1/// <reference path="../../../../../../../../global.d.ts" /> 2/// <reference path="../../../../../../../../iu.d.ts" /> 3function _assert_this_initialized(self) { 4 if (self === void 0) { 5 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 6 } 7 return self; 8} 9function _class_call_check(instance, Constructor) { 10 if (!(instance instanceof Constructor)) { 11 throw new TypeError("Cannot call a class as a function"); 12 } 13} 14function _defineProperties(target, props) { 15 for(var i = 0; i < props.length; i++){ 16 var descriptor = props[i]; 17 descriptor.enumerable = descriptor.enumerable || false; 18 descriptor.configurable = true; 19 if ("value" in descriptor) descriptor.writable = true; 20 Object.defineProperty(target, descriptor.key, descriptor); 21 } 22} 23function _create_class(Constructor, protoProps, staticProps) { 24 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 25 if (staticProps) _defineProperties(Constructor, staticProps); 26 return Constructor; 27} 28function _define_property(obj, key, value) { 29 if (key in obj) { 30 Object.defineProperty(obj, key, { 31 value: value, 32 enumerable: true, 33 configurable: true, 34 writable: true 35 }); 36 } else { 37 obj[key] = value; 38 } 39 return obj; 40} 41function _get_prototype_of(o) { 42 _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) { 43 return o.__proto__ || Object.getPrototypeOf(o); 44 }; 45 return _get_prototype_of(o); 46} 47function _inherits(subClass, superClass) { 48 if (typeof superClass !== "function" && superClass !== null) { 49 throw new TypeError("Super expression must either be null or a function"); 50 } 51 subClass.prototype = Object.create(superClass && superClass.prototype, { 52 constructor: { 53 value: subClass, 54 writable: true, 55 configurable: true 56 } 57 }); 58 if (superClass) _set_prototype_of(subClass, superClass); 59} 60function _possible_constructor_return(self, call) { 61 if (call && (_type_of(call) === "object" || typeof call === "function")) { 62 return call; 63 } 64 return _assert_this_initialized(self); 65} 66function _set_prototype_of(o, p) { 67 _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) { 68 o.__proto__ = p; 69 return o; 70 }; 71 return _set_prototype_of(o, p); 72} 73function _type_of(obj) { 74 "@swc/helpers - typeof"; 75 return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; 76} 77function _is_native_reflect_construct() { 78 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 79 if (Reflect.construct.sham) return false; 80 if (typeof Proxy === "function") return true; 81 try { 82 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); 83 return true; 84 } catch (e) { 85 return false; 86 } 87} 88function _create_super(Derived) { 89 var hasNativeReflectConstruct = _is_native_reflect_construct(); 90 return function _createSuperInternal() { 91 var Super = _get_prototype_of(Derived), result; 92 if (hasNativeReflectConstruct) { 93 var NewTarget = _get_prototype_of(this).constructor; 94 result = Reflect.construct(Super, arguments, NewTarget); 95 } else { 96 result = Super.apply(this, arguments); 97 } 98 return _possible_constructor_return(this, result); 99 }; 100} 101import { Controller } from "@hotwired/stimulus"; 102var _class = /*#__PURE__*/ function(Controller) { 103 "use strict"; 104 _inherits(_class, Controller); 105 var _super = _create_super(_class); 106 function _class() { 107 _class_call_check(this, _class); 108 var _this; 109 _this = _super.apply(this, arguments); 110 _define_property(_assert_this_initialized(_this), "handlePaymentUnsuccessful", function() { 111 _this.openPaymentView(); 112 _this.widgetTitleTarget.setAttribute("style", "margin-bottom: 24px;"); 113 if (_this.hasShadowPayButtonTarget) { 114 _this.shadowPayButtonTarget.classList.remove("iu-button--loading"); 115 } 116 if (_this.hasInstantOfferTextContainerTarget) { 117 _this.hideElement(_this.instantOfferTextContainerTarget); 118 _this.hideElement(_this.shadowPayButtonTarget); 119 } 120 }); 121 return _this; 122 } 123 _create_class(_class, [ 124 { 125 key: "connect", 126 value: function connect() { 127 this.subscriptionOfferTextContainer = this.paymentWidgetContainerTarget.querySelector(".payment-widget__after-payment"); 128 this.subscriptionButtonTextContainers = this.paymentWidgetContainerTarget.querySelectorAll(".payButtonJs .iu-button-text"); 129 this.subscriptionFromTheHeaderModal = document.getElementById("subscription-from-the-header-modal"); 130 window.addEventListener("paymentUnsuccessful", this.handlePaymentUnsuccessful); 131 this.tariffsListTarget.querySelector('input[name="tariff"]').click(); 132 } 133 }, 134 { 135 key: "disconnect", 136 value: function disconnect() { 137 window.removeEventListener("paymentUnsuccessful", this.handlePaymentUnsuccessful); 138 } 139 }, 140 { 141 key: "applyTariff", 142 value: function applyTariff(tariffValue) { 143 var config = this.tariffsConfigValue[tariffValue]; 144 if (!config) return; 145 window.paymentWidgets[this.widgetIdValue].changeOrderAndCost(config.orderId, config.cost); 146 if (this.subscriptionOfferTextContainer) { 147 this.subscriptionOfferTextContainer.innerHTML = config.offerText; 148 }
149 this.subscriptionButtonTextContainers.forEach(function(buttonTextContainer) { 150 var container = buttonTextContainer; 151 container.innerHTML = config.payText; 152 }); 153 if (this.hasInstantOfferTextContainerTarget) { 154 this.instantOfferTextContainerTarget.innerHTML = config.instantOfferText; 155 } 156 } 157 }, 158 { 159 key: "changeTariffsList", 160 value: function changeTariffsList(event) { 161 var target = event.target; 162 if (!target || target.name !== "tariff") return; 163 this.applyTariff(target.value); 164 } 165 }, 166 { 167 key: "paymentButtonAction", 168 value: function paymentButtonAction() { 169 this.openPaymentView(); 170 this.hideElement(this.paymentButtonTarget); 171 } 172 }, 173 { 174 key: "shadowPayButtonAction", 175 value: function shadowPayButtonAction() { 176 var checked = this.tariffsListTarget.querySelector('input[name="tariff"]:checked'); 177 var config = checked ? this.tariffsConfigValue[checked.value] : null; 178 this.shadowPayButtonTarget.classList.add("iu-button--loading"); 179 window.dispatchEvent(new CustomEvent("secondStepPayment", { 180 detail: { 181 orderId: config ? config.orderId : null, 182 widgetId: this.widgetIdValue 183 } 184 })); 185 } 186 }, 187 { 188 key: "backButtonAction", 189 value: function backButtonAction() { 190 this.openTariffsView(); 191 if (this.hasInstantOfferTextContainerTarget) { 192 this.showElement(this.instantOfferTextContainerTarget); 193 this.showElement(this.shadowPayButtonTarget); 194 } else { 195 this.showElement(this.paymentButtonTarget); 196 } 197 } 198 }, 199 { 200 key: "showElement", 201 value: function showElement(element) { 202 element.classList.remove("is-hidden"); 203 } 204 }, 205 { 206 key: "hideElement", 207 value: function hideElement(element) { 208 element.classList.add("is-hidden"); 209 } 210 }, 211 { 212 key: "openPaymentView", 213 value: function openPaymentView() { 214 this.subscriptionFromTheHeaderModal.classList.replace("aic-modal--lg", "aic-modal--sm"); 215 this.showElement(this.paymentWidgetContainerTarget); 216 this.hideElement(this.tariffsListTarget); 217 this.showElement(this.backButtonTarget); 218 this.widgetTitleTarget.textContent = "ÐÑоÑмление подпиÑки"; 219 } 220 }, 221 { 222 key: "openTariffsView", 223 value: function openTariffsView() { 224 this.subscriptionFromTheHeaderModal.classList.replace("aic-modal--sm", "aic-modal--lg"); 225 this.hideElement(this.paymentWidgetContainerTarget); 226 this.showElement(this.tariffsListTarget); 227 this.hideElement(this.backButtonTarget); 228 this.widgetTitleTarget.innerHTML = this.widgetTitleValue; 229 this.widgetTitleTarget.removeAttribute("style"); 230 } 231 } 232 ]); 233 return _class; 234}(Controller); 235_define_property(_class, "targets", [ 236 "backButton", 237 "widgetTitle", 238 "tariffsList", 239 "paymentButton", 240 "shadowPayButton", 241 "paymentWidgetContainer", 242 "instantOfferTextContainer" 243]); 244_define_property(_class, "values", { 245 widgetId: String, 246 tariffsConfig: Array, 247 widgetTitle: String 248}); 249/* stimulusFetch: 'lazy' */ export { _class as default };
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.