Source: utility/has-offers-query-info.js

'use strict';

/** Provide a single place to parse inbound Has Offers affiliate links. */
class HasOffersQueryInfo {
  /** The parameters off the current URL
   * @type {URLSearchParams}
   */
  _params = null;

  /** Set the value of dynamic properties */
  constructor() {
    this._params = new URLSearchParams(window.location.search);
  }

  /** Whether the query parameters identify an inbound affiliate link. */
  get isAffiliate() {
    return this._params.has('transaction_id') && this._params.has('offer_id');
  }
}

export const hasOffersQueryInfo = new HasOffersQueryInfo();