403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/calendar/sharing/analytics/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/calendar/sharing/analytics/src/analytics.js
import { sendData } from 'ui.analytics';
import { Context, LinkType, LinkCreateMethod, Params, RuleChange } from './types';

export class Analytics
{
	static tool = 'calendar';
	static category = 'slots';

	static contexts: Map<string, Context> = {
		calendar: 'calendar',
		crm: 'crm',
	};

	static linkTypes: Map<string, LinkType> = {
		solo: 'solo',
		multiple: 'multiple',
	};

	static events = {
		form_open: 'form_open',
		setup: 'setup',
		adding_people: 'adding_people',
		link_created: 'link_created',
	};

	static linkCreateMethods: Map<string, LinkCreateMethod> = {
		crm_send: 'crm_send',
		crm_copy: 'crm_copy',
		calendar_copy_main: 'calendar_copy_main',
		calendar_copy_list: 'calendar_copy_list',
	};

	static ruleChanges: Map<string, RuleChange> = {
		custom_days: 'custom_days',
		custom_length: 'custom_length',
	};

	static sendPopupOpened(context: Context): void
	{
		this.sendAnalytics(Analytics.events.form_open, {
			c_section: context,
		});
	}

	static sendRuleUpdated(context: Context, changes: RuleChange[]): void
	{
		for (const type of changes)
		{
			this.sendAnalytics(Analytics.events.setup, {
				type,
				c_section: context,
			});
		}
	}

	static sendMembersAdded(context: Context, peopleCount: number): void
	{
		this.sendAnalytics(Analytics.events.adding_people, {
			c_section: context,
			p1: `peopleCount_${peopleCount}`,
		});
	}

	static sendLinkCopied(context: Context, type: LinkType, params: Params): void
	{
		let method = Analytics.linkCreateMethods.calendar_copy_main;
		if (context === Analytics.contexts.crm)
		{
			method = Analytics.linkCreateMethods.crm_copy;
		}

		this.sendLinkCreated(context, type, method, params);
	}

	static sendLinkCopiedList(context: Context, params: Params): void
	{
		const method = Analytics.linkCreateMethods.calendar_copy_list;

		this.sendLinkCreated(context, Analytics.linkTypes.multiple, method, params);
	}

	static sendLinkCreated(context: Context, type: LinkType, method: LinkCreateMethod, params: Params): void
	{
		const ruleChanges = {
			customDays: params.ruleChanges.includes(Analytics.ruleChanges.custom_days) ? 'Y' : 'N',
			customLength: params.ruleChanges.includes(Analytics.ruleChanges.custom_length) ? 'Y' : 'N',
		};

		this.sendAnalytics(Analytics.events.link_created, {
			type,
			c_section: context,
			c_element: method,
			p1: `peopleCount_${params.peopleCount}`,
			p2: `customDays_${ruleChanges.customDays}`,
			p3: `customLength_${ruleChanges.customLength}`,
		});
	}

	/**
	 * @private
	 */
	static sendAnalytics(event: string, params: {
		c_section: string,
		c_element: string,
		type: string,
		p1: string,
		p2: string,
		p3: string,
	}): void
	{
		sendData({
			tool: Analytics.tool,
			category: Analytics.category,
			event,
			...params,
		});
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit