{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/aVi0eS2OCarxIexzSSa3/KHjFMsAlJ5YiSVNdccfK/free_trials.js", "ssg:https://framerusercontent.com/modules/RqwNb65Pt1IqwWtZLOFE/cpPuaq8D2tZaBO6EzGRg/is_referral.js", "ssg:https://framerusercontent.com/modules/UxqBXpuU4GMc4WjX5cuA/vNLP41sSsaCe3FOPabuN/local_storage.js", "ssg:https://framerusercontent.com/modules/1HXZiu3jhMNERAXG1Gks/K0nhFEVt3sva1ezQs2nQ/mail_app_redirect.js", "ssg:https://framerusercontent.com/modules/RgCsmN5afHEa5XXUaU7f/qqfdDbtTtWdeX0O20fYd/homepage.js"],
  "sourcesContent": ["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useStore } from \"https://framerusercontent.com/modules/klLRvhIbJVlZimk3R0YY/gwMknfib6uoSZdkBUyUD/signup_state.js\";\nexport function withShowForFreeTrials(Component) {\n  return props => {\n    const [store] = useStore();\n    return store.shouldOfferFreeTrialWithoutCreditCard ? /*#__PURE__*/_jsx(Component, {\n      ...props\n    }) : null;\n  };\n}\nexport function withUpdateCopyForFreeTrials(Component) {\n  return props => {\n    const [store] = useStore();\n    const shouldUpdateText = props.text.startsWith(\"The Fastest\") && store.shouldOfferFreeTrialWithoutCreditCard;\n    const isMobile = props.variant === \"Mobile\";\n    const updatedText = isMobile ? \"Try Superhuman\\nFor Free\" : \"Try Superhuman For Free\";\n    const text = shouldUpdateText ? updatedText : props.text;\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      text: text\n    });\n  };\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"withUpdateCopyForFreeTrials\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withUpdateCopyForFreeTrials\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withShowForFreeTrials\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withShowForFreeTrials\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};", "export function isReferral() {\n  const searchParams = new URLSearchParams(window.location.search);\n  const source = searchParams.get(\"source\");\n  return source === \"referral\";\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"isReferral\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};\n//# sourceMappingURL=./is_referral.map", "export function isLocalStorageAvailable() {\n  try {\n    const key = \"key\";\n    const value = \"value\";\n    localStorage.setItem(key, value);\n    const recoveredValue = localStorage.getItem(key);\n    localStorage.removeItem(key);\n    return recoveredValue === value;\n  } catch (e) {\n    return false;\n  }\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"isLocalStorageAvailable\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};\n//# sourceMappingURL=./local_storage.map", "import { NATIVE_PROTOCOL, WEB_APP_ORIGIN } from \"https://framerusercontent.com/modules/qGoVzbWYhJxr4Ja3txj9/GTBA8y9WiGTKKf5hQJDP/constants.js\"; // Inspired by: https://github.com/fingerprintjs/external-protocol-flooding\n// 1. We open a popup window with an input.\n// 2. We try to open our native app in that window via deep-link.\n// 3. We try to focus the input from step 1.\n// 4. If we can't focus it, we know the native app is installed.\n//    (Because the native app's open confirmation blocks the input.)\n// 5. We set a cookie so we don't have to do that in the future.\nconst WINDOWS_PLATFORMS = [\"Win32\", \"Win64\", \"Windows\", \"WinCE\"];\nconst EXTENSION_INSTALLED_CLASS = \"superhumanIsInstalled\";\nconst NATIVE_APP_INSTALLED_CLASS = \"nativeAppInstalled\";\nconst HAS_NATIVE_COOKIE_NAME = \"has-native\"; // Expires in 5 days\nconst COOKIE_EXPIRATION = 5 * 864e5; // TODO: Move these functions to another file ----------\nexport function isFirefox() {\n  return navigator.userAgent.includes(\"Firefox\");\n}\nexport function isMobile() {\n  return navigator.userAgent.match(/android|webos|iphone|ipod|blackberry|iemobile|opera mini/i) !== null;\n}\nexport function isSafari() {\n  return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n} // -----------------------------------------------------\nexport function redirectToWebApp() {\n  window.open(WEB_APP_ORIGIN, \"_blank\");\n}\nexport function redirectToNativeApp() {\n  window.open(NATIVE_PROTOCOL, \"_blank\");\n}\nexport function isSuperhumanExtensionInstalled() {\n  return document.documentElement.classList.contains(EXTENSION_INSTALLED_CLASS);\n}\nexport async function isSuperhumanNativeAppInstalled() {\n  if (isMobile() || isSafari()) return false;\n  const nativeCookieValue = getNativeCookieValue();\n  if (nativeCookieValue === \"true\") return true;\n  if (nativeCookieValue === \"false\") return false;\n  return isFirefox() ? await detectFirefox() : await detectChrome();\n}\nexport function getNativeCookieValue() {\n  const cookies = document.cookie.split(\";\");\n  for (const cookie of cookies) {\n    const [name, value] = cookie.trim().split(\"=\");\n    if (name === HAS_NATIVE_COOKIE_NAME) return value;\n  }\n  return null;\n}\nexport function saveDetectionResult(hasNative) {\n  const expiresDate = new Date(Date.now() + COOKIE_EXPIRATION).toUTCString();\n  const cookieValue = `${HAS_NATIVE_COOKIE_NAME}=${hasNative}; expires=${expiresDate};`;\n  document.cookie = HAS_NATIVE_COOKIE_NAME + \"=\" + cookieValue;\n  if (hasNative) {\n    document.documentElement.classList.add(NATIVE_APP_INSTALLED_CLASS);\n  }\n}\nasync function detectChrome() {\n  const handler = getPopupWindow();\n  let isDetected = true;\n  const input = document.createElement(\"input\");\n  input.style.opacity = \"0\";\n  input.style.position = \"absolute\"; // If we can focus our input, the deep link didn't trigger.\n  input.onfocus = () => {\n    isDetected = false;\n  };\n  const isWindows = WINDOWS_PLATFORMS.indexOf(navigator.platform) > -1;\n  await wait(isWindows ? 100 : 40);\n  if (document.hasFocus()) {\n    document.body.insertBefore(input, document.getElementById(\"app\"));\n  } else {\n    handler.document.body.appendChild(input);\n  }\n  handler.location.replace(NATIVE_PROTOCOL);\n  await wait(isWindows ? 250 : 125); // Perform detection\n  input.focus();\n  handler.close();\n  saveDetectionResult(isDetected);\n  return isDetected;\n}\nconst firefoxDetectionWaitingDefault = 200;\nlet firefoxDetectionWaiting = firefoxDetectionWaitingDefault;\nasync function detectFirefox() {\n  const handler = getPopupWindow();\n  const start = performance.now();\n  const unsubscribe = listenOnce(\"load\", () => {\n    const delta = performance.now() - start;\n    if (firefoxDetectionWaiting === firefoxDetectionWaitingDefault) {\n      firefoxDetectionWaiting = delta + 15;\n    }\n  });\n  const iframe = document.createElement(\"iframe\");\n  iframe.src = NATIVE_PROTOCOL;\n  iframe.style.opacity = \"0\";\n  handler.document.body.appendChild(iframe);\n  await wait(firefoxDetectionWaiting);\n  unsubscribe();\n  const isDetected = !!iframe.contentDocument;\n  saveDetectionResult(isDetected);\n  handler.location.replace(\"/blank\");\n  await waitForLocation(document.location.origin + \"/blank\");\n  handler.location.replace(\"about:blank\");\n  await waitForLocation(\"about:blank\");\n  handler.close();\n  return isDetected;\n}\nasync function wait(delay = 0) {\n  return new Promise(resolve => {\n    setTimeout(resolve, delay);\n  });\n} // TODO: Move these functions to another file\nlet handler = null;\nfunction createPopupWindow() {\n  const params = `width=50,height=50,left=9999,top=9999`;\n  const initialUrl = \"about:blank\";\n  handler = window.open(initialUrl, \"\", params);\n  return handler;\n}\nexport function getPopupWindow() {\n  return handler || createPopupWindow();\n}\nexport function listenOnce(type, callback) {\n  handler.addEventListener(type, callback, {\n    once: true\n  });\n  return () => handler.removeEventListener(type, callback);\n} /**\n  * Wait after cross-origin loading\n  */\nexport function waitForLocation(href) {\n  return new Promise(resolve => {\n    const intervalId = setInterval(() => {\n      try {\n        if (handler.location.href === href) {\n          clearInterval(intervalId);\n          resolve();\n        }\n      } catch (e) {\n        clearInterval(intervalId);\n        resolve();\n      }\n    });\n  });\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"isMobile\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"getPopupWindow\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"saveDetectionResult\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"isSafari\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"isFirefox\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"isSuperhumanExtensionInstalled\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"redirectToNativeApp\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"redirectToWebApp\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"getNativeCookieValue\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"listenOnce\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"waitForLocation\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"isSuperhumanNativeAppInstalled\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};", "/**\n * This file contains code that we run when the homepage loads.\n * It currently handles two things:\n * 1. Redirecting current customers to the web or native app.\n * 2. Storing influencer info for eventual use on /checkout.\n */import { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { useStore } from \"https://framerusercontent.com/modules/klLRvhIbJVlZimk3R0YY/gwMknfib6uoSZdkBUyUD/signup_state.js\";\nimport { evaluateFlagAsync } from \"https://framerusercontent.com/modules/jSuMcOQoPLz68oxh0XfU/watfEBprw9JTZTBCGTSn/flags.js\";\nimport { isReferral } from \"https://framerusercontent.com/modules/RqwNb65Pt1IqwWtZLOFE/cpPuaq8D2tZaBO6EzGRg/is_referral.js\";\nimport { isReferralInc } from \"https://framerusercontent.com/modules/Ni1yr7p6OBG8GTADiS0V/03YMqKnkt84rEivxYrO4/is_referral_incentive.js\";\nimport { isReferralLink } from \"https://framerusercontent.com/modules/T47pd6wbrNPfgLwVvvsX/i6ITmzFC2666tJIdayk2/is_referral_link.js\";\nimport { isSentViaSuperhumanLink } from \"https://framerusercontent.com/modules/tVN7Coq0UHh62BlKwLVJ/oCN0LZCANB4CEaY7BVLc/is_sent_via_superhuman_link.js\";\nimport { isLocalStorageAvailable } from \"https://framerusercontent.com/modules/UxqBXpuU4GMc4WjX5cuA/vNLP41sSsaCe3FOPabuN/local_storage.js\";\nimport { isSuperhumanExtensionInstalled, getNativeCookieValue } from \"https://framerusercontent.com/modules/1HXZiu3jhMNERAXG1Gks/K0nhFEVt3sva1ezQs2nQ/mail_app_redirect.js\";\nimport { NATIVE_PROTOCOL, WEB_APP_ORIGIN } from \"https://framerusercontent.com/modules/qGoVzbWYhJxr4Ja3txj9/GTBA8y9WiGTKKf5hQJDP/constants.js\";\nconst SOURCES_NOT_TO_REDIRECT = [\"mail_app\", \"referral_inc\", \"referral_link\", \"referral_holiday_inc\"];\nconst shouldRedirectToMailApp = () => {\n  // Don't redirect if a visitor came from on another webpage.\n  if (document.referrer.includes(\"superhuman.com\")) return false;\n  const searchParams = new URLSearchParams(window.location.search); // Don't redirect if the URL contains ?redirect=0.\n  if (searchParams.get(\"redirect\") === \"0\") return false; // Don't redirect if a visitor came from one of these sources.\n  const source = searchParams.get(\"source\");\n  if (SOURCES_NOT_TO_REDIRECT.includes(source)) return false;\n  return true;\n};\nconst redirectToMailApp = () => {\n  if (isSuperhumanExtensionInstalled()) {\n    window.location.href = `${WEB_APP_ORIGIN}/?source=website`;\n    return;\n  }\n  if (getNativeCookieValue() === \"true\") {\n    window.location.href = NATIVE_PROTOCOL;\n    return;\n  }\n};\nconst maybeRedirectToMailApp = () => {\n  if (shouldRedirectToMailApp()) {\n    redirectToMailApp();\n  }\n}; /**\n   * If someone visits a page like /influencer-name, we do this:\n   *   1. Show the homepage's content\n   *   2. Save `influencer-name` to localStorage as `via`\n   *   3. Retrieve `via` on /checkout\n   *   4. Include `via` in a request to the signups.create endpoint\n   *      (This lets the backend apply a Stripe coupon.)\n   *   5. Remove `via` from localStorage\n   */\nconst maybeSavePathToLocalStorage = () => {\n  const via = document.location.pathname.slice(1);\n  if (via && isLocalStorageAvailable()) {\n    localStorage.setItem(\"via\", via);\n  }\n};\nexport function withHomepageLoad(Component) {\n  return props => {\n    const [_, setStore] = useStore();\n    React.useEffect(() => {\n      maybeSavePathToLocalStorage();\n      maybeRedirectToMailApp();\n    }, []); // Decide whether to offer someone a no-credit-card free trial.\n    React.useEffect(() => {\n      const params = new URLSearchParams(window.location.search);\n      const wasJustOnPricing = Boolean(params.get(\"tier\")); // Certain types of visitors aren't eligible for these trials.\n      if (isReferral() || isReferralInc() || isReferralLink() || isSentViaSuperhumanLink() || wasJustOnPricing) return; // We check a feature flag to A/B test these trials.\n      evaluateFlagAsync(\"should_offer_free_trial_without_credit_card\", {\n        shouldLogTestGroup: true\n      }).then(result => {\n        setStore({\n          shouldOfferFreeTrialWithoutCreditCard: result\n        });\n      });\n    }, []);\n    return /*#__PURE__*/_jsx(Component, {\n      ...props\n    });\n  };\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"withHomepageLoad\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withHomepageLoad\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};"],
  "mappings": "iVAEO,SAASA,EAAsBC,EAAW,CAC/C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e,IAAI,gBAAgBC,EAAO,SAAS,MAAM,EAC/D,GAAID,EAAa,IAAI,UAAU,IAAM,IAAK,MAAO,GACjD,IAAME,EAASF,EAAa,IAAI,QAAQ,EACxC,MAAI,CAAAF,EAAwB,SAASI,CAAM,CAE7C,EACMC,EAAoB,IAAM,CAC9B,GAAIC,EAA+B,EAAG,CACpCH,EAAO,SAAS,KAAO,GAAGI,oBAC1B,OAEF,GAAIC,EAAqB,IAAM,OAAQ,CACrCL,EAAO,SAAS,KAAOM,EACvB,OAEJ,EACMC,EAAyB,IAAM,CAC/BT,EAAwB,GAC1BI,EAAkB,CAEtB,EASMM,EAA8B,IAAM,CACxC,IAAMC,EAAM,SAAS,SAAS,SAAS,MAAM,CAAC,EAC1CA,GAAOC,EAAwB,GACjC,aAAa,QAAQ,MAAOD,CAAG,CAEnC,EACO,SAASE,GAAiBC,EAAW,CAC1C,OAAOC,GAAS,CACd,GAAM,CAACC,EAAGC,CAAQ,EAAIC,EAAS,EAC/B,OAAAC,EAAM,UAAU,IAAM,CACpBT,EAA4B,EAC5BD,EAAuB,CACzB,EAAG,CAAC,CAAC,EACLU,EAAM,UAAU,IAAM,CACpB,IAAMC,EAAS,IAAI,gBAAgBlB,EAAO,SAAS,MAAM,EACnDmB,EAAmB,QAAQD,EAAO,IAAI,MAAM,CAAC,EAC/CE,EAAW,GAAKC,EAAc,GAAKC,EAAe,GAAKC,EAAwB,GAAKJ,GACxFK,EAAkB,8CAA+C,CAC/D,mBAAoB,EACtB,CAAC,EAAE,KAAKC,GAAU,CAChBV,EAAS,CACP,sCAAuCU,CACzC,CAAC,CACH,CAAC,CACH,EAAG,CAAC,CAAC,EACeC,EAAKd,EAAW,CAClC,GAAGC,CACL,CAAC,CACH,CACF",
  "names": ["withShowForFreeTrials", "Component", "props", "store", "useStore", "p", "withUpdateCopyForFreeTrials", "shouldUpdateText", "updatedText", "text", "isReferral", "window", "isLocalStorageAvailable", "key", "value", "recoveredValue", "EXTENSION_INSTALLED_CLASS", "HAS_NATIVE_COOKIE_NAME", "COOKIE_EXPIRATION", "isSuperhumanExtensionInstalled", "EXTENSION_INSTALLED_CLASS", "getNativeCookieValue", "cookies", "cookie", "name", "value", "HAS_NATIVE_COOKIE_NAME", "SOURCES_NOT_TO_REDIRECT", "shouldRedirectToMailApp", "searchParams", "window", "source", "redirectToMailApp", "isSuperhumanExtensionInstalled", "WEB_APP_ORIGIN", "getNativeCookieValue", "NATIVE_PROTOCOL", "maybeRedirectToMailApp", "maybeSavePathToLocalStorage", "via", "isLocalStorageAvailable", "withHomepageLoad", "Component", "props", "_", "setStore", "useStore", "e", "params", "wasJustOnPricing", "isReferral", "isReferralInc", "isReferralLink", "isSentViaSuperhumanLink", "evaluateFlagAsync", "result", "p"]
}
