"use strict";(globalThis.webpackChunk_affine_web=globalThis.webpackChunk_affine_web||[]).push([[9007],{99029:(e,n,t)=>{t.d(n,{k:()=>p,J:()=>u});var a=t(36870),s=t(63234),r=t(24312),i=t(37064),l=t(86326),o="t5nkbg2",c="t5nkbg0";let m=({to:e,okText:n,cancelText:t,onCancel:r,onConfirm:l})=>(0,a.jsxs)("div",{className:"t5nkbg1",children:[(0,a.jsx)(s.$n,{className:(0,i.A)(o,"t5nkbg4"),size:"default",onClick:r,variant:"plain",children:t}),(0,a.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",children:(0,a.jsx)(s.$n,{onClick:l,className:(0,i.A)(o,"t5nkbg3"),variant:"plain",children:n})})]}),d=environment.isDesktop,u=()=>{let e=(0,r.s9)(),n=(0,l.useRef)(null);return(0,l.useCallback)(t=>{n.current&&s.me.dismiss(n.current);let r=(0,s.me)({title:(0,a.jsx)("span",{className:c,children:e["com.arms.payment.upgrade-success-notify.title"]()}),message:e["com.arms.payment.upgrade-success-notify.content"](),alignMessage:"title",icon:null,footer:(0,a.jsx)(m,{to:t,okText:d?e["com.arms.payment.upgrade-success-notify.ok-client"]():e["com.arms.payment.upgrade-success-notify.ok-web"](),cancelText:e["com.arms.payment.upgrade-success-notify.later"](),onCancel:()=>s.me.dismiss(r),onConfirm:()=>s.me.dismiss(r)})},{duration:864e5});n.current=r},[e])},p=()=>{let e=(0,r.s9)(),n=(0,l.useRef)(null);return(0,l.useCallback)(t=>{n.current&&s.me.dismiss(n.current);let r=(0,s.me)({title:(0,a.jsx)("span",{className:c,children:e["com.arms.payment.downgraded-notify.title"]()}),message:e["com.arms.payment.downgraded-notify.content"](),alignMessage:"title",icon:null,footer:(0,a.jsx)(m,{to:t,okText:d?e["com.arms.payment.downgraded-notify.ok-client"]():e["com.arms.payment.downgraded-notify.ok-web"](),cancelText:e["com.arms.payment.downgraded-notify.later"](),onCancel:()=>s.me.dismiss(r),onConfirm:()=>s.me.dismiss(r)})},{duration:864e5});n.current=r},[e])}},29007:(e,n,t)=>{t.d(n,{Pc:()=>p,e6:()=>f,ed:()=>u,f2:()=>k,tp:()=>y});var a=t(99029),s=t(94002),r=t(53216),i=t(30397),l=t(86326),o=t(4194);let c=(0,i.Ak)(),m="subscription-succeed-info",d=(e,n)=>{let t=(Array.isArray(n.plan)?n.plan:[n.plan]).map(e=>e===r.R$.AI?"ai":"cloud").join("-"),a=n.recurring===r.zS.Monthly?"monthly":n.recurring===r.zS.Lifetime?"lifeTime":"annually";return`https://6dxre9ihosp.typeform.com/to/${e}#email=${n.email??""}&name=${n.name??"Unknown"}&user_id=${n.id}&product_id=${t}&product_price=${a}`},u=e=>d("mUMGGQS8",e),p=e=>d("RvD9AoRg",e),f=(e,n,t)=>{if(null===e)throw Error("Account is required");let a=n===r.R$.AI?"/ai-upgrade-success":"/upgrade-success",s=e?.info?.name??"";s.includes("::")&&(s=s.replaceAll("::",c));let i=[n,t,e.id,e.email,e.info?.name??""].join("::");return`${a}?info=${encodeURIComponent(i)}`},g=e=>{let[n,t,a,s,r]=decodeURIComponent(e).split("::");return{plan:n,recurring:t,account:{id:a,email:s,info:{name:r.replaceAll(c,"::")}}}},k=()=>{let[e]=(0,o.ok)();(0,l.useEffect)(()=>{let n=e.get("info");n&&(localStorage.setItem(m,n),e.delete("info"))},[e])},y=()=>{let e=(0,a.J)(),n=(0,l.useCallback)(()=>{let n=localStorage.getItem(m);if(n)try{let{plan:t,recurring:a,account:r}=g(n),i=u({id:r.id,email:r.email,name:r.info?.name??"",plan:t,recurring:a});e(i),localStorage.removeItem(m),s.u4.$.settingsPanel.plans.subscribe({plan:t,recurring:a})}catch(e){console.error("Failed to parse subscription callback link",e)}},[e]);(0,l.useEffect)(()=>(n(),window.addEventListener("focus",n),()=>{window.removeEventListener("focus",n)}),[n])}}}]); //# sourceMappingURL=chunk.9007.937c29d4.js.map