PageSourceSearch

https://www.roundabouttheatre.org/wp-content/themes/roundabout/dis…formance-performance-promo-form-DIsW5EKB.js

js roundabouttheatre.org collected 2026-09-24 17:16:43 UTC 3,121 bytes, 2 lines download raw bytes

1(function(){const{hooks:u}=window.sitchco,{promo:l,hooks:d}=window.sitchco.performance,m="Sorry, something went wrong. Please try again.",y="Please enter a promotional code.",v=new WeakSet,p=new WeakMap;function A(o){const e=o.querySelector("[data-promo-form]");return{form:e,input:e?.querySelector('input[name="promo_code"]'),button:e?.querySelector("[data-promo-submit]"),message:o.querySelector("[data-promo-message]")}}function g(o,e,t){if(o){if(o.classList.remove("performance-promo-code-message--success","performance-promo-code-message--error"),!e){o.textContent="",o.hidden=!0;return}o.classList.add(`performance-promo-code-message--${t}`),o.hidden=!1,o.textContent=e}}function f(o,e,{error:t=""}={}){const{form:r,input:n,button:c,message:i}=A(o);r&&(r.dataset.promoActive="1",p.set(o,e),n&&(n.value=e.code??"",n.readOnly=!0,n.removeAttribute("aria-invalid")),c&&(c.textContent="Remove"),g(i,t||(e.message??""),t?"error":"success"))}function s(o,{keepValue:e=!1,error:t=""}={}){const{form:r,input:n,button:c,message:i}=A(o);r&&(delete r.dataset.promoActive,p.delete(o),n&&(n.readOnly=!1,e||(n.value=""),n.toggleAttribute("aria-invalid",!!t)),c&&(c.textContent="Submit"),g(i,t,"error"))}function h(o,{promo:e,promoInvalid:t,promoCode:r=null}){if(e){f(o,e);return}if(t){l.clearCode(r),s(o,{error:l.restConfig().invalidMessage||m});return}s(o)}async function O(o,e){const{form:t,input:r,button:n}=A(e);if(o.preventDefault(),v.has(t))return;const c=!!t.dataset.promoActive,i=c?"":(r?.value??"").trim();if(!c&&!i){s(e,{keepValue:!0,error:y}),r?.focus();return}v.add(t),n?.setAttribute("aria-busy","true");try{const a=await l.submit(i);if(a.superseded)return;if(a.valid&&a.promo)f(e,a.promo);else if(a.cleared)s(e);else{s(e,{keepValue:!0,error:a.message||m}),r?.focus(),r?.select();return}u.doAction(d.PROMO_CHANGE,{promo:a.promo??null,code:a.promo?.code??"",cleared:!!a.cleared})}catch(a){if(console.error(a),c&&a?.afterHeaders){l.setCode(""),s(e),u.doAction(d.PROMO_CHANGE,{promo:null,code:"",cleared:!0});return}const b=c?p.get(e):null;b?f(e,b,{error:m}):s(e,{keepValue:!c,error:m})}finally{v.delete(t),n?.removeAttribute("aria-busy")}}function E(o){const{form:e}=A(o);!e||e.dataset.performanceInit||(e.dataset.performanceInit="1",e.addEventListener("submit",t=>O(t,o)))}u.addAction(d.DATA_LOAD,({container:o,promo:e,promoInvalid:t,promoCode:r})=>h(o,{promo:e,promoInvalid:t,promoCode:r}),10,"performance-promo-form");function w(){const o=C();document.querySelectorAll("[data-promo-form]").forEach(e=>{const t=e.closest("[data-performance-block]")??e.parentElement;t&&(o?f(t,o):s(t))})}function C(){const o=l.getCode();if(!o)return null;for(const e of document.querySelectorAll("[data-promo-form]")){const t=e.closest("[data-performance-block]")??e.parentElement,r=t&&p.get(t);if(r&&r.code===o)return r}return{code:o}}u.addAction(d.PROMO_CHANGE,w,20,"performance-promo-form");u.addAction(d.PROMO_CLEARED,w,20,"performance-promo-form");window.sitchco.performance=Object.assign(window.sitchco.performance||{},{promoForm:{init:E,hydrate:h}});})();
2//# sourceMappingURL=performance-performance-promo-form-DIsW5EKB.js.map

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.