PageSourceSearch

https://user.bitfocus.io/assets/index-Cm6azZhJ.js

js bitfocus.io collected 2026-09-25 19:12:01 UTC 12,670 bytes, 1 lines download raw bytes

1import{y as ue,z as w,s as A,D as H,q as V,C as pe,u as fe,S as Re,r as i,b as h,j as e,V as Ie,W as De,X as Ee,a1 as ke,M as Ne,l as J,ap as Me,aq as W,Z as qe,ar as Te,as as Ue,p as K,m as Be,L as Oe,P as Q,ao as T,at as ze,au as G,n as Fe}from"./index-CjsjdJIr.js";import{P as ee}from"./PageTitle-Cm-REMfk.js";import{D as We,a as we}from"./DeleteModal-B6yr0Ew8.js";import{b as Ae,c as He,d as Ve}from"./selectors-DNInVxZ9.js";import{g as me,C as he}from"./CardImage-B1pV_k8N.js";import{N as Ye}from"./NetErrorHoc-BIxhA1SU.js";import{F as $e}from"./FormControl-8-lVNXK4.js";import{I as Xe}from"./InputLabel-BVIE5-L7.js";import{S as Ze}from"./Select-CrmtdwmC.js";import{s as Je}from"./url-DaVAPK2j.js";import{T as te,a as se,b as U,c as n,d as ae}from"./TableRow-DxeCMkgU.js";import{T as ne}from"./TableHead-zhko0HUq.js";import{D as re}from"./Divider-IvZ40J2i.js";import{C as ie}from"./Chip-DLZtX4La.js";import{A as Ke}from"./Alert-DfRbo9na.js";import"./utils-CARSbpnB.js";import"./useFormControl-RS6PzdU6.js";import"./Popover-DKfx-8dI.js";const Qe=ue(o=>({root:{width:"100%",maxWidth:1400},table:{minWidth:650},cardIcon:{width:33,marginTop:-10,marginBottom:-11}}));var L={},oe;function Ge(){if(oe)return L;oe=1;var o=w();Object.defineProperty(L,"__esModule",{value:!0}),L.default=void 0;var r=o(A()),f=o(H()),m=(0,f.default)(r.default.createElement(r.default.Fragment,null,r.default.createElement("path",{d:"M17.75 7L14 3.25l-10 10V17h3.75l10-10zm2.96-2.96c.39-.39.39-1.02 0-1.41L18.37.29a.9959.9959 0 0 0-1.41 0L15 2.25 18.75 6l1.96-1.96z"}),r.default.createElement("path",{fillOpacity:".36",d:"M0 20h24v4H0z"})),"BorderColor");return L.default=m,L}
1var et=Ge();const tt=V(et);var P={},ce;function st(){if(ce)return P;ce=1;var o=w(),r=pe();Object.defineProperty(P,"__esModule",{value:!0}),P.default=void 0;var f=r(A()),m=o(H()),u=(0,m.default)(f.createElement("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"Undo");return P.default=u,P}var at=st();const nt=V(at);var R={},le;function rt(){if(le)return R;le=1;var o=w(),r=pe();Object.defineProperty(R,"__esModule",{value:!0}),R.default=void 0;var f=r(A()),m=o(H()),u=(0,m.default)(f.createElement("path",{d:"M18 17H6v-2h12v2zm0-4H6v-2h12v2zm0-4H6V7h12v2zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2v20z"}),"Receipt");return R.default=u,R}var it=rt();const de=V(it),ot=ue(o=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{backgroundColor:o.palette.background.paper,boxShadow:o.shadows[5],padding:o.spacing(2,4,3),outline:"none",borderRadius:5,width:400},modal_content:{width:"100%",marginTop:30},formControl:{margin:o.spacing(1),width:"100%"},cardIcon:{width:33,marginTop:-10,marginBottom:-11}})),ct=o=>{const r=ot(),f=fe(),{modalOpen:m,modalData:u}=o,[x,I]=Re.useState(!1),[j,v]=i.useState(null),[y,C]=i.useState([]),[D,E]=i.useState(""),S=h(me);i.useEffect(()=>{m&&(I(!0),v(u))},[m]),i.useEffect(()=>{S&&C(S)},[S]),i.useEffect(()=>{u&&E(u.default_payment_method)},[u]);const _=()=>{I(!1),v(null),o.editClosed()},k=c=>{E(c.target.value)},B=c=>{c.preventDefault(),f(Me({id:j.id,data:{default_payment_method:D}})),_()},N=c=>{const O=c==null?void 0:c.card.brand,M=c==null?void 0:c.card.last4;return e.jsxs(e.Fragment,{children:[e.jsx(he,{brand:O})," ",e.jsxs("strong",{children:["···· ",M]})]})};return e.jsx("div",{children:e.jsx(Ie,{"aria-labelledby":"transition-modal-title","aria-describedby":"transition-modal-description",className:r.modal,open:x,onClose:_,closeAfterTransition:!0,BackdropComponent:De,BackdropProps:{timeout:500},children:e.jsx(Ee,{in:x,children:e.jsx("div",{className:r.paper,children:e.jsxs("div",{className:"pt-10",children:[e.jsx(ke,{variant:"h6",component:"h2",children:"Change payment method"}),e.jsx("div",{className:"pt-30",children:e.jsxs($e,{variant:"outlined",className:r.formControl,children:[e.jsx(Xe,{id:"demo-simple-select-outlined-label",children:"Payment Method"}),e.jsx(Ze,{labelId:"demo-simple-select-outlined-label",id:"demo-simple-select-outlined",value:D,name:"paymentMethod",onChange:k,label:"Payment Method",children:y.map(c=>e.jsx(Ne,{value:c.id,children:N(c)},c.id))})]})}),e.jsxs("div",{className:"pt-30 d-flex-between",children:[e.jsx(J,{variant:"contained",style:{background:"green",color:"white"},className:"text-unset",onClick:B,children:"Confirm"}),e.jsx(J,{variant:"contained",onClick:_,className:"text-unset",children:"Cancel"})]})]})})})})})},lt=()=>{const o=Qe(),r=fe(),f=h(t=>t.subscription.isCanceled),m=h(t=>t.subscription.fetching),u=h(t=>t.subscription.isUpdated),x=h(Ae),I=h(t=>t.subscription.fetchingLicenses),j=h(He),v=h(Ve),y=h(me),[C,D]=i.useState([]),[E,S]=i.useState([]),[_,k]=i.useState(!1),[B,N]=i.useState(null),[c,O]=i.useState(null),[M,ge]=i.useState(!1),[Y,xe]=i.useState([]),[z]=i.useState(()=>new URLSearchParams(window.location.search).get("subscribeSuccess"));i.useEffect(()=>{if(r(W()),r(qe()),r(Te()),r(Ue()),z){K.capture("purchase_complete",{session_id:z,...Be()});const t=new URL(window.location.href);t.searchParams.delete("subscribeSuccess"),window.history.replaceState({},"",t.toString())}},[]),i.useEffect(()=>{x&&D(x)},[x]),i.useEffect(()=>{j&&(console.log("licenses",j),xe(j.filter(t=>t.perpetual===!0&&(t.status==="active"||t.status==="incomplete"))))},[j]),i.useEffect(()=>{f&&r(W())},[f]),i.useEffect(()=>{u&&r(W())},[u]),i.useEffect(()=>{y&&S(y)},[y]);const $=async t=>{try{const s=await ze.getInvoice(t);window.open(s.data.hosted_invoice_url,"_blank")}catch(s){console.error(s),r(G({variant:s,message:"Error fetching invoice. Please try again."}))}},je=(t,s)=>{t.preventDefault(),K.capture("cancel_subscription"),k(!0),N({type:"subscription",deleteId:s})},be=()=>{k(!1),N(null)},ve=async(t,s)=>{t.preventDefault();try{const a=await Fe.createCheckoutUpdateSession(s.id);Je(a.data.redirect_url)}catch(a){console.error(a),r(G({variant:a,message:"Error changing payment method. Please try again."}))}},ye=()=>{O(null),ge(!1)},X=t=>new Date(t).toLocaleDateString(),Z=t=>{var p,q;let s=0;for(const g of t.items.data)s+=g.price.unit_amount*g.quantity;if(t.discounts&&t.discounts.length>0)for(const g of t.discounts)if(g.coupon.percent_off)if(g.coupon.percent_off===100){s=0;break}else s=s*(g.coupon.percent_off/100);else g.coupon.amount_off&&(s=s-g.coupon.amount_off);const a=s/100,l=((p=t.items)==null?void 0:p.currency)||t.items.data[0].plan.currency,d=((q=t.plan)==null?void 0:q.interval)||t.items.data[0].plan.interval;
1return a.toLocaleString()+" "+l.toUpperCase()+"/"+d+(t.status==="trialing"?" after trial":"")},Ce=()=>"Tax excluded, see invoice for details",Se=t=>{if(!v)return"";const s=v.find(a=>a.id===t);return(s==null?void 0:s.name)||""},_e=t=>{var d,p;const s=E.filter(q=>q.id===t),a=(d=s[0])==null?void 0:d.card.brand,l=(p=s[0])==null?void 0:p.card.last4;return e.jsxs(e.Fragment,{children:[l&&e.jsx(he,{brand:a})," ",e.jsxs("strong",{children:[" ",l&&"···· ",l||"No card"]})]})},Le=t=>t.reduce((a,l)=>{const d=l.subId||"Unknown";a[d]||(a[d]={});const p=l.productName;return a[d][p]||(a[d][p]={productName:p,licenses:[],count:0}),a[d][p].licenses.push(l),a[d][p].count+=1,a},{}),F=new URLSearchParams(window.location.search),Pe=z;let b;return Pe&&(b=e.jsxs(Ke,{severity:"success",title:"Success!",children:["Subscription successfully added to your account. Next up would be the ",e.jsx("a",{href:"/download",children:"downloads"})," ","section, and there's also documentation available under Products. For any technical issues or questions, please contact us at ",e.jsx("a",{href:"mailto:[email protected]",children:"[email protected]"}),"."]})),F.get("subscribeCancel")&&(b=e.jsxs("div",{style:{backgroundColor:"#fee",padding:16,border:"1px solid #faa",borderRadius:6},children:[e.jsx("div",{style:{fontSize:20,fontWeight:"bold"},children:"Error from payment processor"}),e.jsxs("div",{style:{paddingTop:10},children:["Are you sure your payment method are valid? Please try again, and with another payment card. If you're stuck, don't hesitate to reach out to ",e.jsx("a",{href:"[email protected]",children:"[email protected]"}),", and we'll figure it out!"]})]})),F.get("updateSuccess")&&(b=e.jsx("div",{style:{backgroundColor:"#efe",padding:16,border:"1px solid #aca",borderRadius:6},children:e.jsx("div",{style:{},children:"Subscription details updated successfully"})})),F.get("updateCancel")&&(b=e.jsx("div",{style:{backgroundColor:"#fee",padding:16,border:"1px solid #faa",borderRadius:6},children:e.jsx("div",{style:{fontWeight:"bold"},children:"Error updating subscription details"})})),e.jsxs("div",{className:o.root,children:[e.jsx(ee,{children:"Subscriptions"}),m||I?e.jsx(Oe,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{children:C.length===0?e.jsxs("div",{style:{padding:16,backgroundColor:"#f0f0f0",color:"#444",marginTop:16,borderRadius:8},children:["You don't have any subscriptions to manage. Check out our options on the"," ",e.jsx("a",{href:"/products",children:"products page"}),"."]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Complete overview of your Bitfocus subscriptions."}),b&&e.jsx("div",{children:b}),e.jsx(te,{component:Q,className:"mt-30",children:e.jsxs(se,{className:o.table,children:[e.jsx(ne,{children:e.jsxs(U,{children:[e.jsx(n,{align:"left",children:"Product"}),e.jsx(n,{align:"left",children:"Price/Period"}),e.jsx(n,{align:"left",children:"Status"}),e.jsx(n,{align:"left",children:"Next invoice"}),e.jsx(n,{align:"left",children:"Card"}),e.jsx(n,{align:"left",children:"Reference"}),e.jsx(n,{align:"center"})]})}),e.jsx(ae,{children:(C||[]).map(t=>e.jsxs(U,{children:[e.jsx(n,{align:"left",children:t.items.data.map((s,a)=>e.jsxs("div",{children:[s.quantity>1&&e.jsxs("span",{children:[s.quantity," x "]}),Se(s.plan.product),a<t.items.data.length-1&&e.jsx(re,{style:{margin:"4px 0"}})]},s.id))}),e.jsxs(n,{align:"left",children:[e.jsx("span",{children:Z(t)})," ",e.jsx("br",{}),Z(t)!=="0 USD/month"&&e.jsx("span",{style:{fontSize:12,color:"gray"},children:Ce()})]}),e.jsx(n,{align:"left",children:e.jsx(ie,{label:t.cancel_at_period_end?"Cancels at "+X(t.items.data[0].current_period_end*1e3):t.status,color:"primary",style:{textTransform:"capitalize",backgroundColor:t.cancel_at_period_end?"rgb(200,100,60)":"rgb(60,200,60)"}})}),e.jsx(n,{align:"left",children:t.cancel_at_period_end?"Never":X(t.items.data[0].current_period_end*1e3)}),e.jsx(n,{align:"left",children:_e(t.default_payment_method)}),e.jsx(n,{style:{fontSize:10},children:t.id}),e.jsx(n,{align:"left",children:e.jsxs("div",{className:"d-flex",children:[e.jsx(T,{title:"View invoice",onClick:()=>$(t.latest_invoice),children:e.jsx(de,{color:"primary"})}),e.jsx(T,{title:"Change payment method",onClick:s=>ve(s,t),children:e.jsx(tt,{color:"primary"})}),e.jsx(T,{onClick:s=>je(s,t.id),title:t.cancel_at_period_end?"Undo":"Cancel",children:t.cancel_at_period_end?e.jsx(nt,{color:"primary"}):e.jsx(We,{color:"secondary"})})]})})]},t.id))})]})})]})}),e.jsxs("div",{style:{paddingTop:32},children:[e.jsx(ee,{children:"Purchased Products"}),Y.length>0?e.jsx(te,{component:Q,className:"mt-30",children:e.jsxs(se,{className:o.table,children:[e.jsx(ne,{children:e.jsxs(U,{children:[e.jsx(n,{align:"left",children:"Products"}),e.jsx(n,{align:"left",children:"Status"}),e.jsx(n,{align:"left",children:"Reference"}),e.jsx(n,{align:"center"})]})}),e.jsx(ae,{children:Object.entries(Le(Y)).map(([t,s])=>e.jsxs(U,{children:[e.jsx(n,{align:"left",children:Object.values(s).map((a,l)=>e.jsxs("div",{children:[a.count>1?"".concat(a.count,"x "):"",a.productName,l<Object.values(s).length-1&&e.jsx(re,{style:{margin:"4px 0"}})]},a.productName))}),e.jsx(n,{align:"left",children:(()=>{var d;const a=Object.values(s)[0],l=((d=a==null?void 0:a.licenses[0])==null?void 0:d.status)||"unknown";return e.jsx(ie,{label:l,color:"primary",style:{textTransform:"capitalize",backgroundColor:l==="active"?"rgb(60,200,60)":"rgb(200,100,60)"}})})()}),e.jsx(n,{style:{fontSize:10},children:t}),e.jsx(n,{align:"left",children:e.jsx("div",{className:"d-flex",children:e.jsx(T,{title:"View invoice",onClick:()=>$(t),children:e.jsx(de,{color:"primary"})})})})]},t))})]})}):e.jsxs("div",{style:{padding:16,backgroundColor:"#f0f0f0",color:"#444",marginTop:16,borderRadius:8},children:["You don't have any perpetual licenses. They are available for purchase"," ",e.jsx("a",{href:"/purchase/buttons",children:"here"}),"."]})]})]}),e.jsx(we,{modalOpen:_,modalData:B,deleteClosed:be}),M&&e.jsx(ct,{modalOpen:M,modalData:c,editClosed:ye})]})},kt=Ye(lt);export{kt 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.