{"size": 1881, "ext": "js", "max_stars_repo_path": "src/utils/storage.js", "max_stars_repo_name": "gladly-team/tab-ads", "max_stars_repo_stars_event_min_datetime": "2021-02-03T14:52:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-21T02:02:12.000Z", "max_issues_repo_path": "src/utils/storage.js", "max_issues_repo_name": "gladly-team/tab-ads", "max_issues_repo_issues_event_min_datetime": "2020-02-26T22:22:09.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-26T03:10:02.000Z", "max_forks_repo_path": "src/utils/storage.js", "max_forks_repo_name": "gladly-team/tab-ads", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 28, "max_forks_count": null, "avg_line_length": 31.8813559322, "max_line_length": 105, "alphanum_fraction": 0.6416799575}
/* eslint-disable import/prefer-default-export */
import getGlobal from 'src/utils/getGlobal'

const global = getGlobal()

const getDefaultAdDataStore = () => ({
  // Storing data from Google's ad slot events.
  adManager: {
    // Objects from googletag's "slotRenderEnded" event. This event fires
    // before the "slotOnload" event; i.e., before the actual creative loads.
    // Key: slot ID
    // Value: https://developers.google.com/doubleclick-gpt/reference#googletageventsslotrenderendedevent
    slotsRendered: {},

    // Marking which slots have fired googletag's "impressionViewable" event.
    // See:
    // https://developers.google.com/doubleclick-gpt/reference#googletageventsimpressionviewableevent
    // Key: slot ID
    // Value: `true`
    slotsViewable: {},

    // Marking which slots have fired googletag's "slotOnload" event;
    // i.e., which slots have loaded creative. See:
    // https://developers.google.com/doubleclick-gpt/reference#googletag.events.SlotRenderEndedEvent
    // Key: slot ID
    // Value: `true`
    slotsLoaded: {},
  },

  bidResponses: {
    // // E.g.:
    // amazon: {
    //   // Bid response for each slot, standardized.
    //   bidResponses: {
    //     'div-gpt-abc-123': [
    //       {} // BidResponse
    //     ],
    //   },
    //   // true if the bidder responded in time to be included in the auction.
    //   includedInAdRequest: false,
    //   // Raw response data for each slot from the ad partner.
    //   rawBidResponses: {
    //     'div-gpt-abc-123': {
    //       bid: 'data'
    //     }
    //   }
    // },
  },
})

global.tabAds = global.tabAds || {}
global.tabAds.adDataStore = global.tabAds.adDataStore || getDefaultAdDataStore()

export const clearAdDataStore = () => {
  global.tabAds.adDataStore = getDefaultAdDataStore()
}

export const getAdDataStore = () => global.tabAds.adDataStore
