Skip to content

Commit 55d36fd

Browse files
authored
Add caching for the GPP string to be able to shorten the timeout period for GPP to load (#112)
1 parent 27b1b71 commit 55d36fd

27 files changed

+1033
-765
lines changed

dist/chunk-F27EXGO2.js

Lines changed: 296 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/chunk-FIXT2GT4.js

Lines changed: 0 additions & 296 deletions
This file was deleted.

dist/chunk-GFRQTZVS.mjs

Lines changed: 296 additions & 0 deletions
Large diffs are not rendered by default.

dist/chunk-QTBOAJIU.mjs

Lines changed: 0 additions & 296 deletions
This file was deleted.

dist/core.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ type GPPHasSectionCallback = (data: boolean, success: boolean) => void;
199199
type GPPPingCallback = (data: GPPPing, success: boolean) => void;
200200
type GPPRemoveEventListenerCallback = (data: boolean, success: boolean) => void;
201201
interface GPPEvent {
202-
eventName: string;
202+
eventName: GPPEventNameType;
203203
listenerId: number;
204204
data: unknown;
205205
pingData: GPPPing;
@@ -216,7 +216,8 @@ interface GPPPing {
216216
gppString: string;
217217
parsedSections: Record<string, unknown[]>;
218218
}
219-
type GPPFunction = <K extends keyof GPPCommand>(command: K, callback: GPPCommand[K], parameter?: unknown, version?: string) => void;
219+
type GPPFunction = <K extends keyof GPPCommand>(command: K, callback: GPPCommand[K], parameter?: unknown, version?: string) => K extends "addEventListener" ? GPPEvent : void;
220+
type GPPEventNameType = "listenerRegistered" | "listenerRemoved" | "cmpStatus" | "cmpDisplayStatus" | "signalStatus" | "error" | "sectionChange";
220221
type IABAdUnitFormatType = "Billboard" | "SmartphoneBanner300" | "SmartphoneBanner320" | "Leaderboard" | "SuperLeaderboardPushdown" | "Portrait" | "Skyscraper" | "MediumRectangle" | "TwentyBySixty" | "MobilePhoneInterstitial640" | "MobilePhoneInterstitial750" | "MobilePhoneInterstitial1080" | "FeaturePhoneSmallBanner" | "FeaturePhoneMediumBanner" | "FeaturePhoneLargeBanner";
221222
type NonIABAdUnitFormatType = "NewTab";
222223
type AdUnitFormatType = IABAdUnitFormatType | NonIABAdUnitFormatType;
@@ -470,7 +471,7 @@ declare class DefaultLogger implements Logger {
470471
private emitLog;
471472
}
472473

473-
type MozAdsStoreKey = "contextId";
474+
type MozAdsStoreKey = "contextId" | "gppPing";
474475
declare enum StoreType {
475476
Persistent = 0,
476477
SessionOnly = 1
@@ -480,4 +481,4 @@ declare const setItemInStore: (key: MozAdsStoreKey, value: string, storeType?: S
480481
declare const removeItemFromStore: (key: MozAdsStoreKey, storeType?: StoreType) => void;
481482
declare const getOrGenerateContextId: (forceRegenerate?: boolean) => string;
482483

483-
export { AdUnitFormatImpressionThreshold, type AdUnitFormatType, AdUnitFormatTypeLookup, type AdUnitFormatTypeLookupKey, CLOSE_ICON_SVG, DEFAULT_SERVICE_ENDPOINT, DefaultImpressionThreshold, DefaultLogReporter, type DefaultLogReporterConfig, DefaultLogger, DefaultMozAdsImpressionObserver, FALLBACK_BILLBOARD_SVG, FALLBACK_DINO_SVG_FRAGMENT, FALLBACK_DONATE_SVG_FRAGMENT, FALLBACK_MRECTANGLE_SVG, FALLBACK_SKYSCRAPER_SVG, FallbackAdURL, FetchAdsError, type FetchAdsParams, FixedSize, type GPPAddEventListenerCallback, type GPPCommand, type GPPEvent, type GPPFunction, type GPPGetFieldCallback, type GPPGetSectionCallback, type GPPHasSectionCallback, type GPPPing, type GPPPingCallback, type GPPRemoveEventListenerCallback, type HTTPSURLString, type HttpRequestMethod, type IABAdUnitFormatType, type IABContent, type IABContentTaxonomyType, IABFixedSize, INSTRUMENT_ENDPOINT, IS_BROWSER, IS_PRODUCTION, type ImpressionThreshold, LOG_EMIT_FLAG_DEFAULT, LOG_TO_CONSOLE_FLAG_DEFAULT, type LogEmitterOptions, type LogFields, type LogReporter, type LogType, type Logger, type LoggerConfig, LoggerLevel, type MozAdsConfig, type MozAdsContent, type MozAdsImpressionObserver, type MozAdsImpressionTracker, type MozAdsLocalizedStringKey, type MozAdsPlacementConfig, type MozAdsPlacementWithContent, type MozAdsPlacements, type MozAdsRenderPlacementErrorEvent, type MozAdsRenderPlacementEvent, type MozAdsRenderPlacementProps, type MozAdsRenderPlacementReportEvent, type MozAdsSize, type MozAdsStoreKey, type MozLogMessage, type NonIABAdUnitFormatType, NonIABFixedSize, type PlacementImpressionInfo, REPORT_ICON_SVG, SeverityLevel, StoreType, type TelemetryEventLabel, buildPlacementsRequest, defaultImpressionObserver, defaultLogReporter, fetchAds, getConfig, getConfigValue, getItemFromStore, getOrGenerateContextId, l, mapResponseToPlacementsWithContent, preloadImage, recordClick, removeItemFromStore, renderPlacement, setConfig, setConfigValue, setItemInStore };
484+
export { AdUnitFormatImpressionThreshold, type AdUnitFormatType, AdUnitFormatTypeLookup, type AdUnitFormatTypeLookupKey, CLOSE_ICON_SVG, DEFAULT_SERVICE_ENDPOINT, DefaultImpressionThreshold, DefaultLogReporter, type DefaultLogReporterConfig, DefaultLogger, DefaultMozAdsImpressionObserver, FALLBACK_BILLBOARD_SVG, FALLBACK_DINO_SVG_FRAGMENT, FALLBACK_DONATE_SVG_FRAGMENT, FALLBACK_MRECTANGLE_SVG, FALLBACK_SKYSCRAPER_SVG, FallbackAdURL, FetchAdsError, type FetchAdsParams, FixedSize, type GPPAddEventListenerCallback, type GPPCommand, type GPPEvent, type GPPEventNameType, type GPPFunction, type GPPGetFieldCallback, type GPPGetSectionCallback, type GPPHasSectionCallback, type GPPPing, type GPPPingCallback, type GPPRemoveEventListenerCallback, type HTTPSURLString, type HttpRequestMethod, type IABAdUnitFormatType, type IABContent, type IABContentTaxonomyType, IABFixedSize, INSTRUMENT_ENDPOINT, IS_BROWSER, IS_PRODUCTION, type ImpressionThreshold, LOG_EMIT_FLAG_DEFAULT, LOG_TO_CONSOLE_FLAG_DEFAULT, type LogEmitterOptions, type LogFields, type LogReporter, type LogType, type Logger, type LoggerConfig, LoggerLevel, type MozAdsConfig, type MozAdsContent, type MozAdsImpressionObserver, type MozAdsImpressionTracker, type MozAdsLocalizedStringKey, type MozAdsPlacementConfig, type MozAdsPlacementWithContent, type MozAdsPlacements, type MozAdsRenderPlacementErrorEvent, type MozAdsRenderPlacementEvent, type MozAdsRenderPlacementProps, type MozAdsRenderPlacementReportEvent, type MozAdsSize, type MozAdsStoreKey, type MozLogMessage, type NonIABAdUnitFormatType, NonIABFixedSize, type PlacementImpressionInfo, REPORT_ICON_SVG, SeverityLevel, StoreType, type TelemetryEventLabel, buildPlacementsRequest, defaultImpressionObserver, defaultLogReporter, fetchAds, getConfig, getConfigValue, getItemFromStore, getOrGenerateContextId, l, mapResponseToPlacementsWithContent, preloadImage, recordClick, removeItemFromStore, renderPlacement, setConfig, setConfigValue, setItemInStore };

dist/core.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import{A as z,B as A,C as B,D as C,E as D,F as E,G as F,H as G,I as H,J as I,K as J,L as K,M as L,N as M,O as N,P as O,Q as P,R as Q,S as R,a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,v as s,w as u,x as v,y as w,z as y}from"./chunk-QTBOAJIU.mjs";import"./chunk-UNPJE3EO.mjs";export{d as AdUnitFormatImpressionThreshold,b as AdUnitFormatTypeLookup,h as CLOSE_ICON_SVG,e as DEFAULT_SERVICE_ENDPOINT,g as DefaultImpressionThreshold,u as DefaultLogReporter,y as DefaultLogger,z as DefaultMozAdsImpressionObserver,l as FALLBACK_BILLBOARD_SVG,j as FALLBACK_DINO_SVG_FRAGMENT,k as FALLBACK_DONATE_SVG_FRAGMENT,q as FALLBACK_MRECTANGLE_SVG,n as FALLBACK_SKYSCRAPER_SVG,c as FallbackAdURL,O as FetchAdsError,a as FixedSize,t as IABFixedSize,f as INSTRUMENT_ENDPOINT,o as IS_BROWSER,r as IS_PRODUCTION,p as LOG_EMIT_FLAG_DEFAULT,m as LOG_TO_CONSOLE_FLAG_DEFAULT,w as LoggerLevel,x as NonIABFixedSize,i as REPORT_ICON_SVG,s as SeverityLevel,J as StoreType,Q as buildPlacementsRequest,A as defaultImpressionObserver,v as defaultLogReporter,P as fetchAds,C as getConfig,E as getConfigValue,K as getItemFromStore,N as getOrGenerateContextId,G as l,R as mapResponseToPlacementsWithContent,H as preloadImage,B as recordClick,M as removeItemFromStore,I as renderPlacement,D as setConfig,F as setConfigValue,L as setItemInStore};
1+
import{A as z,B as A,C as B,D as C,E as D,F as E,G as F,H as G,I as H,J as I,K as J,L as K,M as L,N as M,O as N,P as O,Q as P,R as Q,S as R,a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,v as s,w as u,x as v,y as w,z as y}from"./chunk-GFRQTZVS.mjs";import"./chunk-UNPJE3EO.mjs";export{d as AdUnitFormatImpressionThreshold,b as AdUnitFormatTypeLookup,h as CLOSE_ICON_SVG,e as DEFAULT_SERVICE_ENDPOINT,g as DefaultImpressionThreshold,u as DefaultLogReporter,y as DefaultLogger,z as DefaultMozAdsImpressionObserver,l as FALLBACK_BILLBOARD_SVG,j as FALLBACK_DINO_SVG_FRAGMENT,k as FALLBACK_DONATE_SVG_FRAGMENT,q as FALLBACK_MRECTANGLE_SVG,n as FALLBACK_SKYSCRAPER_SVG,c as FallbackAdURL,O as FetchAdsError,a as FixedSize,t as IABFixedSize,f as INSTRUMENT_ENDPOINT,o as IS_BROWSER,r as IS_PRODUCTION,p as LOG_EMIT_FLAG_DEFAULT,m as LOG_TO_CONSOLE_FLAG_DEFAULT,w as LoggerLevel,x as NonIABFixedSize,i as REPORT_ICON_SVG,s as SeverityLevel,J as StoreType,Q as buildPlacementsRequest,A as defaultImpressionObserver,v as defaultLogReporter,P as fetchAds,C as getConfig,E as getConfigValue,K as getItemFromStore,N as getOrGenerateContextId,G as l,R as mapResponseToPlacementsWithContent,H as preloadImage,B as recordClick,M as removeItemFromStore,I as renderPlacement,D as setConfig,F as setConfigValue,L as setItemInStore};

0 commit comments

Comments
 (0)