@startlibs/utils 1.0.3 → 1.0.4
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/lib/index.js +29 -12
- package/package.json +1 -1
- package/yarn-error.log +3643 -0
package/lib/index.js
CHANGED
|
@@ -574,7 +574,11 @@ function () {
|
|
|
574
574
|
case 0:
|
|
575
575
|
return _context4.abrupt("return", innerFetcher(addQueryString(url, jsonParams), _objectSpread({
|
|
576
576
|
method: 'GET'
|
|
577
|
-
}, fetchOptions
|
|
577
|
+
}, fetchOptions, {
|
|
578
|
+
headers: _objectSpread({
|
|
579
|
+
'X-Requested-With': 'XMLHttpRequest'
|
|
580
|
+
}, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers)
|
|
581
|
+
})));
|
|
578
582
|
|
|
579
583
|
case 1:
|
|
580
584
|
case "end":
|
|
@@ -881,7 +885,7 @@ var getFrameOffset = function getFrameOffset(i, total) {
|
|
|
881
885
|
};
|
|
882
886
|
|
|
883
887
|
var emotion = createEmotion({
|
|
884
|
-
nonce: 'animation_nonce'
|
|
888
|
+
nonce: typeof document !== 'undefined' && (document.querySelector('meta[property="csp-nonce"]') || {}).content || 'animation_nonce'
|
|
885
889
|
});
|
|
886
890
|
var oneWayAnimation = function oneWayAnimation() {
|
|
887
891
|
for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
@@ -1435,6 +1439,16 @@ var useEventListener = function useEventListener(eventName, callback) {
|
|
|
1435
1439
|
};
|
|
1436
1440
|
}, deps);
|
|
1437
1441
|
};
|
|
1442
|
+
var useEventListenerIf = function useEventListenerIf(check, eventName, callback) {
|
|
1443
|
+
var deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1444
|
+
useEffect(function () {
|
|
1445
|
+
if (!check()) return;
|
|
1446
|
+
window.addEventListener(eventName, callback);
|
|
1447
|
+
return function () {
|
|
1448
|
+
return window.removeEventListener(eventName, callback);
|
|
1449
|
+
};
|
|
1450
|
+
}, deps);
|
|
1451
|
+
};
|
|
1438
1452
|
var useEventListenerFor = function useEventListenerFor(element, eventName, callback) {
|
|
1439
1453
|
var deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1440
1454
|
useEffect(function () {
|
|
@@ -1629,20 +1643,23 @@ function isRetina() {
|
|
|
1629
1643
|
return (window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches) || window.devicePixelRatio && window.devicePixelRatio >= 2) && /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
|
|
1630
1644
|
}
|
|
1631
1645
|
function isMobile() {
|
|
1632
|
-
|
|
1646
|
+
if (typeof navigator === 'undefined') return false;
|
|
1647
|
+
var ua = navigator.userAgent;
|
|
1648
|
+
var isAndroid = /android/i.test(ua);
|
|
1649
|
+
var isiOS = /iphone|ipod|ipad/i.test(ua); // iPadOS 13+ reports "Macintosh" but has touch
|
|
1633
1650
|
|
|
1634
|
-
|
|
1635
|
-
|
|
1651
|
+
var isIPadOS = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
1652
|
+
return isAndroid || isiOS || isIPadOS;
|
|
1653
|
+
}
|
|
1654
|
+
function isAndroid() {
|
|
1655
|
+
if (navigator.userAgentData) {
|
|
1656
|
+
return navigator.userAgentData.platform === "Android";
|
|
1636
1657
|
}
|
|
1637
1658
|
|
|
1638
|
-
|
|
1639
|
-
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ -/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4))) check = true;
|
|
1640
|
-
})(navigator.userAgent || navigator.vendor || window['opera']);
|
|
1641
|
-
|
|
1642
|
-
return check;
|
|
1659
|
+
return /Android/i.test(navigator.userAgent);
|
|
1643
1660
|
}
|
|
1644
1661
|
var isPWA = function isPWA() {
|
|
1645
|
-
return window.matchMedia && window.matchMedia("(display-mode: standalone)").matches;
|
|
1662
|
+
return window.matchMedia && window.matchMedia("(display-mode: standalone)").matches || !!window.hasWebviewBridge;
|
|
1646
1663
|
};
|
|
1647
1664
|
function isTouchDevice() {
|
|
1648
1665
|
return window.document && 'ontouchstart' in window.document.documentElement;
|
|
@@ -2379,4 +2396,4 @@ var parseDecimalToNumber = function parseDecimalToNumber(v) {
|
|
|
2379
2396
|
return _isString(v) ? Number(v.replace(/\./g, '').replace(',', ".")) : v || 0;
|
|
2380
2397
|
};
|
|
2381
2398
|
|
|
2382
|
-
export { Action, COMPLETE_ACTION, DAY, FETCH, HOUR, MINUTE, MONTH, REDUCE, SECOND, SKIPPED_ACTION, SKIP_DISPATCH, SKIP_FETCH, SkipAction, WEEK, YEAR, _s, activateActions, addExtraProp, addHttp, addQueryString, addZero, animationTiming, asciify, asyncDebounce, blockDiffIntervals, callIfFunction, callIfFunctions, callMany, cancelableTimer, compareBest, concatSelectors, constrainEvent, createPressAndHoldEvent, createPressAndMoveEvent, createPressEvent, createPromiseQueue, createPromiseResolverPair, createSimplePromiseLock, customTheme, diffIntervals, digitsToPattern, ellipsis, fixMediaQuery, formFetch, formFetchWithResponse, formatDate, formatDateToPattern, formatHour, formatJoin, formatJoinArr, formatPath, getClosestOffsetScroll, getColor, getFetcher, getFetcherWithResponse, getMargin, getNumberInputType, getNumberInputType2, getScrollParent, getStartOfDay, getUID, getUrlParams, identityFn, identityOpacityFrames, identityTranslateFrames, ifNotProp, ifProp, ifPropEquals, ifUndefined, intToHour, intervalsIntersect, intervalsIntersectExclusive, intervalsIntersection, intsToHour, isElementInView, isEmptyHtml, isHighDensity, isIOS, isIPad, isMobile, isPWA, isRetina, isSameDay, isShallowEqual, isShallowEqualSameKeys, isSmallDevice, isTouchDevice, isUrl, lazyValue, linkRegex, mapGetOrSet, media, normalizeMouse, normalizePress, normalizeText, normalizeTextUrl, normalizeTouch, notPrinterMedia, oneWayAnimation, parseDate, parseDecimalToNumber, postFetcher, postFetcherWithResponse, preventDefault, printerMedia, promiseMapReduce, prop, queryStringToObj, rafThrottle, removeAccents, safeNewLineToBr, scrollIntoViewWithOffset, scrollWidth, selectPath, smoothScroll, startBlockDiffIntervals, stopPropagation, styledExtend, timerPromise, toHighest, toLowest, touchClick, twoWayAnimation, useEventListener, useEventListenerFor, using, vheight, will, willFormatDecimal, willRafThrottle, wrapLazy };
|
|
2399
|
+
export { Action, COMPLETE_ACTION, DAY, FETCH, HOUR, MINUTE, MONTH, REDUCE, SECOND, SKIPPED_ACTION, SKIP_DISPATCH, SKIP_FETCH, SkipAction, WEEK, YEAR, _s, activateActions, addExtraProp, addHttp, addQueryString, addZero, animationTiming, asciify, asyncDebounce, blockDiffIntervals, callIfFunction, callIfFunctions, callMany, cancelableTimer, compareBest, concatSelectors, constrainEvent, createPressAndHoldEvent, createPressAndMoveEvent, createPressEvent, createPromiseQueue, createPromiseResolverPair, createSimplePromiseLock, customTheme, diffIntervals, digitsToPattern, ellipsis, fixMediaQuery, formFetch, formFetchWithResponse, formatDate, formatDateToPattern, formatHour, formatJoin, formatJoinArr, formatPath, getClosestOffsetScroll, getColor, getFetcher, getFetcherWithResponse, getMargin, getNumberInputType, getNumberInputType2, getScrollParent, getStartOfDay, getUID, getUrlParams, identityFn, identityOpacityFrames, identityTranslateFrames, ifNotProp, ifProp, ifPropEquals, ifUndefined, intToHour, intervalsIntersect, intervalsIntersectExclusive, intervalsIntersection, intsToHour, isAndroid, isElementInView, isEmptyHtml, isHighDensity, isIOS, isIPad, isMobile, isPWA, isRetina, isSameDay, isShallowEqual, isShallowEqualSameKeys, isSmallDevice, isTouchDevice, isUrl, lazyValue, linkRegex, mapGetOrSet, media, normalizeMouse, normalizePress, normalizeText, normalizeTextUrl, normalizeTouch, notPrinterMedia, oneWayAnimation, parseDate, parseDecimalToNumber, postFetcher, postFetcherWithResponse, preventDefault, printerMedia, promiseMapReduce, prop, queryStringToObj, rafThrottle, removeAccents, safeNewLineToBr, scrollIntoViewWithOffset, scrollWidth, selectPath, smoothScroll, startBlockDiffIntervals, stopPropagation, styledExtend, timerPromise, toHighest, toLowest, touchClick, twoWayAnimation, useEventListener, useEventListenerFor, useEventListenerIf, using, vheight, will, willFormatDecimal, willRafThrottle, wrapLazy };
|