文件操作 - extendify-shared-a0f4a4fcde46bba78e82.js
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/extendify/public/build/extendify-shared-a0f4a4fcde46bba78e82.js
编辑文件内容
"use strict";(globalThis.webpackChunkextendify=globalThis.webpackChunkextendify||[]).push([[355],{6374(e,t,a){var s=a(8490),n=a.n(s),i=a(7723),r=a(8971),o=a(6427),c=a(6087),l=a(2023),d=a(790);const m=({children:e,title:t,onClose:a,anchor:s})=>{const[n,m]=(0,c.useState)(!1),[u,x]=(0,c.useState)(0),[p,h]=(0,c.useState)(0),g=()=>{m(!1),a?.()};if((0,c.useLayoutEffect)(()=>{if(!s||!n)return;const e=s.style.outline;s.style.outline="99999px solid rgba(0, 0, 0, 0.4)";const t=s.getBoundingClientRect(),a=t.left+t.width/2,i=t.top+t.height;return x(a),h(i),()=>{s.style.outline=e}},[s,n]),(0,c.useEffect)(()=>{m(!0)},[u,p]),n)return(0,d.jsx)(r.lG,{static:!0,className:"extendify-shared",open:n,onClose:g,children:(0,d.jsxs)("div",{className:"relative z-max",children:[(0,d.jsx)("div",{onClick:g,"aria-hidden":!0,role:"presentation",className:"fixed inset-0 z-10 h-screen w-screen bg-transparent"}),(0,d.jsxs)("div",{className:"fixed z-20 flex min-w-80 max-w-xs flex-col bg-transparent shadow-2xl",style:{top:`${p+12}px`,left:`${u}px`,transform:"translate(-50%, 0)"},children:[(0,d.jsx)("div",{className:"absolute left-1/2 top-[-12px] h-0 w-0 -translate-x-1/2 transform border-b-[12px] border-l-[8px] border-r-[8px] border-transparent border-b-white"}),(0,d.jsx)("button",{type:"button","data-test":"close-tooltip",className:"absolute right-0 top-0 z-20 m-2 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full border-0 bg-white p-0 leading-none outline-hidden ring-1 ring-gray-200 focus:shadow-none focus:ring-wp focus:ring-design-main rtl:left-0 rtl:right-auto",onClick:g,"aria-label":(0,i.__)("Close ToolTip","extendify-local"),children:(0,d.jsx)(o.Icon,{icon:l.A,className:"h-4 w-4 fill-current"})}),(0,d.jsx)(r.L3,{className:"sr-only",children:t}),(0,d.jsx)("div",{className:"text-base relative m-0 bg-white p-6 pt-8 text-left font-sans leading-7 text-gray-900 rtl:text-right",children:e})]})]})})},u=()=>(0,d.jsx)(m,{title:(0,i.__)("Tooltip pointing to the edit page button","extendify-local"),anchor:document.querySelector("#wp-admin-bar-edit"),children:(0,i.__)("Welcome to your new site! When you're ready, press here to edit this page.","extendify-local")});var x=a(1455),p=a.n(x);const h=/^(?:\/)?(?:wp|extendify)\/v\d+(?:\/|$|\?)/i;p().use((e,t)=>h.test(e.path)?t({...e,headers:{...e?.headers,"X-Extendify":"true"}}):t(e));var g=a(3832);const f=async({slug:e,email:t,marketingConsent:a,termsAgreed:s,signal:n,scriptData:i})=>{await p()({path:`extendify/v1/${e}/create-account`,method:"POST",data:{email:t,marketingConsent:a,termsAgreed:s,...i},signal:n})},w={simplybook:{idempotent:!1,createAccountCallback:async({scriptData:e,email:t,marketingConsent:a,termsAgreed:s,signal:n})=>{const i=await(r=e?.recaptchaAction,o=e?.recaptchaSiteKey,new Promise((e,t)=>{const a=()=>window.grecaptcha.enterprise.ready(async()=>{try{e(await window.grecaptcha.enterprise.execute(o,{action:r}))}catch(e){t(e)}});if(document.querySelector('script[src*="recaptcha/enterprise"]'))return void a();const s=document.createElement("script");s.src=`https://www.google.com/recaptcha/enterprise.js?render=${o}`,s.async=!0,s.onload=a,document.head.appendChild(s)}));var r,o;const c=(0,g.addQueryArgs)(`${window.extSharedData.homeUrl}/`,{rest_route:"/extendify/v1/simplybook/create-account"});await p()({url:c,method:"POST",data:{email:t,marketingConsent:a,termsAgreed:s,captcha_token:i},signal:n})}},"translatepress-multilingual":{createAccountCallback:e=>f({slug:"translatepress-multilingual",...e})},imagify:{createAccountCallback:e=>f({slug:"imagify",...e})}};var y=a(9124);const b=()=>(0,d.jsxs)("div",{className:"py-10 px-16 flex flex-col items-center justify-center",children:[(0,d.jsx)("div",{className:"mb-6",children:(0,d.jsx)(o.Spinner,{className:"h-10 w-10 text-[#1A5130]"})}),(0,d.jsx)(r.L3,{className:"text-xl font-semibold text-center text-gray-900 mb-3 font-sans",children:(0,i.__)("Setting up plugins for you...","extendify-local")}),(0,d.jsx)(y.VY,{className:"text-center text-gray-700 text-base",children:(0,i.__)("Please wait while we install your plugins and create accounts with the selected providers. This should only take a moment.","extendify-local")})]});var v=a(319),j=a(6963);const k=()=>(0,d.jsx)(d.Fragment,{children:(0,d.jsx)("div",{className:"p-2 rounded-full bg-[#4AB866]/25",children:(0,d.jsx)(v.A,{icon:j.A,className:"h-10 w-10 rounded-full bg-[#4AB866] fill-white"})})}),C=({handleClose:e})=>(0,d.jsxs)("div",{className:"px-16 py-10 flex flex-col items-center justify-center",children:[(0,d.jsx)("div",{className:"mb-6",children:(0,d.jsx)(k,{})}),(0,d.jsx)(r.L3,{className:"text-xl font-semibold text-center text-gray-900 mb-2 font-sans",children:(0,i.__)("Setup complete","extendify-local")}),(0,d.jsx)("p",{className:"text-center text-gray-700 mb-2 text-base",children:(0,i.__)("Your plugin accounts have been set up. Account activation may take a moment to complete.","extendify-local")}),(0,d.jsx)("button",{type:"button",onClick:e,className:"mt-6 px-6 py-3 text-base font-medium text-white bg-extendify-main rounded-lg hover:bg-extendify-main-dark focus:outline-none focus:ring-2 focus:ring-extendify-main focus:ring-offset-2",children:(0,i.__)("Close","extendify-local")})]});var A=a(4611),N=a(540),S=a(2912),_=a(2344),D=a(5367),T=a(6942),E=a.n(T);const P=({plugins:e,setPlugins:t,handleCreateAccounts:a,email:s,setEmail:n,handleClose:o,marketingConsent:c,setMarketingConsent:l,termsAgreed:m,setTermsAgreed:u})=>{const x=(0,g.isEmail)(s)&&m&&e?.some(e=>e.selected);return(0,d.jsxs)("div",{className:"py-10 px-16",children:[(0,d.jsx)(r.L3,{className:"text-2xl font-semibold text-center text-gray-900 mb-10 font-sans",children:(0,i.__)("Almost done! Let's finish setting up your plugins","extendify-local")}),(0,d.jsx)("div",{className:"space-y-3 mb-8",children:e?.map(a=>{const s=a.selected;return(0,d.jsxs)("div",{className:E()("w-full flex items-center gap-4 p-4 rounded-lg border-2 text-left transition-colors",s?"border-[#1A5130] bg-[#1A5130]/5":"border-gray-300 bg-white hover:border-gray-400"),children:[(0,d.jsx)("div",{className:"shrink-0 self-baseline",children:(0,d.jsx)("img",{alt:"",src:a.image,className:"w-8 h-8 rounded-full"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"font-semibold text-gray-900 mb-1",children:a.title}),(0,d.jsxs)("div",{className:"text-sm text-gray-700",children:[a.description," ",a.termOfServiceLink&&(0,d.jsxs)("a",{href:a.termOfServiceLink,onClick:e=>e.stopPropagation(),target:"_blank",rel:"noopener noreferrer",className:"text-gray-900 underline hover:underline",children:[(0,i.__)("Term of Service","extendify-local"),(0,d.jsx)(v.A,{icon:_.A,size:18,className:"ml-0.5 inline"})]})]})]}),(0,d.jsx)(v.A,{icon:j.A,onClick:()=>{return s=a.title,void t(e?.map(e=>e.title!==s?e:{...e,selected:!e?.selected}));var s},className:E()("shrink-0 rounded-full transition-colors cursor-pointer",s?"bg-[#1A5130] fill-white":"bg-gray-200 fill-transparent")})]},a.title)})}),(0,d.jsxs)(A.D,{className:"mb-8",children:[(0,d.jsx)(N.JU,{className:"block text-sm font-medium text-gray-900 mb-2",children:(0,i.__)("Email address","extendify-local")}),(0,d.jsx)(S.p,{required:!0,type:"email",value:s,onChange:e=>n(e.target.value),placeholder:"admin@example.com",className:"text-gray-900 w-full px-4 py-3 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-extendify-main focus:border-transparent"}),(0,d.jsx)(y.VY,{className:"mt-2 text-xss text-gray-700",children:(0,i.__)("This email will be used to create accounts with the selected plugin providers. Form protected by reCAPTCHA.","extendify-local")})]}),(0,d.jsxs)("label",{className:"flex items-start gap-3 mb-4 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:m,onChange:e=>u(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 rounded border-gray-300 accent-extendify-main focus:ring-extendify-main scheme-light"}),(0,d.jsx)("span",{className:"text-xs/relaxed text-gray-700",children:(0,i.__)("I agree to create accounts with the selected providers using my email address, and to their applicable Terms of Service.","extendify-local")})]}),(0,d.jsxs)("label",{className:"flex items-start gap-3 mb-8 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:c,onChange:e=>l(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 rounded border-gray-300 accent-extendify-main focus:ring-extendify-main scheme-light"}),(0,d.jsx)("span",{className:"text-xs/relaxed text-gray-700",children:(0,i.__)("I wish to receive communications about news and/or promotions from selected providers.","extendify-local")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-4",children:[(0,d.jsx)("button",{type:"button",onClick:()=>o(),className:"px-6 py-3 text-base font-medium text-gray-900 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-extendify-main",children:(0,i.__)("No thanks","extendify-local")}),(0,d.jsxs)("button",{type:"button",onClick:a,disabled:!x,className:E()("ml-auto px-6 py-3 text-base font-medium text-white bg-extendify-main rounded-lg hover:bg-extendify-main-dark focus:outline-none focus:ring-2 focus:ring-extendify-main focus:ring-offset-2 flex items-center gap-2",{"cursor-not-allowed opacity-50":!x}),children:[(0,i.__)("Create accounts","extendify-local"),(0,d.jsx)(v.A,{size:22,icon:D.A,className:"fill-white"})]})]})]})};var I=a(8969),L=a(4225);const R=async e=>{const t=new URLSearchParams(e.map(e=>["plugins",e]));return t.append("siteId",window.extSharedData.siteId),t.append("partnerId",window.extSharedData.partnerId),(await fetch(`${I.AY}/api/plugins/activate?${t}`)).json()};const $=()=>{const[e,t]=(0,c.useState)(!0),[a,s]=(0,c.useState)(!1),[n,i]=(0,c.useState)(!1),[o,l]=(0,c.useState)((window.extSharedData?.showProductActivation??[]).map(e=>({...e,selected:!0,createAccountCallback:w[e.slug]?.createAccountCallback??null,idempotent:w[e.slug]?.idempotent??!0})).filter(e=>e.createAccountCallback)),[m,u]=(0,c.useState)(window.extSharedData?.userEmail??""),[x,p]=(0,c.useState)(!1),[h,f]=(0,c.useState)(!1),{scriptData:y,activatePlugins:v}=(e=>{const t=e.map(e=>e.slug),{data:a,isLoading:s,error:n}=(0,L.A)(t,R),{activationId:i,...r}=a??{},o=e.filter(e=>e.selected).map(e=>e.slug);return{scriptData:r,activatePlugins:({status:e,context:t})=>(async({activationId:e,selectedPlugins:t,status:a,context:s})=>{await fetch(`${I.AY}/api/plugins/activate`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({activationId:e,selectedPlugins:t,status:a,context:s})})})({activationId:i,selectedPlugins:o,status:e,context:t}),loading:s,error:n}})(o);return(0,c.useEffect)(()=>{const e=document.createElement("style");e.textContent=".grecaptcha-badge { visibility: hidden; }",document.head.appendChild(e)},[]),o?.length&&(0,d.jsxs)(r.lG,{open:e,onClose:()=>{},className:"relative z-high extendify-shared",children:[(0,d.jsx)(r.Xi,{transition:!0,className:"fixed inset-0 bg-black/30 transition-opacity data-closed:opacity-0"}),(0,d.jsx)("div",{className:"z-10 fixed inset-0 flex w-screen items-center justify-center p-4 [body:has(#extendify-agent-chat)_&]:ml-96 [body:has(#extendify-agent-chat)_&]:w-[calc(100%-24rem)]",children:(0,d.jsxs)(r.Lj,{transition:!0,className:"relative w-full max-w-208 bg-white rounded-lg shadow-xl transition-all data-closed:opacity-0 data-closed:scale-95",children:[!n&&!a&&(0,d.jsx)(P,{plugins:o,setPlugins:l,handleCreateAccounts:async()=>{if(!(0,g.isEmail)(m))return;s(!0);const e=o?.filter(e=>e.selected)??[],t=await Promise.allSettled(e.map(e=>async function(e,t){if(!e?.idempotent){const a=AbortSignal.timeout(1e4),s=Date.now();try{return await e.createAccountCallback({...t,signal:a}),{requestTimeInMs:[Date.now()-s],retries:0,errors:[]}}catch(e){const t=new Error("Single attempt failed");throw t.requestTimeInMs=[Date.now()-s],t.retries=0,t.errors=e?.message?[e.message]:[],t}}return async function(e,{email:t,marketingConsent:a,termsAgreed:s,scriptData:n}){const i=1e4,r=Date.now(),o=[],c=[];let l=0;for(;Date.now()-r<i&&l<5;){const d=Date.now(),m=AbortSignal.timeout(5e3);try{return await e.createAccountCallback({email:t,marketingConsent:a,termsAgreed:s,scriptData:n,signal:m}),o.push(Date.now()-d),{requestTimeInMs:o,retries:l,errors:c}}catch(e){o.push(Date.now()-d),e?.message&&c.push(e.message);const t=m.aborted,a=i-(Date.now()-r);if(a<=0)break;l++,!t&&a>=2500&&await new Promise(e=>setTimeout(e,2500))}}const d=new Error("Retry window of 10000ms exceeded");throw d.requestTimeInMs=o,d.retries=l,d.errors=c,d}(e,t)}(e,{email:m,marketingConsent:x,termsAgreed:h,scriptData:y?.[e.slug]}))),a=Object.fromEntries(e.map((e,a)=>{const s=t[a],{requestTimeInMs:n,retries:i,errors:r}="fulfilled"===s.status?s.value:s.reason,o={status:"fulfilled"===s.status?"success":"error",requestTimeInMs:n,endpoint:`extendify/v1/${e.slug}/create-account`,retries:i,...r.length>0&&{errors:r}};return[e.slug,o]}));await v({status:"completed",context:a}),i(!0),s(!1)},email:m,setEmail:u,handleClose:()=>{v({status:"skipped"}),t(!1)},marketingConsent:x,setMarketingConsent:p,termsAgreed:h,setTermsAgreed:f}),!n&&a&&(0,d.jsx)(b,{}),n&&(0,d.jsx)(C,{handleClose:()=>t(!1)})]})})]})};var q=a(7828),O=a(9358);const M=window.extSharedData.showAIAgents;n()(()=>{if((()=>{const e=new URLSearchParams(window.location.search).get("page");return"extendify-launch"===e||"extendify-auto-launch"===e})())return;(0,O.E)();const e=new URLSearchParams(window.location.search);if(!e.has("extendify-launch-success"))return;if(window.extSharedData?.showProductActivation?.length){const e=Object.assign(document.createElement("div"),{id:"extendify-product-activation-container"});document.body.appendChild(e),(0,q.X)((0,d.jsx)($,{}),e)}const t=new URL(window.location.href);e.delete("extendify-launch-success");const a=`${t.origin}${t.pathname}`;if(window.history.replaceState({},"",a),requestAnimationFrame(()=>{requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("extendify-launch-success")),window.dispatchEvent(new CustomEvent("extendify-agent:open"))})}),M)return;const s=new URL(window.extSharedData.homeUrl);if(t.origin!==s.origin||t.pathname!==s.pathname)return;const n=Object.assign(document.createElement("div"),{id:"extendify-edit-page-modal-tooltip"});document.body.appendChild(n),(0,q.X)((0,d.jsx)(u,{}),n)})},1609(e){e.exports=window.React},5795(e){e.exports=window.ReactDOM},790(e){e.exports=window.ReactJSXRuntime},1455(e){e.exports=window.wp.apiFetch},6427(e){e.exports=window.wp.components},8490(e){e.exports=window.wp.domReady},6087(e){e.exports=window.wp.element},7723(e){e.exports=window.wp.i18n},5573(e){e.exports=window.wp.primitives},3832(e){e.exports=window.wp.url}},e=>{e.O(0,[65,223],()=>e(e.s=6374)),e.O()}]);
修改文件时间
将文件时间修改为当前时间的前一年
删除文件