caterium-app/public/core/hotfix-v1763.js
pavlov346346-source 298b29cd52
Expose developer promo creation with three subscription plans (#39)
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.
2026-09-21 03:30:21 +03:00

51 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{
'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};
})();