feat: initial build - static app kapp-pwa
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,215 @@
|
||||
(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([[5168],{
|
||||
|
||||
/***/ 55168:
|
||||
/*!********************************************************!*\
|
||||
!*** ./node_modules/@capacitor/device/dist/esm/web.js ***!
|
||||
\********************************************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "DeviceWeb": () => (/* binding */ DeviceWeb)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 71670);
|
||||
/* harmony import */ var _capacitor_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @capacitor/core */ 26549);
|
||||
|
||||
|
||||
class DeviceWeb extends _capacitor_core__WEBPACK_IMPORTED_MODULE_1__.WebPlugin {
|
||||
getId() {
|
||||
var _this = this;
|
||||
|
||||
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
|
||||
return {
|
||||
identifier: _this.getUid()
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
getInfo() {
|
||||
var _this2 = this;
|
||||
|
||||
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
|
||||
if (typeof navigator === 'undefined' || !navigator.userAgent) {
|
||||
throw _this2.unavailable('Device API not available in this browser');
|
||||
}
|
||||
|
||||
const ua = navigator.userAgent;
|
||||
|
||||
const uaFields = _this2.parseUa(ua);
|
||||
|
||||
return {
|
||||
model: uaFields.model,
|
||||
platform: 'web',
|
||||
operatingSystem: uaFields.operatingSystem,
|
||||
osVersion: uaFields.osVersion,
|
||||
manufacturer: navigator.vendor,
|
||||
isVirtual: false,
|
||||
webViewVersion: uaFields.browserVersion
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
getBatteryInfo() {
|
||||
var _this3 = this;
|
||||
|
||||
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
|
||||
if (typeof navigator === 'undefined' || !navigator.getBattery) {
|
||||
throw _this3.unavailable('Device API not available in this browser');
|
||||
}
|
||||
|
||||
let battery = {};
|
||||
|
||||
try {
|
||||
battery = yield navigator.getBattery();
|
||||
} catch (e) {// Let it fail, we don't care
|
||||
}
|
||||
|
||||
return {
|
||||
batteryLevel: battery.level,
|
||||
isCharging: battery.charging
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
getLanguageCode() {
|
||||
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
|
||||
return {
|
||||
value: navigator.language.split('-')[0].toLowerCase()
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
getLanguageTag() {
|
||||
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
|
||||
return {
|
||||
value: navigator.language
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
parseUa(ua) {
|
||||
const uaFields = {};
|
||||
const start = ua.indexOf('(') + 1;
|
||||
let end = ua.indexOf(') AppleWebKit');
|
||||
|
||||
if (ua.indexOf(') Gecko') !== -1) {
|
||||
end = ua.indexOf(') Gecko');
|
||||
}
|
||||
|
||||
const fields = ua.substring(start, end);
|
||||
|
||||
if (ua.indexOf('Android') !== -1) {
|
||||
const tmpFields = fields.replace('; wv', '').split('; ').pop();
|
||||
|
||||
if (tmpFields) {
|
||||
uaFields.model = tmpFields.split(' Build')[0];
|
||||
}
|
||||
|
||||
uaFields.osVersion = fields.split('; ')[1];
|
||||
} else {
|
||||
uaFields.model = fields.split('; ')[0];
|
||||
|
||||
if (typeof navigator !== 'undefined' && navigator.oscpu) {
|
||||
uaFields.osVersion = navigator.oscpu;
|
||||
} else {
|
||||
if (ua.indexOf('Windows') !== -1) {
|
||||
uaFields.osVersion = fields;
|
||||
} else {
|
||||
const tmpFields = fields.split('; ').pop();
|
||||
|
||||
if (tmpFields) {
|
||||
const lastParts = tmpFields.replace(' like Mac OS X', '').split(' ');
|
||||
uaFields.osVersion = lastParts[lastParts.length - 1].replace(/_/g, '.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (/android/i.test(ua)) {
|
||||
uaFields.operatingSystem = 'android';
|
||||
} else if (/iPad|iPhone|iPod/.test(ua) && !window.MSStream) {
|
||||
uaFields.operatingSystem = 'ios';
|
||||
} else if (/Win/.test(ua)) {
|
||||
uaFields.operatingSystem = 'windows';
|
||||
} else if (/Mac/i.test(ua)) {
|
||||
uaFields.operatingSystem = 'mac';
|
||||
} else {
|
||||
uaFields.operatingSystem = 'unknown';
|
||||
} // Check for browsers based on non-standard javascript apis, only not user agent
|
||||
|
||||
|
||||
const isSafari = !!window.ApplePaySession;
|
||||
const isChrome = !!window.chrome;
|
||||
const isFirefox = /Firefox/.test(ua);
|
||||
const isEdge = /Edg/.test(ua);
|
||||
const isFirefoxIOS = /FxiOS/.test(ua);
|
||||
const isChromeIOS = /CriOS/.test(ua);
|
||||
const isEdgeIOS = /EdgiOS/.test(ua); // FF and Edge User Agents both end with "/MAJOR.MINOR"
|
||||
|
||||
if (isSafari || isChrome && !isEdge || isFirefoxIOS || isChromeIOS || isEdgeIOS) {
|
||||
// Safari version comes as "... Version/MAJOR.MINOR ..."
|
||||
// Chrome version comes as "... Chrome/MAJOR.MINOR ..."
|
||||
// FirefoxIOS version comes as "... FxiOS/MAJOR.MINOR ..."
|
||||
// ChromeIOS version comes as "... CriOS/MAJOR.MINOR ..."
|
||||
let searchWord;
|
||||
|
||||
if (isFirefoxIOS) {
|
||||
searchWord = 'FxiOS';
|
||||
} else if (isChromeIOS) {
|
||||
searchWord = 'CriOS';
|
||||
} else if (isEdgeIOS) {
|
||||
searchWord = 'EdgiOS';
|
||||
} else if (isSafari) {
|
||||
searchWord = 'Version';
|
||||
} else {
|
||||
searchWord = 'Chrome';
|
||||
}
|
||||
|
||||
const words = ua.split(' ');
|
||||
|
||||
for (const word of words) {
|
||||
if (word.includes(searchWord)) {
|
||||
const version = word.split('/')[1];
|
||||
uaFields.browserVersion = version;
|
||||
}
|
||||
}
|
||||
} else if (isFirefox || isEdge) {
|
||||
const reverseUA = ua.split('').reverse().join('');
|
||||
const reverseVersion = reverseUA.split('/')[0];
|
||||
const version = reverseVersion.split('').reverse().join('');
|
||||
uaFields.browserVersion = version;
|
||||
}
|
||||
|
||||
return uaFields;
|
||||
}
|
||||
|
||||
getUid() {
|
||||
if (typeof window !== 'undefined' && window.localStorage) {
|
||||
let uid = window.localStorage.getItem('_capuid');
|
||||
|
||||
if (uid) {
|
||||
return uid;
|
||||
}
|
||||
|
||||
uid = this.uuid4();
|
||||
window.localStorage.setItem('_capuid', uid);
|
||||
return uid;
|
||||
}
|
||||
|
||||
return this.uuid4();
|
||||
}
|
||||
|
||||
uuid4() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
const r = Math.random() * 16 | 0,
|
||||
v = c === 'x' ? r : r & 0x3 | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***/ })
|
||||
|
||||
}])
|
||||
//# sourceMappingURL=5168.js.map
|
||||
Reference in New Issue
Block a user