Your IP : 3.145.72.233


Current Path : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/js/voximplant/callerid/
Upload File :
Current File : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/js/voximplant/callerid/voximplant.callerid.min.js

(function(){BX.namespace("BX.Voximplant");if(BX.Voximplant.CallerIdSlider){return}var e={New:1,Verification:2,Verified:3};BX.Voximplant.CallerIdSlider=function(e){this.slider=null;if(!BX.type.isPlainObject(e)){e={}}if(e.dataPromise instanceof Promise){this.configPromise=e.dataPromise}else{this.init(e)}this.verificationCode="";this.elements={number:null,errorContainer:null,hint:null,confirmation:null,buttons:null,saveButton:null,confirmButton:null,repeatButton:null,prolongButton:null};this.callbacks={onClose:BX.type.isFunction(e.onClose)?e.onClose:BX.DoNothing}};BX.Voximplant.CallerIdSlider.prototype={init:function(t){this.phoneNumber=t.phoneNumber||"";this.verified=t.verified||false;this.verifiedUntil=t.verifiedUntil||"";if(!this.phoneNumber){this.state=e.New}else{this.state=this.verified?e.Verified:e.Verification}},show:function(){BX.SidePanel.Instance.open("voximplant:callerId-add",{width:400,events:{onClose:this.onSliderClose.bind(this),onDestroy:this.onSliderDestroy.bind(this)},contentCallback:function(e){var t=new BX.Promise;this.slider=e;if(this.configPromise){this.configPromise.then(function(e){this.init(e);return top.BX.loadExt("voximplant.common")}.bind(this)).then(function(){var e=this.render();this.initLayout();t.resolve(e)}.bind(this)).catch(function(t){e.close();BX.Voximplant.alert(" ",t.message)})}else{top.BX.loadExt("voximplant.common").then(function(){var e=this.render();this.initLayout();t.resolve(e)}.bind(this))}return t}.bind(this)})},render:function(){return BX.createFragment([BX.create("div",{props:{className:"voximplant-slider-pagetitle-wrap"},children:[BX.create("div",{props:{className:"voximplant-slider-pagetitle"},children:[BX.create("span",{text:BX.message("VOX_CALLER_ID_TITLE")})]})]}),BX.create("div",{props:{className:"voximplant-container voximplant-options-popup"},children:[BX.create("div",{props:{className:"voximplant-control-row"},children:[BX.create("div",{props:{className:"voximplant-control-subtitle"},text:BX.message("VOX_CALLER_ID_PROVIDE_INTERNATIONAL_NUMBER")}),this.elements.number=BX.create("input",{props:{className:"voximplant-control-input"},attrs:{type:"text",placeholder:"+7 495 111-22-33",value:this.phoneNumber,disabled:this.state!==e.New}})]}),this.elements.errorContainer=BX.create("div",{props:{className:"voximplant-control-row"}}),this.elements.hint=BX.create("div",{props:{className:"voximplant-control-row"},children:this.renderHint()}),this.elements.confirmation=BX.create("div",{children:this.renderConfirmation()})]}),this.elements.buttons=BX.create("div",{props:{className:"voximplant-button-panel"},children:this.renderButtons()})])},renderHint:function(){if(this.state===e.New||this.state===e.Verification){return[BX.create("p",{text:BX.message("VOX_CALLER_ID_HINT_P1")}),BX.create("p",{text:BX.message("VOX_CALLER_ID_HINT_P2")}),BX.create("p",{text:BX.message("VOX_CALLER_ID_HINT_P3")})]}else if(this.state===e.Verified){if(this.verified){return[BX.create("div",{props:{className:"ui-alert ui-alert-primary"},children:[BX.create("span",{props:{className:"ui-alert-message"},text:BX.message("VOX_CALLER_ID_VERIFIED_UNTIL").replace("#DATE#",this.verifiedUntil)})]})]}else{return[BX.create("div",{props:{className:"ui-alert ui-alert-error"},children:[BX.create("span",{props:{className:"ui-alert-message"},text:BX.message("VOX_CALLER_ID_UNVERIFIED")})]})]}}},initLayout:function(){this.phoneInput=new BX.PhoneNumber.Input({node:this.elements.number,onChange:function(e){this.phoneNumber=e.value}.bind(this)})},updateHint:function(){BX.cleanNode(this.elements.hint);BX.adjust(this.elements.hint,{children:this.renderHint()})},renderButtons:function(){var t=[];if(this.state===e.New){this.elements.saveButton=BX.create("button",{props:{className:"ui-btn ui-btn-primary"},text:BX.message("VOX_CALLER_ID_BUTTON_LINK"),events:{click:this.onAddButtonClick.bind(this)}});t.push(this.elements.saveButton)}else if(this.state===e.Verification){this.elements.confirmButton=BX.create("button",{props:{className:"ui-btn ui-btn-primary"},text:BX.message("VOX_CALLER_ID_BUTTON_CONFIRM"),events:{click:this.onConfirmButtonClick.bind(this)}});t.push(this.elements.confirmButton);this.elements.repeatButton=BX.create("button",{props:{className:"ui-btn ui-btn-default"},text:BX.message("VOX_CALLER_ID_BUTTON_REPEAT_CALL"),events:{click:this.onRepeatButtonClick.bind(this)}});t.push(this.elements.repeatButton)}else if(this.state===e.Verified){this.elements.prolongButton=BX.create("button",{props:{className:"ui-btn ui-btn-primary"},text:BX.message("VOX_CALLER_ID_BUTTON_PROLONG"),events:{click:this.onProlongButtonClick.bind(this)}});t.push(this.elements.prolongButton)}t.push(this.elements.cancelButton);return t},updateButtons:function(){BX.cleanNode(this.elements.buttons);BX.adjust(this.elements.buttons,{children:this.renderButtons()})},renderConfirmation:function(){if(this.state===e.Verification){return[BX.create("div",{props:{className:"voximplant-control-row"},children:[BX.create("div",{props:{className:"voximplant-control-subtitle"},text:BX.message("VOX_CALLER_ID_ENTER_CODE")}),BX.create("input",{props:{className:"voximplant-control-input"},attrs:{type:"text"},events:{bxchange:function(e){this.verificationCode=e.currentTarget.value}.bind(this)}})]})]}else{return[]}},updateConfirmation:function(){BX.cleanNode(this.elements.confirmation);BX.adjust(this.elements.confirmation,{children:this.renderConfirmation()})},setState:function(t){this.state=t;this.elements.number.disabled=this.state!==e.New;this.updateHint();this.updateConfirmation();this.updateButtons()},showError:function(e){BX.adjust(this.elements.errorContainer,{children:[BX.create("div",{props:{className:"ui-alert ui-alert-danger ui-alert-icon-danger"},children:[BX.create("span",{props:{className:"ui-alert-message"},text:e})]})]})},hideError:function(){BX.cleanNode(this.elements.errorContainer)},onSliderClose:function(e){this.slider.destroy();this.callbacks.onClose()},onSliderDestroy:function(e){this.slider=null},onAddButtonClick:function(t){this.hideError();BX.addClass(this.elements.saveButton,"ui-btn-wait");BX.ajax.runAction("voximplant.callerId.add",{data:{phoneNumber:this.phoneNumber,requestVerification:true}}).then(function(t){BX.removeClass(this.elements.saveButton,"ui-btn-wait");var i=t.data;this.verified=i.verified==="Y";this.verifiedUntil=i.verifiedUntil;if(this.verified){this.setState(e.Verified)}else{this.setState(e.Verification)}}.bind(this)).catch(function(e){var t=e.errors[0];BX.removeClass(this.elements.saveButton,"ui-btn-wait");console.error(t);this.showError(t.message)}.bind(this))},onRepeatButtonClick:function(e){this.hideError();BX.addClass(this.elements.repeatButton,"ui-btn-wait");BX.ajax.runAction("voximplant.callerId.requestVerification",{data:{phoneNumber:this.phoneNumber}}).then(function(e){BX.removeClass(this.elements.repeatButton,"ui-btn-wait")}.bind(this)).catch(function(e){var t=e.errors[0];BX.removeClass(this.elements.repeatButton,"ui-btn-wait");console.error(t);this.showError(t.message)}.bind(this))},onConfirmButtonClick:function(t){this.hideError();BX.addClass(this.elements.confirmButton,"ui-btn-wait");BX.ajax.runAction("voximplant.callerId.verify",{data:{phoneNumber:this.phoneNumber,code:this.verificationCode}}).then(function(t){var i=t.data;this.verified=i.verified==="Y";this.verifiedUntil=i.verifiedUntil;this.setState(e.Verified)}.bind(this)).catch(function(e){var t=e.errors[0];BX.removeClass(this.elements.confirmButton,"ui-btn-wait");console.error(t);this.showError(t.message)}.bind(this))},onProlongButtonClick:function(t){this.hideError();BX.addClass(this.elements.prolongButton,"ui-btn-wait");BX.ajax.runAction("voximplant.callerId.requestVerification",{data:{phoneNumber:this.phoneNumber}}).then(function(t){BX.removeClass(this.elements.prolongButton,"ui-btn-wait");this.setState(e.Verification)}.bind(this)).catch(function(e){var t=e.errors[0];BX.removeClass(this.elements.prolongButton,"ui-btn-wait");console.error(t);this.showError(t.message)}.bind(this))}}})();
//# sourceMappingURL=voximplant.callerid.map.js