PageSourceSearch

https://codir.pro/assets/Dashboard-Dqzj2aB_.js

js codir.pro collected 2026-10-02 02:05:55 UTC 12,590 bytes, 16 lines download raw bytes

1import{c as C,u as Q,a as z,r as n,j as e,D as H,L as k,A as W,m as N,E as X,C as Z,R as ee,t as d,b as _}from"./index-B0sM48fE.js";import{B as b}from"./button-CXcf0psP.js";import{I as D}from"./input-CEx6Es-i.js";import{M as se}from"./mail-Bq5DIA9G.js";import{C as te}from"./copy-DiuWMnTl.js";import{E as ae}from"./eye-off-CNUKsdly.js";/**
2 * @license lucide-react v0.475.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ne=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],q=C("ExternalLink",ne);/**
7 * @license lucide-react v0.475.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const re=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],oe=C("LockOpen",re);/**
12 * @license lucide-react v0.475.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const ie=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ce=C("Puzzle",ie),le=3e4;function j({title:m,subscriptionName:a,chromeStoreUrl:i,verifyFunctionName:y,user:x,onUserUpdate:v,hasAccess:w,accentClass:p="bg-primary/10 text-primary",icon:f=ce,logoUrl:c=null}){const h=Q(),{t:s}=z(),[o,E]=n.useState(""),[L,O]=n.useState(!1),[u,S]=n.useState(null),[A,R]=n.useState(!1),[K,P]=n.useState(0),[U,T]=n.useState(!1),[g,I]=n.useState(""),[M,F]=n.useState(!1);n.useEffect(()=>{if(!u)return;P(le/1e3);const t=setInterval(()=>{P(r=>r<=1?(clearInterval(t),S(null),0):r-1)},1e3);return()=>clearInterval(t)},[u]);const Y=async()=>{var r,l;if(!/^\d{4}$/.test(o)){d.error(s("token_toast_pin_4digits"));return}O(!0);const t=await _.functions.invoke(y,{pinCode:o});O(!1),(r=t.data)!=null&&r.success?(S(t.data.token),E("")):d.error(((l=t.data)==null?void 0:l.error)||s("token_toast_pin_invalid"))},$=()=>{u&&(navigator.clipboard.writeText(u),R(!0),d.success(s("token_toast_copied")),setTimeout(()=>R(!1),2e3))},V=()=>{S(null),P(0)},G=async()=>{var r,l;T(!0);const t=await _.functions.invoke("requestPinChangeLink",{});T(!1),(r=t.data)!=null&&r.success?d.success(s("token_toast_email_sent")):d.error(((l=t.data)==null?void 0:l.error)||s("token_toast_email_failed"))},B=async()=>{var r,l;if(!/^\d{4}$/.test(g)){d.error(s("token_toast_pin_4digits"));return}F(!0);const t=await _.functions.invoke("savePinCode",{pinCode:g});F(!1),(r=t.data)!=null&&r.success?(d.success(s("token_toast_pin_saved")),v({...x,pinCode:g}),I("")):d.error(((l=t.data)==null?void 0:l.error)||s("token_toast_pin_save_failed"))};if(!w)return e.jsxs("div",{className:"rounded-2xl border border-border/50 bg-card/80 backdrop-blur-xl p-8 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:`h-10 w-10 rounded-xl flex items-center justify-center ${p}`,children:c?e.jsx("img",{src:c,alt:a,className:"h-6 w-6 object-contain opacity-70"}):e.jsx(f,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-space font-bold text-lg text-white",children:m}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("token_locked_badge_prefix")," ",e.jsx("span",{className:"text-primary font-semibold",children:a})," ",s("token_locked_badge_suffix")]})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-5",children:[s("token_locked_desc_prefix")," ",a," ",s("token_locked_desc_suffix")]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between gap-3 mb-4 p-4 rounded-xl bg-primary/10 border border-primary/20 hover:bg-primary/15 transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/20 flex items-center justify-center shrink-0",children:e.jsx(H,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:s("token_install_title")}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("token_install_desc_prefix")," ",a]})]})]}),e.jsx(q,{className:"h-4 w-4 text-primary group-hover:translate-x-0.5 transition-transform"})]}),e.jsxs(b,{onClick:()=>h("/app/subscription"),className:"bg-primary hover:bg-primary/90 text-primary-foreground w-full mt-auto",children:[e.jsx(oe,{className:"h-4 w-4 mr-2"}),s("token_unlock_button")]})]});const J=!!(x!=null&&x.pinCode);return e.jsxs("div",{className:"rounded-2xl border border-border/50 bg-card/80 backdrop-blur-xl p-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:`h-10 w-10 rounded-xl flex items-center justify-center ${p}`,children:c?e.jsx("img",{src:c,alt:a,className:"h-6 w-6 object-contain"}):e.jsx(f,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-space font-bold text-lg text-white",children:m}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("token_paste_hint")})]})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between gap-3 mb-6 p-4 rounded-xl bg-primary/10 border border-primary/20 hover:bg-primary/15 transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/20 flex items-center justify-center shrink-0",children:e.jsx(H,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:s("token_install_title")}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("token_install_desc_prefix")," ",a]})]})]}),e.jsx(q,{className:"h-4 w-4 text-primary group-hover:translate-x-0.5 transition-transform"})]}),J?e.jsx(W,{mode:"wait",children:u?e.jsxs(N.div,{initial:{opacity:0}
16,animate:{opacity:1},exit:{opacity:0},className:"space-y-3",children:[e.jsx("div",{className:"bg-secondary rounded-xl p-4 font-mono text-xs break-all text-foreground border border-primary/20",children:u}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(b,{onClick:$,variant:"outline",size:"sm",children:[A?e.jsx(Z,{className:"h-3.5 w-3.5 mr-1"}):e.jsx(te,{className:"h-3.5 w-3.5 mr-1"}),s(A?"token_copied":"token_copy")]}),e.jsxs(b,{onClick:V,variant:"ghost",size:"sm",children:[e.jsx(ae,{className:"h-3.5 w-3.5 mr-1"}),s("token_hide")]})]}),e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(ee,{className:"h-3 w-3"}),s("token_autohide_prefix")," ",K,s("token_autohide_suffix")]})]})]},"revealed"):e.jsxs(N.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[e.jsx("div",{className:"bg-secondary rounded-xl p-4 font-mono text-xs tracking-wider text-muted-foreground select-none break-all",children:"ext_••••••••••••••••••••••••••••••••••••••••••••••••"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{type:"password",inputMode:"numeric",maxLength:4,placeholder:s("token_enter_pin_placeholder"),value:o,onChange:t=>E(t.target.value.replace(/\D/g,"").slice(0,4)),onKeyDown:t=>t.key==="Enter"&&Y(),className:"bg-secondary border-border/50 tracking-[0.5em] text-center"}),e.jsx(b,{onClick:Y,disabled:L||o.length!==4,className:"bg-primary hover:bg-primary/90 text-primary-foreground shrink-0",children:L?e.jsx(k,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-4 w-4 mr-1"})," ",s("token_reveal_button")]})})]}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("button",{onClick:G,disabled:U,className:"text-xs text-muted-foreground hover:text-foreground flex items-center gap-1.5 transition-colors",children:[U?e.jsx(k,{className:"h-3 w-3 animate-spin"}):e.jsx(se,{className:"h-3 w-3"}),s("token_forgot_pin")]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("token_persistent_note")})]},"locked")}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("token_setup_pin_desc")}),e.jsx(D,{type:"password",inputMode:"numeric",maxLength:4,placeholder:s("token_setup_pin_placeholder"),value:g,onChange:t=>I(t.target.value.replace(/\D/g,"").slice(0,4)),onKeyDown:t=>t.key==="Enter"&&B(),className:"bg-secondary border-border/50 tracking-[0.5em] text-center text-lg"}),e.jsx(b,{onClick:B,disabled:M||g.length!==4,className:"bg-primary hover:bg-primary/90 text-primary-foreground w-full",children:M?e.jsx(k,{className:"h-4 w-4 animate-spin"}):s("token_setup_pin_button")})]})]})}const de=["beacons","creator-hub","complete"],me=["paypal","complete"],pe=["shopify","complete"],xe=["stripe","complete"],he="https://chromewebstore.google.com/detail/codir-bc/dhbageoimfkhbfihgpcfefacahhokgje",ue="https://chromewebstore.google.com/detail/codir-pp/lpdngnnibooaddgganflbhjjoedbkfdc",fe="https://chromewebstore.google.com/detail/codir-sh/opcnpobebfjhjonnhenmmbndkpgoccgp",ge="https://chromewebstore.google.com/detail/codir-%C2%B7-stripe/imlpbmiklngadfhpnknnjjnankbnmjpc",be="https://media.base44.com/images/public/69d3bbd071c32e8e2cd61c44/4a75bb4a7_LogoBeacons.png",_e="https://media.base44.com/images/public/69d3bbd071c32e8e2cd61c44/fb9c6ade2_image.png",ye="https://media.base44.com/images/public/69d3bbd071c32e8e2cd61c44/6bb88099f_ShopifyLogo.png",je="https://media.base44.com/images/public/69d3bbd071c32e8e2cd61c44/23c01e3af_Sanstitre.png";function Ee(){var f;const{t:m}=z(),[a,i]=n.useState(null),[y,x]=n.useState({}),[v,w]=n.useState(!0);n.useEffect(()=>{async function c(){var o;const[h,s]=await Promise.all([_.auth.me(),_.functions.invoke("getStripeSubscriptions",{})]);i(h),x(((o=s.data)==null?void 0:o.subscriptions)||{}),w(!1)}c()},[]);const p=c=>a?a.role==="admin"?!0:c.some(h=>{var s,o;return((s=y[h])==null?void 0:s.isActive)&&!((o=y[h])!=null&&o.cancelAtPeriodEnd)}):!1;return v?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"relative",children:[e.jsxs(N.div,{initial:{opacity:0,y:-10,filter:"blur(8px) brightness(2)"}
16,animate:{opacity:1,y:0,filter:"blur(0px) brightness(1)"},transition:{duration:.6,ease:[.22,1,.36,1]},className:"mb-10 text-center",children:[e.jsxs("h1",{className:"font-space font-bold text-3xl md:text-4xl text-white tracking-tight",children:[m("dash_welcome_back")," ",((f=a==null?void 0:a.full_name)==null?void 0:f.split(" ")[0])||m("dash_welcome_you")," 👋"]}),e.jsx("p",{className:"text-white/80 mt-2",children:m("dash_subtitle")})]}),e.jsxs(N.section,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1},className:"max-w-6xl mx-auto",children:[e.jsx("h2",{className:"text-xs font-space font-bold text-white uppercase tracking-[0.25em] mb-4",children:m("dash_section_extensions")}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsx(j,{title:"Beacons Token",subscriptionName:"Beacons",chromeStoreUrl:he,verifyFunctionName:"verifyPinForExtensionToken",user:a,onUserUpdate:i,hasAccess:p(de),accentClass:"bg-orange-500/10",logoUrl:be}),e.jsx(j,{title:"PayPal Token",subscriptionName:"PayPal",chromeStoreUrl:ue,verifyFunctionName:"verifyPinForPaypalToken",user:a,onUserUpdate:i,hasAccess:p(me),accentClass:"bg-blue-500/10",logoUrl:_e}),e.jsx(j,{title:"Shopify Token",subscriptionName:"Shopify",chromeStoreUrl:fe,verifyFunctionName:"verifyPinForShopifyToken",user:a,onUserUpdate:i,hasAccess:p(pe),accentClass:"bg-green-500/10",logoUrl:ye}),e.jsx(j,{title:"Stripe Token",subscriptionName:"Stripe",chromeStoreUrl:ge,verifyFunctionName:"verifyPinForStripeToken",user:a,onUserUpdate:i,hasAccess:p(xe),accentClass:"bg-violet-500/10",logoUrl:je})]})]})]})}export{Ee as default};

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.