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AAiBxM,QAIrB+C,EAAU,CACRQ,OAAQ,yDACRC,GAAI,qBACJC,SAAU,QAEd,CmByCE6J,GACF,CC7DAC,E","sources":["webpack://distribution-core/./node_modules/@tinkoff/eventea-queue/lib/index.js","webpack://distribution-core/./node_modules/@tj-dev/shared-core/dist/index-npm.js","webpack://distribution-core/webpack/bootstrap","webpack://distribution-core/./src/util/add-script.ts","webpack://distribution-core/./src/util/get-operation-data.ts","webpack://distribution-core/./src/util/window.ts","webpack://distribution-core/./src/operations.ts","webpack://distribution-core/./src/constants.ts","webpack://distribution-core/./src/actions/send-saved-views.ts","webpack://distribution-core/./src/util/shared-core-v3.ts","webpack://distribution-core/./src/util/get-customer-from-profile.ts","webpack://distribution-core/./src/core/init-popmechanic.ts","webpack://distribution-core/./src/util/get-course-slug.ts","webpack://distribution-core/./src/util/get-lesson-slug.ts","webpack://distribution-core/./src/actions/save-lesson-view.ts","webpack://distribution-core/./src/actions/send-lesson-view.ts","webpack://distribution-core/./src/core/handle-page-view.ts","webpack://distribution-core/./src/actions/send-course-page-view.ts","webpack://distribution-core/./src/actions/save-course-page-view.ts","webpack://distribution-core/./src/actions/send-pro-main-page-view.ts","webpack://distribution-core/./src/actions/save-pro-main-page-view.ts","webpack://distribution-core/./src/actions/send-pro-collection-page-view.ts","webpack://distribution-core/./src/actions/send-article-view.ts","webpack://distribution-core/./src/actions/save-article-view.ts","webpack://distribution-core/./src/util/subscribe-article-viewed.ts","webpack://distribution-core/./src/actions/send-add-article-to-list.ts","webpack://distribution-core/./src/actions/save-add-article-to-list.ts","webpack://distribution-core/./src/analytics/index.ts","webpack://distribution-core/./src/actions/send-banner-clicked-event.ts","webpack://distribution-core/./src/actions/send-banner-shown-event.ts","webpack://distribution-core/./src/init.ts","webpack://distribution-core/./src/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EventeaQueueObserver = exports.EventeaQueue = void 0;\nconst windowObj = typeof window !== 'undefined' ? window : undefined;\nclass EventeaQueue {\n __addEventToStore(...queueItems) {\n if (windowObj === null || windowObj === void 0 ? void 0 : windowObj._evnteq) {\n windowObj._evnteq.push(...queueItems);\n }\n }\n get getQueue() {\n var _a;\n if (Array.isArray(windowObj === null || windowObj === void 0 ? void 0 : windowObj._evnteq)) {\n return windowObj === null || windowObj === void 0 ? void 0 : windowObj._evnteq;\n }\n return (_a = windowObj === null || windowObj === void 0 ? void 0 : windowObj._evnteq) === null || _a === void 0 ? void 0 : _a.queue;\n }\n constructor(options) {\n var _a, _b;\n this.errorHandlers = options === null || options === void 0 ? void 0 : options.errorHandlers;\n if (windowObj) {\n !windowObj._evnteq && (windowObj._evnteq = []);\n }\n else {\n (_b = (_a = this.errorHandlers) === null || _a === void 0 ? void 0 : _a.handleQueueUsageAtServer) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n }\n send(eventObject) {\n this.__addEventToStore(['send', eventObject]);\n }\n sendOnce(eventObject) {\n this.__addEventToStore(['sendOnce', eventObject]);\n return true;\n }\n data(dataObject) {\n this.__addEventToStore(['data', dataObject]);\n }\n}\nexports.EventeaQueue = EventeaQueue;\nclass EventeaQueueObserver {\n set watch(fnCallback) {\n var _a, _b;\n if (!this.observerSuspended) {\n this.watcher = fnCallback;\n this.push(...this.queue);\n this.queue = [];\n }\n else {\n (_b = (_a = this.errorHandlers) === null || _a === void 0 ? void 0 : _a.handleQueueUsageAtServer) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n }\n push(...eventQueueItems) {\n var _a, _b;\n if (this.watcher) {\n try {\n this.watcher(eventQueueItems);\n }\n catch (e) {\n const { message } = e;\n (_b = (_a = this.errorHandlers) === null || _a === void 0 ? void 0 : _a.handleObserverWatcherErrors) === null || _b === void 0 ? void 0 : _b.call(_a, message);\n }\n }\n else {\n this.queue.push(...eventQueueItems);\n }\n }\n constructor(options) {\n var _a, _b;\n this.observerSuspended = false;\n this.queue = [];\n this.errorHandlers = options === null || options === void 0 ? void 0 : options.errorHandlers;\n if (windowObj) {\n if (Array.isArray(windowObj._evnteq)) {\n this.queue.push(...windowObj._evnteq);\n }\n windowObj._evnteq = this;\n }\n else {\n this.observerSuspended = true;\n (_b = (_a = this.errorHandlers) === null || _a === void 0 ? void 0 : _a.handleQueueUsageAtServer) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n }\n}\nexports.EventeaQueueObserver = EventeaQueueObserver;\n","(()=>{\"use strict\";var e={595:(e,r)=>{function o(e=t()){var r;return Boolean(null===(r=null==e?void 0:e.tjlib)||void 0===r?void 0:r.core)}function t(){return\"undefined\"!=typeof window?window:null}Object.defineProperty(r,\"__esModule\",{value:!0}),r.isCoreInitialized=o,r.setCore=function(e,r=t()){if(!r)throw new Error(\"unable to initialize shared core without holder\");if(o(r))throw new Error(\"tjlib.core is already initialized\");r.tjlib=r.tjlib||{},r.tjlib.core=e},r.getCore=function(e=t()){var r;return null===(r=null==e?void 0:e.tjlib)||void 0===r?void 0:r.core}}},r={};function o(t){var i=r[t];if(void 0!==i)return i.exports;var n=r[t]={exports:{}};return e[t](n,n.exports,o),n.exports}var t={};(()=>{var e=t;Object.defineProperty(e,\"__esModule\",{value:!0}),e.getCore=void 0;var r=o(595);Object.defineProperty(e,\"getCore\",{enumerable:!0,get:function(){return r.getCore}})})(),module.exports=t})();","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","type Options = {\n source: string;\n id?: string;\n position?: 'body' | 'head';\n};\n\nexport function addScript(options: Options) {\n function perform() {\n if ('requestIdleCallback' in window) {\n requestIdleCallback(() => loadScript(options));\n } else {\n setTimeout(() => loadScript(options), 1);\n }\n }\n\n if (document.readyState === 'complete') {\n perform();\n } else {\n window.addEventListener('load', perform);\n }\n}\n\nfunction loadScript({ source, id, position = 'head' }: Options) {\n const script = document.createElement('script');\n\n script.src = source;\n if (id) {\n script.id = id;\n }\n\n document[position].appendChild(script);\n}\n","import type {\n MindboxCustomer,\n MindboxOperation,\n MindboxProductKey,\n MindboxRequestData,\n} from '../types';\n\nexport function getOperationData(\n operation: MindboxOperation,\n customer?: MindboxCustomer,\n page?: string\n): MindboxRequestData {\n // В качестве id статей, курсов и страниц в mindbox используются slug-и\n const webSite = page || getSlug(operation, window.location.pathname);\n\n const productKey: MindboxProductKey =\n operation === 'AddArticleToList' ? 'addProductToList' : 'viewProduct';\n\n const operationData: MindboxRequestData = {\n operation,\n data: {\n [productKey]: {\n product: {\n ids: {\n webSite,\n },\n },\n },\n },\n };\n\n if (customer) {\n operationData.data.customer = customer;\n }\n\n return operationData;\n}\n\nfunction getSlug(operation: MindboxOperation, pathname: string) {\n // для страниц сборников Учебника нужно отправлять slug сборника\n // пример: /pro/collection/time/ отправляем time\n if (operation === 'ViewCollectionPage') {\n return pathname.split('/')[3] || pathname;\n }\n return pathname;\n}\n","import type {\n DistributionCore,\n DistributionCoreHolder,\n Mindbox,\n} from '../types';\n\nexport function getDistributionCore(wnd: DistributionCoreHolder = getHolder()) {\n return wnd.tjlib?.distribution;\n}\n\nexport function setDistributionCore(core: DistributionCore) {\n const wnd = getHolder();\n wnd.tjlib = wnd.tjlib || {};\n wnd.tjlib.distribution = core;\n}\n\nfunction getHolder() {\n return window as DistributionCoreHolder;\n}\n\nexport function getMindbox() {\n return getHolder().mindbox as Mindbox;\n}\n\nexport function isMindboxInitialized() {\n return !!getHolder().mindbox;\n}\n\nexport function initMindbox() {\n if (isMindboxInitialized()) {\n return;\n }\n\n const mindbox: Mindbox = (...args: unknown[]) => {\n mindbox.queue.push(args);\n };\n mindbox.queue = [];\n\n const { DISTRIBUTION_FIREBASE_SENDER_ID: firebaseSenderId, ENV_NAME: env } =\n getConstants() ?? {};\n\n if (firebaseSenderId) {\n // Документацию по веб-пушам https://developers.mindbox.ru/page/webpush\n mindbox('create', {\n // Свойство endpointId является простым идентификатором в майндбоксе\n endpointId:\n env === 'production' ? 'journal.tinkoff.ru' : 'stage.tjournal.tech',\n firebaseMessagingSenderId: firebaseSenderId,\n serviceWorkerPath: '/mindbox-service-worker.js',\n });\n\n mindbox('webpush.create');\n } else {\n // Не инициализируем веб-пуши, если в константах отсутствует DISTRIBUTION_FIREBASE_SENDER_ID\n console.error('DISTRIBUTION_FIREBASE_SENDER_ID is not defined');\n mindbox('create');\n }\n\n (window as DistributionCoreHolder).mindbox = mindbox;\n}\n\nexport function getArticleMeta() {\n return getHolder().TJ_ARTICLE_META;\n}\n\nexport function getUraniaMeta() {\n return getHolder().TJ_URANIA_META;\n}\n\nexport function getConstants() {\n return getHolder().CONSTANTS;\n}\n","import type { MindboxCustomer } from './types';\nimport { getOperationData } from './util/get-operation-data';\nimport { getMindbox } from './util/window';\n\n// Просмотр статьи\n// https://tj.mindbox.ru/campaigns/operations/54/help\nexport function sendMindboxArticleView(\n customer?: MindboxCustomer,\n article?: string\n) {\n const mindbox = getMindbox();\n if (!mindbox) {\n return;\n }\n\n const data = getOperationData('ViewArticle', customer, article);\n mindbox('async', data);\n}\n\n// Добавление статьи в список прочитанного\n// https://tj.mindbox.ru/campaigns/operations/109/help\nexport function sendMindboxAddArticleToList(\n customer?: MindboxCustomer,\n article?: string\n) {\n const mindbox = getMindbox();\n if (!mindbox) {\n return;\n }\n\n const data = getOperationData('AddArticleToList', customer, article);\n mindbox('async', data);\n}\n\n// Просмотр урока\n// https://tj.mindbox.ru/campaigns/operations/715/help\nexport function sendMindboxLessonView(\n customer?: MindboxCustomer,\n lesson?: string\n) {\n const mindbox = getMindbox();\n if (!mindbox) {\n return;\n }\n\n const data = getOperationData('ViewLessonPage', customer, lesson);\n mindbox('async', data);\n}\n\n// Просмотр главной страницы учебника\n// https://tj.mindbox.ru/campaigns/operations/713/help\nexport function sendMindboxProMainPageView(customer?: MindboxCustomer) {\n const mindbox = getMindbox();\n if (!mindbox) {\n return;\n }\n\n const data = getOperationData('ViewGeneralCoursePage', customer);\n mindbox('async', data);\n}\n\n// Просмотр страницы курса\n// https://tj.mindbox.ru/campaigns/operations/714/help\nexport function sendMindboxCourseView(\n customer?: MindboxCustomer,\n course?: string\n) {\n const mindbox = getMindbox();\n if (!mindbox) {\n return;\n }\n\n const data = getOperationData('ViewCoursePage', customer, course);\n mindbox('async', data);\n}\n\n// Просмотр страницы сборника курсов\n// https://tj.mindbox.ru/campaigns/operations/26134/help\nexport function sendMindboxCollectionView(customer?: MindboxCustomer) {\n const mindbox = getMindbox();\n if (!mindbox) {\n return;\n }\n\n const data = getOperationData('ViewCollectionPage', customer);\n mindbox('async', data);\n}\n","export const VISITED_ARTICLES = 'visitedArticles';\nexport const VIEWED_ARTICLES = 'viewedArticles';\nexport const VISITED_LESSONS = 'visitedLessons';\nexport const VISITED_COURSES = 'visitedCourses';\nexport const PRO_MAIN_PAGE_VISITS = 'proMainPageVisits';\n\nexport const AUTH_POPUP_URL_PARAM = 'show-login-popup';\n","import {\n sendMindboxAddArticleToList,\n sendMindboxArticleView,\n sendMindboxCourseView,\n sendMindboxProMainPageView,\n sendMindboxLessonView,\n} from '../operations';\nimport {\n PRO_MAIN_PAGE_VISITS,\n VISITED_ARTICLES,\n VIEWED_ARTICLES,\n VISITED_COURSES,\n VISITED_LESSONS,\n} from '../constants';\nimport type { MindboxCustomer } from '../types';\n\nexport function sendSavedViews(customer: MindboxCustomer) {\n sendArticleViews(customer);\n sendArticleAddToList(customer);\n sendProMainPageViews(customer);\n sendCoursePageViews(customer);\n sendLessonPageViews(customer);\n}\n\nfunction sendArticleViews(customer: MindboxCustomer) {\n const visitedArticles = localStorage.getItem(VISITED_ARTICLES);\n\n if (!visitedArticles) {\n return;\n }\n\n /* Парсим статьи из строки, создаем сет, чтобы оставить только уникальные */\n const uniqueArticlesSet = new Set(visitedArticles.split(','));\n uniqueArticlesSet.forEach((article) => {\n sendMindboxArticleView(customer, article);\n });\n\n localStorage.removeItem(VISITED_ARTICLES);\n}\n\nfunction sendArticleAddToList(customer: MindboxCustomer) {\n const viewedArticles = localStorage.getItem(VIEWED_ARTICLES);\n\n if (!viewedArticles) {\n return;\n }\n\n /* Парсим статьи из строки, создаем сет, чтобы оставить только уникальные */\n const uniqueArticlesSet = new Set(viewedArticles.split(','));\n uniqueArticlesSet.forEach((article) => {\n sendMindboxAddArticleToList(customer, article);\n });\n\n localStorage.removeItem(VIEWED_ARTICLES);\n}\n\nfunction sendProMainPageViews(customer: MindboxCustomer) {\n const pageVisits = localStorage.getItem(PRO_MAIN_PAGE_VISITS);\n\n if (!pageVisits) {\n return;\n }\n\n for (let i = 0; i < parseInt(pageVisits, 10); i++) {\n sendMindboxProMainPageView(customer);\n }\n\n localStorage.removeItem(PRO_MAIN_PAGE_VISITS);\n}\n\nfunction sendCoursePageViews(customer: MindboxCustomer) {\n const coursesViews = localStorage.getItem(VISITED_COURSES);\n\n if (!coursesViews) {\n return;\n }\n\n const coursesList = coursesViews.split(',');\n for (const course of coursesList) {\n sendMindboxCourseView(customer, course);\n }\n\n localStorage.removeItem(VISITED_COURSES);\n}\n\nfunction sendLessonPageViews(customer: MindboxCustomer) {\n const lessonsViews = localStorage.getItem(VISITED_LESSONS);\n\n if (!lessonsViews) {\n return;\n }\n\n const lessonsList = lessonsViews.split(',');\n for (const lesson of lessonsList) {\n sendMindboxLessonView(customer, lesson);\n }\n\n localStorage.removeItem(VISITED_LESSONS);\n}\n","import { getCore } from '@tj-dev/shared-core';\nimport type {\n Profile,\n RecentSocialId,\n RequestLoginParams,\n} from '@tj-dev/shared-core/dist/types';\n\nexport function getProfile(): Profile {\n return getCore()?.profile.get();\n}\n\nexport function subscribeToProfileChange(cb: (profile: Profile) => void) {\n return getCore()?.profile.subscribe(cb);\n}\n\nexport function requestLogin(args: RequestLoginParams) {\n return getCore()?.actions.requestLogin(args);\n}\n\nexport function getRecentSocialId(): RecentSocialId {\n return getCore()?.recentSocialId.get();\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport type { MindboxCustomer } from '../types';\n\nexport function getCustomerFromProfile(\n profile: Profile\n): MindboxCustomer | undefined {\n if (!profile) {\n return;\n }\n\n const customer: MindboxCustomer = {\n ids: {\n socialId: profile.id,\n },\n };\n if (profile.email) {\n customer.email = profile.email;\n }\n\n return customer;\n}\n","import type { ArticleMeta, DistributionCoreHolder } from '../types';\nimport { addScript } from '../util/add-script';\nimport { getArticleMeta } from '../util/window';\n\nexport function initPopmechanic() {\n const meta = getArticleMeta();\n\n if (meta) {\n setPopmechanicData(meta);\n }\n\n // Выходим если попмеханики уже загружены чем-то другим\n if ('PopMechanic' in window) {\n return;\n }\n\n addScript({\n source: 'https://static.popmechanic.ru/service/loader.js?c=5263',\n id: 'popmechanic-script',\n position: 'body',\n });\n}\n\nfunction setPopmechanicData(meta: ArticleMeta) {\n const flowsString = meta.articleFlows.join(',');\n const tagsString = meta.articleTags.join(',');\n\n (window as DistributionCoreHolder).PopMechanicPageData = {\n type: 'product',\n product: {\n id: window.location.pathname,\n name: window.document.title,\n pictureUrl: getArticleImage(),\n category: tagsString,\n categoryId: flowsString,\n },\n };\n}\n\nfunction getArticleImage() {\n const ogEl = document.querySelector(\n 'meta[property=\"og:image:secure_url\"]'\n ) as HTMLMetaElement;\n return ogEl ? ogEl.content : '';\n}\n","export function getCourseSlug(pathname: string): string {\n const pathParts = pathname.split('/');\n\n // В mindbox записаны слаги курсов без слэшек по краям\n return pathParts[2];\n}\n","export function getLessonSlug(pathname: string) {\n const pathParts = pathname.split('/');\n // Уроки могут быть как на домене журнала (journal.tinkoff.ru/intro-fingram/),\n // так и вложенными в учебник (journal.tinkoff.ru/pro/fingram/intro-fingram/)\n const lessonSlug = pathParts[1] === 'pro' ? pathParts[3] : pathParts[1];\n\n return lessonSlug;\n}\n","import { VISITED_LESSONS } from '../constants';\nimport { getLessonSlug } from '../util/get-lesson-slug';\n\nexport function saveLessonView() {\n const lesson = getLessonSlug(window.location.pathname);\n const currentViews = localStorage.getItem(VISITED_LESSONS);\n\n localStorage.setItem(\n VISITED_LESSONS,\n currentViews ? `${currentViews},${lesson}` : lesson\n );\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport { sendMindboxLessonView } from '../operations';\nimport { getCustomerFromProfile } from '../util/get-customer-from-profile';\nimport { getLessonSlug } from '../util/get-lesson-slug';\n\nexport function sendLessonView(profile?: Profile) {\n const customer = getCustomerFromProfile(profile);\n const lessonSlug = getLessonSlug(window.location.pathname);\n sendMindboxLessonView(customer, lessonSlug);\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport { saveArticleView } from '../actions/save-article-view';\nimport { saveCoursePageView } from '../actions/save-course-page-view';\nimport { saveLessonView } from '../actions/save-lesson-view';\nimport { saveProMainPageView } from '../actions/save-pro-main-page-view';\nimport { sendArticleView } from '../actions/send-article-view';\nimport { sendCoursePageView } from '../actions/send-course-page-view';\nimport { sendLessonView } from '../actions/send-lesson-view';\nimport { sendProMainPageView } from '../actions/send-pro-main-page-view';\nimport { sendAddArticleToList } from '../actions/send-add-article-to-list';\nimport { sendProCollectionPageView } from '../actions/send-pro-collection-page-view';\nimport { saveAddArticleToList } from '../actions/save-add-article-to-list';\nimport { getArticleMeta, getUraniaMeta } from '../util/window';\nimport { subscribeArticleViewed } from '../util/subscribe-article-viewed';\nimport type { UraniaPageType } from '../types';\n\ntype Helpers = {\n send: (profile?: Profile) => void;\n save: () => void;\n};\nconst URANIA_VIEW_MAP: Record = {\n lesson: {\n send: sendLessonView,\n save: saveLessonView,\n },\n quiz: {\n send: sendLessonView,\n save: saveLessonView,\n },\n course: {\n send: sendCoursePageView,\n save: saveCoursePageView,\n },\n main: {\n send: sendProMainPageView,\n save: saveProMainPageView,\n },\n collection: {\n send: sendProCollectionPageView,\n save: () => {\n // Mindbox сам записывает часть анонимных просмотров,\n // поэтому пока договорились не добавлять отдельную логику для них.\n },\n },\n};\n\nexport function handlePageView(profile?: Profile) {\n const articleMeta = getArticleMeta();\n if (articleMeta) {\n sendArticleView(profile);\n\n if (!profile) {\n saveArticleView();\n }\n\n // Подписываемся на просмотр статьи пользователем, и в этот момент вызываем action sendArticleViewed\n subscribeArticleViewed(() => {\n sendAddArticleToList(profile);\n if (!profile) {\n saveAddArticleToList();\n }\n });\n\n return;\n }\n\n const uraniaMeta = getUraniaMeta();\n if (uraniaMeta) {\n URANIA_VIEW_MAP[uraniaMeta.pageType]?.send(profile);\n\n if (!profile) {\n URANIA_VIEW_MAP[uraniaMeta.pageType]?.save();\n }\n }\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport { sendMindboxCourseView } from '../operations';\nimport { getCourseSlug } from '../util/get-course-slug';\nimport { getCustomerFromProfile } from '../util/get-customer-from-profile';\n\nexport function sendCoursePageView(profile?: Profile) {\n const customer = getCustomerFromProfile(profile);\n const course = getCourseSlug(window.location.pathname);\n sendMindboxCourseView(customer, course);\n}\n","import { VISITED_COURSES } from '../constants';\nimport { getCourseSlug } from '../util/get-course-slug';\n\nexport function saveCoursePageView() {\n const course = getCourseSlug(window.location.pathname);\n const currentViews = localStorage.getItem(VISITED_COURSES);\n\n localStorage.setItem(\n VISITED_COURSES,\n currentViews ? `${currentViews},${course}` : course\n );\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport { sendMindboxProMainPageView } from '../operations';\nimport { getCustomerFromProfile } from '../util/get-customer-from-profile';\n\nexport function sendProMainPageView(profile?: Profile) {\n const customer = getCustomerFromProfile(profile);\n if (customer && 'email' in customer) {\n delete customer.email;\n }\n sendMindboxProMainPageView(customer);\n}\n","import { PRO_MAIN_PAGE_VISITS } from '../constants';\n\nexport function saveProMainPageView() {\n const currentVisits = parseInt(\n localStorage.getItem(PRO_MAIN_PAGE_VISITS) || '0',\n 10\n );\n localStorage.setItem(PRO_MAIN_PAGE_VISITS, `${currentVisits + 1}`);\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport { getCustomerFromProfile } from '../util/get-customer-from-profile';\nimport { sendMindboxCollectionView } from '../operations';\n\nexport function sendProCollectionPageView(profile?: Profile) {\n const customer = getCustomerFromProfile(profile);\n if (customer && 'email' in customer) {\n delete customer.email;\n }\n sendMindboxCollectionView(customer);\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport { getCustomerFromProfile } from '../util/get-customer-from-profile';\nimport { sendMindboxArticleView } from '../operations';\nimport { getArticleMeta } from '../util/window';\n\nexport function sendArticleView(profile?: Profile) {\n if (!getArticleMeta()) {\n return;\n }\n\n const customer = getCustomerFromProfile(profile);\n sendMindboxArticleView(customer);\n}\n","import { VISITED_ARTICLES } from '../constants';\nimport { getArticleMeta } from '../util/window';\n\nexport function saveArticleView() {\n if (!getArticleMeta()) {\n return;\n }\n\n const currentList = localStorage.getItem(VISITED_ARTICLES);\n\n const newArticle = window.location.pathname;\n localStorage.setItem(\n VISITED_ARTICLES,\n currentList ? `${currentList},${newArticle}` : newArticle\n );\n}\n","import { getArticleMeta } from './window';\n\n/* Договорились, что будем трекать полный просмотр статьи, если юзер доскроллил до комментов, а в случае отсутствия, до рекомендосов */\nexport function subscribeArticleViewed(cb: VoidFunction) {\n if (!getArticleMeta()) {\n return;\n }\n\n const commentsContainer = document.getElementById('comments');\n const recommendationsContainer = document.getElementById('showcase');\n const targetContainer = commentsContainer ?? recommendationsContainer;\n\n if (!targetContainer) {\n cb();\n return;\n }\n\n const intersectionObserver = new IntersectionObserver(\n (entries, observerInstance) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n cb();\n observerInstance.disconnect();\n }\n }\n }\n );\n\n intersectionObserver.observe(targetContainer);\n}\n","import type { Profile } from '@tj-dev/shared-core/dist/types';\nimport { getArticleMeta } from '../util/window';\nimport { getCustomerFromProfile } from '../util/get-customer-from-profile';\nimport { sendMindboxAddArticleToList } from '../operations';\n\nexport function sendAddArticleToList(profile?: Profile) {\n if (!getArticleMeta()) {\n return;\n }\n\n const customer = getCustomerFromProfile(profile);\n sendMindboxAddArticleToList(customer);\n}\n","import { VIEWED_ARTICLES } from '../constants';\nimport { getArticleMeta } from '../util/window';\n\nexport function saveAddArticleToList() {\n if (!getArticleMeta()) {\n return;\n }\n\n const currentList = localStorage.getItem(VIEWED_ARTICLES);\n\n const newArticle = window.location.pathname;\n localStorage.setItem(\n VIEWED_ARTICLES,\n currentList ? `${currentList},${newArticle}` : newArticle\n );\n}\n","// Документация по событиям\n// https://wiki.tcsbank.ru/pages/viewpage.action?pageId=2626757920\n\n// Актуальная информация об использовании банковской аналитики\n// содержится в README.md репозитория hedge https://gitlab.tcsbank.ru/tj/hedge\n\nimport { EventeaQueue } from '@tinkoff/eventea-queue';\nimport type { SelectSpec } from '@tinkoff/eventea-types';\n\n// Класс-хелпер, который собирает события и отправляет их\n// как только eventea становится доступен в window\nconst eventeaQueue = new EventeaQueue();\n\ntype BannerClickedEventPayload = SelectSpec<\n 'tjournal',\n 'bannerClicked'\n>['payload'];\n\ntype BannerClickedEventPayloadTj = SelectSpec<\n 'tj',\n 'events.bannerClicked'\n>['payload'];\n\ntype BannerShownEventPayload = SelectSpec<'tjournal', 'bannerShown'>['payload'];\n\ntype BannerShownEventPayloadTj = SelectSpec<\n 'tj',\n 'events.bannerShown'\n>['payload'];\n\n// На поля defaultParam в типах не обращаем внимания,\n// это некий воркэраунд для удобства аналитиков\n// Нас же интересует только обязательное тело + специфичные для события параметры\n// Лучше всего сверяться с вики-докой по событиям\n// https://wiki.tcsbank.ru/pages/viewpage.action?pageId=2614246964\n\n// eventea ожидает, что все отправляемые параметры будут string\n// поэтому во избежание ругани с TS и потенциальными undefined полями\n// делаем payload аргумент send функций Partial\n\nexport function sendBannerClickedEvent(\n payload: Partial\n) {\n eventeaQueue.send({\n project: 'tjournal',\n event: 'bannerClicked',\n payload: payload as BannerClickedEventPayload,\n });\n eventeaQueue.send({\n project: 'tj',\n event: 'events.bannerClicked',\n payload: payload as BannerClickedEventPayloadTj,\n });\n}\n\nexport function sendBannerShownEvent(\n payload: Partial\n) {\n eventeaQueue.send({\n project: 'tjournal',\n event: 'bannerShown',\n payload: payload as BannerShownEventPayload,\n });\n eventeaQueue.send({\n project: 'tj',\n event: 'events.bannerShown',\n payload: payload as BannerShownEventPayloadTj,\n });\n}\n","import type { BannerEventParams } from '../types';\nimport { sendBannerClickedEvent as sendBannerClickedAnalyticsEvent } from '../analytics';\nimport { getArticleMeta } from '../util/window';\nimport { getRecentSocialId } from '../util/shared-core-v3';\n\nexport function sendBannerClickedEvent(params: BannerEventParams) {\n if (!params.id || !params.href) {\n return;\n }\n\n const articleMeta = getArticleMeta();\n const recentSocialId = getRecentSocialId();\n\n sendBannerClickedAnalyticsEvent({\n entityType: 'mindbox.popup',\n socialId: String(recentSocialId ?? ''),\n ...params,\n ...articleMeta,\n });\n}\n","import type { BannerEventParams } from '../types';\nimport { sendBannerShownEvent as sendBannerShownAnalyticsEvent } from '../analytics';\nimport { getArticleMeta } from '../util/window';\nimport { getRecentSocialId } from '../util/shared-core-v3';\n\nexport function sendBannerShownEvent(params: BannerEventParams) {\n if (!params.id || !params.href) {\n return;\n }\n\n const articleMeta = getArticleMeta();\n const recentSocialId = getRecentSocialId();\n\n sendBannerShownAnalyticsEvent({\n entityType: 'mindbox.popup',\n socialId: String(recentSocialId ?? ''),\n ...params,\n ...articleMeta,\n });\n}\n","import { addScript } from './util/add-script';\nimport { sendSavedViews } from './actions/send-saved-views';\nimport type { DistributionCore, MindboxCustomer } from './types';\nimport { initMindbox, setDistributionCore } from './util/window';\nimport {\n getProfile,\n requestLogin,\n subscribeToProfileChange,\n} from './util/shared-core-v3';\nimport { getCustomerFromProfile } from './util/get-customer-from-profile';\nimport { initPopmechanic } from './core/init-popmechanic';\nimport { handlePageView } from './core/handle-page-view';\nimport { AUTH_POPUP_URL_PARAM } from './constants';\nimport { sendBannerClickedEvent } from './actions/send-banner-clicked-event';\nimport { sendBannerShownEvent } from './actions/send-banner-shown-event';\n\nlet wasUnauthorized = false;\nlet savedAnauthorizedView = false;\n\nexport default async function init() {\n if (typeof window === 'undefined') {\n return;\n }\n\n // Подключаем основной скрипт mindbox-а\n addScript({\n source: 'https://api.mindbox.ru/scripts/v1/tracker.js',\n });\n\n // https://developers.mindbox.ru/docs/%D1%82%D1%80%D0%B5%D0%BA%D0%B5%D1%80\n initMindbox();\n\n // Добавляем колбэки, которые смогут дёргать другие сервисы\n initCore();\n handleView();\n\n // Проверяем url параметры, чтобы автоматом показать попап авторизации\n showAuthPopupIfNeeded();\n\n subscribeToProfileChange((profile) => {\n // Если пользователь не авторизован, то profile === null\n // Если инфа ещё грузится, то profile === undefined\n // Завязываться на проверку null или undefined -- плохая практика,\n // потому что это поведение в shared-core может поменяться.\n // Поэтому заводим 2 флага, чтобы не дублировать запросы/сохранение.\n if (!profile) {\n // добавляем флаг, чтобы не посылать просмотры дважды,\n // если пользователь разлогинится/залогинится\n if (!savedAnauthorizedView) {\n handlePageView();\n savedAnauthorizedView = true;\n }\n wasUnauthorized = true;\n\n return;\n }\n if (!wasUnauthorized) {\n handlePageView(profile);\n }\n sendSavedViews(getCustomerFromProfile(profile) as MindboxCustomer);\n });\n\n initPopmechanic();\n}\n\nfunction initCore() {\n const core: DistributionCore = {\n sendSavedViews,\n sendBannerClickedEvent,\n sendBannerShownEvent,\n };\n setDistributionCore(core);\n}\n\nfunction handleView() {\n const profile = getProfile();\n\n // Добавляем на случай, если shared-core успеет прогрузить профиль до того,\n // как начнёт отрабатывать distribution-core\n if (profile) {\n handlePageView(profile);\n }\n}\n\nfunction showAuthPopupIfNeeded() {\n const params = new URLSearchParams(window.location.search);\n const showLoginPopup = params.get(AUTH_POPUP_URL_PARAM);\n\n if (!showLoginPopup && showLoginPopup !== '') {\n return;\n }\n\n const profile = getProfile();\n\n // Если profile === undefined, значит профиль ещё не загрузился, и нужно подписаться на изменение\n if (profile === undefined) {\n subscribeToProfileChange((scProfile) => {\n if (!scProfile && scProfile !== undefined) {\n requestLogin({ pointOfContact: 'email' });\n }\n });\n return;\n }\n\n if (!profile) {\n requestLogin({ pointOfContact: 'email' });\n }\n}\n","import init from './init';\n\ninit();\n"],"names":["exports","windowObj","window","undefined","__addEventToStore","queueItems","_evnteq","push","getQueue","_a","Array","isArray","queue","constructor","options","_b","this","errorHandlers","handleQueueUsageAtServer","call","send","eventObject","sendOnce","data","dataObject","e","r","o","t","Boolean","tjlib","core","Object","defineProperty","value","isCoreInitialized","setCore","Error","getCore","i","n","enumerable","get","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","addScript","perform","requestIdleCallback","loadScript","setTimeout","document","readyState","addEventListener","source","id","position","script","createElement","src","appendChild","getOperationData","operation","customer","page","webSite","pathname","split","getSlug","location","operationData","product","ids","getHolder","getMindbox","mindbox","getArticleMeta","TJ_ARTICLE_META","sendMindboxArticleView","article","sendMindboxAddArticleToList","sendMindboxLessonView","lesson","sendMindboxProMainPageView","sendMindboxCourseView","course","VISITED_ARTICLES","VIEWED_ARTICLES","VISITED_LESSONS","VISITED_COURSES","PRO_MAIN_PAGE_VISITS","sendSavedViews","visitedArticles","localStorage","getItem","Set","forEach","removeItem","sendArticleViews","viewedArticles","sendArticleAddToList","pageVisits","parseInt","sendProMainPageViews","coursesViews","coursesList","sendCoursePageViews","lessonsViews","lessonsList","sendLessonPageViews","getProfile","profile","subscribeToProfileChange","cb","subscribe","requestLogin","args","actions","getRecentSocialId","recentSocialId","getCustomerFromProfile","socialId","email","getArticleImage","ogEl","querySelector","content","getCourseSlug","getLessonSlug","pathParts","saveLessonView","currentViews","setItem","sendLessonView","URANIA_VIEW_MAP","save","quiz","main","currentVisits","collection","sendMindboxCollectionView","handlePageView","sendArticleView","currentList","newArticle","saveArticleView","commentsContainer","getElementById","recommendationsContainer","targetContainer","IntersectionObserver","entries","observerInstance","entry","isIntersecting","disconnect","observe","subscribeArticleViewed","sendAddArticleToList","saveAddArticleToList","uraniaMeta","TJ_URANIA_META","pageType","eventeaQueue","EventeaQueue","sendBannerClickedEvent","params","href","articleMeta","payload","entityType","String","project","event","sendBannerShownEvent","wasUnauthorized","savedAnauthorizedView","async","DISTRIBUTION_FIREBASE_SENDER_ID","firebaseSenderId","ENV_NAME","env","CONSTANTS","endpointId","firebaseMessagingSenderId","serviceWorkerPath","console","error","initMindbox","wnd","distribution","setDistributionCore","handleView","showLoginPopup","URLSearchParams","search","pointOfContact","scProfile","showAuthPopupIfNeeded","meta","flowsString","articleFlows","join","tagsString","articleTags","PopMechanicPageData","type","name","title","pictureUrl","category","categoryId","setPopmechanicData","initPopmechanic","init"],"sourceRoot":""}