3namespace Bitrix\Seo\Analytics;
7use Bitrix\Seo\BusinessSuite\IInternalService;
8use Bitrix\Seo\Retargeting;
68 return static::GROUP .
'.' .
$type;
88 static::TYPE_FACEBOOK,
89 static::TYPE_VKONTAKTE,
92 static::TYPE_INSTAGRAM,
116 $providers = static::getServiceProviders($types);
123 $regions = $onlyRu ? [
'ru'] : [
'ru',
'kz',
'by'];
126 return in_array(
$region, $regions);
131 $typeList = static::getTypes();
133 $providers =
array();
134 foreach ($typeList as
$type)
136 if ($types && !in_array(
$type, $types))
141 if (in_array(
$type, [static::TYPE_FACEBOOK, static::TYPE_INSTAGRAM]) && self::isRegionRussian(
true))
146 $authAdapter = static::getInstance()->getAuthAdapter(
$type);
147 $account = static::getInstance()->getAccount(
$type);
151 'HAS_AUTH' => $authAdapter->hasAuth(),
152 'AUTH_URL' => $authAdapter->getAuthUrl(),
153 'HAS_ACCOUNTS' => $account->hasAccounts(),
154 'PROFILE' => $account->getProfileCached(),
155 'ENGINE_CODE' => static::getEngineCode(
$type),
156 'CLIENTS' => static::getClientsProfiles($authAdapter)
160 if ($providers[
$type][
'HAS_AUTH'] && empty($providers[
$type][
'PROFILE']))
162 static::removeAuth(
$type);
163 $providers[
$type][
'HAS_AUTH'] =
false;
178 if (!static::canUse())
185 $account = static::getAccount(
$type);
186 $accountsResult = $account->getList();
187 if ($accountsResult->isSuccess())
189 while ($accountData = $accountsResult->fetch())
191 $accountData = $account->normalizeListRow($accountData);
192 if ($accountData[
'ID'])
195 'id' => $accountData[
'ID'],
196 'name' => $accountData[
'NAME'] ? $accountData[
'NAME'] : $accountData[
'ID']
203 self::$errors = $accountsResult->getErrorMessages();
217 static::getInstance()->getAuthAdapter(
$type)->removeAuth();
227 return self::$errors;
237 self::$errors =
array();
247 return count(self::$errors) > 0;
276 $type = $authAdapter->getType();
277 return array_values(array_filter(array_map(
function ($item) use (
$type) {
279 $service->setClientId($item[
'proxy_client_id']);
284 $account->getRequest()->setAuthAdapter($authAdapter);
286 $profile = $account->getProfileCached();
294 $authAdapter->removeAuth();
297 }, $authAdapter->getAuthorizedClientsList())));
305 foreach (static::getTypes() as
$type)
307 if($engineCode == static::getEngineCode(
$type))
static includeModule($moduleName)
static getClientsProfiles(Retargeting\AuthAdapter $authAdapter)
static isRegionRussian(bool $onlyRu=false)
static getProviders(array $types=null)
static getEngineCode($type)
static getTypeByEngine(string $engineCode)
static getAccounts($type)
static canUseAsInternal()
static getServiceProviders(array $types=null)
static getAuthAdapter($type)
static canUseMultipleClients()
static create($type, IService $service=null, bool $ignoreType=false)
static create($type, $parameters=null, IService $service=null)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"