From 912a3d9605490a2e4a7bab946050ae278331417c Mon Sep 17 00:00:00 2001 From: yujuiting Date: Mon, 14 Dec 2020 13:01:11 +0800 Subject: [PATCH] 1.0.15 --- dist/index.d.ts | 5 +++++ dist/index.esm.d.ts | 5 +++++ dist/index.esm.js | 7 +++++++ dist/index.esm.js.map | 2 +- dist/index.js | 7 +++++++ dist/index.js.map | 2 +- dist/tsconfig.tsbuildinfo | 6 +++--- package.json | 2 +- src/Agent.ts | 8 +++++++- src/TrackingEvent.ts | 4 ++++ 10 files changed, 41 insertions(+), 7 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 410f1b8..c216c2f 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -18,6 +18,10 @@ interface BasePayload { timestamp?: string; codename?: string; guestSessionId?: string; + sourceUrl?: string; + componentId?: string; + componentType?: string; + traceId?: string; } interface ClickButtonEventPayload extends BasePayload { action: "ButtonClick"; @@ -247,6 +251,7 @@ declare class MatomoAgent extends Agent { readonly config: MatomoAgentConfig; private get client(); private trackPageViewTimer; + private currentScene; constructor(config: MatomoAgentConfig); doInitialize(): Promise; report(event: SpyEvent): void; diff --git a/dist/index.esm.d.ts b/dist/index.esm.d.ts index 410f1b8..c216c2f 100644 --- a/dist/index.esm.d.ts +++ b/dist/index.esm.d.ts @@ -18,6 +18,10 @@ interface BasePayload { timestamp?: string; codename?: string; guestSessionId?: string; + sourceUrl?: string; + componentId?: string; + componentType?: string; + traceId?: string; } interface ClickButtonEventPayload extends BasePayload { action: "ButtonClick"; @@ -247,6 +251,7 @@ declare class MatomoAgent extends Agent { readonly config: MatomoAgentConfig; private get client(); private trackPageViewTimer; + private currentScene; constructor(config: MatomoAgentConfig); doInitialize(): Promise; report(event: SpyEvent): void; diff --git a/dist/index.esm.js b/dist/index.esm.js index 46fe090..e68b953 100644 --- a/dist/index.esm.js +++ b/dist/index.esm.js @@ -1238,6 +1238,7 @@ var MatomoAgent = /*#__PURE__*/function (_Agent2) { _this3 = _super2.call(this); _this3.config = config; _this3.trackPageViewTimer = 0; + _this3.currentScene = null; return _this3; } @@ -1304,6 +1305,7 @@ var MatomoAgent = /*#__PURE__*/function (_Agent2) { this.requestTrackPageView(); this.client.push(['enableLinkTracking']); this.client.push(['trackAllContentImpressions']); + this.currentScene = toScene; } }, { key: "track", @@ -1312,6 +1314,11 @@ var MatomoAgent = /*#__PURE__*/function (_Agent2) { var category = event.category, action = event.action, name = event.name; + + if (this.currentScene) { + event.payload.sourceUrl = this.currentScene.pathname; + } + var dimensions = createMatomoCustomDimensions(event); this.client.push(['trackEvent', category, action, name, '', dimensions]); return; diff --git a/dist/index.esm.js.map b/dist/index.esm.js.map index 0b80d01..9b7d734 100644 --- a/dist/index.esm.js.map +++ b/dist/index.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"index.esm.js","sources":["../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/esm/inherits.js","../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../node_modules/@babel/runtime/regenerator/index.js","../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../node_modules/@babel/runtime/helpers/esm/createClass.js","../src/utils/loadScript.ts","../src/utils/object.ts","../src/TrackingEvent.ts","../src/utils/constants.ts","../src/utils/param.ts","../src/Agent.ts","../src/utils/dom.ts","../src/Source.ts","../src/types.ts","../src/Observer.ts","../src/hooks.ts","../src/actions.ts","../src/createTrackingEvent.ts"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\"use strict\";\n\nvar Op = Object.prototype;\nvar hasOwn = Op.hasOwnProperty;\nvar undefined; // More compressible than void 0.\nvar $Symbol = typeof Symbol === \"function\" ? Symbol : {};\nvar iteratorSymbol = $Symbol.iterator || \"@@iterator\";\nvar asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\nvar toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\nfunction wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n}\n\n// Try/catch helper to minimize deoptimizations. Returns a completion\n// record like context.tryEntries[i].completion. This interface could\n// have been (and was previously) designed to take a closure to be\n// invoked without arguments, but in all the cases we care about we\n// already have an existing method we want to call, so there's no need\n// to create a new function object. We can even get away with assuming\n// the method takes exactly one argument, since that happens to be true\n// in every case, so we don't have to touch the arguments object. The\n// only additional allocation required is the completion record, which\n// has a stable shape and so hopefully should be cheap to allocate.\nfunction tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n}\n\nvar GenStateSuspendedStart = \"suspendedStart\";\nvar GenStateSuspendedYield = \"suspendedYield\";\nvar GenStateExecuting = \"executing\";\nvar GenStateCompleted = \"completed\";\n\n// Returning this object from the innerFn has the same effect as\n// breaking out of the dispatch switch statement.\nvar ContinueSentinel = {};\n\n// Dummy constructor functions that we use as the .constructor and\n// .constructor.prototype properties for functions that return Generator\n// objects. For full spec compliance, you may wish to configure your\n// minifier not to mangle the names of these two functions.\nfunction Generator() {}\nfunction GeneratorFunction() {}\nfunction GeneratorFunctionPrototype() {}\n\n// This is a polyfill for %IteratorPrototype% for environments that\n// don't natively support it.\nvar IteratorPrototype = {};\nIteratorPrototype[iteratorSymbol] = function () {\n return this;\n};\n\nvar getProto = Object.getPrototypeOf;\nvar NativeIteratorPrototype = getProto && getProto(getProto(values([])));\nif (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n}\n\nvar Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\nGeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\nGeneratorFunctionPrototype.constructor = GeneratorFunction;\nGeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n// Helper for defining the .next, .throw, and .return methods of the\n// Iterator interface in terms of a single ._invoke method.\nfunction defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n}\n\nfunction isGeneratorFunction (genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n};\n\nfunction mark (genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n};\n\n// Within the body of any async function, `await x` is transformed to\n// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n// `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n// meant to be awaited.\nfunction awrap (arg) {\n return { __await: arg };\n};\n\nfunction AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n}\n\ndefineIteratorMethods(AsyncIterator.prototype);\nAsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n};\n\n// Note that simple async functions are implemented on top of\n// AsyncIterator objects; they just return a Promise for the value of\n// the final result produced by the iterator.\n function async (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n};\n\nfunction makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n}\n\n// Call delegate.iterator[context.method](context.arg) and handle the\n// result, either by returning a { value, done } result from the\n// delegate iterator, or by modifying context.method and context.arg,\n// setting context.delegate to null, and returning the ContinueSentinel.\nfunction maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n}\n\n// Define Generator.prototype.{next,throw,return} in terms of the\n// unified ._invoke helper method.\ndefineIteratorMethods(Gp);\n\nGp[toStringTagSymbol] = \"Generator\";\n\n// A Generator should always return itself as the iterator object when the\n// @@iterator function is called on it. Some browsers' implementations of the\n// iterator prototype chain incorrectly implement this, causing the Generator\n// object to not be returned from this call. This ensures that doesn't happen.\n// See https://github.com/facebook/regenerator/issues/274 for more details.\nGp[iteratorSymbol] = function() {\n return this;\n};\n\nGp.toString = function() {\n return \"[object Generator]\";\n};\n\nfunction pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n}\n\nfunction resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n}\n\nfunction Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n}\n\nfunction keys (object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n};\n\nfunction values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n}\n\nfunction doneResult() {\n return { value: undefined, done: true };\n}\n\nContext.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n};\n\n// Export a default namespace that plays well with Rollup\nexport default {\n wrap,\n isGeneratorFunction,\n AsyncIterator,\n mark,\n awrap,\n async,\n keys,\n values\n};\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export function loadScript(src: string) {\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.defer = true;\n script.src = src;\n\n const firstScript = document.getElementsByTagName('script')[0];\n firstScript.parentNode!.insertBefore(script, firstScript);\n\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = reject;\n });\n}\n\nexport function loadScripts(...src: string[]) {\n return Promise.all(src.map(loadScript));\n}\n","export function trim(object: Record) {\n for (const key in object) {\n if (typeof object[key] === 'undefined') {\n delete object[key];\n }\n if (object[key] === null) {\n delete object[key];\n }\n }\n}\n\nexport function convertStringToSankecase(str: string) {\n const upperCaseMap = new Map();\n const strArray = Array.from(str);\n strArray.forEach((char, index) => {\n const currentCharCode = char.charCodeAt(0);\n const asciiCodeA = 'A'.charCodeAt(0);\n const asciiCodeZ = 'Z'.charCodeAt(0);\n if (currentCharCode >= asciiCodeA && currentCharCode <= asciiCodeZ) {\n upperCaseMap.set(index, char);\n }\n });\n upperCaseMap.forEach((value, key) => {\n strArray[key] = `_${value.toLowerCase()}`;\n });\n return strArray.join('');\n}\n\nexport function convertParamsToSankecase(params: T) {\n return Object.keys(params).reduce((prev: Record, key: string) => {\n const currentParams = prev;\n const snakecaseKey = convertStringToSankecase(key);\n currentParams[snakecaseKey] = (params as any)[key];\n return currentParams;\n }, {});\n}\n","interface BaseEvent {\n type: 'tracking';\n category: string;\n action: string;\n name: string;\n payload: Payload;\n $$type: 'TrackingEvent';\n}\n\n// auto injection\nexport interface BasePayload {\n //如果是訪客打 \"guest\"\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: string;\n codename?: string;\n guestSessionId?: string;\n}\n\ninterface ClickButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n}\n\nexport interface ClickButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickTabEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // url\n page: string;\n}\n\nexport interface ClickTabEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickLeaderboardButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // bonus, contributor, vote\n type: string;\n}\n\nexport interface ClickLeaderboardButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'button_expend.open' | 'button_expend.close' | 'button_vote';\n}\n\ninterface ClickTopStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'topavatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickTopStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_top';\n}\n\ninterface ClickStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'avatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_streamer';\n}\n\ninterface LinkEventPayload extends BasePayload {\n action: 'LinkClick';\n url: string;\n //超連結字名稱\n name: string;\n}\n\nexport interface LinkEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'link_info';\n}\n\ninterface PageViewEventPayload extends BasePayload {\n leaderboardStartTime: number;\n leaderboardEndTime: number;\n // url\n from: string;\n // url\n to: string;\n utmCampaign: string;\n utmContent: string;\n utmMedium: string;\n utmSource: string;\n}\n\nexport interface PageViewEvent extends BaseEvent {\n category: 'Leaderboard' | 'Infomation';\n action: 'view';\n name: 'event_view';\n}\n\ninterface SectionViewEventPayload extends BasePayload {\n section: string;\n action: 'enter' | 'leave';\n //滑榜單停下時,打看到的最後一個名次\n rank?: number;\n // 提供給客製活動使用(因為url不會轉換)\n customPath?: string;\n}\n\nexport interface SectionViewEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'scroll';\n}\n\ninterface SearchUserEventPayload extends BasePayload {\n searchString: string;\n resultCount: number;\n}\n\nexport interface SearchUserEvent extends BaseEvent {\n category: 'Content';\n action: 'search';\n name: 'search_user';\n}\n\nexport type TrackingEvent =\n | ClickButtonEvent\n | ClickTabEvent\n | ClickLeaderboardButtonEvent\n | ClickTopStreamerEvent\n | ClickStreamerEvent\n | LinkEvent\n | PageViewEvent\n | SectionViewEvent\n | SearchUserEvent;\n\nexport function isTrackingEvent(value: unknown): value is TrackingEvent {\n if (typeof value !== 'object') return false;\n if (value === null) return false;\n return (value as TrackingEvent).$$type === 'TrackingEvent';\n}\n","export const EVENT_NAME_CLICK = 'click';\nexport const EVENT_NAME_ENTER = 'enter';\nexport const EVENT_NAME_LEAVE = 'leave';\nexport const EVENT_NAME_SEARCH = 'search';\nexport const EVENT_NAME_SECTION_VIEW = 'section_view';\n\nexport const CATEGORY_DEFAULT = 'default';\n\nexport const ACTION_BUTTON_CLICK = 'ButtonClick';\nexport const ACTION_TAB_CLICK = 'TabClick';\nexport const ACTION_PROFILE_CLICK = 'ProfileClick';\nexport const ACTION_LINK_CLICK = 'LinkClick';\nexport const ACTION_ENTER = 'scroll';\n\nexport const __CLIENT__ = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n\nexport const matomoCustomDimensionMap: Record = {\n contentId: 'dimension1',\n contentType: 'dimension2',\n search: 'dimension5',\n comment: 'dimension6',\n genericJson: 'dimension11',\n genericText: 'dimension12',\n traceId: 'dimension13',\n appVersion: 'dimension15',\n deviceId: 'dimension16',\n timestamp: 'dimension17',\n componentId: 'dimension21',\n componentType: 'dimension22',\n advertisingId: 'dimension23',\n sourceUrl: 'dimension24',\n user: 'dimension25',\n};\n","import qs from 'qs';\nimport { v4 } from 'uuid';\nimport { Scene, DefaultEventParams, RefinedEventPathname, TrackingToken } from 'types';\nimport { TrackingEvent as V2TrackingEvent } from '../TrackingEvent';\nimport { matomoCustomDimensionMap } from './constants';\n\nfunction getUserID() {\n const qsUserID = qs.parse(window.location.search, { ignoreQueryPrefix: true }).userID;\n if (Array.isArray(qsUserID)) {\n return sessionStorage.getItem('userID') || 'guest';\n }\n // The order of checking UserID.\n // 1. sessionStorage\n // 2. query string\n return sessionStorage.getItem('userID') || `${qsUserID}` || 'guest';\n}\n\nfunction createTrackingToken() {\n const storageKey = 'trackingToken';\n const days30 = 60 * 60 * 24 * 30 * 1000;\n const newTrackingToken: TrackingToken = {\n sessionID: v4(),\n date: Date.now(),\n };\n\n try {\n const trackingToken = JSON.parse(localStorage.getItem(storageKey) || '') as TrackingToken;\n const { date, sessionID } = trackingToken;\n // Expired checking (after 30 days)\n if (Date.now() - date < days30) return sessionID;\n\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n } catch (error) {\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n }\n return newTrackingToken.sessionID;\n}\n\nexport function createScene(): Scene {\n const { title } = window.document;\n const { hostname, pathname } = window.location;\n return { title, hostname, pathname };\n}\n\nexport function refineEventPathname(pathname: string): RefinedEventPathname {\n const slashCount = pathname.match(/-/g)?.length;\n if (slashCount && slashCount >= 3) {\n // slashCount === 3+\n const pathnameArray = pathname.split('-');\n const eventId = pathnameArray[0];\n const codename = pathnameArray.splice(1, pathnameArray.length).join('-');\n return { eventId, codename };\n }\n return { eventId: '', codename: pathname };\n}\n\nexport function createDefaultEventParams(): DefaultEventParams {\n const codenameArray = window.location.pathname.split('/');\n const eventPathname = codenameArray.length > 1 ? codenameArray[1] : '';\n const { eventId, codename } = refineEventPathname(eventPathname);\n const trackingToken = createTrackingToken();\n\n return {\n userId: getUserID(),\n lang: navigator.language || '',\n os: navigator.userAgent || '',\n timestamp: Date.now(),\n codename,\n eventId,\n guestSessionId: trackingToken,\n };\n}\n\nexport function createMatomoCustomDimensions(event: V2TrackingEvent) {\n const dimensions: Record = {};\n for (const key in event.payload) {\n const dimensionKey = matomoCustomDimensionMap[key];\n if (!dimensionKey) continue;\n dimensions[dimensionKey] = event.payload[key as keyof typeof event.payload];\n }\n return dimensions;\n}\n","/* eslint-disable @typescript-eslint/camelcase */\n\nimport { loadScript, loadScripts } from 'utils/loadScript';\nimport * as object from 'utils/object';\nimport { TrackingEvent, TransitionEvent, LoginEvent, SpyEvent } from 'types';\nimport type { analytics } from 'firebase';\nimport { isTrackingEvent as isV2TrackingEvent, TrackingEvent as V2TrackingEvent } from './TrackingEvent';\nimport * as params from './utils/param';\n\nenum AgentState {\n Uninitialized,\n Initializing,\n Initialized,\n InitializeFail,\n}\n\ndeclare var firebase: any;\n\nexport abstract class Agent {\n protected state = AgentState.Uninitialized;\n\n async initialize() {\n if (this.state !== AgentState.Uninitialized) return;\n\n this.state = AgentState.Initializing;\n\n try {\n await this.doInitialize();\n this.state = AgentState.Initialized;\n } catch (error) {\n console.error(error);\n this.state = AgentState.InitializeFail;\n }\n }\n\n abstract report(event: SpyEvent): void;\n\n protected abstract doInitialize(): Promise | void;\n}\n\nlet isInit = false;\n\nexport class FirebaseAgent extends Agent {\n private client!: analytics.Analytics;\n\n private queue: Array<() => void> = [];\n\n /**\n * @param config @see https://support.google.com/firebase/answer/7015592\n */\n constructor(readonly config: any) {\n super();\n }\n\n async doInitialize() {\n await loadScripts(\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-app.js',\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-analytics.js',\n );\n\n if (!isInit) {\n this.client = firebase.initializeApp(this.config).analytics();\n isInit = true;\n } else {\n this.client = firebase.analytics();\n }\n\n this.queue.forEach(callback => callback());\n\n this.queue = [];\n }\n\n report(event: SpyEvent) {\n this.queueIfNotInitialized(() => this.doReport(event));\n }\n\n private doReport(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n this.client.setUserId(userId, { global: true });\n if (userId) this.client.logEvent('login', { userId });\n }\n\n private transit(event: TransitionEvent) {\n const { toScene, defaultTrackingParams } = event;\n const { title, hostname, pathname } = toScene;\n this.client.logEvent('page_view', {\n page_title: title,\n page_location: hostname,\n page_path: pathname,\n ...object.convertParamsToSankecase(defaultTrackingParams),\n });\n this.client.setCurrentScreen(event.toScene.title, { global: true });\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { name, payload } = event;\n object.trim(payload);\n this.client.logEvent(name, object.convertParamsToSankecase(payload));\n return;\n }\n const { eventName, trackingParams = {} } = event;\n object.trim(trackingParams);\n this.client.logEvent(eventName, object.convertParamsToSankecase(trackingParams));\n }\n\n private queueIfNotInitialized(callback: () => void) {\n if (this.state === AgentState.Initialized) callback();\n else this.queue.push(callback);\n }\n}\n\nexport interface MatomoAgentConfig {\n endpoint: string;\n siteId: string;\n}\n\nexport class MatomoAgent extends Agent {\n private get client() {\n window._paq = window._paq || []; // eslint-disable-line no-underscore-dangle\n return window._paq; // eslint-disable-line no-underscore-dangle\n }\n\n private trackPageViewTimer = 0;\n\n constructor(readonly config: MatomoAgentConfig) {\n super();\n }\n\n async doInitialize() {\n this.client.push(['setTrackerUrl', `${this.config.endpoint}matomo.php`]);\n this.client.push(['setSiteId', this.config.siteId]);\n this.client.push(['trackPageView']);\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n await loadScript(`${this.config.endpoint}piwik.js`);\n }\n\n report(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n if (userId) this.client.push(['setUserId', userId]);\n else this.client.push(['resetUserId']);\n this.requestTrackPageView();\n }\n\n private transit(event: TransitionEvent) {\n const { fromScene, toScene } = event;\n this.client.push(['setReferrerUrl', fromScene.pathname]);\n this.client.push(['setCustomUrl', toScene.pathname]);\n this.client.push(['setDocumentTitle', toScene.title]);\n this.client.push(['setGenerationTimeMs', 0]);\n this.requestTrackPageView();\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { category, action, name } = event;\n const dimensions = params.createMatomoCustomDimensions(event);\n this.client.push(['trackEvent', category, action, name, '', dimensions]);\n return;\n }\n // matomo support only v2 event\n // /**\n // * ref : https://developer.matomo.org/guides/tracking-javascript\n // * trackEvent(category, action, [name], [value]) -\n // * Log an event with an event category (Videos, Music, Games...), an event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional event name and optional numeric value.\n // */\n // const { eventName, category, trackingParams = {} } = event;\n // const { name = '', value = '' } = trackingParams;\n // const dimensions = {};\n // /**\n // * _paq.push(['trackEvent', category, action, name, value, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackSiteSearch', keyword, category, resultsCount, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackLink', url, linkType, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackGoal', idGoal, customRevenue, {dimension1: 'DimensionValue'}]);\n // */\n // this.client.push(['trackEvent', category, eventName, name, value, dimensions]);\n }\n\n private requestTrackPageView() {\n if (this.trackPageViewTimer) clearTimeout(this.trackPageViewTimer);\n this.trackPageViewTimer = setTimeout(() => {\n this.client.push(['trackPageView']);\n this.trackPageViewTimer = 0;\n });\n }\n}\n","const tagNameRole: Record = {\n alert: 'alert',\n alertdialog: 'alertdialog',\n application: 'application',\n article: 'article',\n banner: 'banner',\n button: 'button',\n cell: 'cell',\n checkbox: 'checkbox',\n columnheader: 'columnheader',\n combobox: 'combobox',\n command: 'command',\n complementary: 'complementary',\n composite: 'composite',\n contentinfo: 'contentinfo',\n definition: 'definition',\n dialog: 'dialog',\n directory: 'directory',\n document: 'document',\n feed: 'feed',\n figure: 'figure',\n form: 'form',\n grid: 'grid',\n gridcell: 'gridcell',\n group: 'group',\n heading: 'heading',\n img: 'img',\n input: 'input',\n landmark: 'landmark',\n link: 'link',\n list: 'list',\n listbox: 'listbox',\n listitem: 'listitem',\n log: 'log',\n main: 'main',\n 'The main content of a document.': 'The main content of a document.',\n marquee: 'marquee',\n math: 'math',\n 'Content that represents a mathematical expression.': 'Content that represents a mathematical expression.',\n menu: 'menu',\n menubar: 'menubar',\n menuitem: 'menuitem',\n menuitemcheckbox: 'menuitemcheckbox',\n menuitemradio: 'menuitemradio',\n navigation: 'navigation',\n none: 'none',\n note: 'note',\n option: 'option',\n presentation: 'presentation',\n progressbar: 'progressbar',\n radio: 'radio',\n radiogroup: 'radiogroup',\n range: 'range',\n region: 'region',\n roletype: 'roletype',\n row: 'row',\n rowgroup: 'rowgroup',\n rowheader: 'rowheader',\n scrollbar: 'scrollbar',\n search: 'search',\n searchbox: 'searchbox',\n section: 'section',\n sectionhead: 'sectionhead',\n select: 'select',\n separator: 'separator',\n slider: 'slider',\n spinbutton: 'spinbutton',\n status: 'status',\n structure: 'structure',\n switch: 'switch',\n tab: 'tab',\n table: 'table',\n tablist: 'tablist',\n tabpanel: 'tabpanel',\n term: 'term',\n textbox: 'textbox',\n timer: 'timer',\n toolbar: 'toolbar',\n tooltip: 'tooltip',\n tree: 'tree',\n treegrid: 'treegrid',\n treeitem: 'treeitem',\n widget: 'widget',\n window: 'window',\n};\n\nexport function guessRole(element: HTMLElement) {\n return element.getAttribute('role') || tagNameRole[element.tagName] || 'unknown';\n}\n\nexport function getContent(element: HTMLElement) {\n return element.innerText;\n}\n","import { TransitionEvent, TrackingEvent, TrackingEventParams, Scene, SpyEvent } from 'types';\nimport { Agent } from 'Agent';\nimport { History } from 'history';\nimport * as dom from 'utils/dom';\nimport { createScene, createDefaultEventParams } from 'utils/param';\nimport { TrackingEvent as V2TrackingEvent, isTrackingEvent as isV2TrackingEvent } from './TrackingEvent';\n\nexport interface Source {\n addAgent(agent: Agent): void;\n}\n\nexport class DefaultSource implements Source {\n private agents: Agent[] = [];\n\n private currentScene: Scene = createScene();\n\n addAgent(agent: Agent) {\n agent.initialize();\n this.agents.push(agent);\n }\n\n spyTransition(history: History) {\n // wait for whole page updated\n // init page_view\n setTimeout(() => this.transit(createScene()), 100);\n history.listen(() => {\n const { action } = history;\n // Filtering replace action (The pushed url is not matching, ex: Redirect)\n if (action === 'PUSH') {\n setTimeout(() => this.transit(createScene()), 100);\n }\n });\n }\n\n spyClick() {\n window.addEventListener('click', event => {\n const { target } = event;\n if (target instanceof HTMLElement) {\n this.track({\n eventName: 'click',\n category: 'default',\n trackingParams: {\n name: dom.getContent(target),\n value: '',\n role: dom.guessRole(target),\n },\n });\n }\n });\n }\n\n // tracking page visibility. e.g. page minimized, change browser tab or page unload\n spyPageDurationByVisible(params?: TrackingEventParams) {\n let startDurationTime: number = 0;\n\n const handleVisibleChange = (e: Event) => {\n if (document.visibilityState === 'hidden') {\n const endDurationTime = e.timeStamp;\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url: window.location.href,\n duration,\n ...params,\n },\n });\n }\n if (document.visibilityState === 'visible') {\n startDurationTime = e.timeStamp;\n }\n };\n document.addEventListener('visibilitychange', handleVisibleChange);\n }\n\n spyPageDurationByTransition(history: History, params?: TrackingEventParams) {\n let startDurationTime: number = Date.now();\n let url = window.location.href;\n history.listen(() => {\n const endDurationTime: number = Date.now();\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url,\n duration,\n ...params,\n },\n });\n startDurationTime = endDurationTime;\n url = window.location.href;\n });\n }\n\n login(userId: string) {\n this.report({ type: 'login', userId });\n }\n\n transit(toScene: Scene) {\n const fromScene = this.currentScene;\n const event: TransitionEvent = {\n type: 'transition',\n fromScene,\n toScene,\n defaultTrackingParams: createDefaultEventParams(),\n };\n this.report(event);\n }\n\n track(event: Omit | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n this.report(event);\n return;\n }\n const { trackingParams } = event;\n const defaultParams = trackingParams?.hasOwnProperty('productName') ? {} : createDefaultEventParams();\n const mergedTrackingParams = {\n ...defaultParams,\n ...trackingParams,\n };\n event.trackingParams = mergedTrackingParams;\n this.report({ type: 'tracking', ...event });\n }\n\n private report(event: SpyEvent) {\n this.agents.forEach(agent => {\n try {\n agent.report(event);\n } catch (error) {\n console.error(error);\n }\n });\n }\n}\n","import { TrackingEvent as V2TrackingEvent } from './TrackingEvent';\n\nexport enum Threshold {\n 'MIN' = 0,\n 'HALF' = 0.5,\n 'FULL' = 1,\n}\n\nexport interface Scene {\n title: string;\n hostname: string;\n pathname: string;\n}\n\nexport interface TransitionEvent {\n type: 'transition';\n fromScene: Scene;\n toScene: Scene;\n defaultTrackingParams: DefaultEventParams;\n}\n\nexport interface TrackingToken {\n sessionID: string;\n date: number;\n}\n\nexport interface TrackingEventParams {\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: number;\n action?: string;\n name?: string;\n role?: string;\n value?: string;\n page?: string;\n type?: string;\n leaderboardId?: string;\n streamerId?: string;\n liveStatus?: boolean;\n section?: string;\n rank?: number;\n to?: string;\n url?: string;\n utmCampaign?: string;\n utmContent?: string;\n utmMedium?: string;\n utmSource?: string;\n searchString?: string;\n resultCount?: number;\n hasDeeplink?: boolean;\n codename?: string;\n productName?: string;\n userName?: string;\n from?: string;\n result?: string;\n duration?: number;\n customPath?: string;\n}\nexport interface TrackingEvent {\n type: 'tracking';\n category: string;\n eventName: string;\n action?: string;\n trackingParams?: TrackingEventParams;\n}\n\nexport interface DefaultEventParams {\n userId: string;\n lang: string;\n os: string;\n eventId: string;\n timestamp: number;\n codename: string;\n guestSessionId: string;\n}\n\nexport interface LoginEvent {\n type: 'login';\n userId: string;\n}\n\nexport interface RefinedEventPathname {\n eventId: string;\n codename: string;\n}\n\nexport type ElementMap = Map;\n\nexport type SpyEvent = TrackingEvent | TransitionEvent | LoginEvent | V2TrackingEvent;\n\nexport type EventCallback = (event: T) => void;\n\nexport type EventListener = (callback: EventCallback) => void;\n","import { RefObject } from 'react';\nimport { ElementMap, Threshold } from './types';\nimport { __CLIENT__ } from './utils/constants';\nimport 'intersection-observer';\n\nclass SectionObserver {\n public elementMap: ElementMap;\n\n private observer: IntersectionObserver | undefined;\n\n private debounceExecute: number;\n\n constructor(debounce: boolean, threshold: Threshold) {\n this.elementMap = new Map();\n this.debounceExecute = 0;\n try {\n this.observer = new window.IntersectionObserver(\n entries => {\n if (debounce) {\n this.debounceSectionIntersect(entries);\n } else {\n this.sectionIntersect(entries);\n }\n },\n {\n threshold: [threshold],\n },\n );\n } catch (error) {\n console.log(`Error occur when creating IntersectionObserver: ${error}`);\n }\n }\n\n sectionObserve(ref: RefObject, callback: Function) {\n if (this.observer) this.observer.observe(ref.current);\n this.elementMap.set(ref.current, callback);\n }\n\n sectionUnobserve(ref: RefObject) {\n if (this.observer) this.observer.unobserve(ref.current);\n if (this.elementMap.has(ref.current)) this.elementMap.delete(ref.current);\n }\n\n resetSectionObserver() {\n this.elementMap.forEach((value, key) => {\n if (this.observer) this.observer.observe(key);\n });\n }\n\n private sectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n callback();\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n\n private debounceSectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n clearTimeout(this.debounceExecute);\n this.debounceExecute = window.setTimeout(() => {\n callback();\n }, 1000);\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n}\n\nexport let completeSectionObserver: SectionObserver | undefined;\nexport let halfSectionObserver: SectionObserver | undefined;\nexport let minSectionObserver: SectionObserver | undefined;\nexport let rankSectionObserver: SectionObserver | undefined;\n\nexport function registCompleteSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registCompleteSectionObserver()] should be invoked on client side.');\n }\n if (!completeSectionObserver) completeSectionObserver = new SectionObserver(false, Threshold.FULL);\n completeSectionObserver.sectionObserve(ref, callback);\n return () => {\n completeSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registHalfSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registHalfSectionObserver()] should be invoked on client side.');\n }\n\n if (!halfSectionObserver) halfSectionObserver = new SectionObserver(false, Threshold.HALF);\n halfSectionObserver.sectionObserve(ref, callback);\n return () => {\n halfSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registMinSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registMinSectionObserver()] should be invoked on client side.');\n }\n\n if (!minSectionObserver) minSectionObserver = new SectionObserver(false, Threshold.MIN);\n minSectionObserver.sectionObserve(ref, callback);\n return () => {\n minSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registRankSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registRankSectionObserver()] should be invoked on client side.');\n }\n\n if (!rankSectionObserver) rankSectionObserver = new SectionObserver(true, Threshold.FULL);\n rankSectionObserver.sectionObserve(ref, callback);\n return () => {\n rankSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function resetSectionObserverStatus() {\n if (completeSectionObserver) completeSectionObserver.resetSectionObserver();\n if (halfSectionObserver) halfSectionObserver.resetSectionObserver();\n if (minSectionObserver) minSectionObserver.resetSectionObserver();\n if (rankSectionObserver) rankSectionObserver.resetSectionObserver();\n}\n","import { RefObject, useEffect } from 'react';\nimport { History } from 'history';\nimport { DefaultSource } from './Source';\n\nimport {\n registCompleteSectionObserver,\n registHalfSectionObserver,\n registMinSectionObserver,\n registRankSectionObserver,\n resetSectionObserverStatus,\n} from './Observer';\n\nexport function useCompleteSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registCompleteSectionObserver(ref, callback);\n });\n}\n\nexport function useHalfSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registHalfSectionObserver(ref, callback);\n });\n}\n\nexport function useMinSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registMinSectionObserver(ref, callback);\n });\n}\n\nexport function useRankSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registRankSectionObserver(ref, callback);\n });\n}\n\nexport function usePageTransitionListener(trackingSource: DefaultSource, history: History) {\n useEffect(() => {\n // Regist history (for page_view & screen_view)\n trackingSource.spyTransition(history);\n history.listen(() => {\n resetSectionObserverStatus();\n });\n }, [history]);\n}\n","import {\n EVENT_NAME_CLICK,\n EVENT_NAME_ENTER,\n EVENT_NAME_LEAVE,\n EVENT_NAME_SEARCH,\n EVENT_NAME_SECTION_VIEW,\n CATEGORY_DEFAULT,\n ACTION_BUTTON_CLICK,\n ACTION_TAB_CLICK,\n ACTION_PROFILE_CLICK,\n ACTION_LINK_CLICK,\n ACTION_ENTER,\n} from './utils/constants';\n\nimport { TrackingEvent } from './types';\n\ntype EventAction = Omit;\ntype SectionName = 'buttons' | 'duration' | 'gifts' | 'searchBar' | 'tabs' | 'description' | 'timeline' | 'topStreamer';\ntype ProfileName = 'topavatar' | 'avatar';\n\nexport function createButtonClickAction(buttonName: string, link: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: buttonName,\n page: link,\n },\n };\n}\n\nexport function createPageEnterAction(\n utmCampaign: string,\n utmContent: string,\n utmMedium: string,\n utmSource: string,\n): EventAction {\n return {\n eventName: EVENT_NAME_ENTER,\n category: CATEGORY_DEFAULT,\n trackingParams: {\n utmCampaign,\n utmContent,\n utmMedium,\n utmSource,\n },\n };\n}\n\nexport function createPageLeaveAction(): EventAction {\n return {\n eventName: EVENT_NAME_LEAVE,\n category: CATEGORY_DEFAULT,\n };\n}\n\nexport function createTabClickAction(link: string, tabName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_TAB_CLICK,\n page: link,\n name: tabName,\n },\n };\n}\n\nexport function createProfileClickAction(userID: string, liveStatus: boolean, profileType: ProfileName): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: liveStatus ? 'LiveStream' : 'Profile',\n trackingParams: {\n action: ACTION_PROFILE_CLICK,\n type: profileType,\n streamerId: userID,\n liveStatus: liveStatus,\n leaderboardId: '',\n hasDeeplink: false,\n },\n };\n}\n\nexport function createSearchAction(keyword: string, count: number): EventAction {\n return {\n eventName: EVENT_NAME_SEARCH,\n category: 'Content',\n trackingParams: {\n searchString: keyword,\n resultCount: count,\n },\n };\n}\n\nexport function createVoteAction(voteTopic: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'Interaction_vote',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: voteTopic,\n type: 'vote',\n },\n };\n}\n\nexport function createLeaderboardSectionViewAction(rank: number): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section: 'leaderboardItem',\n rank,\n },\n };\n}\n\nexport function createLinkClickAction(link: string, linkName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_LINK_CLICK,\n url: link,\n name: linkName,\n },\n };\n}\n\nexport function createSectionViewAction(section: SectionName, customPath?: string): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section,\n // For customized event to use.\n customPath,\n },\n };\n}\n","import { TrackingEvent } from './TrackingEvent';\nimport { createDefaultEventParams } from './utils/param';\n\nexport function createTrackingEvent(event: Omit) {\n return {\n ...event,\n payload: { ...createDefaultEventParams(), ...event.payload },\n type: 'tracking',\n $$type: 'TrackingEvent',\n } as TrackingEvent;\n}\n"],"names":["setPrototypeOf","assertThisInitialized","Op","Object","prototype","hasOwn","hasOwnProperty","undefined","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","fn","obj","arg","type","call","err","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","constructor","displayName","defineIteratorMethods","forEach","method","isGeneratorFunction","genFun","ctor","name","mark","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","value","then","unwrapped","error","previousPromise","enqueue","callInvokeWithMethodAndArg","async","Promise","iter","next","done","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","info","resultName","nextLoc","toString","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","keys","object","key","reverse","length","pop","iterable","iteratorMethod","isNaN","i","skipTempReset","prev","charAt","slice","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","object.convertParamsToSankecase","isV2TrackingEvent","object.trim","params.createMatomoCustomDimensions","dom.getContent","dom.guessRole"],"mappings":";;;;;AAAe,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;AACzD,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;AACpC,MAAM,KAAK,EAAE,KAAK;AAClB,MAAM,UAAU,EAAE,IAAI;AACtB,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,QAAQ,EAAE,IAAI;AACpB,KAAK,CAAC,CAAC;AACP,GAAG,MAAM;AACT,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACrB,GAAG;AACH;AACA,EAAE,OAA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AA,IAAI,EAAE,SAFQ;AAGd,MAAA,IAAI,EAAE;AAHQ;AAHX,GAAP;AASD;AAEK,SAAU,kCAAV,CAA6C,IAA7C,EAAyD;AAC7D,SAAO;AACL,IAAA,SAAS,EAAE,uBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,YADM;AAEd,MAAA,OAAO,EAAE,iBAFK;AAGd,MAAA,IAAI,EAAJ;AAHc;AAHX,GAAP;AASD;AAEK,SAAU,qBAAV,CAAgC,IAAhC,EAA8C,QAA9C,EAA8D;AAClE,SAAO;AACL,IAAA,SAAS,EAAE,gBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,iBADM;AAEd,MAAA,GAAG,EAAE,IAFS;AAGd,MAAA,IAAI,EAAE;AAHQ;AAHX,GAAP;AASD;AAEK,SAAU,uBAAV,CAAkC,OAAlC,EAAwD,UAAxD,EAA2E;AAC/E,SAAO;AACL,IAAA,SAAS,EAAE,uBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,YADM;AAEd,MAAA,OAAO,EAAP,OAFc;AAGd;AACA,MAAA,UAAU,EAAV;AAJc;AAHX,GAAP;AAUD;;;;;AC3IK,SAAU,mBAAV,CAA8B,KAA9B,EAA2E;AAC/E,6CACK,KADL;AAEE,IAAA,OAAO,sCAAO,wBAAwB,EAA/B,GAAsC,KAAK,CAAC,OAA5C,CAFT;AAGE,IAAA,IAAI,EAAE,UAHR;AAIE,IAAA,MAAM,EAAE;AAJV;AAMD;;;;"} \ No newline at end of file +{"version":3,"file":"index.esm.js","sources":["../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/esm/inherits.js","../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../node_modules/@babel/runtime/regenerator/index.js","../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../node_modules/@babel/runtime/helpers/esm/createClass.js","../src/utils/loadScript.ts","../src/utils/object.ts","../src/TrackingEvent.ts","../src/utils/constants.ts","../src/utils/param.ts","../src/Agent.ts","../src/utils/dom.ts","../src/Source.ts","../src/types.ts","../src/Observer.ts","../src/hooks.ts","../src/actions.ts","../src/createTrackingEvent.ts"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\"use strict\";\n\nvar Op = Object.prototype;\nvar hasOwn = Op.hasOwnProperty;\nvar undefined; // More compressible than void 0.\nvar $Symbol = typeof Symbol === \"function\" ? Symbol : {};\nvar iteratorSymbol = $Symbol.iterator || \"@@iterator\";\nvar asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\nvar toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\nfunction wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n}\n\n// Try/catch helper to minimize deoptimizations. Returns a completion\n// record like context.tryEntries[i].completion. This interface could\n// have been (and was previously) designed to take a closure to be\n// invoked without arguments, but in all the cases we care about we\n// already have an existing method we want to call, so there's no need\n// to create a new function object. We can even get away with assuming\n// the method takes exactly one argument, since that happens to be true\n// in every case, so we don't have to touch the arguments object. The\n// only additional allocation required is the completion record, which\n// has a stable shape and so hopefully should be cheap to allocate.\nfunction tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n}\n\nvar GenStateSuspendedStart = \"suspendedStart\";\nvar GenStateSuspendedYield = \"suspendedYield\";\nvar GenStateExecuting = \"executing\";\nvar GenStateCompleted = \"completed\";\n\n// Returning this object from the innerFn has the same effect as\n// breaking out of the dispatch switch statement.\nvar ContinueSentinel = {};\n\n// Dummy constructor functions that we use as the .constructor and\n// .constructor.prototype properties for functions that return Generator\n// objects. For full spec compliance, you may wish to configure your\n// minifier not to mangle the names of these two functions.\nfunction Generator() {}\nfunction GeneratorFunction() {}\nfunction GeneratorFunctionPrototype() {}\n\n// This is a polyfill for %IteratorPrototype% for environments that\n// don't natively support it.\nvar IteratorPrototype = {};\nIteratorPrototype[iteratorSymbol] = function () {\n return this;\n};\n\nvar getProto = Object.getPrototypeOf;\nvar NativeIteratorPrototype = getProto && getProto(getProto(values([])));\nif (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n}\n\nvar Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\nGeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\nGeneratorFunctionPrototype.constructor = GeneratorFunction;\nGeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n// Helper for defining the .next, .throw, and .return methods of the\n// Iterator interface in terms of a single ._invoke method.\nfunction defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n}\n\nfunction isGeneratorFunction (genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n};\n\nfunction mark (genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n};\n\n// Within the body of any async function, `await x` is transformed to\n// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n// `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n// meant to be awaited.\nfunction awrap (arg) {\n return { __await: arg };\n};\n\nfunction AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n}\n\ndefineIteratorMethods(AsyncIterator.prototype);\nAsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n};\n\n// Note that simple async functions are implemented on top of\n// AsyncIterator objects; they just return a Promise for the value of\n// the final result produced by the iterator.\n function async (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n};\n\nfunction makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n}\n\n// Call delegate.iterator[context.method](context.arg) and handle the\n// result, either by returning a { value, done } result from the\n// delegate iterator, or by modifying context.method and context.arg,\n// setting context.delegate to null, and returning the ContinueSentinel.\nfunction maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n}\n\n// Define Generator.prototype.{next,throw,return} in terms of the\n// unified ._invoke helper method.\ndefineIteratorMethods(Gp);\n\nGp[toStringTagSymbol] = \"Generator\";\n\n// A Generator should always return itself as the iterator object when the\n// @@iterator function is called on it. Some browsers' implementations of the\n// iterator prototype chain incorrectly implement this, causing the Generator\n// object to not be returned from this call. This ensures that doesn't happen.\n// See https://github.com/facebook/regenerator/issues/274 for more details.\nGp[iteratorSymbol] = function() {\n return this;\n};\n\nGp.toString = function() {\n return \"[object Generator]\";\n};\n\nfunction pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n}\n\nfunction resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n}\n\nfunction Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n}\n\nfunction keys (object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n};\n\nfunction values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n}\n\nfunction doneResult() {\n return { value: undefined, done: true };\n}\n\nContext.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n};\n\n// Export a default namespace that plays well with Rollup\nexport default {\n wrap,\n isGeneratorFunction,\n AsyncIterator,\n mark,\n awrap,\n async,\n keys,\n values\n};\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export function loadScript(src: string) {\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.defer = true;\n script.src = src;\n\n const firstScript = document.getElementsByTagName('script')[0];\n firstScript.parentNode!.insertBefore(script, firstScript);\n\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = reject;\n });\n}\n\nexport function loadScripts(...src: string[]) {\n return Promise.all(src.map(loadScript));\n}\n","export function trim(object: Record) {\n for (const key in object) {\n if (typeof object[key] === 'undefined') {\n delete object[key];\n }\n if (object[key] === null) {\n delete object[key];\n }\n }\n}\n\nexport function convertStringToSankecase(str: string) {\n const upperCaseMap = new Map();\n const strArray = Array.from(str);\n strArray.forEach((char, index) => {\n const currentCharCode = char.charCodeAt(0);\n const asciiCodeA = 'A'.charCodeAt(0);\n const asciiCodeZ = 'Z'.charCodeAt(0);\n if (currentCharCode >= asciiCodeA && currentCharCode <= asciiCodeZ) {\n upperCaseMap.set(index, char);\n }\n });\n upperCaseMap.forEach((value, key) => {\n strArray[key] = `_${value.toLowerCase()}`;\n });\n return strArray.join('');\n}\n\nexport function convertParamsToSankecase(params: T) {\n return Object.keys(params).reduce((prev: Record, key: string) => {\n const currentParams = prev;\n const snakecaseKey = convertStringToSankecase(key);\n currentParams[snakecaseKey] = (params as any)[key];\n return currentParams;\n }, {});\n}\n","interface BaseEvent {\n type: 'tracking';\n category: string;\n action: string;\n name: string;\n payload: Payload;\n $$type: 'TrackingEvent';\n}\n\n// auto injection\nexport interface BasePayload {\n //如果是訪客打 \"guest\"\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: string;\n codename?: string;\n guestSessionId?: string;\n sourceUrl?: string;\n componentId?: string;\n componentType?: string;\n traceId?: string;\n}\n\ninterface ClickButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n}\n\nexport interface ClickButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickTabEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // url\n page: string;\n}\n\nexport interface ClickTabEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickLeaderboardButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // bonus, contributor, vote\n type: string;\n}\n\nexport interface ClickLeaderboardButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'button_expend.open' | 'button_expend.close' | 'button_vote';\n}\n\ninterface ClickTopStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'topavatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickTopStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_top';\n}\n\ninterface ClickStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'avatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_streamer';\n}\n\ninterface LinkEventPayload extends BasePayload {\n action: 'LinkClick';\n url: string;\n //超連結字名稱\n name: string;\n}\n\nexport interface LinkEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'link_info';\n}\n\ninterface PageViewEventPayload extends BasePayload {\n leaderboardStartTime: number;\n leaderboardEndTime: number;\n // url\n from: string;\n // url\n to: string;\n utmCampaign: string;\n utmContent: string;\n utmMedium: string;\n utmSource: string;\n}\n\nexport interface PageViewEvent extends BaseEvent {\n category: 'Leaderboard' | 'Infomation';\n action: 'view';\n name: 'event_view';\n}\n\ninterface SectionViewEventPayload extends BasePayload {\n section: string;\n action: 'enter' | 'leave';\n //滑榜單停下時,打看到的最後一個名次\n rank?: number;\n // 提供給客製活動使用(因為url不會轉換)\n customPath?: string;\n}\n\nexport interface SectionViewEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'scroll';\n}\n\ninterface SearchUserEventPayload extends BasePayload {\n searchString: string;\n resultCount: number;\n}\n\nexport interface SearchUserEvent extends BaseEvent {\n category: 'Content';\n action: 'search';\n name: 'search_user';\n}\n\nexport type TrackingEvent =\n | ClickButtonEvent\n | ClickTabEvent\n | ClickLeaderboardButtonEvent\n | ClickTopStreamerEvent\n | ClickStreamerEvent\n | LinkEvent\n | PageViewEvent\n | SectionViewEvent\n | SearchUserEvent;\n\nexport function isTrackingEvent(value: unknown): value is TrackingEvent {\n if (typeof value !== 'object') return false;\n if (value === null) return false;\n return (value as TrackingEvent).$$type === 'TrackingEvent';\n}\n","export const EVENT_NAME_CLICK = 'click';\nexport const EVENT_NAME_ENTER = 'enter';\nexport const EVENT_NAME_LEAVE = 'leave';\nexport const EVENT_NAME_SEARCH = 'search';\nexport const EVENT_NAME_SECTION_VIEW = 'section_view';\n\nexport const CATEGORY_DEFAULT = 'default';\n\nexport const ACTION_BUTTON_CLICK = 'ButtonClick';\nexport const ACTION_TAB_CLICK = 'TabClick';\nexport const ACTION_PROFILE_CLICK = 'ProfileClick';\nexport const ACTION_LINK_CLICK = 'LinkClick';\nexport const ACTION_ENTER = 'scroll';\n\nexport const __CLIENT__ = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n\nexport const matomoCustomDimensionMap: Record = {\n contentId: 'dimension1',\n contentType: 'dimension2',\n search: 'dimension5',\n comment: 'dimension6',\n genericJson: 'dimension11',\n genericText: 'dimension12',\n traceId: 'dimension13',\n appVersion: 'dimension15',\n deviceId: 'dimension16',\n timestamp: 'dimension17',\n componentId: 'dimension21',\n componentType: 'dimension22',\n advertisingId: 'dimension23',\n sourceUrl: 'dimension24',\n user: 'dimension25',\n};\n","import qs from 'qs';\nimport { v4 } from 'uuid';\nimport { Scene, DefaultEventParams, RefinedEventPathname, TrackingToken } from 'types';\nimport { TrackingEvent as V2TrackingEvent } from '../TrackingEvent';\nimport { matomoCustomDimensionMap } from './constants';\n\nfunction getUserID() {\n const qsUserID = qs.parse(window.location.search, { ignoreQueryPrefix: true }).userID;\n if (Array.isArray(qsUserID)) {\n return sessionStorage.getItem('userID') || 'guest';\n }\n // The order of checking UserID.\n // 1. sessionStorage\n // 2. query string\n return sessionStorage.getItem('userID') || `${qsUserID}` || 'guest';\n}\n\nfunction createTrackingToken() {\n const storageKey = 'trackingToken';\n const days30 = 60 * 60 * 24 * 30 * 1000;\n const newTrackingToken: TrackingToken = {\n sessionID: v4(),\n date: Date.now(),\n };\n\n try {\n const trackingToken = JSON.parse(localStorage.getItem(storageKey) || '') as TrackingToken;\n const { date, sessionID } = trackingToken;\n // Expired checking (after 30 days)\n if (Date.now() - date < days30) return sessionID;\n\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n } catch (error) {\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n }\n return newTrackingToken.sessionID;\n}\n\nexport function createScene(): Scene {\n const { title } = window.document;\n const { hostname, pathname } = window.location;\n return { title, hostname, pathname };\n}\n\nexport function refineEventPathname(pathname: string): RefinedEventPathname {\n const slashCount = pathname.match(/-/g)?.length;\n if (slashCount && slashCount >= 3) {\n // slashCount === 3+\n const pathnameArray = pathname.split('-');\n const eventId = pathnameArray[0];\n const codename = pathnameArray.splice(1, pathnameArray.length).join('-');\n return { eventId, codename };\n }\n return { eventId: '', codename: pathname };\n}\n\nexport function createDefaultEventParams(): DefaultEventParams {\n const codenameArray = window.location.pathname.split('/');\n const eventPathname = codenameArray.length > 1 ? codenameArray[1] : '';\n const { eventId, codename } = refineEventPathname(eventPathname);\n const trackingToken = createTrackingToken();\n\n return {\n userId: getUserID(),\n lang: navigator.language || '',\n os: navigator.userAgent || '',\n timestamp: Date.now(),\n codename,\n eventId,\n guestSessionId: trackingToken,\n };\n}\n\nexport function createMatomoCustomDimensions(event: V2TrackingEvent) {\n const dimensions: Record = {};\n for (const key in event.payload) {\n const dimensionKey = matomoCustomDimensionMap[key];\n if (!dimensionKey) continue;\n dimensions[dimensionKey] = event.payload[key as keyof typeof event.payload];\n }\n return dimensions;\n}\n","/* eslint-disable @typescript-eslint/camelcase */\n\nimport { loadScript, loadScripts } from 'utils/loadScript';\nimport * as object from 'utils/object';\nimport { TrackingEvent, TransitionEvent, LoginEvent, SpyEvent, Scene } from 'types';\nimport type { analytics } from 'firebase';\nimport { isTrackingEvent as isV2TrackingEvent, TrackingEvent as V2TrackingEvent } from './TrackingEvent';\nimport * as params from './utils/param';\n\nenum AgentState {\n Uninitialized,\n Initializing,\n Initialized,\n InitializeFail,\n}\n\ndeclare var firebase: any;\n\nexport abstract class Agent {\n protected state = AgentState.Uninitialized;\n\n async initialize() {\n if (this.state !== AgentState.Uninitialized) return;\n\n this.state = AgentState.Initializing;\n\n try {\n await this.doInitialize();\n this.state = AgentState.Initialized;\n } catch (error) {\n console.error(error);\n this.state = AgentState.InitializeFail;\n }\n }\n\n abstract report(event: SpyEvent): void;\n\n protected abstract doInitialize(): Promise | void;\n}\n\nlet isInit = false;\n\nexport class FirebaseAgent extends Agent {\n private client!: analytics.Analytics;\n\n private queue: Array<() => void> = [];\n\n /**\n * @param config @see https://support.google.com/firebase/answer/7015592\n */\n constructor(readonly config: any) {\n super();\n }\n\n async doInitialize() {\n await loadScripts(\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-app.js',\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-analytics.js',\n );\n\n if (!isInit) {\n this.client = firebase.initializeApp(this.config).analytics();\n isInit = true;\n } else {\n this.client = firebase.analytics();\n }\n\n this.queue.forEach(callback => callback());\n\n this.queue = [];\n }\n\n report(event: SpyEvent) {\n this.queueIfNotInitialized(() => this.doReport(event));\n }\n\n private doReport(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n this.client.setUserId(userId, { global: true });\n if (userId) this.client.logEvent('login', { userId });\n }\n\n private transit(event: TransitionEvent) {\n const { toScene, defaultTrackingParams } = event;\n const { title, hostname, pathname } = toScene;\n this.client.logEvent('page_view', {\n page_title: title,\n page_location: hostname,\n page_path: pathname,\n ...object.convertParamsToSankecase(defaultTrackingParams),\n });\n this.client.setCurrentScreen(event.toScene.title, { global: true });\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { name, payload } = event;\n object.trim(payload);\n this.client.logEvent(name, object.convertParamsToSankecase(payload));\n return;\n }\n const { eventName, trackingParams = {} } = event;\n object.trim(trackingParams);\n this.client.logEvent(eventName, object.convertParamsToSankecase(trackingParams));\n }\n\n private queueIfNotInitialized(callback: () => void) {\n if (this.state === AgentState.Initialized) callback();\n else this.queue.push(callback);\n }\n}\n\nexport interface MatomoAgentConfig {\n endpoint: string;\n siteId: string;\n}\n\nexport class MatomoAgent extends Agent {\n private get client() {\n window._paq = window._paq || []; // eslint-disable-line no-underscore-dangle\n return window._paq; // eslint-disable-line no-underscore-dangle\n }\n\n private trackPageViewTimer = 0;\n\n private currentScene: Scene | null = null;\n\n constructor(readonly config: MatomoAgentConfig) {\n super();\n }\n\n async doInitialize() {\n this.client.push(['setTrackerUrl', `${this.config.endpoint}matomo.php`]);\n this.client.push(['setSiteId', this.config.siteId]);\n this.client.push(['trackPageView']);\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n await loadScript(`${this.config.endpoint}piwik.js`);\n }\n\n report(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n if (userId) this.client.push(['setUserId', userId]);\n else this.client.push(['resetUserId']);\n this.requestTrackPageView();\n }\n\n private transit(event: TransitionEvent) {\n const { fromScene, toScene } = event;\n this.client.push(['setReferrerUrl', fromScene.pathname]);\n this.client.push(['setCustomUrl', toScene.pathname]);\n this.client.push(['setDocumentTitle', toScene.title]);\n this.client.push(['setGenerationTimeMs', 0]);\n this.requestTrackPageView();\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n this.currentScene = toScene;\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { category, action, name } = event;\n if (this.currentScene) {\n event.payload.sourceUrl = this.currentScene.pathname;\n }\n const dimensions = params.createMatomoCustomDimensions(event);\n this.client.push(['trackEvent', category, action, name, '', dimensions]);\n return;\n }\n // matomo support only v2 event\n // /**\n // * ref : https://developer.matomo.org/guides/tracking-javascript\n // * trackEvent(category, action, [name], [value]) -\n // * Log an event with an event category (Videos, Music, Games...), an event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional event name and optional numeric value.\n // */\n // const { eventName, category, trackingParams = {} } = event;\n // const { name = '', value = '' } = trackingParams;\n // const dimensions = {};\n // /**\n // * _paq.push(['trackEvent', category, action, name, value, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackSiteSearch', keyword, category, resultsCount, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackLink', url, linkType, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackGoal', idGoal, customRevenue, {dimension1: 'DimensionValue'}]);\n // */\n // this.client.push(['trackEvent', category, eventName, name, value, dimensions]);\n }\n\n private requestTrackPageView() {\n if (this.trackPageViewTimer) clearTimeout(this.trackPageViewTimer);\n this.trackPageViewTimer = setTimeout(() => {\n this.client.push(['trackPageView']);\n this.trackPageViewTimer = 0;\n });\n }\n}\n","const tagNameRole: Record = {\n alert: 'alert',\n alertdialog: 'alertdialog',\n application: 'application',\n article: 'article',\n banner: 'banner',\n button: 'button',\n cell: 'cell',\n checkbox: 'checkbox',\n columnheader: 'columnheader',\n combobox: 'combobox',\n command: 'command',\n complementary: 'complementary',\n composite: 'composite',\n contentinfo: 'contentinfo',\n definition: 'definition',\n dialog: 'dialog',\n directory: 'directory',\n document: 'document',\n feed: 'feed',\n figure: 'figure',\n form: 'form',\n grid: 'grid',\n gridcell: 'gridcell',\n group: 'group',\n heading: 'heading',\n img: 'img',\n input: 'input',\n landmark: 'landmark',\n link: 'link',\n list: 'list',\n listbox: 'listbox',\n listitem: 'listitem',\n log: 'log',\n main: 'main',\n 'The main content of a document.': 'The main content of a document.',\n marquee: 'marquee',\n math: 'math',\n 'Content that represents a mathematical expression.': 'Content that represents a mathematical expression.',\n menu: 'menu',\n menubar: 'menubar',\n menuitem: 'menuitem',\n menuitemcheckbox: 'menuitemcheckbox',\n menuitemradio: 'menuitemradio',\n navigation: 'navigation',\n none: 'none',\n note: 'note',\n option: 'option',\n presentation: 'presentation',\n progressbar: 'progressbar',\n radio: 'radio',\n radiogroup: 'radiogroup',\n range: 'range',\n region: 'region',\n roletype: 'roletype',\n row: 'row',\n rowgroup: 'rowgroup',\n rowheader: 'rowheader',\n scrollbar: 'scrollbar',\n search: 'search',\n searchbox: 'searchbox',\n section: 'section',\n sectionhead: 'sectionhead',\n select: 'select',\n separator: 'separator',\n slider: 'slider',\n spinbutton: 'spinbutton',\n status: 'status',\n structure: 'structure',\n switch: 'switch',\n tab: 'tab',\n table: 'table',\n tablist: 'tablist',\n tabpanel: 'tabpanel',\n term: 'term',\n textbox: 'textbox',\n timer: 'timer',\n toolbar: 'toolbar',\n tooltip: 'tooltip',\n tree: 'tree',\n treegrid: 'treegrid',\n treeitem: 'treeitem',\n widget: 'widget',\n window: 'window',\n};\n\nexport function guessRole(element: HTMLElement) {\n return element.getAttribute('role') || tagNameRole[element.tagName] || 'unknown';\n}\n\nexport function getContent(element: HTMLElement) {\n return element.innerText;\n}\n","import { TransitionEvent, TrackingEvent, TrackingEventParams, Scene, SpyEvent } from 'types';\nimport { Agent } from 'Agent';\nimport { History } from 'history';\nimport * as dom from 'utils/dom';\nimport { createScene, createDefaultEventParams } from 'utils/param';\nimport { TrackingEvent as V2TrackingEvent, isTrackingEvent as isV2TrackingEvent } from './TrackingEvent';\n\nexport interface Source {\n addAgent(agent: Agent): void;\n}\n\nexport class DefaultSource implements Source {\n private agents: Agent[] = [];\n\n private currentScene: Scene = createScene();\n\n addAgent(agent: Agent) {\n agent.initialize();\n this.agents.push(agent);\n }\n\n spyTransition(history: History) {\n // wait for whole page updated\n // init page_view\n setTimeout(() => this.transit(createScene()), 100);\n history.listen(() => {\n const { action } = history;\n // Filtering replace action (The pushed url is not matching, ex: Redirect)\n if (action === 'PUSH') {\n setTimeout(() => this.transit(createScene()), 100);\n }\n });\n }\n\n spyClick() {\n window.addEventListener('click', event => {\n const { target } = event;\n if (target instanceof HTMLElement) {\n this.track({\n eventName: 'click',\n category: 'default',\n trackingParams: {\n name: dom.getContent(target),\n value: '',\n role: dom.guessRole(target),\n },\n });\n }\n });\n }\n\n // tracking page visibility. e.g. page minimized, change browser tab or page unload\n spyPageDurationByVisible(params?: TrackingEventParams) {\n let startDurationTime: number = 0;\n\n const handleVisibleChange = (e: Event) => {\n if (document.visibilityState === 'hidden') {\n const endDurationTime = e.timeStamp;\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url: window.location.href,\n duration,\n ...params,\n },\n });\n }\n if (document.visibilityState === 'visible') {\n startDurationTime = e.timeStamp;\n }\n };\n document.addEventListener('visibilitychange', handleVisibleChange);\n }\n\n spyPageDurationByTransition(history: History, params?: TrackingEventParams) {\n let startDurationTime: number = Date.now();\n let url = window.location.href;\n history.listen(() => {\n const endDurationTime: number = Date.now();\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url,\n duration,\n ...params,\n },\n });\n startDurationTime = endDurationTime;\n url = window.location.href;\n });\n }\n\n login(userId: string) {\n this.report({ type: 'login', userId });\n }\n\n transit(toScene: Scene) {\n const fromScene = this.currentScene;\n const event: TransitionEvent = {\n type: 'transition',\n fromScene,\n toScene,\n defaultTrackingParams: createDefaultEventParams(),\n };\n this.report(event);\n }\n\n track(event: Omit | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n this.report(event);\n return;\n }\n const { trackingParams } = event;\n const defaultParams = trackingParams?.hasOwnProperty('productName') ? {} : createDefaultEventParams();\n const mergedTrackingParams = {\n ...defaultParams,\n ...trackingParams,\n };\n event.trackingParams = mergedTrackingParams;\n this.report({ type: 'tracking', ...event });\n }\n\n private report(event: SpyEvent) {\n this.agents.forEach(agent => {\n try {\n agent.report(event);\n } catch (error) {\n console.error(error);\n }\n });\n }\n}\n","import { TrackingEvent as V2TrackingEvent } from './TrackingEvent';\n\nexport enum Threshold {\n 'MIN' = 0,\n 'HALF' = 0.5,\n 'FULL' = 1,\n}\n\nexport interface Scene {\n title: string;\n hostname: string;\n pathname: string;\n}\n\nexport interface TransitionEvent {\n type: 'transition';\n fromScene: Scene;\n toScene: Scene;\n defaultTrackingParams: DefaultEventParams;\n}\n\nexport interface TrackingToken {\n sessionID: string;\n date: number;\n}\n\nexport interface TrackingEventParams {\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: number;\n action?: string;\n name?: string;\n role?: string;\n value?: string;\n page?: string;\n type?: string;\n leaderboardId?: string;\n streamerId?: string;\n liveStatus?: boolean;\n section?: string;\n rank?: number;\n to?: string;\n url?: string;\n utmCampaign?: string;\n utmContent?: string;\n utmMedium?: string;\n utmSource?: string;\n searchString?: string;\n resultCount?: number;\n hasDeeplink?: boolean;\n codename?: string;\n productName?: string;\n userName?: string;\n from?: string;\n result?: string;\n duration?: number;\n customPath?: string;\n}\nexport interface TrackingEvent {\n type: 'tracking';\n category: string;\n eventName: string;\n action?: string;\n trackingParams?: TrackingEventParams;\n}\n\nexport interface DefaultEventParams {\n userId: string;\n lang: string;\n os: string;\n eventId: string;\n timestamp: number;\n codename: string;\n guestSessionId: string;\n}\n\nexport interface LoginEvent {\n type: 'login';\n userId: string;\n}\n\nexport interface RefinedEventPathname {\n eventId: string;\n codename: string;\n}\n\nexport type ElementMap = Map;\n\nexport type SpyEvent = TrackingEvent | TransitionEvent | LoginEvent | V2TrackingEvent;\n\nexport type EventCallback = (event: T) => void;\n\nexport type EventListener = (callback: EventCallback) => void;\n","import { RefObject } from 'react';\nimport { ElementMap, Threshold } from './types';\nimport { __CLIENT__ } from './utils/constants';\nimport 'intersection-observer';\n\nclass SectionObserver {\n public elementMap: ElementMap;\n\n private observer: IntersectionObserver | undefined;\n\n private debounceExecute: number;\n\n constructor(debounce: boolean, threshold: Threshold) {\n this.elementMap = new Map();\n this.debounceExecute = 0;\n try {\n this.observer = new window.IntersectionObserver(\n entries => {\n if (debounce) {\n this.debounceSectionIntersect(entries);\n } else {\n this.sectionIntersect(entries);\n }\n },\n {\n threshold: [threshold],\n },\n );\n } catch (error) {\n console.log(`Error occur when creating IntersectionObserver: ${error}`);\n }\n }\n\n sectionObserve(ref: RefObject, callback: Function) {\n if (this.observer) this.observer.observe(ref.current);\n this.elementMap.set(ref.current, callback);\n }\n\n sectionUnobserve(ref: RefObject) {\n if (this.observer) this.observer.unobserve(ref.current);\n if (this.elementMap.has(ref.current)) this.elementMap.delete(ref.current);\n }\n\n resetSectionObserver() {\n this.elementMap.forEach((value, key) => {\n if (this.observer) this.observer.observe(key);\n });\n }\n\n private sectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n callback();\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n\n private debounceSectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n clearTimeout(this.debounceExecute);\n this.debounceExecute = window.setTimeout(() => {\n callback();\n }, 1000);\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n}\n\nexport let completeSectionObserver: SectionObserver | undefined;\nexport let halfSectionObserver: SectionObserver | undefined;\nexport let minSectionObserver: SectionObserver | undefined;\nexport let rankSectionObserver: SectionObserver | undefined;\n\nexport function registCompleteSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registCompleteSectionObserver()] should be invoked on client side.');\n }\n if (!completeSectionObserver) completeSectionObserver = new SectionObserver(false, Threshold.FULL);\n completeSectionObserver.sectionObserve(ref, callback);\n return () => {\n completeSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registHalfSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registHalfSectionObserver()] should be invoked on client side.');\n }\n\n if (!halfSectionObserver) halfSectionObserver = new SectionObserver(false, Threshold.HALF);\n halfSectionObserver.sectionObserve(ref, callback);\n return () => {\n halfSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registMinSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registMinSectionObserver()] should be invoked on client side.');\n }\n\n if (!minSectionObserver) minSectionObserver = new SectionObserver(false, Threshold.MIN);\n minSectionObserver.sectionObserve(ref, callback);\n return () => {\n minSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registRankSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registRankSectionObserver()] should be invoked on client side.');\n }\n\n if (!rankSectionObserver) rankSectionObserver = new SectionObserver(true, Threshold.FULL);\n rankSectionObserver.sectionObserve(ref, callback);\n return () => {\n rankSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function resetSectionObserverStatus() {\n if (completeSectionObserver) completeSectionObserver.resetSectionObserver();\n if (halfSectionObserver) halfSectionObserver.resetSectionObserver();\n if (minSectionObserver) minSectionObserver.resetSectionObserver();\n if (rankSectionObserver) rankSectionObserver.resetSectionObserver();\n}\n","import { RefObject, useEffect } from 'react';\nimport { History } from 'history';\nimport { DefaultSource } from './Source';\n\nimport {\n registCompleteSectionObserver,\n registHalfSectionObserver,\n registMinSectionObserver,\n registRankSectionObserver,\n resetSectionObserverStatus,\n} from './Observer';\n\nexport function useCompleteSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registCompleteSectionObserver(ref, callback);\n });\n}\n\nexport function useHalfSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registHalfSectionObserver(ref, callback);\n });\n}\n\nexport function useMinSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registMinSectionObserver(ref, callback);\n });\n}\n\nexport function useRankSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registRankSectionObserver(ref, callback);\n });\n}\n\nexport function usePageTransitionListener(trackingSource: DefaultSource, history: History) {\n useEffect(() => {\n // Regist history (for page_view & screen_view)\n trackingSource.spyTransition(history);\n history.listen(() => {\n resetSectionObserverStatus();\n });\n }, [history]);\n}\n","import {\n EVENT_NAME_CLICK,\n EVENT_NAME_ENTER,\n EVENT_NAME_LEAVE,\n EVENT_NAME_SEARCH,\n EVENT_NAME_SECTION_VIEW,\n CATEGORY_DEFAULT,\n ACTION_BUTTON_CLICK,\n ACTION_TAB_CLICK,\n ACTION_PROFILE_CLICK,\n ACTION_LINK_CLICK,\n ACTION_ENTER,\n} from './utils/constants';\n\nimport { TrackingEvent } from './types';\n\ntype EventAction = Omit;\ntype SectionName = 'buttons' | 'duration' | 'gifts' | 'searchBar' | 'tabs' | 'description' | 'timeline' | 'topStreamer';\ntype ProfileName = 'topavatar' | 'avatar';\n\nexport function createButtonClickAction(buttonName: string, link: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: buttonName,\n page: link,\n },\n };\n}\n\nexport function createPageEnterAction(\n utmCampaign: string,\n utmContent: string,\n utmMedium: string,\n utmSource: string,\n): EventAction {\n return {\n eventName: EVENT_NAME_ENTER,\n category: CATEGORY_DEFAULT,\n trackingParams: {\n utmCampaign,\n utmContent,\n utmMedium,\n utmSource,\n },\n };\n}\n\nexport function createPageLeaveAction(): EventAction {\n return {\n eventName: EVENT_NAME_LEAVE,\n category: CATEGORY_DEFAULT,\n };\n}\n\nexport function createTabClickAction(link: string, tabName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_TAB_CLICK,\n page: link,\n name: tabName,\n },\n };\n}\n\nexport function createProfileClickAction(userID: string, liveStatus: boolean, profileType: ProfileName): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: liveStatus ? 'LiveStream' : 'Profile',\n trackingParams: {\n action: ACTION_PROFILE_CLICK,\n type: profileType,\n streamerId: userID,\n liveStatus: liveStatus,\n leaderboardId: '',\n hasDeeplink: false,\n },\n };\n}\n\nexport function createSearchAction(keyword: string, count: number): EventAction {\n return {\n eventName: EVENT_NAME_SEARCH,\n category: 'Content',\n trackingParams: {\n searchString: keyword,\n resultCount: count,\n },\n };\n}\n\nexport function createVoteAction(voteTopic: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'Interaction_vote',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: voteTopic,\n type: 'vote',\n },\n };\n}\n\nexport function createLeaderboardSectionViewAction(rank: number): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section: 'leaderboardItem',\n rank,\n },\n };\n}\n\nexport function createLinkClickAction(link: string, linkName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_LINK_CLICK,\n url: link,\n name: linkName,\n },\n };\n}\n\nexport function createSectionViewAction(section: SectionName, customPath?: string): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section,\n // For customized event to use.\n customPath,\n },\n };\n}\n","import { TrackingEvent } from './TrackingEvent';\nimport { createDefaultEventParams } from './utils/param';\n\nexport function createTrackingEvent(event: Omit) {\n return {\n ...event,\n payload: { ...createDefaultEventParams(), ...event.payload },\n type: 'tracking',\n $$type: 'TrackingEvent',\n } as TrackingEvent;\n}\n"],"names":["setPrototypeOf","assertThisInitialized","Op","Object","prototype","hasOwn","hasOwnProperty","undefined","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","fn","obj","arg","type","call","err","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","constructor","displayName","defineIteratorMethods","forEach","method","isGeneratorFunction","genFun","ctor","name","mark","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","value","then","unwrapped","error","previousPromise","enqueue","callInvokeWithMethodAndArg","async","Promise","iter","next","done","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","info","resultName","nextLoc","toString","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","keys","object","key","reverse","length","pop","iterable","iteratorMethod","isNaN","i","skipTempReset","prev","charAt","slice","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","object.convertParamsToSankecase","isV2TrackingEvent","object.trim","params.createMatomoCustomDimensions","dom.getContent","dom.guessRole"],"mappings":";;;;;AAAe,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;AACzD,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;AACpC,MAAM,KAAK,EAAE,KAAK;AAClB,MAAM,UAAU,EAAE,IAAI;AACtB,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,QAAQ,EAAE,IAAI;AACpB,KAAK,CAAC,CAAC;AACP,GAAG,MAAM;AACT,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACrB,GAAG;AACH;AACA,EAAE,OAAO,GAAG,CAAC;AACb;;ACbe,SAAS,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE;AAC9C,EAAE,eAAe,GAAG,MAAM,CAAC,cAAc,IAAI,SAAS,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE;AAC5E,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;AACpB,IAAI,OAAO,CAAC,CAAC;AACb,GAAG,CAAC;AACJ;AACA,EAAE,OAAO,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B;;ACNe,SAAS,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE;AACxD,EAAE,IAAI,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,KAAK,IAAI,EAAE;AAC/D,IAAI,MAAM,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC;AAC9E,GAAG;A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hC,EAA8C,QAA9C,EAA8D;AAClE,SAAO;AACL,IAAA,SAAS,EAAE,gBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,iBADM;AAEd,MAAA,GAAG,EAAE,IAFS;AAGd,MAAA,IAAI,EAAE;AAHQ;AAHX,GAAP;AASD;AAEK,SAAU,uBAAV,CAAkC,OAAlC,EAAwD,UAAxD,EAA2E;AAC/E,SAAO;AACL,IAAA,SAAS,EAAE,uBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,YADM;AAEd,MAAA,OAAO,EAAP,OAFc;AAGd;AACA,MAAA,UAAU,EAAV;AAJc;AAHX,GAAP;AAUD;;;;;AC3IK,SAAU,mBAAV,CAA8B,KAA9B,EAA2E;AAC/E,6CACK,KADL;AAEE,IAAA,OAAO,sCAAO,wBAAwB,EAA/B,GAAsC,KAAK,CAAC,OAA5C,CAFT;AAGE,IAAA,IAAI,EAAE,UAHR;AAIE,IAAA,MAAM,EAAE;AAJV;AAMD;;;;"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 14eeebd..8a09921 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1246,6 +1246,7 @@ var MatomoAgent = /*#__PURE__*/function (_Agent2) { _this3 = _super2.call(this); _this3.config = config; _this3.trackPageViewTimer = 0; + _this3.currentScene = null; return _this3; } @@ -1312,6 +1313,7 @@ var MatomoAgent = /*#__PURE__*/function (_Agent2) { this.requestTrackPageView(); this.client.push(['enableLinkTracking']); this.client.push(['trackAllContentImpressions']); + this.currentScene = toScene; } }, { key: "track", @@ -1320,6 +1322,11 @@ var MatomoAgent = /*#__PURE__*/function (_Agent2) { var category = event.category, action = event.action, name = event.name; + + if (this.currentScene) { + event.payload.sourceUrl = this.currentScene.pathname; + } + var dimensions = createMatomoCustomDimensions(event); this.client.push(['trackEvent', category, action, name, '', dimensions]); return; diff --git a/dist/index.js.map b/dist/index.js.map index c48c552..c387c35 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/esm/inherits.js","../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../node_modules/@babel/runtime/regenerator/index.js","../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../node_modules/@babel/runtime/helpers/esm/createClass.js","../src/utils/loadScript.ts","../src/utils/object.ts","../src/TrackingEvent.ts","../src/utils/constants.ts","../src/utils/param.ts","../src/Agent.ts","../src/utils/dom.ts","../src/Source.ts","../src/types.ts","../src/Observer.ts","../src/hooks.ts","../src/actions.ts","../src/createTrackingEvent.ts"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\"use strict\";\n\nvar Op = Object.prototype;\nvar hasOwn = Op.hasOwnProperty;\nvar undefined; // More compressible than void 0.\nvar $Symbol = typeof Symbol === \"function\" ? Symbol : {};\nvar iteratorSymbol = $Symbol.iterator || \"@@iterator\";\nvar asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\nvar toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\nfunction wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n}\n\n// Try/catch helper to minimize deoptimizations. Returns a completion\n// record like context.tryEntries[i].completion. This interface could\n// have been (and was previously) designed to take a closure to be\n// invoked without arguments, but in all the cases we care about we\n// already have an existing method we want to call, so there's no need\n// to create a new function object. We can even get away with assuming\n// the method takes exactly one argument, since that happens to be true\n// in every case, so we don't have to touch the arguments object. The\n// only additional allocation required is the completion record, which\n// has a stable shape and so hopefully should be cheap to allocate.\nfunction tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n}\n\nvar GenStateSuspendedStart = \"suspendedStart\";\nvar GenStateSuspendedYield = \"suspendedYield\";\nvar GenStateExecuting = \"executing\";\nvar GenStateCompleted = \"completed\";\n\n// Returning this object from the innerFn has the same effect as\n// breaking out of the dispatch switch statement.\nvar ContinueSentinel = {};\n\n// Dummy constructor functions that we use as the .constructor and\n// .constructor.prototype properties for functions that return Generator\n// objects. For full spec compliance, you may wish to configure your\n// minifier not to mangle the names of these two functions.\nfunction Generator() {}\nfunction GeneratorFunction() {}\nfunction GeneratorFunctionPrototype() {}\n\n// This is a polyfill for %IteratorPrototype% for environments that\n// don't natively support it.\nvar IteratorPrototype = {};\nIteratorPrototype[iteratorSymbol] = function () {\n return this;\n};\n\nvar getProto = Object.getPrototypeOf;\nvar NativeIteratorPrototype = getProto && getProto(getProto(values([])));\nif (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n}\n\nvar Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\nGeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\nGeneratorFunctionPrototype.constructor = GeneratorFunction;\nGeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n// Helper for defining the .next, .throw, and .return methods of the\n// Iterator interface in terms of a single ._invoke method.\nfunction defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n}\n\nfunction isGeneratorFunction (genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n};\n\nfunction mark (genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n};\n\n// Within the body of any async function, `await x` is transformed to\n// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n// `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n// meant to be awaited.\nfunction awrap (arg) {\n return { __await: arg };\n};\n\nfunction AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n}\n\ndefineIteratorMethods(AsyncIterator.prototype);\nAsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n};\n\n// Note that simple async functions are implemented on top of\n// AsyncIterator objects; they just return a Promise for the value of\n// the final result produced by the iterator.\n function async (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n};\n\nfunction makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n}\n\n// Call delegate.iterator[context.method](context.arg) and handle the\n// result, either by returning a { value, done } result from the\n// delegate iterator, or by modifying context.method and context.arg,\n// setting context.delegate to null, and returning the ContinueSentinel.\nfunction maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n}\n\n// Define Generator.prototype.{next,throw,return} in terms of the\n// unified ._invoke helper method.\ndefineIteratorMethods(Gp);\n\nGp[toStringTagSymbol] = \"Generator\";\n\n// A Generator should always return itself as the iterator object when the\n// @@iterator function is called on it. Some browsers' implementations of the\n// iterator prototype chain incorrectly implement this, causing the Generator\n// object to not be returned from this call. This ensures that doesn't happen.\n// See https://github.com/facebook/regenerator/issues/274 for more details.\nGp[iteratorSymbol] = function() {\n return this;\n};\n\nGp.toString = function() {\n return \"[object Generator]\";\n};\n\nfunction pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n}\n\nfunction resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n}\n\nfunction Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n}\n\nfunction keys (object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n};\n\nfunction values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n}\n\nfunction doneResult() {\n return { value: undefined, done: true };\n}\n\nContext.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n};\n\n// Export a default namespace that plays well with Rollup\nexport default {\n wrap,\n isGeneratorFunction,\n AsyncIterator,\n mark,\n awrap,\n async,\n keys,\n values\n};\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export function loadScript(src: string) {\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.defer = true;\n script.src = src;\n\n const firstScript = document.getElementsByTagName('script')[0];\n firstScript.parentNode!.insertBefore(script, firstScript);\n\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = reject;\n });\n}\n\nexport function loadScripts(...src: string[]) {\n return Promise.all(src.map(loadScript));\n}\n","export function trim(object: Record) {\n for (const key in object) {\n if (typeof object[key] === 'undefined') {\n delete object[key];\n }\n if (object[key] === null) {\n delete object[key];\n }\n }\n}\n\nexport function convertStringToSankecase(str: string) {\n const upperCaseMap = new Map();\n const strArray = Array.from(str);\n strArray.forEach((char, index) => {\n const currentCharCode = char.charCodeAt(0);\n const asciiCodeA = 'A'.charCodeAt(0);\n const asciiCodeZ = 'Z'.charCodeAt(0);\n if (currentCharCode >= asciiCodeA && currentCharCode <= asciiCodeZ) {\n upperCaseMap.set(index, char);\n }\n });\n upperCaseMap.forEach((value, key) => {\n strArray[key] = `_${value.toLowerCase()}`;\n });\n return strArray.join('');\n}\n\nexport function convertParamsToSankecase(params: T) {\n return Object.keys(params).reduce((prev: Record, key: string) => {\n const currentParams = prev;\n const snakecaseKey = convertStringToSankecase(key);\n currentParams[snakecaseKey] = (params as any)[key];\n return currentParams;\n }, {});\n}\n","interface BaseEvent {\n type: 'tracking';\n category: string;\n action: string;\n name: string;\n payload: Payload;\n $$type: 'TrackingEvent';\n}\n\n// auto injection\nexport interface BasePayload {\n //如果是訪客打 \"guest\"\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: string;\n codename?: string;\n guestSessionId?: string;\n}\n\ninterface ClickButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n}\n\nexport interface ClickButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickTabEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // url\n page: string;\n}\n\nexport interface ClickTabEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickLeaderboardButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // bonus, contributor, vote\n type: string;\n}\n\nexport interface ClickLeaderboardButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'button_expend.open' | 'button_expend.close' | 'button_vote';\n}\n\ninterface ClickTopStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'topavatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickTopStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_top';\n}\n\ninterface ClickStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'avatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_streamer';\n}\n\ninterface LinkEventPayload extends BasePayload {\n action: 'LinkClick';\n url: string;\n //超連結字名稱\n name: string;\n}\n\nexport interface LinkEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'link_info';\n}\n\ninterface PageViewEventPayload extends BasePayload {\n leaderboardStartTime: number;\n leaderboardEndTime: number;\n // url\n from: string;\n // url\n to: string;\n utmCampaign: string;\n utmContent: string;\n utmMedium: string;\n utmSource: string;\n}\n\nexport interface PageViewEvent extends BaseEvent {\n category: 'Leaderboard' | 'Infomation';\n action: 'view';\n name: 'event_view';\n}\n\ninterface SectionViewEventPayload extends BasePayload {\n section: string;\n action: 'enter' | 'leave';\n //滑榜單停下時,打看到的最後一個名次\n rank?: number;\n // 提供給客製活動使用(因為url不會轉換)\n customPath?: string;\n}\n\nexport interface SectionViewEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'scroll';\n}\n\ninterface SearchUserEventPayload extends BasePayload {\n searchString: string;\n resultCount: number;\n}\n\nexport interface SearchUserEvent extends BaseEvent {\n category: 'Content';\n action: 'search';\n name: 'search_user';\n}\n\nexport type TrackingEvent =\n | ClickButtonEvent\n | ClickTabEvent\n | ClickLeaderboardButtonEvent\n | ClickTopStreamerEvent\n | ClickStreamerEvent\n | LinkEvent\n | PageViewEvent\n | SectionViewEvent\n | SearchUserEvent;\n\nexport function isTrackingEvent(value: unknown): value is TrackingEvent {\n if (typeof value !== 'object') return false;\n if (value === null) return false;\n return (value as TrackingEvent).$$type === 'TrackingEvent';\n}\n","export const EVENT_NAME_CLICK = 'click';\nexport const EVENT_NAME_ENTER = 'enter';\nexport const EVENT_NAME_LEAVE = 'leave';\nexport const EVENT_NAME_SEARCH = 'search';\nexport const EVENT_NAME_SECTION_VIEW = 'section_view';\n\nexport const CATEGORY_DEFAULT = 'default';\n\nexport const ACTION_BUTTON_CLICK = 'ButtonClick';\nexport const ACTION_TAB_CLICK = 'TabClick';\nexport const ACTION_PROFILE_CLICK = 'ProfileClick';\nexport const ACTION_LINK_CLICK = 'LinkClick';\nexport const ACTION_ENTER = 'scroll';\n\nexport const __CLIENT__ = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n\nexport const matomoCustomDimensionMap: Record = {\n contentId: 'dimension1',\n contentType: 'dimension2',\n search: 'dimension5',\n comment: 'dimension6',\n genericJson: 'dimension11',\n genericText: 'dimension12',\n traceId: 'dimension13',\n appVersion: 'dimension15',\n deviceId: 'dimension16',\n timestamp: 'dimension17',\n componentId: 'dimension21',\n componentType: 'dimension22',\n advertisingId: 'dimension23',\n sourceUrl: 'dimension24',\n user: 'dimension25',\n};\n","import qs from 'qs';\nimport { v4 } from 'uuid';\nimport { Scene, DefaultEventParams, RefinedEventPathname, TrackingToken } from 'types';\nimport { TrackingEvent as V2TrackingEvent } from '../TrackingEvent';\nimport { matomoCustomDimensionMap } from './constants';\n\nfunction getUserID() {\n const qsUserID = qs.parse(window.location.search, { ignoreQueryPrefix: true }).userID;\n if (Array.isArray(qsUserID)) {\n return sessionStorage.getItem('userID') || 'guest';\n }\n // The order of checking UserID.\n // 1. sessionStorage\n // 2. query string\n return sessionStorage.getItem('userID') || `${qsUserID}` || 'guest';\n}\n\nfunction createTrackingToken() {\n const storageKey = 'trackingToken';\n const days30 = 60 * 60 * 24 * 30 * 1000;\n const newTrackingToken: TrackingToken = {\n sessionID: v4(),\n date: Date.now(),\n };\n\n try {\n const trackingToken = JSON.parse(localStorage.getItem(storageKey) || '') as TrackingToken;\n const { date, sessionID } = trackingToken;\n // Expired checking (after 30 days)\n if (Date.now() - date < days30) return sessionID;\n\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n } catch (error) {\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n }\n return newTrackingToken.sessionID;\n}\n\nexport function createScene(): Scene {\n const { title } = window.document;\n const { hostname, pathname } = window.location;\n return { title, hostname, pathname };\n}\n\nexport function refineEventPathname(pathname: string): RefinedEventPathname {\n const slashCount = pathname.match(/-/g)?.length;\n if (slashCount && slashCount >= 3) {\n // slashCount === 3+\n const pathnameArray = pathname.split('-');\n const eventId = pathnameArray[0];\n const codename = pathnameArray.splice(1, pathnameArray.length).join('-');\n return { eventId, codename };\n }\n return { eventId: '', codename: pathname };\n}\n\nexport function createDefaultEventParams(): DefaultEventParams {\n const codenameArray = window.location.pathname.split('/');\n const eventPathname = codenameArray.length > 1 ? codenameArray[1] : '';\n const { eventId, codename } = refineEventPathname(eventPathname);\n const trackingToken = createTrackingToken();\n\n return {\n userId: getUserID(),\n lang: navigator.language || '',\n os: navigator.userAgent || '',\n timestamp: Date.now(),\n codename,\n eventId,\n guestSessionId: trackingToken,\n };\n}\n\nexport function createMatomoCustomDimensions(event: V2TrackingEvent) {\n const dimensions: Record = {};\n for (const key in event.payload) {\n const dimensionKey = matomoCustomDimensionMap[key];\n if (!dimensionKey) continue;\n dimensions[dimensionKey] = event.payload[key as keyof typeof event.payload];\n }\n return dimensions;\n}\n","/* eslint-disable @typescript-eslint/camelcase */\n\nimport { loadScript, loadScripts } from 'utils/loadScript';\nimport * as object from 'utils/object';\nimport { TrackingEvent, TransitionEvent, LoginEvent, SpyEvent } from 'types';\nimport type { analytics } from 'firebase';\nimport { isTrackingEvent as isV2TrackingEvent, TrackingEvent as V2TrackingEvent } from './TrackingEvent';\nimport * as params from './utils/param';\n\nenum AgentState {\n Uninitialized,\n Initializing,\n Initialized,\n InitializeFail,\n}\n\ndeclare var firebase: any;\n\nexport abstract class Agent {\n protected state = AgentState.Uninitialized;\n\n async initialize() {\n if (this.state !== AgentState.Uninitialized) return;\n\n this.state = AgentState.Initializing;\n\n try {\n await this.doInitialize();\n this.state = AgentState.Initialized;\n } catch (error) {\n console.error(error);\n this.state = AgentState.InitializeFail;\n }\n }\n\n abstract report(event: SpyEvent): void;\n\n protected abstract doInitialize(): Promise | void;\n}\n\nlet isInit = false;\n\nexport class FirebaseAgent extends Agent {\n private client!: analytics.Analytics;\n\n private queue: Array<() => void> = [];\n\n /**\n * @param config @see https://support.google.com/firebase/answer/7015592\n */\n constructor(readonly config: any) {\n super();\n }\n\n async doInitialize() {\n await loadScripts(\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-app.js',\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-analytics.js',\n );\n\n if (!isInit) {\n this.client = firebase.initializeApp(this.config).analytics();\n isInit = true;\n } else {\n this.client = firebase.analytics();\n }\n\n this.queue.forEach(callback => callback());\n\n this.queue = [];\n }\n\n report(event: SpyEvent) {\n this.queueIfNotInitialized(() => this.doReport(event));\n }\n\n private doReport(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n this.client.setUserId(userId, { global: true });\n if (userId) this.client.logEvent('login', { userId });\n }\n\n private transit(event: TransitionEvent) {\n const { toScene, defaultTrackingParams } = event;\n const { title, hostname, pathname } = toScene;\n this.client.logEvent('page_view', {\n page_title: title,\n page_location: hostname,\n page_path: pathname,\n ...object.convertParamsToSankecase(defaultTrackingParams),\n });\n this.client.setCurrentScreen(event.toScene.title, { global: true });\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { name, payload } = event;\n object.trim(payload);\n this.client.logEvent(name, object.convertParamsToSankecase(payload));\n return;\n }\n const { eventName, trackingParams = {} } = event;\n object.trim(trackingParams);\n this.client.logEvent(eventName, object.convertParamsToSankecase(trackingParams));\n }\n\n private queueIfNotInitialized(callback: () => void) {\n if (this.state === AgentState.Initialized) callback();\n else this.queue.push(callback);\n }\n}\n\nexport interface MatomoAgentConfig {\n endpoint: string;\n siteId: string;\n}\n\nexport class MatomoAgent extends Agent {\n private get client() {\n window._paq = window._paq || []; // eslint-disable-line no-underscore-dangle\n return window._paq; // eslint-disable-line no-underscore-dangle\n }\n\n private trackPageViewTimer = 0;\n\n constructor(readonly config: MatomoAgentConfig) {\n super();\n }\n\n async doInitialize() {\n this.client.push(['setTrackerUrl', `${this.config.endpoint}matomo.php`]);\n this.client.push(['setSiteId', this.config.siteId]);\n this.client.push(['trackPageView']);\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n await loadScript(`${this.config.endpoint}piwik.js`);\n }\n\n report(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n if (userId) this.client.push(['setUserId', userId]);\n else this.client.push(['resetUserId']);\n this.requestTrackPageView();\n }\n\n private transit(event: TransitionEvent) {\n const { fromScene, toScene } = event;\n this.client.push(['setReferrerUrl', fromScene.pathname]);\n this.client.push(['setCustomUrl', toScene.pathname]);\n this.client.push(['setDocumentTitle', toScene.title]);\n this.client.push(['setGenerationTimeMs', 0]);\n this.requestTrackPageView();\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { category, action, name } = event;\n const dimensions = params.createMatomoCustomDimensions(event);\n this.client.push(['trackEvent', category, action, name, '', dimensions]);\n return;\n }\n // matomo support only v2 event\n // /**\n // * ref : https://developer.matomo.org/guides/tracking-javascript\n // * trackEvent(category, action, [name], [value]) -\n // * Log an event with an event category (Videos, Music, Games...), an event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional event name and optional numeric value.\n // */\n // const { eventName, category, trackingParams = {} } = event;\n // const { name = '', value = '' } = trackingParams;\n // const dimensions = {};\n // /**\n // * _paq.push(['trackEvent', category, action, name, value, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackSiteSearch', keyword, category, resultsCount, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackLink', url, linkType, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackGoal', idGoal, customRevenue, {dimension1: 'DimensionValue'}]);\n // */\n // this.client.push(['trackEvent', category, eventName, name, value, dimensions]);\n }\n\n private requestTrackPageView() {\n if (this.trackPageViewTimer) clearTimeout(this.trackPageViewTimer);\n this.trackPageViewTimer = setTimeout(() => {\n this.client.push(['trackPageView']);\n this.trackPageViewTimer = 0;\n });\n }\n}\n","const tagNameRole: Record = {\n alert: 'alert',\n alertdialog: 'alertdialog',\n application: 'application',\n article: 'article',\n banner: 'banner',\n button: 'button',\n cell: 'cell',\n checkbox: 'checkbox',\n columnheader: 'columnheader',\n combobox: 'combobox',\n command: 'command',\n complementary: 'complementary',\n composite: 'composite',\n contentinfo: 'contentinfo',\n definition: 'definition',\n dialog: 'dialog',\n directory: 'directory',\n document: 'document',\n feed: 'feed',\n figure: 'figure',\n form: 'form',\n grid: 'grid',\n gridcell: 'gridcell',\n group: 'group',\n heading: 'heading',\n img: 'img',\n input: 'input',\n landmark: 'landmark',\n link: 'link',\n list: 'list',\n listbox: 'listbox',\n listitem: 'listitem',\n log: 'log',\n main: 'main',\n 'The main content of a document.': 'The main content of a document.',\n marquee: 'marquee',\n math: 'math',\n 'Content that represents a mathematical expression.': 'Content that represents a mathematical expression.',\n menu: 'menu',\n menubar: 'menubar',\n menuitem: 'menuitem',\n menuitemcheckbox: 'menuitemcheckbox',\n menuitemradio: 'menuitemradio',\n navigation: 'navigation',\n none: 'none',\n note: 'note',\n option: 'option',\n presentation: 'presentation',\n progressbar: 'progressbar',\n radio: 'radio',\n radiogroup: 'radiogroup',\n range: 'range',\n region: 'region',\n roletype: 'roletype',\n row: 'row',\n rowgroup: 'rowgroup',\n rowheader: 'rowheader',\n scrollbar: 'scrollbar',\n search: 'search',\n searchbox: 'searchbox',\n section: 'section',\n sectionhead: 'sectionhead',\n select: 'select',\n separator: 'separator',\n slider: 'slider',\n spinbutton: 'spinbutton',\n status: 'status',\n structure: 'structure',\n switch: 'switch',\n tab: 'tab',\n table: 'table',\n tablist: 'tablist',\n tabpanel: 'tabpanel',\n term: 'term',\n textbox: 'textbox',\n timer: 'timer',\n toolbar: 'toolbar',\n tooltip: 'tooltip',\n tree: 'tree',\n treegrid: 'treegrid',\n treeitem: 'treeitem',\n widget: 'widget',\n window: 'window',\n};\n\nexport function guessRole(element: HTMLElement) {\n return element.getAttribute('role') || tagNameRole[element.tagName] || 'unknown';\n}\n\nexport function getContent(element: HTMLElement) {\n return element.innerText;\n}\n","import { TransitionEvent, TrackingEvent, TrackingEventParams, Scene, SpyEvent } from 'types';\nimport { Agent } from 'Agent';\nimport { History } from 'history';\nimport * as dom from 'utils/dom';\nimport { createScene, createDefaultEventParams } from 'utils/param';\nimport { TrackingEvent as V2TrackingEvent, isTrackingEvent as isV2TrackingEvent } from './TrackingEvent';\n\nexport interface Source {\n addAgent(agent: Agent): void;\n}\n\nexport class DefaultSource implements Source {\n private agents: Agent[] = [];\n\n private currentScene: Scene = createScene();\n\n addAgent(agent: Agent) {\n agent.initialize();\n this.agents.push(agent);\n }\n\n spyTransition(history: History) {\n // wait for whole page updated\n // init page_view\n setTimeout(() => this.transit(createScene()), 100);\n history.listen(() => {\n const { action } = history;\n // Filtering replace action (The pushed url is not matching, ex: Redirect)\n if (action === 'PUSH') {\n setTimeout(() => this.transit(createScene()), 100);\n }\n });\n }\n\n spyClick() {\n window.addEventListener('click', event => {\n const { target } = event;\n if (target instanceof HTMLElement) {\n this.track({\n eventName: 'click',\n category: 'default',\n trackingParams: {\n name: dom.getContent(target),\n value: '',\n role: dom.guessRole(target),\n },\n });\n }\n });\n }\n\n // tracking page visibility. e.g. page minimized, change browser tab or page unload\n spyPageDurationByVisible(params?: TrackingEventParams) {\n let startDurationTime: number = 0;\n\n const handleVisibleChange = (e: Event) => {\n if (document.visibilityState === 'hidden') {\n const endDurationTime = e.timeStamp;\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url: window.location.href,\n duration,\n ...params,\n },\n });\n }\n if (document.visibilityState === 'visible') {\n startDurationTime = e.timeStamp;\n }\n };\n document.addEventListener('visibilitychange', handleVisibleChange);\n }\n\n spyPageDurationByTransition(history: History, params?: TrackingEventParams) {\n let startDurationTime: number = Date.now();\n let url = window.location.href;\n history.listen(() => {\n const endDurationTime: number = Date.now();\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url,\n duration,\n ...params,\n },\n });\n startDurationTime = endDurationTime;\n url = window.location.href;\n });\n }\n\n login(userId: string) {\n this.report({ type: 'login', userId });\n }\n\n transit(toScene: Scene) {\n const fromScene = this.currentScene;\n const event: TransitionEvent = {\n type: 'transition',\n fromScene,\n toScene,\n defaultTrackingParams: createDefaultEventParams(),\n };\n this.report(event);\n }\n\n track(event: Omit | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n this.report(event);\n return;\n }\n const { trackingParams } = event;\n const defaultParams = trackingParams?.hasOwnProperty('productName') ? {} : createDefaultEventParams();\n const mergedTrackingParams = {\n ...defaultParams,\n ...trackingParams,\n };\n event.trackingParams = mergedTrackingParams;\n this.report({ type: 'tracking', ...event });\n }\n\n private report(event: SpyEvent) {\n this.agents.forEach(agent => {\n try {\n agent.report(event);\n } catch (error) {\n console.error(error);\n }\n });\n }\n}\n","import { TrackingEvent as V2TrackingEvent } from './TrackingEvent';\n\nexport enum Threshold {\n 'MIN' = 0,\n 'HALF' = 0.5,\n 'FULL' = 1,\n}\n\nexport interface Scene {\n title: string;\n hostname: string;\n pathname: string;\n}\n\nexport interface TransitionEvent {\n type: 'transition';\n fromScene: Scene;\n toScene: Scene;\n defaultTrackingParams: DefaultEventParams;\n}\n\nexport interface TrackingToken {\n sessionID: string;\n date: number;\n}\n\nexport interface TrackingEventParams {\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: number;\n action?: string;\n name?: string;\n role?: string;\n value?: string;\n page?: string;\n type?: string;\n leaderboardId?: string;\n streamerId?: string;\n liveStatus?: boolean;\n section?: string;\n rank?: number;\n to?: string;\n url?: string;\n utmCampaign?: string;\n utmContent?: string;\n utmMedium?: string;\n utmSource?: string;\n searchString?: string;\n resultCount?: number;\n hasDeeplink?: boolean;\n codename?: string;\n productName?: string;\n userName?: string;\n from?: string;\n result?: string;\n duration?: number;\n customPath?: string;\n}\nexport interface TrackingEvent {\n type: 'tracking';\n category: string;\n eventName: string;\n action?: string;\n trackingParams?: TrackingEventParams;\n}\n\nexport interface DefaultEventParams {\n userId: string;\n lang: string;\n os: string;\n eventId: string;\n timestamp: number;\n codename: string;\n guestSessionId: string;\n}\n\nexport interface LoginEvent {\n type: 'login';\n userId: string;\n}\n\nexport interface RefinedEventPathname {\n eventId: string;\n codename: string;\n}\n\nexport type ElementMap = Map;\n\nexport type SpyEvent = TrackingEvent | TransitionEvent | LoginEvent | V2TrackingEvent;\n\nexport type EventCallback = (event: T) => void;\n\nexport type EventListener = (callback: EventCallback) => void;\n","import { RefObject } from 'react';\nimport { ElementMap, Threshold } from './types';\nimport { __CLIENT__ } from './utils/constants';\nimport 'intersection-observer';\n\nclass SectionObserver {\n public elementMap: ElementMap;\n\n private observer: IntersectionObserver | undefined;\n\n private debounceExecute: number;\n\n constructor(debounce: boolean, threshold: Threshold) {\n this.elementMap = new Map();\n this.debounceExecute = 0;\n try {\n this.observer = new window.IntersectionObserver(\n entries => {\n if (debounce) {\n this.debounceSectionIntersect(entries);\n } else {\n this.sectionIntersect(entries);\n }\n },\n {\n threshold: [threshold],\n },\n );\n } catch (error) {\n console.log(`Error occur when creating IntersectionObserver: ${error}`);\n }\n }\n\n sectionObserve(ref: RefObject, callback: Function) {\n if (this.observer) this.observer.observe(ref.current);\n this.elementMap.set(ref.current, callback);\n }\n\n sectionUnobserve(ref: RefObject) {\n if (this.observer) this.observer.unobserve(ref.current);\n if (this.elementMap.has(ref.current)) this.elementMap.delete(ref.current);\n }\n\n resetSectionObserver() {\n this.elementMap.forEach((value, key) => {\n if (this.observer) this.observer.observe(key);\n });\n }\n\n private sectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n callback();\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n\n private debounceSectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n clearTimeout(this.debounceExecute);\n this.debounceExecute = window.setTimeout(() => {\n callback();\n }, 1000);\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n}\n\nexport let completeSectionObserver: SectionObserver | undefined;\nexport let halfSectionObserver: SectionObserver | undefined;\nexport let minSectionObserver: SectionObserver | undefined;\nexport let rankSectionObserver: SectionObserver | undefined;\n\nexport function registCompleteSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registCompleteSectionObserver()] should be invoked on client side.');\n }\n if (!completeSectionObserver) completeSectionObserver = new SectionObserver(false, Threshold.FULL);\n completeSectionObserver.sectionObserve(ref, callback);\n return () => {\n completeSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registHalfSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registHalfSectionObserver()] should be invoked on client side.');\n }\n\n if (!halfSectionObserver) halfSectionObserver = new SectionObserver(false, Threshold.HALF);\n halfSectionObserver.sectionObserve(ref, callback);\n return () => {\n halfSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registMinSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registMinSectionObserver()] should be invoked on client side.');\n }\n\n if (!minSectionObserver) minSectionObserver = new SectionObserver(false, Threshold.MIN);\n minSectionObserver.sectionObserve(ref, callback);\n return () => {\n minSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registRankSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registRankSectionObserver()] should be invoked on client side.');\n }\n\n if (!rankSectionObserver) rankSectionObserver = new SectionObserver(true, Threshold.FULL);\n rankSectionObserver.sectionObserve(ref, callback);\n return () => {\n rankSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function resetSectionObserverStatus() {\n if (completeSectionObserver) completeSectionObserver.resetSectionObserver();\n if (halfSectionObserver) halfSectionObserver.resetSectionObserver();\n if (minSectionObserver) minSectionObserver.resetSectionObserver();\n if (rankSectionObserver) rankSectionObserver.resetSectionObserver();\n}\n","import { RefObject, useEffect } from 'react';\nimport { History } from 'history';\nimport { DefaultSource } from './Source';\n\nimport {\n registCompleteSectionObserver,\n registHalfSectionObserver,\n registMinSectionObserver,\n registRankSectionObserver,\n resetSectionObserverStatus,\n} from './Observer';\n\nexport function useCompleteSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registCompleteSectionObserver(ref, callback);\n });\n}\n\nexport function useHalfSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registHalfSectionObserver(ref, callback);\n });\n}\n\nexport function useMinSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registMinSectionObserver(ref, callback);\n });\n}\n\nexport function useRankSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registRankSectionObserver(ref, callback);\n });\n}\n\nexport function usePageTransitionListener(trackingSource: DefaultSource, history: History) {\n useEffect(() => {\n // Regist history (for page_view & screen_view)\n trackingSource.spyTransition(history);\n history.listen(() => {\n resetSectionObserverStatus();\n });\n }, [history]);\n}\n","import {\n EVENT_NAME_CLICK,\n EVENT_NAME_ENTER,\n EVENT_NAME_LEAVE,\n EVENT_NAME_SEARCH,\n EVENT_NAME_SECTION_VIEW,\n CATEGORY_DEFAULT,\n ACTION_BUTTON_CLICK,\n ACTION_TAB_CLICK,\n ACTION_PROFILE_CLICK,\n ACTION_LINK_CLICK,\n ACTION_ENTER,\n} from './utils/constants';\n\nimport { TrackingEvent } from './types';\n\ntype EventAction = Omit;\ntype SectionName = 'buttons' | 'duration' | 'gifts' | 'searchBar' | 'tabs' | 'description' | 'timeline' | 'topStreamer';\ntype ProfileName = 'topavatar' | 'avatar';\n\nexport function createButtonClickAction(buttonName: string, link: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: buttonName,\n page: link,\n },\n };\n}\n\nexport function createPageEnterAction(\n utmCampaign: string,\n utmContent: string,\n utmMedium: string,\n utmSource: string,\n): EventAction {\n return {\n eventName: EVENT_NAME_ENTER,\n category: CATEGORY_DEFAULT,\n trackingParams: {\n utmCampaign,\n utmContent,\n utmMedium,\n utmSource,\n },\n };\n}\n\nexport function createPageLeaveAction(): EventAction {\n return {\n eventName: EVENT_NAME_LEAVE,\n category: CATEGORY_DEFAULT,\n };\n}\n\nexport function createTabClickAction(link: string, tabName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_TAB_CLICK,\n page: link,\n name: tabName,\n },\n };\n}\n\nexport function createProfileClickAction(userID: string, liveStatus: boolean, profileType: ProfileName): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: liveStatus ? 'LiveStream' : 'Profile',\n trackingParams: {\n action: ACTION_PROFILE_CLICK,\n type: profileType,\n streamerId: userID,\n liveStatus: liveStatus,\n leaderboardId: '',\n hasDeeplink: false,\n },\n };\n}\n\nexport function createSearchAction(keyword: string, count: number): EventAction {\n return {\n eventName: EVENT_NAME_SEARCH,\n category: 'Content',\n trackingParams: {\n searchString: keyword,\n resultCount: count,\n },\n };\n}\n\nexport function createVoteAction(voteTopic: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'Interaction_vote',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: voteTopic,\n type: 'vote',\n },\n };\n}\n\nexport function createLeaderboardSectionViewAction(rank: number): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section: 'leaderboardItem',\n rank,\n },\n };\n}\n\nexport function createLinkClickAction(link: string, linkName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_LINK_CLICK,\n url: link,\n name: linkName,\n },\n };\n}\n\nexport function createSectionViewAction(section: SectionName, customPath?: string): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section,\n // For customized event to use.\n customPath,\n },\n };\n}\n","import { TrackingEvent } from './TrackingEvent';\nimport { createDefaultEventParams } from './utils/param';\n\nexport function createTrackingEvent(event: Omit) {\n return {\n ...event,\n payload: { ...createDefaultEventParams(), ...event.payload },\n type: 'tracking',\n $$type: 'TrackingEvent',\n } as TrackingEvent;\n}\n"],"names":["setPrototypeOf","assertThisInitialized","Op","Object","prototype","hasOwn","hasOwnProperty","undefined","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","fn","obj","arg","type","call","err","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","constructor","displayName","defineIteratorMethods","forEach","method","isGeneratorFunction","genFun","ctor","name","mark","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","value","then","unwrapped","error","previousPromise","enqueue","callInvokeWithMethodAndArg","async","Promise","iter","next","done","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","info","resultName","nextLoc","toString","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","keys","object","key","reverse","length","pop","iterable","iteratorMethod","isNaN","i","skipTempReset","prev","charAt","slice","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","qs","v4","object.convertParamsToSankecase","isV2TrackingEvent","object.trim","params.createMatomoCustomDimensions","dom.getContent","dom.guessRole","Threshold","completeSectionObserver","halfSectionObserver","minSectionObserver","rankSectionObserver","useEffect"],"mappings":";;;;;;;;;;;;;AAAe,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;AACzD,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;AACpC,MAAM,KAAK,EAAE,KAAK;AAClB,MAAM,UAAU,EAAE,IAAI;AACtB,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,QAAQ,EAAE,IAAI;AACpB,KAAK,CAAC,CAAC;AACP,GAAG,MAAM;AACT,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACrB,GAAG;AACH;AACA,EAAE,OAAO,GAAG,CAAC;AACb;;ACbe,SAAS,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE;AAC9C,EAAE,eAAe,GAAG,MAAM,CAAC,cAAc,IAAI,SAAS,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE;AAC5E,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;AACpB,IAAI,OAAO,CAAC,CAAC;AACb,GAAG,CAAC;AACJ;AACA,EAAE,OAAO,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B;;ACNe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AEK,SAAU,qBAAV,CAAgC,IAAhC,EAA8C,QAA9C,EAA8D;AAClE,SAAO;AACL,IAAA,SAAS,EAAE,gBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,iBADM;AAEd,MAAA,GAAG,EAAE,IAFS;AAGd,MAAA,IAAI,EAAE;AAHQ;AAHX,GAAP;AASD;AAEK,SAAU,uBAAV,CAAkC,OAAlC,EAAwD,UAAxD,EAA2E;AAC/E,SAAO;AACL,IAAA,SAAS,EAAE,uBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,YADM;AAEd,MAAA,OAAO,EAAP,OAFc;AAGd;AACA,MAAA,UAAU,EAAV;AAJc;AAHX,GAAP;AAUD;;;;;AC3IK,SAAU,mBAAV,CAA8B,KAA9B,EAA2E;AAC/E,6CACK,KADL;AAEE,IAAA,OAAO,sCAAO,wBAAwB,EAA/B,GAAsC,KAAK,CAAC,OAA5C,CAFT;AAGE,IAAA,IAAI,EAAE,UAHR;AAIE,IAAA,MAAM,EAAE;AAJV;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/@babel/runtime/helpers/esm/inherits.js","../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../node_modules/@babel/runtime/regenerator/index.js","../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../node_modules/@babel/runtime/helpers/esm/createClass.js","../src/utils/loadScript.ts","../src/utils/object.ts","../src/TrackingEvent.ts","../src/utils/constants.ts","../src/utils/param.ts","../src/Agent.ts","../src/utils/dom.ts","../src/Source.ts","../src/types.ts","../src/Observer.ts","../src/hooks.ts","../src/actions.ts","../src/createTrackingEvent.ts"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\"use strict\";\n\nvar Op = Object.prototype;\nvar hasOwn = Op.hasOwnProperty;\nvar undefined; // More compressible than void 0.\nvar $Symbol = typeof Symbol === \"function\" ? Symbol : {};\nvar iteratorSymbol = $Symbol.iterator || \"@@iterator\";\nvar asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\nvar toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\nfunction wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n}\n\n// Try/catch helper to minimize deoptimizations. Returns a completion\n// record like context.tryEntries[i].completion. This interface could\n// have been (and was previously) designed to take a closure to be\n// invoked without arguments, but in all the cases we care about we\n// already have an existing method we want to call, so there's no need\n// to create a new function object. We can even get away with assuming\n// the method takes exactly one argument, since that happens to be true\n// in every case, so we don't have to touch the arguments object. The\n// only additional allocation required is the completion record, which\n// has a stable shape and so hopefully should be cheap to allocate.\nfunction tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n}\n\nvar GenStateSuspendedStart = \"suspendedStart\";\nvar GenStateSuspendedYield = \"suspendedYield\";\nvar GenStateExecuting = \"executing\";\nvar GenStateCompleted = \"completed\";\n\n// Returning this object from the innerFn has the same effect as\n// breaking out of the dispatch switch statement.\nvar ContinueSentinel = {};\n\n// Dummy constructor functions that we use as the .constructor and\n// .constructor.prototype properties for functions that return Generator\n// objects. For full spec compliance, you may wish to configure your\n// minifier not to mangle the names of these two functions.\nfunction Generator() {}\nfunction GeneratorFunction() {}\nfunction GeneratorFunctionPrototype() {}\n\n// This is a polyfill for %IteratorPrototype% for environments that\n// don't natively support it.\nvar IteratorPrototype = {};\nIteratorPrototype[iteratorSymbol] = function () {\n return this;\n};\n\nvar getProto = Object.getPrototypeOf;\nvar NativeIteratorPrototype = getProto && getProto(getProto(values([])));\nif (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n}\n\nvar Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\nGeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\nGeneratorFunctionPrototype.constructor = GeneratorFunction;\nGeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n// Helper for defining the .next, .throw, and .return methods of the\n// Iterator interface in terms of a single ._invoke method.\nfunction defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n}\n\nfunction isGeneratorFunction (genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n};\n\nfunction mark (genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n};\n\n// Within the body of any async function, `await x` is transformed to\n// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n// `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n// meant to be awaited.\nfunction awrap (arg) {\n return { __await: arg };\n};\n\nfunction AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n}\n\ndefineIteratorMethods(AsyncIterator.prototype);\nAsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n};\n\n// Note that simple async functions are implemented on top of\n// AsyncIterator objects; they just return a Promise for the value of\n// the final result produced by the iterator.\n function async (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n};\n\nfunction makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n}\n\n// Call delegate.iterator[context.method](context.arg) and handle the\n// result, either by returning a { value, done } result from the\n// delegate iterator, or by modifying context.method and context.arg,\n// setting context.delegate to null, and returning the ContinueSentinel.\nfunction maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n}\n\n// Define Generator.prototype.{next,throw,return} in terms of the\n// unified ._invoke helper method.\ndefineIteratorMethods(Gp);\n\nGp[toStringTagSymbol] = \"Generator\";\n\n// A Generator should always return itself as the iterator object when the\n// @@iterator function is called on it. Some browsers' implementations of the\n// iterator prototype chain incorrectly implement this, causing the Generator\n// object to not be returned from this call. This ensures that doesn't happen.\n// See https://github.com/facebook/regenerator/issues/274 for more details.\nGp[iteratorSymbol] = function() {\n return this;\n};\n\nGp.toString = function() {\n return \"[object Generator]\";\n};\n\nfunction pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n}\n\nfunction resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n}\n\nfunction Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n}\n\nfunction keys (object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n};\n\nfunction values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n}\n\nfunction doneResult() {\n return { value: undefined, done: true };\n}\n\nContext.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n};\n\n// Export a default namespace that plays well with Rollup\nexport default {\n wrap,\n isGeneratorFunction,\n AsyncIterator,\n mark,\n awrap,\n async,\n keys,\n values\n};\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export function loadScript(src: string) {\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.defer = true;\n script.src = src;\n\n const firstScript = document.getElementsByTagName('script')[0];\n firstScript.parentNode!.insertBefore(script, firstScript);\n\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = reject;\n });\n}\n\nexport function loadScripts(...src: string[]) {\n return Promise.all(src.map(loadScript));\n}\n","export function trim(object: Record) {\n for (const key in object) {\n if (typeof object[key] === 'undefined') {\n delete object[key];\n }\n if (object[key] === null) {\n delete object[key];\n }\n }\n}\n\nexport function convertStringToSankecase(str: string) {\n const upperCaseMap = new Map();\n const strArray = Array.from(str);\n strArray.forEach((char, index) => {\n const currentCharCode = char.charCodeAt(0);\n const asciiCodeA = 'A'.charCodeAt(0);\n const asciiCodeZ = 'Z'.charCodeAt(0);\n if (currentCharCode >= asciiCodeA && currentCharCode <= asciiCodeZ) {\n upperCaseMap.set(index, char);\n }\n });\n upperCaseMap.forEach((value, key) => {\n strArray[key] = `_${value.toLowerCase()}`;\n });\n return strArray.join('');\n}\n\nexport function convertParamsToSankecase(params: T) {\n return Object.keys(params).reduce((prev: Record, key: string) => {\n const currentParams = prev;\n const snakecaseKey = convertStringToSankecase(key);\n currentParams[snakecaseKey] = (params as any)[key];\n return currentParams;\n }, {});\n}\n","interface BaseEvent {\n type: 'tracking';\n category: string;\n action: string;\n name: string;\n payload: Payload;\n $$type: 'TrackingEvent';\n}\n\n// auto injection\nexport interface BasePayload {\n //如果是訪客打 \"guest\"\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: string;\n codename?: string;\n guestSessionId?: string;\n sourceUrl?: string;\n componentId?: string;\n componentType?: string;\n traceId?: string;\n}\n\ninterface ClickButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n}\n\nexport interface ClickButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickTabEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // url\n page: string;\n}\n\nexport interface ClickTabEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n}\n\ninterface ClickLeaderboardButtonEventPayload extends BasePayload {\n action: 'ButtonClick';\n name: string;\n // bonus, contributor, vote\n type: string;\n}\n\nexport interface ClickLeaderboardButtonEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'button_expend.open' | 'button_expend.close' | 'button_vote';\n}\n\ninterface ClickTopStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'topavatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickTopStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_top';\n}\n\ninterface ClickStreamerEventPayload extends BasePayload {\n action: 'ProfileClick';\n leaderboardId: string;\n streamerId: string;\n type: 'avatar';\n liveStatus: boolean;\n // 如果有勾選“Open 17 app when clicking avatar if enable.”則為true,反之則為false\n hasDeeplink: boolean;\n}\n\nexport interface ClickStreamerEvent extends BaseEvent {\n // 直撥中 = LiveStream, 非直撥中 = Profile\n category: 'LiveStream' | 'Profile';\n action: 'click';\n name: 'avatar_streamer';\n}\n\ninterface LinkEventPayload extends BasePayload {\n action: 'LinkClick';\n url: string;\n //超連結字名稱\n name: string;\n}\n\nexport interface LinkEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'click';\n name: 'link_info';\n}\n\ninterface PageViewEventPayload extends BasePayload {\n leaderboardStartTime: number;\n leaderboardEndTime: number;\n // url\n from: string;\n // url\n to: string;\n utmCampaign: string;\n utmContent: string;\n utmMedium: string;\n utmSource: string;\n}\n\nexport interface PageViewEvent extends BaseEvent {\n category: 'Leaderboard' | 'Infomation';\n action: 'view';\n name: 'event_view';\n}\n\ninterface SectionViewEventPayload extends BasePayload {\n section: string;\n action: 'enter' | 'leave';\n //滑榜單停下時,打看到的最後一個名次\n rank?: number;\n // 提供給客製活動使用(因為url不會轉換)\n customPath?: string;\n}\n\nexport interface SectionViewEvent extends BaseEvent {\n category: 'PageSurfing';\n action: 'scroll';\n}\n\ninterface SearchUserEventPayload extends BasePayload {\n searchString: string;\n resultCount: number;\n}\n\nexport interface SearchUserEvent extends BaseEvent {\n category: 'Content';\n action: 'search';\n name: 'search_user';\n}\n\nexport type TrackingEvent =\n | ClickButtonEvent\n | ClickTabEvent\n | ClickLeaderboardButtonEvent\n | ClickTopStreamerEvent\n | ClickStreamerEvent\n | LinkEvent\n | PageViewEvent\n | SectionViewEvent\n | SearchUserEvent;\n\nexport function isTrackingEvent(value: unknown): value is TrackingEvent {\n if (typeof value !== 'object') return false;\n if (value === null) return false;\n return (value as TrackingEvent).$$type === 'TrackingEvent';\n}\n","export const EVENT_NAME_CLICK = 'click';\nexport const EVENT_NAME_ENTER = 'enter';\nexport const EVENT_NAME_LEAVE = 'leave';\nexport const EVENT_NAME_SEARCH = 'search';\nexport const EVENT_NAME_SECTION_VIEW = 'section_view';\n\nexport const CATEGORY_DEFAULT = 'default';\n\nexport const ACTION_BUTTON_CLICK = 'ButtonClick';\nexport const ACTION_TAB_CLICK = 'TabClick';\nexport const ACTION_PROFILE_CLICK = 'ProfileClick';\nexport const ACTION_LINK_CLICK = 'LinkClick';\nexport const ACTION_ENTER = 'scroll';\n\nexport const __CLIENT__ = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n\nexport const matomoCustomDimensionMap: Record = {\n contentId: 'dimension1',\n contentType: 'dimension2',\n search: 'dimension5',\n comment: 'dimension6',\n genericJson: 'dimension11',\n genericText: 'dimension12',\n traceId: 'dimension13',\n appVersion: 'dimension15',\n deviceId: 'dimension16',\n timestamp: 'dimension17',\n componentId: 'dimension21',\n componentType: 'dimension22',\n advertisingId: 'dimension23',\n sourceUrl: 'dimension24',\n user: 'dimension25',\n};\n","import qs from 'qs';\nimport { v4 } from 'uuid';\nimport { Scene, DefaultEventParams, RefinedEventPathname, TrackingToken } from 'types';\nimport { TrackingEvent as V2TrackingEvent } from '../TrackingEvent';\nimport { matomoCustomDimensionMap } from './constants';\n\nfunction getUserID() {\n const qsUserID = qs.parse(window.location.search, { ignoreQueryPrefix: true }).userID;\n if (Array.isArray(qsUserID)) {\n return sessionStorage.getItem('userID') || 'guest';\n }\n // The order of checking UserID.\n // 1. sessionStorage\n // 2. query string\n return sessionStorage.getItem('userID') || `${qsUserID}` || 'guest';\n}\n\nfunction createTrackingToken() {\n const storageKey = 'trackingToken';\n const days30 = 60 * 60 * 24 * 30 * 1000;\n const newTrackingToken: TrackingToken = {\n sessionID: v4(),\n date: Date.now(),\n };\n\n try {\n const trackingToken = JSON.parse(localStorage.getItem(storageKey) || '') as TrackingToken;\n const { date, sessionID } = trackingToken;\n // Expired checking (after 30 days)\n if (Date.now() - date < days30) return sessionID;\n\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n } catch (error) {\n localStorage.setItem(storageKey, JSON.stringify(newTrackingToken));\n }\n return newTrackingToken.sessionID;\n}\n\nexport function createScene(): Scene {\n const { title } = window.document;\n const { hostname, pathname } = window.location;\n return { title, hostname, pathname };\n}\n\nexport function refineEventPathname(pathname: string): RefinedEventPathname {\n const slashCount = pathname.match(/-/g)?.length;\n if (slashCount && slashCount >= 3) {\n // slashCount === 3+\n const pathnameArray = pathname.split('-');\n const eventId = pathnameArray[0];\n const codename = pathnameArray.splice(1, pathnameArray.length).join('-');\n return { eventId, codename };\n }\n return { eventId: '', codename: pathname };\n}\n\nexport function createDefaultEventParams(): DefaultEventParams {\n const codenameArray = window.location.pathname.split('/');\n const eventPathname = codenameArray.length > 1 ? codenameArray[1] : '';\n const { eventId, codename } = refineEventPathname(eventPathname);\n const trackingToken = createTrackingToken();\n\n return {\n userId: getUserID(),\n lang: navigator.language || '',\n os: navigator.userAgent || '',\n timestamp: Date.now(),\n codename,\n eventId,\n guestSessionId: trackingToken,\n };\n}\n\nexport function createMatomoCustomDimensions(event: V2TrackingEvent) {\n const dimensions: Record = {};\n for (const key in event.payload) {\n const dimensionKey = matomoCustomDimensionMap[key];\n if (!dimensionKey) continue;\n dimensions[dimensionKey] = event.payload[key as keyof typeof event.payload];\n }\n return dimensions;\n}\n","/* eslint-disable @typescript-eslint/camelcase */\n\nimport { loadScript, loadScripts } from 'utils/loadScript';\nimport * as object from 'utils/object';\nimport { TrackingEvent, TransitionEvent, LoginEvent, SpyEvent, Scene } from 'types';\nimport type { analytics } from 'firebase';\nimport { isTrackingEvent as isV2TrackingEvent, TrackingEvent as V2TrackingEvent } from './TrackingEvent';\nimport * as params from './utils/param';\n\nenum AgentState {\n Uninitialized,\n Initializing,\n Initialized,\n InitializeFail,\n}\n\ndeclare var firebase: any;\n\nexport abstract class Agent {\n protected state = AgentState.Uninitialized;\n\n async initialize() {\n if (this.state !== AgentState.Uninitialized) return;\n\n this.state = AgentState.Initializing;\n\n try {\n await this.doInitialize();\n this.state = AgentState.Initialized;\n } catch (error) {\n console.error(error);\n this.state = AgentState.InitializeFail;\n }\n }\n\n abstract report(event: SpyEvent): void;\n\n protected abstract doInitialize(): Promise | void;\n}\n\nlet isInit = false;\n\nexport class FirebaseAgent extends Agent {\n private client!: analytics.Analytics;\n\n private queue: Array<() => void> = [];\n\n /**\n * @param config @see https://support.google.com/firebase/answer/7015592\n */\n constructor(readonly config: any) {\n super();\n }\n\n async doInitialize() {\n await loadScripts(\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-app.js',\n 'https://www.gstatic.com/firebasejs/7.14.1/firebase-analytics.js',\n );\n\n if (!isInit) {\n this.client = firebase.initializeApp(this.config).analytics();\n isInit = true;\n } else {\n this.client = firebase.analytics();\n }\n\n this.queue.forEach(callback => callback());\n\n this.queue = [];\n }\n\n report(event: SpyEvent) {\n this.queueIfNotInitialized(() => this.doReport(event));\n }\n\n private doReport(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n this.client.setUserId(userId, { global: true });\n if (userId) this.client.logEvent('login', { userId });\n }\n\n private transit(event: TransitionEvent) {\n const { toScene, defaultTrackingParams } = event;\n const { title, hostname, pathname } = toScene;\n this.client.logEvent('page_view', {\n page_title: title,\n page_location: hostname,\n page_path: pathname,\n ...object.convertParamsToSankecase(defaultTrackingParams),\n });\n this.client.setCurrentScreen(event.toScene.title, { global: true });\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { name, payload } = event;\n object.trim(payload);\n this.client.logEvent(name, object.convertParamsToSankecase(payload));\n return;\n }\n const { eventName, trackingParams = {} } = event;\n object.trim(trackingParams);\n this.client.logEvent(eventName, object.convertParamsToSankecase(trackingParams));\n }\n\n private queueIfNotInitialized(callback: () => void) {\n if (this.state === AgentState.Initialized) callback();\n else this.queue.push(callback);\n }\n}\n\nexport interface MatomoAgentConfig {\n endpoint: string;\n siteId: string;\n}\n\nexport class MatomoAgent extends Agent {\n private get client() {\n window._paq = window._paq || []; // eslint-disable-line no-underscore-dangle\n return window._paq; // eslint-disable-line no-underscore-dangle\n }\n\n private trackPageViewTimer = 0;\n\n private currentScene: Scene | null = null;\n\n constructor(readonly config: MatomoAgentConfig) {\n super();\n }\n\n async doInitialize() {\n this.client.push(['setTrackerUrl', `${this.config.endpoint}matomo.php`]);\n this.client.push(['setSiteId', this.config.siteId]);\n this.client.push(['trackPageView']);\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n await loadScript(`${this.config.endpoint}piwik.js`);\n }\n\n report(event: SpyEvent) {\n switch (event.type) {\n case 'login':\n return this.login(event);\n case 'tracking':\n return this.track(event);\n case 'transition':\n return this.transit(event);\n default:\n break;\n }\n }\n\n private login(event: LoginEvent) {\n const { userId } = event;\n if (userId) this.client.push(['setUserId', userId]);\n else this.client.push(['resetUserId']);\n this.requestTrackPageView();\n }\n\n private transit(event: TransitionEvent) {\n const { fromScene, toScene } = event;\n this.client.push(['setReferrerUrl', fromScene.pathname]);\n this.client.push(['setCustomUrl', toScene.pathname]);\n this.client.push(['setDocumentTitle', toScene.title]);\n this.client.push(['setGenerationTimeMs', 0]);\n this.requestTrackPageView();\n this.client.push(['enableLinkTracking']);\n this.client.push(['trackAllContentImpressions']);\n this.currentScene = toScene;\n }\n\n private track(event: TrackingEvent | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n const { category, action, name } = event;\n if (this.currentScene) {\n event.payload.sourceUrl = this.currentScene.pathname;\n }\n const dimensions = params.createMatomoCustomDimensions(event);\n this.client.push(['trackEvent', category, action, name, '', dimensions]);\n return;\n }\n // matomo support only v2 event\n // /**\n // * ref : https://developer.matomo.org/guides/tracking-javascript\n // * trackEvent(category, action, [name], [value]) -\n // * Log an event with an event category (Videos, Music, Games...), an event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional event name and optional numeric value.\n // */\n // const { eventName, category, trackingParams = {} } = event;\n // const { name = '', value = '' } = trackingParams;\n // const dimensions = {};\n // /**\n // * _paq.push(['trackEvent', category, action, name, value, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackSiteSearch', keyword, category, resultsCount, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackLink', url, linkType, {dimension1: 'DimensionValue'}]);\n // * _paq.push(['trackGoal', idGoal, customRevenue, {dimension1: 'DimensionValue'}]);\n // */\n // this.client.push(['trackEvent', category, eventName, name, value, dimensions]);\n }\n\n private requestTrackPageView() {\n if (this.trackPageViewTimer) clearTimeout(this.trackPageViewTimer);\n this.trackPageViewTimer = setTimeout(() => {\n this.client.push(['trackPageView']);\n this.trackPageViewTimer = 0;\n });\n }\n}\n","const tagNameRole: Record = {\n alert: 'alert',\n alertdialog: 'alertdialog',\n application: 'application',\n article: 'article',\n banner: 'banner',\n button: 'button',\n cell: 'cell',\n checkbox: 'checkbox',\n columnheader: 'columnheader',\n combobox: 'combobox',\n command: 'command',\n complementary: 'complementary',\n composite: 'composite',\n contentinfo: 'contentinfo',\n definition: 'definition',\n dialog: 'dialog',\n directory: 'directory',\n document: 'document',\n feed: 'feed',\n figure: 'figure',\n form: 'form',\n grid: 'grid',\n gridcell: 'gridcell',\n group: 'group',\n heading: 'heading',\n img: 'img',\n input: 'input',\n landmark: 'landmark',\n link: 'link',\n list: 'list',\n listbox: 'listbox',\n listitem: 'listitem',\n log: 'log',\n main: 'main',\n 'The main content of a document.': 'The main content of a document.',\n marquee: 'marquee',\n math: 'math',\n 'Content that represents a mathematical expression.': 'Content that represents a mathematical expression.',\n menu: 'menu',\n menubar: 'menubar',\n menuitem: 'menuitem',\n menuitemcheckbox: 'menuitemcheckbox',\n menuitemradio: 'menuitemradio',\n navigation: 'navigation',\n none: 'none',\n note: 'note',\n option: 'option',\n presentation: 'presentation',\n progressbar: 'progressbar',\n radio: 'radio',\n radiogroup: 'radiogroup',\n range: 'range',\n region: 'region',\n roletype: 'roletype',\n row: 'row',\n rowgroup: 'rowgroup',\n rowheader: 'rowheader',\n scrollbar: 'scrollbar',\n search: 'search',\n searchbox: 'searchbox',\n section: 'section',\n sectionhead: 'sectionhead',\n select: 'select',\n separator: 'separator',\n slider: 'slider',\n spinbutton: 'spinbutton',\n status: 'status',\n structure: 'structure',\n switch: 'switch',\n tab: 'tab',\n table: 'table',\n tablist: 'tablist',\n tabpanel: 'tabpanel',\n term: 'term',\n textbox: 'textbox',\n timer: 'timer',\n toolbar: 'toolbar',\n tooltip: 'tooltip',\n tree: 'tree',\n treegrid: 'treegrid',\n treeitem: 'treeitem',\n widget: 'widget',\n window: 'window',\n};\n\nexport function guessRole(element: HTMLElement) {\n return element.getAttribute('role') || tagNameRole[element.tagName] || 'unknown';\n}\n\nexport function getContent(element: HTMLElement) {\n return element.innerText;\n}\n","import { TransitionEvent, TrackingEvent, TrackingEventParams, Scene, SpyEvent } from 'types';\nimport { Agent } from 'Agent';\nimport { History } from 'history';\nimport * as dom from 'utils/dom';\nimport { createScene, createDefaultEventParams } from 'utils/param';\nimport { TrackingEvent as V2TrackingEvent, isTrackingEvent as isV2TrackingEvent } from './TrackingEvent';\n\nexport interface Source {\n addAgent(agent: Agent): void;\n}\n\nexport class DefaultSource implements Source {\n private agents: Agent[] = [];\n\n private currentScene: Scene = createScene();\n\n addAgent(agent: Agent) {\n agent.initialize();\n this.agents.push(agent);\n }\n\n spyTransition(history: History) {\n // wait for whole page updated\n // init page_view\n setTimeout(() => this.transit(createScene()), 100);\n history.listen(() => {\n const { action } = history;\n // Filtering replace action (The pushed url is not matching, ex: Redirect)\n if (action === 'PUSH') {\n setTimeout(() => this.transit(createScene()), 100);\n }\n });\n }\n\n spyClick() {\n window.addEventListener('click', event => {\n const { target } = event;\n if (target instanceof HTMLElement) {\n this.track({\n eventName: 'click',\n category: 'default',\n trackingParams: {\n name: dom.getContent(target),\n value: '',\n role: dom.guessRole(target),\n },\n });\n }\n });\n }\n\n // tracking page visibility. e.g. page minimized, change browser tab or page unload\n spyPageDurationByVisible(params?: TrackingEventParams) {\n let startDurationTime: number = 0;\n\n const handleVisibleChange = (e: Event) => {\n if (document.visibilityState === 'hidden') {\n const endDurationTime = e.timeStamp;\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url: window.location.href,\n duration,\n ...params,\n },\n });\n }\n if (document.visibilityState === 'visible') {\n startDurationTime = e.timeStamp;\n }\n };\n document.addEventListener('visibilitychange', handleVisibleChange);\n }\n\n spyPageDurationByTransition(history: History, params?: TrackingEventParams) {\n let startDurationTime: number = Date.now();\n let url = window.location.href;\n history.listen(() => {\n const endDurationTime: number = Date.now();\n const duration = Math.floor(endDurationTime - startDurationTime);\n this.track({\n eventName: 'pageView',\n category: 'default',\n trackingParams: {\n url,\n duration,\n ...params,\n },\n });\n startDurationTime = endDurationTime;\n url = window.location.href;\n });\n }\n\n login(userId: string) {\n this.report({ type: 'login', userId });\n }\n\n transit(toScene: Scene) {\n const fromScene = this.currentScene;\n const event: TransitionEvent = {\n type: 'transition',\n fromScene,\n toScene,\n defaultTrackingParams: createDefaultEventParams(),\n };\n this.report(event);\n }\n\n track(event: Omit | V2TrackingEvent) {\n if (isV2TrackingEvent(event)) {\n this.report(event);\n return;\n }\n const { trackingParams } = event;\n const defaultParams = trackingParams?.hasOwnProperty('productName') ? {} : createDefaultEventParams();\n const mergedTrackingParams = {\n ...defaultParams,\n ...trackingParams,\n };\n event.trackingParams = mergedTrackingParams;\n this.report({ type: 'tracking', ...event });\n }\n\n private report(event: SpyEvent) {\n this.agents.forEach(agent => {\n try {\n agent.report(event);\n } catch (error) {\n console.error(error);\n }\n });\n }\n}\n","import { TrackingEvent as V2TrackingEvent } from './TrackingEvent';\n\nexport enum Threshold {\n 'MIN' = 0,\n 'HALF' = 0.5,\n 'FULL' = 1,\n}\n\nexport interface Scene {\n title: string;\n hostname: string;\n pathname: string;\n}\n\nexport interface TransitionEvent {\n type: 'transition';\n fromScene: Scene;\n toScene: Scene;\n defaultTrackingParams: DefaultEventParams;\n}\n\nexport interface TrackingToken {\n sessionID: string;\n date: number;\n}\n\nexport interface TrackingEventParams {\n userId?: string;\n lang?: string;\n os?: string;\n eventId?: string;\n timestamp?: number;\n action?: string;\n name?: string;\n role?: string;\n value?: string;\n page?: string;\n type?: string;\n leaderboardId?: string;\n streamerId?: string;\n liveStatus?: boolean;\n section?: string;\n rank?: number;\n to?: string;\n url?: string;\n utmCampaign?: string;\n utmContent?: string;\n utmMedium?: string;\n utmSource?: string;\n searchString?: string;\n resultCount?: number;\n hasDeeplink?: boolean;\n codename?: string;\n productName?: string;\n userName?: string;\n from?: string;\n result?: string;\n duration?: number;\n customPath?: string;\n}\nexport interface TrackingEvent {\n type: 'tracking';\n category: string;\n eventName: string;\n action?: string;\n trackingParams?: TrackingEventParams;\n}\n\nexport interface DefaultEventParams {\n userId: string;\n lang: string;\n os: string;\n eventId: string;\n timestamp: number;\n codename: string;\n guestSessionId: string;\n}\n\nexport interface LoginEvent {\n type: 'login';\n userId: string;\n}\n\nexport interface RefinedEventPathname {\n eventId: string;\n codename: string;\n}\n\nexport type ElementMap = Map;\n\nexport type SpyEvent = TrackingEvent | TransitionEvent | LoginEvent | V2TrackingEvent;\n\nexport type EventCallback = (event: T) => void;\n\nexport type EventListener = (callback: EventCallback) => void;\n","import { RefObject } from 'react';\nimport { ElementMap, Threshold } from './types';\nimport { __CLIENT__ } from './utils/constants';\nimport 'intersection-observer';\n\nclass SectionObserver {\n public elementMap: ElementMap;\n\n private observer: IntersectionObserver | undefined;\n\n private debounceExecute: number;\n\n constructor(debounce: boolean, threshold: Threshold) {\n this.elementMap = new Map();\n this.debounceExecute = 0;\n try {\n this.observer = new window.IntersectionObserver(\n entries => {\n if (debounce) {\n this.debounceSectionIntersect(entries);\n } else {\n this.sectionIntersect(entries);\n }\n },\n {\n threshold: [threshold],\n },\n );\n } catch (error) {\n console.log(`Error occur when creating IntersectionObserver: ${error}`);\n }\n }\n\n sectionObserve(ref: RefObject, callback: Function) {\n if (this.observer) this.observer.observe(ref.current);\n this.elementMap.set(ref.current, callback);\n }\n\n sectionUnobserve(ref: RefObject) {\n if (this.observer) this.observer.unobserve(ref.current);\n if (this.elementMap.has(ref.current)) this.elementMap.delete(ref.current);\n }\n\n resetSectionObserver() {\n this.elementMap.forEach((value, key) => {\n if (this.observer) this.observer.observe(key);\n });\n }\n\n private sectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n callback();\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n\n private debounceSectionIntersect(entries: IntersectionObserverEntry[]) {\n entries.forEach(entry => {\n const { target } = entry;\n if (entry.isIntersecting && this.elementMap.has(target)) {\n const callback = this.elementMap.get(target);\n if (!callback) return;\n\n clearTimeout(this.debounceExecute);\n this.debounceExecute = window.setTimeout(() => {\n callback();\n }, 1000);\n\n if (this.observer) this.observer.unobserve(target);\n }\n });\n }\n}\n\nexport let completeSectionObserver: SectionObserver | undefined;\nexport let halfSectionObserver: SectionObserver | undefined;\nexport let minSectionObserver: SectionObserver | undefined;\nexport let rankSectionObserver: SectionObserver | undefined;\n\nexport function registCompleteSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registCompleteSectionObserver()] should be invoked on client side.');\n }\n if (!completeSectionObserver) completeSectionObserver = new SectionObserver(false, Threshold.FULL);\n completeSectionObserver.sectionObserve(ref, callback);\n return () => {\n completeSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registHalfSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registHalfSectionObserver()] should be invoked on client side.');\n }\n\n if (!halfSectionObserver) halfSectionObserver = new SectionObserver(false, Threshold.HALF);\n halfSectionObserver.sectionObserve(ref, callback);\n return () => {\n halfSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registMinSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registMinSectionObserver()] should be invoked on client side.');\n }\n\n if (!minSectionObserver) minSectionObserver = new SectionObserver(false, Threshold.MIN);\n minSectionObserver.sectionObserve(ref, callback);\n return () => {\n minSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function registRankSectionObserver(ref: RefObject, callback: Function) {\n if (!__CLIENT__) {\n throw new Error('[registRankSectionObserver()] should be invoked on client side.');\n }\n\n if (!rankSectionObserver) rankSectionObserver = new SectionObserver(true, Threshold.FULL);\n rankSectionObserver.sectionObserve(ref, callback);\n return () => {\n rankSectionObserver!.sectionUnobserve(ref);\n };\n}\n\nexport function resetSectionObserverStatus() {\n if (completeSectionObserver) completeSectionObserver.resetSectionObserver();\n if (halfSectionObserver) halfSectionObserver.resetSectionObserver();\n if (minSectionObserver) minSectionObserver.resetSectionObserver();\n if (rankSectionObserver) rankSectionObserver.resetSectionObserver();\n}\n","import { RefObject, useEffect } from 'react';\nimport { History } from 'history';\nimport { DefaultSource } from './Source';\n\nimport {\n registCompleteSectionObserver,\n registHalfSectionObserver,\n registMinSectionObserver,\n registRankSectionObserver,\n resetSectionObserverStatus,\n} from './Observer';\n\nexport function useCompleteSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registCompleteSectionObserver(ref, callback);\n });\n}\n\nexport function useHalfSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registHalfSectionObserver(ref, callback);\n });\n}\n\nexport function useMinSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registMinSectionObserver(ref, callback);\n });\n}\n\nexport function useRankSectionTracking(ref: RefObject, callback: Function) {\n useEffect(() => {\n if (ref.current === null) return;\n return registRankSectionObserver(ref, callback);\n });\n}\n\nexport function usePageTransitionListener(trackingSource: DefaultSource, history: History) {\n useEffect(() => {\n // Regist history (for page_view & screen_view)\n trackingSource.spyTransition(history);\n history.listen(() => {\n resetSectionObserverStatus();\n });\n }, [history]);\n}\n","import {\n EVENT_NAME_CLICK,\n EVENT_NAME_ENTER,\n EVENT_NAME_LEAVE,\n EVENT_NAME_SEARCH,\n EVENT_NAME_SECTION_VIEW,\n CATEGORY_DEFAULT,\n ACTION_BUTTON_CLICK,\n ACTION_TAB_CLICK,\n ACTION_PROFILE_CLICK,\n ACTION_LINK_CLICK,\n ACTION_ENTER,\n} from './utils/constants';\n\nimport { TrackingEvent } from './types';\n\ntype EventAction = Omit;\ntype SectionName = 'buttons' | 'duration' | 'gifts' | 'searchBar' | 'tabs' | 'description' | 'timeline' | 'topStreamer';\ntype ProfileName = 'topavatar' | 'avatar';\n\nexport function createButtonClickAction(buttonName: string, link: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: buttonName,\n page: link,\n },\n };\n}\n\nexport function createPageEnterAction(\n utmCampaign: string,\n utmContent: string,\n utmMedium: string,\n utmSource: string,\n): EventAction {\n return {\n eventName: EVENT_NAME_ENTER,\n category: CATEGORY_DEFAULT,\n trackingParams: {\n utmCampaign,\n utmContent,\n utmMedium,\n utmSource,\n },\n };\n}\n\nexport function createPageLeaveAction(): EventAction {\n return {\n eventName: EVENT_NAME_LEAVE,\n category: CATEGORY_DEFAULT,\n };\n}\n\nexport function createTabClickAction(link: string, tabName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_TAB_CLICK,\n page: link,\n name: tabName,\n },\n };\n}\n\nexport function createProfileClickAction(userID: string, liveStatus: boolean, profileType: ProfileName): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: liveStatus ? 'LiveStream' : 'Profile',\n trackingParams: {\n action: ACTION_PROFILE_CLICK,\n type: profileType,\n streamerId: userID,\n liveStatus: liveStatus,\n leaderboardId: '',\n hasDeeplink: false,\n },\n };\n}\n\nexport function createSearchAction(keyword: string, count: number): EventAction {\n return {\n eventName: EVENT_NAME_SEARCH,\n category: 'Content',\n trackingParams: {\n searchString: keyword,\n resultCount: count,\n },\n };\n}\n\nexport function createVoteAction(voteTopic: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'Interaction_vote',\n trackingParams: {\n action: ACTION_BUTTON_CLICK,\n name: voteTopic,\n type: 'vote',\n },\n };\n}\n\nexport function createLeaderboardSectionViewAction(rank: number): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section: 'leaderboardItem',\n rank,\n },\n };\n}\n\nexport function createLinkClickAction(link: string, linkName: string): EventAction {\n return {\n eventName: EVENT_NAME_CLICK,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_LINK_CLICK,\n url: link,\n name: linkName,\n },\n };\n}\n\nexport function createSectionViewAction(section: SectionName, customPath?: string): EventAction {\n return {\n eventName: EVENT_NAME_SECTION_VIEW,\n category: 'PageSurfing',\n trackingParams: {\n action: ACTION_ENTER,\n section,\n // For customized event to use.\n customPath,\n },\n };\n}\n","import { TrackingEvent } from './TrackingEvent';\nimport { createDefaultEventParams } from './utils/param';\n\nexport function createTrackingEvent(event: Omit) {\n return {\n ...event,\n payload: { ...createDefaultEventParams(), ...event.payload },\n type: 'tracking',\n $$type: 'TrackingEvent',\n } as TrackingEvent;\n}\n"],"names":["setPrototypeOf","assertThisInitialized","Op","Object","prototype","hasOwn","hasOwnProperty","undefined","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","makeInvokeMethod","tryCatch","fn","obj","arg","type","call","err","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","constructor","displayName","defineIteratorMethods","forEach","method","isGeneratorFunction","genFun","ctor","name","mark","__proto__","awrap","__await","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","value","then","unwrapped","error","previousPromise","enqueue","callInvokeWithMethodAndArg","async","Promise","iter","next","done","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","info","resultName","nextLoc","toString","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","keys","object","key","reverse","length","pop","iterable","iteratorMethod","isNaN","i","skipTempReset","prev","charAt","slice","stop","rootEntry","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","qs","v4","object.convertParamsToSankecase","isV2TrackingEvent","object.trim","params.createMatomoCustomDimensions","dom.getContent","dom.guessR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;AAHQ;AAHX,GAAP;AASD;AAEK,SAAU,uBAAV,CAAkC,OAAlC,EAAwD,UAAxD,EAA2E;AAC/E,SAAO;AACL,IAAA,SAAS,EAAE,uBADN;AAEL,IAAA,QAAQ,EAAE,aAFL;AAGL,IAAA,cAAc,EAAE;AACd,MAAA,MAAM,EAAE,YADM;AAEd,MAAA,OAAO,EAAP,OAFc;AAGd;AACA,MAAA,UAAU,EAAV;AAJc;AAHX,GAAP;AAUD;;;;;AC3IK,SAAU,mBAAV,CAA8B,KAA9B,EAA2E;AAC/E,6CACK,KADL;AAEE,IAAA,OAAO,sCAAO,wBAAwB,EAA/B,GAAsC,KAAK,CAAC,OAA5C,CAFT;AAGE,IAAA,IAAI,EAAE,UAHR;AAIE,IAAA,MAAM,EAAE;AAJV;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/tsconfig.tsbuildinfo b/dist/tsconfig.tsbuildinfo index 2e09180..d0e4160 100644 --- a/dist/tsconfig.tsbuildinfo +++ b/dist/tsconfig.tsbuildinfo @@ -162,8 +162,8 @@ "affectsGlobalScope": false }, "../src/trackingevent.ts": { - "version": 1, - "signature": "69949727099", + "version": 2, + "signature": "80457106564", "affectsGlobalScope": false }, "../src/types.ts": { @@ -193,7 +193,7 @@ }, "../src/agent.ts": { "version": 1, - "signature": "-31951521637", + "signature": "-57266381044", "affectsGlobalScope": false }, "../node_modules/@types/history/domutils.d.ts": { diff --git a/package.json b/package.json index 9dc55a5..1dfa830 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "17media-browser-spy", - "version": "1.0.12", + "version": "1.0.15", "main": "dist/index.js", "module": "dist/index.esm.js", "license": "MIT", diff --git a/src/Agent.ts b/src/Agent.ts index c973be2..58a583c 100644 --- a/src/Agent.ts +++ b/src/Agent.ts @@ -2,7 +2,7 @@ import { loadScript, loadScripts } from 'utils/loadScript'; import * as object from 'utils/object'; -import { TrackingEvent, TransitionEvent, LoginEvent, SpyEvent } from 'types'; +import { TrackingEvent, TransitionEvent, LoginEvent, SpyEvent, Scene } from 'types'; import type { analytics } from 'firebase'; import { isTrackingEvent as isV2TrackingEvent, TrackingEvent as V2TrackingEvent } from './TrackingEvent'; import * as params from './utils/param'; @@ -136,6 +136,8 @@ export class MatomoAgent extends Agent { private trackPageViewTimer = 0; + private currentScene: Scene | null = null; + constructor(readonly config: MatomoAgentConfig) { super(); } @@ -178,11 +180,15 @@ export class MatomoAgent extends Agent { this.requestTrackPageView(); this.client.push(['enableLinkTracking']); this.client.push(['trackAllContentImpressions']); + this.currentScene = toScene; } private track(event: TrackingEvent | V2TrackingEvent) { if (isV2TrackingEvent(event)) { const { category, action, name } = event; + if (this.currentScene) { + event.payload.sourceUrl = this.currentScene.pathname; + } const dimensions = params.createMatomoCustomDimensions(event); this.client.push(['trackEvent', category, action, name, '', dimensions]); return; diff --git a/src/TrackingEvent.ts b/src/TrackingEvent.ts index 9e4b102..dc36b4c 100644 --- a/src/TrackingEvent.ts +++ b/src/TrackingEvent.ts @@ -17,6 +17,10 @@ export interface BasePayload { timestamp?: string; codename?: string; guestSessionId?: string; + sourceUrl?: string; + componentId?: string; + componentType?: string; + traceId?: string; } interface ClickButtonEventPayload extends BasePayload {