PageSourceSearch

https://tuforums.com/assets/BillingPage.BykWcP_t.js

js tuforums.com collected 2026-10-02 00:57:54 UTC 7,969 bytes, 1 lines download raw bytes

1import{bD as o,a as I,r as T,j as e,z as K,e as $,cD as G}from"./index.C_jEAofg.js";import{r as p,L as Y}from"./reactRouter.C6cvQAHO.js";import{b as q,a as J,c as Q,f as B,d as A,e as W,i as X,g as Z,h as ee,p as le,u as se,B as ie}from"./billingPage.DjrRZhPq.js";import{C as te}from"./CopyIcon.CPWoIfTs.js";import{u as L}from"./i18n.BxWiIRpk.js";import"./recharts.DzmhKP_O.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};i.SENTRY_RELEASE={id:"aec9389561908f1f1b5366362ca3b629220ab900"},i._sentryModuleMetadata=i._sentryModuleMetadata||{},i._sentryModuleMetadata[new i.Error().stack]=function(l){for(var d=1;d<arguments.length;d++){var a=arguments[d];if(a!=null)for(var s in a)a.hasOwnProperty(s)&&(l[s]=a[s])}return l}({},i._sentryModuleMetadata[new i.Error().stack],{"_sentryBundlerPluginAppKey:tuf-website":!0});var c=new i.Error().stack;c&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[c]="2b12d782-7cf1-46f6-a22a-0b2deddf6e61",i._sentryDebugIdIdentifier="sentry-dbid-2b12d782-7cf1-46f6-a22a-0b2deddf6e61")}catch{}})();function ne({events:i,onAfterRefund:c}){var R,w,E,k,D,P;const{t:l,i18n:d}=L("pages"),a=d.language||void 0,[s,f]=p.useState(null),[g,y]=p.useState(!1),j=p.useCallback(async t=>{const r=q(t,l);try{await navigator.clipboard.writeText(r),o.success(l("billing.history.copySupportDone"))}catch{o.error(l("billing.history.copySupportFail",{defaultValue:"Could not copy."}))}},[l]),N=p.useCallback(async t=>{var b,u,m;const r=o.loading(l("billing.history.refundLoadingPreview"));try{const{data:n}=await I.get(T.billingV3.stripe.refundPreview(),{params:{billingEventId:t.id}});if(o.dismiss(r),!(n!=null&&n.eligible)){const x=J(n==null?void 0:n.reasonCode,l);o.error(x||l("billing.history.refundErrors.REFUND_NOT_ELIGIBLE"));return}f({ev:t,preview:n})}catch(n){o.dismiss(r),o.error(((m=(u=(b=n==null?void 0:n.response)==null?void 0:b.data)==null?void 0:u.error)==null?void 0:m.message)||l("billing.history.refundErrors.STRIPE_ERROR"))}},[l]),S=p.useCallback(()=>{g||f(null)},[g]),F=p.useCallback(async()=>{var t,r,b,u,m,n,x;if((t=s==null?void 0:s.ev)!=null&&t.id){y(!0);try{await I.post(T.billingV3.stripe.refund(),{billingEventId:s.ev.id}),o.success(l("billing.history.refundSuccess")),f(null),typeof c=="function"&&await c()}catch(h){const M=(u=(b=(r=h==null?void 0:h.response)==null?void 0:r.data)==null?void 0:b.error)==null?void 0:u.code,z=Q(M,l),H=((x=(n=(m=h==null?void 0:h.response)==null?void 0:m.data)==null?void 0:n.error)==null?void 0:x.message)||l("billing.history.refundErrors.STRIPE_ERROR");o.error(z||H)}finally{y(!1)}}},[s,l,c]);if(!i.length)return null;const _=(R=s==null?void 0:s.preview)==null?void 0:R.listUsdPerMonth,U=((w=s==null?void 0:s.preview)==null?void 0:w.maxRefundAgeDays)??180,v=((E=s==null?void 0:s.preview)==null?void 0:E.currency)||"USD",C=B((k=s==null?void 0:s.preview)==null?void 0:k.refundCents,v,a),V=B((D=s==null?void 0:s.preview)==null?void 0:D.listChargeCents,v,a),O=_!=null&&Number.isFinite(Number(_))?A(Number(_),v,a)||`USD ${_}`:"";return e.jsxs("section",{className:"billing-page__card","aria-labelledby":"billing-history-heading",children:[e.jsx("div",{className:"billing-page__section-head",children:e.jsx("h3",{id:"billing-history-heading",className:"billing-page__card-title",children:l("billing.history.title")})}),e.jsx("div",{className:"billing-page__history-table-wrap",role:"region","aria-label":l("billing.history.title"),children:e.jsxs("table",{className:"billing-page__history-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:l("billing.history.cols.date")}),e.jsx("th",{scope:"col",children:l("billing.history.cols.event")}),e.jsx("th",{scope:"col",children:l("billing.history.cols.status")}),e.jsx("th",{scope:"col",className:"billing-page__col--right",children:l("billing.history.cols.amount")}),e.jsx("th",{scope:"col",className:"billing-page__col--actions",children:l("billing.history.cols.actions")})]})}),e.jsx("tbody",{children:i.map(t=>{const r=A(t.amount,t.currency,a),b=W(t.product,l),u=X(t);return e.jsxs("tr",{children:[e.jsx("td",{children:Z(t.createdAt,a)}),e.jsx("td",{children:e.jsxs("div",{className:"billing-page__event-cell-stack",children:[e.jsx("span",{className:"billing-page__event-type-label",children:ee(t,l)}),b?e.jsx("span",{className:"billing-page__event-product-detail",children:b}):null]})}),e.jsx("td",{children:e.jsx("span",{className:`billing-page__event-status billing-page__event-status--${t.status}`,children:le(t.status,l)})}),e.jsx("td",{className:"billing-page__col--right",children:r||"—"}),e.jsx("td",{className:"billing-page__col--actions",children:e.jsxs("div",{className:"billing-page__history-actions",children:[e.jsx("button",{type:"button",className:"btn-fill-ghost btn-icon btn-sm billing-page__history-icon-btn",onClick:()=>
1j(t),"aria-label":l("billing.history.copyDetailsAria"),children:e.jsx(te,{color:"currentColor",size:20,"aria-hidden":!0})}),u?e.jsx("button",{type:"button",className:"btn-fill-ghost billing-page__history-refund-btn",onClick:()=>N(t),children:l("billing.history.refundButton")}):null]})})]},t.id)})})]})}),s?e.jsxs(K,{onClose:S,closeDisabled:g,overlayClassName:"billing-page__overlay",panelClassName:"billing-page__modal",ariaLabelledBy:"billing-refund-modal-title",children:[e.jsx("h4",{id:"billing-refund-modal-title",className:"billing-page__modal-title",children:l("billing.history.refundConfirmTitle")}),e.jsx("p",{className:"billing-page__modal-text",children:l("billing.history.refundPolicy180",{days:U})}),e.jsx("p",{className:"billing-page__modal-text",children:((P=s.preview)==null?void 0:P.mode)==="partial"?l("billing.history.refundPartialBody",{listRate:O,listCharge:V||"—",refund:C||"—"}):l("billing.history.refundFullBody",{refund:C||"—"})}),e.jsxs("div",{className:"billing-page__modal-actions",children:[e.jsx("button",{type:"button",className:"btn-fill-ghost",onClick:S,disabled:g,children:l("billing.history.refundCancel")}),e.jsx("button",{type:"button",className:"btn-fill-primary",onClick:F,disabled:g,children:l(g?"billing.history.refundSubmitting":"billing.history.refundConfirm")})]})]}):null]})}const be=()=>{const{t:i}=L(["pages","common"]),{user:c}=$(),l=se({loadEvents:!0}),{loading:d,errorState:a,fetchAll:s,accessPillKey:f,accessActive:g,accessExpiresAt:y,purchaseFundedRemainingMs:j,accessSegments:N}=l;return d&&!l.billingState?e.jsx("div",{className:"settings-sub-page settings-sub-page--centered billing-page",children:e.jsx("div",{className:"loader-shell loader-shell--tall",children:e.jsx("div",{className:"loader loader-relative"})})}):e.jsxs("div",{className:"settings-sub-page billing-page",children:[e.jsxs("header",{className:"billing-page__header billing-page__header--toolbar",children:[e.jsx("div",{className:"billing-page__header-text",children:e.jsx("h2",{className:"settings-sub-page__title billing-page__title",children:i("billing.pages.billingTitle")})}),e.jsx("button",{type:"button",className:"btn-fill-ghost",onClick:()=>s({forceRefresh:!0}),disabled:d,children:i("billing.actions.refreshPage")})]}),a?e.jsxs("div",{className:"billing-page__card billing-page__card--error",children:[e.jsx("p",{className:"settings-sub-page__text",children:i("billing.loadError")}),e.jsx("button",{type:"button",className:"btn-fill-glass",onClick:()=>s({forceRefresh:!0}),children:i("billing.actions.retry",{defaultValue:i("buttons.retry",{ns:"common",defaultValue:"Retry"})})})]}):null,G(c)?e.jsx("nav",{className:"billing-page__cross-links","aria-label":i("billing.crossLinks.navAria"),children:e.jsx(Y,{className:"btn-fill-ghost billing-page__cross-link",to:"/tuf-stellar",children:i("billing.crossLinks.manageTufStellar")})}):null,e.jsx(ie,{accessPillKey:f,accessActive:g,accessExpiresAt:y,purchaseFundedRemainingMs:j,accessSegments:N}),e.jsx(ne,{events:l.events,onAfterRefund:()=>s({forceRefresh:!0})})]})};export{be 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.