PageSourceSearch

https://www.dealkeep.io/assets/OptimizedDashboardLoader-D2SRpVBb.js

js dealkeep.io collected 2026-09-24 13:36:41 UTC 23,750 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrialDashboard-B1SbDoiw.js","assets/vendor-react-Dqm4a0k5.js","assets/index-BR-ShKyk.js","assets/vendor-supabase-RijQlDjE.js","assets/vendor-utils-KLhAiGEE.js","assets/vendor-icons-Dv6Y7wXg.js","assets/vendor-query-BQV4-hhd.js","assets/radix-react-slot-CrO6XSQS.js","assets/radix-react-compose-refs-IIetlP92.js","assets/index-B1JAUuM_.css","assets/WidgetErrorBoundary-BwyMhiC9.js","assets/PlanComparisonDrawer-CbPW99uT.js","assets/vendor-radix-DFc8vCWX.js","assets/validation-DfDrtHjz.js","assets/usePlanManagement-BuZFkxtl.js","assets/MobilePageTransitionAnimated-lpTtBr8f.js","assets/vendor-motion-uI1IlCbt.js","assets/useDashboardMetrics-DizIeV6R.js","assets/FullShell-D8umUy0n.js","assets/useSupportTickets-CNr_YXIK.js","assets/useDebounce-JJj-9H3L.js","assets/use-toast-DL6cPnZQ.js","assets/featureVisits-BSHlqVTm.js","assets/SubscriptionManagementCard-D52MJoVD.js","assets/RedeemLicenseCode-DgZ5r-CN.js","assets/toolIcon-CtXhzpJG.js","assets/TrialEndedToast-tuQJxlUQ.js","assets/CategoryPicker-PGHuajy7.js","assets/command-BihCDANY.js","assets/useOwnedToolCount-wyv1Fa3v.js","assets/shimmer-DpOdRRUj.js","assets/placeholderStyles-DBHPcRYS.js","assets/EditAvgCostDialog-SJgVhJsU.js","assets/useUnifiedToolsData-rJg8g7fP.js","assets/usePlanLimitedData-BmP7rsfl.js","assets/licenseCodes-gVoUkkH-.js","assets/Breadcrumbs-DyKA5pqw.js","assets/tapIntent-ChFounVY.js","assets/bulkCategorize-h2Op8naW.js","assets/theme-logo-CvMov46y.js","assets/useEarnStack-5Of8e7D0.js","assets/useWatchlistFlag-BdqMoolJ.js","assets/CommandPalette-QTja5aVJ.js","assets/useTeamTools-CB7LIUeC.js","assets/useBugReports-DNNSx95G.js","assets/PageHeader-YF11zZ1Y.js","assets/ConsoleKit-D6nSHYFq.js","assets/Comprehe
1nsiveEmailSystemTester-D2oSdOs7.js","assets/dropdown-menu-BeTST-1x.js","assets/UnifiedMobileDashboard-BSgRMEg6.js","assets/MobileTabGrid-D3o1zdIa.js","assets/MobileOptimizedLayout-Bn6L9nW0.js","assets/ConsoleAddTools-ihIvTrMB.js","assets/categories-DVobXU6A.js","assets/ScreenshotAttachments-9p1tqcn2.js","assets/types-BWQbS8eK.js","assets/MobileAppBar-ybB0CJBV.js","assets/FreeDashboard-BcazkbAm.js","assets/CreateTeamDialog-DNo6L3c7.js","assets/ProDashboard-v5Raytt7.js","assets/usePlanVerification-DhJKONL9.js","assets/UncategorizedProductsBanner-CV5QYUhc.js","assets/TeamPlanDashboard-9XUH7s59.js","assets/useNotificationPreferences-Dpqtbt_N.js","assets/EnhancedReminderButton-BNegs7FW.js","assets/SimplifiedDashboard-B02J3S7Z.js"])))=>i.map(i=>d[i]);
2import{_}from"./vendor-supabase-RijQlDjE.js";import{r,j as e,L as G,e as le}from"./vendor-react-Dqm4a0k5.js";import{u as ce}from"./vendor-query-BQV4-hhd.js";import{u as de,P as J}from"./MobilePageTransitionAnimated-lpTtBr8f.js";import{p as j,s as f,C as Y,e as se,f as ae,B as S,a as Q,u as re,J as D,_ as ue,$ as me,a0 as he,a1 as pe,l as I}from"./index-BR-ShKyk.js";import{u as fe}from"./use-toast-DL6cPnZQ.js";import{u as xe}from"./useTeamTools-CB7LIUeC.js";import{u as ge}from"./useSupportTickets-CNr_YXIK.js";import{P as ye}from"./WidgetErrorBoundary-BwyMhiC9.js";import{R as be}from"./EnhancedReminderButton-BNegs7FW.js";import{r as R,c as _e}from"./useDashboardMetrics-DizIeV6R.js";import{u as je}from"./usePlanManagement-BuZFkxtl.js";import{X as ne,G as we,aV as ve,T as Se,at as X,C as q,aW as Ne,aX as De,aj as Z,z as ke}from"./vendor-icons-Dv6Y7wXg.js";import"./vendor-motion-uI1IlCbt.js";import"./vendor-utils-KLhAiGEE.js";import"./radix-react-slot-CrO6XSQS.js";import"./radix-react-compose-refs-IIetlP92.js";import"./FullShell-D8umUy0n.js";import"./vendor-radix-DFc8vCWX.js";import"./useDebounce-JJj-9H3L.js";import"./PlanComparisonDrawer-CbPW99uT.js";import"./validation-DfDrtHjz.js";import"./featureVisits-BSHlqVTm.js";import"./useNotificationPreferences-Dpqtbt_N.js";const Pe=async n=>{j({type:"start"});const{data:d}=await f.auth.getSession(),t=d?.session?.user?.id;if(t){const o=await R("dashboard-metrics",()=>Promise.resolve(f.rpc("get_dashboard_metrics",{p_user_id:t}).then(({data:u,error:p})=>{if(p)throw p;return u?.[0]??null})),{retry:!0,authRecovery:!0});o.ok&&o.data&&(n.setQueryData(["dashboard-metrics",t],o.data),j({type:"success",label:"dashboard-metrics"}))}const i=await R("notification-preferences",async()=>{const{data:o,error:u}=await f.from("notification_preferences").select("*").maybeSingle();if(u)throw u;return o},{retry:!0});i.ok&&(n.setQueryData(["notification-preferences"],i.data),j({type:"success",label:"notification-preferences"})),R("tools-paginated",async()=>{const{data:o,error:u,count:p}=await f.from("tools").select("*",{count:"exact"}).order("purchase_date",{ascending:!1}).range(0,19);if(u)throw u;return{tools:o||[],totalCount:p||0,hasNextPage:(p||0)>20,page:1,limit:20}},{retry:!0}).then(o=>{o.ok&&(n.setQueryData(["tools-paginated",1,20],o.data),j({type:"success",label:"tools-paginated"}))}),R("appsumo-products-paginated",async()=>{const{data:o,error:u,count:p}=await f.from("appsumo_products").select("*",{count:"exact"}).order("purchase_date",{ascending:!1}).range(0,19);if(u)throw u;return{products:o||[],totalCount:p||0,hasNextPage:(p||0)>20,page:1,limit:20}},{retry:!0}).then(o=>{o.ok&&(n.setQueryData(["appsumo-products-paginated",1,20],o.data),j({type:"success",label:"appsumo-products-paginated"}))})},Ee=n=>{setTimeout(()=>{R("smart_stacks",async()=>{const{data:t,error:i}=await f.from("smart_stacks").select("*").order("updated_at",{ascending:!1});if(i)throw i;return t||[]},{retry:!0}).then(t=>{t.ok&&(n.setQueryData(["smart_stacks"],t.data),j({type:"success",label:"smart_stacks"}))})},2e3)},z="dealkeep_install_guide_dismissed";function Te(){const[n,d]=r.useState(()=>{try{return localStorage.getItem(z)==="true"}catch{return!1}}),t=()=>{try{localStorage.setItem(z,"true")}catch{}d(!0)},i=()=>{try{localStorage.removeItem(z)}catch{}d(!1)};return n?e.jsx("div",{className:"mb-4",children:e.jsx("button",{type:"button",onClick:i,className:"text-xs text-muted-foreground hover:text-primary underline underline-offset-2 transition-colors",children:"Show setup guide"})}):e.jsxs(Y,{className:"mb-6 border-primary/20 bg-card",children:[e.jsxs(se,{className:"flex flex-row items-start justify-between gap-3 pb-3",children:[e.jsx(ae,{className:"text-lg sm:text-xl",children:"How to Install & Import Your Tools from AppSumo"}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:t,"aria-label":"Dismiss setup guide",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground shrink-0",children:e.jsx(ne,{className:"h-4 w-4"})})]}),e.jsx(Q,{className:"pt-0",children:e.jsxs("ol",{className:"space-y-4",children:[e.jsxs(k,{number:1,children:["Log in to DealKeep and go to"," ",e.jsx(G,{to:"/app/tools?tab=add&subtab=extension",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"Tools → Chrome Install"})," ","to download the Chrome extension."]}),e.jsxs(k,{number:2,children:["Open your"," ",e.jsx("a",{href:"https://appsumo.com/account/products/",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"AppSumo products page"})," ","and click the DealKeep extension icon in your browser toolbar."]}),e.jsxs(k,{number:3,children:["Confirm the extension is connected to the correct DealKeep account.",e.jsxs("ul",{className:"mt-2 ml-1 space-y-1 text-xs text-muted-foreground list-disc list-inside",children:[e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Starter"})," supports 1 account connection"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Pro"})," supports up to 5 account connections"]})]})]}
2),e.jsxs(k,{number:4,children:["Return to your AppSumo active products page and click"," ",e.jsx("span",{className:"font-semibold text-foreground",children:'"Scrape All Tools"'})," ","in the extension popup to import your active tools into DealKeep."]}),e.jsxs(k,{number:5,children:["After the import, the extension keeps working for a few more minutes, linking each tool to its official website — a"," ",e.jsx("span",{className:"font-semibold text-foreground",children:"progress counter on the AppSumo page"})," ","shows how much time is left. Keep that tab open until it says"," ",e.jsx("span",{className:"font-semibold text-foreground",children:'"Full import completed ✅"'})," ","(you can browse in other tabs meanwhile). Closing early is safe — unreached tools simply keep their AppSumo link until your next import."]}),e.jsxs(k,{number:6,children:["If your tools do not appear in DealKeep, refresh your browser. If they still do not appear, check that the extension is not connected to a different email address, especially on the ",e.jsx("span",{className:"font-medium",children:"Starter"})," plan."]}),e.jsxs(k,{number:7,children:["If you still see errors or missing tools, contact support through the"," ",e.jsx(G,{to:"/app/help",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"Help & Support"})," ","or email"," ",e.jsx("a",{href:"mailto:[email protected]",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"[email protected]"}),"."]})]})})]})}function k({number:n,children:d}){return e.jsxs("li",{className:"flex gap-3 items-start",children:[e.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-primary/15 text-primary flex items-center justify-center text-sm font-bold",children:n}),e.jsx("div",{className:"text-sm text-muted-foreground leading-relaxed pt-0.5",children:d})]})}const ee="dealkeep_referral_banner_dismissed",Re="https://www.dealkeep.io/affiliate";function Ce(){const[n,d]=r.useState(()=>{try{return localStorage.getItem(ee)==="true"}catch{return!1}}),t=()=>{try{localStorage.setItem(ee,"true")}catch{}d(!0)};return n?null:e.jsx(Y,{className:"mb-6 border-primary/20 bg-gradient-to-r from-brand-blue/5 to-brand-green/5",children:e.jsxs(Q,{className:"flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-4 py-4",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"flex-shrink-0 w-9 h-9 rounded-full bg-primary/15 text-primary flex items-center justify-center",children:e.jsx(we,{className:"h-4.5 w-4.5","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-sm font-semibold leading-snug",children:["Love DealKeep? Earn ",e.jsx("span",{className:"text-primary",children:"40% commission"}),"."]}),e.jsx("p",{className:"text-xs text-muted-foreground leading-snug mt-0.5",children:"Refer other lifetime-deal buyers — they get 10% off, you earn 40% on every sale."})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 shrink-0",children:[e.jsx(S,{asChild:!0,size:"sm",className:"font-semibold",children:e.jsx("a",{href:Re,target:"_blank",rel:"noopener noreferrer",title:"Join the DealKeep affiliate program",children:"Become an affiliate"})}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:t,"aria-label":"Dismiss affiliate invite",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground shrink-0",children:e.jsx(ne,{className:"h-4 w-4"})})]})]})})}const Ie=500,Ae=I(()=>_(()=>import("./TrialDashboard-B1SbDoiw.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]))),Le=I(()=>_(()=>import("./FreeDashboard-BcazkbAm.js").then(n=>n.F),__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,17,18,15,16,12,19,20,21,35,30,49,50,36,37,13,38,39,40,41,42,28,29,11,14,22,43,44,45,26,46,47,48,51,24,25,27,31,32,33,34,10,52,53,54,55,56,23,58]))),Oe=I(()=>_(()=>import("./ProDashboard-v5Raytt7.js"),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,57,17,18,15,16,12,19,20,21,35,30,49,50,36,37,13,38,39,40,41,42,28,29,11,14,22,43,44,45,26,46,47,48,51,24,25,27,31,32,33,34,10,52,53,54,55,56,23,58,60,61]))),Me=I(()=>_(()=>import("./TeamPlanDashboard-9XUH7s59.js"),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,57,17,18,15,16,12,19,20,21,35,30,49,50,36,37,13,38,39,40,41,42,28,29,11,14,22,43,44,45,26,46,47,48,51,24,25,27,31,32,33,34,10,52,53,54,55,56,23,58,63,60,61,64]))),Fe=I(()=>_(()=>import("./SimplifiedDashboard-B02J3S7Z.js"),__vite__mapDeps([65,1,50,36,37,6,2,3,4,5,7,8,9,18,15,16,12,19,20,21,30,13,35,38,39,40,41,42,28,29,11,14,17,22,43,44,45,26,46,47,48,61,51,
210]))),H=({message:n="Loading your dashboard..."})=>e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin mx-auto"}),e.jsx("p",{className:"text-muted-foreground",children:n})]})}),te=typeof import.meta<"u"&&!1;let V=0;const Ke=1e4;function Ue({error:n,onRetry:d}){const[t,i]=r.useState(!1),[o,u]=r.useState(te),[p,N]=r.useState(!1),{user:x}=re();ge();const h=n?_e(n):null,a=h?.type==="AUTH",b=typeof navigator<"u"&&!navigator.onLine;r.useEffect(()=>{if(a||b)return;const c=Date.now();if(c-V<Ke)return;V=c;const E=setTimeout(async()=>{try{await f.auth.refreshSession()}catch{}d()},1500);return()=>clearTimeout(E)},[a,b,d]);const C=async()=>{i(!0),V=0;try{await f.auth.refreshSession()}catch{}d(),setTimeout(()=>i(!1),2e3)},A=()=>{window.location.href="/app"},L=()=>{window.location.href="/login"},P=he();return e.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:e.jsxs(Y,{className:"max-w-md w-full border-destructive/30",children:[e.jsxs(se,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto w-12 h-12 bg-destructive/10 rounded-full flex items-center justify-center mb-3",children:b?e.jsx(ve,{className:"w-6 h-6 text-destructive"}):e.jsx(Se,{className:"w-6 h-6 text-destructive"})}),e.jsx(ae,{className:"text-lg",children:b?"You're offline":a?"Session expired":"Failed to load dashboard"})]}),e.jsxs(Q,{className:"space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:b?"Please check your internet connection and try again.":a?"Your session has expired. Please sign in again.":"We encountered an issue loading your dashboard. This is usually temporary."}),!b&&e.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 p-3 rounded-md",children:[e.jsx("p",{className:"font-medium mb-1",children:"Possible causes:"}),e.jsxs("ul",{className:"list-disc list-inside text-left space-y-1",children:[e.jsx("li",{children:"Temporary network issues"}),e.jsx("li",{children:"Session expired – try signing out and back in"}),e.jsx("li",{children:"Browser cache needs clearing"})]})]}),h&&e.jsxs("div",{className:"text-left",children:[e.jsxs(S,{variant:"ghost",size:"sm",className:"w-full justify-between text-muted-foreground",onClick:()=>u(c=>!c),children:[o?"Hide details":"Show details",o?e.jsx(X,{className:"h-4 w-4"}):e.jsx(q,{className:"h-4 w-4"})]}),o&&e.jsxs("div",{className:"mt-2 p-3 rounded-md bg-muted/50 font-mono text-xs break-all",children:[e.jsxs("div",{children:["Type: ",h.type]}),h.status!=null&&e.jsxs("div",{children:["Status: ",h.status]}),h.code&&e.jsxs("div",{children:["Code: ",h.code]}),e.jsxs("div",{children:["Message: ",h.message]}),te,e.jsxs("div",{children:["Time: ",new Date().toISOString()]})]})]}),e.jsxs("div",{className:"text-left",children:[e.jsxs(S,{variant:"ghost",size:"sm",className:"w-full justify-between text-muted-foreground",onClick:()=>N(c=>!c),children:[e.jsx(Ne,{className:"h-4 w-4 mr-2"}),"Diagnostics",p?e.jsx(X,{className:"h-4 w-4"}):e.jsx(q,{className:"h-4 w-4"})]}),p&&e.jsx("div",{className:"mt-2 p-3 rounded-md bg-muted/50 font-mono text-xs max-h-48 overflow-y-auto space-y-1",children:P.length===0?e.jsx("div",{children:"No events yet."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{children:["Last ",P.length," events"]}),e.jsx(S,{variant:"ghost",size:"sm",onClick:()=>pe(),children:"Clear"})]}),[...P].reverse().map((c,E)=>e.jsxs("div",{className:"border-b border-border/50 pb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:c.timestamp})," ",c.type,c.label&&` ${c.label}`,c.status!=null&&` status=${c.status}`,c.message&&` ${c.message}`]},E))]})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a?e.jsxs(S,{onClick:L,className:"flex-1",children:[e.jsx(De,{className:"w-4 h-4 mr-2"}),"Sign in again"]}):e.jsx(S,{onClick:C,className:"flex-1",disabled:t,children:t?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-2 animate-spin"}),"Retrying..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-2"}),"Try Again"]})}),e.jsxs(S,{variant:"outline",onClick:A,className:"flex-1",children:[e.jsx(ke,{className:"w-4 h-4 mr-2"}),"Go Home"]})]})]})]})})}const ze=(n,d,t)=>e.jsx(Ue,{error:n,onRetry:t});function mt(){const n=fe(),d=xe(),{plan:t,loading:i,isTransitioning:o,refreshPlan:u}=de(),{isAuthStable:p}=re(),N=ce(),[x,h]=le(),[a,b]=r.useState(null),[C,A]=r.useState(!1),[L,P]=r.useState(!1),c=r.useRef(!1),E=r.useRef(!1),{changePlan:F}=je(),W=r.useRef(!1),K=r.useRef(null),T=r.useRef(null);r.useEffect(()=>{console.log("[DashboardLoader] State:",{loading:i,plan:t,displayPlan:a,isTransitioning:o,isChanging:C,hasStabilized:W.current})},[i,t,a,o,C]);const O=r.useCallback(s=>{if(a===null){console.log("[DashboardLoader] Initial plan set:",s),b(s);return}s!==a&&(console.log("[DashboardLoader] Plan changing:",a,"->",s),localStorage.removeItem("dealkeep_plan_cache"),localStorage.removeItem("user_plan"),T.current&&clearTimeout(T.current),A(!0),T.current=setTimeout(()=>{b(s),A(!1),T.current=null},200))},[a]);r.useEffect(()=>(!i&&a===null&&t&&(console.log("[DashboardLoader] Setting initial displayPlan:",t),b(t),K.current=setTimeout(()=>
2{W.current=!0,console.log("[DashboardLoader] Stabilized")},Ie)),()=>{K.current&&clearTimeout(K.current)}),[i,a,t]),r.useEffect(()=>{t&&t!==a&&a!==null&&!i&&O(t)},[t,a,i,O]),r.useEffect(()=>{const s=m=>{const l=m.detail.plan;l&&O(l)};return window.addEventListener(J,s),()=>{window.removeEventListener(J,s),T.current&&clearTimeout(T.current)}},[O]);const $="dealkeep_trial_popup_seen";r.useEffect(()=>{if(c.current||!a||x.get("showPricing")!=="1")return;try{const w=x.get("plan")?.toUpperCase();if(localStorage.getItem($)==="true"&&w!=="STARTER"&&w!=="PRO"&&w!=="TEAM"){c.current=!0,h(M=>{const v=new URLSearchParams(M);return v.delete("showPricing"),v.delete("plan"),v.delete("billing"),v},{replace:!0});return}}catch{}c.current=!0;const s=x.get("plan")?.toUpperCase(),m=x.get("billing"),l=x.get("promo")||"";if(h(w=>{const y=new URLSearchParams(w);return y.delete("showPricing"),y.delete("plan"),y.delete("billing"),y.delete("promo"),y.delete("intent"),y},{replace:!0}),(s==="STARTER"||s==="PRO"||s==="TEAM")&&!E.current){E.current=!0;const w=s==="STARTER"?"starter":s==="TEAM"?"team":"pro";D.success(`Welcome! Starting your free 7-day ${s} trial…`,{duration:3e3}),(async()=>{try{const{data:y,error:M}=await f.rpc("start_14day_trial",{p_plan_id:w}),v=y??null;if(M||!v?.success){const B=v?.error||M?.message||"unknown";console.warn("[DashboardLoader] start_14day_trial failed, falling back to checkout:",B),B==="trial_already_used"?D.info("You already used your free trial — redirecting to checkout instead.",{duration:4e3}):D.error("Could not start free trial — redirecting to checkout instead.",{duration:4e3}),F({targetPlan:s,billingCycle:m||void 0,reason:"signup_trial_fallback_to_checkout",redirectInTab:!0,promoCode:l||void 0});return}D.success(`Your 7-day ${s} trial is active!`,{description:v.trial_end?`Trial ends ${new Date(v.trial_end).toLocaleDateString()}`:void 0,duration:5e3}),ue(w);try{await u()}catch{}}catch(y){console.error("[DashboardLoader] start_14day_trial threw:",y),D.error("Could not start free trial — redirecting to checkout instead.",{duration:4e3}),F({targetPlan:s,billingCycle:m||void 0,reason:"signup_trial_fallback_to_checkout",redirectInTab:!0,promoCode:l||void 0})}})()}else P(!0),D.success("Welcome! Choose a plan or explore your dashboard.",{duration:5e3})},[a,x,h,F]);const U=r.useRef(!1);r.useEffect(()=>{if(console.log("[plan_activated] effect fired, URL:",window.location.href),console.log("[plan_activated] searchParams:",x.toString()),console.log("[plan_activated] hasHandledPlanActivated:",U.current),x.get("plan_activated")!=="true"&&x.get("upgraded")!=="true"||(console.log("[plan_activated] PASSED param check — proceeding"),U.current))return;console.log("[plan_activated] PASSED ref guard — executing cleanup"),U.current=!0,window.history.replaceState({},document.title,"/app"),h(m=>{const l=new URLSearchParams(m);return l.delete("plan_activated"),l.delete("upgraded"),l},{replace:!0}),(async()=>{try{await f.auth.refreshSession()}catch{}N.removeQueries({predicate:m=>{const l=m.queryKey;return l[0]==="tools"&&l.some(g=>g===null||g==="null"||g===void 0)}}),await N.invalidateQueries({predicate:m=>{const l=m.queryKey;return l[0]==="tools"?l.every(g=>g!==null&&g!=="null"&&g!==void 0):!0}}),await u(),D.success("Your plan is now active. Welcome!",{duration:5e3})})()},[x,h,u,N]);const oe=r.useCallback(s=>{if(!s)try{localStorage.setItem($,"true")}catch{}P(s),s||(c.current=!0)},[]);if(r.useEffect(()=>{if(i||!a)return;let s=!1;return(async()=>{const{data:m}=await f.auth.getSession();if(s)return;if(!m?.session){j({type:"fail",label:"health_check",message:"No session"});return}const l=await R("health_check",async()=>{const{error:g}=await f.rpc("get_dashboard_metrics",{p_user_id:m.session.user.id});if(g)throw g;return 1},{retry:!1,authRecovery:!1});s||(l.ok?j({type:"success",label:"health_check"}):l.error.type==="RLS"?j({type:"fail",label:"health_check",message:"Permissions/RLS issue",code:l.error.code}):j({type:"fail",label:"health_check",status:l.error.status,message:l.error.message}))})(),()=>{s=!0}},[i,a]),r.useEffect(()=>{!i&&a&&(Pe(N),Ee(N),setTimeout(()=>{switch(a){case"TRIAL":_(()=>import("./TrialDashboard-B1SbDoiw.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]));break;case"FREE":_(()=>import("./FreeDashboard-BcazkbAm.js").then(m=>m.F),__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,17,18,15,16,12,19,20,21,35,30,49,50,36,37,13,38,39,40,41,42,28,29,11,14,22,43,44,45,26,46,47,48,51,24,25,27,31,32,33,34,10,52,53,54,55,56,23,58]));break;case"PRO":_(()=>import("./ProDashboard-v5Raytt7.js"),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,57,17,18,15,16,12,19,20,21,35,30,49,50,36,37,13,38,39,40,41,42,28,29,11,14,22,43,44,45,26,46,47,48,51,24,25,27,31,32,33,34,10,52,53,54,55,56,23,58,60,61]));break;case"TEAM":_(()=>import("./TeamPlanDashboard-9XUH7s59.js"),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,57,17,18,15,16,12,19,20,21,35,30,49,50,36,37,13,38,39,40,41,42,28,29,11,14,22,43,44,45,26,46,47,48,51,24,25,27,31,32,33,34,10,52,53,54,55,56,23,58,63,60,61,64]));break;default:_(()=>import("./SimplifiedDashboard-B02J3S7Z.js"),__vite__mapDeps([65,1,50,36,37,6,2,3,4,5,7,8,9,18,15,16,12,19,20,21,30,13,35,38,39,40,41,42,28,29,11,14,17,22,43,44,45,26,46,47,48,61,51,
210]))}},100))},[i,a,N]),i||a===null||!p)return e.jsx(H,{});if(o||C)return e.jsx(H,{message:"Switching to your new plan..."});const ie=()=>{switch(a){case"TRIAL":return e.jsx(Ae,{});case"FREE":return e.jsx(Le,{});case"PRO":return e.jsx(Oe,{});case"TEAM":return e.jsx(Me,{});default:return e.jsx(Fe,{})}};return e.jsx(me,{fallback:ze,children:e.jsxs(be,{children:[e.jsxs(r.Suspense,{fallback:e.jsx(H,{}),children:[!(n&&d)&&e.jsxs("div",{className:"w-full max-w-7xl mx-auto px-4 sm:px-6 pt-4 sm:pt-6",children:[e.jsx(Te,{}),e.jsx(Ce,{})]}),ie()]}),L&&e.jsx(ye,{open:L,onOpenChange:oe})]})})}export{mt as OptimizedDashboardLoader};

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.