Load the missing promo module, add a prominent creation button and place Promos beside Overview. Use existing AAL2-guarded server RPCs with selected plan, subscription duration and code validity; preserve form input, honest clipboard feedback and scope async responses. Full PR QA succeeded in run 35547013076. No live data, SQL, MFA or unfinished training branch changes. Preserve normal main QA and exact-asset/browser publication verification.
51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
(()=>{
|
||
'use strict';
|
||
if(window.SunHotfixV1763)return;
|
||
|
||
const VERSION='17.6.3';
|
||
function patchDeveloperOpen(){
|
||
const dev=window.SunDeveloperV22;
|
||
if(!dev||dev.__sunV1763SafeOpen||typeof dev.open!=='function')return false;
|
||
const original=dev.open.bind(dev);
|
||
dev.open=(source=null)=>original(source instanceof HTMLElement?source:null);
|
||
Object.defineProperty(dev,'__sunV1763SafeOpen',{value:true,configurable:true});
|
||
return true;
|
||
}
|
||
|
||
// Authentication screens belong to the unified auth gate. Never replace
|
||
// its loading/error state with an old developer-only login card.
|
||
|
||
function interceptSaasAdmin(event){
|
||
const button=event.target?.closest?.('[data-saas-admin]');
|
||
if(!button)return;
|
||
const dev=window.SunDeveloperV22;
|
||
if(!dev)return;
|
||
event.preventDefault();
|
||
event.stopImmediatePropagation();
|
||
patchDeveloperOpen();
|
||
dev.open?.();
|
||
}
|
||
|
||
function loadPromoControls(){
|
||
const id='cateriumTrialPromoDeveloperV181Script';
|
||
if(window.CateriumTrialPromoDeveloperV181||document.getElementById(id))return;
|
||
const script=document.createElement('script');script.id=id;
|
||
script.src='core/trial-promo-developer-v181.js?v=20260921-promo-entry';script.async=true;
|
||
script.onerror=()=>{script.remove();console.warn('[Caterium] Не загрузился раздел промокодов.');};
|
||
document.head.append(script);
|
||
}
|
||
|
||
function maintain(){
|
||
loadPromoControls();
|
||
patchDeveloperOpen();
|
||
}
|
||
|
||
document.addEventListener('click',interceptSaasAdmin,true);
|
||
window.addEventListener('sun:cloud-permissions-changed',()=>setTimeout(maintain,0));
|
||
window.addEventListener('sun:cloud-state-applied',()=>setTimeout(maintain,0));
|
||
setTimeout(maintain,0);
|
||
setInterval(()=>{if(!document.hidden)maintain();},10000);
|
||
|
||
window.SunHotfixV1763={VERSION,patchDeveloperOpen};
|
||
})();
|