@capgo/capacitor-webview-version-checker 8.0.0 → 8.1.1
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/README.md +86 -17
- package/android/build.gradle +1 -1
- package/android/src/main/java/app/capgo/webviewversionchecker/GeneratedVersionShareData.java +28 -0
- package/android/src/main/java/app/capgo/webviewversionchecker/WebviewVersionCheckerPlugin.java +445 -15
- package/dist/docs.json +28 -0
- package/dist/esm/definitions.d.ts +95 -4
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/generated-version-share.d.ts +9 -0
- package/dist/esm/generated-version-share.js +106 -0
- package/dist/esm/generated-version-share.js.map +1 -0
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +86 -10
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +190 -10
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +190 -10
- package/dist/plugin.js.map +1 -1
- package/package.json +6 -3
package/dist/plugin.cjs.js
CHANGED
|
@@ -6,6 +6,111 @@ const WebviewVersionChecker = core.registerPlugin('WebviewVersionChecker', {
|
|
|
6
6
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.WebviewVersionCheckerWeb()),
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
/**
|
|
11
|
+
* AUTO-GENERATED FILE. DO NOT EDIT.
|
|
12
|
+
* Generated by: scripts/generate-version-share-data.mjs
|
|
13
|
+
* Source: https://raw.githubusercontent.com/Fyrd/caniuse/main/data.json
|
|
14
|
+
* Generated at: 2026-02-20T04:04:07.658Z
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_VERSION_SHARE_DATA_SOURCE = 'generatedVersionShareByMajor';
|
|
17
|
+
const DEFAULT_VERSION_SHARE_BY_MAJOR = {
|
|
18
|
+
"4": 0.000092,
|
|
19
|
+
"39": 0.004796,
|
|
20
|
+
"40": 0.004796,
|
|
21
|
+
"41": 0.009592,
|
|
22
|
+
"42": 0.004796,
|
|
23
|
+
"43": 0.004796,
|
|
24
|
+
"44": 0.004796,
|
|
25
|
+
"45": 0.009592,
|
|
26
|
+
"46": 0.004796,
|
|
27
|
+
"47": 0.009592,
|
|
28
|
+
"48": 0.014388,
|
|
29
|
+
"49": 0.014388,
|
|
30
|
+
"50": 0.009592,
|
|
31
|
+
"51": 0.009592,
|
|
32
|
+
"52": 0.014388,
|
|
33
|
+
"53": 0.009592,
|
|
34
|
+
"54": 0.004796,
|
|
35
|
+
"55": 0.009592,
|
|
36
|
+
"56": 0.009592,
|
|
37
|
+
"57": 0.009592,
|
|
38
|
+
"58": 0.009592,
|
|
39
|
+
"59": 0.009592,
|
|
40
|
+
"60": 0.014388,
|
|
41
|
+
"61": 0.004796,
|
|
42
|
+
"62": 0.009592,
|
|
43
|
+
"63": 0.009592,
|
|
44
|
+
"64": 0.009592,
|
|
45
|
+
"65": 0.004796,
|
|
46
|
+
"66": 0.02398,
|
|
47
|
+
"67": 0.009592,
|
|
48
|
+
"68": 0.009592,
|
|
49
|
+
"69": 0.033572,
|
|
50
|
+
"70": 0.009592,
|
|
51
|
+
"75": 0.004796,
|
|
52
|
+
"77": 0.004796,
|
|
53
|
+
"79": 0.067144,
|
|
54
|
+
"80": 0.009592,
|
|
55
|
+
"81": 0.009592,
|
|
56
|
+
"83": 0.043164,
|
|
57
|
+
"85": 0.004796,
|
|
58
|
+
"86": 0.009592,
|
|
59
|
+
"87": 0.028776,
|
|
60
|
+
"88": 0.004796,
|
|
61
|
+
"91": 0.019184,
|
|
62
|
+
"92": 0.014388,
|
|
63
|
+
"93": 0.009592,
|
|
64
|
+
"97": 0.009592,
|
|
65
|
+
"98": 0.04796,
|
|
66
|
+
"99": 0.043164,
|
|
67
|
+
"101": 0.014388,
|
|
68
|
+
"102": 0.009592,
|
|
69
|
+
"103": 0.26378,
|
|
70
|
+
"104": 0.230208,
|
|
71
|
+
"105": 0.273372,
|
|
72
|
+
"106": 0.206228,
|
|
73
|
+
"107": 0.230208,
|
|
74
|
+
"108": 0.230208,
|
|
75
|
+
"109": 0.786544,
|
|
76
|
+
"110": 0.235004,
|
|
77
|
+
"111": 0.292556,
|
|
78
|
+
"112": 2.71454,
|
|
79
|
+
"113": 0.004796,
|
|
80
|
+
"114": 0.062348,
|
|
81
|
+
"115": 0.02398,
|
|
82
|
+
"116": 0.446028,
|
|
83
|
+
"117": 0.282964,
|
|
84
|
+
"118": 0.052756,
|
|
85
|
+
"119": 0.038368,
|
|
86
|
+
"120": 0.31174,
|
|
87
|
+
"121": 0.04796,
|
|
88
|
+
"122": 0.091124,
|
|
89
|
+
"123": 0.062348,
|
|
90
|
+
"124": 0.230208,
|
|
91
|
+
"125": 0.244596,
|
|
92
|
+
"126": 0.052756,
|
|
93
|
+
"127": 0.052756,
|
|
94
|
+
"128": 0.076736,
|
|
95
|
+
"129": 0.067144,
|
|
96
|
+
"130": 0.09592,
|
|
97
|
+
"131": 0.709808,
|
|
98
|
+
"132": 0.139084,
|
|
99
|
+
"133": 0.52756,
|
|
100
|
+
"134": 0.067144,
|
|
101
|
+
"135": 0.067144,
|
|
102
|
+
"136": 0.09592,
|
|
103
|
+
"137": 0.062348,
|
|
104
|
+
"138": 0.235004,
|
|
105
|
+
"139": 3.34761,
|
|
106
|
+
"140": 0.177452,
|
|
107
|
+
"141": 0.398068,
|
|
108
|
+
"142": 1.29972,
|
|
109
|
+
"143": 10.4121,
|
|
110
|
+
"144": 41.8835,
|
|
111
|
+
"145": 0.019184
|
|
112
|
+
};
|
|
113
|
+
|
|
9
114
|
const UNKNOWN_REASON = 'Web implementation is a compatibility shim. Native Android/iOS implementations provide full WebView checks.';
|
|
10
115
|
class WebviewVersionCheckerWeb extends core.WebPlugin {
|
|
11
116
|
constructor() {
|
|
@@ -16,21 +121,60 @@ class WebviewVersionCheckerWeb extends core.WebPlugin {
|
|
|
16
121
|
this.lastStatus = null;
|
|
17
122
|
}
|
|
18
123
|
async check(options = {}) {
|
|
19
|
-
var _a;
|
|
124
|
+
var _a, _b;
|
|
20
125
|
const currentVersion = this.detectCurrentVersion();
|
|
21
126
|
const currentMajorVersion = this.parseMajorVersion(currentVersion);
|
|
22
127
|
const latestVersion = options.latestVersion;
|
|
23
128
|
const latestMajorVersion = this.parseMajorVersion(latestVersion);
|
|
129
|
+
const minimumDeviceSharePercent = this.normalizePercent((_a = options.minimumDeviceSharePercent) !== null && _a !== void 0 ? _a : 3);
|
|
130
|
+
const normalizedInlineVersionShareByMajor = this.normalizeVersionShareByMajor(options.versionShareByMajor);
|
|
131
|
+
const normalizedGeneratedVersionShareByMajor = this.normalizeVersionShareByMajor(DEFAULT_VERSION_SHARE_BY_MAJOR);
|
|
132
|
+
const normalizedVersionShareByMajor = normalizedInlineVersionShareByMajor !== null && normalizedInlineVersionShareByMajor !== void 0 ? normalizedInlineVersionShareByMajor : normalizedGeneratedVersionShareByMajor;
|
|
133
|
+
const versionShareSource = normalizedInlineVersionShareByMajor
|
|
134
|
+
? 'versionShareByMajor'
|
|
135
|
+
: DEFAULT_VERSION_SHARE_DATA_SOURCE;
|
|
136
|
+
const currentVersionSharePercent = this.resolveCurrentVersionSharePercent(currentMajorVersion, normalizedVersionShareByMajor);
|
|
137
|
+
let deviceShareError;
|
|
24
138
|
let state = 'unknown';
|
|
25
139
|
let reason = UNKNOWN_REASON;
|
|
26
|
-
if (
|
|
140
|
+
if (typeof minimumDeviceSharePercent === 'number') {
|
|
141
|
+
if (typeof currentVersionSharePercent === 'number') {
|
|
142
|
+
state = currentVersionSharePercent >= minimumDeviceSharePercent ? 'latest' : 'outdated';
|
|
143
|
+
reason =
|
|
144
|
+
state === 'latest'
|
|
145
|
+
? 'Current browser engine major version meets the configured device-share threshold.'
|
|
146
|
+
: 'Current browser engine major version is below the configured device-share threshold.';
|
|
147
|
+
}
|
|
148
|
+
else if (!normalizedVersionShareByMajor && options.versionShareApiUrl) {
|
|
149
|
+
deviceShareError =
|
|
150
|
+
'Web shim does not fetch version-share API data. Provide versionShareByMajor to evaluate minimumDeviceSharePercent.';
|
|
151
|
+
}
|
|
152
|
+
else if (!normalizedVersionShareByMajor) {
|
|
153
|
+
deviceShareError = 'minimumDeviceSharePercent is set, but no versionShareByMajor dataset was provided.';
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
deviceShareError = 'No device-share entry was found for the current browser engine major version.';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (state === 'unknown' && latestVersion && currentVersion) {
|
|
27
160
|
const cmp = this.compareVersions(currentVersion, latestVersion);
|
|
28
161
|
state = cmp >= 0 ? 'latest' : 'outdated';
|
|
29
|
-
reason =
|
|
162
|
+
reason =
|
|
163
|
+
cmp >= 0
|
|
164
|
+
? 'Current browser engine is at or above the requested latest version.'
|
|
165
|
+
: 'Current browser engine is below the requested latest version.';
|
|
30
166
|
}
|
|
31
|
-
else if (
|
|
167
|
+
else if (state === 'unknown' &&
|
|
168
|
+
typeof options.minimumMajorVersion === 'number' &&
|
|
169
|
+
typeof currentMajorVersion === 'number') {
|
|
32
170
|
state = currentMajorVersion >= options.minimumMajorVersion ? 'latest' : 'outdated';
|
|
33
|
-
reason =
|
|
171
|
+
reason =
|
|
172
|
+
state === 'latest'
|
|
173
|
+
? 'Current browser engine major version meets the minimum requirement.'
|
|
174
|
+
: 'Current browser engine major version is below the minimum requirement.';
|
|
175
|
+
}
|
|
176
|
+
else if (state === 'unknown' && deviceShareError) {
|
|
177
|
+
reason = deviceShareError;
|
|
34
178
|
}
|
|
35
179
|
const status = {
|
|
36
180
|
platform: 'web',
|
|
@@ -42,8 +186,12 @@ class WebviewVersionCheckerWeb extends core.WebPlugin {
|
|
|
42
186
|
currentMajorVersion,
|
|
43
187
|
latestVersion,
|
|
44
188
|
latestMajorVersion,
|
|
189
|
+
currentVersionSharePercent,
|
|
190
|
+
minimumDeviceSharePercent,
|
|
191
|
+
versionShareSource: normalizedVersionShareByMajor ? versionShareSource : undefined,
|
|
192
|
+
deviceShareError,
|
|
45
193
|
updateUrl: options.updateUrl,
|
|
46
|
-
source: (
|
|
194
|
+
source: (_b = options.source) !== null && _b !== void 0 ? _b : 'web-shim',
|
|
47
195
|
};
|
|
48
196
|
this.lastStatus = status;
|
|
49
197
|
this.notifyListeners('statusChanged', status);
|
|
@@ -116,11 +264,11 @@ class WebviewVersionCheckerWeb extends core.WebPlugin {
|
|
|
116
264
|
}
|
|
117
265
|
detectCurrentVersion() {
|
|
118
266
|
const chromiumMatch = navigator.userAgent.match(/Chrome\/([\d.]+)/i);
|
|
119
|
-
if (chromiumMatch
|
|
267
|
+
if (chromiumMatch === null || chromiumMatch === void 0 ? void 0 : chromiumMatch[1]) {
|
|
120
268
|
return chromiumMatch[1];
|
|
121
269
|
}
|
|
122
270
|
const appleWebKitMatch = navigator.userAgent.match(/AppleWebKit\/([\d.]+)/i);
|
|
123
|
-
if (appleWebKitMatch
|
|
271
|
+
if (appleWebKitMatch === null || appleWebKitMatch === void 0 ? void 0 : appleWebKitMatch[1]) {
|
|
124
272
|
return appleWebKitMatch[1];
|
|
125
273
|
}
|
|
126
274
|
return navigator.userAgent;
|
|
@@ -147,8 +295,14 @@ class WebviewVersionCheckerWeb extends core.WebPlugin {
|
|
|
147
295
|
}
|
|
148
296
|
compareVersions(left, right) {
|
|
149
297
|
var _a, _b;
|
|
150
|
-
const leftParts = left
|
|
151
|
-
|
|
298
|
+
const leftParts = left
|
|
299
|
+
.split(/[^0-9]+/)
|
|
300
|
+
.filter(Boolean)
|
|
301
|
+
.map((part) => Number.parseInt(part, 10));
|
|
302
|
+
const rightParts = right
|
|
303
|
+
.split(/[^0-9]+/)
|
|
304
|
+
.filter(Boolean)
|
|
305
|
+
.map((part) => Number.parseInt(part, 10));
|
|
152
306
|
const maxLength = Math.max(leftParts.length, rightParts.length);
|
|
153
307
|
for (let i = 0; i < maxLength; i += 1) {
|
|
154
308
|
const a = (_a = leftParts[i]) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -162,6 +316,32 @@ class WebviewVersionCheckerWeb extends core.WebPlugin {
|
|
|
162
316
|
}
|
|
163
317
|
return 0;
|
|
164
318
|
}
|
|
319
|
+
normalizePercent(value) {
|
|
320
|
+
if (typeof value !== 'number' || Number.isNaN(value) || !Number.isFinite(value)) {
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
return Math.min(100, Math.max(0, value));
|
|
324
|
+
}
|
|
325
|
+
normalizeVersionShareByMajor(shareByMajor) {
|
|
326
|
+
if (!shareByMajor) {
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
const normalized = {};
|
|
330
|
+
for (const [rawKey, rawShare] of Object.entries(shareByMajor)) {
|
|
331
|
+
const major = this.parseMajorVersion(rawKey);
|
|
332
|
+
const share = this.normalizePercent(rawShare);
|
|
333
|
+
if (typeof major === 'number' && typeof share === 'number') {
|
|
334
|
+
normalized[major] = share;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return Object.keys(normalized).length > 0 ? normalized : undefined;
|
|
338
|
+
}
|
|
339
|
+
resolveCurrentVersionSharePercent(currentMajorVersion, normalizedShareByMajor) {
|
|
340
|
+
if (typeof currentMajorVersion !== 'number' || !normalizedShareByMajor) {
|
|
341
|
+
return undefined;
|
|
342
|
+
}
|
|
343
|
+
return normalizedShareByMajor[currentMajorVersion];
|
|
344
|
+
}
|
|
165
345
|
}
|
|
166
346
|
|
|
167
347
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst WebviewVersionChecker = registerPlugin('WebviewVersionChecker', {\n web: () => import('./web').then((m) => new m.WebviewVersionCheckerWeb()),\n});\nexport * from './definitions';\nexport { WebviewVersionChecker };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst UNKNOWN_REASON = 'Web implementation is a compatibility shim. Native Android/iOS implementations provide full WebView checks.';\nexport class WebviewVersionCheckerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.monitoring = false;\n this.checkOnResume = true;\n this.autoPromptOnOutdated = false;\n this.lastStatus = null;\n }\n async check(options = {}) {\n var _a;\n const currentVersion = this.detectCurrentVersion();\n const currentMajorVersion = this.parseMajorVersion(currentVersion);\n const latestVersion = options.latestVersion;\n const latestMajorVersion = this.parseMajorVersion(latestVersion);\n let state = 'unknown';\n let reason = UNKNOWN_REASON;\n if (latestVersion && currentVersion) {\n const cmp = this.compareVersions(currentVersion, latestVersion);\n state = cmp >= 0 ? 'latest' : 'outdated';\n reason = cmp >= 0 ? 'Current browser engine is at or above the requested latest version.' : 'Current browser engine is below the requested latest version.';\n }\n else if (typeof options.minimumMajorVersion === 'number' && typeof currentMajorVersion === 'number') {\n state = currentMajorVersion >= options.minimumMajorVersion ? 'latest' : 'outdated';\n reason = state === 'latest' ? 'Current browser engine major version meets the minimum requirement.' : 'Current browser engine major version is below the minimum requirement.';\n }\n const status = {\n platform: 'web',\n state,\n isLatest: state === 'latest',\n checkedAt: new Date().toISOString(),\n reason,\n currentVersion,\n currentMajorVersion,\n latestVersion,\n latestMajorVersion,\n updateUrl: options.updateUrl,\n source: (_a = options.source) !== null && _a !== void 0 ? _a : 'web-shim',\n };\n this.lastStatus = status;\n this.notifyListeners('statusChanged', status);\n if (state === 'latest') {\n this.notifyListeners('webViewLatest', status);\n }\n else if (state === 'outdated') {\n this.notifyListeners('webViewOutdated', status);\n if (options.showPromptOnOutdated || this.autoPromptOnOutdated) {\n await this.showUpdatePrompt({ updateUrl: status.updateUrl });\n }\n }\n return status;\n }\n async startMonitoring(options = {}) {\n var _a, _b, _c, _d;\n this.monitoring = true;\n this.checkOnResume = (_a = options.checkOnResume) !== null && _a !== void 0 ? _a : true;\n this.autoPromptOnOutdated = (_b = options.autoPromptOnOutdated) !== null && _b !== void 0 ? _b : false;\n if ((_c = options.checkOnStart) !== null && _c !== void 0 ? _c : true) {\n await this.check(Object.assign(Object.assign({}, options), { source: (_d = options.source) !== null && _d !== void 0 ? _d : 'startMonitoring' }));\n }\n return {\n monitoring: this.monitoring,\n checkOnResume: this.checkOnResume,\n autoPromptOnOutdated: this.autoPromptOnOutdated,\n };\n }\n async stopMonitoring() {\n this.monitoring = false;\n return {\n monitoring: this.monitoring,\n checkOnResume: this.checkOnResume,\n autoPromptOnOutdated: this.autoPromptOnOutdated,\n };\n }\n async getLastStatus() {\n return {\n status: this.lastStatus,\n };\n }\n async showUpdatePrompt(options = {}) {\n var _a, _b;\n const url = (_a = options.updateUrl) !== null && _a !== void 0 ? _a : (_b = this.lastStatus) === null || _b === void 0 ? void 0 : _b.updateUrl;\n if (!url) {\n return {\n shown: false,\n openedUpdatePage: false,\n };\n }\n const opened = this.openUrl(url);\n return {\n shown: true,\n openedUpdatePage: opened,\n };\n }\n async openUpdatePage(options = {}) {\n var _a, _b, _c;\n const url = (_c = (_a = options.updateUrl) !== null && _a !== void 0 ? _a : (_b = this.lastStatus) === null || _b === void 0 ? void 0 : _b.updateUrl) !== null && _c !== void 0 ? _c : '';\n if (!url) {\n return {\n opened: false,\n url,\n };\n }\n return {\n opened: this.openUrl(url),\n url,\n };\n }\n detectCurrentVersion() {\n const chromiumMatch = navigator.userAgent.match(/Chrome\\/([\\d.]+)/i);\n if (chromiumMatch && chromiumMatch[1]) {\n return chromiumMatch[1];\n }\n const appleWebKitMatch = navigator.userAgent.match(/AppleWebKit\\/([\\d.]+)/i);\n if (appleWebKitMatch && appleWebKitMatch[1]) {\n return appleWebKitMatch[1];\n }\n return navigator.userAgent;\n }\n openUrl(url) {\n try {\n window.open(url, '_blank', 'noopener,noreferrer');\n return true;\n }\n catch (_a) {\n return false;\n }\n }\n parseMajorVersion(version) {\n if (!version) {\n return undefined;\n }\n const match = version.match(/(\\d+)/);\n if (!match) {\n return undefined;\n }\n const major = Number.parseInt(match[1], 10);\n return Number.isFinite(major) ? major : undefined;\n }\n compareVersions(left, right) {\n var _a, _b;\n const leftParts = left.split(/[^0-9]+/).filter(Boolean).map((part) => Number.parseInt(part, 10));\n const rightParts = right.split(/[^0-9]+/).filter(Boolean).map((part) => Number.parseInt(part, 10));\n const maxLength = Math.max(leftParts.length, rightParts.length);\n for (let i = 0; i < maxLength; i += 1) {\n const a = (_a = leftParts[i]) !== null && _a !== void 0 ? _a : 0;\n const b = (_b = rightParts[i]) !== null && _b !== void 0 ? _b : 0;\n if (a > b) {\n return 1;\n }\n if (a < b) {\n return -1;\n }\n }\n return 0;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC5E,CAAC;;ACFD,MAAM,cAAc,GAAG,6GAA6G;AAC7H,MAAM,wBAAwB,SAASC,cAAS,CAAC;AACxD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,UAAU,GAAG,KAAK;AAC/B,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI;AACjC,QAAQ,IAAI,CAAC,oBAAoB,GAAG,KAAK;AACzC,QAAQ,IAAI,CAAC,UAAU,GAAG,IAAI;AAC9B,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,OAAO,GAAG,EAAE,EAAE;AAC9B,QAAQ,IAAI,EAAE;AACd,QAAQ,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,EAAE;AAC1D,QAAQ,MAAM,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC;AAC1E,QAAQ,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa;AACnD,QAAQ,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAi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CAAC,EAAE;AAC/C,YAAY,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,CAAC;AAC5E,YAAY,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,CAAC;AAC7E,YAAY,IAAI,CAAC,GAAG,CAAC,EAAE;AACvB,gBAAgB,OAAO,CAAC;AACxB,YAAY;AACZ,YAAY,IAAI,CAAC,GAAG,CAAC,EAAE;AACvB,gBAAgB,OAAO,EAAE;AACzB,YAAY;AACZ,QAAQ;AACR,QAAQ,OAAO,CAAC;AAChB,IAAI;AACJ;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/generated-version-share.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst WebviewVersionChecker = registerPlugin('WebviewVersionChecker', {\n web: () => import('./web').then((m) => new m.WebviewVersionCheckerWeb()),\n});\nexport * from './definitions';\nexport { WebviewVersionChecker };\n//# sourceMappingURL=index.js.map","/* eslint-disable */\n/**\n * AUTO-GENERATED FILE. DO NOT EDIT.\n * Generated by: scripts/generate-version-share-data.mjs\n * Source: https://raw.githubusercontent.com/Fyrd/caniuse/main/data.json\n * Generated at: 2026-02-20T04:04:07.658Z\n */\nexport const DEFAULT_VERSION_SHARE_DATA_SOURCE = 'generatedVersionShareByMajor';\nexport const DEFAULT_VERSION_SHARE_GENERATED_AT = '2026-02-20T04:04:07.658Z';\nexport const DEFAULT_VERSION_SHARE_BY_MAJOR = {\n \"4\": 0.000092,\n \"39\": 0.004796,\n \"40\": 0.004796,\n \"41\": 0.009592,\n \"42\": 0.004796,\n \"43\": 0.004796,\n \"44\": 0.004796,\n \"45\": 0.009592,\n \"46\": 0.004796,\n \"47\": 0.009592,\n \"48\": 0.014388,\n \"49\": 0.014388,\n \"50\": 0.009592,\n \"51\": 0.009592,\n \"52\": 0.014388,\n \"53\": 0.009592,\n \"54\": 0.004796,\n \"55\": 0.009592,\n \"56\": 0.009592,\n \"57\": 0.009592,\n \"58\": 0.009592,\n \"59\": 0.009592,\n \"60\": 0.014388,\n \"61\": 0.004796,\n \"62\": 0.009592,\n \"63\": 0.009592,\n \"64\": 0.009592,\n \"65\": 0.004796,\n \"66\": 0.02398,\n \"67\": 0.009592,\n \"68\": 0.009592,\n \"69\": 0.033572,\n \"70\": 0.009592,\n \"75\": 0.004796,\n \"77\": 0.004796,\n \"79\": 0.067144,\n \"80\": 0.009592,\n \"81\": 0.009592,\n \"83\": 0.043164,\n \"85\": 0.004796,\n \"86\": 0.009592,\n \"87\": 0.028776,\n \"88\": 0.004796,\n \"91\": 0.019184,\n \"92\": 0.014388,\n \"93\": 0.009592,\n \"97\": 0.009592,\n \"98\": 0.04796,\n \"99\": 0.043164,\n \"101\": 0.014388,\n \"102\": 0.009592,\n \"103\": 0.26378,\n \"104\": 0.230208,\n \"105\": 0.273372,\n \"106\": 0.206228,\n \"107\": 0.230208,\n \"108\": 0.230208,\n \"109\": 0.786544,\n \"110\": 0.235004,\n \"111\": 0.292556,\n \"112\": 2.71454,\n \"113\": 0.004796,\n \"114\": 0.062348,\n \"115\": 0.02398,\n \"116\": 0.446028,\n \"117\": 0.282964,\n \"118\": 0.052756,\n \"119\": 0.038368,\n \"120\": 0.31174,\n \"121\": 0.04796,\n \"122\": 0.091124,\n \"123\": 0.062348,\n \"124\": 0.230208,\n \"125\": 0.244596,\n \"126\": 0.052756,\n \"127\": 0.052756,\n \"128\": 0.076736,\n \"129\": 0.067144,\n \"130\": 0.09592,\n \"131\": 0.709808,\n \"132\": 0.139084,\n \"133\": 0.52756,\n \"134\": 0.067144,\n \"135\": 0.067144,\n \"136\": 0.09592,\n \"137\": 0.062348,\n \"138\": 0.235004,\n \"139\": 3.34761,\n \"140\": 0.177452,\n \"141\": 0.398068,\n \"142\": 1.29972,\n \"143\": 10.4121,\n \"144\": 41.8835,\n \"145\": 0.019184\n};\n//# sourceMappingURL=generated-version-share.js.map","import { WebPlugin } from '@capacitor/core';\nimport { DEFAULT_VERSION_SHARE_BY_MAJOR, DEFAULT_VERSION_SHARE_DATA_SOURCE } from './generated-version-share';\nconst UNKNOWN_REASON = 'Web implementation is a compatibility shim. Native Android/iOS implementations provide full WebView checks.';\nexport class WebviewVersionCheckerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.monitoring = false;\n this.checkOnResume = true;\n this.autoPromptOnOutdated = false;\n this.lastStatus = null;\n }\n async check(options = {}) {\n var _a, _b;\n const currentVersion = this.detectCurrentVersion();\n const currentMajorVersion = this.parseMajorVersion(currentVersion);\n const latestVersion = options.latestVersion;\n const latestMajorVersion = this.parseMajorVersion(latestVersion);\n const minimumDeviceSharePercent = this.normalizePercent((_a = options.minimumDeviceSharePercent) !== null && _a !== void 0 ? _a : 3);\n const normalizedInlineVersionShareByMajor = this.normalizeVersionShareByMajor(options.versionShareByMajor);\n const normalizedGeneratedVersionShareByMajor = this.normalizeVersionShareByMajor(DEFAULT_VERSION_SHARE_BY_MAJOR);\n const normalizedVersionShareByMajor = normalizedInlineVersionShareByMajor !== null && normalizedInlineVersionShareByMajor !== void 0 ? normalizedInlineVersionShareByMajor : normalizedGeneratedVersionShareByMajor;\n const versionShareSource = normalizedInlineVersionShareByMajor\n ? 'versionShareByMajor'\n : DEFAULT_VERSION_SHARE_DATA_SOURCE;\n const currentVersionSharePercent = this.resolveCurrentVersionSharePercent(currentMajorVersion, normalizedVersionShareByMajor);\n let deviceShareError;\n let state = 'unknown';\n let reason = UNKNOWN_REASON;\n if (typeof minimumDeviceSharePercent === 'number') {\n if (typeof currentVersionSharePercent === 'number') {\n state = currentVersionSharePercent >= minimumDeviceSharePercent ? 'latest' : 'outdated';\n reason =\n state === 'latest'\n ? 'Current browser engine major version meets the configured device-share threshold.'\n : 'Current browser engine major version is below the configured device-share threshold.';\n }\n else if (!normalizedVersionShareByMajor && options.versionShareApiUrl) {\n deviceShareError =\n 'Web shim does not fetch version-share API data. Provide versionShareByMajor to evaluate minimumDeviceSharePercent.';\n }\n else if (!normalizedVersionShareByMajor) {\n deviceShareError = 'minimumDeviceSharePercent is set, but no versionShareByMajor dataset was provided.';\n }\n else {\n deviceShareError = 'No device-share entry was found for the current browser engine major version.';\n }\n }\n if (state === 'unknown' && latestVersion && currentVersion) {\n const cmp = this.compareVersions(currentVersion, latestVersion);\n state = cmp >= 0 ? 'latest' : 'outdated';\n reason =\n cmp >= 0\n ? 'Current browser engine is at or above the requested latest version.'\n : 'Current browser engine is below the requested latest version.';\n }\n else if (state === 'unknown' &&\n typeof options.minimumMajorVersion === 'number' &&\n typeof currentMajorVersion === 'number') {\n state = currentMajorVersion >= options.minimumMajorVersion ? 'latest' : 'outdated';\n reason =\n state === 'latest'\n ? 'Current browser engine major version meets the minimum requirement.'\n : 'Current browser engine major version is below the minimum requirement.';\n }\n else if (state === 'unknown' && deviceShareError) {\n reason = deviceShareError;\n }\n const status = {\n platform: 'web',\n state,\n isLatest: state === 'latest',\n checkedAt: new Date().toISOString(),\n reason,\n currentVersion,\n currentMajorVersion,\n latestVersion,\n latestMajorVersion,\n currentVersionSharePercent,\n minimumDeviceSharePercent,\n versionShareSource: normalizedVersionShareByMajor ? versionShareSource : undefined,\n deviceShareError,\n updateUrl: options.updateUrl,\n source: (_b = options.source) !== null && _b !== void 0 ? _b : 'web-shim',\n };\n this.lastStatus = status;\n this.notifyListeners('statusChanged', status);\n if (state === 'latest') {\n this.notifyListeners('webViewLatest', status);\n }\n else if (state === 'outdated') {\n this.notifyListeners('webViewOutdated', status);\n if (options.showPromptOnOutdated || this.autoPromptOnOutdated) {\n await this.showUpdatePrompt({ updateUrl: status.updateUrl });\n }\n }\n return status;\n }\n async startMonitoring(options = {}) {\n var _a, _b, _c, _d;\n this.monitoring = true;\n this.checkOnResume = (_a = options.checkOnResume) !== null && _a !== void 0 ? _a : true;\n this.autoPromptOnOutdated = (_b = options.autoPromptOnOutdated) !== null && _b !== void 0 ? _b : false;\n if ((_c = options.checkOnStart) !== null && _c !== void 0 ? _c : true) {\n await this.check(Object.assign(Object.assign({}, options), { source: (_d = options.source) !== null && _d !== void 0 ? _d : 'startMonitoring' }));\n }\n return {\n monitoring: this.monitoring,\n checkOnResume: this.checkOnResume,\n autoPromptOnOutdated: this.autoPromptOnOutdated,\n };\n }\n async stopMonitoring() {\n this.monitoring = false;\n return {\n monitoring: this.monitoring,\n checkOnResume: this.checkOnResume,\n autoPromptOnOutdated: this.autoPromptOnOutdated,\n };\n }\n async getLastStatus() {\n return {\n status: this.lastStatus,\n };\n }\n async showUpdatePrompt(options = {}) {\n var _a, _b;\n const url = (_a = options.updateUrl) !== null && _a !== void 0 ? _a : (_b = this.lastStatus) === null || _b === void 0 ? void 0 : _b.updateUrl;\n if (!url) {\n return {\n shown: false,\n openedUpdatePage: false,\n };\n }\n const opened = this.openUrl(url);\n return {\n shown: true,\n openedUpdatePage: opened,\n };\n }\n async openUpdatePage(options = {}) {\n var _a, _b, _c;\n const url = (_c = (_a = options.updateUrl) !== null && _a !== void 0 ? _a : (_b = this.lastStatus) === null || _b === void 0 ? void 0 : _b.updateUrl) !== null && _c !== void 0 ? _c : '';\n if (!url) {\n return {\n opened: false,\n url,\n };\n }\n return {\n opened: this.openUrl(url),\n url,\n };\n }\n detectCurrentVersion() {\n const chromiumMatch = navigator.userAgent.match(/Chrome\\/([\\d.]+)/i);\n if (chromiumMatch === null || chromiumMatch === void 0 ? void 0 : chromiumMatch[1]) {\n return chromiumMatch[1];\n }\n const appleWebKitMatch = navigator.userAgent.match(/AppleWebKit\\/([\\d.]+)/i);\n if (appleWebKitMatch === null || appleWebKitMatch === void 0 ? void 0 : appleWebKitMatch[1]) {\n return appleWebKitMatch[1];\n }\n return navigator.userAgent;\n }\n openUrl(url) {\n try {\n window.open(url, '_blank', 'noopener,noreferrer');\n return true;\n }\n catch (_a) {\n return false;\n }\n }\n parseMajorVersion(version) {\n if (!version) {\n return undefined;\n }\n const match = version.match(/(\\d+)/);\n if (!match) {\n return undefined;\n }\n const major = Number.parseInt(match[1], 10);\n return Number.isFinite(major) ? major : undefined;\n }\n compareVersions(left, right) {\n var _a, _b;\n const leftParts = left\n .split(/[^0-9]+/)\n .filter(Boolean)\n .map((part) => Number.parseInt(part, 10));\n const rightParts = right\n .split(/[^0-9]+/)\n .filter(Boolean)\n .map((part) => Number.parseInt(part, 10));\n const maxLength = Math.max(leftParts.length, rightParts.length);\n for (let i = 0; i < maxLength; i += 1) {\n const a = (_a = leftParts[i]) !== null && _a !== void 0 ? _a : 0;\n const b = (_b = rightParts[i]) !== null && _b !== void 0 ? _b : 0;\n if (a > b) {\n return 1;\n }\n if (a < b) {\n return -1;\n }\n }\n return 0;\n }\n normalizePercent(value) {\n if (typeof value !== 'number' || Number.isNaN(value) || !Number.isFinite(value)) {\n return undefined;\n }\n return Math.min(100, Math.max(0, value));\n }\n normalizeVersionShareByMajor(shareByMajor) {\n if (!shareByMajor) {\n return undefined;\n }\n const normalized = {};\n for (const [rawKey, rawShare] of Object.entries(shareByMajor)) {\n const major = this.parseMajorVersion(rawKey);\n const share = this.normalizePercent(rawShare);\n if (typeof major === 'number' && typeof share === 'number') {\n normalized[major] = share;\n }\n }\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n }\n resolveCurrentVersionSharePercent(currentMajorVersion, normalizedShareByMajor) {\n if (typeof currentMajorVersion !== 'number' || !normalizedShareByMajor) {\n return undefined;\n }\n return normalizedShareByMajor[currentMajorVersion];\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,qBAAqB,GAAGA,mBAAc,CAAC,uBAAuB,EAAE;AACtE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAC5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,EAAE;AAC/C,QAAQ,IAAI,CAAC,YAAY,EAAE;AAC3B,YAAY,OAAO,SAAS;AAC5B,QAAQ;AACR,QAAQ,MAAM,UAAU,GAAG,EAAE;AAC7B,QAAQ,KAAK,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AACvE,YAAY,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;AACxD,YAAY,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC;AACzD,YAAY,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACxE,gBAAgB,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK;AACzC,YAAY;AACZ,QAAQ;AACR,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,UAAU,GAAG,SAAS;AAC1E,IAAI;AACJ,IAAI,iCAAiC,CAAC,mBAAmB,EAAE,sBAAsB,EAAE;AACnF,QAAQ,IAAI,OAAO,mBAAmB,KAAK,QAAQ,IAAI,CAAC,sBAAsB,EAAE;AAChF,YAAY,OAAO,SAAS;AAC5B,QAAQ;AACR,QAAQ,OAAO,sBAAsB,CAAC,mBAAmB,CAAC;AAC1D,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -5,6 +5,111 @@ var capacitorWebviewVersionChecker = (function (exports, core) {
|
|
|
5
5
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.WebviewVersionCheckerWeb()),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
/**
|
|
10
|
+
* AUTO-GENERATED FILE. DO NOT EDIT.
|
|
11
|
+
* Generated by: scripts/generate-version-share-data.mjs
|
|
12
|
+
* Source: https://raw.githubusercontent.com/Fyrd/caniuse/main/data.json
|
|
13
|
+
* Generated at: 2026-02-20T04:04:07.658Z
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_VERSION_SHARE_DATA_SOURCE = 'generatedVersionShareByMajor';
|
|
16
|
+
const DEFAULT_VERSION_SHARE_BY_MAJOR = {
|
|
17
|
+
"4": 0.000092,
|
|
18
|
+
"39": 0.004796,
|
|
19
|
+
"40": 0.004796,
|
|
20
|
+
"41": 0.009592,
|
|
21
|
+
"42": 0.004796,
|
|
22
|
+
"43": 0.004796,
|
|
23
|
+
"44": 0.004796,
|
|
24
|
+
"45": 0.009592,
|
|
25
|
+
"46": 0.004796,
|
|
26
|
+
"47": 0.009592,
|
|
27
|
+
"48": 0.014388,
|
|
28
|
+
"49": 0.014388,
|
|
29
|
+
"50": 0.009592,
|
|
30
|
+
"51": 0.009592,
|
|
31
|
+
"52": 0.014388,
|
|
32
|
+
"53": 0.009592,
|
|
33
|
+
"54": 0.004796,
|
|
34
|
+
"55": 0.009592,
|
|
35
|
+
"56": 0.009592,
|
|
36
|
+
"57": 0.009592,
|
|
37
|
+
"58": 0.009592,
|
|
38
|
+
"59": 0.009592,
|
|
39
|
+
"60": 0.014388,
|
|
40
|
+
"61": 0.004796,
|
|
41
|
+
"62": 0.009592,
|
|
42
|
+
"63": 0.009592,
|
|
43
|
+
"64": 0.009592,
|
|
44
|
+
"65": 0.004796,
|
|
45
|
+
"66": 0.02398,
|
|
46
|
+
"67": 0.009592,
|
|
47
|
+
"68": 0.009592,
|
|
48
|
+
"69": 0.033572,
|
|
49
|
+
"70": 0.009592,
|
|
50
|
+
"75": 0.004796,
|
|
51
|
+
"77": 0.004796,
|
|
52
|
+
"79": 0.067144,
|
|
53
|
+
"80": 0.009592,
|
|
54
|
+
"81": 0.009592,
|
|
55
|
+
"83": 0.043164,
|
|
56
|
+
"85": 0.004796,
|
|
57
|
+
"86": 0.009592,
|
|
58
|
+
"87": 0.028776,
|
|
59
|
+
"88": 0.004796,
|
|
60
|
+
"91": 0.019184,
|
|
61
|
+
"92": 0.014388,
|
|
62
|
+
"93": 0.009592,
|
|
63
|
+
"97": 0.009592,
|
|
64
|
+
"98": 0.04796,
|
|
65
|
+
"99": 0.043164,
|
|
66
|
+
"101": 0.014388,
|
|
67
|
+
"102": 0.009592,
|
|
68
|
+
"103": 0.26378,
|
|
69
|
+
"104": 0.230208,
|
|
70
|
+
"105": 0.273372,
|
|
71
|
+
"106": 0.206228,
|
|
72
|
+
"107": 0.230208,
|
|
73
|
+
"108": 0.230208,
|
|
74
|
+
"109": 0.786544,
|
|
75
|
+
"110": 0.235004,
|
|
76
|
+
"111": 0.292556,
|
|
77
|
+
"112": 2.71454,
|
|
78
|
+
"113": 0.004796,
|
|
79
|
+
"114": 0.062348,
|
|
80
|
+
"115": 0.02398,
|
|
81
|
+
"116": 0.446028,
|
|
82
|
+
"117": 0.282964,
|
|
83
|
+
"118": 0.052756,
|
|
84
|
+
"119": 0.038368,
|
|
85
|
+
"120": 0.31174,
|
|
86
|
+
"121": 0.04796,
|
|
87
|
+
"122": 0.091124,
|
|
88
|
+
"123": 0.062348,
|
|
89
|
+
"124": 0.230208,
|
|
90
|
+
"125": 0.244596,
|
|
91
|
+
"126": 0.052756,
|
|
92
|
+
"127": 0.052756,
|
|
93
|
+
"128": 0.076736,
|
|
94
|
+
"129": 0.067144,
|
|
95
|
+
"130": 0.09592,
|
|
96
|
+
"131": 0.709808,
|
|
97
|
+
"132": 0.139084,
|
|
98
|
+
"133": 0.52756,
|
|
99
|
+
"134": 0.067144,
|
|
100
|
+
"135": 0.067144,
|
|
101
|
+
"136": 0.09592,
|
|
102
|
+
"137": 0.062348,
|
|
103
|
+
"138": 0.235004,
|
|
104
|
+
"139": 3.34761,
|
|
105
|
+
"140": 0.177452,
|
|
106
|
+
"141": 0.398068,
|
|
107
|
+
"142": 1.29972,
|
|
108
|
+
"143": 10.4121,
|
|
109
|
+
"144": 41.8835,
|
|
110
|
+
"145": 0.019184
|
|
111
|
+
};
|
|
112
|
+
|
|
8
113
|
const UNKNOWN_REASON = 'Web implementation is a compatibility shim. Native Android/iOS implementations provide full WebView checks.';
|
|
9
114
|
class WebviewVersionCheckerWeb extends core.WebPlugin {
|
|
10
115
|
constructor() {
|
|
@@ -15,21 +120,60 @@ var capacitorWebviewVersionChecker = (function (exports, core) {
|
|
|
15
120
|
this.lastStatus = null;
|
|
16
121
|
}
|
|
17
122
|
async check(options = {}) {
|
|
18
|
-
var _a;
|
|
123
|
+
var _a, _b;
|
|
19
124
|
const currentVersion = this.detectCurrentVersion();
|
|
20
125
|
const currentMajorVersion = this.parseMajorVersion(currentVersion);
|
|
21
126
|
const latestVersion = options.latestVersion;
|
|
22
127
|
const latestMajorVersion = this.parseMajorVersion(latestVersion);
|
|
128
|
+
const minimumDeviceSharePercent = this.normalizePercent((_a = options.minimumDeviceSharePercent) !== null && _a !== void 0 ? _a : 3);
|
|
129
|
+
const normalizedInlineVersionShareByMajor = this.normalizeVersionShareByMajor(options.versionShareByMajor);
|
|
130
|
+
const normalizedGeneratedVersionShareByMajor = this.normalizeVersionShareByMajor(DEFAULT_VERSION_SHARE_BY_MAJOR);
|
|
131
|
+
const normalizedVersionShareByMajor = normalizedInlineVersionShareByMajor !== null && normalizedInlineVersionShareByMajor !== void 0 ? normalizedInlineVersionShareByMajor : normalizedGeneratedVersionShareByMajor;
|
|
132
|
+
const versionShareSource = normalizedInlineVersionShareByMajor
|
|
133
|
+
? 'versionShareByMajor'
|
|
134
|
+
: DEFAULT_VERSION_SHARE_DATA_SOURCE;
|
|
135
|
+
const currentVersionSharePercent = this.resolveCurrentVersionSharePercent(currentMajorVersion, normalizedVersionShareByMajor);
|
|
136
|
+
let deviceShareError;
|
|
23
137
|
let state = 'unknown';
|
|
24
138
|
let reason = UNKNOWN_REASON;
|
|
25
|
-
if (
|
|
139
|
+
if (typeof minimumDeviceSharePercent === 'number') {
|
|
140
|
+
if (typeof currentVersionSharePercent === 'number') {
|
|
141
|
+
state = currentVersionSharePercent >= minimumDeviceSharePercent ? 'latest' : 'outdated';
|
|
142
|
+
reason =
|
|
143
|
+
state === 'latest'
|
|
144
|
+
? 'Current browser engine major version meets the configured device-share threshold.'
|
|
145
|
+
: 'Current browser engine major version is below the configured device-share threshold.';
|
|
146
|
+
}
|
|
147
|
+
else if (!normalizedVersionShareByMajor && options.versionShareApiUrl) {
|
|
148
|
+
deviceShareError =
|
|
149
|
+
'Web shim does not fetch version-share API data. Provide versionShareByMajor to evaluate minimumDeviceSharePercent.';
|
|
150
|
+
}
|
|
151
|
+
else if (!normalizedVersionShareByMajor) {
|
|
152
|
+
deviceShareError = 'minimumDeviceSharePercent is set, but no versionShareByMajor dataset was provided.';
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
deviceShareError = 'No device-share entry was found for the current browser engine major version.';
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (state === 'unknown' && latestVersion && currentVersion) {
|
|
26
159
|
const cmp = this.compareVersions(currentVersion, latestVersion);
|
|
27
160
|
state = cmp >= 0 ? 'latest' : 'outdated';
|
|
28
|
-
reason =
|
|
161
|
+
reason =
|
|
162
|
+
cmp >= 0
|
|
163
|
+
? 'Current browser engine is at or above the requested latest version.'
|
|
164
|
+
: 'Current browser engine is below the requested latest version.';
|
|
29
165
|
}
|
|
30
|
-
else if (
|
|
166
|
+
else if (state === 'unknown' &&
|
|
167
|
+
typeof options.minimumMajorVersion === 'number' &&
|
|
168
|
+
typeof currentMajorVersion === 'number') {
|
|
31
169
|
state = currentMajorVersion >= options.minimumMajorVersion ? 'latest' : 'outdated';
|
|
32
|
-
reason =
|
|
170
|
+
reason =
|
|
171
|
+
state === 'latest'
|
|
172
|
+
? 'Current browser engine major version meets the minimum requirement.'
|
|
173
|
+
: 'Current browser engine major version is below the minimum requirement.';
|
|
174
|
+
}
|
|
175
|
+
else if (state === 'unknown' && deviceShareError) {
|
|
176
|
+
reason = deviceShareError;
|
|
33
177
|
}
|
|
34
178
|
const status = {
|
|
35
179
|
platform: 'web',
|
|
@@ -41,8 +185,12 @@ var capacitorWebviewVersionChecker = (function (exports, core) {
|
|
|
41
185
|
currentMajorVersion,
|
|
42
186
|
latestVersion,
|
|
43
187
|
latestMajorVersion,
|
|
188
|
+
currentVersionSharePercent,
|
|
189
|
+
minimumDeviceSharePercent,
|
|
190
|
+
versionShareSource: normalizedVersionShareByMajor ? versionShareSource : undefined,
|
|
191
|
+
deviceShareError,
|
|
44
192
|
updateUrl: options.updateUrl,
|
|
45
|
-
source: (
|
|
193
|
+
source: (_b = options.source) !== null && _b !== void 0 ? _b : 'web-shim',
|
|
46
194
|
};
|
|
47
195
|
this.lastStatus = status;
|
|
48
196
|
this.notifyListeners('statusChanged', status);
|
|
@@ -115,11 +263,11 @@ var capacitorWebviewVersionChecker = (function (exports, core) {
|
|
|
115
263
|
}
|
|
116
264
|
detectCurrentVersion() {
|
|
117
265
|
const chromiumMatch = navigator.userAgent.match(/Chrome\/([\d.]+)/i);
|
|
118
|
-
if (chromiumMatch
|
|
266
|
+
if (chromiumMatch === null || chromiumMatch === void 0 ? void 0 : chromiumMatch[1]) {
|
|
119
267
|
return chromiumMatch[1];
|
|
120
268
|
}
|
|
121
269
|
const appleWebKitMatch = navigator.userAgent.match(/AppleWebKit\/([\d.]+)/i);
|
|
122
|
-
if (appleWebKitMatch
|
|
270
|
+
if (appleWebKitMatch === null || appleWebKitMatch === void 0 ? void 0 : appleWebKitMatch[1]) {
|
|
123
271
|
return appleWebKitMatch[1];
|
|
124
272
|
}
|
|
125
273
|
return navigator.userAgent;
|
|
@@ -146,8 +294,14 @@ var capacitorWebviewVersionChecker = (function (exports, core) {
|
|
|
146
294
|
}
|
|
147
295
|
compareVersions(left, right) {
|
|
148
296
|
var _a, _b;
|
|
149
|
-
const leftParts = left
|
|
150
|
-
|
|
297
|
+
const leftParts = left
|
|
298
|
+
.split(/[^0-9]+/)
|
|
299
|
+
.filter(Boolean)
|
|
300
|
+
.map((part) => Number.parseInt(part, 10));
|
|
301
|
+
const rightParts = right
|
|
302
|
+
.split(/[^0-9]+/)
|
|
303
|
+
.filter(Boolean)
|
|
304
|
+
.map((part) => Number.parseInt(part, 10));
|
|
151
305
|
const maxLength = Math.max(leftParts.length, rightParts.length);
|
|
152
306
|
for (let i = 0; i < maxLength; i += 1) {
|
|
153
307
|
const a = (_a = leftParts[i]) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -161,6 +315,32 @@ var capacitorWebviewVersionChecker = (function (exports, core) {
|
|
|
161
315
|
}
|
|
162
316
|
return 0;
|
|
163
317
|
}
|
|
318
|
+
normalizePercent(value) {
|
|
319
|
+
if (typeof value !== 'number' || Number.isNaN(value) || !Number.isFinite(value)) {
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
return Math.min(100, Math.max(0, value));
|
|
323
|
+
}
|
|
324
|
+
normalizeVersionShareByMajor(shareByMajor) {
|
|
325
|
+
if (!shareByMajor) {
|
|
326
|
+
return undefined;
|
|
327
|
+
}
|
|
328
|
+
const normalized = {};
|
|
329
|
+
for (const [rawKey, rawShare] of Object.entries(shareByMajor)) {
|
|
330
|
+
const major = this.parseMajorVersion(rawKey);
|
|
331
|
+
const share = this.normalizePercent(rawShare);
|
|
332
|
+
if (typeof major === 'number' && typeof share === 'number') {
|
|
333
|
+
normalized[major] = share;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return Object.keys(normalized).length > 0 ? normalized : undefined;
|
|
337
|
+
}
|
|
338
|
+
resolveCurrentVersionSharePercent(currentMajorVersion, normalizedShareByMajor) {
|
|
339
|
+
if (typeof currentMajorVersion !== 'number' || !normalizedShareByMajor) {
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
return normalizedShareByMajor[currentMajorVersion];
|
|
343
|
+
}
|
|
164
344
|
}
|
|
165
345
|
|
|
166
346
|
var web = /*#__PURE__*/Object.freeze({
|