PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.6.0
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.6.0
4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / assets / js / google-reviews.build.js
embedpress / assets / js Last commit date
chunks 2 weeks ago vendor 9 months ago admin.build.js 2 weeks ago admin.js 3 months ago analytics-tracker.js 1 month ago analytics.build.js 2 weeks ago blocks.build.js 4 days ago carousel.js 1 year ago custom-player.build.js 2 weeks ago documents-viewer-script.js 3 months ago ep-gr-elementor-control.js 4 days ago ep-pdf-lightbox.js 3 months ago ep-view-count.js 2 weeks ago ep-yt-queue.js 1 month ago feature-notices.js 7 months ago feature-preview-modal.js 4 days ago front.js 4 days ago frontend.build.js 3 months ago gallery-justify.js 2 weeks ago google-reviews.build.js 4 days ago google-reviews.js 4 days ago gutneberg-script.js 2 months ago index.html 7 years ago initCarousel.js 2 years ago initplyr.js 2 months ago instafeed.js 1 month ago instagram-shortcode-generator.js 1 month ago lazy-load.js 6 months ago license.js 3 months ago meetup-timezone.js 3 months ago onboarding.build.js 2 weeks ago pdf-gallery-elementor-editor.js 3 months ago pdf-gallery.js 3 months ago preview.js 9 months ago settings.js 3 months ago sponsored.js 9 months ago
google-reviews.build.js
4 lines
1 import{j as e,r as a}from"./chunks/index-DOwIfqLg.js";import{c as Pe}from"./chunks/client-CYGEkzri.js";const k=window.wp&&window.wp.i18n&&window.wp.i18n.__||(r=>r),Re="/embedpress/v1/google-reviews",Le={limit:10,min_rating:0,layout:"list",show_photo:!0,show_stars:!0,show_date:!0,show_images:!0,show_link:!1,columns:3,gap:20,max_width:0,show_summary:!0,sort:"newest",keyword:"",hide_empty:!1,load_more:!0,theme:"light",accent_color:"",autoplay:!1,schema:!1},z=typeof window<"u"&&window.epGoogleReviewsAdmin||{},A=!!z.proActive,$=z.upgradeUrl||"https://wpdeveloper.com/in/upgrade-embedpress",ee=r=>{const l=String(r||"");return l.length<=12?l:`${l.slice(0,6)}${"*".repeat(11)}${l.slice(-6)}`},ge=[{label:"List",value:"list"},{label:"Grid",value:"grid"},{label:"Card",value:"card"},{label:"Carousel",value:"carousel"},{label:"Masonry",value:"masonry",pro:!0},{label:"Compact badge",value:"badge",pro:!0},{label:"Spotlight",value:"spotlight",pro:!0},{label:"Knowledge panel",value:"knowledge",pro:!0},{label:"Marquee",value:"marquee",pro:!0},{label:"Bubble",value:"bubble",pro:!0}],ce={list:{reviews:!0,columns:!1,gap:!1,slider:!1,autoplay:!1,loadMore:!0,images:!0},grid:{reviews:!0,columns:!0,gap:!0,slider:!1,autoplay:!1,loadMore:!0,images:!0},card:{reviews:!0,columns:!0,gap:!0,slider:!1,autoplay:!1,loadMore:!0,images:!0},carousel:{reviews:!0,columns:!0,gap:!0,slider:!0,autoplay:!0,loadMore:!1,images:!1},masonry:{reviews:!0,columns:!0,gap:!0,slider:!1,autoplay:!1,loadMore:!0,images:!0},badge:{reviews:!1,columns:!1,gap:!1,slider:!1,autoplay:!1,loadMore:!1,images:!1},spotlight:{reviews:!0,columns:!1,gap:!1,slider:!1,autoplay:!0,loadMore:!1,images:!0},knowledge:{reviews:!1,columns:!1,gap:!1,slider:!1,autoplay:!1,loadMore:!1,images:!1},marquee:{reviews:!0,columns:!0,gap:!0,slider:!1,autoplay:!1,loadMore:!1,images:!1},bubble:{reviews:!0,columns:!0,gap:!0,slider:!1,autoplay:!1,loadMore:!0,images:!0}},me=r=>ce[r]||ce.list;new Set(ge.filter(r=>r.pro).map(r=>r.value));const Te=[{name:"Default",color:""},{name:"EmbedPress",color:"#5b4e96"},{name:"Google Blue",color:"#4285f4"},{name:"Green",color:"#34a853"},{name:"Amber",color:"#fbbc05"},{name:"Red",color:"#ea4335"},{name:"Slate",color:"#334155"}];function P(r,l,p,c){const d=z.restUrl||"/wp-json"+Re,n=d.indexOf("?")!==-1;let o;if(n?o=d.replace(/([?&]rest_route=)([^&]*)/,(h,m,w)=>m+encodeURIComponent(decodeURIComponent(w)+l)):o=d+l,p){const h=Object.keys(p).map(m=>encodeURIComponent(m)+"="+encodeURIComponent(p[m])).join("&");h&&(o+=(o.indexOf("?")!==-1?"&":"?")+h)}const i={method:r,headers:{"X-WP-Nonce":z.nonce||"","Content-Type":"application/json"},credentials:"same-origin"};return c&&(i.body=JSON.stringify(c)),fetch(o,i).then(h=>h.json().then(m=>({ok:h.ok,status:h.status,body:m})))}const Ae=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const l=Math.random()*16|0;return(r==="x"?l:l&3|8).toString(16)}),Ie=5*60*1e3,Fe=[{k:"limit"},{k:"min_rating",cap:"reviews",pro:!0},{k:"layout"},{k:"show_photo",cap:"reviews"},{k:"show_stars",cap:"reviews"},{k:"show_date",cap:"reviews"},{k:"show_images",cap:"images",pro:!0},{k:"show_link",cap:"reviews"},{k:"show_summary"},{k:"columns",cap:"columns"},{k:"gap",cap:"gap"},{k:"max_width"},{k:"sort",cap:"reviews"},{k:"keyword",cap:"reviews"},{k:"hide_empty",cap:"reviews"},{k:"load_more",cap:"loadMore"},{k:"theme"},{k:"accent_color"},{k:"autoplay",cap:"autoplay"},{k:"schema"}];function Me(r,l){if(!r)return"";const p=me(l.layout),c=["embedpress_google_reviews",`place_id="${r.place_id}"`];return r.main_text&&c.push(`place_name="${r.main_text.replace(/"/g,"&quot;")}"`),Fe.forEach(({k:d,cap:n,pro:o})=>{if(n&&!p[n]||o&&!A)return;let i=l[d];i===Le[d]||i===void 0||(typeof i=="boolean"&&(i=i?"true":"false"),i!==""&&c.push(`${d}="${i}"`))}),`[${c.join(" ")}]`}const $e=()=>{const[r,l]=a.useState({connected:!1,site_id:"",tier:"",connected_at:0,home_url:"",endpoint:"",would_send:{site_url:"",admin_email:""}}),[p,c]=a.useState(!1),[d,n]=a.useState(!1),[o,i]=a.useState({text:"",tone:""}),[h,m]=a.useState(21600),[w,f]=a.useState(!1),[g,N]=a.useState(!1);a.useEffect(()=>{P("GET","/managed/status").then(t=>{t.ok&&l(t.body),c(!0)}),P("GET","/settings").then(t=>{t.ok&&t.body&&t.body.cache_ttl&&m(parseInt(t.body.cache_ttl,10))})},[]);const _=(t,b)=>{i({text:t,tone:b}),setTimeout(()=>i({text:"",tone:""}),7e3)},I=()=>{n(!0),P("POST","/managed/connect").then(t=>{n(!1),t.ok&&t.body&&t.body.connected?(l(t.body),window.dispatchEvent(new CustomEvent("ep-gr-connection-changed",{detail:{connected:!0}})),_("Connected to the EmbedPress API.","success")):_(t.body&&t.body.message||"Couldn’t connect. Try again.","error")})},y=()=>{n(!0),P("POST","/managed/disconnect").then(t=>{n(!1),t.ok?(l(t.body),window.dispatchEvent(new CustomEvent("ep-gr-connection-changed",{detail:{connected:!1}})),_("Disconnected from the EmbedPress API.","error")):_(t.body&&t.body.message||"Couldn’t disconnect. Try again.","error")})},S=()=>{f(!0),P("POST","/settings",null,{cache_ttl:h}).then(t=>{f(!1),t.ok?_("Settings saved.","success"):_(t.body&&t.body.message||"Couldn’t save settings.","error")})},U=()=>{P("POST","/clear-cache",null,{}).then(t=>{t.ok?_(`Cache cleared (${t.body&&t.body.deleted||0} reviews).`,"success"):_("Couldn’t clear the cache.","error")})};if(!p)return e.jsxs("section",{className:"ep-gr-card ep-gr-card--api ep-gr-card--skeleton","aria-hidden":"true",children:[e.jsxs("header",{className:"ep-gr-card-header",children:[e.jsx("span",{className:"ep-gr-step-badge",children:"·"}),e.jsxs("div",{className:"ep-gr-card-headtext",children:[e.jsx("h2",{children:e.jsx("span",{className:"ep-gr-skel ep-gr-skel--title",style:{width:180}})}),e.jsxs("p",{children:[e.jsx("span",{className:"ep-gr-skel ep-gr-skel--line"}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--line ep-gr-skel--line-short"})]})]})]}),e.jsx("div",{className:"ep-gr-card-body",children:e.jsxs("div",{className:"ep-gr-api-cta",children:[e.jsx("span",{className:"ep-gr-skel ep-gr-skel--btn",style:{width:200,height:32}}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--line",style:{width:100}})]})})]});const L=!!r.connected,M=r.would_send||{};return e.jsxs("section",{className:"ep-gr-card ep-gr-card--api",children:[e.jsxs("header",{className:"ep-gr-card-header",children:[e.jsx("span",{className:"ep-gr-step-badge",children:"1"}),e.jsxs("div",{className:"ep-gr-card-headtext",children:[e.jsxs("h2",{children:["EmbedPress API",L?e.jsxs("span",{className:"ep-gr-hpill ep-gr-hpill--on",children:[e.jsx("span",{className:"ep-gr-hpill-dot"}),"Connected",` · ${A?"PRO":"Free"}`]}):e.jsxs("span",{className:"ep-gr-hpill ep-gr-hpill--off",children:[e.jsx("span",{className:"ep-gr-hpill-dot"}),"Not connected"]})]}),e.jsx("p",{children:L?"Your site is connected and ready to pull Google reviews. This connection is locked to this site only.":"Connect in one click to start pulling Google reviews — no signup or API keys needed."})]})]}),e.jsxs("div",{className:"ep-gr-card-body",children:[L?e.jsxs("div",{className:"ep-gr-api-status",children:[e.jsxs("div",{className:"ep-gr-api-status-meta",children:[e.jsx("span",{className:"ep-gr-api-status-label",children:"Site ID"}),e.jsx("code",{className:"ep-gr-api-status-val",children:r.site_id?ee(r.site_id):"—"})]}),e.jsx("button",{type:"button",className:"button",disabled:d,onClick:y,children:d?"Disconnecting…":"Disconnect"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ep-gr-api-cta",children:[e.jsx("button",{type:"button",className:"button button-primary",disabled:d,onClick:I,children:d?"Connecting…":"Connect to EmbedPress API"}),e.jsx("button",{type:"button",className:"ep-gr-linklike","aria-expanded":g,onClick:()=>N(t=>!t),children:g?"Hide Data Privacy Info":"View Data Privacy Info"})]}),g&&e.jsxs("ul",{className:"ep-gr-send-list","aria-label":"Information sent at connect",children:[e.jsxs("li",{children:[e.jsx("span",{className:"ep-gr-send-key",children:"Site URL"}),e.jsx("code",{className:"ep-gr-send-val",children:M.site_url||""}),e.jsx("span",{className:"ep-gr-send-note",children:"used to verify and connect this site"})]}),e.jsxs("li",{children:[e.jsx("span",{className:"ep-gr-send-key",children:"Email"}),e.jsx("code",{className:"ep-gr-send-val",children:M.admin_email||""}),e.jsx("span",{className:"ep-gr-send-note",children:"used to identify this connection"})]})]})]}),e.jsx("div",{className:"ep-gr-advanced",children:e.jsxs("div",{className:"ep-gr-advanced-body",children:[e.jsxs("div",{className:"ep-gr-advanced-row",children:[e.jsxs("div",{className:"ep-gr-advanced-control",children:[e.jsx("label",{htmlFor:"ep-gr-cache-ttl",children:"Cache reviews for"}),e.jsxs("div",{className:"ep-gr-advanced-inline",children:[e.jsxs("select",{id:"ep-gr-cache-ttl",value:h,onChange:t=>m(parseInt(t.target.value,10)),children:[e.jsx("option",{value:3600,children:"1 hour"}),e.jsx("option",{value:21600,children:"6 hours"}),e.jsx("option",{value:86400,children:"24 hours"})]}),e.jsx("button",{type:"button",className:"button button-primary",disabled:w,onClick:S,children:w?"Saving…":"Save"})]})]}),e.jsxs("button",{type:"button",className:"button ep-gr-clear-cache",onClick:U,children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),"Clear reviews cache"]})]}),e.jsx("p",{className:"ep-gr-advanced-hint",children:"How long fetched reviews are stored before EmbedPress checks for fresh ones."})]})}),o.text&&e.jsx("span",{className:`ep-gr-status ep-gr-status--${o.tone}`,"aria-live":"polite",children:o.text})]})]})},se=()=>e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fill:"currentColor",d:"M5 16L3 5l5.5 5L12 4l3.5 6L21 5l-2 11H5zm0 2h14v2H5v-2z"})}),de=()=>e.jsxs("svg",{className:"ep-gr-suggestion-pin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),pe=({rating:r,count:l})=>r==null&&l==null?null:e.jsxs("span",{className:"ep-gr-suggestion-meta",children:[r!=null&&e.jsxs("span",{className:"ep-gr-suggestion-rating",children:[e.jsx("span",{className:"ep-gr-suggestion-star","aria-hidden":"true",children:"�
2 "}),Number(r).toFixed(1)]}),l!=null&&e.jsxs("span",{className:"ep-gr-suggestion-count",children:[Number(l).toLocaleString()," ",k(l===1?"review":"reviews","embedpress")]})]}),Ue=({locked:r,children:l})=>r?e.jsxs("div",{className:"ep-gr-prolock",role:"button",tabIndex:0,title:k("This is a Pro feature — click to upgrade.","embedpress"),onClick:()=>window.open($,"_blank","noopener"),onKeyDown:p=>{p.key==="Enter"&&window.open($,"_blank","noopener")},children:[e.jsxs("span",{className:"ep-gr-prolock-badge",children:[e.jsx(se,{})," ",k("Pro","embedpress")]}),e.jsx("div",{className:"ep-gr-prolock-inner","aria-hidden":"true",children:l})]}):l,De=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),e.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),e.jsx("line",{x1:"8",y1:"14",x2:"13",y2:"14"})]}),He=({value:r,onChange:l})=>e.jsx("div",{className:"ep-gr-layout-picker",children:ge.map(p=>{const c=p.pro&&!A;return e.jsxs("button",{type:"button",className:"ep-gr-layout-tile"+(p.value===r?" is-active":"")+(c?" is-locked":""),"aria-pressed":p.value===r,disabled:c,title:c?`${p.label} — ${k("Pro","embedpress")}`:p.label,onClick:()=>{c?window.open($,"_blank","noopener"):l(p.value)},children:[c&&e.jsx("svg",{className:"ep-gr-tile-crown",width:"12",height:"12",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fill:"#f0b849",d:"M5 16L3 5l5.5 5L12 4l3.5 6L21 5l-2 11H5zm0 2h14v2H5v-2z"})}),e.jsx("span",{className:"ep-gr-layout-tile-icon",children:De}),e.jsx("span",{className:"ep-gr-layout-tile-label",children:p.label})]},p.value)})}),Oe=({place:r,apifyConnected:l,onClose:p})=>{const c=l?50:10,d={place_id:r.place_id,main_text:r.place_name||r.place_id},[n,o]=a.useState({limit:10,min_rating:0,layout:"list",show_photo:!0,show_stars:!0,show_date:!0,show_images:!0,show_link:!1,show_summary:!0,columns:3,gap:20,max_width:0,sort:"newest",keyword:"",hide_empty:!1,load_more:!0,theme:"light",accent_color:"",autoplay:!1,schema:!1}),[i,h]=a.useState(""),[m,w]=a.useState(!1),[f,g]=a.useState(null),[N,_]=a.useState(!1),I=a.useRef(null),y=(t,b)=>o(E=>({...E,[t]:b})),S=me(n.layout);a.useEffect(()=>{const t=E=>{E.key==="Escape"&&p()};document.addEventListener("keydown",t);const b=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",t),document.body.style.overflow=b}},[p]);const U=a.useCallback(()=>{w(!0),g(null);const t={place_id:d.place_id,place_name:d.main_text||"",...n};P("GET","/preview",t).then(b=>{w(!1),b.ok&&b.body.html?h(b.body.html):(h(""),g(b.body&&(b.body.message||b.body.code)||`Preview failed (HTTP ${b.status}).`))}).catch(()=>{w(!1),g("Network error — could not reach the server.")})},[d.place_id,d.main_text,n]);a.useEffect(()=>(clearTimeout(I.current),I.current=setTimeout(U,250),()=>clearTimeout(I.current)),[n,U]);const L=Me(d,n),M=()=>{if(!L)return;(b=>{if(navigator.clipboard&&navigator.clipboard.writeText)return navigator.clipboard.writeText(b);const E=document.createElement("textarea");return E.value=b,document.body.appendChild(E),E.select(),document.execCommand("copy"),document.body.removeChild(E),Promise.resolve()})(L).then(()=>{_(!0),setTimeout(()=>_(!1),2e3)})};return e.jsx("div",{className:"ep-gr-modal-overlay",onMouseDown:p,role:"presentation",children:e.jsxs("div",{className:"ep-gr-modal",role:"dialog","aria-modal":"true","aria-label":`Generate shortcode for ${d.main_text}`,onMouseDown:t=>t.stopPropagation(),children:[e.jsxs("header",{className:"ep-gr-modal-header",children:[e.jsxs("div",{className:"ep-gr-modal-title",children:[e.jsx("span",{className:"ep-gr-modal-title-icon","aria-hidden":"true",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]})}),e.jsxs("div",{children:[e.jsx("h2",{children:"Embed this place"}),e.jsx("p",{children:d.main_text})]})]}),e.jsx("button",{type:"button",className:"ep-gr-modal-close","aria-label":"Close",onClick:p,children:"×"})]}),e.jsxs("div",{className:"ep-gr-modal-body",children:[e.jsxs("div",{className:"ep-gr-callout",children:["Use the shortcode in ",e.jsx("strong",{children:"Classic, Bricks, Divi"}),", or any builder. In ",e.jsx("strong",{children:"Gutenberg"})," & ",e.jsx("strong",{children:"Elementor"}),", use the dedicated ",e.jsx("strong",{children:"Google Reviews"})," block/widget for richer controls."]}),e.jsxs("div",{className:"ep-gr-split",children:[e.jsxs("div",{className:"ep-gr-split-pane",children:[e.jsx("h3",{children:"Layout"}),e.jsx(He,{value:n.layout,onChange:t=>y("layout",t)}),e.jsx("h3",{className:"ep-gr-h3-spaced",children:"Display"}),e.jsxs("div",{className:"ep-gr-row ep-gr-row--three",children:[S.reviews&&e.jsx(Ue,{locked:!A,children:e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{htmlFor:"ep-gr-min-rating",children:"Minimum rating"}),e.jsxs("select",{id:"ep-gr-min-rating",value:n.min_rating,onChange:t=>y("min_rating",parseInt(t.target.value,10)),children:[e.jsx("option",{value:0,children:"Any"}),e.jsx("option",{value:3,children:"3+"}),e.jsx("option",{value:4,children:"4+"}),e.jsx("option",{value:5,children:"5"})]})]})}),S.loadMore&&e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{htmlFor:"ep-gr-limit",children:"Reviews per page"}),e.jsx("select",{id:"ep-gr-limit",value:n.limit,onChange:t=>y("limit",parseInt(t.target.value,10)),children:(c>5?[1,2,3,4,5,6,8,10,15,20,30,40,50]:[1,2,3,4,5]).filter(t=>t<=c).map(t=>e.jsx("option",{value:t,children:t},t))})]}),S.columns&&e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{htmlFor:"ep-gr-columns",children:"Columns"}),e.jsx("select",{id:"ep-gr-columns",value:n.columns,onChange:t=>y("columns",parseInt(t.target.value,10)),children:[1,2,3,4,5,6].map(t=>e.jsx("option",{value:t,children:t},t))})]})]}),S.reviews&&e.jsxs("fieldset",{className:"ep-gr-toggles",children:[e.jsx("legend",{children:"Review Elements"}),e.jsx("div",{className:"ep-gr-chips",children:[["show_photo","Reviewer photo",!0,!1],["show_stars","Star rating",!0,!1],["show_date","Date",!0,!1],["show_images","Review images",S.images,!0],["show_link","“View on Google” link",!0,!1],["show_summary","Show header",!0,!1]].filter(([,,t])=>t).map(([t,b,,E])=>{const R=E&&!A;return e.jsxs("label",{className:`ep-gr-chip${n[t]&&!R?" is-on":""}${R?" is-locked":""}`,title:R?"Pro feature":void 0,onClick:R?D=>{D.preventDefault(),window.open($,"_blank","noopener")}:void 0,children:[e.jsx("input",{type:"checkbox",checked:n[t]&&!R,disabled:R,onChange:D=>{R||y(t,D.target.checked)}}),b,R&&e.jsx(se,{})]},t)})})]}),S.loadMore&&e.jsx("div",{className:"ep-gr-pro-toggles",children:e.jsxs("label",{className:`ep-gr-switch${n.load_more?" is-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:n.load_more,onChange:t=>y("load_more",t.target.checked)}),e.jsx("span",{className:"ep-gr-switch-track"})," Load More"]})}),e.jsx("div",{className:"ep-gr-section-divider",children:e.jsx("span",{children:"Filtering & style"})}),e.jsxs(e.Fragment,{children:[S.reviews&&e.jsxs("div",{className:"ep-gr-row ep-gr-row--two",children:[e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{htmlFor:"ep-gr-sort",children:"Sort by"}),e.jsxs("select",{id:"ep-gr-sort",value:n.sort,onChange:t=>y("sort",t.target.value),children:[e.jsx("option",{value:"newest",children:"Newest"}),e.jsx("option",{value:"highest",children:"Highest rated"}),e.jsx("option",{value:"lowest",children:"Lowest rated"}),e.jsx("option",{value:"relevant",children:"Most relevant"})]})]}),e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{htmlFor:"ep-gr-keyword",children:"Keyword filter"}),e.jsx("input",{id:"ep-gr-keyword",type:"text",placeholder:"e.g. service, staff",value:n.keyword,onChange:t=>y("keyword",t.target.value)})]})]}),e.jsxs("div",{className:"ep-gr-row ep-gr-row--two",children:[e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{htmlFor:"ep-gr-theme",children:"Theme"}),e.jsxs("select",{id:"ep-gr-theme",value:n.theme,onChange:t=>y("theme",t.target.value),children:[e.jsx("option",{value:"light",children:"Light"}),e.jsx("option",{value:"dark",children:"Dark"})]})]}),e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{children:"Accent color"}),e.jsx("div",{className:"ep-gr-swatches",children:Te.map(t=>e.jsx("button",{type:"button",className:"ep-gr-swatch"+(n.accent_color===t.color?" is-active":"")+(t.color===""?" ep-gr-swatch--none":""),style:t.color?{background:t.color}:void 0,title:t.name,"aria-label":t.name,onClick:()=>y("accent_color",t.color)},t.name))})]})]}),e.jsxs("div",{className:"ep-gr-pro-toggles",children:[S.reviews&&e.jsxs("label",{className:`ep-gr-switch${n.hide_empty?" is-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:n.hide_empty,onChange:t=>y("hide_empty",t.target.checked)}),e.jsx("span",{className:"ep-gr-switch-track"})," Hide reviews with no text"]}),S.autoplay&&e.jsxs("label",{className:`ep-gr-switch${n.autoplay?" is-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:n.autoplay,onChange:t=>y("autoplay",t.target.checked)}),e.jsx("span",{className:"ep-gr-switch-track"})," Autoplay"]}),e.jsxs("label",{className:`ep-gr-switch${n.schema?" is-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:n.schema,onChange:t=>y("schema",t.target.checked)}),e.jsx("span",{className:"ep-gr-switch-track"})," Output review schema (JSON-LD)"]})]})]}),e.jsxs("div",{className:"ep-gr-field ep-gr-shortcode-field",children:[e.jsxs("div",{className:"ep-gr-shortcode-head",children:[e.jsx("label",{htmlFor:"ep-gr-shortcode",children:"Generated shortcode"}),e.jsx("span",{className:"ep-gr-shortcode-hint",children:"Paste into any post, page, or builder widget."})]}),e.jsxs("div",{className:`ep-gr-shortcode-row${N?" is-copied":""}`,children:[e.jsx("span",{className:"ep-gr-shortcode-prompt","aria-hidden":"true",children:"</>"}),e.jsx("textarea",{id:"ep-gr-shortcode",rows:1,readOnly:!0,value:L,onFocus:t=>t.target.select()}),e.jsx("button",{type:"button",className:"ep-gr-shortcode-copy",disabled:!L,onClick:M,"aria-label":N?"Copied":"Copy shortcode",children:N?e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})]})]}),e.jsxs("div",{className:"ep-gr-split-pane",children:[e.jsx("h3",{children:"Live preview"}),e.jsxs("div",{className:"ep-gr-preview-wrap",children:[m&&i&&e.jsx("span",{className:"ep-gr-preview-loading",children:"Updating"}),f?e.jsxs("p",{className:"ep-gr-inline-note ep-gr-inline-note--error",role:"alert",children:[e.jsx("strong",{children:"Preview failed:"})," ",f]}):i?e.jsx("div",{dangerouslySetInnerHTML:{__html:i}}):e.jsxs("div",{className:"ep-gr-preview-skeleton","aria-hidden":"true",children:[e.jsxs("div",{className:"ep-gr-preview-skel-summary",children:[e.jsx("span",{className:"ep-gr-skel ep-gr-skel--avatar"}),e.jsxs("div",{className:"ep-gr-preview-skel-summary-lines",children:[e.jsx("span",{className:"ep-gr-skel ep-gr-skel--title"}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--sub"})]})]}),[0,1,2].map(t=>e.jsxs("div",{className:"ep-gr-preview-skel-card",children:[e.jsxs("div",{className:"ep-gr-preview-skel-card-head",children:[e.jsx("span",{className:"ep-gr-skel ep-gr-skel--avatar"}),e.jsxs("div",{className:"ep-gr-preview-skel-card-meta",children:[e.jsx("span",{className:"ep-gr-skel ep-gr-skel--title"}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--sub"})]})]}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--line"}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--line"}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--line ep-gr-skel--line-short"})]},t))]})]})]})]})]})]})})},Be=[50,100,500],Ge=r=>{const l=a.useRef(null),[p,c]=a.useState(!1),[d,n]=a.useState(!1);return a.useLayoutEffect(()=>{if(!r){n(!1);return}const o=l.current;if(!o)return;const i=()=>{const h=o.offsetParent||o.parentElement;if(!h){n(!0);return}const m=h.getBoundingClientRect(),w=o.offsetHeight||200,f=window.innerHeight-m.bottom,g=m.top;c(f<w+12&&g>f),n(!0)};return i(),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[r]),[l,p,d]},te=r=>{const l=a.useRef(null),[p,c]=a.useState(!1),[d,n]=a.useState(!1);return a.useEffect(()=>{const o=h=>{l.current&&!l.current.contains(h.target)&&r()},i=h=>{h.key==="Escape"&&r()};return document.addEventListener("mousedown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i)}},[r]),a.useLayoutEffect(()=>{const o=l.current;if(!o)return;const i=o.offsetParent||o.parentElement;if(!i){n(!0);return}const h=i.getBoundingClientRect(),m=o.offsetHeight||200,w=window.innerHeight-h.bottom,f=h.top;c(w<m+12&&f>w),n(!0)},[]),a.useEffect(()=>{const o=()=>{const i=l.current;if(!i)return;const h=i.offsetParent||i.parentElement;if(!h)return;const m=h.getBoundingClientRect(),w=i.offsetHeight||200,f=window.innerHeight-m.bottom,g=m.top;c(f<w+12&&g>f)};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),[l,p,d]},K=1e3,qe=({onConfirm:r,onClose:l,total:p=0})=>{const[c,d]=a.useState("quick"),[n,o]=a.useState("100"),[i,h,m]=te(l),w=p>0?Math.min(p,K):K,f=()=>{if(c==="quick"){r({mode:"quick",count:0});return}const g=n==="all"?0:parseInt(n,10),N=Number.isFinite(g)&&g>0?Math.min(g,w):0;r({mode:"full",count:N})};return e.jsxs("div",{className:`ep-gr-refetch-pop${h?" is-up":""}${m?"":" is-measuring"}`,ref:i,role:"dialog","aria-label":"Refetch reviews",children:[e.jsx("p",{className:"ep-gr-refetch-pop-title",children:"Refetch reviews"}),e.jsxs("div",{className:"ep-gr-refetch-modes",role:"radiogroup","aria-label":"Refetch mode",children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":c==="quick",className:`ep-gr-refetch-mode${c==="quick"?" is-active":""}`,onClick:()=>d("quick"),children:[e.jsx("span",{className:"ep-gr-refetch-mode-title",children:"Quick check"}),e.jsx("span",{className:"ep-gr-refetch-mode-desc",children:"Only pull new reviews since last fetch (recommended)."})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":c==="full",className:`ep-gr-refetch-mode${c==="full"?" is-active":""}`,onClick:()=>d("full"),children:[e.jsx("span",{className:"ep-gr-refetch-mode-title",children:"Full refresh"}),e.jsx("span",{className:"ep-gr-refetch-mode-desc",children:"Wipe and re-pull. Surfaces edits and deleted reviews."})]})]}),c==="full"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ep-gr-refetch-presets",children:[Be.map(g=>e.jsx("button",{type:"button",className:`ep-gr-refetch-preset${n===String(g)?" is-active":""}`,onClick:()=>o(String(g)),children:g},g)),e.jsx("button",{type:"button",className:`ep-gr-refetch-preset${n==="all"?" is-active":""}`,onClick:()=>o("all"),children:"All"})]}),e.jsxs("div",{className:"ep-gr-refetch-custom",children:[e.jsx("input",{type:"text",inputMode:"numeric",value:n==="all"?"All":n,onChange:g=>{const N=g.target.value.replace(/[^0-9]/g,"");if(N===""){o("");return}o(String(Math.min(parseInt(N,10),w)))},onKeyDown:g=>{g.key==="Enter"&&f()},"aria-label":"Number of reviews to fetch"}),e.jsx("button",{type:"button",className:"button button-primary button-small",onClick:f,children:"Fetch"})]}),e.jsx("p",{className:"ep-gr-refetch-hint",children:"More reviews = longer fetch time."})]}),c==="quick"&&e.jsx("div",{className:"ep-gr-refetch-actions",children:e.jsx("button",{type:"button",className:"button button-primary button-small",onClick:f,children:"Check now"})})]})},B=10,We=({fetched:r,total:l,onClose:p})=>{const[c,d,n]=te(p),o=!A&&r>=B&&(!l||l>B);return e.jsxs("div",{className:`ep-gr-refetch-pop ep-gr-info-pop${d?" is-up":""}${n?"":" is-measuring"}`,ref:c,role:"dialog","aria-label":"About this count",children:[e.jsx("p",{className:"ep-gr-refetch-pop-title",children:"About this count"}),l>0?e.jsxs("p",{className:"ep-gr-info-pop-count",children:[e.jsx("strong",{children:r.toLocaleString()})," of ",l.toLocaleString()," reviews ready to show"]}):e.jsxs("p",{className:"ep-gr-info-pop-count",children:[e.jsx("strong",{children:r.toLocaleString()})," reviews ready to show"]}),!o&&l>r?e.jsx("p",{className:"ep-gr-info-pop-body",children:"Google may not make all reviews available for automated collection, so the number imported can be lower than the total shown on Google."}):null,A&&r>=K?e.jsxs("p",{className:"ep-gr-info-pop-body",children:["EmbedPress keeps up to ",e.jsx("strong",{children:K.toLocaleString()})," reviews per place."]}):null,o?e.jsxs("div",{className:"ep-gr-upsell ep-gr-info-pop-note",children:[e.jsxs("p",{className:"ep-gr-upsell-text",children:["Free shows up to ",e.jsx("strong",{children:B})," reviews for ",e.jsx("strong",{children:"1"})," place. Upgrade to Pro for ",e.jsx("strong",{children:"unlimited places"})," and up to ",e.jsx("strong",{children:"1,000"})," reviews each."]}),e.jsx("a",{className:"ep-gr-upsell-cta",href:$,target:"_blank",rel:"noopener noreferrer",children:"Upgrade to Pro →"})]}):e.jsxs("p",{className:"ep-gr-info-pop-note",children:["Use ",e.jsx("strong",{children:"Refetch"})," to pick up new or updated reviews."]})]})},ze=({placeName:r,onConfirm:l,onClose:p})=>{const[c,d,n]=te(p);return e.jsxs("div",{className:`ep-gr-refetch-pop ep-gr-confirm-pop${d?" is-up":""}${n?"":" is-measuring"}`,ref:c,role:"dialog","aria-label":"Confirm remove",children:[e.jsx("p",{className:"ep-gr-refetch-pop-title",children:"Remove this place?"}),e.jsxs("p",{className:"ep-gr-confirm-pop-body",children:[e.jsx("strong",{children:r})," and its cached reviews will be deleted from your library. You can re-add it anytime."]}),e.jsxs("div",{className:"ep-gr-confirm-pop-actions",children:[e.jsx("button",{type:"button",className:"button button-small",onClick:p,children:"Cancel"}),e.jsx("button",{type:"button",className:"button button-small button-primary ep-gr-confirm-pop-danger",onClick:l,children:"Remove"})]})]})},ue=["Connecting…","Opening Google Maps…","Finding the place…","Loading reviews…"],Ke=({fetched:r=0})=>{const[l,p]=a.useState(0),c=r<=0;a.useEffect(()=>{if(!c)return;const n=setInterval(()=>{p(o=>o<ue.length-1?o+1:o)},2200);return()=>clearInterval(n)},[c]);const d=c?ue[l]:"Fetching reviews…";return e.jsxs("span",{className:"ep-gr-pill ep-gr-pill--running",children:[e.jsx("span",{className:"ep-gr-spinner","aria-hidden":"true"}),e.jsx("span",{className:"ep-gr-running-text",children:d})]})},Ve=()=>{const[r,l]=a.useState([]),[p,c]=a.useState(!0),[d,n]=a.useState(""),[o,i]=a.useState([]),[h,m]=a.useState(!1),[w,f]=a.useState(!1),[g,N]=a.useState(null),[_,I]=a.useState(""),[y,S]=a.useState({text:"",tone:""}),[U,L]=a.useState(null),[M,t]=a.useState(null),[b,E]=a.useState(null),[R,D]=a.useState(null),[V,Y]=a.useState(""),[G,re]=a.useState(""),[xe,fe]=a.useState(!1),[H,ae]=a.useState(null),J=a.useRef(null),[je,ve,be]=Ge(o.length>0),F=(s,u)=>{S({text:s,tone:u}),setTimeout(()=>S({text:"",tone:""}),7e3)},q=a.useRef(!1),ne=a.useRef(0),W=a.useCallback(()=>{if(q.current)return;q.current=!0;const s=++ne.current;P("GET","/places").then(u=>{q.current=!1,s===ne.current&&(c(!1),u.ok&&Array.isArray(u.body.places)&&l(x=>{const j={};return x.forEach(v=>{j[v.place_id]=v}),u.body.places.map(v=>{const T=j[v.place_id],C=v.fetch_status==="running"||v.fetch_status==="queued";if(T&&C&&(T.fetch_status==="running"||T.fetch_status==="queued")){const Z=Math.max(v.fetched_so_far||0,T.fetched_so_far||0);return{...v,fetched_so_far:Z}}return v})}))}).catch(()=>{q.current=!1})},[]);a.useEffect(()=>{W()},[W]),a.useEffect(()=>{P("GET","/settings").then(s=>{s.ok&&fe(!!s.body.apify_token_configured)})},[]);const[Q,X]=a.useState(null);a.useEffect(()=>{const s=u=>{const x=!!(u.detail&&u.detail.connected);N(null),X(x)};return window.addEventListener("ep-gr-connection-changed",s),()=>window.removeEventListener("ep-gr-connection-changed",s)},[]);const le=r.some(s=>s.fetch_status==="running"||s.fetch_status==="queued");a.useEffect(()=>{if(!le)return;const s=setInterval(W,2e3);return()=>clearInterval(s)},[le,W]);const oe=a.useRef({});a.useEffect(()=>{if(!A)for(const u of r){const x=u.fetch_status==="running"||u.fetch_status==="queued";if(oe.current[u.place_id]&&!x&&u.last_fetched_at&&u.total&&(u.review_count||0)<u.total){E(u.place_id);break}}const s={};r.forEach(u=>{s[u.place_id]=u.fetch_status==="running"||u.fetch_status==="queued"}),oe.current=s},[r]);const O=a.useRef({token:"",mintedAt:0}),we=()=>{const s=Date.now();return(!O.current.token||s-O.current.mintedAt>Ie)&&(O.current={token:Ae(),mintedAt:s}),O.current.token},ye=()=>{O.current={token:"",mintedAt:0}};a.useEffect(()=>{if(clearTimeout(J.current),N(null),Q===!1){i([]),f(!1),m(!1);return}if(d.trim().length<3){i([]),f(!1);return}return m(!0),J.current=setTimeout(()=>{P("GET","/search",{q:d.trim(),session_token:we()}).then(s=>{m(!1),s.ok&&Array.isArray(s.body.predictions)?(X(!0),i(s.body.predictions),f(s.body.predictions.length===0)):s.body&&s.body.code==="embedpress_gr_not_connected"?(X(!1),i([]),f(!1)):(i([]),f(!1),N(s.body&&(s.body.message||s.body.code)||`Search failed (HTTP ${s.status}).`))}).catch(()=>{m(!1),i([]),f(!1),N("Network error — could not reach the server.")})},800),()=>clearTimeout(J.current)},[d,Q]);const ke=s=>{(x=>{if(navigator.clipboard&&navigator.clipboard.writeText)return navigator.clipboard.writeText(x);const j=document.createElement("textarea");return j.value=x,document.body.appendChild(j),j.select(),document.execCommand("copy"),document.body.removeChild(j),Promise.resolve()})(s).then(()=>{re(s),setTimeout(()=>re(x=>x===s?"":x),2e3)})},Ne=(s,u,x="",j={})=>{if(V)return;ye(),Y(s);const v={};j.total!=null&&Number(j.total)>0&&(v.total=Number(j.total)),j.rating!=null&&Number(j.rating)>0&&(v.rating=Number(j.rating)),P("POST","/places",null,{action:"add",place_id:s,place_name:u||"",place_address:x||"",...v}).then(T=>{if(Y(""),T.ok){l(T.body.places||[]),n(""),i([]),f(!1),N(null);const C=(T.body.places||[]).find(Z=>Z.place_id===s);!A&&C&&C.review_count>=B&&(!C.total||C.total>B)?(ae({place:C.place_name||"This place",fetched:C.review_count,total:C.total||0}),F("Place added.","success")):C&&C.total&&C.total>C.review_count?F(`Place added — showing ${C.review_count} of ${C.total} reviews. Refetch to pull more.`,"success"):F("Place added.","success")}else T.body&&T.body.code==="embedpress_gr_pro_required"?F(T.body.message||"Upgrade to EmbedPress Pro to add more places.","error"):F("Couldn’t add that place. Try again.","error")}).catch(()=>{Y(""),F("Couldn’t add that place. Try again.","error")})},_e=(s,{mode:u,count:x})=>{t(null),I(s);const j=x==="all"||x===""||!x;P("POST","/places",null,{action:"refetch",place_id:s,fetch_max:j?0:Number(x)||0,sort:"newest",mode:u==="full"?"full":"quick"}).then(v=>{I(""),v.ok?(l(v.body.places||[]),F(u==="quick"?"Checking for new reviews…":j?"Fetching all reviews in the background…":`Fetching up to ${x} reviews in the background…`,"info")):F(v.body&&v.body.message||"Couldn’t start the refetch. Try again.","error")})},Ce=s=>{D(null),I(s),P("POST","/places",null,{action:"remove",place_id:s}).then(u=>{I(""),u.ok?(l(u.body.places||[]),F("Place removed.","success")):F("Couldn’t remove that place.","error")})},Se=new Set(r.map(s=>s.place_id)),Ee=s=>s?new Date(s.replace(" ","T")).toLocaleString():"—",ie=!A&&r.length>=1;return e.jsxs("section",{className:"ep-gr-card",children:[e.jsxs("header",{className:"ep-gr-card-header",children:[e.jsx("span",{className:"ep-gr-step-badge",children:"2"}),e.jsxs("div",{className:"ep-gr-card-headtext",children:[e.jsx("h2",{children:"Add your places"}),e.jsxs("p",{children:["Search and save the Google Businesses you want to display. Reviews are stored on your site, so every block, widget, and shortcode reuses them — no repeat lookups. Hit ",e.jsx("strong",{children:"Refetch"})," anytime to pull the latest."]})]})]}),e.jsxs("div",{className:"ep-gr-card-body",children:[e.jsxs("div",{className:"ep-gr-field",children:[e.jsx("label",{htmlFor:"ep-gr-place-search",children:e.jsx("strong",{children:"Add a place"})}),e.jsx("input",{id:"ep-gr-place-search",type:"text",autoComplete:"off",placeholder:"e.g. Sydney Opera House",value:d,onChange:s=>n(s.target.value)}),Q===!1&&d.trim().length>0&&e.jsxs("p",{className:"ep-gr-inline-note ep-gr-inline-note--error",role:"alert",children:[e.jsx("strong",{children:"Connect to the EmbedPress API to search."})," ","Connect in ",e.jsx("strong",{children:"step 1"})," above, then search for a place to add."]}),h&&!g&&e.jsx("p",{className:"description",children:"Searching…"}),o.length>0&&e.jsxs("div",{ref:je,className:`ep-gr-suggestions-panel${ve?" is-up":""}${be?"":" is-measuring"}`,children:[e.jsx("ul",{className:"ep-gr-suggestions",children:o.map(s=>{const u=Se.has(s.place_id),x=ie&&!u,j=V===s.place_id,v=!!V;return e.jsx("li",{children:e.jsxs("button",{type:"button",className:`ep-gr-suggestion${x?" is-locked":""}${v?" is-adding-busy":""}`,disabled:v,"aria-busy":j,title:x?k("Adding more places needs EmbedPress Pro — click to upgrade.","embedpress"):void 0,onClick:()=>{if(!v){if(x){window.open($,"_blank","noopener");return}Ne(s.place_id,s.main_text||s.description,s.secondary_text||"",{total:s.review_count,rating:s.rating})}},children:[e.jsx(de,{}),e.jsxs("span",{className:"ep-gr-suggestion-body",children:[e.jsx("strong",{children:s.main_text||s.description}),s.secondary_text&&e.jsx("span",{children:s.secondary_text}),e.jsx(pe,{rating:s.rating,count:s.review_count})]}),j?e.jsxs("em",{className:"ep-gr-suggestion-add ep-gr-suggestion-add--loading",children:[e.jsx("span",{className:"ep-gr-spinner","aria-hidden":"true"})," ",k("Adding…","embedpress")]}):u?e.jsx("em",{className:"ep-gr-already",children:k("already added","embedpress")}):x?e.jsxs("em",{className:"ep-gr-suggestion-pro",children:[e.jsx(se,{})," ",k("Upgrade to add","embedpress")]}):e.jsxs("em",{className:"ep-gr-suggestion-add",children:["+ ",k("Add","embedpress")]})]})},s.place_id)})}),ie&&e.jsxs("p",{className:"ep-gr-inline-note ep-gr-inline-note--muted ep-gr-suggestions-note",children:[k("You’ve added your 1 free place.","embedpress")," ",e.jsx("a",{href:$,target:"_blank",rel:"noopener noreferrer",children:k("Go Pro","embedpress")})," ",k("to show reviews from multiple businesses at once.","embedpress")]})]}),!h&&w&&!g&&e.jsxs("p",{className:"ep-gr-inline-note ep-gr-inline-note--muted",children:["No matches for “",d.trim(),"”. Try a different spelling or include the city."]}),g&&e.jsxs("p",{className:"ep-gr-inline-note ep-gr-inline-note--error",role:"alert",children:[e.jsx("strong",{children:"Search failed:"})," ",g,/missing|api[_ ]?key|not configured|no_key|not connected/i.test(g)&&e.jsxs(e.Fragment,{children:[" "," ","Connect a provider in ",e.jsx("strong",{children:"step 1"})," above before searching."]})]})]}),H&&!A&&e.jsxs("div",{className:"ep-gr-upsell-banner",role:"status",children:[e.jsx("span",{className:"ep-gr-upsell-crown","aria-hidden":"true",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M3 7l4 4 5-6 5 6 4-4v10H3V7z"})})}),e.jsxs("div",{className:"ep-gr-upsell-banner-body",children:[e.jsx("strong",{children:"You’re on the free plan."})," ",H.place," shows"," ",H.total?e.jsxs(e.Fragment,{children:[H.fetched," of ",H.total," reviews"]}):e.jsxs(e.Fragment,{children:["up to ",H.fetched," reviews"]}),"."," ","Upgrade to Pro for ",e.jsx("strong",{children:"unlimited places"})," and up to"," ",e.jsx("strong",{children:"1,000"})," reviews each."]}),e.jsx("a",{className:"ep-gr-upsell-banner-cta",href:$,target:"_blank",rel:"noopener noreferrer",children:"Upgrade to Pro →"}),e.jsx("button",{type:"button",className:"ep-gr-upsell-banner-x","aria-label":"Dismiss",onClick:()=>ae(null),children:"×"})]}),p?e.jsxs("table",{className:"ep-gr-places-table ep-gr-places-table--skeleton","aria-hidden":"true",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"ep-gr-col-place",children:"Place"}),e.jsx("th",{className:"ep-gr-col-num",children:"Reviews"}),e.jsx("th",{className:"ep-gr-col-num",children:"Rating"}),e.jsx("th",{className:"ep-gr-col-status",children:"Last fetched"}),e.jsx("th",{className:"ep-gr-col-actions"})]})}),e.jsx("tbody",{children:[0,1,2].map(s=>e.jsxs("tr",{children:[e.jsxs("td",{className:"ep-gr-col-place",children:[e.jsx("span",{className:"ep-gr-skel ep-gr-skel--title"}),e.jsx("span",{className:"ep-gr-skel ep-gr-skel--sub"})]}),e.jsx("td",{className:"ep-gr-col-num",children:e.jsx("span",{className:"ep-gr-skel ep-gr-skel--num"})}),e.jsx("td",{className:"ep-gr-col-num",children:e.jsx("span",{className:"ep-gr-skel ep-gr-skel--num"})}),e.jsx("td",{children:e.jsx("span",{className:"ep-gr-skel ep-gr-skel--text"})}),e.jsx("td",{className:"ep-gr-col-actions",children:e.jsx("span",{className:"ep-gr-skel ep-gr-skel--btn"})})]},s))})]}):r.length===0?e.jsxs("div",{className:"ep-gr-places-empty",children:[e.jsx("p",{children:"No places saved yet."}),e.jsx("p",{className:"description",children:"Search above to add a Google Business, then Refetch it to load its reviews."})]}):e.jsxs("table",{className:"ep-gr-places-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"ep-gr-col-place",children:"Place"}),e.jsx("th",{className:"ep-gr-col-num",children:"Reviews"}),e.jsx("th",{className:"ep-gr-col-num",children:"Rating"}),e.jsx("th",{className:"ep-gr-col-status",children:"Last fetched"}),e.jsx("th",{className:"ep-gr-col-actions"})]})}),e.jsx("tbody",{children:r.map(s=>{const u=s.fetch_status==="running"||s.fetch_status==="queued",x=s.fetch_status==="failed";return e.jsxs("tr",{className:u?"is-running":"",children:[e.jsx("td",{className:"ep-gr-col-place",children:e.jsxs("span",{className:"ep-gr-place-cell",children:[e.jsx(de,{}),e.jsxs("span",{className:"ep-gr-place-cell-body",children:[e.jsxs("span",{className:"ep-gr-place-title",children:[e.jsx("strong",{children:s.place_name||ee(s.place_id)}),e.jsx("button",{type:"button",className:`ep-gr-copy-id${G===s.place_id?" is-copied":""}`,onClick:()=>ke(s.place_id),"aria-label":G===s.place_id?k("Place ID copied","embedpress"):k("Copy Place ID","embedpress"),"data-tip":G===s.place_id?k("Place ID copied!","embedpress"):`${k("Copy Place ID","embedpress")} · ${ee(s.place_id)}`,children:G===s.place_id?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),s.address&&e.jsx("span",{className:"ep-gr-place-address",children:s.address}),e.jsx(pe,{rating:s.rating||null,count:s.total||(s.review_count!=null?s.review_count:null)})]})]})}),e.jsx("td",{className:"ep-gr-col-num",children:u&&s.fetched_so_far?e.jsx("b",{className:"ep-gr-count-live",children:s.fetched_so_far}):s.last_fetched_at||s.review_count?e.jsxs("span",{className:"ep-gr-count-wrap",children:[e.jsx("b",{children:s.review_count}),s.total&&s.review_count<s.total&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"ep-gr-info-btn","aria-label":"About this count",title:"About this count",onClick:()=>E(b===s.place_id?null:s.place_id),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M12 11v5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"8",r:"1.2",fill:"currentColor"})]})}),b===s.place_id&&e.jsx(We,{fetched:s.review_count,total:s.total||0,onClose:()=>E(null)})]})]}):e.jsx("span",{className:"ep-gr-muted",children:"—"})}),e.jsx("td",{className:"ep-gr-col-num",children:s.rating?e.jsxs("span",{className:"ep-gr-rating",children:[s.rating,"�
3 "]}):e.jsx("span",{className:"ep-gr-muted",children:""})}),e.jsx("td",{className:"ep-gr-col-status",children:u?e.jsx(Ke,{fetched:s.fetched_so_far||0}):x?e.jsx("span",{className:"ep-gr-pill ep-gr-pill--error",title:s.fetch_message||"",children:"Failed"}):s.last_fetched_at?e.jsx("span",{className:"ep-gr-fetched-at",children:Ee(s.last_fetched_at)}):e.jsx("span",{className:"ep-gr-muted",children:"Not fetched yet"})}),e.jsx("td",{className:"ep-gr-col-actions",children:e.jsxs("div",{className:"ep-gr-actions-row",children:[e.jsx("button",{type:"button",className:"ep-gr-icon-btn",title:s.last_fetched_at?"Get shortcode":"Refetch this place first to load reviews","aria-label":"Get shortcode",disabled:!s.last_fetched_at||u,onClick:()=>L(s),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("polyline",{points:"8 7 3 12 8 17"}),e.jsx("polyline",{points:"16 7 21 12 16 17"})]})}),e.jsxs("span",{className:"ep-gr-refetch-wrap",children:[e.jsx("button",{type:"button",className:`button button-small${_===s.place_id?" is-loading":""}`,disabled:_===s.place_id||u,"aria-haspopup":"dialog","aria-expanded":M===s.place_id,onClick:()=>t(M===s.place_id?null:s.place_id),children:_===s.place_id?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ep-gr-spinner","aria-hidden":"true"}),"Starting"]}):"Refetch"}),M===s.place_id&&e.jsx(qe,{total:s.total||s.review_count||0,onConfirm:j=>_e(s.place_id,j),onClose:()=>t(null)})]}),e.jsxs("span",{className:"ep-gr-refetch-wrap",children:[e.jsx("button",{type:"button",className:"button button-small button-link-delete",disabled:_===s.place_id,"aria-haspopup":"dialog","aria-expanded":R===s.place_id,onClick:()=>D(R===s.place_id?null:s.place_id),children:"Remove"}),R===s.place_id&&e.jsx(ze,{placeName:s.place_name||s.place_id,onConfirm:()=>Ce(s.place_id),onClose:()=>D(null)})]})]})})]},s.place_id)})})]}),y.text&&e.jsx("span",{className:`ep-gr-status ep-gr-status--${y.tone}`,"aria-live":"polite",children:y.text})]}),U&&e.jsx(Oe,{place:U,apifyConnected:xe,onClose:()=>L(null)})]})},Ye=()=>e.jsxs("div",{className:"ep-gr-app",children:[e.jsxs("header",{className:"ep-gr-page-title",children:[e.jsxs("div",{className:"ep-gr-page-title-main",children:[e.jsx("h1",{children:"Google Reviews"}),e.jsx("p",{children:"Embed Google Business reviews on any page, post, or page-builder widgetsearch a place, pick your options, and copy the shortcode."})]}),e.jsxs("a",{className:"ep-gr-doc-link",href:"https://embedpress.com/docs/embed-google-reviews-in-wordpress/",target:"_blank",rel:"noopener noreferrer",children:["Read the documentation",e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M7 17 17 7M7 7h10v10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),e.jsxs("div",{className:"ep-gr-stack",children:[e.jsx($e,{}),e.jsx(Ve,{})]})]}),he=document.getElementById("embedpress-google-reviews-root");he&&Pe(he).render(e.jsx(Ye,{}));
4