File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import type { ConsentState } from '@guardian/libs' ;
22import { getConsentFor , onConsent } from '@guardian/libs' ;
33import { commercialFeatures } from './lib/commercial-features' ;
4+ import { createCommercialQueue } from './lib/guardian-commercial-queue' ;
5+
6+ window . guardian . commercial ??= { queue : createCommercialQueue ( ) } ;
7+
48
59const shouldBootConsentless = ( consentState : ConsentState ) => {
610 return (
Original file line number Diff line number Diff line change @@ -48,7 +48,10 @@ const bootCommercial = async (
4848
4949 try {
5050 return Promise . allSettled ( modules . map ( ( module ) => module ( ) ) ) . then (
51- recordCommercialMetrics ,
51+ ( ) => {
52+ recordCommercialMetrics ( ) ;
53+ window . guardian . commercial ?. queue ?. flush ( )
54+ }
5255 ) ;
5356 } catch ( error ) {
5457 // report async errors in bootCommercial to Sentry with the commercial feature tag
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ declare global {
4646 commercial ?: {
4747 dfpEnv ?: DfpEnv ;
4848 a9WinningBids ?: FetchBidResponse [ ] ;
49- queue : QueueArray ;
49+ queue ? : QueueArray ;
5050 } ;
5151 notificationEventHistory ?: HeaderNotification [ ] [ ] ;
5252 commercialTimer ?: EventTimer ;
You can’t perform that action at this time.
0 commit comments