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ASkE,cAAc,UACtCD,EAAOE,aAAa,cAAe,aACnCF,EAAOE,aAAa,QAAS,IAE7BF,EAAOG,iBAAiB,OAAQ,KAuB9BnG,OAAOoB,OAAOgF,OAAO,KACnBpG,OAAOoB,OAAOiF,KAAK,CACjBC,YAAaxG,IACbyG,aAAc,CACZ,IAAIvG,OAAOoB,OAAOoF,YAAY,CAC5B/E,QAAoC,eAA3B3B,IACT2G,OAAO,EACPC,KAAK,IAEP,IAAIjE,WAAU,GACd,IAAIsB,+BAEN4C,qBAAqB,EACrBC,eAAgB,SAKtBZ,EAAOG,iBAAiB,QAAS,KAC/BnG,OAAOyB,QAAQG,KAAK,6BAGtBG,SAAS8E,KAAKC,OAAOd,GAQrBA,EAAOe,IAAM,mEACf,CAEAC,E","sources":["webpack://lange/./scripts/determine-environment.ts","webpack://lange/./scripts/integrations/sentry/cli.ts","webpack://lange/./scripts/common/cookie.ts","webpack://lange/./scripts/integrations/sentry/fullstory.ts","webpack://lange/./scripts/integrations/sentry/shopify-theme-sentry-integration.ts","webpack://lange/./scripts/integrations/sentry/index.ts"],"sourcesContent":["/**\n * Returns the stage of the current deployment. This involves some tricky logic to account for the\n * many ways in which the site can be deployed and issues with some developers using incorrect test\n * deployment settings.\n *\n * Be careful with changing the return values. Some users of this function such as Sentry naively\n * forward along the output value to a backend system that processes data based upon this exact\n * string.\n *\n * This cannot rely on NODE_ENV as NODE_ENV has other meanings during CI/CD deployment.\n */\nexport function determineEnvironment() {\n  if (!window.Shopify) {\n    return 'development';\n  }\n\n  if (Shopify.inspectMode) {\n    return 'development';\n  }\n\n  // Detect when the website was loaded as a Shopify theme preview (or sometimes in editor mode).\n  if (Shopify.theme?.role === 'unpublished') {\n    return 'development';\n  }\n\n  return 'production';\n}\n","window.ofircli = window.ofircli || {};\nwindow.ofircli.sentry = {};\n\nwindow.ofircli.sentry.test = function (message: string) {\n  const randomString = createRandomString();\n  const errorMessage = message || ('sentry test capture exception ' + randomString);\n  return window.Sentry?.captureException(new Error(errorMessage));\n};\n\nfunction createRandomString() {\n  let randomString = '';\n  const alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n  for (const _char of alpha) {\n    randomString += alpha.charAt(Math.floor(Math.random() * alpha.length));\n  }\n\n  return randomString;\n}\n\nwindow.ofircli.sentry.flush = async function () {\n  try {\n    await window.Sentry.flush();\n    window.console.log('flushed');\n  } catch (error) {\n    window.console.warn(error);\n  }\n};\n\nconst whatever = 'hello';\n\n// This is a hack to solve https://www.typescriptlang.org/docs/handbook/modules.html issue. Since\n// we have no exports or imports without this line, TypeScript thinks this is a global script.\nexport {\n  whatever\n};\n","function parseCookies() {\n  return document.cookie.split(';')\n    .map(function (keyValuePair) {\n      return keyValuePair.split('=');\n    })\n    .reduce<Record<string, string>>(function (cookies, keyValuePair) {\n      if (keyValuePair && typeof keyValuePair[0] === 'string') {\n        // @ts-ignore\n        cookies[decodeURIComponent(keyValuePair[0].trim())] =\n          decodeURIComponent(keyValuePair[1]?.trim());\n      }\n\n      return cookies;\n    }, {});\n}\n\nexport function getCookie(name: string) {\n  const parsedCookies = parseCookies();\n  return parsedCookies[name];\n}\n\nexport function setCookie(name: string, value: string, days = 30) {\n  const expires = new Date();\n  expires.setDate(expires.getDate() + days);\n  document.cookie =\n    `${encodeURIComponent(name)}=${encodeURIComponent(value || '')}; expires=${expires};`;\n}\n\nexport function removeCookie(name: string) {\n  document.cookie = `${name}=; expires=${new Date(0)};`;\n}\n","import * as SentryTypes from '@sentry/types';\nimport { getCookie } from '../../common/cookie';\n\n/**\n * Attaches FullStory information to errors captured by Sentry.\n *\n * @see https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/dedupe.ts\n * @see https://docs.sentry.io/platforms/javascript/enriching-events/attachments\n */\nexport class FullStory {\n  static id = 'FullStory';\n  public name: string;\n  public startAtCurrentTime: boolean;\n\n  /**\n   * @param [startAtCurrentTime] whether session urls should open the session starting at\n   * the time of the error, if false then the url opens a session at its start, defaults to true\n   */\n  constructor(startAtCurrentTime = true) {\n    this.name = 'FullStory';\n    this.startAtCurrentTime = startAtCurrentTime;\n  }\n\n  /**\n   * Sets up the integration.\n   *\n   * @param addGlobalEventProcessor The global event processor callback\n   * @param getCurrentHub Returns the current hub\n   *\n   * @see https://docs.sentry.io/platforms/javascript/enriching-events/scopes\n   */\n  setupOnce(addGlobalEventProcessor: (callback: SentryTypes.EventProcessor)=> void,\n    getCurrentHub: ()=> SentryTypes.Hub) {\n    addGlobalEventProcessor(event => {\n      if (typeof event !== 'object' || event === null) {\n        return event;\n      }\n\n      try {\n        if (!getCurrentHub()?.getIntegration(FullStory)) {\n          return event;\n        }\n\n        let sessionUrl;\n        let sessionId;\n        if (window._fs_namespace) {\n          // @ts-ignore\n          const fullstory = <FullStory.SDK>window[window._fs_namespace];\n          if (fullstory) {\n            if (typeof fullstory.getCurrentSessionURL === 'function') {\n              try {\n                sessionUrl = fullstory.getCurrentSessionURL(this.startAtCurrentTime);\n              } catch (error) {\n                // ignore\n              }\n            }\n\n            if (typeof fullstory.getCurrentSession === 'function') {\n              try {\n                sessionId = fullstory.getCurrentSession();\n              } catch (error) {\n                // ignore\n              }\n            }\n          }\n        }\n\n        let userId;\n        try {\n          userId = getCookie('fs_uid');\n        } catch (error) {\n          // ignore\n        }\n\n        // mutate instead of spread-clone because of issues like vue reactive objects\n\n        event.contexts = event.contexts || {};\n        event.contexts.fullstory = {\n          session_id: sessionId,\n          url: sessionUrl,\n          user_id: userId\n        };\n\n        return event;\n      } catch (error) {\n        window.console.warn(error, event);\n        return event;\n      }\n    });\n  }\n}\n","import * as SentryTypes from '@sentry/types';\n\n/**\n * Attaches Shopify information to errors captured by Sentry.\n */\nexport class ShopifyThemeSentryIntegration {\n  static id = 'ShopifyThemeSentryIntegration';\n  public name: string;\n\n  constructor() {\n    this.name = 'ShopifyThemeSentryIntegration';\n  }\n\n  /**\n   * Sets up the integration.\n   *\n   * @param addGlobalEventProcessor The global event processor callback\n   * @param getCurrentHub Returns the current hub\n   *\n   * @see https://docs.sentry.io/platforms/javascript/enriching-events/scopes\n   */\n\n  // eslint-disable-next-line @typescript-eslint/class-methods-use-this\n  setupOnce(addGlobalEventProcessor: (callback: SentryTypes.EventProcessor)=> void,\n    getCurrentHub: ()=> SentryTypes.Hub) {\n    addGlobalEventProcessor(event => {\n      if (typeof event !== 'object' || event === null) {\n        return event;\n      }\n\n      try {\n        if (!getCurrentHub()?.getIntegration(ShopifyThemeSentryIntegration)) {\n          return event;\n        }\n\n        // mutate instead of spread-clone because of issues like vue reactive objects\n\n        event.contexts = event.contexts || {};\n\n        // note: because of swc compiler we cannot use export.context['property name']\n\n        event.contexts.shopify_theme = {\n          country: window.Shopify?.country,\n          currency_active: window.Shopify?.currency?.active,\n          currency_rate: window.Shopify?.currency?.rate,\n          locale: window.Shopify?.locale,\n          modules: window.Shopify?.modules,\n          routes: window.Shopify?.routes,\n          shop: window.Shopify?.shop,\n          theme_handle: window.Shopify?.theme?.handle,\n          theme_id: window.Shopify?.theme?.id,\n          theme_name: window.Shopify?.theme?.name,\n          theme_role: window.Shopify?.theme?.role,\n          theme_style_handle: window.Shopify?.theme?.style?.handle,\n          theme_style_id: window.Shopify?.theme?.style?.id\n        };\n\n        return event;\n      } catch (error) {\n        window.console.warn(error, event);\n        return event;\n      }\n    });\n  }\n}\n\nShopifyThemeSentryIntegration.id = 'ShopifyThemeSentryIntegration';\n","import { determineEnvironment } from '../../determine-environment.js';\nimport './cli';\nimport { FullStory } from './fullstory';\nimport { ShopifyThemeSentryIntegration } from './shopify-theme-sentry-integration';\n\nfunction main() {\n  const script = document.createElement('script');\n  script.setAttribute('crossorigin', 'anonymous');\n  script.setAttribute('async', '');\n\n  script.addEventListener('load', () => {\n    // See https://docs.sentry.io/platforms/javascript/install/lazy-load-sentry/#sdk-configuration\n\n    // TODO: we cannot support debug in this particular script we are loading\n    // debug: process.env.NODE_ENV !== 'production', so we have to somehow load the bundle in a\n    // different way if we want debugging\n\n    // TODO: we cannot use the extra error data integration unless we also explicitly somehow load\n    // it and then on load set it.\n    //\n    // new window.Sentry.ExtraErrorData({ depth: 5 }),\n\n    // onLoad does not fire immediately on load. It fires when the first error occurs. Basic errors\n    // are buffered and the full Sentry client is lazily loaded only later.\n\n    // Regarding environment configuration, we cannot trivially pass through the value of NODE_ENV.\n    // Something is wrong somewhere in our CI/CD setup where the environment is not specified on\n    // some builds. To fix this, treat all invalid setups as development environments. The only way\n    // to specify production is to explicitly specify production. This will help prevent development\n    // errors on invalid setups from entering into the production environment in the Sentry project.\n    // That is very important because that prevents development errors from appearing in production.\n    // That is important because that is how we know which errors are live.\n\n    window.Sentry.onLoad(() => {\n      window.Sentry.init({\n        environment: determineEnvironment(),\n        integrations: [\n          new window.Sentry.Breadcrumbs({\n            console: determineEnvironment() === 'production' ? true : false,\n            fetch: false,\n            xhr: false\n          }),\n          new FullStory(true),\n          new ShopifyThemeSentryIntegration()\n        ],\n        autoSessionTracking: false,\n        normalizeDepth: 10\n      });\n    });\n  });\n\n  script.addEventListener('error', () => {\n    window.console.warn('[sentry] FAILED TO LOAD');\n  });\n\n  document.head.append(script);\n\n  // This is our DSN key for the ofir beauty project in the script url. Sentry generates a cached\n  // JavaScript file in its CDN that embeds this key into it. We do not need to call Sentry.init\n  // with this key again.\n  //\n  // Because some browsers do eager loading before the script load event is registered we wait to\n  // set the src until after everything is setup.\n  script.src = 'https://js.sentry-cdn.com/2f548f7966f54c2bb95307a0e7dff379.min.js';\n}\n\nmain();\n"],"names":["determineEnvironment","_Shopify$theme","window","Shopify","inspectMode","theme","role","ofircli","sentry","test","message","_window$Sentry","randomString","alpha","_char","charAt","Math","floor","random","length","createRandomString","errorMessage","Sentry","captureException","Error","flush","async","console","log","error","warn","getCookie","name","document","cookie","split","map","keyValuePair","reduce","cookies","_keyValuePair$","decodeURIComponent","trim","FullStory","constructor","startAtCurrentTime","this","setupOnce","addGlobalEventProcessor","getCurrentHub","event","_getCurrentHub","getIntegration","sessionUrl","sessionId","userId","_fs_namespace","fullstory","getCurrentSessionURL","getCurrentSession","contexts","session_id","url","user_id","id","ShopifyThemeSentryIntegration","_window$Shopify","_window$Shopify2","_window$Shopify3","_window$Shopify4","_window$Shopify5","_window$Shopify6","_window$Shopify7","_window$Shopify8","_window$Shopify9","_window$Shopify0","_window$Shopify1","_window$Shopify10","_window$Shopify11","shopify_theme","country","currency_active","currency","active","currency_rate","rate","locale","modules","routes","shop","theme_handle","handle","theme_id","theme_name","theme_role","theme_style_handle","style","theme_style_id","script","createElement","setAttribute","addEventListener","onLoad","init","environment","integrations","Breadcrumbs","fetch","xhr","autoSessionTracking","normalizeDepth","head","append","src","main"],"sourceRoot":""}