18
"js/organization-shell.js?v=20260930-eli4-v1",
19
"js/taxpayer-print.js?v=20261003-reference-v2"
20
];
21
+const FINORA_EXTENSION_BUNDLE_URL=null;
22
+const FINORA_EXTENSION_WAIT_MS=18000;
23
function finoraLoadScript(src){
24
return new Promise((resolve,reject)=>{
25
const script=document.createElement('script');
26
script.async=false;
27
script.src=src;
26
- script.onload=()=>resolve(src);
27
- script.onerror=()=>reject(new Error('Failed to load '+src));
28
+ let complete=false;
29
+ const finish=(error)=>{
30
+ if(complete)return;
31
+ complete=true;clearTimeout(timeout);
32
+ script.onload=null;script.onerror=null;
33
+ if(error){script.remove();reject(new Error('FINORA_EXTENSION_LOAD_FAILED'));}
34
+ else resolve(src);
35
+ };
36
+ const timeout=setTimeout(()=>finish(true),FINORA_EXTENSION_WAIT_MS);
37
+ script.onload=()=>finish(false);
38
+ script.onerror=()=>finish(true);
39
document.head.appendChild(script);
40
});
41
}
50
}
51
window.addEventListener('DOMContentLoaded',async()=>{
52
const started=performance.now();
42
- const results=await Promise.allSettled(FINORA_EXTENSION_SCRIPTS.map(finoraLoadScript));
43
- const failed=results.flatMap((r,i)=>r.status==='rejected'?[FINORA_EXTENSION_SCRIPTS[i]]:[]);
53
+ const sources=FINORA_EXTENSION_BUNDLE_URL?[FINORA_EXTENSION_BUNDLE_URL]:FINORA_EXTENSION_SCRIPTS;
54
+ const results=await Promise.allSettled(sources.map(finoraLoadScript));
55
+ const failed=results.flatMap((r,i)=>r.status==='rejected'?[sources[i]]:[]);
56
Object.assign(window.FinoraStartupStatus,{
57
extensionCount:FINORA_EXTENSION_SCRIPTS.length,
46
- failedExtensionCount:failed.length,
58
+ failedExtensionCount:FINORA_EXTENSION_BUNDLE_URL&&failed.length?FINORA_EXTENSION_SCRIPTS.length:failed.length,
59
+ extensionBundle:!!FINORA_EXTENSION_BUNDLE_URL,
60
extensionLoadMs:Math.round(performance.now()-started),
61
extensionsReady:true
62
});
50
- if(failed.length)console.error('Finora platform extension assets unavailable:',failed);
51
- // A successful sign-in/restored session must wait for these modules, but
52
- // rendering the interactive email/password form never waits for them.
53
- window.finoraMarkAppAssetsReady();
63
+ if(failed.length){
64
+ console.warn('Finora workspace assets unavailable; partial ERP is blocked.');
65
+ window.finoraMarkAppAssetsFailed();
66
+ }else{
67
+ window.finoraMarkAppAssetsReady();
68
+ }
69
+ // Login controls remain usable even when workspace modules fail.
70
if(window.FinoraStartupStatus.authSessionChecked)window.FinoraStartupStatus.authChecked=true;
71
});