@bizy/core 19.10.4 → 19.11.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/fesm2022/bizy-core.mjs +245 -240
- package/fesm2022/bizy-core.mjs.map +1 -1
- package/lib/services/device/device.service.d.ts +12 -0
- package/lib/services/index.d.ts +1 -1
- package/package.json +2 -1
- package/lib/services/user-agent/user-agent.service.d.ts +0 -6
- /package/lib/services/{user-agent → device}/uach-retrofill.d.ts +0 -0
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -34,6 +34,7 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
|
34
34
|
import * as i1$2 from '@angular/router';
|
|
35
35
|
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
|
|
36
36
|
import { Clipboard } from '@angular/cdk/clipboard';
|
|
37
|
+
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
37
38
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
38
39
|
import * as i1$4 from '@angular/platform-browser';
|
|
39
40
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
@@ -4027,242 +4028,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
4027
4028
|
args: [BizyRouterService]
|
|
4028
4029
|
}] }] });
|
|
4029
4030
|
|
|
4030
|
-
/**
|
|
4031
|
-
* Copyright 2020 Google LLC
|
|
4032
|
-
*
|
|
4033
|
-
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
4034
|
-
* you may not use this file except in compliance with the License.
|
|
4035
|
-
* You may obtain a copy of the License at
|
|
4036
|
-
*
|
|
4037
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4038
|
-
*
|
|
4039
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4040
|
-
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
4041
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4042
|
-
* See the License for the specific language governing permissions and
|
|
4043
|
-
* limitations under the License.
|
|
4044
|
-
*/
|
|
4045
|
-
// This function's role is to enable smooth transition to the brave new world of
|
|
4046
|
-
// User-Agent Client Hints. If you have legacy code that relies on
|
|
4047
|
-
// `navigator.userAgent` and which relies on entropy that will go away by
|
|
4048
|
-
// default, you *need* to refactor it to use UA-CH. This function is to be used
|
|
4049
|
-
// as a stop gap, to enable smooth transition during that period.
|
|
4050
|
-
/**
|
|
4051
|
-
* @param {string[]} hints
|
|
4052
|
-
* @return {Promise<string|undefined>} A Promise that resolves to a string if a
|
|
4053
|
-
* UA could be synthesized from client hints, otherwise undefined.
|
|
4054
|
-
*/
|
|
4055
|
-
async function getUserAgentUsingClientHints(hints) {
|
|
4056
|
-
// Helper functions for platform specific strings
|
|
4057
|
-
const GetCrosSpecificString = (values) => {
|
|
4058
|
-
let osCPUFragment = '';
|
|
4059
|
-
if (values.bitness == '64') {
|
|
4060
|
-
if (values.architecture == 'x86') {
|
|
4061
|
-
osCPUFragment = 'x86_64';
|
|
4062
|
-
}
|
|
4063
|
-
else if (values.architecture == 'arm') {
|
|
4064
|
-
osCPUFragment = 'aarch64';
|
|
4065
|
-
}
|
|
4066
|
-
}
|
|
4067
|
-
else if (values.architecture == 'arm' && values.bitness == '32') {
|
|
4068
|
-
osCPUFragment = 'armv7l';
|
|
4069
|
-
}
|
|
4070
|
-
if (osCPUFragment == '') {
|
|
4071
|
-
return `X11; CrOS ${values.platformVersion}`;
|
|
4072
|
-
}
|
|
4073
|
-
return `X11; CrOS ${osCPUFragment} ${values.platformVersion}`;
|
|
4074
|
-
};
|
|
4075
|
-
const GetWindowsSpecificString = (values) => {
|
|
4076
|
-
let osCPUFragment = '';
|
|
4077
|
-
if (values.architecture == 'x86' && values.bitness == '64') {
|
|
4078
|
-
osCPUFragment = '; Win64; x64';
|
|
4079
|
-
}
|
|
4080
|
-
else if (values.architecture == 'arm') {
|
|
4081
|
-
osCPUFragment = '; ARM';
|
|
4082
|
-
}
|
|
4083
|
-
else if (values.wow64 === true) {
|
|
4084
|
-
osCPUFragment = '; WOW64';
|
|
4085
|
-
}
|
|
4086
|
-
return `Windows NT ${getWindowsPlatformVersion(values.platformVersion)}${osCPUFragment}`;
|
|
4087
|
-
};
|
|
4088
|
-
const GetMacSpecificString = (values) => {
|
|
4089
|
-
let newUA = 'Macintosh;';
|
|
4090
|
-
newUA += values.architecture === 'arm' ? ' ARM ' : ' Intel ';
|
|
4091
|
-
newUA += 'Mac OS X ';
|
|
4092
|
-
let macVersion = values.platformVersion;
|
|
4093
|
-
if (macVersion.indexOf('.') > -1) {
|
|
4094
|
-
macVersion = macVersion.split('.').join('_');
|
|
4095
|
-
}
|
|
4096
|
-
newUA += macVersion;
|
|
4097
|
-
return newUA;
|
|
4098
|
-
};
|
|
4099
|
-
const GetAndroidSpecificString = (values) => {
|
|
4100
|
-
let newUA = 'Linux; Android ';
|
|
4101
|
-
newUA += values.platformVersion;
|
|
4102
|
-
if (values.model) {
|
|
4103
|
-
newUA += '; ';
|
|
4104
|
-
newUA += values.model;
|
|
4105
|
-
}
|
|
4106
|
-
return newUA;
|
|
4107
|
-
};
|
|
4108
|
-
const Initialize = (values) => {
|
|
4109
|
-
if (!values.architecture) {
|
|
4110
|
-
values.architecture = 'x86';
|
|
4111
|
-
}
|
|
4112
|
-
if (!values.bitness) {
|
|
4113
|
-
values.bitness = '64';
|
|
4114
|
-
}
|
|
4115
|
-
if (!values.model) {
|
|
4116
|
-
values.model = '';
|
|
4117
|
-
}
|
|
4118
|
-
if (!values.platform) {
|
|
4119
|
-
values.platform = 'Windows';
|
|
4120
|
-
}
|
|
4121
|
-
if (!values.platformVersion) {
|
|
4122
|
-
values.platformVersion = '10.0';
|
|
4123
|
-
}
|
|
4124
|
-
if (!values.wow64) {
|
|
4125
|
-
values.wow64 = false;
|
|
4126
|
-
}
|
|
4127
|
-
return values;
|
|
4128
|
-
};
|
|
4129
|
-
// @ts-ignore-error
|
|
4130
|
-
if (!navigator.userAgentData) {
|
|
4131
|
-
return Promise.resolve('');
|
|
4132
|
-
}
|
|
4133
|
-
// Verify that this is a Chromium-based browser
|
|
4134
|
-
let isChromium = false;
|
|
4135
|
-
let chromiumVersion;
|
|
4136
|
-
// eslint-disable-next-line prefer-regex-literals
|
|
4137
|
-
const isChromeUAPattern = new RegExp('AppleWebKit/537.36 \\(KHTML, like Gecko\\) Chrome/\\d+.\\d+.\\d+.\\d+ (Mobile )?Safari/537.36$');
|
|
4138
|
-
// @ts-ignore-error
|
|
4139
|
-
navigator.userAgentData.brands.forEach(value => {
|
|
4140
|
-
if (value.brand == 'Chromium') {
|
|
4141
|
-
// Let's double check the UA string as well, so we don't accidentally
|
|
4142
|
-
// capture a headless browser or friendly bot (which should report as
|
|
4143
|
-
// HeadlessChrome or something entirely different).
|
|
4144
|
-
isChromium = isChromeUAPattern.test(navigator.userAgent);
|
|
4145
|
-
chromiumVersion = value.version;
|
|
4146
|
-
}
|
|
4147
|
-
});
|
|
4148
|
-
// @ts-ignore
|
|
4149
|
-
if (!isChromium || chromiumVersion < 100) {
|
|
4150
|
-
// If this is not a Chromium-based browser, the UA string should be very
|
|
4151
|
-
// different. Or, if this is a Chromium lower than 100, it doesn't have
|
|
4152
|
-
// all the hints we rely on. So let's bail.
|
|
4153
|
-
return Promise.resolve('');
|
|
4154
|
-
}
|
|
4155
|
-
// Main logic
|
|
4156
|
-
return new Promise(resolve => {
|
|
4157
|
-
// @ts-ignore-error
|
|
4158
|
-
navigator.userAgentData.getHighEntropyValues(hints).then(values => {
|
|
4159
|
-
let initialValues = {
|
|
4160
|
-
// @ts-ignore-error
|
|
4161
|
-
platform: navigator.userAgentData?.platform,
|
|
4162
|
-
version: chromiumVersion
|
|
4163
|
-
};
|
|
4164
|
-
values = Object.assign(initialValues, values);
|
|
4165
|
-
values = Initialize(values);
|
|
4166
|
-
let newUA = 'Mozilla/5.0 (';
|
|
4167
|
-
if (['Chrome OS', 'Chromium OS'].includes(values.platform)) {
|
|
4168
|
-
newUA += GetCrosSpecificString(values);
|
|
4169
|
-
}
|
|
4170
|
-
else if (values.platform == 'Windows') {
|
|
4171
|
-
newUA += GetWindowsSpecificString(values);
|
|
4172
|
-
}
|
|
4173
|
-
else if (values.platform == 'macOS') {
|
|
4174
|
-
newUA += GetMacSpecificString(values);
|
|
4175
|
-
}
|
|
4176
|
-
else if (values.platform == 'Android') {
|
|
4177
|
-
newUA += GetAndroidSpecificString(values);
|
|
4178
|
-
}
|
|
4179
|
-
else {
|
|
4180
|
-
newUA += 'X11; Linux x86_64';
|
|
4181
|
-
}
|
|
4182
|
-
newUA += ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/';
|
|
4183
|
-
newUA += getVersion(values?.fullVersionList, initialValues.version);
|
|
4184
|
-
// @ts-ignore-error
|
|
4185
|
-
if (navigator.userAgentData.mobile) {
|
|
4186
|
-
newUA += ' Mobile';
|
|
4187
|
-
}
|
|
4188
|
-
newUA += ' Safari/537.36';
|
|
4189
|
-
resolve(newUA);
|
|
4190
|
-
});
|
|
4191
|
-
});
|
|
4192
|
-
}
|
|
4193
|
-
function getVersion(fullVersionList, majorVersion) {
|
|
4194
|
-
// If we don't get a fullVersionList, or it's somehow undefined, return
|
|
4195
|
-
// the reduced version number.
|
|
4196
|
-
return (fullVersionList?.find((item) => item.brand == 'Google Chrome')?.version ||
|
|
4197
|
-
`${majorVersion}.0.0.0`);
|
|
4198
|
-
}
|
|
4199
|
-
function getWindowsPlatformVersion(platformVersion) {
|
|
4200
|
-
// https://wicg.github.io/ua-client-hints/#get-the-legacy-windows-version-number
|
|
4201
|
-
const versionMap = new Map([
|
|
4202
|
-
['0.3.0', '6.3'], // Windows 8.1
|
|
4203
|
-
['0.2.0', '6.2'], // Windows 8
|
|
4204
|
-
['0.1.0', '6.1'] // Windows 7
|
|
4205
|
-
]);
|
|
4206
|
-
if (versionMap.has(platformVersion)) {
|
|
4207
|
-
return versionMap.get(platformVersion);
|
|
4208
|
-
}
|
|
4209
|
-
// Windows 10 and above send "Windows NT 10.0"
|
|
4210
|
-
return '10.0';
|
|
4211
|
-
}
|
|
4212
|
-
/**
|
|
4213
|
-
* @param {string[]} hints
|
|
4214
|
-
* @return {Promise<string|undefined>} A Promise that resolves on overriding the
|
|
4215
|
-
* navigator.userAgent string.
|
|
4216
|
-
*/
|
|
4217
|
-
async function overrideUserAgentUsingClientHints(hints) {
|
|
4218
|
-
return new Promise(resolve => {
|
|
4219
|
-
getUserAgentUsingClientHints(hints).then(newUA => {
|
|
4220
|
-
if (newUA) {
|
|
4221
|
-
// Got a new UA value. Now override `navigator.userAgent`.
|
|
4222
|
-
Object.defineProperty(navigator, 'userAgent', {
|
|
4223
|
-
value: newUA,
|
|
4224
|
-
writable: false,
|
|
4225
|
-
configurable: true
|
|
4226
|
-
});
|
|
4227
|
-
}
|
|
4228
|
-
else {
|
|
4229
|
-
newUA = navigator.userAgent;
|
|
4230
|
-
}
|
|
4231
|
-
resolve(newUA);
|
|
4232
|
-
});
|
|
4233
|
-
});
|
|
4234
|
-
}
|
|
4235
|
-
const exportedForTests = { getVersion, getWindowsPlatformVersion };
|
|
4236
|
-
|
|
4237
|
-
class BizyUserAgentService {
|
|
4238
|
-
get() {
|
|
4239
|
-
return new Promise(resolve => {
|
|
4240
|
-
overrideUserAgentUsingClientHints([
|
|
4241
|
-
'architecture',
|
|
4242
|
-
'bitness',
|
|
4243
|
-
'model',
|
|
4244
|
-
'platformVersion',
|
|
4245
|
-
'uaFullVersion',
|
|
4246
|
-
'fullVersionList'
|
|
4247
|
-
])
|
|
4248
|
-
.then(userAgent => {
|
|
4249
|
-
resolve(userAgent);
|
|
4250
|
-
})
|
|
4251
|
-
.catch(() => {
|
|
4252
|
-
resolve(window.navigator.userAgent);
|
|
4253
|
-
});
|
|
4254
|
-
});
|
|
4255
|
-
}
|
|
4256
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BizyUserAgentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4257
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BizyUserAgentService, providedIn: 'root' });
|
|
4258
|
-
}
|
|
4259
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BizyUserAgentService, decorators: [{
|
|
4260
|
-
type: Injectable,
|
|
4261
|
-
args: [{
|
|
4262
|
-
providedIn: 'root'
|
|
4263
|
-
}]
|
|
4264
|
-
}] });
|
|
4265
|
-
|
|
4266
4031
|
class BizyValidatorService {
|
|
4267
4032
|
isEmail(email) {
|
|
4268
4033
|
const regex = /^(([^ñ<>()[\]\\.,;:\s@"]+(\.[^ñ<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
@@ -4562,9 +4327,247 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
4562
4327
|
}]
|
|
4563
4328
|
}] });
|
|
4564
4329
|
|
|
4330
|
+
/**
|
|
4331
|
+
* Copyright 2020 Google LLC
|
|
4332
|
+
*
|
|
4333
|
+
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
4334
|
+
* you may not use this file except in compliance with the License.
|
|
4335
|
+
* You may obtain a copy of the License at
|
|
4336
|
+
*
|
|
4337
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4338
|
+
*
|
|
4339
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4340
|
+
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
4341
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4342
|
+
* See the License for the specific language governing permissions and
|
|
4343
|
+
* limitations under the License.
|
|
4344
|
+
*/
|
|
4345
|
+
// This function's role is to enable smooth transition to the brave new world of
|
|
4346
|
+
// User-Agent Client Hints. If you have legacy code that relies on
|
|
4347
|
+
// `navigator.userAgent` and which relies on entropy that will go away by
|
|
4348
|
+
// default, you *need* to refactor it to use UA-CH. This function is to be used
|
|
4349
|
+
// as a stop gap, to enable smooth transition during that period.
|
|
4350
|
+
/**
|
|
4351
|
+
* @param {string[]} hints
|
|
4352
|
+
* @return {Promise<string|undefined>} A Promise that resolves to a string if a
|
|
4353
|
+
* UA could be synthesized from client hints, otherwise undefined.
|
|
4354
|
+
*/
|
|
4355
|
+
async function getUserAgentUsingClientHints(hints) {
|
|
4356
|
+
// Helper functions for platform specific strings
|
|
4357
|
+
const GetCrosSpecificString = (values) => {
|
|
4358
|
+
let osCPUFragment = '';
|
|
4359
|
+
if (values.bitness == '64') {
|
|
4360
|
+
if (values.architecture == 'x86') {
|
|
4361
|
+
osCPUFragment = 'x86_64';
|
|
4362
|
+
}
|
|
4363
|
+
else if (values.architecture == 'arm') {
|
|
4364
|
+
osCPUFragment = 'aarch64';
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
else if (values.architecture == 'arm' && values.bitness == '32') {
|
|
4368
|
+
osCPUFragment = 'armv7l';
|
|
4369
|
+
}
|
|
4370
|
+
if (osCPUFragment == '') {
|
|
4371
|
+
return `X11; CrOS ${values.platformVersion}`;
|
|
4372
|
+
}
|
|
4373
|
+
return `X11; CrOS ${osCPUFragment} ${values.platformVersion}`;
|
|
4374
|
+
};
|
|
4375
|
+
const GetWindowsSpecificString = (values) => {
|
|
4376
|
+
let osCPUFragment = '';
|
|
4377
|
+
if (values.architecture == 'x86' && values.bitness == '64') {
|
|
4378
|
+
osCPUFragment = '; Win64; x64';
|
|
4379
|
+
}
|
|
4380
|
+
else if (values.architecture == 'arm') {
|
|
4381
|
+
osCPUFragment = '; ARM';
|
|
4382
|
+
}
|
|
4383
|
+
else if (values.wow64 === true) {
|
|
4384
|
+
osCPUFragment = '; WOW64';
|
|
4385
|
+
}
|
|
4386
|
+
return `Windows NT ${getWindowsPlatformVersion(values.platformVersion)}${osCPUFragment}`;
|
|
4387
|
+
};
|
|
4388
|
+
const GetMacSpecificString = (values) => {
|
|
4389
|
+
let newUA = 'Macintosh;';
|
|
4390
|
+
newUA += values.architecture === 'arm' ? ' ARM ' : ' Intel ';
|
|
4391
|
+
newUA += 'Mac OS X ';
|
|
4392
|
+
let macVersion = values.platformVersion;
|
|
4393
|
+
if (macVersion.indexOf('.') > -1) {
|
|
4394
|
+
macVersion = macVersion.split('.').join('_');
|
|
4395
|
+
}
|
|
4396
|
+
newUA += macVersion;
|
|
4397
|
+
return newUA;
|
|
4398
|
+
};
|
|
4399
|
+
const GetAndroidSpecificString = (values) => {
|
|
4400
|
+
let newUA = 'Linux; Android ';
|
|
4401
|
+
newUA += values.platformVersion;
|
|
4402
|
+
if (values.model) {
|
|
4403
|
+
newUA += '; ';
|
|
4404
|
+
newUA += values.model;
|
|
4405
|
+
}
|
|
4406
|
+
return newUA;
|
|
4407
|
+
};
|
|
4408
|
+
const Initialize = (values) => {
|
|
4409
|
+
if (!values.architecture) {
|
|
4410
|
+
values.architecture = 'x86';
|
|
4411
|
+
}
|
|
4412
|
+
if (!values.bitness) {
|
|
4413
|
+
values.bitness = '64';
|
|
4414
|
+
}
|
|
4415
|
+
if (!values.model) {
|
|
4416
|
+
values.model = '';
|
|
4417
|
+
}
|
|
4418
|
+
if (!values.platform) {
|
|
4419
|
+
values.platform = 'Windows';
|
|
4420
|
+
}
|
|
4421
|
+
if (!values.platformVersion) {
|
|
4422
|
+
values.platformVersion = '10.0';
|
|
4423
|
+
}
|
|
4424
|
+
if (!values.wow64) {
|
|
4425
|
+
values.wow64 = false;
|
|
4426
|
+
}
|
|
4427
|
+
return values;
|
|
4428
|
+
};
|
|
4429
|
+
// @ts-ignore-error
|
|
4430
|
+
if (!navigator.userAgentData) {
|
|
4431
|
+
return Promise.resolve('');
|
|
4432
|
+
}
|
|
4433
|
+
// Verify that this is a Chromium-based browser
|
|
4434
|
+
let isChromium = false;
|
|
4435
|
+
let chromiumVersion;
|
|
4436
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
4437
|
+
const isChromeUAPattern = new RegExp('AppleWebKit/537.36 \\(KHTML, like Gecko\\) Chrome/\\d+.\\d+.\\d+.\\d+ (Mobile )?Safari/537.36$');
|
|
4438
|
+
// @ts-ignore-error
|
|
4439
|
+
navigator.userAgentData.brands.forEach(value => {
|
|
4440
|
+
if (value.brand == 'Chromium') {
|
|
4441
|
+
// Let's double check the UA string as well, so we don't accidentally
|
|
4442
|
+
// capture a headless browser or friendly bot (which should report as
|
|
4443
|
+
// HeadlessChrome or something entirely different).
|
|
4444
|
+
isChromium = isChromeUAPattern.test(navigator.userAgent);
|
|
4445
|
+
chromiumVersion = value.version;
|
|
4446
|
+
}
|
|
4447
|
+
});
|
|
4448
|
+
// @ts-ignore
|
|
4449
|
+
if (!isChromium || chromiumVersion < 100) {
|
|
4450
|
+
// If this is not a Chromium-based browser, the UA string should be very
|
|
4451
|
+
// different. Or, if this is a Chromium lower than 100, it doesn't have
|
|
4452
|
+
// all the hints we rely on. So let's bail.
|
|
4453
|
+
return Promise.resolve('');
|
|
4454
|
+
}
|
|
4455
|
+
// Main logic
|
|
4456
|
+
return new Promise(resolve => {
|
|
4457
|
+
// @ts-ignore-error
|
|
4458
|
+
navigator.userAgentData.getHighEntropyValues(hints).then(values => {
|
|
4459
|
+
let initialValues = {
|
|
4460
|
+
// @ts-ignore-error
|
|
4461
|
+
platform: navigator.userAgentData?.platform,
|
|
4462
|
+
version: chromiumVersion
|
|
4463
|
+
};
|
|
4464
|
+
values = Object.assign(initialValues, values);
|
|
4465
|
+
values = Initialize(values);
|
|
4466
|
+
let newUA = 'Mozilla/5.0 (';
|
|
4467
|
+
if (['Chrome OS', 'Chromium OS'].includes(values.platform)) {
|
|
4468
|
+
newUA += GetCrosSpecificString(values);
|
|
4469
|
+
}
|
|
4470
|
+
else if (values.platform == 'Windows') {
|
|
4471
|
+
newUA += GetWindowsSpecificString(values);
|
|
4472
|
+
}
|
|
4473
|
+
else if (values.platform == 'macOS') {
|
|
4474
|
+
newUA += GetMacSpecificString(values);
|
|
4475
|
+
}
|
|
4476
|
+
else if (values.platform == 'Android') {
|
|
4477
|
+
newUA += GetAndroidSpecificString(values);
|
|
4478
|
+
}
|
|
4479
|
+
else {
|
|
4480
|
+
newUA += 'X11; Linux x86_64';
|
|
4481
|
+
}
|
|
4482
|
+
newUA += ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/';
|
|
4483
|
+
newUA += getVersion(values?.fullVersionList, initialValues.version);
|
|
4484
|
+
// @ts-ignore-error
|
|
4485
|
+
if (navigator.userAgentData.mobile) {
|
|
4486
|
+
newUA += ' Mobile';
|
|
4487
|
+
}
|
|
4488
|
+
newUA += ' Safari/537.36';
|
|
4489
|
+
resolve(newUA);
|
|
4490
|
+
});
|
|
4491
|
+
});
|
|
4492
|
+
}
|
|
4493
|
+
function getVersion(fullVersionList, majorVersion) {
|
|
4494
|
+
// If we don't get a fullVersionList, or it's somehow undefined, return
|
|
4495
|
+
// the reduced version number.
|
|
4496
|
+
return (fullVersionList?.find((item) => item.brand == 'Google Chrome')?.version ||
|
|
4497
|
+
`${majorVersion}.0.0.0`);
|
|
4498
|
+
}
|
|
4499
|
+
function getWindowsPlatformVersion(platformVersion) {
|
|
4500
|
+
// https://wicg.github.io/ua-client-hints/#get-the-legacy-windows-version-number
|
|
4501
|
+
const versionMap = new Map([
|
|
4502
|
+
['0.3.0', '6.3'], // Windows 8.1
|
|
4503
|
+
['0.2.0', '6.2'], // Windows 8
|
|
4504
|
+
['0.1.0', '6.1'] // Windows 7
|
|
4505
|
+
]);
|
|
4506
|
+
if (versionMap.has(platformVersion)) {
|
|
4507
|
+
return versionMap.get(platformVersion);
|
|
4508
|
+
}
|
|
4509
|
+
// Windows 10 and above send "Windows NT 10.0"
|
|
4510
|
+
return '10.0';
|
|
4511
|
+
}
|
|
4512
|
+
/**
|
|
4513
|
+
* @param {string[]} hints
|
|
4514
|
+
* @return {Promise<string|undefined>} A Promise that resolves on overriding the
|
|
4515
|
+
* navigator.userAgent string.
|
|
4516
|
+
*/
|
|
4517
|
+
async function overrideUserAgentUsingClientHints(hints) {
|
|
4518
|
+
return new Promise(resolve => {
|
|
4519
|
+
getUserAgentUsingClientHints(hints).then(newUA => {
|
|
4520
|
+
if (newUA) {
|
|
4521
|
+
// Got a new UA value. Now override `navigator.userAgent`.
|
|
4522
|
+
Object.defineProperty(navigator, 'userAgent', {
|
|
4523
|
+
value: newUA,
|
|
4524
|
+
writable: false,
|
|
4525
|
+
configurable: true
|
|
4526
|
+
});
|
|
4527
|
+
}
|
|
4528
|
+
else {
|
|
4529
|
+
newUA = navigator.userAgent;
|
|
4530
|
+
}
|
|
4531
|
+
resolve(newUA);
|
|
4532
|
+
});
|
|
4533
|
+
});
|
|
4534
|
+
}
|
|
4535
|
+
const exportedForTests = { getVersion, getWindowsPlatformVersion };
|
|
4536
|
+
|
|
4537
|
+
class BizyDeviceService {
|
|
4538
|
+
#device = inject(DeviceDetectorService);
|
|
4539
|
+
async getUserAgent() {
|
|
4540
|
+
try {
|
|
4541
|
+
const userAgent = await overrideUserAgentUsingClientHints([
|
|
4542
|
+
'architecture',
|
|
4543
|
+
'bitness',
|
|
4544
|
+
'model',
|
|
4545
|
+
'platformVersion',
|
|
4546
|
+
'uaFullVersion',
|
|
4547
|
+
'fullVersionList'
|
|
4548
|
+
]);
|
|
4549
|
+
return userAgent;
|
|
4550
|
+
}
|
|
4551
|
+
catch {
|
|
4552
|
+
return window.navigator.userAgent;
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4555
|
+
isMobile = () => this.#device.isMobile();
|
|
4556
|
+
isTablet = () => this.#device.isTablet();
|
|
4557
|
+
isDesktop = () => this.#device.isDesktop();
|
|
4558
|
+
isPortrait = () => this.#device.orientation === 'portrait';
|
|
4559
|
+
isLandscape = () => this.#device.orientation === 'landscape';
|
|
4560
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BizyDeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4561
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BizyDeviceService, providedIn: 'root' });
|
|
4562
|
+
}
|
|
4563
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BizyDeviceService, decorators: [{
|
|
4564
|
+
type: Injectable,
|
|
4565
|
+
args: [{ providedIn: 'root' }]
|
|
4566
|
+
}] });
|
|
4567
|
+
|
|
4565
4568
|
const SERVICES = [
|
|
4566
4569
|
BizyAnimationService,
|
|
4567
|
-
|
|
4570
|
+
BizyDeviceService,
|
|
4568
4571
|
BizyCacheService,
|
|
4569
4572
|
BizyCopyToClipboardService,
|
|
4570
4573
|
BizyExportToCSVService,
|
|
@@ -4624,8 +4627,10 @@ class BizyPopupService {
|
|
|
4624
4627
|
dialogRef = Array.from(BizyPopupService.dialogs).pop();
|
|
4625
4628
|
}
|
|
4626
4629
|
if (dialogRef) {
|
|
4627
|
-
|
|
4628
|
-
|
|
4630
|
+
if (dialogRef.componentInstance instanceof BizyFullScreenPopupWrapperComponent) {
|
|
4631
|
+
const nativeElement = dialogRef.overlayRef.overlayElement;
|
|
4632
|
+
await this.#animation.setAnimation(nativeElement, BIZY_ANIMATION.SLIDE_OUT_DOWN);
|
|
4633
|
+
}
|
|
4629
4634
|
dialogRef.close(data ? data.response : null);
|
|
4630
4635
|
BizyPopupService.dialogs.delete(dialogRef);
|
|
4631
4636
|
}
|
|
@@ -7744,5 +7749,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImpor
|
|
|
7744
7749
|
* Generated bundle index. Do not edit.
|
|
7745
7750
|
*/
|
|
7746
7751
|
|
|
7747
|
-
export { BIZY_ANIMATION, BIZY_CALENDAR_DAY, BIZY_CALENDAR_EVENT_ACTION, BIZY_CALENDAR_LANGUAGE, BIZY_CALENDAR_MODE, BIZY_FORMAT_SECONDS_FORMAT, BIZY_FORMAT_SECONDS_LANGUAGE, BIZY_SKELETON_SHAPE, BIZY_TAG_TYPE, BizyAccordionComponent, BizyAccordionModule, BizyAnimationService, BizyAudioPlayerComponent, BizyAudioPlayerModule, BizyAutoFocusDirective, BizyAveragePipe, BizyBarLineChartComponent, BizyBarLineChartModule, BizyBreadcrumbComponent, BizyBreadcrumbModule, BizyButtonComponent, BizyButtonModule, BizyCacheService, BizyCalendarComponent, BizyCalendarModule, BizyCardComponent, BizyCardModule, BizyCheckboxComponent, BizyCheckboxModule, BizyCopyToClipboardDirective, BizyCopyToClipboardService, BizyCurrencyFormatDirective, BizyDatePickerComponent, BizyDatePickerModule, BizyDirectivesModule, BizyEnumToArrayPipe, BizyExportToCSVService, BizyExtractNumbersPipe, BizyFileUploaderComponent, BizyFileUploaderModule, BizyFileUploaderService, BizyFilterComponent, BizyFilterContentComponent, BizyFilterModule, BizyFilterPipe, BizyFilterSectionCheckboxOptionComponent, BizyFilterSectionComponent, BizyFilterSectionRangeOptionComponent, BizyFilterSectionSearchOptionComponent, BizyFilterSectionsComponent, BizyFormComponent, BizyFormModule, BizyFormatSecondsPipe, BizyFormatSecondsService, BizyFullScreenPopupWrapperComponent, BizyGridComponent, BizyGridForDirective, BizyGridModule, BizyGridRowComponent, BizyInputComponent, BizyInputModule, BizyInputOptionComponent, BizyKeyboardService, BizyListComponent, BizyListModule, BizyLoadingDirective, BizyLogService, BizyLongPressDirective, BizyMenuComponent, BizyMenuModule, BizyMenuOptionComponent, BizyMenuTitleComponent, BizyOnlyNumbersDirective, BizyOnlyPhoneDigitsDirective, BizyOrderByPipe, BizyPieChartComponent, BizyPieChartModule, BizyPipesModule, BizyPopupModule, BizyPopupService, BizyPopupWrapperComponent, BizyRadioComponent, BizyRadioModule, BizyRangeFilterPipe, BizyReducePipe, BizyRepeatPipe, BizyRouterService, BizySafePipe, BizySearchPipe, BizySectionCenterComponent, BizySectionComponent, BizySectionEndComponent, BizySectionModule, BizySectionStartComponent, BizySelectComponent, BizySelectModule, BizySelectOptionComponent, BizySelectedPipe, BizyServicesModule, BizySetToArrayPipe, BizySidebarComponent, BizySidebarFloatingOptionComponent, BizySidebarFloatingOptionTitleComponent, BizySidebarModule, BizySidebarOptionComponent, BizySkeletonComponent, BizySkeletonModule, BizySliderComponent, BizySliderModule, BizyStorageService, BizyTabComponent, BizyTableColumnArrowsComponent, BizyTableColumnComponent, BizyTableColumnFixedDirective, BizyTableComponent, BizyTableFooterComponent, BizyTableHeaderComponent, BizyTableModule, BizyTableRowComponent, BizyTableRowExpandContentComponent, BizyTableScrollingComponent, BizyTableScrollingDirective, BizyTabsComponent, BizyTabsModule, BizyTagComponent, BizyTagModule, BizyTextEllipsisDirective, BizyToastModule, BizyToastService, BizyToastWrapperComponent, BizyToggleComponent, BizyToggleModule, BizyToolbarComponent, BizyToolbarModule, BizyTooltipDirective, BizyTrackByIdDirective, BizyTranslateModule, BizyTranslatePipe, BizyTranslateService,
|
|
7752
|
+
export { BIZY_ANIMATION, BIZY_CALENDAR_DAY, BIZY_CALENDAR_EVENT_ACTION, BIZY_CALENDAR_LANGUAGE, BIZY_CALENDAR_MODE, BIZY_FORMAT_SECONDS_FORMAT, BIZY_FORMAT_SECONDS_LANGUAGE, BIZY_SKELETON_SHAPE, BIZY_TAG_TYPE, BizyAccordionComponent, BizyAccordionModule, BizyAnimationService, BizyAudioPlayerComponent, BizyAudioPlayerModule, BizyAutoFocusDirective, BizyAveragePipe, BizyBarLineChartComponent, BizyBarLineChartModule, BizyBreadcrumbComponent, BizyBreadcrumbModule, BizyButtonComponent, BizyButtonModule, BizyCacheService, BizyCalendarComponent, BizyCalendarModule, BizyCardComponent, BizyCardModule, BizyCheckboxComponent, BizyCheckboxModule, BizyCopyToClipboardDirective, BizyCopyToClipboardService, BizyCurrencyFormatDirective, BizyDatePickerComponent, BizyDatePickerModule, BizyDeviceService, BizyDirectivesModule, BizyEnumToArrayPipe, BizyExportToCSVService, BizyExtractNumbersPipe, BizyFileUploaderComponent, BizyFileUploaderModule, BizyFileUploaderService, BizyFilterComponent, BizyFilterContentComponent, BizyFilterModule, BizyFilterPipe, BizyFilterSectionCheckboxOptionComponent, BizyFilterSectionComponent, BizyFilterSectionRangeOptionComponent, BizyFilterSectionSearchOptionComponent, BizyFilterSectionsComponent, BizyFormComponent, BizyFormModule, BizyFormatSecondsPipe, BizyFormatSecondsService, BizyFullScreenPopupWrapperComponent, BizyGridComponent, BizyGridForDirective, BizyGridModule, BizyGridRowComponent, BizyInputComponent, BizyInputModule, BizyInputOptionComponent, BizyKeyboardService, BizyListComponent, BizyListModule, BizyLoadingDirective, BizyLogService, BizyLongPressDirective, BizyMenuComponent, BizyMenuModule, BizyMenuOptionComponent, BizyMenuTitleComponent, BizyOnlyNumbersDirective, BizyOnlyPhoneDigitsDirective, BizyOrderByPipe, BizyPieChartComponent, BizyPieChartModule, BizyPipesModule, BizyPopupModule, BizyPopupService, BizyPopupWrapperComponent, BizyRadioComponent, BizyRadioModule, BizyRangeFilterPipe, BizyReducePipe, BizyRepeatPipe, BizyRouterService, BizySafePipe, BizySearchPipe, BizySectionCenterComponent, BizySectionComponent, BizySectionEndComponent, BizySectionModule, BizySectionStartComponent, BizySelectComponent, BizySelectModule, BizySelectOptionComponent, BizySelectedPipe, BizyServicesModule, BizySetToArrayPipe, BizySidebarComponent, BizySidebarFloatingOptionComponent, BizySidebarFloatingOptionTitleComponent, BizySidebarModule, BizySidebarOptionComponent, BizySkeletonComponent, BizySkeletonModule, BizySliderComponent, BizySliderModule, BizyStorageService, BizyTabComponent, BizyTableColumnArrowsComponent, BizyTableColumnComponent, BizyTableColumnFixedDirective, BizyTableComponent, BizyTableFooterComponent, BizyTableHeaderComponent, BizyTableModule, BizyTableRowComponent, BizyTableRowExpandContentComponent, BizyTableScrollingComponent, BizyTableScrollingDirective, BizyTabsComponent, BizyTabsModule, BizyTagComponent, BizyTagModule, BizyTextEllipsisDirective, BizyToastModule, BizyToastService, BizyToastWrapperComponent, BizyToggleComponent, BizyToggleModule, BizyToolbarComponent, BizyToolbarModule, BizyTooltipDirective, BizyTrackByIdDirective, BizyTranslateModule, BizyTranslatePipe, BizyTranslateService, BizyValidatorService, BizyViewportService, LANGUAGE, LOADING_TYPE, MIME_TYPE };
|
|
7748
7753
|
//# sourceMappingURL=bizy-core.mjs.map
|