1"use strict";(self.webpackChunkigms=self.webpackChunkigms||[]).push([[3954],{13954(e,t,s){s.d(t,{A:()=>He});var i,n,o,a=s(96540),r=s(72635),l=s(5556),p=s.n(l),c=s(64951),h=(s(21755),s(74848));class d extends a.Component{render(){return(0,h.jsxs)("div",{className:"options-sidebar-buttons",children:[(0,h.jsx)(c.A,{className:"apply-options-button",text:r.Ay.t("common:apply"),action:this.props.applyTempOptions}),(0,h.jsx)(c.A,{className:"cancel-options-button",text:r.Ay.t("common:cancel"),action:this.props.cancelTempOptions}),(0,h.jsx)(c.A,{wrapperClassName:"help-desk",text:(0,h.jsx)("a",{href:r.Ay.t("common:helpDeskLinks.howToAutomateAirbnbReplies"),target:"_blank",rel:"noreferrer",children:(0,h.jsx)("i",{className:"icon-info"})})})]})}}d.displayName="MTOptionsSidebarButtons",i=d,n="propTypes",o={applyTempOptions:p().func.isRequired,cancelTempOptions:p().func.isRequired},(n=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n))in i?Object.defineProperty(i,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[n]=o;var u=s(59815),m=s(87701),g=s(12950),b=s(67191),y=(s(47635),s(9816)),v=s(7522);function f(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class A extends a.Component{render(){return(0,h.jsxs)("div",{className:"automation-sidebar-header",children:[(0,h.jsx)("i",{className:"icon-plane"}),r.Ay.t("listings:automation"),(0,h.jsx)(y.A,{onChange:(e,t)=>
1{this.props.toggleAutomation(e)},value:this.props.isAutoresponder,disabled:this.props.isReadOnlyAccess}),(0,h.jsx)("img",{src:v,alt:"header-sidebar"})]})}}A.displayName="MTAutomationHeader",f(A,"propTypes",{isReadOnlyAccess:p().bool.isRequired,toggleAutomation:p().func.isRequired,isAutoresponder:p().bool}),f(A,"defaultProps",{isAutoresponder:!1});var O=s(30905),x=s(83571),j=s(67873),T=s(96319);function P(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,i)}return s}function C(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?P(Object(s),!0).forEach(function(t){w(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):P(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function w(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s(99486);class S extends a.Component{constructor(e){super(e),this.state=C(C({},e.options),{},{sendTimeManualInput:!1,minVal:e.options.reservationMin,maxVal:e.options.reservationMax,beginTime:(0,x.Ib)(e.options.beginTime),eventThreshold:e.options.eventThreshold,isBeginTimeValid:!0,isBeginTimeFocused:!1}),this.timeInputRef=null,this.getOption=this.getOption.bind(this),this.showEventSelector=this.showEventSelector.bind(this),this.setOption=this.setOption.bind(this),this.getEvent=this.getEvent.bind(this),this.eventSelectorButton=this.eventSelectorButton.bind(this),this.getQuantityButton=this.getQuantityButton.bind(this),this.daysQuantitySelector=this.daysQuantitySelector.bind(this),this.delayInput=this.delayInput.bind(this),this.getTimeInputRef=this.getTimeInputRef.bind(this),this.onBlurSendTime=this.onBlurSendTime.bind(this),this.sendTimeInput=this.sendTimeInput.bind(this),this.setRecurrenceRule=this.setRecurrenceRule.bind(this),this.setRecurrenceValidity=this.setRecurrenceValidity.bind(this),this.recurrenceRuleInput=this.recurrenceRuleInput.bind(this),this.ignoreBackToCheckbox=this.ignoreBackToCheckbox.bind(this),this.ignoreForCheckboxes=this.ignoreForCheckboxes.bind(this),this.lastMinuteCheckbox=this.lastMinuteCheckbox.bind(this),this.reservationLengthOption=this.reservationLengthOption.bind(this),this.toggleAutomation=this.toggleAutomation.bind(this)}onBlurSendTime(e,t){let s;s=(0,T.Im)(e.target.value)?t:(0,x.Ib)(e.target.value),this.setOption("beginTime",s),this.setState({isBeginTimeFocused:!1,beginTime:s,isBeginTimeValid:!0})}getQuantityButton(e){const t=["quantity-button"];e===this.state.eventThreshold&&t.push("active");const s=r.Ay.t("common:date.dWithCount",{count:e});return(0,h.jsx)(c.A,{text:s,wrapperClassName:t.join(" "),action:()=>{this.setOption("eventThreshold",e)},disabled:this.props.isReadOnlyAccess})}getEvent(){const e=this.props.isMobile?this.state.eventId:this.props.options.eventId;return this.props.getEvent(e)}setOption(e,t){const s={[e]:t};if("reservationMin"===e||"reservationMax"===e){const i="reservationMin"===e?"minVal":"maxVal",n=this.getOption(e);if(!/^\d+$/.test(t)||parseInt(t,10)<1)return void this.setState({[i]:n});if("reservationMin"===e&&this.getOption("reservationMax")<t){if(this.getOption("reservationMaxChecked"))return void this.setState({[i]:n});s.reservationMax=t,s.maxVal=t}if("reservationMax"===e&&this.getOption("reservationMin")>t){if(this.getOption("reservationMinChecked"))return void this.setState({[i]:n});s.reservationMin=t,s.minVal=t}}this.props.isMobile?(this.props.setTempOptions(s),this.setState(s)):(this.props.setOptions(s),this.setState(s))}setRecurrenceRule(e){const t={repeatMode:e.repeatMode,repeatWeekdays:e.repeatWeekdays,repeatIntervalDays:e.repeatIntervalDays};this.props.isMobile?this.props.setTempOptions(t):this.props.setOptions(t),this.setState(t)}setRecurrenceValidity(e){this.props.isMobile||this.props.setOptionsError(!e)}getOption(e){return this.props.isMobile?this.state[e]:this.props.options[e]}getTimeInputRef(e){this.timeInputRef=e}delayInput(e){if((0,T.Im)(e)||"on-inquiry"!==e.type&&"on-booking"!==e.type&&"on-cancellation"!==e.type&&"on-alteration"!==e.type)return"";let t=this.getOption("delayTime");return(0,T.Im)(t)&&(t=0),(0,h.jsxs)("div",{className:"days-quantity-option",children:[(0,h.jsxs)("div",{className:"option-label",children:[r.Ay.t("listings:delayDeliveryInMinutes"),":"]}),(0,h.jsx)("div",{className:"days-quantity-selector",children:(0,h.jsx)(b.A,{value:t,onChange:e=>{this.setOption("delayTime",e)},minValue:0,maxValue:43201,step:1,manualInput:!0,disabled:this.props.isReadOnlyAccess})})]})}daysQuantitySelector(e){return(0,T.Im)(e)||(0,T.Im)(e.days)||!e.days||"on-checkin-day"===e.type||"on-checkout-day"===e.type||"on-inquiry"===e.type||"on-booking"===e.type||"on-cancellation"===e.type||"on-alteration"===e.type?"":(0,h.jsxs)("div",{className:"days-quantity-option",children:[(0,h.jsxs)("div",{className:"option-label",children:[r.Ay.t("common:date.days")," ",e.label,":"]}
1),(0,h.jsxs)("div",{className:"days-quantity-selector",children:[(0,h.jsx)(b.A,{value:this.state.eventThreshold,onChange:e=>{this.setOption("eventThreshold",e)},minValue:1,maxValue:365,step:1,manualInput:!0,allowEmpty:!0,disabled:this.props.isReadOnlyAccess}),this.getQuantityButton(1),this.getQuantityButton(3),this.getQuantityButton(7),this.getQuantityButton(14)]})]})}eventSelectorButton(e){const t=e?e.label:r.Ay.t("common:disabled"),s=(0,h.jsxs)("span",{className:"button-text",children:[(0,h.jsx)("span",{children:t}),(0,h.jsx)("i",{className:"icon-arrowdown"})]});return(0,h.jsxs)("div",{className:"event-selector-option",children:[(0,h.jsxs)("div",{className:"option-label",children:[r.Ay.t("listings:sendMessageAutomatically"),":"]}),(0,h.jsx)("div",{className:"event-selector-button",children:(0,h.jsx)(c.A,{text:s,action:()=>{this.showEventSelector()},disabled:this.props.isReadOnlyAccess})})]})}showEventSelector(){this.props.isMobile?(this.props.setTempOptions({eventId:null}),this.props.showAutomationEvents()):this.props.setOptions({eventId:null})}sendTimeInput(e){if((0,T.Im)(e)||(0,T.Im)(e.customable_time)||!e.customable_time)return"";let t=this.state.beginTime;(0,T.Im)(t)&&!this.state.sendTimeManualInput&&(t=`${e.begin_time}:00 am`);const s=["time-zone"];return this.state.isBeginTimeFocused||(0,T.Im)(t)||s.push("correct"),(0,h.jsxs)("div",{className:"send-time-option",children:[(0,h.jsxs)("div",{className:"option-label",children:[r.Ay.t("listings:timeToSend"),":"]}),(0,h.jsxs)("div",{className:"send-time-input",children:[(0,h.jsx)(g.A,{isDisabled:this.props.isReadOnlyAccess,type:"text",value:t,onChange:e=>{this.setState({sendTimeManualInput:!0,beginTime:e.target.value,isBeginTimeValid:!0})},onBlur:t=>{this.onBlurSendTime(t,`${e.begin_time}:00 am`)},icon:(0,h.jsx)("i",{className:"icon icon-time-icon",onClick:()=>{this.timeInputRef&&this.timeInputRef.focus()}}),placeHolder:r.Ay.t("listings:timeToSendPlaceholder"),isWarning:this.props.showErrors&&!this.state.isBeginTimeValid,onFocus:()=>{this.setState({isBeginTimeFocused:!0})},getRef:this.getTimeInputRef,onClick:()=>{this.timeInputRef&&this.timeInputRef.focus()}}),(0,h.jsx)("div",{className:s.join(" "),onClick:()=>{this.timeInputRef&&this.timeInputRef.focus()},children:this.props.timezone}),this.props.showErrors&&!this.state.isBeginTimeValid&&(0,h.jsxs)("div",{className:"error-message",children:[(0,h.jsx)("div",{className:"error-icon",children:(0,h.jsx)("i",{className:"icon-error"})}),(0,h.jsx)("div",{className:"error-text",children:r.Ay.t("listings:invalidTimeFormat")})]})]})]})}recurrenceRuleInput(e){return(0,T.Im)(e)||(0,T.Im)(e.allow_recurrence)||!e.allow_recurrence?"":(0,h.jsx)(j.Ay,{value:{repeatMode:this.getOption("repeatMode"),repeatWeekdays:this.getOption("repeatWeekdays"),repeatIntervalDays:this.getOption("repeatIntervalDays")},disabled:this.props.isReadOnlyAccess,onChange:this.setRecurrenceRule,onValidityChange:this.setRecurrenceValidity,showErrors:this.props.showErrors})}
1ignoreBackToCheckbox(e){return(0,T.Im)(e.allow_back_to_back_ignoring)||!e.allow_back_to_back_ignoring?"":(0,h.jsx)(m.A,{label:(0,h.jsxs)("span",{children:[r.Ay.t("listings:backToBackReservationLabel.paragraphOne"),(0,h.jsx)("br",{}),r.Ay.t("listings:backToBackReservationLabel.paragraphTwo")]}),checked:this.getOption("backToBackIgnore"),onChange:e=>{this.setOption("backToBackIgnore",e)},disabled:this.props.isReadOnlyAccess})}ignoreGuestAlreadyLeftReviewCheckbox(e){return(0,T.Im)(e.allow_guest_already_reviewed_ignoring)||!e.allow_guest_already_reviewed_ignoring?"":(0,h.jsx)(m.A,{label:(0,h.jsx)("span",{children:r.Ay.t("listings:guestAlreadyReviewedLabel")}),checked:this.getOption("guestAlreadyLeftReviewIgnore"),onChange:e=>{this.setOption("guestAlreadyLeftReviewIgnore",e)},disabled:this.props.isReadOnlyAccess})}ignoreForCheckboxes(e){return!(0,T.Im)(e)&&(!(0,T.Im)(e.allow_last_minute_booking_ignoring)&&e.allow_last_minute_booking_ignoring||!(0,T.Im)(e.allow_guest_already_reviewed_ignoring)&&e.allow_guest_already_reviewed_ignoring||!(0,T.Im)(e.allow_back_to_back_
1ignoring)&&e.allow_back_to_back_ignoring||!(0,T.Im)(e.allow_one_night_ignoring)&&e.allow_one_night_ignoring)?(0,h.jsxs)("div",{className:"ignore-for-option",children:[(0,h.jsxs)("div",{className:"option-label",children:[r.Ay.t("listings:ignoreFor"),":"]}),(0,h.jsxs)("div",{className:"ignore-for-checkboxes",children:[this.ignoreBackToCheckbox(e),this.ignoreGuestAlreadyLeftReviewCheckbox(e)]})]}):""}lastMinuteCheckbox(e){return(0,T.Im)(e)||"before-checkin"!==e.id?"":(0,h.jsx)("div",{className:"ignore-for-option",children:(0,h.jsx)("div",{className:"ignore-for-checkboxes",children:(0,h.jsx)(m.A,{label:(0,h.jsx)("span",{children:r.Ay.t("listings:applyForLastMinuteBooking")}),checked:this.getOption("lastMinuteBooking"),onChange:e=>{this.setOption("lastMinuteBooking",e)},disabled:this.props.isReadOnlyAccess})})})}reservationLengthOption(e){if((0,T.Im)(e)||"on-cancellation"===e.type||"on-alteration"===e.type)return"";const t=this.getOption("reservationMinChecked"),s=this.getOption("reservationMaxChecked"),i=t?this.state.minVal.toString():"â",n=s?this.state.maxVal.toString():"â";return(0,h.jsxs)("div",{className:"reservation-length-option",children:[(0,h.jsxs)("div",{className:"option-label",children:[r.Ay.t("listings:sendItOnlyWhenReservationLength"),":"]}),(0,h.jsxs)("div",{className:"reservation-length-inputs",children:[(0,h.jsxs)("div",{className:"reservation-length length-min",children:[(0,h.jsx)(m.A,{label:r.Ay.t("common:min"),checked:t,onChange:e=>{this.setOption("reservationMinChecked",e)},disabled:this.props.isReadOnlyAccess}),(0,h.jsx)(g.A,{type:t?"number":"text",inputMode:t?"numeric":"text",value:i,onChange:e=>{(""===e.target.value||/^\d+$/.test(e.target.value)&&parseInt(e.target.value,10)>0)&&this.setState({minVal:e.target.value})},onBlur:()=>{this.setOption("reservationMin",this.state.minVal)},isDisabled:!t||this.props.isReadOnlyAccess,icon:r.Ay.t("common:nights")})]}),(0,h.jsxs)("div",{className:"reservation-length length-max",children:[(0,h.jsx)(m.A,{label:r.Ay.t("common:max"),checked:s,onChange:e=>{this.setOption("reservationMaxChecked",e)},disabled:this.props.isReadOnlyAccess}),(0,h.jsx)(g.A,{type:s?"number":"text",inputMode:t?"numeric":"text",value:n,onChange:e=>{(""===e.target.value||/^\d+$/.test(e.target.value)&&parseInt(e.target.value,10)>0)&&this.setState({maxVal:e.target.value})},onBlur:()=>{this.setOption("reservationMax",this.state.maxVal)},isDisabled:!s||this.props.isReadOnlyAccess,icon:r.Ay.t("common:nights")})]})]})]})}toggleAutomation(e){if(this.props.isMobile){const t=C({},this.state);t.isAutoresponder=e,e||(t.eventId=null),this.props.setTempOptions(t),this.setState(t),e||(PLATFORM_APP.onBackKeyDown(),this.props.showAutomationHelp(t))}else this.props.setOptions({isAutoresponder:e})}render(){const e=this.getEvent();return(0,h.jsxs)("div",{className:"editor-sidebar-wrapper",children:[(0,h.jsx)(A,{toggleAutomation:this.toggleAutomation,isAutoresponder:this.getOption("isAutoresponder"),isReadOnlyAccess:this.props.isReadOnlyAccess}),(0,h.jsxs)("div",{className:"editor-sidebar-body",children:[(0,h.jsxs)("div",{className:"automation-options",children:[this.eventSelectorButton(e),this.delayInput(e),this.daysQuantitySelector(e),this.lastMinuteCheckbox(e),this.sendTimeInput(e),this.recurrenceRuleInput(e),this.reservationLengthOption(e),this.ignoreForCheckboxes(e)]}),(0,h.jsx)(O.A,{})]})]})}}function _(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,i)}return s}function I(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?_(Object(s),!0).forEach(function(t){E(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):_(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function E(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}
1S.displayName="MTAutomationOptionsSidebar",w(S,"propTypes",{isReadOnlyAccess:p().bool.isRequired,getEvent:p().func.isRequired,setTempOptions:p().func,setOptions:p().func,options:p().object.isRequired,isMobile:p().bool,showErrors:p().bool,setOptionsError:p().func,showAutomationHelp:p().func,showAutomationEvents:p().func,timezone:p().string}),w(S,"defaultProps",{setTempOptions:()=>{},setOptions:()=>{},isMobile:!1,showErrors:!1,setOptionsError:()=>{},showAutomationHelp:()=>{},showAutomationEvents:()=>{},timezone:""}),s(56435);class N extends a.Component{constructor(e){super(e),this.state=I({},e.options),this.getOption=this.getOption.bind(this),this.getSectionsEvents=this.getSectionsEvents.bind(this),this.getSectionEvents=this.getSectionEvents.bind(this),this.selectEvent=this.selectEvent.bind(this),this.toggleAutomation=this.toggleAutomation.bind(this),this.showAutomationEvents=this.showAutomationEvents.bind(this),this.showAutomationOptions=this.showAutomationOptions.bind(this),this.getEventButton=this.getEventButton.bind(this),e.isMobile&&e.options.isAutoresponder&&!(0,T.Im)(e.options.eventId)&&this.showAutomationOptions(e.options)}getOption(e){return this.props.isMobile?this.state[e]:this.props.options[e]}getSectionsEvents(){const e=[];let t;if(!(0,T.z)(this.props.sectionEvents))for(const s of this.props.sectionEvents)t=this.getSectionEvents(s,e.length),e.push(t);return e}getSectionEvents(e,t){const s=[];let i,n,o;for(const t of e)(0,T.Im)(t)||(o=this.props.getEvent(t),(0,T.Im)(o)||(n=0===s.length,i=this.getEventButton(o,n,s.length),s.push(i)));return(0,h.jsx)("div",{className:"event-section",children:s},t)}getEventButton(e,t,s){const i=["event-button"];t&&i.push("first-item");const n=(0,h.jsxs)("span",{children:[e.label,(0,h.jsx)("i",{className:"icon-arrowright"})]});return(0,h.jsx)(c.A,{wrapperClassName:i.join(" "),text:n,action:()=>{this.selectEvent(e.id)}},s)}showAutomationOptions(e){const t=(0,h.jsx)(S,{getEvent:this.props.getEvent,setTempOptions:this.props.setTempOptions,setOptions:this.props.setOptions,isMobile:!0,options:e,showErrors:this.props.showErrors,setOptionsError:this.props.setOptionsError,showAutomationHelp:this.props.showAutomationHelp,showAutomationEvents:this.showAutomationEvents,timezone:this.props.timezone});PLATFORM_APP.onBackKeyDown(),PLATFORM_APP.page.pageApi.openCard(r.Ay.t("listings:automation"),u.A,{buttons:(0,h.jsx)(d,{applyTempOptions:()=>{this.props.applyTempOptions(),PLATFORM_APP.onBackKeyDown()},cancelTempOptions:()=>{this.props.cancelTempOptions(),PLATFORM_APP.onBackKeyDown()}}),content:t})}showAutomationEvents(){const e=this.props.options;e.eventId=null;const t=(0,h.jsx)(N,{getEvent:this.props.getEvent,setTempOptions:this.props.setTempOptions,setOptions:this.props.setOptions,sectionEvents:this.props.sectionEvents,isMobile:!0,options:e,applyTempOptions:this.props.applyTempOptions,cancelTempOptions:this.props.cancelTempOptions,showErrors:this.props.showErrors,setOptionsError:this.props.setOptionsError,showAutomationHelp:this.props.showAutomationHelp,timezone:this.props.timezone,isReadOnlyAccess:this.props.isReadOnlyAccess});PLATFORM_APP.onBackKeyDown(),PLATFORM_APP.page.pageApi.openCard(r.Ay.t("listings:automation"),u.A,{buttons:(0,h.jsx)(d,{applyTempOptions:()=>{this.props.applyTempOptions(),PLATFORM_APP.onBackKeyDown()},cancelTempOptions:()=>{this.props.cancelTempOptions(),PLATFORM_APP.onBackKeyDown()}}),content:t})}toggleAutomation(e){if(this.props.isMobile){const t=I({},this.state);t.isAutoresponder=e,e||(t.eventId=null),this.props.setTempOptions(t),this.setState(t),e||(PLATFORM_APP.onBackKeyDown(),this.props.showAutomationHelp(t))}else this.props.setOptions({isAutoresponder:e})}selectEvent(e){if(this.props.isMobile){this.props.setTempOptions({eventId:e});const t=I({},this.state);this.setState({eventId:e}),e&&this.props.getEvent(e)&&(t.eventId=e,this.showAutomationOptions(t))}else this.props.setOptions({eventId:e})}render(){return(0,h.jsxs)("div",{className:"editor-sidebar-wrapper",children:[(0,h.jsx)(A,{toggleAutomation:this.toggleAutomation,isAutoresponder:this.getOption("isAutoresponder"),isReadOnlyAccess:this.props.isReadOnlyAccess}),(0,h.jsxs)("div",{className:"editor-sidebar-body",children:[(0,h.jsxs)("div",{className:"automation-events",children:[(0,h.jsxs)("div",{className:"automation-events-label",children:[r.Ay.t("listings:sendMessageAutomatically"),":"]}
1),this.getSectionsEvents()]}),(0,h.jsx)(O.A,{})]})]})}}N.displayName="MTAutomationEventsSidebar",E(N,"propTypes",{isReadOnlyAccess:p().bool.isRequired,getEvent:p().func.isRequired,setTempOptions:p().func,setOptions:p().func,applyTempOptions:p().func,cancelTempOptions:p().func,sectionEvents:p().array.isRequired,options:p().object.isRequired,isMobile:p().bool,showErrors:p().bool,setOptionsError:p().func,showAutomationHelp:p().func,timezone:p().string}),E(N,"defaultProps",{setTempOptions:()=>{},setOptions:()=>{},applyTempOptions:()=>{},cancelTempOptions:()=>{},isMobile:!1,showErrors:!1,setOptionsError:()=>{},showAutomationHelp:()=>{},timezone:""});var R=s(89684);function k(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,i)}return s}function F(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?k(Object(s),!0).forEach(function(t){L(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):k(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function L(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class M extends a.Component{constructor(e){super(e),this.state=F({},e.options),this.getOption=this.getOption.bind(this),this.toggleAutomation=this.toggleAutomation.bind(this),this.showAutomationEvents=this.showAutomationEvents.bind(this),this.showAutomationHelp=this.showAutomationHelp.bind(this),e.isMobile&&e.options.isAutoresponder&&this.showAutomationEvents(e.options)}getOption(e){return this.props.isMobile?this.state[e]:this.props.options[e]}toggleAutomation(e){if(this.props.isMobile){const t=F({},this.state);t.isAutoresponder=e,e||(t.eventId=null),this.props.setTempOptions(t),this.setState(t),e&&this.showAutomationEvents(t)}else this.props.setOptions({isAutoresponder:e})}showAutomationEvents(e){const t=(0,h.jsx)(N,{getEvent:this.props.getEvent,setTempOptions:this.props.setTempOptions,setOptions:this.props.setOptions,sectionEvents:this.props.sectionEvents,isMobile:!0,options:e,applyTempOptions:this.props.applyTempOptions,cancelTempOptions:this.props.cancelTempOptions,showErrors:this.props.showErrors,setOptionsError:this.props.setOptionsError,showAutomationHelp:this.showAutomationHelp,isReadOnlyAccess:this.props.isReadOnlyAccess});PLATFORM_APP.onBackKeyDown(),PLATFORM_APP.page.pageApi.openCard("Automation",u.A,{buttons:(0,h.jsx)(d,{applyTempOptions:()=>{this.props.applyTempOptions(),PLATFORM_APP.onBackKeyDown()},cancelTempOptions:()=>{this.props.cancelTempOptions(),PLATFORM_APP.onBackKeyDown()}}),content:t})}showAutomationHelp(e){const t=(0,h.jsx)(M,{getEvent:this.props.getEvent,setTempOptions:this.props.setTempOptions,setOptions:this.props.setOptions,sectionEvents:this.props.sectionEvents,isMobile:!0,options:e,applyTempOptions:this.props.applyTempOptions,cancelTempOptions:this.props.cancelTempOptions,showErrors:this.props.showErrors,setOptionsError:this.props.setOptionsError,isReadOnlyAccess:this.props.isReadOnlyAccess});PLATFORM_APP.page.pageApi.openCard(r.Ay.t("listings:automation"),u.A,{buttons:(0,h.jsx)(d,{applyTempOptions:()=>{this.props.applyTempOptions(),PLATFORM_APP.onBackKeyDown()},cancelTempOptions:()=>{this.props.cancelTempOptions(),PLATFORM_APP.onBackKeyDown()}}),content:t})}render(){return(0,h.jsxs)("div",{className:"editor-sidebar-wrapper",children:[(0,h.jsx)(A,{toggleAutomation:this.toggleAutomation,isAutoresponder:this.getOption("isAutoresponder"),isReadOnlyAccess:this.props.isReadOnlyAccess}),(0,h.jsx)(R.A,{})]})}}function B(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}M.displayName="MTAutomationHelpSidebar",L(M,"propTypes",{isReadOnlyAccess:p().bool.isRequired,getEvent:p().func.isRequired,setTempOptions:p().func,setOptions:p().func,applyTempOptions:p().func,cancelTempOptions:p().func,sectionEvents:p().array.isRequired,options:p().object.isRequired,isMobile:p().bool,showErrors:p().bool,setOptionsError:p().func}),L(M,"defaultProps",{setTempOptions:()=>{},setOptions:()=>{},applyTempOptions:()=>{},cancelTempOptions:()=>{},isMobile:!1,showErrors:!1,setOptionsError:()=>{}}),s(37387);class D extends a.Component{constructor(e){super(e),this.openAutomationHelp=this.openAutomationHelp.bind(this)}openAutomationHelp(){const e=(0,h.jsx)(M,{getEvent:this.props.getEvent,setTempOptions:this.props.setTempOptions,setOptions:this.props.setOptions,sectionEvents:this.props.sectionEvents,isMobile:!0,options:this.props.options,applyTempOptions:this.props.applyTempOptions,cancelTempOptions:this.props.cancelTempOptions,showErrors:this.props.showErrors,setOptionsError:this.props.setOptionsError,isReadOnlyAccess:this.props.isReadOnlyAccess});PLATFORM_APP.page.pageApi.openCard("Automation",u.A,{buttons:(0,h.jsx)(d,{applyTempOptions:()=>{this.props.applyTempOptions(),PLATFORM_APP.onBackKeyDown()},cancelTempOptions:()=>{this.props.cancelTempOptions(),PLATFORM_APP.onBackKeyDown()}}),content:e})}render(){const e=this.props.getEvent(this.props.options.eventId),t=this.props.options.isAutoresponder&&e?e.label:"Disabled",s=(0,h.jsxs)("span",{className:"selector-text",children:[(0,h.jsx)("span",{children:t}),(0,h.jsx)("i",{className:"icon-arrowright"})]});return(0,h.jsxs)("div",{className:"form-template-automation",children:[(0,h.jsx)("div",{className:"form-label",children:"Automation:"}),(0,h.jsx)("div",{className:"template-automation-selector",children:(0,h.jsx)(c.A,{text:s,action:()=>{this.openAutomationHelp()},disabled:this.props.isReadOnlyAccess})})]})}}D.displayName="MTEditorAutomation",B(D,"propTypes",{isReadOnlyAccess:p().bool.isRequired,getEvent:p().func.isRequired,setTempOptions:p().func.isRequired,setOptions:p().func.isRequired,applyTempOptions:p().func.isRequired,cancelTempOptions:p().func.isRequired,sectionEvents:p().array.isRequired,options:p().object.isRequired,showErrors:p().bool,setOptionsError:p().func}),B(D,"defaultProps",{showErrors:!1,setOptionsError:()=>{}});var q=s(48547),z=s(24262),U=s(7008),V=s(46743),K=s(96143),H=s(81438),W=s(92628),G=s(82372),$=s(21444),Q=s(10950),Y=s(88454),Z=s(23314),X=s(83112),J=s(28310);s(3560),s(4918);const ee=()=>(0,h.jsxs)("div",{className:"no-results-found-placeholder",children:[(0,h.jsx)("div",{className:"no-results-icon-wrapper",children:(0,h.jsx)("i",{className:"icon-search"})}),(0,h.jsxs)("p",{children:[r.Ay.t("common:nothingWasFound"),(0,h.jsx)("br",{}),r.Ay.t("common:tryChangingTheSearchParameters")]})]});ee.displayName="renderNoResultsPlaceHolder";class te extends a.Component{constructor(e){super(e),this.platformAccessScope=J.A.getScope("PlatformAccess"),this.platformUserScope=J.A.getScope("PlatformUser"),this.platformUserEmailScope=J.A.getScope("PlatformUserEmail"),this.labelScope=J.A.getScope("Label"),this.hotelScope=J.A.getScope("Hotel"),this.state={type:e.type,availableForChannels:e.availableForChannels,availableForListings:e.availableForListings,availableForAccounts:e.availableForAccounts,availableForLabels:e.availableForLabels,searchString:"",labelString:"",isMobileSearchShown:!1},this.onChannelSettingChange=this.onChannelSettingChange.bind(this),this.onAvailableForTypeChange=this.onAvailableForTypeChange.bind(this),this.onSelectedListingsChange=this.onSelectedListingsChange.bind(this),this.onMobileSearchVisibilityChange=this.onMobileSearchVisibilityChange.bind(this),this.onAccountSelect=this.onAccountSelect.bind(this),this.onSearch=this.onSearch.bind(this),this.onApply=this.onApply.bind(this),this.onLabelSearch=this.onLabelSearch.bind(this),this.onLabelSelect=this.onLabelSelect.bind(this)}onApply(){let e=this.state,t=e.availableForChannels,s=e.availableForListings,i=e.availableForAccounts,n=e.availableForLabels;this.state.type!==W.xc&&(s=[]),this.state.type!==W._j&&(t=[]),this.state.type!==W.Iy&&(i=[]),this.state.type!==W.jz&&(n=[]),this.props.onApply({type:this.state.type,channels:t,listings:s,accounts:i,labels:n})}onMobileSearchVisibilityChange(e){this.setState({isMobileSearchShown:!e})}onSearch(e){this.setState({searchString:e})}onLabelSearch(e){this.setState({labelString:e})}onAvailableForTypeChange(e){this.setState({type:e})}onAccountSelect(e,t){this.setState(({availableForAccounts:s})=>{const i=[...s];if(e)i.push(t);else{const e=i.indexOf(t);e>-1&&i.splice(e,1)}return{availableForAccounts:i}})}onSelectedListingsChange(e,t){let s=[...this.state.availableForListings];if(!0===t){-1===s.indexOf(e)&&s.push(e);const t=this.getAllListingIds(),i=[...s];t.sort(),i.sort(),(s.indexOf("all-channels")>-1||t.join(";")===i.join(";"))&&(s=["all-channels",...this.getAllListingIds()])}else"all-channels"!==e&&s.indexOf(e)>-1&&(s.indexOf("all-channels")>-1?s.length>2&&(s.splice(s.indexOf("all-channels"),1),s.splice(s.indexOf(e),1)):s.length>1&&s.splice(s.indexOf(e),1));const i={type:W.xc,availableForListings:[...s]};this.setState(i)}onChannelSettingChange(e,t){this.setState(({availableForChannels:s})=>{const i=[...s];if(e)i.push(t);else{const e=i.indexOf(t);e>-1&&i.splice(e,1)}return{availableForChannels:i}})}onLabelSelect(e,t){this.setState(({availableForLabels:s})=>{let i=[...s];return e?i.push(t):i=i.filter(e=>e!==t),{availableForLabels:i}})}getAllListingIds(){return this.props.listings.map(e=>e.getCompositeKey())}canChangesBeApplied(){return!(this.state.type===W._j&&0===this.state.availableForChannels.length||this.state.type===W.Iy&&0===this.state.availableForAccounts.length||this.state.type===W.jz&&0===this.state.availableForLabels.length)}renderListingLine(e,t,s){var i;const n=this.state.availableForListings.indexOf(e.getCompositeKey())>-1,o="all-channels"===e.getCompositeKey()&&n;return(0,h.jsxs)("div",{className:"listing-line",onClick:()=>{this.onSelectedListingsChange(e.getCompositeKey(),!n)},children:[(0,h.jsx)("div",{className:"listing-line-checkbox",children:(0,h.jsx)(m.A,{checked:n,disabled:o})}),(0,h.jsx)("div",{className:"listing-line-icon",children:(0,h.jsx)(H.A,{isGroup:t,platformType:e.platform_type})}),(0,h.jsxs)("div",{className:"listing-info",children:[(0,h.jsx)("div",{className:"listing-name",children:(0,h.jsx)(V.A,{position:Q.V,children:null===(i=e.getProperty())||void 0===i?void 0:i.name})}),(0,h.jsx)("div",{className:"listing-platform",children:K.A.getPlatformName(e.platform_type)})]})]},s)}renderListingSelector(){if(this.props.listings.length>1){const e=[];e.push(this.renderListingLine({getCompositeKey:()=>"all-channels",platform_type:r.Ay.t("listings:allChannels"),getProperty:()=>this.props.property},!0,e.length));for(const t of this.props.listings)e.push(this.renderListingLine(t,!1,e.length));return(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:"available-for-label",children:r.Ay.t("listings:specifyChannels")}),e]})}return null}renderContentByType(){switch(this.state.type){case W.xc:return this.renderListingSelector();case W._j:return this.renderChannelContent();case W.Iy:return this.renderAccountsContent();case W.jz:return this.renderLabelsContent();default:return null}}renderOptionSelector(){const e=[];return X.A.hasFullListingAccess()&&(e.push((0,h.jsx)(z.A,{id:W.PG,name:"available-for",label:r.Ay.t("listings:allProperties"),value:W.PG,activeValue:this.state.type,onCh
1ange:this.onAvailableForTypeChange,disabled:!X.A.hasFullListingAccess()},e.length)),e.push((0,h.jsx)(z.A,{id:W._j,name:"available-for",label:r.Ay.t("listings:specificChannels"),value:W._j,activeValue:this.state.type,onChange:this.onAvailableForTypeChange,disabled:!X.A.hasFullListingAccess()},e.length))),this.props.accounts.length>0&&e.push((0,h.jsx)(z.A,{id:W.Iy,name:"available-for",label:r.Ay.t("listings:specificAccounts"),value:W.Iy,activeValue:this.state.type,onChange:this.onAvailableForTypeChange},e.length)),this.labelScope.count()&&e.push((0,h.jsx)(z.A,{id:W.jz,name:"available-for",label:r.Ay.t("listings:specificLabels"),value:W.jz,activeValue:this.state.type,onChange:this.onAvailableForTypeChange},e.length)),this.props.listings.length>0&&e.push((0,h.jsx)(z.A,{id:W.xc,name:"available-for",label:this.props.property.name,value:W.xc,activeValue:this.state.type,onChange:this.onAvailableForTypeChange},e.length)),(0,h.jsx)(U.A,{radioButtons:e})}renderChannelContent(){return(0,h.jsx)("div",{className:"available-for-channel-content",children:(0,h.jsxs)("div",{className:"channel-list",children:[(0,h.jsx)(m.A,{label:(0,h.jsxs)("span",{className:"channel-element",children:[(0,h.jsx)("i",{className:"icon-logo-igms3"}),(0,h.jsx)("span",{children:r.Ay.t("common:directBooking")})]}),checked:-1!==this.state.availableForChannels.indexOf("airgms"),onChange:e=>{this.onChannelSettingChange(e,"airgms")}}),(0,h.jsx)(m.A,{label:(0,h.jsxs)("span",{className:"channel-element",children:[(0,h.jsx)("i",{className:"icon-logo-airbnb3"}),(0,h.jsx)("span",{children:r.Ay.t("common:airbnbSite")})]}),checked:-1!==this.state.availableForChannels.indexOf("airbnb"),onChange:e=>{this.onChannelSettingChange(e,"airbnb")}}),(0,h.jsx)(m.A,{label:(0,h.jsxs)("span",{className:"channel-element",children:[(0,h.jsx)("i",{className:"icon-logo-vrbo3"}),(0,h.jsx)("span",{children:r.Ay.t("common:homeAwaySite")})]}),checked:-1!==this.state.availableForChannels.indexOf("homeaway"),onChange:e=>{this.onChannelSettingChange(e,"homeaway")}}),(0,h.jsx)(m.A,{label:(0,h.jsxs)("span",{className:"channel-element",children:[(0,h.jsx)("i",{className:"icon-booking"}),(0,h.jsx)("span",{children:r.Ay.t("common:bookingSite")})]}),checked:-1!==this.state.availableForChannels.indexOf("booking"),onChange:e=>{this.onChannelSettingChange(e,"booking")}})]})})}renderAccountsList(){const e=[];return this.props.accounts.forEach(t=>{const s=this.platformAccessScope.getObject(t),i=this.hotelScope.getObject(t);if(s){const d=`${s.platform_user_id}-${s.platform_type}`,u=this.platformUserScope.getObject(d),g=this.platformUserEmailScope.getObject(d);let b=null,y="",v="";if(!u)return;if(i){var n;b=(0,h.jsx)(G.A,{url:Y.A.getIconPathByTypeId(i.platform_hotel_type),bottomRightIconUrl:"img/platform/booking/blue-circle-letter-dot-for-icons.svg",firstName:i.platform_hotel_name,size:40,bottomRightIconAsAlternative:!0}),y=null!==(n=i.platform_hotel_name)&&void 0!==n?n:"",v=""}else{var o,a,r,l,p,c;b=(0,h.jsx)(G.A,{url:u.icon,firstName:null!==(o=u.full_name)&&void 0!==o?o:u.name,size:40,bottomRightIconUrl:K.A.getPlatformIconUrl(s.platform_type),bottomRightIconAsAlternative:!0});const e=g?g.email:null;y=null!==(a=null!==(r=u.full_name)&&void 0!==r?r:u.name)&&void 0!==a?a:"",v=null!==(l=null!==(p=null!==(c=u.email)&&void 0!==c?c:s.platform_login)&&void 0!==p?p:e)&&void 0!==l?l:""}const f=this.state.searchString.toLowerCase(),A=y.toLowerCase(),O=v.toLowerCase();if(!(0,T.Im)(f)&&-1===A.indexOf(f)&&-1===O.indexOf(f))return;e.push((0,h.jsx)("div",{className:"available-for-account",children:(0,h.jsx)(m.A,{label:(0,h.jsxs)("div",{className:"available-for-account-thumbnail",children:[b,(0,h.jsxs)("div",{className:"available-for-account-data",children:[(0,h.jsx)("span",{className:"available-for-account-data-title",children:Z.A.highlightText(y,f)}),(0,h.jsx)("span",{className:"available-for-account-data-subtitle",children:Z.A.highlightText(v,f)})]})]}),checked:-1!==this.state.availableForAccounts.indexOf(t),onChange:e=>{this.onAccountSelect(e,t)}})},t))}}),e}renderAccountsContent(){const e=this.renderAccountsList();return(0,h.jsxs)("div",{className:"available-for-accounts-content",children:[(0,h.jsx)("div",{className:"available-for-accounts-content-header",children:(0,h.jsx)($.A,{onChange:this.onSearch,searchString:this.state.searchString,placeHolder:r.Ay.t("common:searchAccounts"),minimumSymbolsToSearch:0,onMobileButtonVisibilityChange:this.onMobileSearchVisibilityChange})}),(0,h.jsx)("div",{className:"available-for-accounts-content-body",children:e.length>0?e:ee()})]})}renderLabelsList(){const e=this.state.labelString;return Object.values(this.labelScope.getAll()).map(t=>{if(-1===t.label_name.indexOf(e))return null;const s=-1!==this.state.availableForLabels.indexOf(t.id);return(0,h.jsxs)("div",{className:"available-for-label",onClick:e=>{this.onLabelSelect(!s,t.id),e.preventDefault()},children:[(0,h.jsx)("div",{className:"available-for-label-checkbox",children:(0,h.jsx)(m.A,{checked:s})}),(0,h.jsx)("div",{className:"available-for-label-data",children:(0,h.jsx)(V.A,{children:(0,h.jsx)("span",{className:"available-for-label-name",children:Z.A.highlightText(t.label_name,e)})})})]},t.id)}).filter(e=>null!==e)}renderLabelsContent(){const e=this.renderLabelsList(),t=this.labelScope.count(),s=this.state.availableForLabels.length;return(0,h.jsxs)("div",{className:"available-for-labels-content",children:[t>15&&(0,h.jsx)("div",{className:"available-for-labels-content-header",children:(0,h.jsx)($.A,{onChange:this.onLabelSearch,searchString:this.state.labelString,placeHolder:r.Ay.t("common:searchLabels"),minimumSymbolsToSearch:0,onMobileButtonVisibilityChange:this.onMobileSearchVisibilityChange})}),(0,h.jsxs)("div",{className:"available-for-labels-counts",children:[(0,h.jsx)("span",{className:"labels-count-total",children:r.Ay.t("common:labelsWithCount",{count:t}).toUpperCase()}),(0,h.jsx)("span",{className:"labels-count-selected",children:r.Ay.t("common:selectedWithCount",{count:s}).toUpperCase()})]}),(0,h.jsx)("div",{className:"available-for-labels-content-body",children:e.length>0?e:ee()})]})}renderSidebarBodyClassNames(){return["editor-sidebar-body",`available-for-type-${this.state.type}`].join(" ")}render(){return(0,h.jsxs)("div",{className:"editor-sidebar-wrapper",children:[(0,h.jsxs)("div",{className:"editor-sidebar-header",children:[this.renderOptionSelector(),(0,h.jsx)("img",{src:v,alt:"sidebar-header"})]}),(0,h.jsx)("div",{className:this.renderSidebarBodyClassNames(),children:(0,h.jsxs)("div",{className:"available-for-list",children:[this.renderContentByType(),!this.state.isMobileSearchShown&&(0,h.jsxs)("div",{className:"available-for-buttons",children:[(0,h.jsx)(c.A,{wrapperClassName:"apply-button",text:r.Ay.t("common:apply"),type:PLATFORM_APP.isMobileScreen2()?"default":"primary",action:this.onApply,disabled:!this.canChangesBeApplied()}),(0,h.jsx)(c.A,{wrapperClassName:"cancel-button",text:r.Ay.t("common:cancel"),action:this.props.onCancel})]})]})})]})}}function se(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var s=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=s){var i,n,o,a,r=[],l=!0,p=!1;try{if(o=(s=s.call(e)).next,0===t){if(Object(s)!==s)return;l=!1}else for(;!(l=(i=o.call(s)).done)&&(r.push(i.value),r.length!==t);l=!0);}catch(e){p=!0,n=e}
1finally{try{if(!l&&null!=s.return&&(a=s.return(),Object(a)!==a))return}finally{if(p)throw n}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ie(e,t);var s={}.toString.call(e).slice(8,-1);return"Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s?Array.from(e):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?ie(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var s=0,i=Array(t);s<t;s++)i[s]=e[s];return i}function ne(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}te.displayName="MTAvailableForSidebar",function(e,t,s){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s}(te,"propTypes",{property:p().object.isRequired,listings:p().array.isRequired,accounts:p().array.isRequired,availableForChannels:p().array.isRequired,availableForListings:p().array.isRequired,availableForAccounts:p().array.isRequired,availableForLabels:p().array.isRequired,type:p().string.isRequired,onApply:p().func.isRequired,onCancel:p().func.isRequired}),s(60933);const oe=()=>{PLATFORM_APP.onBackKeyDown()};class ae extends a.Component{constructor(e){super(e),this.labelScope=J.A.getScope("Label"),this.openAvailableForSidebar=this.openAvailableForSidebar.bind(this),this.apply=this.apply.bind(this),this.renderLabelApplied=this.renderLabelApplied.bind(this)}getListingName(e){let t=!1;if(this.props.listings.length>0)for(const i of this.props.listings)if(i.getCompositeKey()===e){var s;t=null===(s=i.getProperty())||void 0===s?void 0:s.name;break}return t||this.props.property.name}apply(e){this.props.applyAvailableFor(e),PLATFORM_APP.onBackKeyDown()}openAvailableForSidebar(){const e=(0,h.jsx)(te,{property:this.props.property,listings:this.props.listings,accounts:this.props.accounts,availableForChannels:this.props.availableFor.channels,availableForListings:this.props.availableFor.listings,availableForAccounts:this.props.availableFor.accounts,availableForLabels:this.props.availableFor.labels,type:this.props.availableFor.type,onApply:this.apply,onCancel:oe});PLATFORM_APP.isMobileScreen2()?PLATFORM_APP.page.pageApi.openCard({title:r.Ay.t("listings:availableFor"),card:u.A,cardProps:{content:e}}):this.props.openCardSidebar(e,r.Ay.t("listings:availableFor"),"available-for-sidebar")}renderIcons(e){const t=[];if(e.length>0){const s=[];for(const t of e){const e=se(t.getCompositeKey().split("-",2),2)[1];s.indexOf(e)<0&&s.push(e)}for(const e of s)t.push((0,h.jsx)(q.A,{platformType:e},t.length))}return t}renderText(){switch(this.props.availableFor.type){case W.xc:return 1===this.props.availableFor.listings.length?this.getListingName(this.props.availableFor.listings[0]):this.props.property.name;case W._j:return r.Ay.t("common:channelsWithCount",{count:this.props.availableFor.channels.length});case W.Iy:return r.Ay.t("common:accountsWithCount",{count:this.props.availableFor.accounts.length});case W.jz:return`${r.Ay.t("common:labelsWithCount",{count:this.props.availableFor.labels.length})}:`;default:return r.Ay.t("listings:allProperties")}}renderLabelApplied(e){const t=this.labelScope.getObject(e);return t?(0,h.jsx)("div",{className:"pe-general-labels__label",children:(0,h.jsx)("div",{className:"pe-general-labels__label-inner",children:t.label_name})}):null}renderIconElements(){let e=[];
1if(this.props.availableFor.type===W.xc)if(this.props.availableFor.listings.length<1||this.props.availableFor.listings.indexOf("all-channels")>-1)e=this.renderIcons(this.props.listings);else{const t=[];if(this.props.availableFor.listings.length>0)for(const e of this.props.availableFor.listings)t.push({getCompositeKey:()=>e});e=this.renderIcons(t)}else if(this.props.availableFor.type===W._j)for(const t of this.props.availableFor.channels)e.push((0,h.jsx)(q.A,{platformType:t},t));else this.props.availableFor.type===W.jz&&(e=(0,h.jsx)("div",{className:"mt-editor-labels",children:this.props.availableFor.labels.map(this.renderLabelApplied)}));return e}renderButtonClassNames(){const e=["selector-text"];return this.props.availableFor.type!==W.xc&&e.push("all-properties"),e.join(" ")}render(){const e=(0,h.jsxs)("span",{className:this.renderButtonClassNames(),children:[(0,h.jsx)("span",{children:this.renderText()}),this.renderIconElements(),(0,h.jsx)("i",{className:"icon-arrowright"})]}),t=["form-template-available"];return PLATFORM_APP.isMobileScreen2()&&t.pu
1sh("for-mobile"),(0,h.jsxs)("div",{className:t.join(" "),children:[(0,h.jsxs)("div",{className:"form-label",children:[r.Ay.t("listings:availableFor"),":"]}),(0,h.jsx)("div",{className:"template-available-selector",children:(0,h.jsx)(c.A,{wrapperClassName:"desktop-button",text:e,action:this.openAvailableForSidebar,disabled:this.props.isReadOnlyAccess})})]})}}ae.displayName="MTEditorAvailable",ne(ae,"propTypes",{property:p().object.isRequired,accounts:p().array.isRequired,listings:p().array.isRequired,availableFor:p().object.isRequired,applyAvailableFor:p().func.isRequired,isReadOnlyAccess:p().bool.isRequired,openCardSidebar:p().func}),ne(ae,"defaultProps",{openCardSidebar:()=>{}}),s(21848);var re=s(54822);s(92009);class le extends a.Component{render(){return(0,h.jsxs)("div",{className:"editor-menu-popup",children:[(0,h.jsx)(c.A,{className:"share-template-button",text:r.Ay.t("common:shareTemplate")}),(0,h.jsx)(c.A,{className:"delete-template-button",text:r.Ay.t("common:deleteTemplate"),action:()=>{PLATFORM_APP.onBackKeyDown(),this.props.deleteTemplate()}})]})}}function pe(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}le.displayName="MTEditorMenuPopup",function(e,t,s){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s}(le,"propTypes",{deleteTemplate:p().func.isRequired});class ce extends a.Component{render(){const e=["save-template-button"];return this.props.isError&&e.push("disabled"),(0,h.jsxs)("div",{className:"card-buttons-wrapper",children:[!this.props.isReadOnlyAccess&&(0,h.jsx)(c.A,{className:e.join(" "),text:r.Ay.t("common:save"),busy:this.props.isSaving,disabled:this.props.disableSave,type:"primary",action:()=>{this.props.saveTemplate()}}),(0,h.jsx)(c.A,{className:"share-template-button",wrapperClassName:"share-template",text:r.Ay.t("common:share")}),(0,h.jsx)(c.A,{className:"edit-cancel-button",text:r.Ay.t("common:cancel"),disabled:this.props.isSaving,action:()=>{PLATFORM_APP.onBackKeyDown()}}),!(0,T.Im)(this.props.templateId)&&!this.props.isReadOnlyAccess&&(0,h.jsx)(c.A,{className:"delete-template-button",wrapperClassName:"delete-template",text:(0,h.jsxs)("span",{children:[r.Ay.t("listings:deleteTemplate")," ",(0,h.jsx)("i",{className:"icon-delete"})]}),action:()=>{this.props.deleteTemplate()}}),!(0,T.Im)(this.props.templateId)&&!this.props.isReadOnlyAccess&&(0,h.jsx)(c.A,{className:"popup-menu-button",wrapperClassName:"popup-menu",text:(0,h.jsx)("i",{className:"icon-arrowup"}),action:()=>{PLATFORM_APP.page.pageApi.openSidebar({component:(0,h.jsx)(re.A,{content:(0,h.jsx)(le,{deleteTemplate:this.props.deleteTemplate})}),side:"bottom",size:"112px",hasCloser:!1,customClass:"sidebar-MTPopup"})}})]})}}ce.displayName="MTEditorCardButtons",pe(ce,"propTypes",{isSaving:p().bool,disableSave:p().bool,templateId:p().oneOfType([p().string,p().number]),saveTemplate:p().func.isRequired,deleteTemplate:p().func.isRequired,isError:p().bool,isReadOnlyAccess:p().bool.isRequired}),pe(ce,"defaultProps",{isError:!1}),s(22879);var he=s(19538),de=s(33495),ue=s(96249),me=s(88108),ge=s(53124);function be(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class ye extends a.Component{constructor(e){super(e),this.state={isOverlayed:!(0,T.Im)(e.content),cursorPosition:e.content.length,customPosition:!1,showErrors:!0},this.addPlaceholder=this.addPlaceholder.bind(this),this.onChange=this.onChange.bind(this),this.showOverlay=this.showOverlay.bind(this),this.hideOverlay=this.hideOverlay.bind(this),this.placeholderButtons=this.placeholderButtons.bind(this),this.isPlaceholder=this.isPlaceholder.bind(this),this.explodeByBr=this.explodeByBr.bind(this),this.getBrExplodedParts=this.getBrExplodedParts.bind(this),this.explodeByPlaceholder=this.explodeByPlaceholder.bind(this),this.getOverlayContent=this.getOverlayContent.bind(this),this.onCursorPositionChange=this.onCursorPositionChange.bind(this),this.hasWrongPlaceholders=this.hasWrongPlaceholders.bind(this),this.openContentEditorMobile=this.openContentEditorMobile.bind(this)}openContentEditorMobile(){this.setState({isOverlayed:!0}),PLATFORM_APP.page.pageApi.openCard(r.Ay.t("messageTemplates:templateContent"),he.A,{content:this.props.content,onContentChange:this.onChange,placeholders:this.props.placeholders,getPlaceholderName:this.getPlaceholderName,openSidebar:this.props.openSidebar})}addPlaceholder(e){this.setState(t=>{const s=this.props.content.substring(0,t.cursorPosition),i=this.props.content.substring(t.cursorPosition),n=s+e+i,o=t.cursorPosition+e.length;return this.props.changeContent(n),{content:n,isOverlayed:!1,cursorPosition:o,customPosition:!0}})}onChange(e){this.props.changeContent(e),this.setState({content:e,customPosition:!1,showErrors:!1})}showOverlay(){this.setState({isOverlayed:!0,showErrors:!0})}hideOverlay(){this.setState({isOverlayed:!1}
1)}placeholderButtons(){const e=this.props.placeholders,t=Object.keys(e).map((t,s)=>{const i=e[t];return(0,h.jsx)(ue.A,{addPlaceholder:this.addPlaceholder,placeholder:i,name:t},s)});return t.push((0,h.jsx)(me.A,{text:(0,h.jsxs)("span",{children:[r.Ay.t("messageTemplates:insertVariablesToRetrieve"),(0,h.jsx)("br",{}),(0,h.jsx)("a",{href:r.Ay.t("common:helpDeskLinks.howToUseTemplates"),target:"_blank",rel:"noreferrer",children:r.Ay.t("common:learnMore")})]}),size:Q.HT,children:(0,h.jsx)(c.A,{wrapperClassName:"help-desk",text:"?"})},t.length)),t}isPlaceholder(e){const t=this.props.placeholders;return Object.values(t).includes(e)||e.match(/^\{\{guests_phone:[1-9]\}\}$/)}explodeByBr(e,t){const s=/\r|\n/.exec(e);let i,n,o;return s?(i=s.index>0?e.substring(0,s.index):"",n=(0,h.jsx)("br",{},`br${t}`),o=e.substring(s.index+s[0].length),[i,n,o]):[e]}getBrExplodedParts(e){let t=0,s=this.explodeByBr(e,t);const i=[];for(;s.length>1;)t++,i.push(s[0]),i.push(s[1]),s=this.explodeByBr(s[2],t);return i.push(s[0]),i}explodeByPlaceholder(e){const t=e.indexOf("{{"),s=e.indexOf("}}");let i,n,o;return t>-1&&s>t+2?(t>0?(i=e.substring(0,t),i=this.getBrExplodedParts(i)):i=[""],n=e.substring(t,s+2),o=e.substring(s+2),[i,n,o]):[this.getBrExplodedParts(e)]}getOverlayContent(){const e=this.props.content;let t,s;const i=[];for(s=this.explodeByPlaceholder(e);s.length>1;)i.push((0,h.jsx)("span",{children:s[0]},i.length)),t=this.isPlaceholder(s[1])?"placeholder":"wrong-placeholder",i.push((0,h.jsx)("span",{className:t,children:s[1]},i.length)),s=this.explodeByPlaceholder(s[2]);return i.push((0,h.jsx)("span",{children:s[0]},i.length)),i}onCursorPositionChange(e){this.setState({cursorPosition:e})}hasWrongPlaceholders(){let e=!1,t=this.explodeByPlaceholder(this.props.content);for(;t.length>1;){if(!this.isPlaceholder(t[1])){e=!0;break}t=this.explodeByPlaceholder(t[2])}return e}renderError(){if(this.showErrors()){if((0,T.Im)(this.props.content))return(0,h.jsx)("div",{className:"error-message",children:(0,h.jsxs)("div",{className:"error-text",children:[(0,h.jsx)("i",{className:"icon-error"})," ",(0,h.jsx)("div",{children:r.Ay.t("messageTemplates:noTemplateContentDefined")})]})});if(this.hasWrongPlaceholders())return(0,h.jsx)("div",{className:"error-message",children:(0,h.jsxs)("div",{className:"error-text",children:[(0,h.jsx)("i",{className:"icon-error"})," ",(0,h.jsx)("div",{children:r.Ay.t("messageTemplates:templateContentHasErrors")})]})})}return""}showErrors(){return this.state.showErrors&&this.props.showErrors&&((0,T.Im)(this.props.content)||this.hasWrongPlaceholders())}render(){const e=["desktop-content-overlay"],t=["content-area-body"];this.showErrors()&&(e.push("error"),t.push("error"));const s=this.state.isOverlayed&&!(0,T.Im)(this.props.content)?(0,h.jsx)("div",{className:e.join(" "),children:this.getOverlayContent()}):"",i=!!this.state.customPosition&&this.state.cursorPosition,n=!(0,T.Im)(this.props.content)&&!this.state.isOverlayed;return(0,h.jsxs)("div",{className:"content-area-wrapper",children:[!this.props.isReadOnlyAccess&&(0,h.jsx)("div",{className:"content-area-header",children:this.placeholderButtons()}),(0,h.jsxs)("div",{className:t.join(" "),children:[(0,h.jsx)(ge.A,{onBlur:()=>{this.showOverlay()},value:this.props.content,onChange:e=>{this.onChange(e.target.value)},focusOnUpdate:n,placeholder:r.Ay.t("messageTemplates:templateContent"),onCursorPositionChange:this.onCursorPositionChange,cursorPosition:i,onFocus:()=>{this.hideOverlay()},onClick:()=>{this.setState({customPosition:!1})},disabled:this.props.isReadOnlyAccess}),(0,h.jsxs)("div",{children:[(0,h.jsx)(c.A,{text:this.props.isReadOnlyAccess?null:(0,h.jsx)("i",{className:"icon-arrowright"}),action:this.props.isReadOnlyAccess?()=>{}:this.openContentEditorMobile,wrapperClassName:"mobile-content-overlay"}),s]})]}),(0,h.jsx)(de.A,{activeLanguage:this.props.activeLanguage,isReadOnlyAccess:this.props.isReadOnlyAccess,deleteLanguage:this.props.deleteLanguage}),this.renderError()]})}}ye.displayName="MTContentArea",be(ye,"propTypes",{isReadOnlyAccess:p().bool.isRequired,changeContent:p().func.isRequired,placeholders:p().object.isRequired,content:p().string.isRequired,openSidebar:p().func.isRequired,activeLanguage:p().string.isRequired,deleteLanguage:p().func.isRequired,showErrors:p().bool}),be(ye,"defaultProps",{showErrors:!1});var ve=s(26002),fe=s(31817);
1function Ae(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s(97899);class Oe extends a.Component{constructor(e){super(e),this.onLanguageChange=this.onLanguageChange.bind(this)}onLanguageChange(e){"new"===e?this.props.addNewLanguage():this.props.onLanguageChange(e)}render(){const e=this.props,t=e.content,s=e.activeLanguage,i=e.isReadOnlyAccess,n=e.addNewLanguage,o=r.Ay.t("listings:templateEditWarning");return(0,h.jsxs)("div",{className:"form-template-content",children:[this.props.isReadOnlyAccess&&(0,h.jsx)(ve.A,{type:"warning",text:o}),(0,h.jsx)(fe.A,{languages:Object.keys(t),activeLanguage:s,onLanguageChange:this.onLanguageChange,isReadOnly:i,addNewLanguage:n}),(0,h.jsx)("div",{className:"template-content-area",children:(0,h.jsx)(ye,{placeholders:this.props.placeholders,content:t[s],changeContent:this.props.changeContent,openSidebar:this.props.openSidebar,showErrors:this.props.showErrors,activeLanguage:s,deleteLanguage:this.props.deleteLanguage,isReadOnlyAccess:i})})]})}}Oe.displayName="MTEditorContent",Ae(Oe,"propTypes",{isReadOnlyAccess:p().bool.isRequired,changeContent:p().func.isRequired,placeholders:p().object.isRequired,content:p().object.isRequired,openSidebar:p().func.isRequired,activeLanguage:p().string.isRequired,onLanguageChange:p().func.isRequired,addNewLanguage:p().func.isRequired,deleteLanguage:p().func.isRequired,showErrors:p().bool}),Ae(Oe,"defaultProps",{showErrors:!1});var xe=s(31292);function je(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,i)}return s}function Te(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?je(Object(s),!0).forEach(function(t){Pe(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):je(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function Pe(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s(94412);class Ce extends a.Component{constructor(e){super(e),this.updateImages=this.updateImages.bind(this)}updateImages(e){this.props.updateImages(e.map(e=>{var t;return Te(Te({},e),{},{file_size:null!==(t=e.file_size)&&void 0!==t?t:e.size,"object-name":e["object-name"]||e.object_name})}))}render(){return(0,h.jsxs)("div",{className:"form-template-images",children:[(0,h.jsxs)("div",{className:"form-label",children:[r.Ay.t("listings:attachedImages"),":"]}),(0,h.jsx)("div",{className:"template-images-area",children:(0,h.jsx)(xe.A,{images:this.props.images,onChangeState:this.updateImages,showWizardPanel:!1,showCover:!1,showSelection:!1,showFooterDelete:!this.props.isReadOnlyAccess,dragFileCssClasse
1s:[],onUploadingStarted:this.props.uploadStart,onUploadingFinished:this.props.uploadStop,onUploadingAborted:this.props.uploadStop,attachItemLast:!0,shortAttachItem:!0,smallItems:!0,isImageLoaderShown:!this.props.isReadOnlyAccess,isItemDraggable:!this.props.isReadOnlyAccess,groupSameNameImages:!1})}),this.props.uploading&&this.props.showErrors&&(0,h.jsxs)("div",{className:"error-text",children:[(0,h.jsx)("i",{className:"icon-error"})," ",(0,h.jsx)("div",{children:r.Ay.t("listings:waitForImages")})]})]})}}Ce.displayName="MTEditorImages",Pe(Ce,"propTypes",{isReadOnlyAccess:p().bool.isRequired,updateImages:p().func.isRequired,uploadStart:p().func.isRequired,uploadStop:p().func.isRequired,images:p().array,uploading:p().bool,showErrors:p().bool}),Pe(Ce,"defaultProps",{images:[],uploading:!1,showErrors:!1}),s(9391);var we=s(49500);function Se(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class _e extends a.Component{constructor(e){super(e),this.state={inputFocused:!1}}renderError(){return!this.props.inputFocused&&this.state.showErrors&&(0,T.Im)(this.props.title)&&(0,h.jsxs)("div",{className:"error-text",children:[(0,h.jsx)("i",{className:"icon-error"}),(0,h.jsx)("div",{children:r.Ay.t("listings:pleaseGiveYourTemplateAShortName")})]})}render(){return(0,h.jsxs)("div",{className:"form-template-name",children:[(0,h.jsxs)("div",{className:"form-label",children:[r.Ay.t("listings:templateName"),":"]}),(0,h.jsx)("div",{className:"template-name-input",children:(0,h.jsx)(we.A,{value:this.props.title,onChange:e=>this.props.changeName(e),placeHolder:r.Ay.t("listings:templateNamePlaceholder"),error:this.renderError(),onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1}),disabled:this.props.isReadOnlyAccess})})]})}}_e.displayName="MTEditorName",Se(_e,"propTypes",{changeName:p().func.isRequired,title:p().string.isRequired,isReadOnlyAccess:p().bool.isRequired,showErrors:p().bool}),Se(_e,"defaultProps",{showErrors:!1});var Ie=s(62536),Ee=s(30238),Ne=s(53951),Re=s(32646),ke=s(2119),Fe=s(48719),Le=s(25516),Me=s(88376),Be=s(2566),De=s(54170),qe=s(44991),ze=s(27578);function Ue(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,i)}return s}function Ve(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(s),!0).forEach(function(t){Ke(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ue(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function Ke(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s(37328),s(44819);class He extends Ee.A{constructor(e){super(e),this.propertyScope=J.A.getScope("Property"),this.messageTemplateScope=J.A.getScope("MessageTemplate"),this.messageTemplateTextScope=J.A.getScope("MessageTemplateText"),this.messageTemplateImageScope=J.A.getScope("MessageTemplateImage"),this.autoresponseEventsScope=J.A.getScope("AutoresponseEvents"),this.messageTemplateAccountAccessScope=J.A.getScope("MessageTemplateAccountAccess"),this.labelScope=J.A.getScope("Label"),this.messageTemplateLabelScope=J.A.getScope("MessageTemplateLabelRelation");let t=e.templateId?this.messageTemplateScope.getObject(e.templateId):null;(0,T.Im)(t)&&(t={content:{en:""},title:"",group_id:null,is_autoresponder:0,last_minute_booking:"",listing_id:null,event_type:"",back_to_back_
1ignore:0,guest_already_left_review_ignore:0});const s=this.messageTemplateTextScope.findObjects({message_template_id:e.templateId});0!==Object.keys(s).length&&"string"!=typeof t.content&&t.content||(t.content={en:"string"==typeof t.content?t.content:""}),Object.keys(s).forEach(e=>{const i=s[e].language_code;t.content[i]=s[e].content}),this.property=this.propertyScope.getObject(e.propertyUid),this.timezone=this.timezoneName(),this.listings=this.getPropertyListings(),this.sectionEvents=[["before-checkin","on-checkin-day","after-checkin"],["during-stay-repeat"],["before-checkout","on-checkout-day","after-checkout"],["on-inquiry","on-booking","on-cancellation","on-alteration","on-checkin-form-completed"]],this.events={},this.originalListingIds=new Set,this.areCategoriesTouched=!1;const i=!(0,T.Im)(t.length_of_reservation_at_least)||!(0,T.Im)(t.one_night_ignore)&&"1"===t.one_night_ignore;let n=1;(0,T.Im)(t.length_of_reservation_at_least)||(n=t.length_of_reservation_at_least),!(0,T.Im)(t.one_night_ignore)&&"1"===t.one_night_ignore&&n<2&&(n=2),this.tempOptions={isAutoresponder:1===t.is_autoresponder,eventId:(0,T.Im)(t.event_type)?null:t.event_type,eventThreshold:(0,T.Im)(t.event_threshold)?1:t.event_threshold,beginTime:(0,T.Im)(t.begin_time)?"":this.convertOldBeginTime(t.begin_time),backToBackIgnore:!(0,T.Im)(t.back_to_back_
1ignore)&&"1"===t.back_to_back_ignore,guestAlreadyLeftReviewIgnore:!(0,T.Im)(t.guest_already_left_review_ignore)&&"1"===t.guest_already_left_review_ignore,lastMinuteBooking:!(0,T.Im)(t.last_minute_booking)&&"1"===t.last_minute_booking,reservationMinChecked:i,reservationMaxChecked:!(0,T.Im)(t.length_of_reservation_less_than),reservationMin:n,reservationMax:(0,T.Im)(t.length_of_reservation_less_than)?n:t.length_of_reservation_less_than,delayTime:(0,T.Im)(t.delay_time)?0:parseInt(t.delay_time,10),repeatMode:(0,T.Im)(t.repeat_mode)?j.W0.repeatMode:t.repeat_mode,repeatWeekdays:(0,T.Im)(t.repeat_weekdays)?[]:t.repeat_weekdays.map(e=>parseInt(e,10)),repeatIntervalDays:(0,T.Im)(t.repeat_interval_days)?j.W0.repeatIntervalDays:parseInt(t.repeat_interval_days,10)},this.state=Ve(Ve({},this.state),{},{availableFor:{type:W.PG,listings:[],channels:[],accounts:[],labels:[]},placeholders:{},options:Ve({},this.tempOptions),showErrors:!1,isOptionsError:!1,imageUploading:!1,disableSave:!0,isSaving:!1,images:e.templateId?this.preparedImages(this.messageTemplateImageScope.findObjects({template_id:e.templateId})):[],templateId:e.templateId,template:t,categoryUids:e.templateId?(0,Fe.o_)(e.templateId):[],activeLanguage:Be.A.getDefaultLanguage(),languagesWithTranslationInProgress:[],accounts:[],labels:[]}),this.updateTemplatesData(),this.timezoneName=this.timezoneName.bind(this),this.imageUploadStart=this.imageUploadStart.bind(this),this.imageUploadStop=this.imageUploadStop.bind(this),this.updateImages=this.updateImages.bind(this),this.convertOldBeginTime=this.convertOldBeginTime.bind(this),this.setOptionsError=this.setOptionsError.bind(this),this.hasErrors=this.hasErrors.bind(this),this.getEvent=this.getEvent.bind(this),this.setTempOptions=this.setTempOptions.bind(this),this.setOptions=this.setOptions.bind(this),this.getTemplateListings=this.getTemplateListings.bind(this),this.updateTemplatesData=this.updateTemplatesData.bind(this),this.getPropertyListings=this.getPropertyListings.bind(this),this.cancelTempOptions=this.cancelTempOptions.bind(this),this.applyTempOptions=this.applyTempOptions.bind(this),this.applyAvailableFor=this.applyAvailableFor.bind(this),this.applyCategories=this.applyCategories.bind(this),this.deleteTemplate=this.deleteTemplate.bind(this),this.checkSaveConfirmationNeed=this.checkSaveConfirmationNeed.bind(this),this.saveTemplate=this.saveTemplate.bind(this),this.changeName=this.changeName.bind(this),this.changeContent=this.changeContent.bind(this),this.isImageLoaderAvailable=this.isImageLoaderAvailable.bind(this),this.isRecurrenceAvailable=this.isRecurrenceAvailable.bind(this),this.getDefaultCardSidebarContent=this.getDefaultCardSidebarContent.bind(this),this.openLanguageSelector=this.openLanguageSelector.bind(this),this.changeLanguage=this.changeLanguage.bind(this),this.translateTemplate=this.translateTemplate.bind(this),this.deleteLanguage=this.deleteLanguage.bind(this)}isReadOnlyAccess(){return this.state.availableFor.type!==W.xc&&(-1!==[W.PG,W._j].indexOf(this.state.availableFor.type)?!X.A.hasFullListingAccess():this.state.availableFor.type!==W.jz&&(this.state.availableFor.accounts.filter(e=>!this.state.accounts.includes(e)).length>0&&!X.A.hasFullListingAccess()))}deleteLanguage(){this.setState(e=>{const t=e.template;delete t.content[this.state.activeLanguage];const s=Object.keys(t.content);return{template:t,activeLanguage:s[s.length-1]}})}openLanguageSelector(){const e=(0,h.jsx)(De.Ay,{onSelect:this.translateTemplate,selectedLanguages:Object.keys(this.state.template.content)});PLATFORM_APP.isMobileScreen2()?PLATFORM_APP.page.pageApi.openCard(r.Ay.t("common:addALanguage"),u.A,{buttons:null,content:e}):this.openCardSidebar(e,!0,!1,!0,r.Ay.t("common:addALanguage"),null,"language-selector-sidebar")}changeLanguage(e){this.setState({activeLanguage:e})}translateTemplate(e){(0,De.iF)(e),qe.A.translateMessageTemplate(this.state.template.content[Be.A.getDefaultLanguage()],e,Be.A.getDefaultLanguage()).then(t=>{(0,De.jE)(e),1===t.status&&(PLATFORM_APP.onBackKeyDown(),this.setState(s=>{const i=Ve({},s.template);return i.content[e]=t.text,{template:i,activeLanguage:e}}))})}static propertyTimezoneName(e){return(0,T.Im)(e)?"":(0,T.Im)(e.property_data_json)||(0,T.Im)(e.property_data_json.timezone)||(0,T.Im)(e.property_data_json.location)||(0,T.Im)(e.property_data_json.location.city)||(0,T.Im)(e.property_data_json.timezone.timezone_name)?(0,T.Im)(e.listing_timezone)?"":e.listing_timezone:e.property_data_json.timezone.timezone_name}selectedTimezoneNames(){if((0,T.Im)(this.listings))return[];const e=(0,T.Im)(this.state.availableFor)||(0,T.Im)(this.state.availableFor.listings)?null:this.state.availableFor.listings,t=new Set;for(const s of this.listings){if(null!==e&&!e.includes(s.getCompositeKey()))continue;const i=He.propertyTimezoneName(s.getProperty());""!==i&&t.add(i)}return[...t]}timezoneName(){if((0,T.Im)(this.property))return"";if(!(0,T.Im)(this.state.availableFor)&&this.state.availableFor.type===W.PG)return r.Ay.t("common:basedOnPropertyTimeZone");const e=this.selectedTimezoneNames();return 1===e.length?e[0]:e.length>1?r.Ay.t("common:basedOnPropertyTimeZone"):He.propertyTimezoneName(this.property)}imageUploadStart(){this.setState({imageUploading:!0})}imageUploadStop(){this.setState({imageUploading:!1})}updateImages(e){this.setState({images:e})}preparedImages(e){return(0,Me.A)(e).map(e=>{var t,s;return{id:e.id,url:e.url,name:e.name||(null===(t=e.image_data_json)||void 0===t||null===(t=t.file)||void 0===t?void 0:t.name),file_size:null!==(s=e.file_size)&&void 0!==s?s:0,preview_url:e.preview_url,"object-name":e.id}})}convertOldBeginTime(e){let t;if(e.length<3){if(/^\d$/.test(e)){if(t=parseInt(e,10),t<13)return`${t}:00 am`;if(t<25)return t-12+":00 pm"}return null}const s=e.substring(e.length-2);if("am"===s||"pm"===s){if(3===e.length)t=parseInt(e.substring(0,1),10);else{if(4!==e.length)return e;t=parseInt(e.substring(0,1),10)}return`${t}:00 ${s}`}return e}
1hasErrors(){return this.hasEmptyContentTab()||(0,T.Im)(this.state.template.title)||this.state.options.isAutoresponder&&this.state.isOptionsError||this.state.imageUploading}hasEmptyContentTab(){return Object.keys(this.state.template.content).some(e=>(0,T.Im)(this.state.template.content[e]))}setOptionsError(e){this.setState({isOptionsError:e})}getEvent(e){return!e||(0,T.z)(this.events[e])?null:this.events[e]}setTempOptions(e){Object.keys(e).forEach(t=>{this.tempOptions[t]=e[t]})}setOptions(e){this.setState(t=>{const s=Ve({},t.options);return Object.keys(e).forEach(t=>{s[t]=e[t]}),this.setState({disableSave:(0,T.Im)(s.eventId)&&!!s.isAutoresponder}),this.tempOptions=Ve({},s),{options:s}})}getTemplateListings(e){if(this.state.templateId&&!(0,T.z)(e)&&e.length>0){const t=[];for(const s of e){const e=this.messageTemplateScope.getObject(s);(null===e||(0,T.Im)(e.group_id)||(0,T.Im)(this.state.template.group_id)||String(e.group_id)!==String(this.state.template.group_id))&&String(e.id)!==String(this.state.templateId)||t.push(e)}return t}return[]}updateTemplatesData(){Ne.A.sectionMessageTemplates(this.props.propertyUid).then(e=>{const t={type:W.PG,listings:[],channels:[],accounts:[],labels:[]};if(this.props.templateId){const s=this.getTemplateListings(e.template_ids),i=this.messageTemplateScope.getObject(this.props.templateId),n=this.messageTemplateAccountAccessScope.findObjects({message_template_id:this.props.templateId}),o=this.messageTemplateLabelScope.findObjects({message_template_id:this.props.templateId}),a=[];if(i&&i.available_channels.length>0)t.channels=i.available_channels,t.type=W._j;else if(n&&Object.keys(n).length>0){const e=[];Object.values(n).forEach(t=>{e.push(t.platform_access_id)}),t.accounts=e,t.type=W.Iy}else if(Object.keys(o).length>0)t.labels=Object.values(o).map(e=>e.label_uid),t.type=W.jz;else if(this.listings.length>0&&s.length>0){for(const e of s)(0,T.z)(e.listing_id)||a.push(e.listing_id);if(a.length>0){t.type=W.xc;const e=this.listings.map(e=>e.getCompositeKey()),s=[...a];e.sort(),s.sort(),e.join(";")===s.join(";")&&a.push("all-channels")}}if(t.listings=[...a],!(0,T.Im)(t.listings))for(const e of t.listings)"all-channels"!==e&&this.originalListingIds.add(e)}else{const e=[];for(const t of this.listings)e.push(t.getCompositeKey());this.listings.length>0&&e.push("all-channels"),t.type=e.length>0?W.xc:W.PG,t.listings=e}if(!(0,T.z)(e.autoresponse_events_keys))for(const t of e.autoresponse_events_keys)this.events[t]=this.autoresponseEventsScope.getObject(t);this.setState(Ve({disableSave:(0,T.Im)(this.state.options.eventId)&&!!this.state.options.isAutoresponder,placeholders:e.message_variables,availableFor:t,accounts:e.accounts},this.areCategoriesTouched||!this.props.templateId?{}:{categoryUids:(0,Fe.o_)(this.props.templateId)}))})}getPropertyListings(){const e=[],t=this.propertyScope.getAll();return Object.keys(t).forEach(s=>{const i=t[s];if(i&&""!==i.group_uid&&i.group_uid===this.property.group_uid||!(0,T.Im)(i.property_id)&&!(0,T.Im)(this.property.property_id)&&i.property_id===this.property.property_id){const t=(0,ke.e)(i.property_id);t&&e.push(t)}}),e}cancelTempOptions(){this.tempOptions=Ve({},this.state.options)}applyTempOptions(){const e=Ve({},this.tempOptions);(0,T.Im)(e.eventId)&&(e.isAutoresponder=!1),this.setState({options:e})}applyAvailableFor(e){this.setState({availableFor:e})}applyCategories(e){this.areCategoriesTouched=!0,this.setState({categoryUids:e})}deleteTemplate(){if(this.state.templateId){const e=[this.state.templateId];PLATFORM_APP.page.pageApi.openDialog(r.Ay.t("common:sureToDeleteTemplate"),r.Ay.t("common:thisOperationCanNotBeUndone"),null,"yesNo",{yes:()=>{Re.h.call("POST","user-api/delete-message-template",{template_id:this.state.templateId,group_ids:e},e=>{0===e.result?alert("something wrong"):(this.props.updateTemplatesData(),PLATFORM_APP.onBackKeyDown())},{})},no:()=>{}})}}checkSaveConfirmationNeed(){this.hasErrors()?this.setState({showErrors:!0}):this.state.availableFor.type===W.PG?PLATFORM_APP.page.pageApi.openDialog({title:r.Ay.t("common:sureMakeAvailableForAll"),supTitle:(0,h.jsx)("img",{src:ze,alt:"template-alert"}),buttons:[{text:r.Ay.t("common:continue"),action:()=>{this.saveTemplate()}},{text:r.Ay.t("common:cancel"),type:"primary",action:()=>!1}],buttonsOrientation:"horizontal",dialogTitle:r.Ay.t("common:editTemplate")}):this.saveTemplate()}saveTemplate(){this.setState({isSaving:!0},()=>{const e={add:[],delete:[],remove_all:0};let t=[],s=[],i=[];const n=new Set(this.originalListingIds);if(this.state.availableFor.type===W.PG)e.remove_all=1;else if(this.state.availableFor.type===W.xc){if(this.state.availableFor.listings.length>0&&this.state.availableFor.listings.indexOf("all-channels")<0)for(const t of this.state.availableFor.listings)n.has(t)?n.delete(t):e.add.push(t);else if(this.listings.length>0)for(const t of this.listings)n.has(t.getCompositeKey())?n.delete(t.getCompositeKey()):e.add.push(t.getCompositeKey())}else this.state.availableFor.type===W._j?(e.remove_all=1,t=this.state.availableFor.channels):this.state.availableFor.type===W.Iy?(e.remove_all=1,s=this.state.availableFor.accounts):this.state.availableFor.type===W.jz&&(e.remove_all=1,i=this.state.availableFor.labels);1!==e.remove_all&&(e.delete=[...n]);const o={id:this.state.templateId,title:this.state.template.title,content:this.state.template.content,listing_id:e,available_channels:t,available_accounts:s,available_labels:i,is_autoresponder:this.state.options.isAutoresponder?1:0,event_type:this.state.options.eventId,event_threshold:this.state.options.eventThreshold,begin_time:this.state.options.beginTime,back_to_back_
1ignore:this.state.options.backToBackIgnore?1:0,guest_already_left_review_ignore:this.state.options.guestAlreadyLeftReviewIgnore?1:0,length_of_reservation_at_least:this.state.options.reservationMinChecked?this.state.options.reservationMin:"",length_of_reservation_less_than:this.state.options.reservationMaxChecked?this.state.options.reservationMax:"",delay_time:this.state.options.delayTime,categories:this.state.categoryUids};this.isRecurrenceAvailable()&&(o.repeat_mode=this.state.options.repeatMode,o.repeat_weekdays=this.state.options.repeatWeekdays,o.repeat_interval_days=this.state.options.repeatIntervalDays),this.isImageLoaderAvailable()&&!(0,T.Im)(this.state.images)&&this.state.images.length>0&&(o.images=this.state.images.map(e=>{let t=e.url;return(0,T.Im)(t)||"=s0"!==t.substring(t.length-3)||(t=t.substring(0,t.length-3)),Ve(Ve({},e),{},{url:t})})),this.state.options.lastMinuteBooking&&"before-checkin"===this.state.options.eventId&&(o.last_minute_booking=1),Re.h.call("POST","user-api/save-message-template",{message_data:o},e=>{(0,T.Yz)("API result: "),(0,T.Bh)(e),1===e.result?(this.setState({templateId:e.id}),this.props.updateTemplatesData(),PLATFORM_APP.onBackKeyDown()):alert(e.message)})})}changeName(e){this.setState(({template:t})=>({template:Ve(Ve({},t),{},{title:e})}))}changeContent(e){this.setState(({template:t})=>({template:Ve(Ve({},t),{},{content:Ve(Ve({},t.content),{},{[this.state.activeLanguage]:e})})}))}isImageLoaderAvailable(){return!this.state.options.isAutoresponder||-1!==W.nt.indexOf(this.state.options.eventId)}isRecurrenceAvailable(){const e=this.getEvent(this.state.options.eventId);return!(0,T.Im)(e)&&!!e.allow_recurrence}getDefaultCardSidebarContent(){return!0===this.state.options.isAutoresponder?(0,T.Im)(this.state.options.eventId)?(0,h.jsx)(N,{getEvent:this.getEvent,setOptions:this.setOptions,sectionEvents:this.sectionEvents,options:this.state.options,showErrors:this.state.showErrors,setOptionsError:this.setOptionsError,timezone:this.timezoneName(),isReadOnlyAccess:this.isReadOnlyAccess()}):(0,h.jsx)(S,{getEvent:this.getEvent,setOptions:this.setOptions,options:this.state.options,showErrors:this.state.showErrors,setOptionsError:this.setOptionsError,timezone:this.timezoneName(),isReadOnlyAccess:this.isReadOnlyAccess()}):(0,h.jsx)(M,{getEvent:this.getEvent,sectionEvents:this.sectionEvents,setOptions:this.setOptions,options:this.state.options,showErrors:this.state.showErrors,setOptionsError:this.setOptionsError,isReadOnlyAccess:this.isReadOnlyAccess()})}getCardContent(){const e=(0,h.jsxs)("div",{className:"editor-form",children:[(0,h.jsxs)("div",{className:"form-header",children:[(0,h.jsx)(_e,{title:this.state.template.title,changeName:this.changeName,showErrors:this.state.showErrors,isReadOnlyAccess:this.isReadOnlyAccess()}),(0,h.jsx)(ae,{property:this.property,listings:this.listings,accounts:this.state.accounts,availableFor:this.state.availableFor,openCardSidebar:(e,t,s=null)=>{this.openCardSidebar(e,!0,!0,!0,t,null,s)},applyAvailableFor:this.applyAvailableFor,isReadOnlyAccess:this.isReadOnlyAccess()}),(0,h.jsx)(Le.A,{selectedCategoryUids:this.state.categoryUids,onChange:this.applyCategories,isReadOnlyAccess:this.isReadOnlyAccess()}),(0,h.jsx)(D,{getEvent:this.getEvent,setTempOptions:this.setTempOptions,setOptions:this.setOptions,sectionEvents:this.sectionEvents,options:this.state.options,applyTempOptions:this.applyTempOptions,cancelTempOptions:this.cancelTempOptions,showErrors:this.state.showErrors,setOptionsError:this.setOptionsError,isReadOnlyAccess:this.isReadOnlyAccess()})]}),(0,h.jsx)("div",{className:"form-body",children:(0,h.jsx)(Oe,{placeholders:this.state.placeholders,content:this.state.template.content,changeContent:this.changeContent,openSidebar:this.openSidebar,showErrors:this.state.showErrors,activeLanguage:this.state.activeLanguage,addNewLanguage:this.openLanguageSelector,onLanguageChange:this.changeLanguage,deleteLanguage:this.deleteLanguage,isReadOnlyAccess:this.isReadOnlyAccess()})}),this.isImageLoaderAvailable()&&(!this.isReadOnlyAccess()||this.isReadOnlyAccess()&&Object.keys(this.state.images).length>0)&&(0,h.jsx)(Ce,{images:this.state.images,updateImages:this.updateImages,uploadStart:this.imageUploadStart,uploadStop:this.imageUploadStop,uploading:this.state.imageUploading,showErrors:this.state.showErrors,isReadOnlyAccess:this.isReadOnlyAccess()})]});return(0,h.jsx)(Ie.A,{content:e})}getCardButtons(){return(0,h.jsx)(ce,{disableSave:this.state.disableSave,templateId:this.state.templateId,isSaving:this.state.isSaving,saveTemplate:this.checkSaveConfirmationNeed,deleteTemplate:this.deleteTemplate,isError:this.hasErrors(),isReadOnlyAccess:this.isReadOnlyAccess()})}}Ke(He,"cssClassName","MTEditor"),Ke(He,"propTypes",{updateTemplatesData:p().func,templateId:p().oneOfType([p().string,p().number]),propertyUid:p().string.isRequired}),Ke(He,"defaultProps",{updateTemplatesData:()=>{},templateId:null})},48547(e,t,s){s.d(t,{A:()=>h});
1var i,n,o,a=s(96540),r=s(5556),l=s.n(r),p=s(96143),c=s(74848);class h extends a.PureComponent{getIconClass(){let e="listing";return"listing"!==this.props.platformType&&"default"!==this.props.platformType&&(e=this.props.platformType===p.A.PLATFORM_BOOKING?"booking":p.A.getPlatformIconNew(this.props.platformType)),`icon-${e}`}render(){const e=["icon",this.getIconClass()];return(0,c.jsx)("i",{className:e.filter(e=>!!e).join(" ")})}}h.displayName="MTPlatformIcon",i=h,n="propTypes",o={platformType:l().string.isRequired},(n=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n))in i?Object.defineProperty(i,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[n]=o},81438(e,t,s){s.d(t,{A:()=>m});var i=s(96540),n=s(5556),o=s.n(n),a=s(48547),r=s(85072),l=s.n(r),p=s(48819);l()(p.A,{insert:"head",singleton:!1}),p.A.locals;var c,h,d,u=s(74848);class m extends i.Component{render(){let e=["property-icon"],t=this.props.platformType;return!0===this.props.isGroup&&(e.push("multiple-listings"),t="listing"),(0,u.jsx)("div",{className:e.join(" "),children:(0,u.jsx)(a.A,{platformType:t})})}}m.displayName="MTPropertyIcon",c=m,h="propTypes",d={isGroup:o().bool.isRequired,platformType:o().string.isRequired},(h=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(h))in c?Object.defineProperty(c,h,{value:d,enumerable:!0,configurable:!0,writable:!0}):c[h]=d},19538(e,t,s){s.d(t,{A:()=>x});var i,n,o,a=s(96540),r=s(5556),l=s.n(r),p=(s(35272),s(72635)),c=s(30238),h=s(64951),d=s(74848);class u extends a.Component{render(){return(0,d.jsx)(h.A,{wrapperClassName:"placeholder-button-mobile",text:this.props.name,action:()=>{this.props.addPlaceholder(this.props.placeholder),PLATFORM_APP.onBackKeyDown()}})}}u.displayName="MTPlaceholderButtonMobile",i=u,n="propTypes",o={addPlaceholder:l().func.isRequired,placeholder:l().string.isRequired,name:l().element.isRequired},(n=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n))in i?Object.defineProperty(i,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[n]=o;var m=s(54822),g=(s(92176),s(63710));class b extends a.Component{constructor(e){super(e)}render(){return(0,d.jsxs)("div",{className:"variables-help",children:[(0,d.jsxs)("div",{className:"help-content",children:[(0,d.jsx)("div",{className:"placeholder-icon",children:(0,d.jsx)("span",{children:"{{ A }}"})}),(0,d.jsx)("div",{className:"description",children:p.Ay.t("common:insertVariablesRetrieveActualData")})]}),(0,d.jsx)(h.A,{wrapperClassName:"help-link",text:(0,d.jsx)(g.x6,{i18nKey:"learnMoreLink",ns:"common",children:(0,d.jsx)("a",{href:p.Ay.t("common:helpDeskLinks.howToUseTemplates"),target:"_blank",rel:"noreferrer"})})})]})}}b.displayName="MTVariablesHelp";var y=s(53124),v=s(62536);function f(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,i)}return s}function A(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?f(Object(s),!0).forEach(function(t){O(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):f(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function O(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class x extends c.A{constructor(e){super(e),O(this,"onChange",e=>{this.setState({content:e,customPosition:!1})}),O(this,"addPlaceholder",e=>{this.setState((t,s)=>{const i=t.content.substring(0,t.cursorPosition),n=t.content.substring(t.cursorPosition);return{content:i+e+n,cursorPosition:t.cursorPosition+e.length,customPosition:!0}})}),O(this,"placeholderButtons",()=>{const e=this.props.placeholders;return Object.keys(e).map((t,s)=>{const i=e[t],n=(0,d.jsxs)("div",{className:"placeholder-label",children:[(0,d.jsx)("div",{className:"placeholder-name",children:t}),(0,d.jsx)("div",{className:"placeholder-item",children:i})]});return(0,d.jsx)(u,{addPlaceholder:this.addPlaceholder,placeholder:i,name:n},s)})}),O(this,"onCursorPositionChange",e=>{this.setState({cursorPosition:e})}),this.state=A(A({},this.state),{},{content:e.content,cursorPosition:e.content.length,customPosition:!0,textareaFocused:!0})}getDefaultCardSidebarContent(){return(0,d.jsx)("div",{})}getCardContent(){const e=!!this.state.customPosition&&this.state.cursorPosition,t=(0,d.jsxs)("div",{className:"airgms-sidebar-container",children:[(0,d.jsxs)("div",{className:"airgms-sidebar-head",children:[(0,d.jsxs)("div",{className:"airgms-sidebar-title",children:[p.Ay.t("common:insertVariable"),(0,d.jsx)(h.A,{wrapperClassName:"help-desk",text:"?",action:()=>{this.props.openSidebar({component:(0,d.jsx)(m.A,{content:(0,d.jsx)(b,{})}),title:p.Ay.t("common:templateVariables"),side:"bottom",size:"448px",hasCloser:!1,customClass:"sidebar-MTPopup"})}})]}),(0,d.jsx)("div",{className:"airgms-sidebar-closer",onClick:e=>{PLATFORM_APP.onBackKeyDown()},children:(0,d.jsx)("i",{className:"icon icon-cross"})})]}),(0,d.jsx)("div",{className:"airgms-sidebar-content mobile-dialog",children:this.placeholderButtons()})]}),s=(0,d.jsx)("div",{className:"editor-form",children:(0,d.jsxs)("div",{className:"editor-mobile-content",onClick:()=>{this.forceUpdate()},children:[(0,d.jsx)(y.A,{value:this.state.content,onChange:e=>{this.onChange(e.target.value)},placeholder:p.Ay.t("common:templateContent"),onCursorPositionChange:this.onCursorPositionChange,focusOnUpdate:this.state.textareaFocused,isFocused:this.state.textareaFocused,cursorPosition:e}),(0,d.jsx)(h.A,{text:"{{ }}",wrapperClassName:"insert-placeholder-menu",action:()=>{this.setState({textareaFocused:!1}),this.openSidebar({hasCloser:!1,component:(0,d.jsx)(v.A,{temp:!0,content:t}),side:"bottom",size:"auto",customClass:"popup-MTEditor",afterClose:()=>{this.setState({textareaFocused:!0})}})}})]})});return(0,d.jsx)(v.A,{content:s})}getCardButtons(){return(0,d.jsxs)("div",{className:"card-buttons-wrapper",children:[(0,d.jsx)(h.A,{className:"save-template-button",text:p.Ay.t("common:save"),type:"primary",action:()=>{this.props.onContentChange(this.state.content),PLATFORM_APP.onBackKeyDown()}}),(0,d.jsx)(h.A,{className:"edit-cancel-button",text:p.Ay.t("common:cancel"),action:()=>{PLATFORM_APP.onBackKeyDown()}})]})}}O(x,"cssClassName","MTEditor"),O(x,"propTypes",{content:l().string.isRequired,onContentChange:l().func.isRequired,placeholders:l().array.isRequired,getPlaceholderName:l().func.isRequired,openSidebar:l().func.isRequired})}
1,96249(e,t,s){s.d(t,{A:()=>h});var i,n,o,a=s(96540),r=s(5556),l=s.n(r),p=(s(5112),s(64951)),c=s(74848);class h extends a.Component{render(){return(0,c.jsx)(p.A,{wrapperClassName:"placeholder-button",text:this.props.name,action:()=>{this.props.addPlaceholder(this.props.placeholder)}})}}h.displayName="MTPlaceholderButton",i=h,n="propTypes",o={addPlaceholder:l().func.isRequired,placeholder:l().string.isRequired,name:l().string.isRequired},(n=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n))in i?Object.defineProperty(i,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[n]=o},89684(e,t,s){s.d(t,{A:()=>r});var i=s(96540),n=s(86725),o=s(30905),a=(s(3131),s(74848));class r extends i.Component{render(){return(0,a.jsxs)("div",{className:"editor-sidebar-body",children:[(0,a.jsxs)("div",{className:"automation-help",children:[(0,a.jsx)("img",{src:n}),(0,a.jsxs)("div",{className:"text-content",children:[(0,a.jsx)("p",{children:"Use this feature to automate communication with your guests! Each template can be sent the day before arrival, during their stay, at departure or after other events."}),(0,a.jsx)("p",{children:"Thanks to some fine-tuning the time is taken into account so that duplicate messages for guests who extend their stay are avoided."})]})]}),(0,a.jsx)(o.A,{})]})}}r.displayName="MTHelpDesk"},30905(e,t,s){s.d(t,{A:()=>a});var i=s(96540),n=(s(48816),s(72635)),o=s(74848);class a extends i.Component{render(){return(0,o.jsxs)("div",{className:"sidebar-learn-more",children:[(0,o.jsx)("div",{className:"label",children:n.Ay.t("common:learnMoreOn")}),(0,o.jsx)("div",{className:"link",children:(0,o.jsxs)("a",{href:n.Ay.t("common:helpDeskLinks.howToAutomateAirbnbReplies"),target:"_blank",rel:"noreferrer",children:[n.Ay.t("common:helpDesk")," ",(0,o.jsx)("i",{className:"icon-arrowright"})]})})]})}}a.displayName="MTLearnMore"},54822(e,t,s){s.d(t,{A:()=>p});var i=s(96540),n=s(5556),o=s.n(n),a=(s(76676),s(64951)),r=s(74848);function l(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class p extends i.Component{render(){const e=this.props.footerCloser?(0,r.jsx)("div",{className:"popup-footer",children:(0,r.jsx)(a.A,{text:(0,r.jsx)("i",{className:"icon-arrowdown"}),wrapperClassName:"close-button-wrapper",action:()=>{PLATFORM_APP.onBackKeyDown()}})}):"";return(0,r.jsxs)("div",{className:"popup-content",children:[(0,r.jsx)("div",{className:"popup-body",children:this.props.content}),e]})}}p.displayName="MTPopup",l(p,"propTypes",{content:o().oneOfType([o().string,o().element,o().array]),footerCloser:o().bool}),l(p,"defaultProps",{content:"",footerCloser:!0})},48819(e,t,s){s.d(t,{A:()=>d});var i=s(54991),n=s.n(i),o=s(76314),a=s.n(o),r=s(4417),l=s.n(r),p=s(91082),c=a()(n()),h=l()(p);c.push([e.id,".property-icon {\n min-width: 40px;\n text-align: center;\n border-radius: 3px;\n border: 1px solid #E0E0E0;\n background: #FFF;\n}\n\n.property-icon.multiple-listings {\n -webkit-box-shadow: 1px 1px 0 0 #FFF,\n 2px 2px 0 0 rgba(0, 0, 0, .15),\n 3px 3px 0 0 #FFF,\n 4px 4px 0 0 rgba(0, 0, 0, .15);\n box-shadow: 1px 1px 0 0 #FFF,\n 2px 2px 0 0 rgba(0, 0, 0, .15),\n 3px 3px 0 0 #FFF,\n 4px 4px 0 0 rgba(0, 0, 0, .15);\n}\n\n.property-icon i {\n font-size: 21px;\n padding: 7px 0 1px;\n color: #333;\n display: block;\n}\n\n.property-icon i.icon-airbnb {\n color: #FD5C63;\n}\n\n.property-icon i.icon-airgms {\n color: #FFA000;\n}\n\n.property-icon i.icon-logo-vrbo3 {\n color: #2057BF;\n font-size: 26px;\n height: 38px;\n padding-top: 5px;\n}\n\n.property-icon i.icon-booking {\n display: block;
1\n width: 20px;\n height: 38px;\n margin-left: 10.5px;\n background: url("+h+") no-repeat center/20px 20px;\n}\n","",{version:3,sources:["webpack://./src/assets/js/components/message-templates-editor/MTPropertyIcon.css"],names:[],mappings:"AAAA;IACI,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,yBAAyB;IACzB,gBAAgB;AACpB;;AAEA;IACI;;;kCAG8B;YAH9B;;;kCAG8B;AAClC;;AAEA;IACI,eAAe;IACf,kBAAkB;IAClB,WAAW;IACX,cAAc;AAClB;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,cAAc;IACd,eAAe;IACf,YAAY;IACZ,gBAAgB;AACpB;;AAEA;IACI,cAAc;IACd,WAAW;IACX,YAAY;IACZ,mBAAmB;IACnB,8EAA+F;AACnG",sourcesContent:[".property-icon {\n min-width: 40px;\n text-align: center;\n border-radius: 3px;\n border: 1px solid #E0E0E0;\n background: #FFF;\n}\n\n.property-icon.multiple-listings {\n box-shadow: 1px 1px 0 0 #FFF,\n 2px 2px 0 0 rgba(0, 0, 0, .15),\n 3px 3px 0 0 #FFF,\n 4px 4px 0 0 rgba(0, 0, 0, .15);\n}\n\n.property-icon i {\n font-size: 21px;\n padding: 7px 0 1px;\n color: #333;\n display: block;\n}\n\n.property-icon i.icon-airbnb {\n color: #FD5C63;\n}\n\n.property-icon i.icon-airgms {\n color: #FFA000;\n}\n\n.property-icon i.icon-logo-vrbo3 {\n color: #2057BF;\n font-size: 26px;\n height: 38px;\n padding-top: 5px;\n}\n\n.property-icon i.icon-booking {\n display: block;\n width: 20px;\n height: 38px;\n margin-left: 10.5px;\n background: url(../../../img/platform/booking/b-letter-dot-icon.svg) no-repeat center/20px 20px;\n}\n"],sourceRoot:""}]);const d=c}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.