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AASC,cAAc,UACtCF,EAAOG,aAAa,cAAe,aACnCH,EAAOG,aAAa,QAAS,IAE7BH,EAAOI,iBAAiB,OAAQ,KAuB9B5E,OAAOoB,OAAOyD,OAAO,KACnB7E,OAAOoB,OAAO0D,KAAK,CACjBC,YAAajF,IACbkF,aAAc,CACZ,IAAIhF,OAAOoB,OAAO6D,YAAY,CAC5BxD,QAAoC,eAA3B3B,IACToF,OAAO,EACPC,KAAK,IAEP,IAAItD,+BAENuD,qBAAqB,EACrBC,eAAgB,SAKtBb,EAAOI,iBAAiB,QAAS,KAC/B5E,OAAOyB,QAAQG,KAAK,6BAGtB6C,SAASa,KAAKC,OAAOf,GAQrBA,EAAOgB,IAAM,mEACf,CAEAC","sources":["webpack://lange/./scripts/determine-environment.ts","webpack://lange/./scripts/integrations/sentry/cli.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","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 = 'ShopifyThemeSentryIntegration';\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    // eslint-disable-next-line @typescript-eslint/no-deprecated\n    getCurrentHub: () => SentryTypes.Hub) {\n    addGlobalEventProcessor(event => {\n      if (typeof event !== 'object' || event === null) {\n        return event;\n      }\n\n      try {\n        // eslint-disable-next-line @typescript-eslint/no-deprecated\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.js';\nimport { ShopifyThemeSentryIntegration } from './shopify-theme-sentry-integration.js';\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 debug:\n    // process.env.NODE_ENV !== 'production', so we have to somehow load the bundle in a different\n    // 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 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","ShopifyThemeSentryIntegration","static","name","setupOnce","addGlobalEventProcessor","getCurrentHub","event","_getCurrentHub","_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","getIntegration","contexts","shopify_theme","country","currency_active","currency","active","currency_rate","rate","locale","modules","routes","shop","theme_handle","handle","theme_id","id","theme_name","theme_role","theme_style_handle","style","theme_style_id","script","document","createElement","setAttribute","addEventListener","onLoad","init","environment","integrations","Breadcrumbs","fetch","xhr","autoSessionTracking","normalizeDepth","head","append","src","main"],"sourceRoot":""}