feat(utm): propagate join focus mode

This commit is contained in:
Panfilov Konstantin committed 2026-10-17 20:46:33 +03:00
1 parent dfbb086e2b
commit 9835bb0ef8
4 files changed
+83 -11

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
<?php
/**
* Контракт Preland → сайт: собственные метки всегда разрешены до перехода,
* а внешние рекламные параметры не теряются.
*/
declare(strict_types=1);
$_GET = [
'utm_source' => 'stage-ad',
'subid' => 'click-42',
'key' => 'must-not-replace-client-key',
];
$_SERVER['HTTP_HOST'] = 'zoomstage.online';
ob_start();
require dirname(__DIR__) . '/index.php';
$html = (string) ob_get_clean();
if (!preg_match('/const redirectUrlUtm = (.+);/', $html, $match)) {
fwrite(STDERR, "FAIL: Preland не отдал redirectUrlUtm.\n");
exit(1);
}
$query = json_decode($match[1], true);
if (!is_string($query)) {
fwrite(STDERR, "FAIL: redirectUrlUtm должен быть JSON-строкой.\n");
exit(1);
}
parse_str($query, $params);
$expected = [
'indpic' => '1',
'theme' => 'dark',
'degr' => '1',
'registration' => 'after',
'bchoice' => 'a',
'chb' => 'b',
'tp' => '1',
'focus' => 'center',
'utm_source' => 'stage-ad',
'subid' => 'click-42',
];
ksort($params);
ksort($expected);
if ($params !== $expected) {
fwrite(STDERR, "FAIL: claim URL обязан нести все resolved UTM и внешние параметры.\n");
exit(1);
}
if (isset($params['key'])) {
fwrite(STDERR, "FAIL: внешний key не должен подменять одноразовый ключ загрузки.\n");
exit(1);
}
fwrite(STDOUT, "OK: preland redirects resolved UTM and external parameters\n");