1 line
9.8 KiB
JavaScript
1 line
9.8 KiB
JavaScript
!function(){"use strict";var e=window.wp.element;function t(t){let{pages:a=[],selected:n=""}=t;const{currentProduct:l,logoUrl:s,strings:c,links:i}=window.tiSDKAboutData,r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e===n?"active":""};return(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"head"},(0,e.createElement)("div",{className:"container"},(0,e.createElement)("img",{src:s,alt:l.name}),(0,e.createElement)("p",null,"by ",(0,e.createElement)("a",{href:"https://themeisle.com"},"Themeisle")))),(i.length>0||a.length>0)&&(0,e.createElement)("div",{className:"container"},(0,e.createElement)("ul",{className:"nav"},(0,e.createElement)("li",{className:r()},(0,e.createElement)("a",{href:window.location},c.aboutUs)),a.map(((t,a)=>(0,e.createElement)("li",{className:r(t.hash),key:a},(0,e.createElement)("a",{href:t.hash},t.name)))),i.map(((t,a)=>(0,e.createElement)("li",{key:a},(0,e.createElement)("a",{href:t.url},t.text)))))))}var a=window.wp.components;function n(){const{strings:t,teamImage:n,homeUrl:l,pageSlug:s}=window.tiSDKAboutData,{heroHeader:c,heroTextFirst:i,heroTextSecond:r,teamImageCaption:o,newsHeading:m,emailPlaceholder:d,signMeUp:u}=t,[E,p]=(0,e.useState)(""),[h,g]=(0,e.useState)(!1),[v,N]=(0,e.useState)(!1);return(0,e.createElement)("div",{className:"container"},(0,e.createElement)("div",{className:"story-card"},(0,e.createElement)("div",{className:"body"},(0,e.createElement)("div",null,(0,e.createElement)("h2",null,c),(0,e.createElement)("p",null,i),(0,e.createElement)("p",null,r)),(0,e.createElement)("figure",null,(0,e.createElement)("img",{src:n,alt:o}),(0,e.createElement)("figcaption",null,o))),(0,e.createElement)("div",{className:"footer"},(0,e.createElement)("h2",null,m),(0,e.createElement)("form",{onSubmit:e=>{var t;e.preventDefault(),g(!0),null===(t=fetch("https://api.themeisle.com/tracking/subscribe",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, */*;q=0.1","Cache-Control":"no-cache"},body:JSON.stringify({slug:"about-us",site:l,from:s,email:E})}).then((e=>e.json())).then((e=>{g(!1),"success"===e.code&&N(!0)})))||void 0===t||t.catch((e=>{g(!1)}))}},(0,e.createElement)("input",{disabled:h||v,type:"email",value:E,onChange:e=>{p(e.target.value)},placeholder:d}),!h&&!v&&(0,e.createElement)(a.Button,{isPrimary:!0,type:"submit"},u),h&&(0,e.createElement)("span",{className:"dashicons dashicons-update spin"}),v&&(0,e.createElement)("span",{className:"dashicons dashicons-yes-alt"})))))}const l=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((a=>{wp.updates.ajax(!0===t?"install-theme":"install-plugin",{slug:e,success:()=>{a({success:!0})},error:e=>{a({success:!1,code:e.errorCode})}})}))};function s(t){let{product:n,slug:s}=t;const{icon:c,name:i,description:r,status:o,premiumUrl:m,activationLink:d}=n,{strings:u,canInstallPlugins:E,canActivatePlugins:p}=window.tiSDKAboutData,{installNow:h,installed:g,notInstalled:v,active:N,activate:b,learnMore:f}=u,w=!!m,[y,k]=(0,e.useState)(o),[S,T]=(0,e.useState)(!1),D=async()=>{T(!0),await l(s,"neve"===s).then((e=>{e.success&&k("installed")})),T(!1)},x=async()=>{T(!0),window.location.href=d},_=()=>"not-installed"===y&&w?(0,e.createElement)(a.Button,{isLink:!0,icon:"external",href:m,target:"_blank"},f):"not-installed"!==y||w?"installed"===y?(0,e.createElement)(a.Button,{isSecondary:!0,onClick:x,disabled:S||!p},b):null:(0,e.createElement)(a.Button,{isPrimary:!0,onClick:D,disabled:S||!E},h),C=!E&&"not-installed"===y||!p&&"installed"===y?(0,e.createElement)(a.Tooltip,{text:`Ask your admin to enable ${i} on your site`,position:"top center"},_()):_();return(0,e.createElement)("div",{className:"product-card"},(0,e.createElement)("div",{className:"header"},c&&(0,e.createElement)("img",{src:c,alt:i}),(0,e.createElement)("h2",null,i)),(0,e.createElement)("div",{className:"body"},(0,e.createElement)("p",{dangerouslySetInnerHTML:{__html:r}})),(0,e.createElement)("div",{className:"footer"},(0,e.createElement)("p",null,"Status:"," ",(0,e.createElement)("span",{className:y},"installed"===y&&g,"not-installed"===y&&v,"active"===y&&N)),"active"!==y&&!S&&C,S&&(0,e.createElement)("span",{className:"dashicons dashicons-update spin"})))}function c(){const{products:t}=window.tiSDKAboutData;return(0,e.createElement)("div",{className:"container"},(0,e.createElement)("div",{className:"product-cards"},Object.keys(t).map(((a,n)=>(0,e.createElement)(s,{key:a,slug:a,product:t[a]})))))}const i={"otter-page":function(t){let{page:n={}}=t;const{products:s,canInstallPlugins:c,canActivatePlugins:i}=window.tiSDKAboutData,{strings:r,plugin:o}=n,m=n&&n.product?n.product:"",d=m&&s[m]&&s[m].icon?s[m].icon:null,[u,E]=(0,e.useState)(r.testimonials.users[0]),[p,h]=(0,e.useState)(o.status),[g,v]=(0,e.useState)(!1),N="In Progress",b=async()=>{v(!0),await l(m,!1).then((e=>{e.success&&(h("installed"),f())}))},f=async()=>{v(!0),window.location.href=o.activationLink},w=(0,e.createElement)(a.Button,{variant:"primary",disabled:g||("not-installed"===p?!c:!i),className:"otter-button"+(g?" is-loading":""),onClick:"not-installed"===p?b:f},g?(0,e.createElement)("span",null,(0,e.createElement)("span",{className:"dashicons dashicons-update spin"})," ",N):r.buttons.install_otter_free),y=(0,e.createElement)(a.Button,{variant:"primary",disabled:g||("not-installed"===p?!c:!i),className:"otter-button"+(g?" is-loading":""),onClick:"not-installed"===p?b:f},g?(0,e.createElement)("span",null,(0,e.createElement)("span",{className:"dashicons dashicons-update spin"}),N):r.buttons.install_now),k=!c&&"not-installed"===p||!i&&"installed"===p||!1,S=t=>k?(0,e.createElement)(a.Tooltip,{text:"Ask your admin to enable Otter on your site",position:"top center"},t):t;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"hero"},d&&(0,e.createElement)("img",{className:"logo",src:d,alt:n.name||""}),(0,e.createElement)("span",{className:"label"},"Neve + Otter = New Possibilities 🤝"),(0,e.createElement)("h1",null,r.heading),(0,e.createElement)("p",null,r.text),("not-installed"===p||"installed"===p)&&S(w)),(0,e.createElement)("div",{className:"col-3-highlights"},(0,e.createElement)("div",{className:"col"},(0,e.createElement)("h3",null,r.features.advancedTitle),(0,e.createElement)("p",null,r.features.advancedDesc)),(0,e.createElement)("div",{className:"col"},(0,e.createElement)("h3",null,r.features.fastTitle),(0,e.createElement)("p",null,r.features.fastDesc)),(0,e.createElement)("div",{className:"col"},(0,e.createElement)("h3",null,r.features.mobileTitle),(0,e.createElement)("p",null,r.features.mobileDesc))),(0,e.createElement)("div",{className:"col-2-highlights"},(0,e.createElement)("div",{className:"col"},(0,e.createElement)("img",{src:r.details.s1Image,alt:r.details.s1Title})),(0,e.createElement)("div",{className:"col"},(0,e.createElement)("h2",null,r.details.s1Title),(0,e.createElement)("p",null,r.details.s1Text))),(0,e.createElement)("div",{className:"col-2-highlights"},(0,e.createElement)("div",{className:"col"},(0,e.createElement)("h2",null,r.details.s2Title),(0,e.createElement)("p",null,r.details.s2Text)),(0,e.createElement)("div",{className:"col"},(0,e.createElement)("img",{src:r.details.s2Image,alt:r.details.s1Title}))),(0,e.createElement)("div",{className:"col-2-highlights"},(0,e.createElement)("div",{className:"col"},(0,e.createElement)("img",{src:r.details.s3Image,alt:r.details.s1Title})),(0,e.createElement)("div",{className:"col"},(0,e.createElement)("h2",null,r.details.s3Title),(0,e.createElement)("p",null,r.details.s3Text))),(0,e.createElement)("div",{className:"col-2-highlights",style:{backgroundColor:"#F7F7F7",borderBottom:"none",borderBottomRightRadius:"8px",borderBottomLeftRadius:"8px"}},(0,e.createElement)("div",{className:"col"},(0,e.createElement)("h2",null,r.testimonials.heading),(0,e.createElement)("div",{className:"button-row"},("not-installed"===p||"installed"===p)&&S(y),(0,e.createElement)("a",{className:"components-button otter-button is-secondary",href:r.buttons.learn_more_link,target:"_blank",rel:"external noreferrer noopener"},r.buttons.learn_more))),(0,e.createElement)("div",{className:"col"},(0,e.createElement)("div",{className:"testimonials"},(0,e.createElement)("ul",{id:"testimonial-container",className:"testimonial-container"},r.testimonials.users.map(((t,a)=>(0,e.createElement)("li",{className:"testimonial",id:"ts_"+a,key:"ts_"+a},(0,e.createElement)("p",null,'"',t.text,'"'),(0,e.createElement)("img",{src:t.avatar,alt:t.name}),(0,e.createElement)("h3",null,t.name))))),(0,e.createElement)("div",{className:"testimonial-nav"},r.testimonials.users.map(((t,n)=>(0,e.createElement)(a.Button,{className:"testimonial-button"+(t.name===u.name?" active":""),key:"button_"+n,onClick:()=>(e=>{const t=r.testimonials.users[e];document.getElementById("ts_"+e).scrollIntoView({behavior:"smooth"}),E(t)})(n)}))))))))}};function r(t){const a=i[t.id];return(0,e.createElement)(a,{page:t.page})}function o(t){let{page:a={}}=t;return(0,e.createElement)("div",{className:"product-page"+(a&&a.product?" "+a.product:"")},(0,e.createElement)(r,{id:a.id,page:a}))}const m=()=>{let e=window.location.hash;return"string"!=typeof window.location.hash?null:e};function d(){const{productPages:a}=window.tiSDKAboutData,l=a?Object.keys(a).map((e=>{const t=a[e];return t.id=e,t})):[],[s,i]=(0,e.useState)(m()),r=()=>{const e=m();null!==e&&i(e)};(0,e.useEffect)((()=>(r(),window.addEventListener("hashchange",r),()=>{window.removeEventListener("hashchange",r)})),[]);const d=l.filter((e=>e.hash===s));return d.length>0?(0,e.createElement)("div",{className:"ti-about"},(0,e.createElement)(t,{pages:l,selected:s}),(0,e.createElement)(o,{page:d[0]})):(0,e.createElement)("div",{className:"ti-about"},(0,e.createElement)(t,{pages:l}),(0,e.createElement)(n,null),(0,e.createElement)(c,null))}document.addEventListener("DOMContentLoaded",(()=>{const t=document.querySelector("#ti-sdk-about");t&&(0,e.render)((0,e.createElement)(d,null),t)}))}(); |