1import{cl as S,j as e,bL as b,e1 as $,r as c,bV as G}from"./vendor-ct_YKIP6_bundle.js";import{F as p,T as x,df as B,a8 as V,H as C,d as L,l as R,aa as Y,t as y,A as m,G as _,a4 as K,ab as X,g as Z}from"./registration-BfOA5mCx_bundle.js";import{a3 as J,u as ee,C as te}from"./slackIntegration-mZcBTumD_bundle.js";import{S as se}from"./index-XK-459JR_bundle.js";import"./moment-DyvZl3Ud_bundle.js";import{i8 as P,i9 as D,ia as t,ib as z,ic as ae,id as ne,as as oe,T as ie,ie as re,w as de,ig as ce,ih as ue,ii as le,ij as Q,ik as pe,il as U,aY as he,aK as ge,aL as O,aZ as H}from"./index-BiagCLbs_bundle.js";import{S as Re}from"./cta-button-add-BSp80i2O_bundle.js";import"./sentry-DLDmuXKN_bundle.js";import"./datadog-DxmyjtSX_bundle.js";import"./manage-team-DdoqA3xP_bundle.js";import"./list-dUheq_Ar_bundle.js";import"./stripe-BA7RN6Z4_bundle.js";import"./speedboat-vendor-DBIVks5t_bundle.js";const me=({activePanel:s})=>{const{t:a}=S(),{showCreateCustomReasonModal:u}=P(s),{isMaxAllCustomReasonsLimitReached:i}=D();return e.jsxs(J.DefaultHeader,{offsets:{pt:32},children:[e.jsxs(p,{justifyContent:"space-between",children:[e.jsx(x,{neutral700:!0,size:"32px",weight:600,children:a("transaction_reasons.title")}),e.jsx(B,{content:a("transaction_reasons.tooltips.max_limit_reached"),forceHidden:!i,placement:"bottom",width:"220px",children:e.jsx(V,{iconWithSpinner:!0,"data-testid":"add-custom-reason-button",disabled:i,disableStyleType:"semitransparentBrandCTA",icon:Re,styleType:"brandPrimaryCTA",type:"button",onClick:()=>u("main red button"),children:a("transaction_reasons.add_reason")})})]}),e.jsx(C,{right:200,top:4,children:e.jsx(x,{neutral500:!0,size:"14px",children:a("transaction_reasons.subheading")})})]})},xe=b.div.withConfig({displayName:"ui__RequireReasonContainer"})(["display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;width:100%;padding:16px 24px;background-color:",";border-radius:12px;"],({theme:s})=>s.bg.white),Te={[t.Move]:{get title(){return y("transaction_reasons.require_reason.move.title")},get description(){return y("transaction_reasons.require_reason.move.description")}},[t.UpdateQuantity]:{get title(){return y("transaction_reasons.require_reason.qty_update.title")},get description(){return y("transaction_reasons.require_reason.qty_update.description")}}},k=({reasonType:s})=>{const{title:a,description:u}=Te[s],i=L(),g=R(o=>o.reasonOptions?.settings?.[s]),n=o=>{const d=o.target.checked;i({type:m.UPDATE_TRANSACTION_REASONS_SETTINGS_REQUEST,payload:{settings:{actionType:s,required:d}}}),_.toggleRequireReason({enabled:d,tab:z(s)})};return e.jsxs(xe,{children:[e.jsxs(p,{column:!0,gap:4,children:[e.jsx(x,{neutral800:!0,size:"14px",weight:500,children:a}),e.jsx(x,{neutral500:!0,size:"14px",weight:400,children:u})]}),e.jsx(Y,{checkboxType:"switcher",checked:g?.required,name:`${s}-required`,"data-testid":`${s}-required-checkbox`,portalAnchor:"#page-content-wrapper",onChange:n})]})},ye=b.div.withConfig({displayName:"ui__TableWrapper"})(["position:relative;"]),Ce=b.div.withConfig({displayName:"ui__AddFieldRow"})(["display:flex;align-items:center;background-color:",";border-top:1px solid ",";border-radius:0 0 8px 8px;height:66px;padding:12px 40px;"],s=>s.theme.bg.white,s=>s.theme.delimiter.neutral100),be=b(p).withConfig({displayName:"ui__AddIcon"})(["width:40px;height:40px;border:1px dashed ",";border-radius:50%;margin-right:16px;flex-shrink:0;"],({theme:s})=>s.text.neutral200),I=({isAddReasonDisabled:s,reasonType:a})=>{const{t:u}=S(),{showNotifications:i,notificationHeight:g}=ee(),n=$(),{data:o,columns:d}=ae({reasonType:a}),{showCreateCustomReasonModal:h}=P(a),T=c.useMemo(()=>ne(n.height,i,g),[g,i,n.height]);return e.jsxs(ye,{children:[e.jsx(oe,{selectMode:"transactionReasons",children:e.jsx(ie,{preventHorizontalOverflow:!0,$tableStyles:{curvedCorners:!0},columns:d,data:o,mode:"transactionReasons",height:T,rowHeight:re,requestPageMeta:{reasonType:a},source:"transactionReasons"})}),e.jsx(Ce,{children:e.jsx(K,{when:!s,children:e.jsx("button",{"data-testid":"add-custom-reason-button",type:"button",onClick:()=>
1h("+ icon"),children:e.jsxs(p,{alignItems:"center",children:[e.jsx(be,{center:!0,children:e.jsx(de,{})}),e.jsx(x,{medium:!0,neutral500:!0,children:u("transaction_reasons.add_custom_reason")})]})})})})]})},Oe=()=>{const{t:s}=S(),a=L(),u=G(),[i,g]=c.useState(t.Move),n=R(ce),o=R(ue),d=R(l=>l.reasonOptions?.settings?.[t.Move]),h=R(l=>l.reasonOptions?.settings?.[t.UpdateQuantity]),{fetchTransactionReasons:T}=X(),F=c.useCallback(l=>{g(l),_.switchTabCustomReasons({tab:z(l),requireMoveReasonEnabled:!!d?.required,requireUpdateQtyReasonEnabled:!!h?.required,moveReasonsCount:n.length,qtyReasonsCount:o.length})},[d,h,n,o]);c.useEffect(()=>{a({type:m.FETCH_TRANSACTION_REASONS_REQUEST,payload:{actionType:t.Move}}),a({type:m.FETCH_TRANSACTION_REASONS_REQUEST,payload:{actionType:t.UpdateQuantity}}),a({type:m.FETCH_TRANSACTION_REASONS_SETTINGS_REQUEST,payload:{actionType:t.Move}}),a({type:m.FETCH_TRANSACTION_REASONS_SETTINGS_REQUEST,payload:{actionType:t.UpdateQuantity}})},[]);const f=c.useRef(!1),v=c.useMemo(()=>u.state?.source??le.Settings,[u.state]);c.useEffect(()=>{if(f.current||n.length===0||!d||!h||T)return;f.current=!0;const l=n.filter(r=>r.isHidden),W=o.filter(r=>r.isHidden),q=n.filter(r=>r.origin===Q.Custom),N=o.filter(r=>r.origin===Q.Custom);_.viewedTransactionReasonsPage({source:v,customReasonsLimitsReached:pe(q.length>=U,N.length>=U),moveReasonsCount:n.length,qtyReasonsCount:o.length,hasDefaultMoveReason:n.some(r=>r.isDefault),hasDefaultQtyReason:o.some(r=>r.isDefault),requireMoveReasonEnabled:!!d?.required,requireUpdateQtyReasonEnabled:!!h?.required,hiddenMoveReasonsCount:l.length,hiddenQtyReasonsCount:W.length,hasCustomMoveReason:q.length>0,hasCustomQtyReason:N.length>0})},[n,o,d,h,T,v]);const{isMaxMoveCustomReasonsLimitReached:j,isMaxUpdateQuantityCustomReasonsLimitReached:A}=D(),E=c.useMemo(()=>i===t.Move?j:A,[j,A,i]),{userStorage:M,updateUserStorage:w}=Z();return c.useEffect(()=>{M?.skipTransactionReasonsRouteNewTag||w({skipTransactionReasonsRouteNewTag:!0})},[M,w]),e.jsx(te,{$greyBg:!0,children:e.jsxs(p,{children:[e.jsx(se,{active:"transaction-reasons"}),e.jsxs(p,{column:!0,fullWidth:!0,children:[e.jsx(me,{activePanel:i}),e.jsx(C,{horizontal:40,children:e.jsxs(he,{currentValue:i,onValueChange:F,children:[e.jsxs(ge,{children:[e.jsx(O,{"data-testid":`${t.Move}-tab`,value:t.Move,children:s("transaction_reasons.move_reasons")}),e.jsx(O,{"data-testid":`${t.UpdateQuantity}-tab`,value:t.UpdateQuantity,children:s("transaction_reasons.qty_update_reasons")})]}),e.jsx(H,{"data-testid":`${t.Move}-content`,value:t.Move,children:e.jsx(C,{vertical:16,children:e.jsxs(p,{column:!0,gap:16,children:[e.jsx(k,{reasonType:t.Move}),e.jsx(I,{isAddReasonDisabled:E,reasonType:t.Move})]})})}),e.jsx(H,{"data-testid":`${t.UpdateQuantity}-content`,value:t.UpdateQuantity,children:e.jsx(C,{vertical:16,children:e.jsxs(p,{column:!0,gap:16,children:[e.jsx(k,{reasonType:t.UpdateQuantity}),e.jsx(I,{isAddReasonDisabled:E,reasonType:t.UpdateQuantity})]})})})]})})]})]})})};export{Oe as default}; 2//# sourceMappingURL=index-BbXeB3sI_bundle.js.map
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.