{"version":3,"file":"mentionMe-JRyDr87H.js","sources":["../../../app/javascript/components/mentionMe/MentionMe.vue","../../../app/javascript/modules/mentionMe.js"],"sourcesContent":["<template>\n <div>\n <div\n class=\"fixed mm-corner-peel cursor-pointer z-3\"\n :class=\"dismiss ? 'hidden' : 'hidden md:flex'\">\n <div\n class=\"h-6 flex items-center px-3 bg-white border-b border-t border-l border-paper-4\"\n @click=\"openMentionMeModal\">\n <p>\n {{ mentionMeData.defaultCallToAction }}\n </p>\n </div>\n <div\n class=\"bg-paper-4 h-6 w-6 flex justify-center items-center\"\n @click=\"dismissCornerPeel\">\n <svg-icon\n height=\"10\"\n width=\"10\"\n name=\"cross\" />\n </div>\n </div>\n <modal\n :open=\"open\"\n class=\"mention-me-modal\"\n ground-close\n @closed=\"closeMentionMeModal\">\n <template #body>\n <iframe\n id=\"preview-iframe\"\n ref=\"iframe\"\n class=\"shadow-2 w-full h-full block mention-me-iframe\"\n style=\"width: 100%; height: 90vh\"\n :src=\"mentionMeData.url\"\n frameborder=\"0\"></iframe>\n </template>\n </modal>\n </div>\n</template>\n\n<script>\nimport Modal from \"@/app/javascript/components/shared/Modal.vue\";\nimport SvgIcon from \"@/app/javascript/components/shared/SvgIcon.vue\";\n\nexport default {\n name: \"MentionMe\",\n components: {\n Modal,\n SvgIcon\n },\n props: {\n mentionMeData: {\n type: Object,\n required: true\n },\n location: {\n type: String,\n required: true\n },\n isGuestCheckout: {\n type: Boolean,\n required: true\n }\n },\n data() {\n return {\n open: false,\n dismiss: false\n };\n },\n computed: {\n mentionMe() {\n return document.querySelector(\".js-open-mention-me\");\n },\n isAustralia() {\n return window.countryCode === \"/au\";\n }\n },\n mounted() {\n if (this.isAustralia) {\n this.dismiss = true;\n this.open = false;\n } else {\n this.open = !this.isGuestCheckout;\n }\n if (this.mentionMe) {\n this.mentionMe.addEventListener(\"click\", this.openMentionMeModal);\n }\n },\n beforeUnmount() {\n if (this.mentionMe) {\n this.mentionMe.removeEventListener(\"click\", this.openMentionMeModal);\n }\n },\n methods: {\n dismissCornerPeel() {\n analytics.track(\"Dismissed Mention Me Corner Peel\");\n this.dismiss = true;\n },\n openMentionMeModal() {\n analytics.track(\"Opened Mention Me Modal\");\n this.open = true;\n },\n closeMentionMeModal() {\n analytics.track(\"Closed Mention Me Modal\");\n this.open = false;\n }\n }\n};\n</script>\n\n<style lang=\"scss\">\n.mm-corner-peel {\n right: 16px;\n bottom: 80px;\n\n @media screen and (min-width: $screen-sm-min) {\n bottom: 78px;\n }\n}\n\n.mention-me-iframe {\n @media screen and (min-width: $screen-sm-min) {\n min-width: 960px;\n max-height: 630px;\n }\n}\n\n.mention-me-modal .modal-dialog {\n width: auto;\n\n @media screen and (max-width: $screen-sm-max) {\n width: 100%;\n }\n}\n\n.mention-me-modal .modal-dialog .modal-body {\n padding: 0px;\n}\n\n.mention-me-modal .modal-dialog .modal-content {\n @media screen and (min-width: $screen-sm-min) {\n min-width: 960px;\n max-height: 630px;\n }\n}\n</style>\n","import { createApp } from \"vue\";\n\nimport MentionMe from \"../components/mentionMe/MentionMe.vue\";\nimport I18n from \"../plugins/i18n\";\n\nconst mentionMe = () => {\n const node = document.getElementById(\"mention-me-app\");\n if (!node) return;\n\n const props = JSON.parse(node.dataset.props);\n const translations = JSON.parse(node.dataset.translations);\n const { offerPayload, location, offerApiUrl } = props.mentionMe;\n\n if (!offerApiUrl) return;\n\n const mountApp = data => {\n const app = createApp(MentionMe, {\n name: \"MentionMe\",\n mentionMeData: data,\n location,\n isGuestCheckout: props.isGuestCheckout\n });\n\n app.use(I18n, translations);\n\n app.mount(node);\n };\n\n const callOfferApi = () => {\n fetch(offerApiUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(offerPayload)\n })\n .then(response => response.json())\n .then(mountApp);\n };\n\n callOfferApi();\n};\n\nexport default mentionMe;\n"],"names":["_sfc_main","Modal","SvgIcon","_hoisted_1","_createElementBlock","_createElementVNode","_normalizeClass","$data","$options","args","_toDisplayString","$props","_createVNode","_component_svg_icon","_component_modal","mentionMe","node","props","translations","offerPayload","location","offerApiUrl","mountApp","data","app","createApp","MentionMe","I18n","response"],"mappings":"4VA2CA,MAAKA,EAAU,CACb,KAAM,YACN,WAAY,CACV,MAAAC,EACAC,QAAAA,CACD,EACD,MAAO,CACL,cAAe,CACb,KAAM,OACN,SAAU,EACX,EACD,SAAU,CACR,KAAM,OACN,SAAU,EACX,EACD,gBAAiB,CACf,KAAM,QACN,SAAU,EACZ,CACD,EACD,MAAO,CACL,MAAO,CACL,KAAM,GACN,QAAS,EACV,CACF,EACD,SAAU,CACR,WAAY,CACV,OAAO,SAAS,cAAc,qBAAqB,CACpD,EACD,aAAc,CACZ,OAAO,OAAO,cAAgB,KAChC,CACD,EACD,SAAU,CACJ,KAAK,aACP,KAAK,QAAU,GACf,KAAK,KAAO,IAEZ,KAAK,KAAO,CAAC,KAAK,gBAEhB,KAAK,WACP,KAAK,UAAU,iBAAiB,QAAS,KAAK,kBAAkB,CAEnE,EACD,eAAgB,CACV,KAAK,WACP,KAAK,UAAU,oBAAoB,QAAS,KAAK,kBAAkB,CAEtE,EACD,QAAS,CACP,mBAAoB,CAClB,UAAU,MAAM,kCAAkC,EAClD,KAAK,QAAU,EAChB,EACD,oBAAqB,CACnB,UAAU,MAAM,yBAAyB,EACzC,KAAK,KAAO,EACb,EACD,qBAAsB,CACpB,UAAU,MAAM,yBAAyB,EACzC,KAAK,KAAO,EACd,CACF,CACF,EA3GAC,EAAA,CAAA,KAAA,wEACEC,EAmCM,MAAA,KAAA,CAlCJC,EAkBM,MAAA,CAjBJ,MAHNC,EAAA,CAGY,0CACEC,EAAO,QAAA,SAAA,gBAAA,CAAA,IACfF,EAMM,MAAA,CALJ,MAAM,gFACL,4BAAOG,EAAkB,oBAAAA,EAAA,mBAAA,GAAAC,CAAA,KAC1BJ,EAEI,IAAA,KAAAK,EADCC,EAAa,cAAC,mBAAmB,EAAA,CAAA,IAGxCN,EAOM,MAAA,CAN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