How to use the globals.URLS.APP_URLS_PR_REVIEW_TEST function in globals

To help you get started, we’ve selected a few globals examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gnosis / dx-react / src / index.tsx View on Github external
URLS.APP_URLS_DEV.includes(hostname) ||
      URLS.APP_URLS_LOCAL.includes(hostname) ||
      URLS.APP_URLS_PR_REVIEW_TEST(hostname) ||
      hostname.startsWith('10')
  ) return preAppRender().catch(console.error)

  /* PRODUCTION builds should be geoBlocked */
  if (FE_CONDITIONAL_ENV === 'production') {
    /* Scenario 1a: User is a developer on any of the STAGING URLS OR ipfs */
    if (URLS.APP_URLS_STAGING.includes(hostname) || hostname.includes('ipfs')) {
      blocked = await isGeoBlocked()
      blocked && (disabledReason = 'geoblock')

      !URLS.APP_URLS_STAGING.includes(hostname) && ReactGA.initialize(GA_CODES.IPFS)
    /* Scenario 1b: User is a developer on a PR-review URL */
    } else if (URLS.APP_URLS_PR_REVIEW_TEST(hostname)) {
      blocked = false
    }
    // Main release Scenarios:
    /* Scenario 2: User is using the dx on dutchx-rinkeby (RINKEBY): BLOCK: networks */
    else if (URLS.APP_URLS_PROD.RINKEBY.includes(hostname)) {
      ALLOWED_NETWORK = 'Rinkeby Test Network'
      blocked = await isNetBlocked(['4'])
      if (blocked) disabledReason = 'networkblock'
      // init GA
      ReactGA.initialize(GA_CODES.RINKEBY)
    }
    /* Scenario 3: User is using the dx on dutchx.app (MAIN): BLOCK: all networks + geoblock */
    else if (URLS.APP_URLS_PROD.MAIN.includes(hostname)) {
      ALLOWED_NETWORK = 'Ethereum Mainnet'
      const netBlockedPromise = isNetBlocked(['1'])
      // geoblock gets precedence, checked last
github gnosis / dx-react / src / index.tsx View on Github external
async function conditionalRender() {
  /* User's environment does not have access to window API (e.g user on mobile?) */
  if (typeof window === 'undefined') return false
  let blocked = true, disabledReason, ALLOWED_NETWORK

  const { hostname } = window.location
  const { FE_CONDITIONAL_ENV } = process.env

  /* Scenario 1: User is a developer running app locally: BLOCK: nothing */
  if (
      FE_CONDITIONAL_ENV !== 'production' ||
      URLS.APP_URLS_DEV.includes(hostname) ||
      URLS.APP_URLS_LOCAL.includes(hostname) ||
      URLS.APP_URLS_PR_REVIEW_TEST(hostname) ||
      hostname.startsWith('10')
  ) return preAppRender().catch(console.error)

  /* PRODUCTION builds should be geoBlocked */
  if (FE_CONDITIONAL_ENV === 'production') {
    /* Scenario 1a: User is a developer on any of the STAGING URLS OR ipfs */
    if (URLS.APP_URLS_STAGING.includes(hostname) || hostname.includes('ipfs')) {
      blocked = await isGeoBlocked()
      blocked && (disabledReason = 'geoblock')

      !URLS.APP_URLS_STAGING.includes(hostname) && ReactGA.initialize(GA_CODES.IPFS)
    /* Scenario 1b: User is a developer on a PR-review URL */
    } else if (URLS.APP_URLS_PR_REVIEW_TEST(hostname)) {
      blocked = false
    }
    // Main release Scenarios: