File "index.js"
Full Path: /home/flipjqml/onlinebetsolution.com/wp-content/plugins/call-now-button/build/index.js
File size: 5.49 KB
MIME-type: text/plain
Charset: utf-8
(()=>{"use strict";const e=window.wp.element,t=window.React,n=({template:e,handleSelect:n,types:a,displayModes:l})=>(0,t.createElement)("article",{onClick:()=>n(e),className:"cnb-template-container","data-template-id":e.id},(0,t.createElement)("section",null,(0,t.createElement)("header",{className:"cnb-relative",style:{backgroundImage:"url("+e.image+")"}},e.categories.includes("pro")&&(0,t.createElement)("span",{className:"cnb-pro-badge"},"Pro",(0,t.createElement)("br",null),"Required"),l&&e.button.options.displayMode&&(0,t.createElement)("span",{className:"cnb-feature-label"},l[e.button.options.displayMode])),(0,t.createElement)("div",{className:"text-block"},(0,t.createElement)("h3",null,e.name),(0,t.createElement)("p",null,e.description),(0,t.createElement)("p",null,e.button.actions.map((e=>(0,t.createElement)("span",{className:"cnb-feature-label"},((e,t)=>{const n=String(e);return t&&n in t?t[n].name:n})(e.actionType,a))))))));function a(e){return e?Object.fromEntries(Object.entries(e).filter((e=>{let[t,n]=e;return null!=n})).map((e=>{let[t,n]=e;return[t,n===Object(n)?a(n):n]}))):e}const l=t=>{let{template:l,setTemplate:i,nonce:o,ajaxUrl:r,types:c,displayModes:s,domain:m,upgradeLink:d}=t;const u=(0,e.useRef)(),[p,b]=(0,e.useState)(void 0),[E,y]=(0,e.useState)(void 0),[g,h]=(0,e.useState)(!1),[v,f]=(0,e.useState)(void 0),w=l.categories.includes("pro")&&"PRO"!==m?.type,S=l.metadata.map((t=>{const n=(t=>t.fields.map((n=>{const a=l.button.actions.find((e=>e.id===t.id)),o=a[n.name],r=t.id+"-"+n.name;return(0,e.createElement)("tr",{key:r},(0,e.createElement)("th",null,n.line),(0,e.createElement)("td",null,(0,e.createElement)("input",{onChange:e=>((e,t,n)=>{n[t.name]=e.target.value,i({...l})})(e,n,a),type:"editable"===n.type?"text":"",name:n.name,value:o,required:n.required}),(0,e.createElement)("p",{className:"description"},n.description)))})))(t);return(0,e.createElement)(e.Fragment,{key:t.id},t.title&&(0,e.createElement)("tr",null,(0,e.createElement)("th",{colSpan:2},(0,e.createElement)("h3",null,t.title))),n)})),N=l.button.actions.length>1?"Generate buttons":"Generate button";return(0,e.createElement)("div",null,!g&&!v&&(0,e.createElement)("button",{className:"button button-secondary",onClick:()=>i(void 0)},"Back to the templates"),(0,e.createElement)("h2",{ref:u},"Configure template ",(0,e.createElement)("code",null,l.name)),(0,e.createElement)(n,{template:l,types:c,displayModes:s,handleSelect:()=>{}}),w&&(0,e.createElement)("div",{className:"notice notice-inline notice-warning"},(0,e.createElement)("h4",null,"This template uses ",(0,e.createElement)("span",{className:"cnb-pro-badge"},"Pro")," features."),l.proFeatures&&(0,e.createElement)("p",null,l.proFeatures),d&&(0,e.createElement)("p",null,"Start your ",(0,e.createElement)("strong",null,"14 day free trial")," to see this in action! ",(0,e.createElement)("a",{className:"button button-primary button-small",href:d},"Upgrade now"))),(0,e.createElement)("form",{onSubmit:e=>{e.preventDefault();const t={action:"cnb_create_button",_wpnonce_button:o,button:a({...l.button,id:void 0,actions:void 0,conditions:void 0}),actions:a(l.button.actions.map((e=>({...e,id:void 0})))),conditions:a(l.button.conditions?.map((e=>({...e,id:null}))))};return e.target.checkValidity()?(jQuery.post(r,t).done((e=>{y("success"),b("Redirecting to your button..."),f(e.redirect_link),h(!1),setTimeout((()=>window.location=e.redirect_link),1e3)})).fail((e=>{y("error"),b("Something went wrong: "+e),h(!1)})),y("info"),b("Your button is being created..."),h(!0),!1):(y("warning"),b("Please fill out all the fields..."),h(!1),!1)}},(0,e.createElement)("table",{className:"form-table form-table-gallery"},S),!g&&!v&&(0,e.createElement)("button",{type:"submit",className:"button button-primary"},N),g&&(0,e.createElement)("button",{className:"button button-primary components-button is-busy"},"Generating your button..."),v&&(0,e.createElement)("a",{className:"button button-primary",href:v},"Go to your new Button"),p&&(0,e.createElement)("div",{className:"notice notice-inline notice-"+E},(0,e.createElement)("p",null,p))))},i=t=>{let{templates:a,setTemplate:l,types:i,displayModes:o}=t;return(0,e.createElement)("section",{className:"cnb-grid cnb-grid-4columns"},a.map((t=>(0,e.createElement)(n,{template:t,types:i,displayModes:o,handleSelect:e=>l(e)}))))},o=()=>{window.cnb_templates_init()};(0,e.render)((0,e.createElement)((()=>{const[t,n]=(0,e.useState)(void 0),[a,r]=(0,e.useState)(void 0),[c,s]=(0,e.useState)(void 0),[m,d]=(0,e.useState)(void 0),[u,p]=(0,e.useState)(void 0),[b,E]=(0,e.useState)(void 0),[y,g]=(0,e.useState)(void 0),[h,v]=(0,e.useState)(void 0),f=e=>{n(e.detail.templates),s(e.detail.nonce),d(e.detail.ajaxUrl),p(e.detail.actionTypes),E(e.detail.displayModes),g(e.detail.currentDomain),v(e.detail.upgradeLink);const a=window.location.hash.replace("#t=",""),l=t?.find((e=>e&&e.id===a));l&&r(l)},w=e=>{if(!e||!e?.id)return window.location.hash="",void r(void 0);window.location.hash="#t="+e.id,r(e)};return(0,e.useEffect)((()=>(window.addEventListener("cnb-templates-init",f),()=>{window.removeEventListener("cnb-templates-init",f)}))),t?(0,e.createElement)("div",{className:"cnb-templates"},a?(0,e.createElement)(l,{template:a,types:u,displayModes:b,setTemplate:w,nonce:c,ajaxUrl:m,domain:y,upgradeLink:h}):(0,e.createElement)(i,{templates:t,types:u,displayModes:b,setTemplate:w})):(setTimeout((()=>{o()}),200),(0,e.createElement)("div",null,"Loading the Templates...",(0,e.createElement)("a",{onClick:()=>{o()}},"If nothing happens for a while, click here")))}),null),document.getElementById("call-now-button-app"))})();