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AAA,MAAM,0CAA0C,OAAAa,EAAI,IAAG,EAEhEC,EAAQ,SAAWA,EAAQ,IAAID,CAAI,EAIjC,cAAOD,GAAkB,WACpBA,EAAc,EAGrB,OAISZ,EAAA,MAAM,4BAA4B,OAAAa,EAAI,IAAG,EACtD,MAAME,EAASJ,EAAW,EAE1B,OAAIG,EAAQ,UACGd,EAAA,MAAM,kCAAkC,OAAAa,EAAI,IAAG,EACpDC,EAAA,IAAID,EAAM,GAAM,CACtB,QAASH,CAAA,CACV,GAEIK,CACT,EAEeC,EAAA,CACb,QAAAR,CACF","names":["init","steps","$body","$","prevLabel","I18n","skipLabel","understandLabel","Promise","__vitePreload","introJs","intro_obj","Introjs","LOGGING_PREFIX","CACHE_KEY_PREFIX","local_logger","log","wrap_message","message","wrap_message_func","func","_flow","old_method","execute","cacheKey","timeoutInSec","FuncToExec","FuncOnNotExec","_key","Cookies","result","ActionWithTimeout"],"ignoreList":[],"sources":["../../../app/assets/javascripts/plugins/introjs/index.ts","../../../app/assets/javascripts/app/action_with_timeout.ts"],"sourcesContent":["\nimport $ from \"jquery\"\nimport Promise from \"plugins/bluebird\"\n\n/* eslint-disable no-unused-vars */\nimport * as IntroJs from \"intro.js\"\n/* eslint-enable no-unused-vars */\n\n\nimport I18n from \"plugins/i18n-js\"\n\n\nconst init = (steps: IntroJs.Step[]): Promise => {\n if ( Object.prototype.toString.call(steps) !== \"[object Array]\" ){\n throw new Error(\"steps is not array\")\n }\n\n if (steps.length === 0){\n throw new Error(\"steps is empty\")\n }\n\n const $body = $(\"body\")\n const prevLabel = I18n.t(\"actions.defaults.go_to_previous_step\")\n const skipLabel = I18n.t(\"actions.defaults.skip\")\n const understandLabel = I18n.t(\"actions.defaults.understand\")\n\n // Scroll to top to avoid user unable to dismiss tutorial\n $body.scrollTop(0)\n\n // disable scrolling until tutorial is completed\n $body.css(\"overflow-y\", \"hidden\")\n\n return Promise.resolve(\n import(\n \"intro.js\"\n )\n .then(({default: introJs}) => {\n\n const intro_obj = introJs()\n intro_obj\n .oncomplete(() => {\n // enable scrolling after tutorial is completed (pressing skip does not count)\n $body.css(\"overflow-y\", \"auto\")\n })\n .onexit(() => {\n // enable scrolling after tutorial is exited (like pressing skip)\n $body.css(\"overflow-y\", \"auto\")\n })\n\n // Doc for options\n // http://introjs.com/docs/\n intro_obj.setOptions({\n showStepNumbers: false,\n nextLabel: understandLabel,\n prevLabel: prevLabel,\n skipLabel: skipLabel,\n doneLabel: understandLabel,\n exitOnOverlayClick: true,\n disableInteraction: true,\n\n steps: steps,\n\n // When there is only one step\n // Clicking on bullet will cause a error (due to plugin bug)\n // So we don't show it when there is only 1 step\n //\n // Assumed steps non-empty\n //\n // Related issues on the plugin:\n // - https://github.com/usablica/intro.js/issues/136\n // - https://github.com/usablica/intro.js/pull/489\n showBullets: false,\n })\n\n return intro_obj\n }),\n )\n}\n\n\nexport default {\n init,\n}\n","\nimport Cookies from \"plugins/cookies-js\"\nimport log from \"plugins/loglevel/index\"\nimport _flow from \"lodash/flow\"\n\nconst LOGGING_PREFIX = \"App.ActionWithTimeout\"\n// The dot is just for easier reading\n// Better not change it\nconst CACHE_KEY_PREFIX = \"App.ActionWithTimeout\"\n\nconst local_logger = log.getLogger(LOGGING_PREFIX)\n\nconst wrap_message = (message: any) => `${LOGGING_PREFIX} ${message}`\nconst wrap_message_func = (func: ((...args: any[]) => any)) => _flow(wrap_message, func)\nconst old_method = local_logger.methodFactory\n\nlocal_logger.methodFactory = _flow(old_method, wrap_message_func)\n// Required to regenerate all methods\nlocal_logger.setLevel(local_logger.getLevel())\n\n\n/*\n * Before running FuncToExec, check cacheKey and timeoutInMs\n * using https://github.com/ScottHamper/Cookies\n * If not set then exec and set cache key\n *\n * @param [string] cacheKey the cache key, will prepend with prefix\n * @param [Number] timeoutInSec timeout in second, taht's what lib Cookies use\n * @param [Func] The function to execute\n * @param [FuncOnNotExec] Called whenever it's decided not to execute Func\n */\nconst execute = (cacheKey: string, timeoutInSec: number, FuncToExec: (() => any), FuncOnNotExec?: (() => any)) => {\n const _key = `${CACHE_KEY_PREFIX}.${cacheKey}`\n local_logger.debug(`Trying to check cookies for cache key <${_key}>`)\n\n if (Cookies.enabled && Cookies.get(_key)){\n // Unless we need compatibility for old Chrome users\n // Just use `typeof` for checking an object is a `function` or not\n // https://stackoverflow.com/questions/17108122/isfunctiona-vs-typeof-a-function-javascript\n if (typeof FuncOnNotExec === \"function\"){\n return FuncOnNotExec()\n }\n else{\n return\n }\n }\n\n local_logger.debug(`Executing for cache key <${_key}>`)\n const result = FuncToExec()\n\n if (Cookies.enabled){\n local_logger.debug(`Saving cookies with cache key <${_key}>`)\n Cookies.set(_key, true, {\n expires: timeoutInSec,\n })\n }\n return result\n}\n\nexport default {\n execute,\n}\n"],"file":"assets/action_with_timeout-D-NlQ9ft.js"}