@reactoo/watchtogether-sdk-js 2.7.19 → 2.7.21
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @reactoo/watchtogether-sdk-js
|
|
3
|
-
* @version 2.7.
|
|
3
|
+
* @version 2.7.21
|
|
4
4
|
*/
|
|
5
5
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
6
6
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -10522,7 +10522,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var webr
|
|
|
10522
10522
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10523
10523
|
|
|
10524
10524
|
"use strict";
|
|
10525
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"wait\", function() { return wait; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBrowserFingerprint\", function() { return getBrowserFingerprint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"generateUUID\", function() { return generateUUID; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeJanusDisplay\", function() { return decodeJanusDisplay; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setExactTimeout\", function() { return setExactTimeout; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clearExactTimeout\", function() { return clearExactTimeout; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"median\", function() { return median; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"maxJitter\", function() { return maxJitter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"chunkArray\", function() { return chunkArray; });\n/* harmony import */ var _wt_fingerprint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wt-fingerprint */ \"./src/modules/wt-fingerprint.js\");\n// import FingerprintJs from \"@fingerprintjs/fingerprintjs\";\n// import FingerprintJsPro from \"@fingerprintjs/fingerprintjs-pro\";\n\nlet wait = function (ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\nlet median = function (values) {\n if (values.length === 0) return 0;\n values.sort(function (a, b) {\n return a - b;\n });\n var half = Math.floor(values.length / 2);\n if (values.length % 2) return values[half];\n return (values[half - 1] + values[half]) / 2.0;\n};\n\n// const getFingerPrint = function(instanceType, salt) {\n//\n// let fingerprint = FingerprintJs.load({\n// monitoring: false\n// })\n//\n// return fingerprint\n// .then(fp => fp.get())\n// .then(result => {\n// const components = {\n// ...result.components,\n// instanceType: { value: instanceType + '_' + salt },\n// }\n// return [8,13,18,23].reduce((acc, cur) => {\n// return acc.slice(0,cur) + '-' + acc.slice(cur)\n// }, FingerprintJs.hashComponents(components)).substring(0,36)\n// })\n// }\n//\n// const getPreciseFingerPrint = function() {\n//\n// let fingerprintPro = FingerprintJsPro.load({\n// monitoring: false,\n// apiKey: '5UHdpSuX3wHr3CjyEiSP',\n// endpoint: \"https://fingerprint.reactoo.com\"\n// })\n//\n// return fingerprintPro\n// .then(fp => fp.get())\n// .then(result => {\n// let id = result.visitorId.padEnd(32, '0');\n// return [8,13,18,23].reduce((acc, cur) => {\n// return acc.slice(0,cur) + '-' + acc.slice(cur)\n// }, id).substring(0,36)\n// })\n// }\n\nlet getBrowserFingerprint = function () {\n let instanceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n let usePrecise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let salt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n // if(!usePrecise) {\n // return getFingerPrint(instanceType, salt)\n // }\n // else {\n // return getPreciseFingerPrint()\n // .catch(() => getFingerPrint(instanceType, salt))\n // }\n\n return Object(_wt_fingerprint__WEBPACK_IMPORTED_MODULE_0__[\"getFingerPrint\"])(instanceType, salt);\n};\nlet generateUUID = function () {\n var d = Date.now();\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n};\nconst janusDisplayDelimiter = ',';\nconst decodeJanusDisplay = display => {\n let output = {\n userId: null,\n role: \"participant\",\n start: Date.now(),\n displayName: \"?\"\n };\n if (display && typeof display === \"string\") {\n if (display.indexOf(janusDisplayDelimiter) >= 0) {\n let values = display.split(new RegExp(`\\\\${janusDisplayDelimiter}(?=(?:(?:[^\"]*\"){2})*[^\"]*$)`, 'mi')).map(v => v && v.startsWith('\"') || v.endsWith('\"') ? v.substring(1, v.length - 1) : /^\\d+$/.test(v) ? parseInt(v) : v);\n Object.keys(output).forEach((key, i) => values[i] ? output[key] = values[i] : null);\n } else {\n output.userId = display;\n }\n return output;\n } else if (display && typeof display === \"object\") {\n return Object.assign({}, output, display);\n }\n return null;\n};\nconst setExactTimeout = function (callback, duration, resolution) {\n const start = new Date().getTime();\n const timeout = setInterval(function () {\n if (new Date().getTime() - start > duration) {\n callback();\n clearInterval(timeout);\n }\n }, resolution);\n return timeout;\n};\nconst clearExactTimeout = function (timeout) {\n clearInterval(timeout);\n};\nconst maxJitter = x => {\n // A function that returns a value between 0.3 and 0.5 depending on the input x\n // The function is based on a logistic curve with parameters a, b, c, and d\n // The parameters are chosen such that f(30) = 0.3 and f(2) = 0.5\n let a = 0.2; // The maximum value of the function\n let b = -0.1; // The growth rate of the function\n let c = 16; // The inflection point of the function\n let d = 0.3; // The minimum value of the function\n return a / (1 + Math.exp(-b * (x - c))) + d; // Fixed the typo here\n};\nconst chunkArray = (
|
|
10525
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"wait\", function() { return wait; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBrowserFingerprint\", function() { return getBrowserFingerprint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"generateUUID\", function() { return generateUUID; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decodeJanusDisplay\", function() { return decodeJanusDisplay; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setExactTimeout\", function() { return setExactTimeout; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clearExactTimeout\", function() { return clearExactTimeout; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"median\", function() { return median; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"maxJitter\", function() { return maxJitter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"chunkArray\", function() { return chunkArray; });\n/* harmony import */ var _wt_fingerprint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wt-fingerprint */ \"./src/modules/wt-fingerprint.js\");\n// import FingerprintJs from \"@fingerprintjs/fingerprintjs\";\n// import FingerprintJsPro from \"@fingerprintjs/fingerprintjs-pro\";\n\nlet wait = function (ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\nlet median = function (values) {\n if (values.length === 0) return 0;\n values.sort(function (a, b) {\n return a - b;\n });\n var half = Math.floor(values.length / 2);\n if (values.length % 2) return values[half];\n return (values[half - 1] + values[half]) / 2.0;\n};\n\n// const getFingerPrint = function(instanceType, salt) {\n//\n// let fingerprint = FingerprintJs.load({\n// monitoring: false\n// })\n//\n// return fingerprint\n// .then(fp => fp.get())\n// .then(result => {\n// const components = {\n// ...result.components,\n// instanceType: { value: instanceType + '_' + salt },\n// }\n// return [8,13,18,23].reduce((acc, cur) => {\n// return acc.slice(0,cur) + '-' + acc.slice(cur)\n// }, FingerprintJs.hashComponents(components)).substring(0,36)\n// })\n// }\n//\n// const getPreciseFingerPrint = function() {\n//\n// let fingerprintPro = FingerprintJsPro.load({\n// monitoring: false,\n// apiKey: '5UHdpSuX3wHr3CjyEiSP',\n// endpoint: \"https://fingerprint.reactoo.com\"\n// })\n//\n// return fingerprintPro\n// .then(fp => fp.get())\n// .then(result => {\n// let id = result.visitorId.padEnd(32, '0');\n// return [8,13,18,23].reduce((acc, cur) => {\n// return acc.slice(0,cur) + '-' + acc.slice(cur)\n// }, id).substring(0,36)\n// })\n// }\n\nlet getBrowserFingerprint = function () {\n let instanceType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n let usePrecise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n let salt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n // if(!usePrecise) {\n // return getFingerPrint(instanceType, salt)\n // }\n // else {\n // return getPreciseFingerPrint()\n // .catch(() => getFingerPrint(instanceType, salt))\n // }\n\n return Object(_wt_fingerprint__WEBPACK_IMPORTED_MODULE_0__[\"getFingerPrint\"])(instanceType, salt);\n};\nlet generateUUID = function () {\n var d = Date.now();\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n};\nconst janusDisplayDelimiter = ',';\nconst decodeJanusDisplay = display => {\n let output = {\n userId: null,\n role: \"participant\",\n start: Date.now(),\n displayName: \"?\"\n };\n if (display && typeof display === \"string\") {\n if (display.indexOf(janusDisplayDelimiter) >= 0) {\n let values = display.split(new RegExp(`\\\\${janusDisplayDelimiter}(?=(?:(?:[^\"]*\"){2})*[^\"]*$)`, 'mi')).map(v => v && v.startsWith('\"') || v.endsWith('\"') ? v.substring(1, v.length - 1) : /^\\d+$/.test(v) ? parseInt(v) : v);\n Object.keys(output).forEach((key, i) => values[i] ? output[key] = values[i] : null);\n } else {\n output.userId = display;\n }\n return output;\n } else if (display && typeof display === \"object\") {\n return Object.assign({}, output, display);\n }\n return null;\n};\nconst setExactTimeout = function (callback, duration, resolution) {\n const start = new Date().getTime();\n const timeout = setInterval(function () {\n if (new Date().getTime() - start > duration) {\n callback();\n clearInterval(timeout);\n }\n }, resolution);\n return timeout;\n};\nconst clearExactTimeout = function (timeout) {\n clearInterval(timeout);\n};\nconst maxJitter = x => {\n // A function that returns a value between 0.3 and 0.5 depending on the input x\n // The function is based on a logistic curve with parameters a, b, c, and d\n // The parameters are chosen such that f(30) = 0.3 and f(2) = 0.5\n let a = 0.2; // The maximum value of the function\n let b = -0.1; // The growth rate of the function\n let c = 16; // The inflection point of the function\n let d = 0.3; // The minimum value of the function\n return a / (1 + Math.exp(-b * (x - c))) + d; // Fixed the typo here\n};\nconst chunkArray = function () {\n var _array;\n let array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n let chunkSize = arguments.length > 1 ? arguments[1] : undefined;\n array = [...array];\n if (!((_array = array) !== null && _array !== void 0 && _array.length)) return [[]];\n let results = [];\n while (array.length) {\n results.push(array.splice(0, chunkSize));\n }\n return results;\n};\n\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/modules/wt-utils.js?");
|
|
10526
10526
|
|
|
10527
10527
|
/***/ }),
|
|
10528
10528
|
|