diff --git a/pr-preview/pr-222/demo-minimal-js.bundle.js b/pr-preview/pr-222/demo-minimal-js.bundle.js index 530e954..52a0faa 100644 --- a/pr-preview/pr-222/demo-minimal-js.bundle.js +++ b/pr-preview/pr-222/demo-minimal-js.bundle.js @@ -26,47 +26,127 @@ return /******/ (() => { // webpackBootstrap \******************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ answerCall: () => (/* binding */ answerCall),\n/* harmony export */ completeCall: () => (/* binding */ completeCall),\n/* harmony export */ endCall: () => (/* binding */ endCall),\n/* harmony export */ incomingCall: () => (/* binding */ incomingCall),\n/* harmony export */ initialize: () => (/* binding */ initialize),\n/* harmony export */ logIn: () => (/* binding */ logIn),\n/* harmony export */ logOut: () => (/* binding */ logOut),\n/* harmony export */ outgoingCall: () => (/* binding */ outgoingCall),\n/* harmony export */ publishToChannel: () => (/* binding */ publishToChannel),\n/* harmony export */ resizeWidget: () => (/* binding */ resizeWidget),\n/* harmony export */ sendError: () => (/* binding */ sendError),\n/* harmony export */ state: () => (/* binding */ state),\n/* harmony export */ userAvailable: () => (/* binding */ userAvailable),\n/* harmony export */ userUnavailable: () => (/* binding */ userUnavailable)\n/* harmony export */ });\n/* harmony import */ var _src_CallingExtensions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../src/CallingExtensions */ \"../../src/CallingExtensions.js\");\n/* harmony import */ var _src_Constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../src/Constants */ \"../../src/Constants.js\");\n/* eslint-disable import/no-relative-packages */\n\n\n// import CallingExtensions, { Constants } from \"@hubspot/calling-extensions-sdk\";\n// const { messageType, callEndStatus } = Constants;\n\nconst state = {\n engagementId: 0,\n fromNumber: \"+123456\",\n incomingContactName: \"\",\n toNumber: \"+1234\",\n userAvailable: false,\n userId: 0,\n enforceButtonsOrder: false,\n ownerId: 0,\n};\n\nconst sizeInfo = {\n width: 400,\n height: 650,\n};\n\n/** Button IDs */\nconst ANSWER_CALL = \"answercall\";\nconst COMPLETE_CALL = \"completecall\";\nconst END_CALL = \"endcall\";\nconst INCOMING_CALL = \"incomingcall\";\nconst INITIALIZE = \"initialize\";\nconst LOG_IN = \"login\";\nconst LOG_OUT = \"logout\";\nconst OUTGOING_CALL = \"outgoingcall\";\nconst RESIZE_WIDGET = \"resizewidget\";\nconst SEND_ERROR = \"senderror\";\nconst USER_AVAILABLE = \"useravailable\";\nconst USER_UNAVAILABLE = \"userunavailable\";\n\nfunction disableButtons(ids) {\n if (!state.enforceButtonsOrder) {\n return;\n }\n ids.forEach(id => {\n document.querySelector(`#${id}`).setAttribute(\"disabled\", true);\n });\n}\n\nfunction enableButtons(ids) {\n if (!state.enforceButtonsOrder) {\n return;\n }\n ids.forEach(id => {\n document.querySelector(`#${id}`).removeAttribute(\"disabled\");\n });\n}\n\nconst cti = new _src_CallingExtensions__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n debugMode: true,\n eventHandlers: {\n onReady: ({ engagementId, portalId, userId, ownerId } = {}) => {\n cti.initialized({\n engagementId,\n isLoggedIn: false,\n sizeInfo,\n });\n disableButtons([\n INITIALIZE,\n USER_AVAILABLE,\n USER_UNAVAILABLE,\n OUTGOING_CALL,\n INCOMING_CALL,\n ANSWER_CALL,\n END_CALL,\n COMPLETE_CALL,\n LOG_OUT,\n ]);\n if (engagementId) {\n enableButtons([ANSWER_CALL, END_CALL]);\n state.engagementId = engagementId;\n return;\n }\n enableButtons([LOG_IN, SEND_ERROR, RESIZE_WIDGET]);\n if (portalId) {\n state.portalId = portalId;\n }\n if (userId) {\n state.userId = userId;\n }\n if (ownerId) {\n state.ownerId = ownerId;\n }\n },\n onDialNumber: (data, rawEvent) => {\n const { phoneNumber } = data;\n state.toNumber = phoneNumber;\n },\n onEngagementCreated: (data, rawEvent) => {\n const { engagementId } = data;\n state.engagementId = engagementId;\n },\n onEndCall: () => {\n window.setTimeout(() => {\n cti.callEnded();\n }, 500);\n },\n onVisibilityChanged: (data, rawEvent) => {\n /** The cti's visibility has changed. */\n },\n onCreateEngagementSucceeded: (data, rawEvent) => {\n const { engagementId } = data;\n state.engagementId = engagementId;\n },\n onCreateEngagementFailed: (data, rawEvent) => {\n /** HubSpot was unable to create an engagement for this call. */\n },\n onUpdateEngagementSucceeded: (data, rawEvent) => {\n const { engagementId } = data;\n state.engagementId = engagementId;\n },\n onUpdateEngagementFailed: (data, rawEvent) => {\n /** HubSpot was unable to update the engagement for this call. */\n },\n onCallerIdMatchSucceeded: (data, rawEvent) => {\n const { callerIdMatches } = data;\n if (callerIdMatches.length) {\n const firstCallerIdMatch = callerIdMatches[0];\n if (firstCallerIdMatch.callerIdType === \"CONTACT\") {\n state.incomingContactName = `${firstCallerIdMatch.firstName} ${firstCallerIdMatch.lastName}`;\n } else if (firstCallerIdMatch.callerIdType === \"COMPANY\") {\n state.incomingContactName = firstCallerIdMatch.name;\n }\n cti.logDebugMessage({\n message: `Incoming call from ${state.incomingContactName} ${state.fromNumber}`,\n type: `${callerIdMatches.length} Caller ID Matches`,\n });\n cti.navigateToRecord({\n objectCoordinates: firstCallerIdMatch.objectCoordinates,\n });\n return;\n }\n cti.logDebugMessage({\n message: `Incoming call from ${state.fromNumber}`,\n type: \"No Caller ID Matches\",\n });\n },\n onCallerIdMatchFailed: (data, rawEvent) => {\n cti.logDebugMessage({\n message: `Incoming call from ${state.fromNumber}`,\n type: \"Caller ID Match Failed\",\n });\n },\n onNavigateToRecordFailed: (data, rawEvent) => {\n /** HubSpot was unable to navigate to the desired record page. */\n },\n onPublishToChannelFailed: (data, rawEvent) => {\n /** HubSpot was unable to publish the call to the connected channel. */\n },\n onPublishToChannelSucceeded: (data, rawEvent) => {\n /** HubSpot successfully published the call to the connected channel. */\n },\n },\n});\n\nfunction initialize() {\n cti.initialized({\n isLoggedIn: false,\n });\n disableButtons([\n INITIALIZE,\n USER_AVAILABLE,\n USER_UNAVAILABLE,\n OUTGOING_CALL,\n INCOMING_CALL,\n ANSWER_CALL,\n END_CALL,\n COMPLETE_CALL,\n LOG_OUT,\n ]);\n enableButtons([LOG_IN, SEND_ERROR, RESIZE_WIDGET]);\n}\n\nfunction logIn() {\n cti.userLoggedIn();\n disableButtons([LOG_IN, INITIALIZE]);\n enableButtons([LOG_OUT, OUTGOING_CALL]);\n if (state.userAvailable) {\n disableButtons([USER_AVAILABLE]);\n enableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n } else {\n disableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([USER_AVAILABLE]);\n }\n}\n\nfunction logOut() {\n cti.userLoggedOut();\n disableButtons([\n LOG_OUT,\n OUTGOING_CALL,\n INCOMING_CALL,\n ANSWER_CALL,\n END_CALL,\n COMPLETE_CALL,\n USER_AVAILABLE,\n USER_UNAVAILABLE,\n ]);\n enableButtons([LOG_IN]);\n}\n\nfunction userAvailable() {\n cti.userAvailable();\n state.userAvailable = true;\n disableButtons([USER_AVAILABLE]);\n enableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n}\n\nfunction userUnavailable() {\n cti.userUnavailable();\n state.userAvailable = false;\n disableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([USER_AVAILABLE]);\n}\n\nfunction incomingCall() {\n window.setTimeout(() => {\n cti.incomingCall({\n createEngagement: true,\n fromNumber: state.fromNumber,\n toNumber: state.toNumber,\n });\n }, 500);\n disableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([ANSWER_CALL, END_CALL]);\n}\n\nfunction outgoingCall() {\n window.setTimeout(() => {\n cti.outgoingCall({\n createEngagement: true,\n toNumber: state.toNumber,\n fromNumber: state.fromNumber,\n });\n }, 500);\n disableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([ANSWER_CALL, END_CALL]);\n}\n\nfunction answerCall() {\n cti.callAnswered();\n disableButtons([ANSWER_CALL]);\n}\n\nfunction endCall() {\n cti.callEnded({\n callEndStatus: _src_Constants__WEBPACK_IMPORTED_MODULE_1__.callEndStatus.INTERNAL_COMPLETED,\n });\n disableButtons([ANSWER_CALL, END_CALL]);\n enableButtons([COMPLETE_CALL]);\n}\n\nfunction completeCall() {\n cti.callCompleted({\n engagementId: state.engagementId,\n hideWidget: false,\n engagementProperties: {\n hs_call_title: \"Demo call\",\n hs_call_body: \"Resolved issue\",\n },\n });\n disableButtons([COMPLETE_CALL]);\n enableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);\n}\n\nfunction sendError() {\n cti.sendError({\n type: _src_Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.ERROR,\n message: \"This is an error alert shown in the Hubspot UI\",\n });\n}\n\nfunction resizeWidget() {\n sizeInfo.width += 20;\n sizeInfo.height += 20;\n cti.resizeWidget({\n width: sizeInfo.width,\n height: sizeInfo.height,\n });\n}\n\nfunction publishToChannel(data) {\n state.engagementId = data && data.engagementId;\n cti.publishToChannel(data);\n}\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ answerCall: () => (/* binding */ answerCall),\n/* harmony export */ completeCall: () => (/* binding */ completeCall),\n/* harmony export */ endCall: () => (/* binding */ endCall),\n/* harmony export */ incomingCall: () => (/* binding */ incomingCall),\n/* harmony export */ initialize: () => (/* binding */ initialize),\n/* harmony export */ logIn: () => (/* binding */ logIn),\n/* harmony export */ logOut: () => (/* binding */ logOut),\n/* harmony export */ outgoingCall: () => (/* binding */ outgoingCall),\n/* harmony export */ publishToChannel: () => (/* binding */ publishToChannel),\n/* harmony export */ resizeWidget: () => (/* binding */ resizeWidget),\n/* harmony export */ sendError: () => (/* binding */ sendError),\n/* harmony export */ state: () => (/* binding */ state),\n/* harmony export */ userAvailable: () => (/* binding */ userAvailable),\n/* harmony export */ userUnavailable: () => (/* binding */ userUnavailable)\n/* harmony export */ });\n/* harmony import */ var _hubspot_calling_extensions_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hubspot/calling-extensions-sdk */ \"./node_modules/@hubspot/calling-extensions-sdk/index.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n\n\nconst { messageType, callEndStatus } = _hubspot_calling_extensions_sdk__WEBPACK_IMPORTED_MODULE_0__.Constants;\n\nconst state = {\n externalCallId: \"\",\n engagementId: 0,\n fromNumber: \"+123456\",\n incomingContactName: \"\",\n toNumber: \"+1234\",\n userAvailable: false,\n userId: 0,\n enforceButtonsOrder: false,\n ownerId: 0,\n};\n\nconst sizeInfo = {\n width: 400,\n height: 650,\n};\n\n/** Button IDs */\nconst ANSWER_CALL = \"answercall\";\nconst COMPLETE_CALL = \"completecall\";\nconst END_CALL = \"endcall\";\nconst INCOMING_CALL = \"incomingcall\";\nconst INITIALIZE = \"initialize\";\nconst LOG_IN = \"login\";\nconst LOG_OUT = \"logout\";\nconst OUTGOING_CALL = \"outgoingcall\";\nconst RESIZE_WIDGET = \"resizewidget\";\nconst SEND_ERROR = \"senderror\";\nconst USER_AVAILABLE = \"useravailable\";\nconst USER_UNAVAILABLE = \"userunavailable\";\n\nfunction disableButtons(ids) {\n if (!state.enforceButtonsOrder) {\n return;\n }\n ids.forEach(id => {\n document.querySelector(`#${id}`).setAttribute(\"disabled\", true);\n });\n}\n\nfunction enableButtons(ids) {\n if (!state.enforceButtonsOrder) {\n return;\n }\n ids.forEach(id => {\n document.querySelector(`#${id}`).removeAttribute(\"disabled\");\n });\n}\n\nconst cti = new _hubspot_calling_extensions_sdk__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n debugMode: true,\n eventHandlers: {\n // eslint-disable-next-line object-curly-newline\n onReady: ({ engagementId, portalId, userId, ownerId } = {}) => {\n cti.initialized({\n engagementId,\n isLoggedIn: false,\n sizeInfo,\n });\n disableButtons([\n INITIALIZE,\n USER_AVAILABLE,\n USER_UNAVAILABLE,\n OUTGOING_CALL,\n INCOMING_CALL,\n ANSWER_CALL,\n END_CALL,\n COMPLETE_CALL,\n LOG_OUT,\n ]);\n if (engagementId) {\n enableButtons([ANSWER_CALL, END_CALL]);\n state.engagementId = engagementId;\n return;\n }\n enableButtons([LOG_IN, SEND_ERROR, RESIZE_WIDGET]);\n if (portalId) {\n state.portalId = portalId;\n }\n if (userId) {\n state.userId = userId;\n }\n if (ownerId) {\n state.ownerId = ownerId;\n }\n },\n onDialNumber: (data, rawEvent) => {\n const { phoneNumber } = data;\n state.toNumber = phoneNumber;\n },\n onEngagementCreated: (data, rawEvent) => {\n const { engagementId } = data;\n state.engagementId = engagementId;\n },\n onEndCall: () => {\n window.setTimeout(() => {\n cti.callEnded();\n }, 500);\n },\n onVisibilityChanged: (data, rawEvent) => {\n /** The cti's visibility has changed. */\n },\n onCreateEngagementSucceeded: (data, rawEvent) => {\n const { engagementId } = data;\n state.engagementId = engagementId;\n },\n onCreateEngagementFailed: (data, rawEvent) => {\n /** HubSpot was unable to create an engagement for this call. */\n },\n onUpdateEngagementSucceeded: (data, rawEvent) => {\n const { engagementId } = data;\n state.engagementId = engagementId;\n },\n onUpdateEngagementFailed: (data, rawEvent) => {\n /** HubSpot was unable to update the engagement for this call. */\n },\n onCallerIdMatchSucceeded: (data, rawEvent) => {\n const { callerIdMatches } = data;\n if (callerIdMatches.length) {\n const firstCallerIdMatch = callerIdMatches[0];\n if (firstCallerIdMatch.callerIdType === \"CONTACT\") {\n state.incomingContactName = `${firstCallerIdMatch.firstName} ${firstCallerIdMatch.lastName}`;\n } else if (firstCallerIdMatch.callerIdType === \"COMPANY\") {\n state.incomingContactName = firstCallerIdMatch.name;\n }\n cti.logDebugMessage({\n message: `Incoming call from ${state.incomingContactName} ${state.fromNumber}`,\n type: `${callerIdMatches.length} Caller ID Matches`,\n });\n cti.navigateToRecord({\n objectCoordinates: firstCallerIdMatch.objectCoordinates,\n });\n return;\n }\n cti.logDebugMessage({\n message: `Incoming call from ${state.fromNumber}`,\n type: \"No Caller ID Matches\",\n });\n },\n onCallerIdMatchFailed: (data, rawEvent) => {\n cti.logDebugMessage({\n message: `Incoming call from ${state.fromNumber}`,\n type: \"Caller ID Match Failed\",\n });\n },\n onNavigateToRecordFailed: (data, rawEvent) => {\n /** HubSpot was unable to navigate to the desired record page. */\n },\n onPublishToChannelFailed: (data, rawEvent) => {\n /** HubSpot was unable to publish the call to the connected channel. */\n },\n onPublishToChannelSucceeded: (data, rawEvent) => {\n /** HubSpot successfully published the call to the connected channel. */\n },\n },\n});\n\nfunction initialize() {\n cti.initialized({\n isLoggedIn: false,\n });\n disableButtons([\n INITIALIZE,\n USER_AVAILABLE,\n USER_UNAVAILABLE,\n OUTGOING_CALL,\n INCOMING_CALL,\n ANSWER_CALL,\n END_CALL,\n COMPLETE_CALL,\n LOG_OUT,\n ]);\n enableButtons([LOG_IN, SEND_ERROR, RESIZE_WIDGET]);\n}\n\nfunction logIn() {\n cti.userLoggedIn();\n disableButtons([LOG_IN, INITIALIZE]);\n enableButtons([LOG_OUT, OUTGOING_CALL]);\n if (state.userAvailable) {\n disableButtons([USER_AVAILABLE]);\n enableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n } else {\n disableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([USER_AVAILABLE]);\n }\n}\n\nfunction logOut() {\n cti.userLoggedOut();\n disableButtons([\n LOG_OUT,\n OUTGOING_CALL,\n INCOMING_CALL,\n ANSWER_CALL,\n END_CALL,\n COMPLETE_CALL,\n USER_AVAILABLE,\n USER_UNAVAILABLE,\n ]);\n enableButtons([LOG_IN]);\n}\n\nfunction userAvailable() {\n cti.userAvailable();\n state.userAvailable = true;\n disableButtons([USER_AVAILABLE]);\n enableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n}\n\nfunction userUnavailable() {\n cti.userUnavailable();\n state.userAvailable = false;\n disableButtons([INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([USER_AVAILABLE]);\n}\n\nfunction incomingCall() {\n state.externalCallId = (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n window.setTimeout(() => {\n cti.incomingCall({\n createEngagement: true,\n fromNumber: state.fromNumber,\n toNumber: state.toNumber,\n externalCallId: state.externalCallId,\n });\n }, 500);\n disableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([ANSWER_CALL, END_CALL]);\n}\n\nfunction outgoingCall() {\n state.externalCallId = (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n window.setTimeout(() => {\n cti.outgoingCall({\n createEngagement: true,\n toNumber: state.toNumber,\n fromNumber: state.fromNumber,\n externalCallId: state.externalCallId,\n });\n }, 500);\n disableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);\n enableButtons([ANSWER_CALL, END_CALL]);\n}\n\nfunction answerCall() {\n cti.callAnswered({ externalCallId: state.externalCallId });\n disableButtons([ANSWER_CALL]);\n}\n\nfunction endCall() {\n cti.callEnded({\n callEndStatus: callEndStatus.INTERNAL_COMPLETED,\n externalCallId: state.externalCallId,\n });\n disableButtons([ANSWER_CALL, END_CALL]);\n enableButtons([COMPLETE_CALL]);\n}\n\nfunction completeCall() {\n cti.callCompleted({\n engagementId: state.engagementId,\n externalCallId: state.externalCallId,\n hideWidget: false,\n engagementProperties: {\n hs_call_title: \"Demo call\",\n hs_call_body: \"Resolved issue\",\n },\n });\n state.externalCallId = \"\";\n disableButtons([COMPLETE_CALL]);\n enableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);\n}\n\nfunction sendError() {\n cti.sendError({\n type: messageType.ERROR,\n message: \"This is an error alert shown in the Hubspot UI\",\n });\n}\n\nfunction resizeWidget() {\n sizeInfo.width += 20;\n sizeInfo.height += 20;\n cti.resizeWidget({\n width: sizeInfo.width,\n height: sizeInfo.height,\n });\n}\n\nfunction publishToChannel(data) {\n state.engagementId = data && data.engagementId;\n cti.publishToChannel(data);\n}\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./index.js?"); /***/ }), -/***/ "../../src/CallingExtensions.js": -/*!**************************************!*\ - !*** ../../src/CallingExtensions.js ***! - \**************************************/ +/***/ "./node_modules/@hubspot/calling-extensions-sdk/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/@hubspot/calling-extensions-sdk/index.js ***! + \***************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _IFrameManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IFrameManager */ \"../../src/IFrameManager.js\");\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants */ \"../../src/Constants.js\");\n// @ts-check\n\n\"use es6\";\n\n\n\n\nconst prefix = `[calling-extensions-sdk@${_Constants__WEBPACK_IMPORTED_MODULE_1__.VERSION}]`;\n\n/*\n * CallingExtensions allows call providers to communicate with HubSpot.\n */\nclass CallingExtensions {\n /**\n * @param {import('./typedefs').Options} options\n */\n constructor(options) {\n if (!options || !options.eventHandlers) {\n throw new Error(\"Invalid options or missing eventHandlers.\");\n }\n\n this.options = options;\n\n this.iFrameManager = new _IFrameManager__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n iFrameOptions: options.iFrameOptions,\n debugMode: options.debugMode,\n onMessageHandler: (/** @type {any} */ event) =>\n // eslint-disable-next-line implicit-arrow-linebreak\n this.onMessageHandler(event),\n });\n }\n\n /**\n * Send a message indicating that the soft phone is ready for interaction.\n *\n * @param {import('./typedefs').OnInitialized} payload\n */\n initialized(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.INITIALIZED,\n data: payload,\n });\n }\n\n /**\n * Event when user's availability is changed to available\n */\n userAvailable() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.USER_AVAILABLE,\n });\n }\n\n /**\n * Event when user's availability is changed to unavailable\n */\n userUnavailable() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.USER_UNAVAILABLE,\n });\n }\n\n /**\n * Sends a message indicating that the user has logged in.\n */\n userLoggedIn() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.LOGGED_IN,\n });\n }\n\n /**\n * Sends a message indicating that the user has logged out.\n */\n userLoggedOut() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.LOGGED_OUT,\n });\n }\n\n /**\n * Event when incoming call is received.\n *\n * @param {import('./typedefs').OnIncomingCall} callInfo\n */\n incomingCall(callInfo) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.INCOMING_CALL,\n data: callInfo,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that an outgoing call has started.\n *\n * @param {import('./typedefs').OnOutgoingCall} callInfo\n */\n outgoingCall(callInfo) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.OUTGOING_CALL_STARTED,\n data: callInfo,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that a call is being answered.\n *\n * @param {import('./typedefs').OnCallAnswered} payload\n */\n callAnswered(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_ANSWERED,\n data: payload,\n });\n }\n\n /**\n * Event to navigate to record page.\n *\n * @param {import('./typedefs').OnNavigateToRecord} payload\n */\n navigateToRecord(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.NAVIGATE_TO_RECORD,\n data: payload,\n });\n }\n\n /**\n * @param {any} payload\n */\n callData(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_DATA,\n data: payload,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the call has ended.\n *\n * @param {import('./typedefs').OnCallEnded} data\n */\n callEnded(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_ENDED,\n data,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the call has completed.\n *\n * @param {import('./typedefs').OnCallCompleted} data\n */\n callCompleted(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_COMPLETED,\n data,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the calling app has encountered an error.\n * @param {import('./typedefs').OnError} data\n */\n sendError(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.ERROR,\n data,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the calling app needs to be resized.\n *\n * @param {import('./typedefs').OnResize} data\n */\n resizeWidget(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.RESIZE_WIDGET,\n data,\n });\n }\n\n /**\n *\n * @param {import('./typedefs').OnMessage} message\n */\n sendMessage(message) {\n this.iFrameManager.sendMessage(message);\n }\n\n /**\n *\n * @param {{message: string, type: string}} param0\n */\n logDebugMessage({ message, type = _Constants__WEBPACK_IMPORTED_MODULE_1__.debugMessageType.GENERIC_MESSAGE }) {\n this.iFrameManager.logDebugMessage(prefix, type, message);\n }\n\n /**\n * @param {{ type: keyof import('./typedefs').EventHandlers; data: any; }} event\n */\n onMessageHandler(event) {\n const { type, data } = event;\n const { eventHandlers } = this.options;\n\n let handler;\n if (type in _Constants__WEBPACK_IMPORTED_MODULE_1__.messageHandlerNames) {\n const name = _Constants__WEBPACK_IMPORTED_MODULE_1__.messageHandlerNames[type];\n handler = eventHandlers[name];\n } else {\n // Send back a message indicating an unknown event is received\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.ERROR,\n data: {\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.errorType.UNKNOWN_MESSAGE_TYPE,\n data: {\n originalMessage: event,\n },\n },\n });\n }\n\n handler = handler || eventHandlers.defaultEventHandler;\n if (handler) {\n handler(data, event);\n } else {\n console.error(\n `No event handler is available to handle message of type: ${type}`,\n );\n }\n }\n\n /**\n * Publishes the call to a connected channel.\n *\n * @param {import('./typedefs').OnPublishToChannel} data - The data object to be published.\n */\n publishToChannel(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.PUBLISH_TO_CHANNEL,\n data,\n });\n }\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CallingExtensions);\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/../../src/CallingExtensions.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Constants: () => (/* reexport module object */ _src_Constants__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ IFrameManager: () => (/* reexport safe */ _src_IFrameManager__WEBPACK_IMPORTED_MODULE_2__[\"default\"]),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _src_CallingExtensions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/CallingExtensions */ \"./node_modules/@hubspot/calling-extensions-sdk/src/CallingExtensions.js\");\n/* harmony import */ var _src_Constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/Constants */ \"./node_modules/@hubspot/calling-extensions-sdk/src/Constants.js\");\n/* harmony import */ var _src_IFrameManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/IFrameManager */ \"./node_modules/@hubspot/calling-extensions-sdk/src/IFrameManager.js\");\n/* harmony import */ var _src_typedefs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./src/typedefs */ \"./node_modules/@hubspot/calling-extensions-sdk/src/typedefs.js\");\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_src_CallingExtensions__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/@hubspot/calling-extensions-sdk/index.js?"); /***/ }), -/***/ "../../src/Constants.js": -/*!******************************!*\ - !*** ../../src/Constants.js ***! - \******************************/ +/***/ "./node_modules/@hubspot/calling-extensions-sdk/src/CallingExtensions.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@hubspot/calling-extensions-sdk/src/CallingExtensions.js ***! + \*******************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ COMPANY: () => (/* binding */ COMPANY),\n/* harmony export */ CONTACT: () => (/* binding */ CONTACT),\n/* harmony export */ VERSION: () => (/* binding */ VERSION),\n/* harmony export */ callEndStatus: () => (/* binding */ callEndStatus),\n/* harmony export */ callEndingStatus: () => (/* binding */ callEndingStatus),\n/* harmony export */ callInProgressStatus: () => (/* binding */ callInProgressStatus),\n/* harmony export */ callRingingStatus: () => (/* binding */ callRingingStatus),\n/* harmony export */ callStatus: () => (/* binding */ callStatus),\n/* harmony export */ callerIdTypes: () => (/* binding */ callerIdTypes),\n/* harmony export */ debugMessageType: () => (/* binding */ debugMessageType),\n/* harmony export */ errorType: () => (/* binding */ errorType),\n/* harmony export */ messageHandlerNames: () => (/* binding */ messageHandlerNames),\n/* harmony export */ messageType: () => (/* binding */ messageType)\n/* harmony export */ });\n/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../package.json */ \"../../package.json\");\n\"use es6\";\n\n\n\nconst VERSION = _package_json__WEBPACK_IMPORTED_MODULE_0__.version;\n\nconst debugMessageType = {\n FROM_HUBSPOT: \"From HubSpot\",\n TO_HUBSPOT: \"To HubSpot\",\n GENERIC_MESSAGE: \"Generic Message\",\n};\n\nconst thirdPartyToHostEvents = {\n CALL_ANSWERED: \"CALL_ANSWERED\",\n CALL_COMPLETED: \"CALL_COMPLETED\",\n CALL_DATA: \"CALL_DATA\",\n CALL_ENDED: \"CALL_ENDED\",\n INCOMING_CALL: \"INCOMING_CALL\",\n INITIALIZED: \"INITIALIZED\",\n LOGGED_IN: \"LOGGED_IN\",\n LOGGED_OUT: \"LOGGED_OUT\",\n NAVIGATE_TO_RECORD: \"NAVIGATE_TO_RECORD\",\n OUTGOING_CALL_STARTED: \"OUTGOING_CALL_STARTED\",\n PUBLISH_TO_CHANNEL: \"PUBLISH_TO_CHANNEL\",\n RESIZE_WIDGET: \"RESIZE_WIDGET\",\n USER_AVAILABLE: \"USER_AVAILABLE\",\n USER_UNAVAILABLE: \"USER_UNAVAILABLE\",\n};\n\nconst hostToThirdPartyEvents = {\n CALLER_ID_MATCH_FAILED: \"CALLER_ID_MATCH_FAILED\",\n CALLER_ID_MATCH_SUCCEEDED: \"CALLER_ID_MATCH_SUCCEEDED\",\n CREATE_ENGAGEMENT_FAILED: \"CREATE_ENGAGEMENT_FAILED\",\n CREATE_ENGAGEMENT_SUCCEEDED: \"CREATE_ENGAGEMENT_SUCCEEDED\",\n DIAL_NUMBER: \"DIAL_NUMBER\",\n /** @deprecated use CREATE_ENGAGEMENT_SUCCEEDED instead */\n ENGAGEMENT_CREATED: \"ENGAGEMENT_CREATED\",\n NAVIGATE_TO_RECORD_FAILED: \"NAVIGATE_TO_RECORD_FAILED\",\n PUBLISH_TO_CHANNEL_FAILED: \"PUBLISH_TO_CHANNEL_FAILED\",\n PUBLISH_TO_CHANNEL_SUCCEEDED: \"PUBLISH_TO_CHANNEL_SUCCEEDED\",\n UPDATE_ENGAGEMENT_FAILED: \"UPDATE_ENGAGEMENT_FAILED\",\n UPDATE_ENGAGEMENT_SUCCEEDED: \"UPDATE_ENGAGEMENT_SUCCEEDED\",\n VISIBILITY_CHANGED: \"VISIBILITY_CHANGED\",\n INITIATE_CALL_ID_SUCCEEDED: \"INITIATE_CALL_ID_SUCCEEDED\",\n INITIATE_CALL_ID_FAILED: \"INITIATE_CALL_ID_FAILED\",\n};\n\nconst messageType = {\n ...thirdPartyToHostEvents,\n ...hostToThirdPartyEvents,\n END_CALL: \"END_CALL\",\n ERROR: \"ERROR\",\n READY: \"READY\",\n SET_CALL_STATE: \"SET_CALL_STATE\",\n SET_WIDGET_URL: \"SET_WIDGET_URL\",\n SYNC_ACK_FAILED: \"SYNC_ACK_FAILED\",\n SYNC_ACK: \"SYNC_ACK\",\n SYNC: \"SYNC\",\n UNLOADING: \"UNLOADING\",\n};\n\n/**\n * @type {{ [key: string]: keyof import('./typedefs').EventHandlers }}\n */\nconst messageHandlerNames = {\n [messageType.CALLER_ID_MATCH_FAILED]: \"onCallerIdMatchFailed\",\n [messageType.CALLER_ID_MATCH_SUCCEEDED]: \"onCallerIdMatchSucceeded\",\n [messageType.CREATE_ENGAGEMENT_FAILED]: \"onCreateEngagementFailed\",\n [messageType.CREATE_ENGAGEMENT_SUCCEEDED]: \"onCreateEngagementSucceeded\",\n [messageType.DIAL_NUMBER]: \"onDialNumber\",\n [messageType.END_CALL]: \"onEndCall\",\n [messageType.ENGAGEMENT_CREATED]: \"onEngagementCreated\",\n [messageType.NAVIGATE_TO_RECORD_FAILED]: \"onNavigateToRecordFailed\",\n [messageType.PUBLISH_TO_CHANNEL_FAILED]: \"onPublishToChannelFailed\",\n [messageType.PUBLISH_TO_CHANNEL_SUCCEEDED]: \"onPublishToChannelSucceeded\",\n [messageType.READY]: \"onReady\",\n [messageType.SET_CALL_STATE]: \"onSetCallState\",\n [messageType.UPDATE_ENGAGEMENT_FAILED]: \"onUpdateEngagementFailed\",\n [messageType.UPDATE_ENGAGEMENT_SUCCEEDED]: \"onUpdateEngagementSucceeded\",\n [messageType.VISIBILITY_CHANGED]: \"onVisibilityChanged\",\n [messageType.INITIATE_CALL_ID_SUCCEEDED]: \"onInitiateCallIdSucceeded\",\n [messageType.INITIATE_CALL_ID_FAILED]: \"onInitiateCallIdFailed\",\n};\n\nconst errorType = {\n UNKNOWN_MESSAGE_TYPE: \"UNKNOWN_MESSAGE_TYPE\",\n};\n\n/** These are potential statuses from the BE client when calling from phone\n * or detecting that a call has ended in the linked engagement */\n\nconst INTERNAL_CONNECTING = \"CONNECTING\";\nconst INTERNAL_CALLING_CRM_USER = \"CALLING_CRM_USER\";\nconst INTERNAL_IN_PROGRESS = \"IN_PROGRESS\";\nconst INTERNAL_CANCELED = \"CANCELED\";\nconst INTERNAL_FAILED = \"FAILED\";\nconst INTERNAL_BUSY = \"BUSY\";\nconst INTERNAL_NO_ANSWER = \"NO_ANSWER\";\nconst INTERNAL_COMPLETED = \"COMPLETED\";\nconst INTERNAL_ENDING = \"ENDING\";\nconst INTERNAL_QUEUED = \"QUEUED\";\nconst INTERNAL_RINGING = \"RINGING\";\n\nconst callStatus = {\n INTERNAL_CONNECTING,\n INTERNAL_CALLING_CRM_USER,\n INTERNAL_IN_PROGRESS,\n INTERNAL_CANCELED,\n INTERNAL_FAILED,\n INTERNAL_BUSY,\n INTERNAL_NO_ANSWER,\n INTERNAL_COMPLETED,\n INTERNAL_ENDING,\n INTERNAL_QUEUED,\n INTERNAL_RINGING,\n};\n\nconst callRingingStatus = {\n INTERNAL_QUEUED,\n INTERNAL_RINGING,\n INTERNAL_CONNECTING,\n INTERNAL_CALLING_CRM_USER,\n};\n\nconst callInProgressStatus = { INTERNAL_IN_PROGRESS };\n\nconst callEndingStatus = { INTERNAL_ENDING };\n\nconst callEndStatus = {\n INTERNAL_COMPLETED,\n INTERNAL_FAILED,\n INTERNAL_CANCELED,\n INTERNAL_BUSY,\n INTERNAL_NO_ANSWER,\n};\n\nconst CONTACT = \"CONTACT\";\nconst COMPANY = \"COMPANY\";\n\nconst callerIdTypes = {\n CONTACT,\n COMPANY,\n};\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/../../src/Constants.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _IFrameManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IFrameManager */ \"./node_modules/@hubspot/calling-extensions-sdk/src/IFrameManager.js\");\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants */ \"./node_modules/@hubspot/calling-extensions-sdk/src/Constants.js\");\n// @ts-check\n\n\"use es6\";\n\n\n\n\nconst prefix = `[calling-extensions-sdk@${_Constants__WEBPACK_IMPORTED_MODULE_1__.VERSION}]`;\n\n/*\n * CallingExtensions allows call providers to communicate with HubSpot.\n */\nclass CallingExtensions {\n /**\n * @param {import('./typedefs').Options} options\n */\n constructor(options) {\n if (!options || !options.eventHandlers) {\n throw new Error(\"Invalid options or missing eventHandlers.\");\n }\n\n this.options = options;\n\n this.iFrameManager = new _IFrameManager__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n iFrameOptions: options.iFrameOptions,\n debugMode: options.debugMode,\n onMessageHandler: (/** @type {any} */ event) =>\n // eslint-disable-next-line implicit-arrow-linebreak\n this.onMessageHandler(event),\n });\n }\n\n /**\n * Send a message indicating that the soft phone is ready for interaction.\n *\n * @param {import('./typedefs').OnInitialized} payload\n */\n initialized(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.INITIALIZED,\n data: payload,\n });\n }\n\n /**\n * Event when user's availability is changed to available\n */\n userAvailable() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.USER_AVAILABLE,\n });\n }\n\n /**\n * Event when user's availability is changed to unavailable\n */\n userUnavailable() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.USER_UNAVAILABLE,\n });\n }\n\n /**\n * Sends a message indicating that the user has logged in.\n */\n userLoggedIn() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.LOGGED_IN,\n });\n }\n\n /**\n * Sends a message indicating that the user has logged out.\n */\n userLoggedOut() {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.LOGGED_OUT,\n });\n }\n\n /**\n * Event when incoming call is received.\n *\n * @param {import('./typedefs').OnIncomingCall} callInfo\n */\n incomingCall(callInfo) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.INCOMING_CALL,\n data: callInfo,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that an outgoing call has started.\n *\n * @param {import('./typedefs').OnOutgoingCall} callInfo\n */\n outgoingCall(callInfo) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.OUTGOING_CALL_STARTED,\n data: callInfo,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that a call is being answered.\n *\n * @param {import('./typedefs').OnCallAnswered} payload\n */\n callAnswered(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_ANSWERED,\n data: payload,\n });\n }\n\n /**\n * Event to navigate to record page.\n *\n * @param {import('./typedefs').OnNavigateToRecord} payload\n */\n navigateToRecord(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.NAVIGATE_TO_RECORD,\n data: payload,\n });\n }\n\n /**\n * @param {any} payload\n */\n callData(payload) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_DATA,\n data: payload,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the call has ended.\n *\n * @param {import('./typedefs').OnCallEnded} data\n */\n callEnded(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_ENDED,\n data,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the call has completed.\n *\n * @param {import('./typedefs').OnCallCompleted} data\n */\n callCompleted(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.CALL_COMPLETED,\n data,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the calling app has encountered an error.\n * @param {import('./typedefs').OnError} data\n */\n sendError(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.ERROR,\n data,\n });\n }\n\n /**\n * Sends a message to notify HubSpot that the calling app needs to be resized.\n *\n * @param {import('./typedefs').OnResize} data\n */\n resizeWidget(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.RESIZE_WIDGET,\n data,\n });\n }\n\n /**\n *\n * @param {import('./typedefs').OnMessage} message\n */\n sendMessage(message) {\n this.iFrameManager.sendMessage(message);\n }\n\n /**\n *\n * @param {{message: string, type: string}} param0\n */\n logDebugMessage({ message, type = _Constants__WEBPACK_IMPORTED_MODULE_1__.debugMessageType.GENERIC_MESSAGE }) {\n this.iFrameManager.logDebugMessage(prefix, type, message);\n }\n\n /**\n * @param {{ type: keyof import('./typedefs').EventHandlers; data: any; }} event\n */\n onMessageHandler(event) {\n const { type, data } = event;\n const { eventHandlers } = this.options;\n\n let handler;\n if (type in _Constants__WEBPACK_IMPORTED_MODULE_1__.messageHandlerNames) {\n const name = _Constants__WEBPACK_IMPORTED_MODULE_1__.messageHandlerNames[type];\n handler = eventHandlers[name];\n } else {\n // Send back a message indicating an unknown event is received\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.ERROR,\n data: {\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.errorType.UNKNOWN_MESSAGE_TYPE,\n data: {\n originalMessage: event,\n },\n },\n });\n }\n\n handler = handler || eventHandlers.defaultEventHandler;\n if (handler) {\n handler(data, event);\n } else {\n console.error(\n `No event handler is available to handle message of type: ${type}`,\n );\n }\n }\n\n /**\n * Publishes the call to a connected channel.\n *\n * @param {import('./typedefs').OnPublishToChannel} data - The data object to be published.\n */\n publishToChannel(data) {\n this.sendMessage({\n type: _Constants__WEBPACK_IMPORTED_MODULE_1__.messageType.PUBLISH_TO_CHANNEL,\n data,\n });\n }\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CallingExtensions);\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/@hubspot/calling-extensions-sdk/src/CallingExtensions.js?"); /***/ }), -/***/ "../../src/IFrameManager.js": -/*!**********************************!*\ - !*** ../../src/IFrameManager.js ***! - \**********************************/ +/***/ "./node_modules/@hubspot/calling-extensions-sdk/src/Constants.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@hubspot/calling-extensions-sdk/src/Constants.js ***! + \***********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants */ \"../../src/Constants.js\");\n// @ts-check\n\n\"use es6\";\n\n\n\nconst prefix = `[calling-extensions-sdk@${_Constants__WEBPACK_IMPORTED_MODULE_0__.VERSION}]`;\n/*\n * IFrameManager abstracts the iFrame communication between the IFrameHost and an IFrame\n * An IFrameManager instance can act as part of the IFrameHost and an IFrame depending on\n * the options.\n */\nclass IFrameManager {\n /**\n *\n * @param {import('./typedefs').IframeManagerOptions} options\n */\n constructor(options) {\n /** @type {import('./typedefs').IframeManagerOptions | null} */\n this.options = options;\n const { iFrameOptions, onMessageHandler, debugMode } = options;\n\n this.onMessageHandler = onMessageHandler;\n if (!this.onMessageHandler) {\n throw new Error(\"Invalid options: onMessageHandler is not defined\");\n }\n this.isIFrameHost = !!iFrameOptions;\n this.debugMode = debugMode;\n\n // Keeps track of all the callbacks\n /** @type {{ [key: string]: Function }} */\n this.callbacks = {};\n\n this.instanceId = Date.now();\n this.instanceRegexp = new RegExp(`^${this.instanceId}`);\n this.isReady = false;\n\n this.messageHandler = (/** @type {any} */ event) => this.onMessage(event);\n window.addEventListener(\"message\", this.messageHandler);\n\n if (iFrameOptions) {\n /** @type {HTMLIFrameElement | null} */\n this.iFrame = IFrameManager.createIFrame(\n iFrameOptions,\n () => {\n this.firstSyncSent = Date.now();\n this.isReady = false;\n this.sendSync();\n },\n this.handleLoadError,\n );\n } else {\n /** @type {HTMLIFrameElement | null} */\n this.iFrame = null;\n }\n\n this.destinationWindow =\n iFrameOptions && this.iFrame ? this.iFrame.contentWindow : window.parent;\n\n this.destinationHost = IFrameManager.getDestinationHost(iFrameOptions);\n }\n\n /**\n * Creates a new message id\n * @param {string|number} instanceId\n * @returns {string}\n */\n static createMessageId(instanceId) {\n return `${instanceId}_${Date.now()}`;\n }\n\n /**\n * Gets the html element that hosts the iFrame\n * @param {string} hostElementSelector\n */\n static getHostElement(hostElementSelector) {\n const hostElement = document.querySelector(hostElementSelector);\n if (!hostElement) {\n throw new Error(\n `hostElement not found. Selector - ${hostElementSelector}`,\n );\n }\n return hostElement;\n }\n\n /**\n * @param {string} url\n */\n static extractHostFromUrl(url) {\n const a = document.createElement(\"a\");\n a.href = url;\n return `${a.protocol}//${a.host}`;\n }\n\n /**\n *\n * @param {import('./typedefs').IframeOptions} [iFrameOptions]\n */\n static getDestinationHost(iFrameOptions) {\n const url = iFrameOptions ? iFrameOptions.src : document.referrer;\n return IFrameManager.extractHostFromUrl(url);\n }\n\n handleLoadError() {\n this.onMessageHandler({\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC_ACK_FAILED,\n });\n }\n\n /**\n * @param {import('./typedefs').IframeOptions} iFrameOptions\n * @param { (this: GlobalEventHandlers, ev: Event) => any } onLoadCallback\n * @param { OnErrorEventHandler } onLoadErrorCallback\n * @returns {HTMLIFrameElement | null}\n */\n static createIFrame(iFrameOptions, onLoadCallback, onLoadErrorCallback) {\n // eslint-disable-next-line object-curly-newline\n const { src, width, height, hostElementSelector } = iFrameOptions;\n\n if (!src || !width || !height || !hostElementSelector) {\n throw new Error(\n \"iFrameOptions is missing one of the required properties - {src, width, height, hostElementSelector}.\",\n );\n }\n\n /** @type {HTMLIFrameElement} */\n const iFrame = document.createElement(\"iframe\");\n iFrame.onload = onLoadCallback;\n iFrame.onerror = onLoadErrorCallback;\n iFrame.src = src;\n iFrame.width = width;\n iFrame.height = height;\n iFrame.allow = \"microphone; autoplay\";\n iFrame.id = \"hubspot-calling-extension-iframe\";\n\n const element = IFrameManager.getHostElement(hostElementSelector);\n element.innerHTML = \"\";\n element.appendChild(iFrame);\n\n return element.querySelector(\"iframe\");\n }\n\n /**\n * @param {import('./typedefs').SizeInfo} sizeInfo\n */\n updateIFrameSize(sizeInfo) {\n const { width, height } = sizeInfo;\n const formatSize = (/** @type {number} */ size) => {\n return typeof size === \"number\" ? `${size}px` : size;\n };\n if (width && this.iFrame) {\n this.iFrame.setAttribute(\"width\", formatSize(width));\n }\n if (height && this.iFrame) {\n this.iFrame.setAttribute(\"height\", formatSize(height));\n }\n }\n\n onReady(data = {}) {\n this.isReady = true;\n this.onMessageHandler({\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.READY,\n data,\n });\n }\n\n /*\n * Unload the iFrame\n */\n remove() {\n window.removeEventListener(\"message\", this.messageHandler);\n\n if (this.iFrame && this.options && this.options.iFrameOptions) {\n const element = IFrameManager.getHostElement(\n this.options.iFrameOptions.hostElementSelector,\n );\n element.innerHTML = \"\";\n\n this.isReady = false;\n this.iFrame = null;\n this.options = null;\n }\n }\n\n /**\n * Send a message to the destination window.\n * @param {{type: string, messageId?: string|number, hostUrl?: string}} message\n * @param {function} [callback]\n */\n sendMessage(message, callback) {\n const { type } = message;\n if (type !== _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC && !this.isReady) {\n // Do not send a message unless the iFrame is ready to receive.\n console.warn(\n prefix,\n \"iFrame not initialized to send a message within HubSpot\",\n message,\n );\n return;\n }\n\n let { messageId } = message;\n if (!messageId) {\n // Initiating a new message\n messageId = IFrameManager.createMessageId(this.instanceId);\n if (callback) {\n // Keep track of the callback\n this.callbacks[messageId] = callback;\n }\n }\n\n const newMessage = Object.assign({}, message, {\n messageId,\n });\n\n this.logDebugMessage(prefix, _Constants__WEBPACK_IMPORTED_MODULE_0__.debugMessageType.TO_HUBSPOT, type, message);\n if (this.destinationWindow) {\n this.destinationWindow.postMessage(newMessage, this.destinationHost);\n }\n }\n\n /**\n * @param {{ data: any; origin?: any; }} event\n */\n onMessage(event) {\n const { data, origin } = event;\n // eslint-disable-next-line object-curly-newline\n const { type, engagementId, portalId, userId, ownerId } = event.data;\n if (type === _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC) {\n // The iFrame host can send this message multiple times, don't respond more than once\n if (!this.isReady) {\n this.isReady = true;\n\n const message = Object.assign({}, event.data, {\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC_ACK,\n debugMode: this.debugMode,\n version: _Constants__WEBPACK_IMPORTED_MODULE_0__.VERSION,\n iFrameUrl: IFrameManager.extractHostFromUrl(window.location.href),\n });\n\n const { hostUrl } = event.data;\n this.destinationHost = hostUrl || this.destinationHost;\n this.logDebugMessage(prefix, _Constants__WEBPACK_IMPORTED_MODULE_0__.debugMessageType.FROM_HUBSPOT, type, data);\n this.sendMessage(message);\n this.onReady({\n engagementId,\n portalId,\n userId,\n ownerId,\n });\n }\n return;\n }\n\n if (this.destinationHost !== origin) {\n // Ignore messages from an unknown origin\n return;\n }\n\n if (type === _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SET_WIDGET_URL) {\n const { iFrameUrl } = data;\n this.destinationHost = iFrameUrl || this.destinationHost;\n return;\n }\n\n const { messageId } = data;\n\n if (!messageId || !type) {\n return;\n }\n\n this.logDebugMessage(prefix, _Constants__WEBPACK_IMPORTED_MODULE_0__.debugMessageType.FROM_HUBSPOT, type, data);\n if (this.instanceRegexp.test(messageId)) {\n // This is a response to some message generated by HubSpot\n const callBack = this.callbacks[messageId];\n if (callBack) {\n callBack(data);\n delete this.callbacks[messageId];\n }\n return;\n }\n\n // This is a new message, let the handler handle it.\n this.onMessageHandler(data);\n }\n\n sendSync() {\n // No SYNC_ACK message after 30sec results in a failure\n if (Date.now() - this.firstSyncSent > 30000) {\n this.onMessageHandler({\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC_ACK_FAILED,\n });\n return;\n }\n\n this.sendMessage(\n {\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC,\n hostUrl: IFrameManager.extractHostFromUrl(window.location.href),\n },\n (/** @type {{ debugMode?: any; iFrameUrl?: any; }} */ eventData) => {\n const { iFrameUrl } = eventData;\n this.destinationHost = iFrameUrl || this.destinationHost;\n this.onReady();\n this.debugMode = eventData && eventData.debugMode;\n },\n );\n\n // In cases where the call widget loads the calling extensions asynchronously, message\n // handlers may not be set up - retry until a response from the iFrame\n window.setTimeout(() => {\n if (this.iFrame && !this.isReady) {\n this.sendSync();\n }\n }, 100);\n }\n\n /**\n * @param {any[]} args\n */\n logDebugMessage(...args) {\n if (this.debugMode) {\n console.log.call(null, args);\n return;\n }\n console.debug.call(null, args);\n }\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (IFrameManager);\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/../../src/IFrameManager.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ COMPANY: () => (/* binding */ COMPANY),\n/* harmony export */ CONTACT: () => (/* binding */ CONTACT),\n/* harmony export */ VERSION: () => (/* binding */ VERSION),\n/* harmony export */ callEndStatus: () => (/* binding */ callEndStatus),\n/* harmony export */ callEndingStatus: () => (/* binding */ callEndingStatus),\n/* harmony export */ callInProgressStatus: () => (/* binding */ callInProgressStatus),\n/* harmony export */ callRingingStatus: () => (/* binding */ callRingingStatus),\n/* harmony export */ callStatus: () => (/* binding */ callStatus),\n/* harmony export */ callerIdTypes: () => (/* binding */ callerIdTypes),\n/* harmony export */ debugMessageType: () => (/* binding */ debugMessageType),\n/* harmony export */ errorType: () => (/* binding */ errorType),\n/* harmony export */ messageHandlerNames: () => (/* binding */ messageHandlerNames),\n/* harmony export */ messageType: () => (/* binding */ messageType)\n/* harmony export */ });\n/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../package.json */ \"./node_modules/@hubspot/calling-extensions-sdk/package.json\");\n\"use es6\";\n\n\n\nconst VERSION = _package_json__WEBPACK_IMPORTED_MODULE_0__.version;\n\nconst debugMessageType = {\n FROM_HUBSPOT: \"From HubSpot\",\n TO_HUBSPOT: \"To HubSpot\",\n GENERIC_MESSAGE: \"Generic Message\",\n};\n\nconst thirdPartyToHostEvents = {\n CALL_ANSWERED: \"CALL_ANSWERED\",\n CALL_COMPLETED: \"CALL_COMPLETED\",\n CALL_DATA: \"CALL_DATA\",\n CALL_ENDED: \"CALL_ENDED\",\n INCOMING_CALL: \"INCOMING_CALL\",\n INITIALIZED: \"INITIALIZED\",\n LOGGED_IN: \"LOGGED_IN\",\n LOGGED_OUT: \"LOGGED_OUT\",\n NAVIGATE_TO_RECORD: \"NAVIGATE_TO_RECORD\",\n OUTGOING_CALL_STARTED: \"OUTGOING_CALL_STARTED\",\n PUBLISH_TO_CHANNEL: \"PUBLISH_TO_CHANNEL\",\n RESIZE_WIDGET: \"RESIZE_WIDGET\",\n USER_AVAILABLE: \"USER_AVAILABLE\",\n USER_UNAVAILABLE: \"USER_UNAVAILABLE\",\n};\n\nconst hostToThirdPartyEvents = {\n CALLER_ID_MATCH_FAILED: \"CALLER_ID_MATCH_FAILED\",\n CALLER_ID_MATCH_SUCCEEDED: \"CALLER_ID_MATCH_SUCCEEDED\",\n CREATE_ENGAGEMENT_FAILED: \"CREATE_ENGAGEMENT_FAILED\",\n CREATE_ENGAGEMENT_SUCCEEDED: \"CREATE_ENGAGEMENT_SUCCEEDED\",\n DIAL_NUMBER: \"DIAL_NUMBER\",\n /** @deprecated use CREATE_ENGAGEMENT_SUCCEEDED instead */\n ENGAGEMENT_CREATED: \"ENGAGEMENT_CREATED\",\n NAVIGATE_TO_RECORD_FAILED: \"NAVIGATE_TO_RECORD_FAILED\",\n PUBLISH_TO_CHANNEL_FAILED: \"PUBLISH_TO_CHANNEL_FAILED\",\n PUBLISH_TO_CHANNEL_SUCCEEDED: \"PUBLISH_TO_CHANNEL_SUCCEEDED\",\n UPDATE_ENGAGEMENT_FAILED: \"UPDATE_ENGAGEMENT_FAILED\",\n UPDATE_ENGAGEMENT_SUCCEEDED: \"UPDATE_ENGAGEMENT_SUCCEEDED\",\n VISIBILITY_CHANGED: \"VISIBILITY_CHANGED\",\n INITIATE_CALL_ID_SUCCEEDED: \"INITIATE_CALL_ID_SUCCEEDED\",\n INITIATE_CALL_ID_FAILED: \"INITIATE_CALL_ID_FAILED\",\n};\n\nconst messageType = {\n ...thirdPartyToHostEvents,\n ...hostToThirdPartyEvents,\n END_CALL: \"END_CALL\",\n ERROR: \"ERROR\",\n READY: \"READY\",\n SET_CALL_STATE: \"SET_CALL_STATE\",\n SET_WIDGET_URL: \"SET_WIDGET_URL\",\n SYNC_ACK_FAILED: \"SYNC_ACK_FAILED\",\n SYNC_ACK: \"SYNC_ACK\",\n SYNC: \"SYNC\",\n UNLOADING: \"UNLOADING\",\n};\n\n/**\n * @type {{ [key: string]: keyof import('./typedefs').EventHandlers }}\n */\nconst messageHandlerNames = {\n [messageType.CALLER_ID_MATCH_FAILED]: \"onCallerIdMatchFailed\",\n [messageType.CALLER_ID_MATCH_SUCCEEDED]: \"onCallerIdMatchSucceeded\",\n [messageType.CREATE_ENGAGEMENT_FAILED]: \"onCreateEngagementFailed\",\n [messageType.CREATE_ENGAGEMENT_SUCCEEDED]: \"onCreateEngagementSucceeded\",\n [messageType.DIAL_NUMBER]: \"onDialNumber\",\n [messageType.END_CALL]: \"onEndCall\",\n [messageType.ENGAGEMENT_CREATED]: \"onEngagementCreated\",\n [messageType.NAVIGATE_TO_RECORD_FAILED]: \"onNavigateToRecordFailed\",\n [messageType.PUBLISH_TO_CHANNEL_FAILED]: \"onPublishToChannelFailed\",\n [messageType.PUBLISH_TO_CHANNEL_SUCCEEDED]: \"onPublishToChannelSucceeded\",\n [messageType.READY]: \"onReady\",\n [messageType.SET_CALL_STATE]: \"onSetCallState\",\n [messageType.UPDATE_ENGAGEMENT_FAILED]: \"onUpdateEngagementFailed\",\n [messageType.UPDATE_ENGAGEMENT_SUCCEEDED]: \"onUpdateEngagementSucceeded\",\n [messageType.VISIBILITY_CHANGED]: \"onVisibilityChanged\",\n [messageType.INITIATE_CALL_ID_SUCCEEDED]: \"onInitiateCallIdSucceeded\",\n [messageType.INITIATE_CALL_ID_FAILED]: \"onInitiateCallIdFailed\",\n};\n\nconst errorType = {\n UNKNOWN_MESSAGE_TYPE: \"UNKNOWN_MESSAGE_TYPE\",\n};\n\n/** These are potential statuses from the BE client when calling from phone\n * or detecting that a call has ended in the linked engagement */\n\nconst INTERNAL_CONNECTING = \"CONNECTING\";\nconst INTERNAL_CALLING_CRM_USER = \"CALLING_CRM_USER\";\nconst INTERNAL_IN_PROGRESS = \"IN_PROGRESS\";\nconst INTERNAL_CANCELED = \"CANCELED\";\nconst INTERNAL_FAILED = \"FAILED\";\nconst INTERNAL_BUSY = \"BUSY\";\nconst INTERNAL_NO_ANSWER = \"NO_ANSWER\";\nconst INTERNAL_COMPLETED = \"COMPLETED\";\nconst INTERNAL_ENDING = \"ENDING\";\nconst INTERNAL_QUEUED = \"QUEUED\";\nconst INTERNAL_RINGING = \"RINGING\";\n\nconst callStatus = {\n INTERNAL_CONNECTING,\n INTERNAL_CALLING_CRM_USER,\n INTERNAL_IN_PROGRESS,\n INTERNAL_CANCELED,\n INTERNAL_FAILED,\n INTERNAL_BUSY,\n INTERNAL_NO_ANSWER,\n INTERNAL_COMPLETED,\n INTERNAL_ENDING,\n INTERNAL_QUEUED,\n INTERNAL_RINGING,\n};\n\nconst callRingingStatus = {\n INTERNAL_QUEUED,\n INTERNAL_RINGING,\n INTERNAL_CONNECTING,\n INTERNAL_CALLING_CRM_USER,\n};\n\nconst callInProgressStatus = { INTERNAL_IN_PROGRESS };\n\nconst callEndingStatus = { INTERNAL_ENDING };\n\nconst callEndStatus = {\n INTERNAL_COMPLETED,\n INTERNAL_FAILED,\n INTERNAL_CANCELED,\n INTERNAL_BUSY,\n INTERNAL_NO_ANSWER,\n};\n\nconst CONTACT = \"CONTACT\";\nconst COMPANY = \"COMPANY\";\n\nconst callerIdTypes = {\n CONTACT,\n COMPANY,\n};\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/@hubspot/calling-extensions-sdk/src/Constants.js?"); /***/ }), -/***/ "../../package.json": -/*!**************************!*\ - !*** ../../package.json ***! - \**************************/ +/***/ "./node_modules/@hubspot/calling-extensions-sdk/src/IFrameManager.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@hubspot/calling-extensions-sdk/src/IFrameManager.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants */ \"./node_modules/@hubspot/calling-extensions-sdk/src/Constants.js\");\n// @ts-check\n\n\"use es6\";\n\n\n\nconst prefix = `[calling-extensions-sdk@${_Constants__WEBPACK_IMPORTED_MODULE_0__.VERSION}]`;\n/*\n * IFrameManager abstracts the iFrame communication between the IFrameHost and an IFrame\n * An IFrameManager instance can act as part of the IFrameHost and an IFrame depending on\n * the options.\n */\nclass IFrameManager {\n /**\n *\n * @param {import('./typedefs').IframeManagerOptions} options\n */\n constructor(options) {\n /** @type {import('./typedefs').IframeManagerOptions | null} */\n this.options = options;\n const { iFrameOptions, onMessageHandler, debugMode } = options;\n\n this.onMessageHandler = onMessageHandler;\n if (!this.onMessageHandler) {\n throw new Error(\"Invalid options: onMessageHandler is not defined\");\n }\n this.isIFrameHost = !!iFrameOptions;\n this.debugMode = debugMode;\n\n // Keeps track of all the callbacks\n /** @type {{ [key: string]: Function }} */\n this.callbacks = {};\n\n this.instanceId = Date.now();\n this.instanceRegexp = new RegExp(`^${this.instanceId}`);\n this.isReady = false;\n\n this.messageHandler = (/** @type {any} */ event) => this.onMessage(event);\n window.addEventListener(\"message\", this.messageHandler);\n\n if (iFrameOptions) {\n /** @type {HTMLIFrameElement | null} */\n this.iFrame = IFrameManager.createIFrame(\n iFrameOptions,\n () => {\n this.firstSyncSent = Date.now();\n this.isReady = false;\n this.sendSync();\n },\n this.handleLoadError,\n );\n } else {\n /** @type {HTMLIFrameElement | null} */\n this.iFrame = null;\n }\n\n this.destinationWindow =\n iFrameOptions && this.iFrame ? this.iFrame.contentWindow : window.parent;\n\n this.destinationHost = IFrameManager.getDestinationHost(iFrameOptions);\n }\n\n /**\n * Creates a new message id\n * @param {string|number} instanceId\n * @returns {string}\n */\n static createMessageId(instanceId) {\n return `${instanceId}_${Date.now()}`;\n }\n\n /**\n * Gets the html element that hosts the iFrame\n * @param {string} hostElementSelector\n */\n static getHostElement(hostElementSelector) {\n const hostElement = document.querySelector(hostElementSelector);\n if (!hostElement) {\n throw new Error(\n `hostElement not found. Selector - ${hostElementSelector}`,\n );\n }\n return hostElement;\n }\n\n /**\n * @param {string} url\n */\n static extractHostFromUrl(url) {\n const a = document.createElement(\"a\");\n a.href = url;\n return `${a.protocol}//${a.host}`;\n }\n\n /**\n *\n * @param {import('./typedefs').IframeOptions} [iFrameOptions]\n */\n static getDestinationHost(iFrameOptions) {\n const url = iFrameOptions ? iFrameOptions.src : document.referrer;\n return IFrameManager.extractHostFromUrl(url);\n }\n\n handleLoadError() {\n this.onMessageHandler({\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC_ACK_FAILED,\n });\n }\n\n /**\n * @param {import('./typedefs').IframeOptions} iFrameOptions\n * @param { (this: GlobalEventHandlers, ev: Event) => any } onLoadCallback\n * @param { OnErrorEventHandler } onLoadErrorCallback\n * @returns {HTMLIFrameElement | null}\n */\n static createIFrame(iFrameOptions, onLoadCallback, onLoadErrorCallback) {\n // eslint-disable-next-line object-curly-newline\n const { src, width, height, hostElementSelector } = iFrameOptions;\n\n if (!src || !width || !height || !hostElementSelector) {\n throw new Error(\n \"iFrameOptions is missing one of the required properties - {src, width, height, hostElementSelector}.\",\n );\n }\n\n /** @type {HTMLIFrameElement} */\n const iFrame = document.createElement(\"iframe\");\n iFrame.onload = onLoadCallback;\n iFrame.onerror = onLoadErrorCallback;\n iFrame.src = src;\n iFrame.width = width;\n iFrame.height = height;\n iFrame.allow = \"microphone; autoplay\";\n iFrame.id = \"hubspot-calling-extension-iframe\";\n\n const element = IFrameManager.getHostElement(hostElementSelector);\n element.innerHTML = \"\";\n element.appendChild(iFrame);\n\n return element.querySelector(\"iframe\");\n }\n\n /**\n * @param {import('./typedefs').SizeInfo} sizeInfo\n */\n updateIFrameSize(sizeInfo) {\n const { width, height } = sizeInfo;\n const formatSize = (/** @type {number} */ size) => {\n return typeof size === \"number\" ? `${size}px` : size;\n };\n if (width && this.iFrame) {\n this.iFrame.setAttribute(\"width\", formatSize(width));\n }\n if (height && this.iFrame) {\n this.iFrame.setAttribute(\"height\", formatSize(height));\n }\n }\n\n onReady(data = {}) {\n this.isReady = true;\n this.onMessageHandler({\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.READY,\n data,\n });\n }\n\n /*\n * Unload the iFrame\n */\n remove() {\n window.removeEventListener(\"message\", this.messageHandler);\n\n if (this.iFrame && this.options && this.options.iFrameOptions) {\n const element = IFrameManager.getHostElement(\n this.options.iFrameOptions.hostElementSelector,\n );\n element.innerHTML = \"\";\n\n this.isReady = false;\n this.iFrame = null;\n this.options = null;\n }\n }\n\n /**\n * Send a message to the destination window.\n * @param {{type: string, messageId?: string|number, hostUrl?: string}} message\n * @param {function} [callback]\n */\n sendMessage(message, callback) {\n const { type } = message;\n if (type !== _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC && !this.isReady) {\n // Do not send a message unless the iFrame is ready to receive.\n console.warn(\n prefix,\n \"iFrame not initialized to send a message within HubSpot\",\n message,\n );\n return;\n }\n\n let { messageId } = message;\n if (!messageId) {\n // Initiating a new message\n messageId = IFrameManager.createMessageId(this.instanceId);\n if (callback) {\n // Keep track of the callback\n this.callbacks[messageId] = callback;\n }\n }\n\n const newMessage = Object.assign({}, message, {\n messageId,\n });\n\n this.logDebugMessage(prefix, _Constants__WEBPACK_IMPORTED_MODULE_0__.debugMessageType.TO_HUBSPOT, type, message);\n if (this.destinationWindow) {\n this.destinationWindow.postMessage(newMessage, this.destinationHost);\n }\n }\n\n /**\n * @param {{ data: any; origin?: any; }} event\n */\n onMessage(event) {\n const { data, origin } = event;\n // eslint-disable-next-line object-curly-newline\n const { type, engagementId, portalId, userId, ownerId } = event.data;\n if (type === _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC) {\n // The iFrame host can send this message multiple times, don't respond more than once\n if (!this.isReady) {\n this.isReady = true;\n\n const message = Object.assign({}, event.data, {\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC_ACK,\n debugMode: this.debugMode,\n version: _Constants__WEBPACK_IMPORTED_MODULE_0__.VERSION,\n iFrameUrl: IFrameManager.extractHostFromUrl(window.location.href),\n });\n\n const { hostUrl } = event.data;\n this.destinationHost = hostUrl || this.destinationHost;\n this.logDebugMessage(prefix, _Constants__WEBPACK_IMPORTED_MODULE_0__.debugMessageType.FROM_HUBSPOT, type, data);\n this.sendMessage(message);\n this.onReady({\n engagementId,\n portalId,\n userId,\n ownerId,\n });\n }\n return;\n }\n\n if (this.destinationHost !== origin) {\n // Ignore messages from an unknown origin\n return;\n }\n\n if (type === _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SET_WIDGET_URL) {\n const { iFrameUrl } = data;\n this.destinationHost = iFrameUrl || this.destinationHost;\n return;\n }\n\n const { messageId } = data;\n\n if (!messageId || !type) {\n return;\n }\n\n this.logDebugMessage(prefix, _Constants__WEBPACK_IMPORTED_MODULE_0__.debugMessageType.FROM_HUBSPOT, type, data);\n if (this.instanceRegexp.test(messageId)) {\n // This is a response to some message generated by HubSpot\n const callBack = this.callbacks[messageId];\n if (callBack) {\n callBack(data);\n delete this.callbacks[messageId];\n }\n return;\n }\n\n // This is a new message, let the handler handle it.\n this.onMessageHandler(data);\n }\n\n sendSync() {\n // No SYNC_ACK message after 30sec results in a failure\n if (Date.now() - this.firstSyncSent > 30000) {\n this.onMessageHandler({\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC_ACK_FAILED,\n });\n return;\n }\n\n this.sendMessage(\n {\n type: _Constants__WEBPACK_IMPORTED_MODULE_0__.messageType.SYNC,\n hostUrl: IFrameManager.extractHostFromUrl(window.location.href),\n },\n (/** @type {{ debugMode?: any; iFrameUrl?: any; }} */ eventData) => {\n const { iFrameUrl } = eventData;\n this.destinationHost = iFrameUrl || this.destinationHost;\n this.onReady();\n this.debugMode = eventData && eventData.debugMode;\n },\n );\n\n // In cases where the call widget loads the calling extensions asynchronously, message\n // handlers may not be set up - retry until a response from the iFrame\n window.setTimeout(() => {\n if (this.iFrame && !this.isReady) {\n this.sendSync();\n }\n }, 100);\n }\n\n /**\n * @param {any[]} args\n */\n logDebugMessage(...args) {\n if (this.debugMode) {\n console.log.call(null, args);\n return;\n }\n console.debug.call(null, args);\n }\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (IFrameManager);\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/@hubspot/calling-extensions-sdk/src/IFrameManager.js?"); + +/***/ }), + +/***/ "./node_modules/@hubspot/calling-extensions-sdk/src/typedefs.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@hubspot/calling-extensions-sdk/src/typedefs.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* eslint-disable max-len */\n// typedefs.js\n/**\n * @namespace typedefs\n */\n\n/**\n * @typedef {Object} EventHandlers\n * @property {function} onReady - Called when HubSpot is ready to receive messages.\n * @property {function} onDialNumber - Called when the HubSpot sends a dial number from the contact.\n * @property {function} onEngagementCreated - Called when HubSpot creates an engagement\n * for the call.\n * @property {function} onVisibilityChanged - Called when the call widget's visibility changes.\n * @property {function} onCallerIdMatchFailed - Called when the caller ID match fails.\n * @property {function} onCallerIdMatchSucceeded - Called when the caller ID match succeeds.\n * @property {function} onCreateEngagementFailed - Called when creating an engagement fails.\n * @property {function} onCreateEngagementSucceeded - Called when creating an engagement succeeds.\n * @property {function} onNavigateToRecordFailed - Called when navigating to a record fails.\n * @property {function} onPublishToChannelFailed - Called when publishing to a channel fails.\n * @property {function} onPublishToChannelSucceeded - Called when publishing to a channel succeeds.\n * @property {function} onSetCallState - Called when the call state changes.\n * @property {function} onUpdateEngagementFailed - Called when updating an engagement fails.\n * @property {function} onUpdateEngagementSucceeded - Called when updating an engagement succeeds.\n * @property {function} onEndCall - Called when the call ends.\n * @property {function} onInitiateCallIdSucceeded - Called when initiating a call ID succeeds.\n * @property {function} onInitiateCallIdFailed - Called when initiating a call ID fails.\n * @property {function} [defaultEventHandler] - Default event handler to handle unhandled events.\n */\n\n/**\n * @typedef {Object} IframeOptions\n * @property {string} src - iframe URL\n * @property {string} height - Height of iframe\n * @property {string} width - Width of iframe\n * @property {string} hostElementSelector - Selector for host element where iframe will be bound\n */\n\n/**\n * @typedef {Object} Options\n * @property {IframeOptions} [iFrameOptions] - iFrame configuration options\n * @property {boolean} debugMode - Whether to log various inbound/outbound debug messages\n * to the console.\n * @property {EventHandlers} eventHandlers - Event handlers handle inbound messages.\n */\n\n/**\n * @typedef {Object} IframeManagerOptions\n * @property {IframeOptions} [iFrameOptions] - iFrame configuration options\n * @property {boolean} debugMode - Whether to log various inbound/outbound debug messages\n * to the console.\n * @property {function} onMessageHandler - Callback function to handle inbound messages.\n */\n\n/**\n * @typedef {Object} OnResize\n * @property {number} width\n * @property {number} height\n */\n\n/**\n * @typedef {OnResize} SizeInfo\n */\n\n/**\n * @typedef {Object} OnInitialized\n * @property {boolean} [isLoggedIn]\n * @property {number} [engagementId]\n */\n\n/**\n * @typedef {Object} OnIncomingCall\n * @property {string} externalCallId\n * @property {number} [callStartTime]\n * @property {boolean} [createEngagement]\n * @property {string} fromNumber\n * @property {string} toNumber\n */\n\n/**\n * @typedef {Object} OnOutgoingCall\n * @property {string} externalCallId\n * @property {number} [callStartTime]\n * @property {boolean} [createEngagement]\n * @property {string} [fromNumber]\n * @property {string} [toNumber]\n */\n\n/**\n * @typedef {Object} OnCallAnswered\n * @property {string} externalCallId\n */\n\n/**\n * @typedef {Object} OnPublishToChannel\n * @property {string} externalCallId\n * @property {number} engagementId\n */\n\n/**\n * @typedef {'COMPLETED'|'FAILED'|'CANCELED'|'BUSY'|'NO_ANSWER'|'REJECTED'|'MISSED'} EndStatus\n */\n\n/**\n * @typedef {Object} OnCallEnded\n * @property {string} externalCallId\n * @property {number} engagementId\n * @property {EndStatus} [callEndStatus]\n */\n\n/**\n * @typedef {Object} RawEngagementProperties\n * @property {number|string} hs_timestamp - This field marks the call's time of creation and determines where the call sits on the record timeline.\n * @property {string} [hs_call_body] - The description of the call, including any notes that you want to add.\n * @property {string} [hs_call_callee_object_id] - The ID of the HubSpot record associated with the call. This will be the recipient of the call for OUTBOUND calls, or the dialer of the call for INBOUND calls.\n * @property {string} [hs_call_callee_object_type] - The type of the object to which the call's associated record belongs (e.g., specifies if the record is a contact or company). This will be the object of the recipient for OUTBOUNDcalls, or the object of the dialer for INBOUND calls.\n * @property {string} [hs_call_direction] - The direction of the call from the perspective of the HubSpot user. If the user is the call recipient, the direction should be set to INBOUND. If the user initiated the call, the direction should be set to OUTBOUND.\n * @property {string} [hs_call_disposition]\n * @property {string} [hs_call_duration] - The duration of the call in milliseconds.\n * @property {string} [hs_call_from_number] - The phone number that the call was made from.\n * @property {string} [hs_call_recording_url] - The URL that stores the call recording. URLS to .mp3 or .wav files can be played back on CRM records. Only HTTPS, secure URLs will be accepted.\n * @property {string} [hs_call_status] - The status of the call. The statuses are BUSY, CALLING_CRM_USER, CANCELED, COMPLETED, CONNECTING, FAILED, IN_PROGRESS, NO_ANSWER, QUEUED, and RINGING.\n * @property {string} [hs_call_title] - The title of the call.\n * @property {string} [hs_call_source] - The source of the call. This is not required, but it is required to leverage the recording and transcriptions pipeline. If the property is set, it must be set to INTEGRATIONS_PLATFORM.\n * @property {string} [hs_call_to_number] - The phone number that received the call.\n * @property {string} [hubspot_owner_id] - The ID of the owner associated with the call. This field determines the user listed as the call creator on the record timeline.\n * @property {string} [hs_activity_type] - The type of call. The options are based on the call types set in your HubSpot account.\n * @property {string} [hs_attachment_ids] - The IDs of the call's attachments. Multiple attachment IDs are separated by a semi-colon.\n */\n\n/**\n * @typedef {Object} OnCallCompleted\n * @property {string} externalCallId\n * @property {number|string} [engagementId]\n * @property {boolean} [hideWidget]\n * @property {RawEngagementProperties} [engagementProperties]\n */\n\n/**\n * @typedef {Object} ObjectCoordinates\n * @property {number} portalId\n * @property {number} objectId\n * @property {\"0-1\"|\"0-2\"} objectTypeId\n */\n\n/**\n * @typedef {Object} OnNavigateToRecord\n * @property {number} [engagementId]\n * @property {ObjectCoordinates} objectCoordinates\n */\n\n/**\n * @typedef {Object} OnError\n * @property {string} message\n */\n\n/**\n * @typedef {Object} OnMessage\n * @property {string} type\n * @property {Object} [data]\n */\n\n/**\n * @typedef {Object} ContactIdMatch\n * @property {\"CONTACT\"} callerIdType\n * @property {ObjectCoordinates} objectCoordinates\n * @property {string} firstName\n * @property {string} lastName\n * @property {string} email\n */\n\n/**\n * @typedef {Object} CompanyIdMatch\n * @property {\"COMPANY\"} callerIdType\n * @property {ObjectCoordinates} objectCoordinates\n * @property {string} name\n */\n\n\n\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/@hubspot/calling-extensions-sdk/src/typedefs.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/native.js": +/*!******************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/native.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n randomUUID\n});\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/uuid/dist/esm-browser/native.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/regex.js": +/*!*****************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/regex.js ***! + \*****************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i);\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/uuid/dist/esm-browser/regex.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/rng.js": +/*!***************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/rng.js ***! + \***************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ rng)\n/* harmony export */ });\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\n\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nfunction rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n return getRandomValues(rnds8);\n}\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/uuid/dist/esm-browser/rng.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/stringify.js": +/*!*********************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***! + \*********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ unsafeStringify: () => (/* binding */ unsafeStringify)\n/* harmony export */ });\n/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/esm-browser/validate.js\");\n\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nfunction unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n //\n // Note to future-self: No, you can't remove the `toLowerCase()` call.\n // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n var uuid = unsafeStringify(arr, offset);\n // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/uuid/dist/esm-browser/stringify.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/v4.js": +/*!**************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/v4.js ***! + \**************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ \"./node_modules/uuid/dist/esm-browser/native.js\");\n/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/esm-browser/rng.js\");\n/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/esm-browser/stringify.js\");\n\n\n\nfunction v4(options, buf, offset) {\n if (_native_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].randomUUID && !buf && !options) {\n return _native_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].randomUUID();\n }\n options = options || {};\n var rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n offset = offset || 0;\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds);\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/uuid/dist/esm-browser/v4.js?"); + +/***/ }), + +/***/ "./node_modules/uuid/dist/esm-browser/validate.js": +/*!********************************************************!*\ + !*** ./node_modules/uuid/dist/esm-browser/validate.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ \"./node_modules/uuid/dist/esm-browser/regex.js\");\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].test(uuid);\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/uuid/dist/esm-browser/validate.js?"); + +/***/ }), + +/***/ "./node_modules/@hubspot/calling-extensions-sdk/package.json": +/*!*******************************************************************!*\ + !*** ./node_modules/@hubspot/calling-extensions-sdk/package.json ***! + \*******************************************************************/ /***/ ((module) => { -eval("module.exports = /*#__PURE__*/JSON.parse('{\"name\":\"@hubspot/calling-extensions-sdk\",\"version\":\"0.6.4-alpha.9\",\"description\":\"A JavaScript SDK for integrating calling apps into HubSpot.\",\"publishConfig\":{\"access\":\"public\"},\"scripts\":{\"build\":\"webpack\",\"build:test\":\"npm run build && npm run test\",\"cover\":\"open coverage/lcov-report/index.html\",\"eslint\":\"eslint src --ext .js\",\"eslint:fix\":\"eslint src --ext .js --fix\",\"preversion\":\"npm run build:test\",\"postversion\":\"git push --follow-tags\",\"publish:alpha:current\":\"npm publish --access public --tag alpha\",\"publish:alpha:patch\":\"npm version patch --preid alpha && npm run publish:alpha:current\",\"publish:alpha:minor\":\"npm version preminor --preid alpha && npm run publish:alpha:current\",\"publish:alpha:major\":\"npm version premajor --preid alpha && npm run publish:alpha:current\",\"publish:alpha\":\"npm version prerelease --preid alpha && npm run publish:alpha:current\",\"publish:beta\":\"npm version prerelease --preid beta && npm publish --access public --tag beta\",\"publish:rc\":\"npm version prerelease --preid rc && npm publish --access public --tag rc\",\"publish:patch\":\"npm version patch && npm publish --access public\",\"publish:minor\":\"npm version minor && npm publish --access public\",\"publish:major\":\"npm version major && npm publish --access public\",\"test:build\":\"npx webpack --config webpack-test.config.js --mode development\",\"test:watch\":\"npx webpack --config webpack-test.config.js --mode development --watch\",\"test:serve\":\"cross-env NODE_ENV=test npm run test:watch & jasmine-browser-runner serve --config=test/support/jasmine-browser.json\",\"test\":\"cross-env NODE_ENV=test npm run test:build && jasmine-browser-runner runSpecs --config=test/support/jasmine-browser.json --browser=headlessChrome\"},\"main\":\"./dist/main.js\",\"files\":[\"dist/**/*\",\"src/\",\"index.js\",\"src/typedefs.js\"],\"types\":\"./dist/types/index.d.ts\",\"module\":\"./index.js\",\"author\":\"\",\"license\":\"MIT\",\"engines\":{\"node\":\">=14\"},\"devDependencies\":{\"@babel/cli\":\"^7.21.0\",\"@babel/core\":\"^7.4.5\",\"@babel/preset-env\":\"^7.21.4\",\"@typescript-eslint/eslint-plugin\":\"^5.59.7\",\"@typescript-eslint/parser\":\"^5.59.7\",\"babel-loader\":\"^8.0.6\",\"cross-env\":\"^7.0.3\",\"eslint\":\"^8.41.0\",\"eslint-config-airbnb\":\"^19.0.4\",\"eslint-plugin-import\":\"^2.27.5\",\"eslint-plugin-jsx-a11y\":\"^6.7.1\",\"eslint-plugin-react\":\"^7.32.2\",\"eslint-plugin-react-hooks\":\"^4.6.0\",\"jasmine-browser-runner\":\"^1.3.0\",\"jasmine-core\":\"^4.6.0\",\"prettier\":\"^2.8.8\",\"ts-loader\":\"^9.5.1\",\"typescript\":\"^5.5.4\",\"webpack\":\"^5.77.0\",\"webpack-cli\":\"^5.0.1\"}}');\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/../../package.json?"); +eval("module.exports = /*#__PURE__*/JSON.parse('{\"name\":\"@hubspot/calling-extensions-sdk\",\"version\":\"0.6.4-alpha.9\",\"description\":\"A JavaScript SDK for integrating calling apps into HubSpot.\",\"publishConfig\":{\"access\":\"public\"},\"scripts\":{\"build\":\"webpack\",\"build:test\":\"npm run build && npm run test\",\"cover\":\"open coverage/lcov-report/index.html\",\"eslint\":\"eslint src --ext .js\",\"eslint:fix\":\"eslint src --ext .js --fix\",\"preversion\":\"npm run build:test\",\"postversion\":\"git push --follow-tags\",\"publish:alpha:current\":\"npm publish --access public --tag alpha\",\"publish:alpha:patch\":\"npm version patch --preid alpha && npm run publish:alpha:current\",\"publish:alpha:minor\":\"npm version preminor --preid alpha && npm run publish:alpha:current\",\"publish:alpha:major\":\"npm version premajor --preid alpha && npm run publish:alpha:current\",\"publish:alpha\":\"npm version prerelease --preid alpha && npm run publish:alpha:current\",\"publish:beta\":\"npm version prerelease --preid beta && npm publish --access public --tag beta\",\"publish:rc\":\"npm version prerelease --preid rc && npm publish --access public --tag rc\",\"publish:patch\":\"npm version patch && npm publish --access public\",\"publish:minor\":\"npm version minor && npm publish --access public\",\"publish:major\":\"npm version major && npm publish --access public\",\"test:build\":\"npx webpack --config webpack-test.config.js --mode development\",\"test:watch\":\"npx webpack --config webpack-test.config.js --mode development --watch\",\"test:serve\":\"cross-env NODE_ENV=test npm run test:watch & jasmine-browser-runner serve --config=test/support/jasmine-browser.json\",\"test\":\"cross-env NODE_ENV=test npm run test:build && jasmine-browser-runner runSpecs --config=test/support/jasmine-browser.json --browser=headlessChrome\"},\"main\":\"./dist/main.js\",\"files\":[\"dist/**/*\",\"src/\",\"index.js\",\"src/typedefs.js\"],\"types\":\"./dist/types/index.d.ts\",\"module\":\"./index.js\",\"author\":\"\",\"license\":\"MIT\",\"engines\":{\"node\":\">=14\"},\"devDependencies\":{\"@babel/cli\":\"^7.21.0\",\"@babel/core\":\"^7.4.5\",\"@babel/preset-env\":\"^7.21.4\",\"@typescript-eslint/eslint-plugin\":\"^5.59.7\",\"@typescript-eslint/parser\":\"^5.59.7\",\"babel-loader\":\"^8.0.6\",\"cross-env\":\"^7.0.3\",\"eslint\":\"^8.41.0\",\"eslint-config-airbnb\":\"^19.0.4\",\"eslint-plugin-import\":\"^2.27.5\",\"eslint-plugin-jsx-a11y\":\"^6.7.1\",\"eslint-plugin-react\":\"^7.32.2\",\"eslint-plugin-react-hooks\":\"^4.6.0\",\"jasmine-browser-runner\":\"^1.3.0\",\"jasmine-core\":\"^4.6.0\",\"prettier\":\"^2.8.8\",\"ts-loader\":\"^9.5.1\",\"typescript\":\"^5.5.4\",\"webpack\":\"^5.77.0\",\"webpack-cli\":\"^5.0.1\"}}');\n\n//# sourceURL=webpack://calling-extensions-sdk-demo-minimal-js/./node_modules/@hubspot/calling-extensions-sdk/package.json?"); /***/ })