Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/analytics/dist/ |
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/analytics/dist/analytics.bundle.js.map |
{"version":3,"file":"analytics.bundle.js","sources":["../src/functions.js","../src/index.js"],"sourcesContent":["import { ajax as Ajax, Extension, Type } from 'main.core';\nimport type { AnalyticsOptions } from './types';\n\nfunction isValidAnalyticsData(analytics: AnalyticsOptions): boolean\n{\n\tif (!Type.isPlainObject(analytics))\n\t{\n\t\tconsole.error('BX.UI.Analytics: {analytics} must be an object.');\n\n\t\treturn false;\n\t}\n\n\tconst requiredFields = ['event', 'tool', 'category'];\n\tfor (const field of requiredFields)\n\t{\n\t\tif (!Type.isStringFilled(analytics[field]))\n\t\t{\n\t\t\tconsole.error(`BX.UI.Analytics: The \"${field}\" property in the \"analytics\" object must be a non-empty string.`);\n\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tconst additionalFields = ['p1', 'p2', 'p3', 'p4', 'p5'];\n\tfor (const field of additionalFields)\n\t{\n\t\tconst value = analytics[field];\n\t\tif (!Type.isStringFilled(value))\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (value.split('_').length > 2)\n\t\t{\n\t\t\tconsole.error(`BX.UI.Analytics: The \"${field}\" property (${value}) in the \"analytics\" object must be a string containing a single underscore.`);\n\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nfunction buildUrlByData(data: AnalyticsOptions): string\n{\n\tconst url = new URL('/_analytics/', window.location.origin);\n\n\tconst queryParams = [];\n\tfor (const [key, value] of Object.entries(data))\n\t{\n\t\tqueryParams.push(`st[${key}]=${encodeURIComponent(value)}`);\n\t}\n\turl.search = queryParams.join('&');\n\n\treturn url.toString();\n}\n\nexport function sendAnalyticsData(analytics: AnalyticsOptions): void\n{\n\tif (!isValidAnalyticsData(analytics))\n\t{\n\t\treturn;\n\t}\n\n\tconst settings = Extension.getSettings('ui.analytics');\n\tconst collectData = settings.get('collectData', false);\n\tif (!collectData)\n\t{\n\t\treturn;\n\t}\n\n\tvoid Ajax({\n\t\tmethod: 'GET',\n\t\turl: buildUrlByData(analytics),\n\t});\n}\n","import { sendAnalyticsData } from './functions';\nimport type { AnalyticsOptions } from './types';\n\nexport function sendData(data: AnalyticsOptions): void\n{\n\t/** @see BX.ajax.runAction */\n\t/** @see processAnalyticsDataToGetParameters() */\n\tsendAnalyticsData(data);\n}\n"],"names":["isValidAnalyticsData","analytics","Type","isPlainObject","console","error","requiredFields","field","isStringFilled","additionalFields","value","split","length","buildUrlByData","data","url","URL","window","location","origin","queryParams","key","Object","entries","push","encodeURIComponent","search","join","toString","sendAnalyticsData","settings","Extension","getSettings","collectData","get","Ajax","method","sendData"],"mappings":";;;;;CAGA,SAASA,oBAAoB,CAACC,SAA2B,EACzD;GACC,IAAI,CAACC,cAAI,CAACC,aAAa,CAACF,SAAS,CAAC,EAClC;KACCG,OAAO,CAACC,KAAK,CAAC,iDAAiD,CAAC;KAEhE,OAAO,KAAK;;GAGb,MAAMC,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC;GACpD,KAAK,MAAMC,KAAK,IAAID,cAAc,EAClC;KACC,IAAI,CAACJ,cAAI,CAACM,cAAc,CAACP,SAAS,CAACM,KAAK,CAAC,CAAC,EAC1C;OACCH,OAAO,CAACC,KAAK,CAAE,yBAAwBE,KAAM,kEAAiE,CAAC;OAE/G,OAAO,KAAK;;;GAId,MAAME,gBAAgB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;GACvD,KAAK,MAAMF,KAAK,IAAIE,gBAAgB,EACpC;KACC,MAAMC,KAAK,GAAGT,SAAS,CAACM,KAAK,CAAC;KAC9B,IAAI,CAACL,cAAI,CAACM,cAAc,CAACE,KAAK,CAAC,EAC/B;OACC;;KAGD,IAAIA,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,GAAG,C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