{"version":3,"file":"static/js/calendly.db9010ab.js","sources":["webpack://@jotforminc/form-widgets/../../../node_modules/.pnpm/react-calendly@4.1.1_react-dom@18.3.0_react@18.3.0__react@18.3.0/node_modules/react-calendly/dist/index.es.js","webpack://@jotforminc/form-widgets/../../../../src/icons/documents/document-list-bullet-filled.svg","webpack://@jotforminc/form-widgets/../../../../src/icons/general/info-circle-filled.svg","webpack://@jotforminc/form-widgets/./src/widgets/calendly/EmptyUrlAlert.js","webpack://@jotforminc/form-widgets/./src/widgets/calendly/CalendlyWidget.js","webpack://@jotforminc/form-widgets/./src/widgets/calendly/index.js","webpack://@jotforminc/form-widgets/./src/widgets/calendly/Calendly.js"],"sourcesContent":["import { createElement, Component, Fragment, useEffect } from 'react';\nimport { createPortal } from 'react-dom';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\n\nfunction styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar css = \"/*\\n code is extracted from Calendly's embed stylesheet: https://assets.calendly.com/assets/external/widget.css\\n*/\\n\\n.calendly-inline-widget,\\n.calendly-inline-widget *,\\n.calendly-badge-widget,\\n.calendly-badge-widget *,\\n.calendly-overlay,\\n.calendly-overlay * {\\n font-size:16px;\\n line-height:1.2em\\n}\\n\\n.calendly-inline-widget iframe,\\n.calendly-badge-widget iframe,\\n.calendly-overlay iframe {\\n display:inline;\\n width:100%;\\n height:100%\\n}\\n\\n.calendly-popup-content {\\n position:relative\\n}\\n\\n.calendly-popup-content.calendly-mobile {\\n -webkit-overflow-scrolling:touch;\\n overflow-y:auto\\n}\\n\\n.calendly-overlay {\\n position:fixed;\\n top:0;\\n left:0;\\n right:0;\\n bottom:0;\\n overflow:hidden;\\n z-index:9999;\\n background-color:#a5a5a5;\\n background-color:rgba(31,31,31,0.4)\\n}\\n\\n.calendly-overlay .calendly-close-overlay {\\n position:absolute;\\n top:0;\\n left:0;\\n right:0;\\n bottom:0\\n}\\n\\n.calendly-overlay .calendly-popup {\\n box-sizing:border-box;\\n position:absolute;\\n top:50%;\\n left:50%;\\n -webkit-transform:translateY(-50%) translateX(-50%);\\n transform:translateY(-50%) translateX(-50%);\\n width:80%;\\n min-width:900px;\\n max-width:1000px;\\n height:90%;\\n max-height:680px\\n}\\n\\n@media (max-width: 975px) {\\n .calendly-overlay .calendly-popup {\\n position:fixed;\\n top:50px;\\n left:0;\\n right:0;\\n bottom:0;\\n -webkit-transform:none;\\n transform:none;\\n width:100%;\\n height:auto;\\n min-width:0;\\n max-height:none\\n }\\n}\\n\\n.calendly-overlay .calendly-popup .calendly-popup-content {\\n height:100%;\\n}\\n\\n.calendly-overlay .calendly-popup-close {\\n position:absolute;\\n top:25px;\\n right:25px;\\n color:#fff;\\n width:19px;\\n height:19px;\\n cursor:pointer;\\n background:url(https://assets.calendly.com/assets/external/close-icon.svg) no-repeat;\\n background-size:contain\\n}\\n\\n@media (max-width: 975px) {\\n .calendly-overlay .calendly-popup-close {\\n top:15px;\\n right:15px\\n }\\n}\\n\\n.calendly-badge-widget {\\n position:fixed;\\n right:20px;\\n bottom:15px;\\n z-index:9998\\n}\\n\\n.calendly-badge-widget .calendly-badge-content {\\n display:table-cell;\\n width:auto;\\n height:45px;\\n padding:0 30px;\\n border-radius:25px;\\n box-shadow:rgba(0,0,0,0.25) 0 2px 5px;\\n font-family:sans-serif;\\n text-align:center;\\n vertical-align:middle;\\n font-weight:bold;\\n font-size:14px;\\n color:#fff;\\n cursor:pointer\\n}\\n\\n.calendly-badge-widget .calendly-badge-content.calendly-white {\\n color:#666a73\\n}\\n\\n.calendly-badge-widget .calendly-badge-content span {\\n display:block;\\n font-size:12px\\n}\\n\\n.calendly-spinner {\\n position:absolute;\\n top:50%;\\n left:0;\\n right:0;\\n -webkit-transform:translateY(-50%);\\n transform:translateY(-50%);\\n text-align:center;\\n z-index:-1\\n}\\n\\n.calendly-spinner>div {\\n display:inline-block;\\n width:18px;\\n height:18px;\\n background-color:#e1e1e1;\\n border-radius:50%;\\n vertical-align:middle;\\n -webkit-animation:calendly-bouncedelay 1.4s infinite ease-in-out;\\n animation:calendly-bouncedelay 1.4s infinite ease-in-out;\\n -webkit-animation-fill-mode:both;\\n animation-fill-mode:both\\n}\\n\\n.calendly-spinner .calendly-bounce1 {\\n -webkit-animation-delay:-0.32s;\\n animation-delay:-0.32s\\n}\\n\\n.calendly-spinner .calendly-bounce2 {\\n -webkit-animation-delay:-0.16s;\\n animation-delay:-0.16s\\n}\\n\\n@-webkit-keyframes calendly-bouncedelay {\\n 0%,80%,100% {\\n -webkit-transform:scale(0);\\n transform:scale(0)\\n } \\n \\n 40%{\\n -webkit-transform:scale(1);\\n transform:scale(1)\\n }\\n}\\n\\n@keyframes calendly-bouncedelay{ \\n 0%,80%,100% {\\n -webkit-transform:scale(0);\\n transform:scale(0)\\n }\\n \\n 40% {\\n -webkit-transform:scale(1);\\n transform:scale(1)\\n }\\n}\";\nstyleInject(css);\n\nfunction sanitizeColorString(str) {\n if (str.charAt(0) === \"#\") {\n return str.slice(1);\n }\n return str;\n}\nfunction sanitizePageSettingsProps(props) {\n if (props === null || props === void 0 ? void 0 : props.primaryColor) {\n props.primaryColor = sanitizeColorString(props.primaryColor);\n }\n if (props === null || props === void 0 ? void 0 : props.textColor) {\n props.textColor = sanitizeColorString(props.textColor);\n }\n if (props === null || props === void 0 ? void 0 : props.backgroundColor) {\n props.backgroundColor = sanitizeColorString(props.backgroundColor);\n }\n return props;\n}\n\nvar CalendlyEvent;\n(function (CalendlyEvent) {\n CalendlyEvent[\"PROFILE_PAGE_VIEWED\"] = \"calendly.profile_page_viewed\";\n CalendlyEvent[\"EVENT_TYPE_VIEWED\"] = \"calendly.event_type_viewed\";\n CalendlyEvent[\"DATE_AND_TIME_SELECTED\"] = \"calendly.date_and_time_selected\";\n CalendlyEvent[\"EVENT_SCHEDULED\"] = \"calendly.event_scheduled\";\n})(CalendlyEvent || (CalendlyEvent = {}));\nvar formatCalendlyUrl = function (_a) {\n var url = _a.url, _b = _a.prefill, prefill = _b === void 0 ? {} : _b, _c = _a.pageSettings, pageSettings = _c === void 0 ? {} : _c, _d = _a.utm, utm = _d === void 0 ? {} : _d, embedType = _a.embedType;\n var sanitizedPageSettings = sanitizePageSettingsProps(pageSettings);\n var backgroundColor = sanitizedPageSettings.backgroundColor, hideEventTypeDetails = sanitizedPageSettings.hideEventTypeDetails, hideLandingPageDetails = sanitizedPageSettings.hideLandingPageDetails, primaryColor = sanitizedPageSettings.primaryColor, textColor = sanitizedPageSettings.textColor, hideGdprBanner = sanitizedPageSettings.hideGdprBanner;\n var customAnswers = prefill.customAnswers, date = prefill.date, email = prefill.email, firstName = prefill.firstName, guests = prefill.guests, lastName = prefill.lastName, location = prefill.location, name = prefill.name;\n var utmCampaign = utm.utmCampaign, utmContent = utm.utmContent, utmMedium = utm.utmMedium, utmSource = utm.utmSource, utmTerm = utm.utmTerm, salesforce_uuid = utm.salesforce_uuid;\n var queryStringIndex = url.indexOf(\"?\");\n var hasQueryString = queryStringIndex > -1;\n var queryString = url.slice(queryStringIndex + 1);\n var baseUrl = hasQueryString ? url.slice(0, queryStringIndex) : url;\n var updatedQueryString = [\n hasQueryString ? queryString : null,\n backgroundColor ? \"background_color=\" + backgroundColor : null,\n hideEventTypeDetails ? \"hide_event_type_details=1\" : null,\n hideLandingPageDetails ? \"hide_landing_page_details=1\" : null,\n primaryColor ? \"primary_color=\" + primaryColor : null,\n textColor ? \"text_color=\" + textColor : null,\n hideGdprBanner ? \"hide_gdpr_banner=1\" : null,\n name ? \"name=\" + encodeURIComponent(name) : null,\n location ? \"location=\" + encodeURIComponent(location) : null,\n firstName ? \"first_name=\" + encodeURIComponent(firstName) : null,\n lastName ? \"last_name=\" + encodeURIComponent(lastName) : null,\n guests ? \"guests=\" + guests.map(encodeURIComponent).join(\",\") : null,\n email ? \"email=\" + encodeURIComponent(email) : null,\n date && date instanceof Date ? \"date=\" + formatDate(date) : null,\n utmCampaign ? \"utm_campaign=\" + encodeURIComponent(utmCampaign) : null,\n utmContent ? \"utm_content=\" + encodeURIComponent(utmContent) : null,\n utmMedium ? \"utm_medium=\" + encodeURIComponent(utmMedium) : null,\n utmSource ? \"utm_source=\" + encodeURIComponent(utmSource) : null,\n utmTerm ? \"utm_term=\" + encodeURIComponent(utmTerm) : null,\n salesforce_uuid\n ? \"salesforce_uuid=\" + encodeURIComponent(salesforce_uuid)\n : null,\n embedType ? \"embed_type=\" + embedType : null,\n /*\n * https://github.com/tcampb/react-calendly/pull/31\n * embed_domain must be defined to receive messages from the Calendly iframe.\n */\n \"embed_domain=1\",\n ]\n .concat(customAnswers ? formatCustomAnswers(customAnswers) : [])\n .filter(function (item) { return item !== null; })\n .join(\"&\");\n return baseUrl + \"?\" + updatedQueryString;\n};\nvar formatDate = function (d) {\n var month = d.getMonth() + 1;\n var day = d.getDate();\n var year = d.getFullYear();\n return [\n year,\n month < 10 ? \"0\" + month : month,\n day < 10 ? \"0\" + day : day,\n ].join(\"-\");\n};\nvar CUSTOM_ANSWER_PATTERN = /^a\\d{1,2}$/;\nvar formatCustomAnswers = function (customAnswers) {\n var customAnswersFiltered = Object.keys(customAnswers).filter(function (key) {\n return key.match(CUSTOM_ANSWER_PATTERN);\n });\n if (!customAnswersFiltered.length)\n return [];\n return customAnswersFiltered.map(function (key) { return key + \"=\" + encodeURIComponent(customAnswers[key]); });\n};\n\nvar LoadingSpinner = /** @class */ (function (_super) {\n __extends(LoadingSpinner, _super);\n function LoadingSpinner() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LoadingSpinner.prototype.render = function () {\n return (createElement(\"div\", { className: \"calendly-spinner\" },\n createElement(\"div\", { className: \"calendly-bounce1\" }),\n createElement(\"div\", { className: \"calendly-bounce2\" }),\n createElement(\"div\", { className: \"calendly-bounce3\" })));\n };\n return LoadingSpinner;\n}(Component));\n\nvar defaultStyles = {\n minWidth: \"320px\",\n height: \"630px\",\n};\nvar InlineWidget = /** @class */ (function (_super) {\n __extends(InlineWidget, _super);\n function InlineWidget(props) {\n var _this = _super.call(this, props) || this;\n _this.state = {\n isLoading: true,\n };\n _this.onLoad = _this.onLoad.bind(_this);\n return _this;\n }\n InlineWidget.prototype.onLoad = function () {\n this.setState({\n isLoading: false,\n });\n };\n InlineWidget.prototype.render = function () {\n var src = formatCalendlyUrl({\n url: this.props.url,\n pageSettings: this.props.pageSettings,\n prefill: this.props.prefill,\n utm: this.props.utm,\n embedType: \"Inline\",\n });\n return (createElement(\"div\", { className: \"calendly-inline-widget\", style: this.props.styles || defaultStyles },\n this.state.isLoading && createElement(LoadingSpinner, null),\n createElement(\"iframe\", { width: \"100%\", height: \"100%\", frameBorder: \"0\", title: this.props.iframeTitle || \"Calendly Scheduling Page\", onLoad: this.onLoad, src: src })));\n };\n return InlineWidget;\n}(Component));\n\nvar ModalContent = /** @class */ (function (_super) {\n __extends(ModalContent, _super);\n function ModalContent(props) {\n var _this = _super.call(this, props) || this;\n _this.state = {\n isLoading: true,\n };\n _this.onLoad = _this.onLoad.bind(_this);\n return _this;\n }\n ModalContent.prototype.onLoad = function () {\n this.setState({\n isLoading: false,\n });\n };\n ModalContent.prototype.render = function () {\n var src = formatCalendlyUrl({\n url: this.props.url,\n pageSettings: this.props.pageSettings,\n prefill: this.props.prefill,\n utm: this.props.utm,\n embedType: \"PopupWidget\",\n });\n return (createElement(Fragment, null,\n this.state.isLoading && createElement(LoadingSpinner, null),\n createElement(\"iframe\", { width: \"100%\", height: \"100%\", frameBorder: \"0\", title: this.props.iframeTitle || \"Calendly Scheduling Page\", onLoad: this.onLoad, src: src })));\n };\n return ModalContent;\n}(Component));\n\nvar Modal = (function (props) {\n if (!props.open)\n return null;\n if (!props.rootElement) {\n throw new Error('[react-calendly]: PopupModal rootElement property cannot be undefined');\n }\n return createPortal(createElement(\"div\", { className: \"calendly-overlay\" },\n createElement(\"div\", { onClick: props.onModalClose, className: \"calendly-close-overlay\" }),\n createElement(\"div\", { className: \"calendly-popup\" },\n createElement(\"div\", { className: \"calendly-popup-content\" },\n createElement(ModalContent, __assign({}, props)))),\n createElement(\"button\", { className: \"calendly-popup-close\", onClick: props.onModalClose, \"aria-label\": \"Close modal\", style: {\n display: \"block\",\n border: \"none\",\n padding: 0,\n } })), props.rootElement);\n});\n\nvar PopupButton = /** @class */ (function (_super) {\n __extends(PopupButton, _super);\n function PopupButton(props) {\n var _this = _super.call(this, props) || this;\n _this.state = {\n isOpen: false,\n };\n _this.onClick = _this.onClick.bind(_this);\n _this.onClose = _this.onClose.bind(_this);\n return _this;\n }\n PopupButton.prototype.onClick = function (e) {\n e.preventDefault();\n this.setState({\n isOpen: true,\n });\n };\n PopupButton.prototype.onClose = function (e) {\n e.stopPropagation();\n this.setState({\n isOpen: false,\n });\n };\n PopupButton.prototype.render = function () {\n return (createElement(Fragment, null,\n createElement(\"button\", { onClick: this.onClick, style: this.props.styles || {}, className: this.props.className || \"\" }, this.props.text),\n createElement(Modal, __assign({}, this.props, { open: this.state.isOpen, onModalClose: this.onClose, rootElement: this.props.rootElement }))));\n };\n return PopupButton;\n}(Component));\n\nvar PopupWidget = /** @class */ (function (_super) {\n __extends(PopupWidget, _super);\n function PopupWidget(props) {\n var _this = _super.call(this, props) || this;\n _this.state = {\n isOpen: false,\n };\n _this.onClick = _this.onClick.bind(_this);\n _this.onClose = _this.onClose.bind(_this);\n return _this;\n }\n PopupWidget.prototype.onClick = function () {\n this.setState({\n isOpen: true,\n });\n };\n PopupWidget.prototype.onClose = function (e) {\n e.stopPropagation();\n this.setState({\n isOpen: false,\n });\n };\n PopupWidget.prototype.render = function () {\n return (createElement(\"div\", { className: \"calendly-badge-widget\", onClick: this.onClick },\n createElement(\"div\", { className: \"calendly-badge-content\", style: {\n background: this.props.color || \"#00a2ff\",\n color: this.props.textColor || \"#ffffff\",\n } },\n this.props.text || \"Schedule time with me\",\n this.props.branding && createElement(\"span\", null, \"powered by Calendly\")),\n createElement(Modal, __assign({}, this.props, { open: this.state.isOpen, onModalClose: this.onClose, rootElement: this.props.rootElement }))));\n };\n return PopupWidget;\n}(Component));\n\nvar EVENT_NAME = \"message\";\nfunction useCalendlyEventListener(eventHandlers) {\n var _a = eventHandlers || {}, onDateAndTimeSelected = _a.onDateAndTimeSelected, onEventScheduled = _a.onEventScheduled, onEventTypeViewed = _a.onEventTypeViewed, onProfilePageViewed = _a.onProfilePageViewed;\n useEffect(function () {\n var onMessage = function (e) {\n var eventName = e.data.event;\n if (eventName === CalendlyEvent.DATE_AND_TIME_SELECTED) {\n onDateAndTimeSelected && onDateAndTimeSelected(e);\n }\n else if (eventName === CalendlyEvent.EVENT_SCHEDULED) {\n onEventScheduled && onEventScheduled(e);\n }\n else if (eventName === CalendlyEvent.EVENT_TYPE_VIEWED) {\n onEventTypeViewed && onEventTypeViewed(e);\n }\n else if (eventName === CalendlyEvent.PROFILE_PAGE_VIEWED) {\n onProfilePageViewed && onProfilePageViewed(e);\n }\n };\n window.addEventListener(EVENT_NAME, onMessage);\n return function cleanup() {\n window.removeEventListener(EVENT_NAME, onMessage);\n };\n }, [eventHandlers]);\n}\n\nexport { InlineWidget, PopupButton, PopupWidget, Modal as PopupModal, useCalendlyEventListener };\n//# sourceMappingURL=index.es.js.map\n","\n","\n","import React from 'react';\nimport { string } from 'prop-types';\nimport { IconDocumentListBulletFilled, IconInfoCircleFilled } from '@jotforminc/svg-icons';\nimport { t } from '@jotforminc/translation';\n\nconst EmptyUrlAlert = ({ height }) => {\n return (\n
{t('You haven\\'t finished configuring Calendly widget.')}
\n\n {t('Go to')}\n \n {t('Widget Settings')}\n \n {t('to add your Calendly Event URL.')}\n
\n{t('This element won\\'t be visible until you add your Calendly URL')}
\n