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/socialnetwork/limit/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/socialnetwork/limit/src/limit.js
import { Runtime, Type } from 'main.core';

type Params = {
	featureId: string,
	code?: string,
	bindElement?: HTMLElement,
	limitAnalyticsLabels?: Object,
}

export class Limit
{
	static instances = {};

	#featureId: string;
	#code: string;
	#bindElement: ?HTMLElement;
	#limitAnalyticsLabels: Object = {};

	constructor(params: Params)
	{
		this.#featureId = params.featureId;
		this.#code = Type.isStringFilled(params.code) ? params.code : `limit_${this.#featureId}`;
		this.#bindElement = Type.isElementNode(params.bindElement) ? params.bindElement : null;

		if (Type.isPlainObject(params.limitAnalyticsLabels))
		{
			this.#limitAnalyticsLabels = { module: 'socialnetwork', ...params.limitAnalyticsLabels };
		}
	}

	static showInstance(params: Params): Promise
	{
		return this.getInstance(params).show();
	}

	static getInstance(params): this
	{
		if (!Type.isStringFilled(params.featureId))
		{
			throw new Error('BX.Socialnetwork.Limit: featureId is required');
		}

		this.instances[params.featureId] ??= new this(params);

		return this.instances[params.featureId];
	}

	show(): Promise
	{
		return new Promise((resolve, reject) => {
			Runtime.loadExtension('ui.info-helper')
				.then(({ FeaturePromotersRegistry }) => {
					if (FeaturePromotersRegistry)
					{
						FeaturePromotersRegistry.getPromoter({
							featureId: this.#featureId,
							code: this.#code,
							bindElement: this.#bindElement,
						}).show();
					}
					else
					{
						BX.UI.InfoHelper.show(this.#code, {
							isLimit: true,
							limitAnalyticsLabels: this.#limitAnalyticsLabels,
						});
					}

					resolve();
				})
				.catch((error) => {
					reject(error);
				})
			;
		});
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit