@bizy/core 21.8.7 → 21.8.8
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/fesm2022/bizy-core.mjs +57 -9
- package/fesm2022/bizy-core.mjs.map +1 -1
- package/package.json +1 -1
- package/types/bizy-core.d.ts +31 -2
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -9957,17 +9957,32 @@ async function overrideUserAgentUsingClientHints(hints) {
|
|
|
9957
9957
|
}
|
|
9958
9958
|
const exportedForTests = { getVersion, getWindowsPlatformVersion };
|
|
9959
9959
|
|
|
9960
|
+
var BIZY_DEVICE_OS;
|
|
9961
|
+
(function (BIZY_DEVICE_OS) {
|
|
9962
|
+
BIZY_DEVICE_OS["IOS"] = "iOS";
|
|
9963
|
+
BIZY_DEVICE_OS["MAC"] = "Mac";
|
|
9964
|
+
BIZY_DEVICE_OS["ANDROID"] = "Android";
|
|
9965
|
+
BIZY_DEVICE_OS["WINDOWS"] = "Windows";
|
|
9966
|
+
BIZY_DEVICE_OS["LINUX"] = "Linux";
|
|
9967
|
+
})(BIZY_DEVICE_OS || (BIZY_DEVICE_OS = {}));
|
|
9968
|
+
var BIZY_DEVICE_BROWSER;
|
|
9969
|
+
(function (BIZY_DEVICE_BROWSER) {
|
|
9970
|
+
BIZY_DEVICE_BROWSER["CHROME"] = "CHROME";
|
|
9971
|
+
BIZY_DEVICE_BROWSER["SAFARI"] = "SAFARI";
|
|
9972
|
+
BIZY_DEVICE_BROWSER["EDGE"] = "EDGE";
|
|
9973
|
+
BIZY_DEVICE_BROWSER["OPERA"] = "OPERA";
|
|
9974
|
+
BIZY_DEVICE_BROWSER["FIREFOX"] = "FIREFOX";
|
|
9975
|
+
BIZY_DEVICE_BROWSER["UNKNOWN"] = "UNKNOWN";
|
|
9976
|
+
})(BIZY_DEVICE_BROWSER || (BIZY_DEVICE_BROWSER = {}));
|
|
9960
9977
|
class BizyDeviceService {
|
|
9961
9978
|
#device = inject(DeviceDetectorService);
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
}));
|
|
9970
|
-
}
|
|
9979
|
+
windowSizeChange$ = fromEvent(window, 'resize').pipe(map$1((event) => ({
|
|
9980
|
+
width: event.currentTarget.innerWidth,
|
|
9981
|
+
height: event.currentTarget.innerHeight
|
|
9982
|
+
})), startWith({
|
|
9983
|
+
width: window.innerWidth,
|
|
9984
|
+
height: window.innerHeight
|
|
9985
|
+
}));
|
|
9971
9986
|
async getUserAgent() {
|
|
9972
9987
|
try {
|
|
9973
9988
|
const userAgent = await overrideUserAgentUsingClientHints([
|
|
@@ -9984,11 +9999,44 @@ class BizyDeviceService {
|
|
|
9984
9999
|
return window.navigator.userAgent;
|
|
9985
10000
|
}
|
|
9986
10001
|
}
|
|
10002
|
+
getWindowSize = () => {
|
|
10003
|
+
return {
|
|
10004
|
+
width: window.innerWidth,
|
|
10005
|
+
height: window.innerHeight
|
|
10006
|
+
};
|
|
10007
|
+
};
|
|
10008
|
+
getWindowWidth = () => window.innerWidth;
|
|
10009
|
+
getWindowHeight = () => window.innerHeight;
|
|
9987
10010
|
isMobile = () => this.#device.isMobile();
|
|
9988
10011
|
isTablet = () => this.#device.isTablet();
|
|
9989
10012
|
isDesktop = () => this.#device.isDesktop();
|
|
9990
10013
|
isPortrait = () => this.#device.orientation() === 'portrait';
|
|
9991
10014
|
isLandscape = () => this.#device.orientation() === 'landscape';
|
|
10015
|
+
isIOS = () => this.#device.os() === BIZY_DEVICE_OS.IOS;
|
|
10016
|
+
isAndroid = () => this.#device.os() === BIZY_DEVICE_OS.ANDROID;
|
|
10017
|
+
isMacintosh = () => this.#device.os() === BIZY_DEVICE_OS.MAC;
|
|
10018
|
+
isWindows = () => this.#device.os() === BIZY_DEVICE_OS.WINDOWS;
|
|
10019
|
+
isLinux = () => this.#device.os() === BIZY_DEVICE_OS.LINUX;
|
|
10020
|
+
getOS = () => this.#device.os();
|
|
10021
|
+
getBrowser = () => {
|
|
10022
|
+
const browser = this.#device.browser();
|
|
10023
|
+
if (browser.indexOf('Chrome') !== -1) {
|
|
10024
|
+
return BIZY_DEVICE_BROWSER.CHROME;
|
|
10025
|
+
}
|
|
10026
|
+
if (browser.indexOf('Firefox') !== -1) {
|
|
10027
|
+
return BIZY_DEVICE_BROWSER.FIREFOX;
|
|
10028
|
+
}
|
|
10029
|
+
if (browser.indexOf('Safari') !== -1) {
|
|
10030
|
+
return BIZY_DEVICE_BROWSER.SAFARI;
|
|
10031
|
+
}
|
|
10032
|
+
if (browser.indexOf('Edge') !== -1) {
|
|
10033
|
+
return BIZY_DEVICE_BROWSER.EDGE;
|
|
10034
|
+
}
|
|
10035
|
+
if (browser.indexOf('Opera') !== -1 || browser.indexOf('OPR') !== -1) {
|
|
10036
|
+
return BIZY_DEVICE_BROWSER.OPERA;
|
|
10037
|
+
}
|
|
10038
|
+
return BIZY_DEVICE_BROWSER.UNKNOWN;
|
|
10039
|
+
};
|
|
9992
10040
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9993
10041
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDeviceService, providedIn: 'root' });
|
|
9994
10042
|
}
|