{"version":3,"file":"sharedFrameEvents-CcDS0bVP.js","sources":["../../../node_modules/.pnpm/date-fns@2.21.1/node_modules/date-fns/esm/addHours/index.js","../../../app/javascript/widget/constants/sdkEvents.js","../../../app/javascript/widget/constants/errorTypes.js","../../../app/javascript/widget/helpers/urlParamsHelper.js","../../../app/javascript/widget/helpers/popoutHelper.js","../../../app/javascript/shared/constants/sharedFrameEvents.js"],"sourcesContent":["import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_HOUR = 3600000;\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of hours to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the hours added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * const result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\n\nexport default function addHours(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR);\n}","export const CHATWOOT_ERROR = 'chatwoot:error';\nexport const CHATWOOT_ON_MESSAGE = 'chatwoot:on-message';\nexport const CHATWOOT_ON_START_CONVERSATION = 'chatwoot:on-start-conversation';\nexport const CHATWOOT_READY = 'chatwoot:ready';\n","export const SET_USER_ERROR = 'SET_USER_ERROR';\n","export const buildSearchParamsWithLocale = search => {\n // [TODO] for now this works, but we will need to find a way to get the locale from the root component\n const locale = window.WOOT_WIDGET.$root.$i18n.locale;\n const params = new URLSearchParams(search);\n params.append('locale', locale);\n\n return `?${params}`;\n};\n\nexport const getLocale = (search = '') => {\n return new URLSearchParams(search).get('locale');\n};\n\nexport const buildPopoutURL = ({\n origin,\n conversationCookie,\n websiteToken,\n locale,\n}) => {\n const popoutUrl = new URL('/widget', origin);\n popoutUrl.searchParams.append('cw_conversation', conversationCookie);\n popoutUrl.searchParams.append('website_token', websiteToken);\n popoutUrl.searchParams.append('locale', locale);\n\n return popoutUrl.toString();\n};\n","import { buildPopoutURL } from './urlParamsHelper';\n\nexport const popoutChatWindow = (\n origin,\n websiteToken,\n locale,\n conversationCookie\n) => {\n try {\n const windowUrl = buildPopoutURL({\n origin,\n websiteToken,\n locale,\n conversationCookie,\n });\n const popoutWindow = window.open(\n windowUrl,\n `webwidget_session_${websiteToken}`,\n 'resizable=off,width=400,height=600'\n );\n popoutWindow.focus();\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(err);\n }\n};\n","export const SDK_SET_BUBBLE_VISIBILITY = 'sdk-set-bubble-visibility';\n"],"names":["MILLISECONDS_IN_HOUR","addHours","dirtyDate","dirtyAmount","requiredArgs","amount","toInteger","addMilliseconds","CHATWOOT_ERROR","CHATWOOT_ON_MESSAGE","CHATWOOT_ON_START_CONVERSATION","CHATWOOT_READY","SET_USER_ERROR","buildSearchParamsWithLocale","search","locale","params","getLocale","buildPopoutURL","origin","conversationCookie","websiteToken","popoutUrl","popoutChatWindow","windowUrl","err","SDK_SET_BUBBLE_VISIBILITY"],"mappings":"kFAGA,IAAIA,EAAuB,KAwBZ,SAASC,EAASC,EAAWC,EAAa,CACvDC,EAAa,EAAG,SAAS,EACzB,IAAIC,EAASC,EAAUH,CAAW,EAClC,OAAOI,EAAgBL,EAAWG,EAASL,CAAoB,CACjE,CC/BY,MAACQ,EAAiB,iBACjBC,EAAsB,sBACtBC,EAAiC,iCACjCC,EAAiB,iBCHjBC,EAAiB,iBCAjBC,EAA8BC,GAAU,CAEnD,MAAMC,EAAS,OAAO,YAAY,MAAM,MAAM,OACxCC,EAAS,IAAI,gBAAgBF,CAAM,EACzC,OAAAE,EAAO,OAAO,SAAUD,CAAM,EAEvB,IAAIC,CAAM,EACnB,EAEaC,EAAY,CAACH,EAAS,KAC1B,IAAI,gBAAgBA,CAAM,EAAE,IAAI,QAAQ,EAGpCI,EAAiB,CAAC,CAC7B,OAAAC,EACA,mBAAAC,EACA,aAAAC,EACA,OAAAN,CACF,IAAM,CACJ,MAAMO,EAAY,IAAI,IAAI,UAAWH,CAAM,EAC3C,OAAAG,EAAU,aAAa,OAAO,kBAAmBF,CAAkB,EACnEE,EAAU,aAAa,OAAO,gBAAiBD,CAAY,EAC3DC,EAAU,aAAa,OAAO,SAAUP,CAAM,EAEvCO,EAAU,UACnB,ECvBaC,EAAmB,CAC9BJ,EACAE,EACAN,EACAK,IACG,CACH,GAAI,CACF,MAAMI,EAAYN,EAAe,CAC/B,OAAAC,EACA,aAAAE,EACA,OAAAN,EACA,mBAAAK,CACN,CAAK,EACoB,OAAO,KAC1BI,EACA,qBAAqBH,CAAY,GACjC,oCACN,EACiB,MAAK,CACnB,OAAQI,EAAK,CAEZ,QAAQ,IAAIA,CAAG,CAChB,CACH,ECzBaC,EAA4B","x_google_ignoreList":[0]}