PageSourceSearch

https://aiagentstore.ai/_next/static/chunks/pages/agency-subscribe-ef085b6ccb2a6562.js

js aiagentstore.ai collected 2026-10-03 23:11:21 UTC 18,668 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1016,5046],{18989:(e,t,a)=>{"use strict";a.d(t,{E5:()=>o,_m:()=>m,gi:()=>c,ih:()=>u,od:()=>l,pP:()=>d});let n="true"===String("true").trim().toLowerCase(),r=String("+1 (332) 232-2900").trim(),i=String("+13322322900").trim(),s=i||r.replace(/[^\d+]/g,""),l=n,o=n?r:"",c=n?i:"",d=n&&s?`tel:${s}`:"",u=!!(n&&r&&s),m="AI Opportunity Assessment"},24375:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>g});var n=a(69519),r=a(16879),i=a(11695),s=a(81829),l=a(47530),o=a(63889),c=a(95090),d=a(49605),u=a(970);a(21479);var m=a(86633),p=a(40601),h=a.n(p),b=a(40896);let g=function(){let[e,t]=(0,r.useState)(null),[a,p]=(0,r.useState)(void 0),[g,y]=(0,r.useState)(50),[x,f]=(0,r.useState)("50"),[_,N]=(0,r.useState)(null),[v,w]=(0,r.useState)(null),[j,S]=(0,r.useState)(!1),[k,I]=(0,r.useState)(""),[A,B]=(0,r.useState)(""),[E,C]=(0,r.useState)(""),[T,P]=(0,r.useState)(!1),[D,O]=(0,r.useState)(null),[F,$]=(0,r.useState)(""),[L,Y]=(0,r.useState)(!1),[z,V]=(0,r.useState)(!1),[U,K]=(0,r.useState)(!0),[M,H]=(0,r.useState)(""),[J,G]=(0,r.useState)(""),[W,X]=(0,r.useState)(!1),[q,Q]=(0,r.useState)(!1),[R,Z]=(0,r.useState)(""),ee=(0,m.getAnalytics)();async function et(e){S(!0);try{let t=(0,i.query)((0,i.collection)(l.db,"publicAgencyBids"),(0,i.where)("monthlyPayment",">=",e<50?50:e)),a=await (0,i.getDocs)(t),n=D&&_===ei?a.size:a.size+1;w(n)}catch(e){console.error(e),w(null)}finally{S(!1)}}(0,r.useEffect)(()=>{let e=s.auth.onAuthStateChanged(e=>{t(e||null)});return()=>e()},[]),(0,r.useEffect)(()=>{if(!e)return void p(void 0);(async()=>{try{let t=await (0,i.getDoc)((0,i.doc)(l.db,"agencies",e.uid));t.exists()?p(t.data()):p(null)}catch(e){p(null)}})()},[e]),(0,r.useEffect)(()=>{if(!e)return void $("Finalize Your Agency Subscription");(async()=>{try{let t=(0,i.doc)(l.db,"agencyBids",e.uid),a=await (0,i.getDoc)(t);if(a.exists()){let e=a.data();e.monthlyPayment&&(y(e.monthlyPayment),f(e.monthlyPayment.toString()),N(e.monthlyPayment)),e.subscriptionId?(O(e.subscriptionId),$("Manage Your Agency Subscription")):$("Finalize Your Agency Subscription"),e.needsCompanyInfo?(H(e.companyName||""),G(e.VATNumber||""),K(!0)):K(!1)}else $("Finalize Your Agency Subscription");let n=(0,i.doc)(l.db,"agencies",e.uid),r=await (0,i.getDoc)(n);if(r.exists()){let e=r.data();Y(e.doubleForDirectLink||!1),V(e.doubleForDirectLink||!1),!M&&e.agencyName&&H(e.agencyName)}else Y(!1),V(!1)}catch(e){console.error("Error loading documents:",e)}})()},[e]),(0,r.useEffect)(()=>{let e=parseInt(x,10);e>=50?et(e):isNaN(e)?w(null):et(50)},[x]);let ea=e=>e<50?"Minimum is $50.":"",en=async()=>{if(!e)return void I("Please log in first.");B(""),C("");let t=parseInt(x,10),a=z?2*t:t,n=ea(t);if(n){I(n),B(n);return}if(!D&&U&&(!M.trim()||!J.trim())){I("Please provide both company name and VAT number."),B("Please provide both company name and VAT number.");return}P(!0),I("");try{let n={userId:e.uid,email:e.email?.slice(0,3)||"",monthlyPayment:t,updatedAt:new Date};U&&(n.companyName=M,n.VATNumber=J),await (0,i.setDoc)((0,i.doc)(l.db,"agencyBids",e.uid),n,{merge:!0});let r=await e.getIdToken(),s=await fetch("https://aiagentstore.ai/createOrUpdateAgency",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({doubleForDirectLink:z})});if(!s.ok)throw Error(`HTTP error: ${s.status}`);let o={monthlyPayment:a,needsCompanyInfo:U,...(0,b.l)()};U&&(o.companyName=M,o.VATNumber=J),window.tolt_referral&&(o.referral=window.tolt_referral);let c=await fetch("https://aiagentstore.ai/createFlexibleSubscription",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify(o)});if(!c.ok){let e=await c.json();throw Error(e.message||`HTTP error: ${c.status}`)}let d=await c.json();if(d.url)window.location.href=d.url;else if(d.message)C(d.message);else throw Error("Missing url or message from createFlexibleSubscription");Y(z),ee&&(0,m.logEvent)(ee,"subscribe_click",{user_id:e.uid,monthly_payment:a,double_for_direct_link:z,needs_company_info:U,timestamp:new Date().toISOString()})}catch(e){console.error(e),I(e.message||"Failed to initiate subscription. Please try again."),B(e.message||"Failed to initiate subscription. Please try again.")}finally{P(!1)}},er=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(e&&D){C(""),I(""),B(""),P(!0);try{let a=await e.getIdToken(),n={subscriptionId:D,reason:t,userId:e.uid,email:e.email||"",monthlyPayment:g,doubleForDirectLink:z,companyName:M,VATNumber:J,cancelledAt:new Date().toISOString()},r=await fetch("https://aiagentstore.ai/cancelFlexibleSubscription",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(n)}),i=await r.json();if(!r.ok)throw Error(i.message||"Error canceling subscription");C("Subscription canceled. Your agency will be marked inactive."),O(""),$("Finalize Your Agency Subscription"),V(!1),Y(!1),K(!0),H(""),G(""),ee&&(0,m.logEvent)(ee,"cancel_subscription_click",{user_id:e.uid,cancellation_reason:t,timestamp:new Date().toISOString()})}catch(e){console.error(e),I(e.message||"Failed to cancel subscription. Please try again.")}finally{P(!1)}}},ei=(()=>{let e=parseInt(x,10);return isNaN(e)?z?100:50:z?2*e>=100?2*e:100:e>=50?e:50})(),es=`Subscribe ($${ei})`,el=!1;return(D&&(null!==_&&(ei===_&&!z&&!L||ei===2*_&&z&&L)?(es="Increase amount to change subscription",el=!0):es=`Click to change subscription to $${ei}`),e)?null===a?(0,n.jsxs)("div",{className:"min-h-screen bg-gradient-to-r from-blue-100 to-blue-200 pt-16",children:[(0,n.jsx)(o.default,{user:e}),(0,n.jsxs)("div",{className:"max-w-2xl mx-auto mt-8 bg-white p-6 rounded shadow mb-16",children:[(0,n.jsx)("p",{children:"No agency data found. Please fill out your agency details before subscribing."}),(0,n.jsx)(h(),{href:"/agency-form",className:"text-blue-500 hover:underline",children:"Go to Agency Form"})]})]}):(0,n.jsxs)("div",{className:"min-h-screen bg-gradient-to-r from-blue-100 to-blue-200 pt-16",children:[(0,n.jsx)(o.default,{}),(0,n.jsxs)("div",{className:"max-w-2xl mx-auto bg-white p-6 mt-8 mb-16 rounded shadow",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold mb-4",children:F}),(0,n.jsxs)("p",{className:"text-gray-700 mb-6",children:["Your listing includes a ",(0,n.jsx)("strong",{children:"dofollow backlink"})," that helps boost your website's search engine rankings, while keeping your business visible to potential customers."]}),(0,n.jsx)("p",{className:"text-gray-700 mb-6",children:"You can modify or cancel your subscription on this page at any time."}),(0,n.jsxs)("p",{className:"text-gray-700 mb-6",children:["Minimum is $50. The more you pay, ",(0,n.jsx)("strong",{children:"the higher"})," your agency will appear (placement depends on other advertisers)."]}),_&&D&&(0,n.jsxs)("p",{className:"text-gray-700 mb-6",children:["Your current subscription: $",L?2*_:_," per month"]}),(0,n.jsx)("label",{className:"block mb-1 font-medium",children:"Monthly Payment Bid (USD)"}),(0,n.jsx)("input",{type:"number",className:`border rounded p-2 w-32 ${k?"border-red-500":"border-gray-300"}`,min:50,step:1,value:x,onChange:t=>{if(f(t.target.value),k){let e=parseInt(t.target.value,10);I(e>=50?"":ea(e))}if(ee){let a=t.target.value;(0,m.logEvent)(ee,"monthly_bid_change",{user_id:e.uid,new_monthly_payment:a,timestamp:new Date().toISOString()})}},onBlur:()=>{let e=parseInt(x,10);isNaN(e)||e<50||y(e),I("")}}),k&&(0,n.jsx)("p",{className:"text-red-500 text-sm mt-1",children:k}),j?(0,n.jsxs)("p",{className:"mt-2 text-gray-500 flex items-center",children:[(0,n.jsx)(c.A,{}),(0,n.jsx)("span",{className:"ml-2",children:"Calculating placement..."})]}):v&&(0,n.jsxs)("p",{className:"mt-2 text-gray-500",children:["Estimated placement: #",v," on the list."]}),D&&(0,n.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded text-sm text-blue-700",children:[(0,n.jsxs)("p",{children:["Active subscription (ID: ",D,")."]}),(0,n.jsxs)("p",{className:"mt-1",children:["Updating your monthly amount will ",(0,n.jsx)("strong",{children:"prorate"})," the difference."]}),(0,n.jsx)("p",{className:"mt-1",children:L&&(0,n.jsxs)("span",{children:[(0,n.jsx)("strong",{children:"Double for direct link"})," is enabled."]})})]}),!D&&(0,n.jsxs)("div",{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex items-center mb-4",children:[(0,n.jsx)("input",{type:"checkbox",id:"needsCompanyInfo",checked:U,onChange:t=>{let a=t.target.checked;K(a),ee&&(0,m.logEvent)(ee,"needs_company_info_toggle",{user_id:e.uid,enabled:a,timestamp:new Date().toISOString()})},className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),(0,n.jsx)("label",{htmlFor:"needsCompanyInfo",className:"ml-2 block text-sm text-gray-900",children:"I need my company name, address or VAT on invoices"}),(0,n.jsxs)("div",{className:"ml-1 relative",children:[(0,n.jsx)(d.lrG,{className:"h-5 w-5 text-gray-500 cursor-pointer","data-tooltip-id":"company-info-tooltip","data-tooltip-content":"Add company details for your accounting/tax records."}),(0,n.jsx)(u.m_,{id:"company-info-tooltip",place:"top",className:"tooltip-custom"})]})]}),U&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"companyName",className:"block mb-1 font-medium text-sm text-gray-700",children:"Company Name"}),(0,n.jsx)("input",{type:"text",id:"companyName",value:M,onChange:e=>H(e.target.value),className:"border rounded p-2 w-full",placeholder:"Enter your company name",required:U})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"VATNumber",className:"block mb-1 font-medium text-sm text-gray-700",children:"VAT Number"}),(0,n.jsx)("input",{type:"text",id:"VATNumber",value:J,onChange:e=>G(e.target.value),className:"border rounded p-2 w-full",placeholder:"Enter your VAT number",required:U})]})]})]}),(0,n.jsxs)("div",{className:"mt-6 flex items-center",children:[(0,n.jsx)("input",{type:"checkbox",id:"doubleForDirectLink",checked:z,onChange:t=>{let a=t.target.checked;V(a),ee&&(0,m.logEvent)(ee,"double_for_direct_link_toggle",{user_id:e.uid,enabled:a,timestamp:new Date().toISOString()})},className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),(0,n.jsx)("label",{htmlFor:"doubleForDirectLink",className:"ml-2 block text-sm text-gray-900",children:"Double for direct link"}),(0,n.jsxs)("div",{className:"ml-1 relative",children:[(0,n.jsx)(d.lrG,{className:"h-5 w-5 text-gray-500 cursor-pointer","data-tooltip-id":"double-link-tooltip","data-tooltip-content":"If checked, the link in the AI Agencies list will lead straight to your website, bypassing the AI Agent Store agency de
1scription page. Fewer steps in the funnel can lead to more conversions."}),(0,n.jsx)(u.m_,{id:"double-link-tooltip",place:"top",className:"tooltip-custom"})]})]}),z&&(0,n.jsxs)("p",{className:"text-gray-700 my-6",children:["Total: $",ei," per month"]}),E&&(0,n.jsx)("p",{className:"mt-4 text-green-600 text-sm font-semibold",children:E}),A&&(0,n.jsx)("p",{className:"text-red-600 text-sm font-semibold mt-4",children:A}),(0,n.jsx)("button",{onClick:en,disabled:T||el,className:`w-full ${el?"bg-primary-light text-white cursor-not-allowed":"bg-primary hover:bg-primary-light text-white"} px-6 py-3 rounded font-bold mt-6 flex items-center justify-center`,children:T?(0,n.jsx)(c.A,{}):es}),D&&(0,n.jsx)("div",{className:"mt-3 text-right",children:(0,n.jsx)("button",{onClick:()=>X(!0),className:"text-xs text-red-500 underline hover:text-red-700",disabled:T,children:"Cancel Subscription"})}),(0,n.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Higher payment = higher placement (depends on other bidders). You can adjust anytime."}),W&&(0,n.jsx)("div",{className:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full",children:[(0,n.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Confirm Cancellation"}),(0,n.jsx)("p",{className:"text-gray-700 mb-6",children:"Are you sure you want to cancel your subscription? Right after cancellation, your agency will no longer be visible on the AI Agent Store. You will lose future leads and SEO value from the backlinks."}),(0,n.jsxs)("div",{className:"flex justify-end space-x-4",children:[(0,n.jsx)("button",{onClick:()=>{X(!1),Z(""),Q(!0)},className:"bg-secondary hover:bg-secondary-light text-primary font-semibold h-10 px-4 rounded-md flex items-center justify-center",children:"Confirm Cancellation"}),(0,n.jsx)("button",{onClick:()=>X(!1),className:"bg-primary hover:bg-primary-light text-white font-semibold h-10 px-4 rounded-md flex items-center justify-center",children:"Keep Subscription"})]})]})}),q&&(0,n.jsx)("div",{className:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full",children:[(0,n.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"We're Sorry to See You Go"}),(0,n.jsx)("p",{className:"text-gray-700 mb-4",children:"Would you mind sharing why you're canceling? Your feedback is valuable and helps us improve our service."}),(0,n.jsx)("textarea",{className:"border rounded p-2 w-full mb-4",value:R,onChange:e=>Z(e.target.value),placeholder:"Enter cancellation reason...",rows:3}),(0,n.jsxs)("div",{className:"flex justify-end space-x-4",children:[(0,n.jsx)("button",{onClick:()=>{Q(!1)},className:"bg-primary hover:bg-primary-light text-white font-semibold h-10 px-4 rounded-md flex items-center justify-center",children:"Back"}),(0,n.jsx)("button",{onClick:()=>{er(R),Q(!1)},disabled:R.trim().length<5,className:`h-10 px-4 rounded-md flex items-center justify-center ${R.trim().length<5?"bg-gray-400 text-gray-700 cursor-not-allowed":"bg-secondary hover:bg-secondary-light text-primary"}`,children:"Finalize Cancellation"})]})]})})]})]}):(0,n.jsxs)("div",{className:"min-h-screen bg-gradient-to-r from-blue-100 to-blue-200 pt-16",children:[(0,n.jsx)(o.default,{}),(0,n.jsx)("div",{className:"max-w-2xl mx-auto bg-white p-6 mt-8 mb-16 rounded shadow",children:(0,n.jsxs)("p",{children:["Please ",(0,n.jsx)(h(),{href:"/login",className:"text-primary hover:underline",children:"log in"})," first."]})})]})}},37285:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/agency-subscribe",function(){return a(24375)}])},47530:(e,t,a)=>{"use strict";a.r(t),a.d(t,{db:()=>i});var n=a(11695),r=a(81829);let i=(0,n.getFirestore)(r.app)},63428:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var n=a(16879);let r={clawEarnEnabled:!0,loading:!1,isAdminIp:!1,clientIp:"",ipSource:"",publicEnabled:!0},i={clawEarnEnabled:!0,loading:!1,isAdminIp:!1,clientIp:"",ipSource:"",publicEnabled:!0};function s(){let e=!(arguments.length>
10)||void 0===arguments[0]||arguments[0],[t,a]=(0,n.useState)(e?r:i);return(0,n.useEffect)(()=>{if(!e)return a(i),()=>{};if(!(e=>{let t=String(e||"").trim().toLowerCase();return!!t&&("test.aiagentstore.ai"===t||t.startsWith("test."))})(window.location.hostname))return a({clawEarnEnabled:!0,loading:!1,isAdminIp:!1,clientIp:"",ipSource:"",publicEnabled:!0}),()=>{};let t=!1;return(async()=>{try{let e=await fetch("/api/claw-feature-gate",{cache:"no-store"}),n=await e.json().catch(()=>({}));if(t)return;if(!e.ok)return void a({clawEarnEnabled:!1,loading:!1,isAdminIp:!1,clientIp:"",ipSource:"",publicEnabled:!1});a({clawEarnEnabled:!!n.clawEarnEnabled,loading:!1,isAdminIp:!1,clientIp:"",ipSource:"",publicEnabled:!!n.clawEarnEnabledPublic})}catch(e){if(t)return;a({clawEarnEnabled:!1,loading:!1,isAdminIp:!1,clientIp:"",ipSource:"",publicEnabled:!1})}})(),()=>{t=!0}},[e]),t}},69624:e=>{e.exports={navbar:"NavBar_navbar___LVQF",brand:"NavBar_brand__HwA0H",brandImage:"NavBar_brandImage__AYbJL",brandText:"NavBar_brandText__OjhEG",brandName:"NavBar_brandName__pwYCo",planBadge:"NavBar_planBadge__1ZGB8",premiumBadge:"NavBar_premiumBadge__PpfdR",founderBadge:"NavBar_founderBadge__4rbfV",desktopNav:"NavBar_desktopNav__kA48A",primaryLinks:"NavBar_primaryLinks__7TIrS",navLink:"NavBar_navLink__ItO69",activeLink:"NavBar_activeLink___HYtB",navIcon:"NavBar_navIcon__esS9R",disabledLink:"NavBar_disabledLink__vzXKL",newBadge:"NavBar_newBadge__oaUZz",countBadge:"NavBar_countBadge__dXwwO",mobileBadge:"NavBar_mobileBadge__fKtH5",moreMenu:"NavBar_moreMenu__QD1Yg",menuItem:"NavBar_menuItem__e__6e",desktopActions:"NavBar_desktopActions__DU7NU",searchControl:"NavBar_searchControl__JYxTs",menuToggle:"NavBar_menuToggle__S78cy",authButton:"NavBar_authButton__rPw0y",logoutButton:"NavBar_logoutButton__hLb0z",signupButton:"NavBar_signupButton__6aIbv",mobileActions:"NavBar_mobileActions__KtltQ",mobileMenu:"NavBar_mobileMenu__vw25W",mobileLinks:"NavBar_mobileLinks__5zmwj",mobileAuth:"NavBar_mobileAuth__DY9tO"}},76227:(e,t,a)=>{"use strict";a.d(t,{S:()=>o,r:()=>c});var n=a(11695),r=a(81829);let i=new Set(["newsSubscribers","agentCollections","monetizationTracking","partnerClicks","payingAgentClicks","payingAgencyClicks"]);function s(e){let t=`write-capability:${e}`,a=localStorage.getItem(t);return a||(a=crypto.randomUUID(),localStorage.setItem(t,a)),a}async function l(e,t,a,l){let[o,c]=e.path.split("/");if(!i.has(o))return l?(0,n.updateDoc)(e,t):(0,n.setDoc)(e,t,a);let d=r.auth.currentUser?await r.auth.currentUser.getIdToken():"",u=t.hashKey||"";if(o.endsWith("Clicks")){let e=c.replace(/^\d{4}-\d{2}_/,"");t={...t,..."payingAgencyClicks"===o?{slug:e}:{seoTitle:e}}}if("newsSubscribers"===o)try{let e=JSON.parse(localStorage.getItem("newsSubscriber")||"{}");u=u||localStorage.getItem(`newsletter-management:${c}`)||(e.email===c?e.hashKey:"")||""}catch{}let m=await fetch("https://aiagentstore.ai/secureClientWrite",{method:"POST",headers:{"Content-Type":"application/json",...d?{Authorization:`Bearer ${d}`}:{}},body:JSON.stringify({collection:o,id:c,data:t,key:u,capability:"newsSubscribers"===o?void 0:s(e.path)})}),p=await m.json();if(!m.ok)throw Error(p.error||"Unable to save.");if(p.id&&p.id!==c&&"agentCollections"===o){localStorage.setItem(`write-capability:${o}/${p.id}`,s(e.path));let t=(localStorage.getItem("collectionIds")||"").split(",").filter(Boolean);localStorage.setItem("collectionIds",[...new Set([...t.map(e=>e===c?p.id:e),p.id])].join(","))}return p.hashKey&&(t.hashKey=p.hashKey,localStorage.setItem(`newsletter-management:${c}`,p.hashKey)),p}let o=(e,t,a)=>l(e,t,a,!1),c=(e,t)=>l(e,t,void 0,!0)},95090:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var n=a(69519);let r=function(){return(0,n.jsx)("div",{className:"loader"})}}},e=>{e.O(0,[6235,5497,8430,6633,9605,1938,7809,5122,1218,3889,636,6593,8792],()=>e(e.s=37285)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.