PageSourceSearch

https://prophit.ai/assets/SalesTaxReturnsCenter-320yqouE.js

js prophit.ai collected 2026-10-05 13:06:29 UTC 65,803 bytes, 2 lines download raw bytes

1import{r as c,b as Te,j as e,L as Xe,g as P,ag as H,C as Ve,e as He,m as Ke,d as Ze,ah as Ne,ai as re}from"./index-C5qvHg02.js";import{I as Re,A as Qe,M as et,a as tt,C as st,F as at,n as $e,b as Oe,c as Pe,d as nt,e as it}from"./AzTptRegionEditor-D_TSuZi2.js";import{T as rt,n as ct,a as lt}from"./TxSourcingEditor-Byj5DpsL.js";import{M as We}from"./MarketplaceOperationsPanel-BJrGicSk.js";import{W as ot}from"./WorkflowRolesConfig-BcceXtAF.js";/* empty css                  *//* empty css                       *//* empty css                                 */import"./marketplaceApi-9bQgbLxj.js";const dt={submitted:{label:"In review",pill:"strc-status-pill--info"},review_complete:{label:"Awaiting approval",pill:"strc-status-pill--ready"},approved:{label:"Approved · locked",pill:"strc-status-pill--success"},rejected:{label:"Changes requested",pill:"strc-status-pill--warning"}},ut=({packageId:d,onChanged:h})=>{const[j,O]=c.useState(null),[N,f]=c.useState(!1),[A,q]=c.useState(null),[p,x]=c.useState(null),[W,_]=c.useState(""),I=c.useCallback(async()=>{try{const E=await Te.get(`/api/workflow/returns/${d}/state`);O(E.data)}catch{O(null)}},[d]);c.useEffect(()=>{I()},[I]);const M=async(E,B)=>{f(!0),q(null);try{await Te.post(`/api/workflow/returns/${d}/${E}`,B??{}),x(null),_(""),await I(),h?.()}catch(U){q(P(U,"The workflow action failed"))}finally{f(!1)}};if(!j)return null;const v=j.review,L=v?.status??null,R=L?dt[L]:null;return e.jsxs("section",{className:"strc-drawer-section","aria-label":"Review and approval workflow","data-testid":"wf-status-panel",children:[e.jsx("h3",{className:"spc-drawer__section-title",children:"Review & approval"}),e.jsxs("p",{className:"spc-drawer__note",children:[R?e.jsx("span",{className:`strc-status-pill ${R.pill}`,children:R.label}):e.jsx("span",{className:"strc-status-pill strc-status-pill--muted",children:"Not submitted for review"}),v?.rejection_reason&&L==="rejected"&&e.jsxs("span",{className:"spc-cell-sub-block strc-cell-sub",children:["Reason: ",v.rejection_reason]})]}),Object.keys(j.assignments).length>0&&e.jsx("p",{className:"spc-drawer__note","data-testid":"wf-assignments",children:["preparer","reviewer","approver"].map(E=>e.jsxs("span",{className:"spc-cell-sub-block strc-cell-sub",children:[E[0].toUpperCase()+E.slice(1),": ",j.assignments[E]?.user_label??"unassigned"," ","(",(j.assignments[E]?.source_scope??"unassigned").replaceAll("_"," "),")"]},E))}),A&&e.jsx("p",{className:"spc-drawer__error",role:"alert",children:A}),e.jsxs("div",{className:"spc-review-actions",children:[(L==null||L==="rejected")&&!j.is_locked&&e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--secondary",disabled:N,onClick:()=>{M("submit-for-review")},"data-testid":"wf-submit",children:L==="rejected"?"Resubmit for review":"Submit for review"}),L==="submitted"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--primary",disabled:N,onClick:()=>{M("complete-review")},title:"Gated: validation clean, marketplace responsibility resolved, no open material variances","data-testid":"wf-complete-review",children:"Complete review"}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--secondary",disabled:N,onClick:()=>x("request_changes"),children:"Request changes"})]}),L==="review_complete"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--primary",disabled:N,onClick:()=>{M("approve")},title:j.caller.is_assigned_approver?"You are the assigned approver":"Only the assigned approver or an org admin can approve","data-testid":"wf-approve",children:"Approve & lock"}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--secondary",disabled:N,onClick:()=>x("request_changes"),children:"Request changes"})]}),L==="approved"&&j.caller.is_org_admin&&e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--secondary",disabled:N,onClick:()=>x("invalidate"),title:"Unlock for material correction — requires re-review and reapproval","data-testid":"wf-invalidate",children:"Invalidate approval"}),v?.reconciliation_run_id!=null&&e.jsx(Xe,{className:"returns-center-button returns-center-button--secondary",to:"/reconciliation",title:`Tick-and-tie run #${v.reconciliation_run_id} in the Reconciliation module`,children:"Open tick-and-tie run"})]}),p!=null&&e.jsxs("div",{className:"spc-drawer__changes",children:[e.jsxs("label",{className:"spc-drawer__label",children:[p==="invalidate"?"Why is the approved version no longer valid?":"What must the preparer fix?",e.jsx("textarea",{className:"strc-select spc-drawer__textarea",rows:2,value:W,onChange:E=>_(E.target.value)})]}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--primary",disabled:N||!W.trim(),onClick:()=>{M(p==="invalidate"?"invalidate-approval":"request-changes",{reason:W.trim()})},children:p==="invalidate"?"Invalidate approval":"Send back to preparer"})]}),e.jsx("p",{className:"strc-cell-sub",children:"Approval locks the reviewed figures. Nothing is transmitted or remitted by preparing, reviewing, or approving."})]})},_t={portal_upload:"Portal upload file",direct_efile:"Direct e-file",portal_keying_worksheet:"Portal-entry worksheet",paper_pdf:"Paper / PDF package"},pt=["paper_pdf","portal_keying_worksheet","portal_upload","direct_efile"],mt={Ready:"ready",Pilot:"warning","Needs account info":"warning","Needs channel review":"warning","Needs taxpayer info":"warning","Needs portal credential":"warning","Waiting on state approval":"info","Reference only":"muted","Not supported by state":"muted","Not available":"muted","Verification needed":"muted","No return required":"info"},De={ok:{label:"OK",variant:"ready"},warning:{label:"Attention",variant:"warning"},blocked:{label:"Blocked",variant:"danger"},unknown:{label:"Unknown",variant:"muted"},not_applicable:{label:"N/A",variant:"muted"}},Me={ok:{label:"Ready to file",variant:"ready"},warning:{label:"Needs attention",variant:"warning"},blocked:{label:"Blocked",variant:"danger"},unknown:{label:"Partially evaluated",variant:"muted"},not_applicable:{label:"Not supported",variant:"muted"}},ht=[{key:"missing_identity",title:"Business identity (legal name, address, FEIN, contact)"},{key:"marketplace_configuration",title:"Marketplace account, return & evidence"},{key:"missing_credentials",title:"Account & credentials"},{key:"missing_transaction_data",title:"Transaction data"},{key:"missing_situs_rate_data",title:"Jurisdiction & local tax coverage"},{key:"period_source_window_blockers",title:"Filing period & source window"},{key:"maintenance_blockers",title:"Rate/boundary data maintenance"}],ft=["not_started","requested","approved","rejected","unknown"],Se=["account_name","state_tax_account_number","sales_tax_permit_number","filing_frequency","fein"],Le=["marketplace_filing_role","marketplace_separate_account_confirmed","marketplace_separate_return_confirmed","marketplace_non_filing_status_approved","marketplace_configuration_evidence_url","marketplace_facilitator_threshold_exceeded_at","marketplace_facilitator_exception_posture","tn_marketplace_facilitated_location_id","tn_marketplace_own_sales_location_ids"],gt=["marketplace_facilitator_threshold_exceeded_at","marketplace_facilitator_exception_posture","tn_marketplace_facilitated_location_id","tn_marketplace_own_sales_location_ids"],Ce=["ca_purchases_subject_to_use_tax","ca_product_fee_scope_status","ca_product_fee_scope_certified","ca_product_fee_scope_evidence_url"],we=new Set(["az_tpt_locations","co_site_numbers","fl_dr
115_county_code"]),qe=new Set([...Se,...Le,...Ce,...we]),Fe=["fl_software_id","dc_bulk_submitter_id","sst_transmitter_etin","sst_process_type","sst_sstp_id","mn_location_number","va_web_upload_account","va_sftp_moa_signed_date","va_sftp_fixed_ip_allowlisted","va_sftp_access_confirmed"],Be=d=>d==="customer"?"You":d==="engineering"?"Prophit engineering":d==="agency"?"State agency":d,xt=new Set(["add_taxpayer_profile_field","add_state_account_info","add_non_secret_credential_reference"]);function vt({orgId:d,locationId:h,accountKey:j,filingUnitKey:O,packageId:N,state:f,period:A,periodLabel:q,onClose:p,onChanged:x,onGenerate:W}){const[_,I]=c.useState(null),[M,v]=c.useState(null),[L,R]=c.useState(0),[E,B]=c.useState(!1),[U,z]=c.useState(null),[Y,J]=c.useState(!1),[g,G]=c.useState({}),[b,$]=c.useState([]),T=c.useCallback(()=>R(t=>t+1),[]);c.useEffect(()=>{let t=!1;return I(null),v(null),H.getStateReadiness(d,f,A,null,h,j,O,N).then(n=>{t||I(n)}).catch(n=>{t||v(P(n,"Failed to load readiness"))}),()=>{t=!0}},[d,h,j,O,N,f,A,L]),c.useEffect(()=>{let t=!1;return Ve.getFilingSetupFields(f,d,h??void 0,j).then(n=>{if(!t){const i=Array.isArray(n.fields)?n.fields:[],u=new Set(i.map(r=>r.field_key)),o=(Array.isArray(n.state_fields_extra)?n.state_fields_extra:[]).filter(r=>!u.has(r.field_key)).map(r=>({field_key:r.field_key,label:r.label,required:r.requiredness==="required",storage:r.storage==="account_metadata"?"metadata":r.storage,group:"other",data_type:r.data_type||"string",help_text:r.help_text||r.condition||"",current_value:r.current_value,sensitive:r.sensitive,options:r.options??[]}));$([...i,...o])}}).catch(()=>{t||$([])}),()=>{t=!0}},[d,h,j,f,L]),c.useEffect(()=>{const t=n=>{n.key==="Escape"&&p()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[p]);const K=c.useCallback(t=>{const n={};for(const o of Se)n[o]=t?.editable?.[o]??"";const i=t?.editable??{};for(const o of Le){const r=i[o];n[o]=typeof r=="boolean"?r:String(r??"")}for(const o of Ce){const r=i[o];n[o]=typeof r=="boolean"?r:String(r??"")}for(const o of b){if(we.has(o.field_key))continue;const r=i[o.field_key]??o.current_value;n[o.field_key]=typeof r=="boolean"?r:String(r??"")}const u=t?.onboarding??{};n.approval_status=u.approval_status??"",n.agency_case_number=u.agency_case_number??"",n.has_state_approval=!!u.has_state_approval,n.has_portal_account=!!u.has_portal_account;for(const o of Fe)n[o]=u[o]??"";G(n)},[b]);c.useEffect(()=>{if(!Y||b.length===0)return;const t=_?.account?.editable??{};G(n=>{const i={...n};for(const u of b){if(we.has(u.field_key)||u.field_key in i)continue;const o=t[u.field_key]??u.current_value;i[u.field_key]=typeof o=="boolean"?o:String(o??"")}return i})},[_?.account?.editable,Y,b]);const[C,Z]=c.useState([]),[D,X]=c.useState([]),[V,te]=c.useState(Re),[ce,ee]=c.useState([]),[se,le]=c.useState({}),[w,Q]=c.useState([]),[oe,ae]=c.useState(""),[_e,a]=c.useState([]),[l,m]=c.useState([]),S=c.useRef("[]"),pe=c.useRef(""),be=c.useRef("[]"),de=_?.account?.can_edit!==!1,ne=()=>{if(!de){J(!1),z("Ask an organization administrator to update filing account information.");return}if(K(_?.account),f==="MO"){const t=_?.account?.mo_sites;Z(Array.isArray(t)?t:[])}if(f==="IL"){const t=_?.account;X(Array.isArray(t?.il_sites)?t.il_sites:[]),te({...Re,...t?.il_declarations??{}})}if(f==="TX"){const t=_?.account;ee(Array.isArray(t?.tx_outlets)?t.tx_outlets:[]),le(t?.tx_seller_fields??{})}if(f==="CO"){const t=_?.account,n=Array.isArray(t?.co_site_numbers)?t.co_site_numbers:[];Q(n),S.current=JSON.stringify($e(n))}if(f==="FL"){const t=_?.account,n=t?.fl_dr15_county_code??"";ae(n),pe.current=Oe(n),a(Array.isArray(t?.fl_county_code_options)?t.fl_county_code_options:[])}if(f==="AZ"){const t=_?.account,n=Array.isArray(t?.az_tpt_locations)?t.az_tpt_locations:[];m(n),be.current=JSON.stringify(Pe(n))}J(!0),z(null)},k=(t,n)=>G(i=>({...i,[t]:n})),ye=()=>{if(!_)return[];const t=new Set;return(i=>(i??[]).forEach(u=>{u.action_type==="add_non_secret_credential_reference"&&(u.required_fields??[]).forEach(o=>{Fe.includes(o)&&t.add(o)})}))(_.missing_credentials?.items),t.has("sst_transmitter_etin")&&t.add("sst_process_type"),Fe.filter(i=>t.has(i))},me=async()=>
1{if(_){B(!0),v(null),z(null);try{const t=_.account,n=["approval_status","agency_case_number","has_state_approval","has_portal_account",...ye(),...Le,...f==="CA"?Ce:[],...b.filter(r=>r.storage==="metadata"&&!we.has(r.field_key)).map(r=>r.field_key)],i={};for(const r of n){const y=g[r];typeof y=="boolean"?i[r]=y:typeof y=="string"&&y.trim()!==""&&(i[r]=y.trim())}if(f==="TN")for(const r of gt){const y=g[r];i[r]=typeof y=="string"?y.trim():""}if(f==="CA")for(const r of Ce){const y=g[r];i[r]=typeof y=="boolean"?y:String(y??"").trim()}for(const r of b){if(r.storage!=="metadata"||qe.has(r.field_key))continue;const y=g[r.field_key];i[r.field_key]=typeof y=="boolean"?y:String(y??"").trim()}const u={};for(const r of Se){const y=g[r];typeof y=="string"&&y.trim()!==""&&(u[r]=y.trim())}for(const r of b){if(r.storage!=="column"||Se.includes(r.field_key))continue;const y=g[r.field_key];typeof y=="boolean"?u[r.field_key]=y:typeof y=="string"&&y.trim()&&(u[r.field_key]=y.trim())}if(f==="MO"&&(i.mo_sites=nt(C)),f==="IL"){i.il_sites=it(D);for(const[r,y]of Object.entries(V))i[r]=y}if(f==="TX"&&(i.tx_outlets=ct(ce),Object.assign(i,lt(se))),f==="CO"){const r=$e(w);(r.length||JSON.stringify(r)!==S.current)&&(i.co_site_numbers=r)}if(f==="FL"){const r=Oe(oe);(r||r!==pe.current)&&(i.fl_dr15_county_code=r)}if(f==="AZ"){const r=Pe(l);(r.length||JSON.stringify(r)!==be.current)&&(i.az_tpt_locations=r)}const o={state_code:f,account_key:j,...u,...Object.keys(i).length?{account_metadata:i}:{}};t?.profile_id?await H.updateAccountProfile(t.profile_id,o,d,h??void 0,j):await H.createAccountProfile(o,d,h??void 0,j),z("Account information saved."),J(!1),x?.(),T()}catch(t){v(P(t,"Failed to save account information"))}finally{B(!1)}}},he=async()=>{if(!W){ne();return}B(!0),v(null),z(null);try{await W(_?.account?.profile_id??null),z("Package action complete."),T()}catch(t){v(P(t,"Package action failed"))}finally{B(!1)}},Ae=async t=>{if(_?.package_id){B(!0),v(null);try{const{items:n}=await H.listArtifacts(_.package_id,d,h??void 0),i=n.find(o=>o.kind===t)??n[0];if(!i){v("No artifact available to download.");return}const u=String(i.metadata?.filename??`${f}_${i.kind}.pdf`);await H.downloadArtifact(_.package_id,Number(i.id),u,d,h??void 0)}catch(n){v(P(n,"Download failed"))}finally{B(!1)}}},je=t=>{if(t.action==="download_artifact")return void Ae(t.artifact_kind);if(t.action==="generate_package")return void he();if(t.action==="record_onboarding")return ne()},fe=_?Me[_.overall_status]??Me.unknown:null,ge=ye(),xe=_?.account?.onboarding_fields??{},ue=b.filter(t=>!qe.has(t.field_key)),[Ee,ve]=A?.split(":")??[],ke=t=>{const n=de&&t.action_type&&xt.has(t.action_type),i=t.action_type==="generate_package";return e.jsxs("div",{className:`strc-dim__item strc-dim__item--${t.severity}`,children:[e.jsxs("p",{children:[t.message,e.jsx("span",{className:"strc-owner-chip",children:Be(t.owner)})]}),t.next_action&&e.jsxs("div",{className:"strc-dim__action",children:["→ ",t.next_action]}),n&&e.jsx("button",{type:"button",className:"strc-link",onClick:ne,"data-testid":`readiness-action-${t.code}`,children:t.action_label||"Fix now"}),i&&e.jsx("button",{type:"button",className:"strc-link",disabled:E,onClick:()=>{he()},"data-testid":`readiness-action-${t.code}`,children:t.action_label||"Generate"})]},t.code)},s=({title:t,dim:n})=>{const i=De[n.status]??De.unknown;if(n.items.length===0&&(n.status==="ok"||n.status==="not_applicable"))return null;const u=n.items.filter(o=>o.severity!=="info"||n.items.length<=2);return e.jsxs("section",{className:"strc-dim","data-testid":`readiness-dim-${t}`,children:[e.jsxs("div",{className:"strc-dim__head",children:[e.jsx("span",{className:"strc-dim__title",children:t}),e.jsx("span",{className:`strc-status-pill strc-status-pill--${i.variant}`,children:i.label})]}),(u.length>0?u:n.items).map(ke)]})};return e.jsx("div",{className:"strc-drawer-overlay",onClick:p,"data-testid":"readiness-drawer",children:e.jsxs("aside",{className:"strc-drawer",onClick:t=>t.stopPropagation(),role:"dialog","aria-label":`${f} filing readiness`,children:[e.jsxs("header",{className:"strc-drawer__header",children:[e.jsxs("div",{children:[e.jsxs("h2",{children:[f," filing readiness",fe&&e.jsx("span",{className:`strc-status-pill strc-status-pill--${fe.variant}`,style:{marginLeft:10},children:fe.label})]}),e.jsxs("div",{className:"strc-drawer__sub",children:[q??(A?`Period ${A}`:"No period selected — account/lane readiness only"),_?.package_id?` · package #${_.package_id}`:""]})]}),e.jsx("button",{type:"button",className:"strc-drawer__close",onClick:p,children:"Close"})]}),e.jsxs("div",{className:"strc-drawer__body",children:[e.jsx(We,{mode:"filing",orgId:d,stateCode:f,periodStart:Ee,periodEnd:ve,compact:!0}),_?.package_id!=null&&e.jsx(ut,{packageId:_.package_id,onChanged:x}),M&&e.jsx("div",{className:"returns-center-banner returns-center-banner--error",children:M}),U&&e.jsx("div",{className:"returns-center-banner returns-center-banner--success","data-testid":"readiness-save-message",children:U}),!_&&!M&&e.jsx("div",{className:"strc-loading",children:"Evaluating readiness…"}),_&&e.jsxs(e.Fragment,{children:[_.best_next_action&&e.jsxs("div",{className:"strc-drawer__next","data-testid":"readiness-next-action",children:[e.jsxs("div",{className:"strc-drawer__next-label",children:["Next action",e.jsx("span",{className:"strc-owner-chip",children:Be(_.best_next_action.owner)})]}),e.jsx("p",{children:_.best_next_action.next_action})]}),e.jsx("div",{className:"strc-dim__title",style:{marginBottom:4},children:"Filing lanes"}),e.jsx("div",{className:"strc-lane-grid",children:pt.map(t=>{const n=_.lanes.find(r=>r.lane===t);if(!n)return null;const i=mt[n.status_label]??"muted",u=_.primary_lane===t,o=_.lane_actions?.[t];return e.jsxs("div",{className:`strc-lane-card${u?" strc-lane-card--primary":""}`,"data-testid":`readiness-lane-${t}`,children:[e.jsxs("span",{className:"strc-lane-card__name",children:[_t[t]??t,n.artifact_scope==="schedule_import"?" — schedule import only":"",u?" ★":""]}),e.jsx("span",{className:`strc-status-pill strc-status-pill--${i}`,children:n.status_label}),n.warnings.length>0&&e.jsx("span",{className:"strc-lane-card__hint",children:n.warnings[0]}),o&&o.enabled&&o.label&&e.jsx("button",{type:"button",className:"strc-link",disabled:E,onClick:()=>je(o),"data-testid":`readiness-lane-action-${t}`,children:o.label}),o&&o.enabled&&o.artifact_scope==="schedule_import"&&o.note&&e.jsx("span",{className:"strc-lane-card__hint","data-testid":`readiness-lane-schedule-note-${t}`,children:o.note}),o&&o.action==="no_artifact_required"&&o.note&&e.jsx("span",{className:"strc-lane-card__hint","data-testid":`readiness-lane-no-artifact-note-${t}`,children:o.note})]},t)})}),(_.missing_required_fields.length>0||_.account?.profile_id)&&e.jsxs("section",{className:"strc-dim","data-testid":"readiness-dim-taxpayer",children:[e.jsxs("div",{className:"strc-dim__head",children:[e.jsx("span",{className:"strc-dim__title",children:"Taxpayer account info"}),e.jsx("span",{className:`strc-status-pill strc-status-pill--${_.missing_required_fields.length>0?"danger":"ready"}`,children:_.missing_required_fields.length>0?"Blocked":"On file"})]}),_.missing_required_fields.map(t=>e.jsxs("div",{className:"strc-dim__item strc-dim__item--blocker",children:[e.jsxs("p",{children:[t.label,e.jsx("span",{className:"strc-owner-chip",children:"You"})]}),e.jsx("div",{className:"strc-dim__action",children:"→ Add it to the state account profile."})]},t.field_key)),de?e.jsx("button",{type:"button",className:"strc-link",onClick:ne,"data-testid":"readiness-edit-account",children:"Edit account & onboarding info"}):e.jsx("div",{className:"strc-dim__action","data-testid":"readiness-account-admin-required",children:"Ask an organization administrator to update filing account information."})]}),de&&Y&&e.jsxs("section",{className:"strc-dim","data-testid":"readiness-editor",children:[e.jsx("div",{className:"strc-dim__head",children:e.jsx("span",{className:"strc-dim__title",children:"Edit account & onboarding (non-secret only
1)"})}),e.jsxs("div",{className:"strc-modal__form",children:[e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Legal business name"}),e.jsx("input",{className:"strc-input",value:String(g.account_name??""),onChange:t=>k("account_name",t.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"State account/permit number"}),e.jsx("input",{className:"strc-input","data-testid":"editor-account-number",value:String(g.state_tax_account_number??""),onChange:t=>k("state_tax_account_number",t.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Sales tax permit number"}),e.jsx("input",{className:"strc-input",value:String(g.sales_tax_permit_number??""),onChange:t=>k("sales_tax_permit_number",t.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Filing frequency"}),e.jsx("input",{className:"strc-input",value:String(g.filing_frequency??""),onChange:t=>k("filing_frequency",t.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Federal EIN"}),e.jsx("input",{className:"strc-input",value:String(g.fein??""),onChange:t=>k("fein",t.target.value)})]})]}),ue.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"strc-dim__action",style:{marginTop:8},children:[f," filing-profile facts (catalog-defined; no values are inferred):"]}),e.jsx("div",{className:"strc-modal__form","data-testid":"readiness-typed-setup-fields",children:ue.map(t=>{const n=g[t.field_key],i=`${t.label}${t.required?" (required)":" (optional)"}`;return e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:i}),t.data_type==="bool"||t.data_type==="boolean"?e.jsxs("select",{className:"strc-select",value:n===!0?"true":n===!1?"false":"",onChange:u=>k(t.field_key,u.target.value==="true"?!0:u.target.value==="false"?!1:""),children:[e.jsx("option",{value:"",children:"Unresolved"}),e.jsx("option",{value:"true",children:"Yes"}),e.jsx("option",{value:"false",children:"No"})]}):t.data_type==="enum"?e.jsxs("select",{className:"strc-select",value:String(n??""),onChange:u=>k(t.field_key,u.target.value),children:[e.jsx("option",{value:"",children:"Unresolved"}),(t.options??[]).map(u=>e.jsx("option",{value:u,children:u.replaceAll("_"," ")},u))]}):e.jsx("input",{className:"strc-input",type:t.data_type==="decimal"||t.data_type==="integer"?"number":t.data_type==="url"?"url":t.data_type==="date"?"date":"text",min:t.data_type==="decimal"||t.data_type==="integer"?"0":void 0,step:t.data_type==="decimal"?"0.01":t.data_type==="integer"?"1":void 0,value:String(n??""),onChange:u=>k(t.field_key,u.target.value)}),t.help_text&&e.jsx("small",{children:t.help_text})]},t.field_key)})})]}),e.jsx("div",{className:"strc-dim__action",style:{marginTop:8},children:"Marketplace account posture (non-secret confirmations; retain evidence):"}),e.jsxs("div",{className:"strc-modal__form",children:[e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Package filing role"}),e.jsxs("select",{className:"strc-select",value:String(g.marketplace_filing_role||"seller"),onChange:t=>k("marketplace_filing_role",t.target.value),children:[e.jsx("option",{value:"seller",children:"Marketplace seller"}),e.jsx("option",{value:"facilitator",children:"Marketplace facilitator"})]})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Evidence URL"}),e.jsx("input",{className:"strc-input",type:"url",value:String(g.marketplace_configuration_evidence_url??""),onChange:t=>k("marketplace_configuration_evidence_url",t.target.value),placeholder:"https://…"})]})]}),e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:!!g.marketplace_separate_account_confirmed,onChange:t=>k("marketplace_separate_account_confirmed",t.target.checked)}),e.jsx("span",{children:"Required separate marketplace account/location/profile is configured"})]}),e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:!!g.marketplace_separate_return_confirmed,onChange:t=>k("marketplace_separate_return_confirmed",t.target.checked)}),e.jsx("span",{children:"Required separate marketplace return is configured"})]}),e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:!!g.marketplace_non_filing_status_approved,onChange:t=>k("marketplace_non_filing_status_approved",t.target.checked)}),e.jsx("span",{children:"State-approved marketplace non-filing status is on file"})]}),f==="TN"&&g.marketplace_filing_role==="facilitator"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"strc-dim__action",style:{marginTop:8},children:"Tennessee facilitator authority facts:"}),e.jsxs("div",{className:"strc-modal__form",children:[e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Threshold exceeded date (> $100,000; exact equality blocked)"}),e.jsx("input",{className:"strc-input",type:"date","data-testid":"tn-facilitator-threshold-date",value:String(g.marketplace_facilitator_threshold_exceeded_at??""),onChange:t=>k("marketplace_facilitator_threshold_exceeded_at",t.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Facilitator exception posture"}),e.jsxs("select",{className:"strc-select","data-testid":"tn-facilitator-exception-posture",value:String(g.marketplace_facilitator_exception_posture??""),onChange:t=>k("marketplace_facilitator_exception_posture",t.target.value),children:[e.jsx("option",{value:"",children:"Unresolved — block filing"}),e.jsx("option",{value:"none",children:"No waiver or seller-remit exception"}),e.jsx("option",{value:"commissioner_waiver",children:"Commissioner-approved waiver"}
1),e.jsx("option",{value:"qualifying_seller_contract",children:"Qualifying seller-remit contract"})]})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"TN facilitated-sales TNTAP location ID (must match imported reporting location)"}),e.jsx("input",{className:"strc-input","data-testid":"tn-facilitated-location-id",value:String(g.tn_marketplace_facilitated_location_id??""),onChange:t=>k("tn_marketplace_facilitated_location_id",t.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"TN own-sales location IDs (comma-separated; required when own sales exist)"}),e.jsx("input",{className:"strc-input","data-testid":"tn-own-sales-location-ids",value:String(g.tn_marketplace_own_sales_location_ids??""),onChange:t=>k("tn_marketplace_own_sales_location_ids",t.target.value)})]})]})]}),f==="CA"&&g.marketplace_filing_role==="seller"&&e.jsxs("div",{style:{marginTop:12},"data-testid":"readiness-ca-marketplace-fields",children:[e.jsx("div",{className:"strc-dim__action",children:"California marketplace worksheet facts:"}),e.jsxs("div",{className:"strc-modal__form",children:[e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Purchases subject to use tax"}),e.jsx("input",{className:"strc-input",type:"number",min:"0",step:"0.01",value:String(g.ca_purchases_subject_to_use_tax??""),onChange:t=>k("ca_purchases_subject_to_use_tax",t.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Product-fee account scope"}),e.jsxs("select",{className:"strc-select",value:String(g.ca_product_fee_scope_status??""),onChange:t=>k("ca_product_fee_scope_status",t.target.value),children:[e.jsx("option",{value:"",children:"Unresolved — withhold exact worksheet"}),e.jsx("option",{value:"not_applicable",children:"Not applicable"}),e.jsx("option",{value:"resolved_separately",children:"Resolved separately"})]})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Product-fee scope evidence URL"}),e.jsx("input",{className:"strc-input",type:"url",value:String(g.ca_product_fee_scope_evidence_url??""),onChange:t=>k("ca_product_fee_scope_evidence_url",t.target.value),placeholder:"https://…"})]})]}),e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:!!g.ca_product_fee_scope_certified,onChange:t=>k("ca_product_fee_scope_certified",t.target.checked)}),e.jsx("span",{children:"Product-fee scope review is certified for this account"})]})]}),(ge.length>0||_.missing_credentials?.items?.length)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"strc-dim__action",style:{marginTop:8},children:"Onboarding status (non-secret registration ids only — never a password/secret):"}),e.jsxs("div",{className:"strc-modal__form",children:[e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Approval status"}),e.jsxs("select",{className:"strc-select","data-testid":"editor-approval-status",value:String(g.approval_status??""),onChange:t=>k("approval_status",t.target.value),children:[e.jsx("option",{value:"",children:"—"}),ft.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Agency case / ticket #"}),e.jsx("input",{className:"strc-input",value:String(g.agency_case_number??""),onChange:t=>k("agency_case_number",t.target.value)})]}),ge.map(t=>e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:xe[t]?.label??t}),xe[t]?.type==="bool"?e.jsx("input",{type:"checkbox","data-testid":`editor-${t}`,checked:!!g[t],onChange:n=>k(t,n.target.checked)}):e.jsx("input",{className:"strc-input",type:xe[t]?.type==="date"?"date":"text","data-testid":`editor-${t}`,value:String(g[t]??""),onChange:n=>k(t,n.target.value)})]},t))]}),e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:!!g.has_state_approval,onChange:t=>k("has_state_approval",t.target.checked)}),e.jsx("span",{children:"Has state approval / registration"})]}),e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:!!g.has_portal_account,onChange:t=>k("has_portal_account",t.target.checked)}),e.jsx("span",{children:"Has state portal account"})]})]}),f==="AZ"&&e.jsxs("div",{style:{marginTop:12},"data-testid":"readiness-az-tpt-locations",children:[e.jsx("div",{className:"strc-modal__hint",children:"Arizona registered TPT locations (official county/city region codes; never inferred from addresses):"}
1),e.jsx(Qe,{value:l,onChange:m})]}),f==="MO"&&e.jsxs("div",{style:{marginTop:12},"data-testid":"readiness-mo-sites",children:[e.jsx("div",{className:"strc-modal__hint",children:"Missouri filing sites (DOR-registered — codes never guessed):"}),e.jsx(et,{value:C,onChange:Z})]}),f==="IL"&&e.jsxs("div",{style:{marginTop:12},"data-testid":"readiness-il-sites",children:[e.jsx("div",{className:"strc-modal__hint",children:"Illinois registered sites (IDOR site numbers never guessed) + scope declarations:"}),e.jsx(tt,{value:D,onChange:X,declarations:V,onDeclarationsChange:te})]}),f==="TX"&&e.jsxs("div",{style:{marginTop:12},"data-testid":"readiness-tx-sourcing",children:[e.jsx("div",{className:"strc-modal__hint",children:"Texas sourcing profile (seller type, permitted outlets, SLTR election — explicit facts, never inferred):"}),e.jsx(rt,{sellerFields:se,onSellerFieldsChange:le,outlets:ce,onOutletsChange:ee})]}),f==="CO"&&e.jsxs("div",{style:{marginTop:12},"data-testid":"readiness-co-site-numbers",children:[e.jsx("div",{className:"strc-modal__hint",children:"Colorado DOR-assigned site numbers (per registered location — never derived from the jurisdiction code):"}),e.jsx(st,{value:w,onChange:Q})]}),f==="FL"&&e.jsxs("div",{style:{marginTop:12},"data-testid":"readiness-fl-county-code",children:[e.jsx("div",{className:"strc-modal__hint",children:"Florida DR-15 filer county code (the county your certificate is registered in — not a delivery county):"}),e.jsx(at,{value:oe,options:_e,onChange:ae})]}),e.jsxs("div",{className:"strc-modal__actions",children:[e.jsx("button",{type:"button",className:"strc-drawer__close",onClick:()=>J(!1),children:"Cancel"}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--primary",disabled:E,onClick:()=>{me()},"data-testid":"readiness-editor-save",children:E?"Saving…":"Save"})]})]}),ht.map(({key:t,title:n})=>{const i=_[t];return!i||typeof i!="object"||!("status"in i)?null:e.jsx(s,{title:n,dim:i},t)})]})]})]})})}const Ie={confirmed:"Filed (confirmed)",filed:"Filed (awaiting confirmation)",needs_attention:"Needs attention",ready:"Ready to file",setup_required:"Setup required",unsupported_state:"Workpapers only",overdue:"Overdue — prepare now",due_soon:"Due soon",not_started:"Not started",upcoming:"Upcoming"},bt={confirmed:"strc-status-pill--success",filed:"strc-status-pill--warning",needs_attention:"strc-status-pill--warning",ready:"strc-status-pill--ready",setup_required:"strc-status-pill--warning",unsupported_state:"strc-status-pill--muted",overdue:"strc-status-pill--danger",due_soon:"strc-status-pill--warning",not_started:"strc-status-pill--info",upcoming:"strc-status-pill--muted"},Ge={overdue:0,due_soon:1,needs_attention:2,setup_required:3,ready:4,not_started:5,upcoming:6,filed:7,confirmed:8,unsupported_state:9},yt={full:"Filing documents available",worksheet_only:"Worksheet (portal entry)",unsupported:"Not yet available"},Ue=d=>d==null?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(d),ie=d=>{if(!d)return"—";const[h,j,O]=d.split("-").map(Number);return!h||!j||!O?d:new Date(h,j-1,O).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},jt=d=>{const h=[];return d.deadline_rule_label&&h.push(d.deadline_rule_label),d.weekend_holiday_adjusted&&h.push("Adjusted to the next business day."),(d.deadline_notes??[]).forEach(j=>h.push(j)),d.deadline_source_url&&h.push(`Source: ${d.deadline_source_url}${d.deadline_source_accessed?` (accessed ${d.deadline_source_accessed})`:""}`),h.length>0?h.join(`
2`):void 0},kt={manual_review:{label:"verify",className:"strc-chip--verify",hint:"Deadline rule needs verification for this state/frequency."},default:{label:"generic",className:"strc-chip--generic",hint:"Generic schedule — state-specific rule not applied."}},Nt=({confidence:d})=>{const h=d?kt[d]:void 0;return h?e.jsx("span",{title:h.hint,className:`strc-chip ${h.className}`,children:h.label}):null},St={upload_xlsx:"State upload workbook (XLSX)",upload_csv:"State upload file (CSV)",upload_xml:"State upload file (XML)",worksheet_pdf:"Preparation worksheet (PDF)",paper_pdf:"Official filled paper return (PDF)"},Ct={upload_xlsx:"xlsx",upload_csv:"csv",upload_xml:"xml",worksheet_pdf:"pdf",paper_pdf:"pdf"},ze=["pending","queued","running"],wt={generated:"Generated package",skipped:"Skipped",failed:"Failed — retry available"},Ye=d=>
2[d.getFullYear(),String(d.getMonth()+1).padStart(2,"0"),String(d.getDate()).padStart(2,"0")].join("-"),Je=(d,h)=>{const j=(d??"").toLowerCase().replace("-","_"),O={monthly:new Set(Array.from({length:12},(p,x)=>x)),quarterly:new Set([0,3,6,9]),semiannual:new Set([0,6]),semi_annual:new Set([0,6]),annual:new Set([0])},N=O[j]??O.monthly,f=new Date,A=h?new Date(`${h}T00:00:00`):f,q=A>f?A:f;for(let p=0;p<=12;p+=1){const x=new Date(q.getFullYear(),q.getMonth()+p,1);if(x>q&&N.has(x.getMonth()))return Ye(x)}return""},At=({orgId:d,groups:h,locationsByState:j,onClose:O,onChanged:N})=>{const f=c.useMemo(()=>Array.from(j.keys()).sort(),[j]),[A,q]=c.useState(""),[p,x]=c.useState(""),[W,_]=c.useState(()=>Je("monthly")),[I,M]=c.useState(new Set),[v,L]=c.useState(new Set),[R,E]=c.useState({}),[B,U]=c.useState({}),[z,Y]=c.useState({}),[J,g]=c.useState([]),[G,b]=c.useState(!1),[$,T]=c.useState(!1),[K,C]=c.useState(null);c.useEffect(()=>{let a=!1;return b(!1),H.listAccountProfiles(d).then(l=>{a||(g(l.items??[]),b(!0))}).catch(l=>{a||C(P(l,"Could not load filing accounts"))}),()=>{a=!0}},[d]),c.useEffect(()=>{E(Object.fromEntries(h.map(a=>[a.id,new Set(a.account_profile_ids)]))),U(Object.fromEntries(h.map(a=>[a.id,new Set(a.location_ids)]))),Y(Object.fromEntries(h.map(a=>{const l=J.find(m=>a.account_profile_ids.includes(m.id));return[a.id,Je(l?.filing_frequency,a.effective_from)]})))},[h,J]);const Z=a=>{const l=new Map(j.get(a)??[]);return h.filter(m=>m.state_code===a).flatMap(m=>m.locations).forEach(m=>{l.has(m.location_id)||l.set(m.location_id,m.location_name??`Location ${m.location_id}`)}),Array.from(l.entries()).map(([m,S])=>({id:m,name:S}))},D=a=>h.some(l=>l.supersedes_group_id===a&&l.is_active),X=Ye(new Date),V=a=>!D(a.id)&&a.effective_to!==null&&a.effective_to>=X,te=a=>{M(l=>{const m=new Set(l);return m.has(a)?m.delete(a):m.add(a),m})},ce=a=>{L(l=>{const m=new Set(l);return m.has(a)?m.delete(a):m.add(a),m})},ee=(a,l)=>{E(m=>{const S=new Set(m[a]??[]);return S.has(l)?S.delete(l):S.add(l),{...m,[a]:S}})},se=(a,l)=>{U(m=>{const S=new Set(m[a]??[]);return S.has(l)?S.delete(l):S.add(l),{...m,[a]:S}})},le=async a=>{if(C(null),!G){C("Filing accounts have not loaded; no changes were made.");return}T(!0);try{await re.update(a,{account_profile_ids:Array.from(R[a]??[])},d),N()}catch(l){C(P(l,"Could not update the filing-account bindings"))}finally{T(!1)}},w=async a=>{C(null);const l=z[a.id],m=Array.from(B[a.id]??[]);if(!l||m.length===0){C("Choose a successor effective date and at least one location.");return}T(!0);try{await re.supersede(a.id,{effective_from:l,location_ids:m,account_profile_ids:Array.from(R[a.id]??[])},d),N()}catch(S){C(P(S,"Could not schedule the filing-unit successor"))}finally{T(!1)}},Q=async a=>{C(null);const l=z[a.id];if(!l){C("Choose the filing-period boundary when standalone filing begins.");return}T(!0);try{await re.dissolve(a.id,l,d),N()}catch(m){C(P(m,"Could not schedule the end of joint filing"))}finally{T(!1)}},oe=async a=>{C(null),T(!0);try{await re.cancelDissolution(a,d),N()}catch(l){C(P(l,"Could not cancel the scheduled end"))}finally{T(!1)}},ae=async()=>{if(C(null),!G){C("Filing accounts have not loaded; no changes were made.");return}if(!A||!p.trim()||I.size===0){C("Pick a state, name the group, and select at least one location.");return}T(!0);try{await re.create({state_code:A,group_name:p.trim(),location_ids:Array.from(I),account_profile_ids:Array.from(v),effective_from:W},d),q(""),x(""),M(new Set),L(new Set),N()}catch(a){C(P(a,"Could not create the joint filing group"))}finally{T(!1)}},_e=async a=>{C(null),T(!0);try{await re.remove(a,d),N()}catch(l){C(P(l,"Could not dissolve the group"))}finally{T(!1)}};return e.jsx("div",{className:"strc-modal-overlay",role:"dialog","aria-modal":"true","data-testid":"strc-joint-modal",onClick:O,children:e.jsxs("div",{className:"strc-modal",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"strc-modal__header",children:[e.jsx("h2",{children:"Joint (consolidated) filing"}),e.jsx("button",{type:"button",className:"strc-link",onClick:O,"data-testid":"strc-joint-close",children:"Close"})]}),e.jsx("p",{className:"strc-modal__intro",children:"By default each location files its own sales tax return. Group same-state locations that share one state registration (taxpayer ID / FEIN) so their return consolidates into a single filing. Dissolving a group reverts its locations to independent filing."}),K&&e.jsx("div",{className:"returns-center-banner returns-center-banner--error",children:K}),e.jsxs("section",{className:"strc-modal__section",children:[e.jsx("h3",{children:"Existing groups"}),h.length===0?e.jsx("p",{className:"strc-cell-sub",children:"No joint filing groups yet — every location files independently."}):e.jsx("ul",{className:"strc-group-list",children:h.map(a=>e.jsxs("li",{className:"strc-group-list__item","data-testid":"strc-group-row",children:[e.jsxs("div",{children:[e.jsx("span",{className:"strc-cell-strong",children:a.group_name}),e.jsx("span",{className:"strc-chip strc-chip--generic",children:a.state_code}),e.jsxs("div",{className:"strc-cell-sub",children:[a.locations.map(l=>l.location_name??`Location ${l.location_id}`).join(" · ")," · ",a.account_profile_ids.length," filing account",a.account_profile_ids.length===1?"":"s"," · ","v",a.version_number," effective ",a.effective_from,a.effective_to?` through ${a.effective_to}`:""]}),e.jsxs("fieldset",{className:"strc-modal__field",disabled:!G||$||a.effective_from<=X||D(a.id),children:[e.jsx("legend",{children:"Accounts filing for this unit"}),J.filter(l=>l.state_code===a.state_code).map(l=>e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:(R[a.id]??new Set).has(l.id),onChange:()=>ee(a.id,l.id)}),l.account_name]},l.id)),a.account_profile_ids.filter(l=>!J.some(m=>
2m.id===l&&m.state_code===a.state_code)).map(l=>e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:(R[a.id]??new Set).has(l),onChange:()=>ee(a.id,l)}),"Unavailable account ",l," — uncheck and save to remove this stale binding"]},l))]}),e.jsxs("fieldset",{className:"strc-modal__field",disabled:$||D(a.id)||V(a),children:[e.jsx("legend",{children:"Locations in the next version"}),Z(a.state_code).map(l=>e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:(B[a.id]??new Set).has(l.id),onChange:()=>se(a.id,l.id)}),l.name]},l.id))]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Successor effective from"}),e.jsx("input",{type:"date",className:"strc-input",disabled:$||D(a.id)||V(a),value:z[a.id]??"",onChange:l=>Y(m=>({...m,[a.id]:l.target.value}))})]})]}),e.jsxs("div",{className:"strc-modal__actions",children:[e.jsx("button",{type:"button",className:"strc-link",disabled:$||!G||a.effective_from<=X||D(a.id),onClick:()=>{le(a.id)},"data-testid":"strc-group-save-accounts",children:"Save accounts"}),e.jsx("button",{type:"button",className:"strc-link",disabled:$||!G||D(a.id)||V(a),onClick:()=>{w(a)},"data-testid":"strc-group-supersede",children:"Schedule successor"}),V(a)?e.jsx("button",{type:"button",className:"strc-link",disabled:$,onClick:()=>{oe(a.id)},children:"Cancel scheduled end"}):e.jsx("button",{type:"button",className:"strc-link strc-link--danger",disabled:$||D(a.id),onClick:()=>{Q(a)},children:"End joint filing"}),e.jsx("button",{type:"button",className:"strc-link strc-link--danger",disabled:$||a.effective_from<=X||D(a.id),onClick:()=>{_e(a.id)},"data-testid":"strc-group-delete",children:"Cancel version"})]})]},a.id))})]}),e.jsxs("section",{className:"strc-modal__section",children:[e.jsx("h3",{children:"Create a joint filing group"}),e.jsxs("div",{className:"strc-modal__form",children:[e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"State"}),e.jsxs("select",{value:A,className:"strc-select","data-testid":"strc-group-state",onChange:a=>{q(a.target.value),M(new Set),L(new Set)},children:[e.jsx("option",{value:"",children:"Select a state"}),f.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Group name"}),e.jsx("input",{type:"text",value:p,className:"strc-input","data-testid":"strc-group-name",placeholder:"e.g. Ohio consolidated",onChange:a=>x(a.target.value)})]}),e.jsxs("label",{className:"strc-modal__field",children:[e.jsx("span",{children:"Effective from"}),e.jsx("input",{type:"date",value:W,className:"strc-input","data-testid":"strc-group-effective-from",onChange:a=>_(a.target.value)})]}),e.jsxs("fieldset",{className:"strc-modal__field","data-testid":"strc-group-accounts",disabled:!G||$,children:[e.jsx("legend",{children:"Filing accounts (select every account that files for this unit)"}),J.filter(a=>a.state_code===A).map(a=>e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:v.has(a.id),onChange:()=>ce(a.id)}),a.account_name]},a.id))]})]}),A&&e.jsxs("div",{className:"strc-modal__members","data-testid":"strc-group-members",children:[e.jsx("span",{className:"strc-cell-sub",children:"Locations filing together:"}),Z(A).length===0?e.jsxs("p",{className:"strc-cell-sub",children:["No visible ",A," locations."]}):Z(A).map(a=>e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:I.has(a.id),onChange:()=>te(a.id)}),a.name]},a.id))]}),e.jsx("div",{className:"strc-modal__actions",children:e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--primary",onClick:()=>{ae()},disabled:$||!G,"data-testid":"strc-group-create",children:$?"Working…":"Create group"})})]})]})})},Mt=()=>{const d=He(),[h,j]=Ke(),{activeOrganization:O,activeLocation:N,moduleStatusMap:f,isModuleStatusLoading:A,showAdminPanel:q}=Ze(),p=O?.id??null,[x,W]=c.useState(null),[_,I]=c.useState(!1),[M,v]=c.useState(null),[L,R]=c.useState(null),[E,B]=c.useState(null),[U,z]=c.useState(""),[Y,J]=c.useState(""),[g,G]=c.useState(!1),[b,$]=c.useState(null),[T,K]=c.useState(!1),[C,Z]=c.useState(!1),[D,X]=c.useState(new Set),[V,te]=c.useState([]),[ce,ee]=c.useState(!1),[se,le]=c.useState(new Set),[w,Q]=c.useState(null),[oe,ae]=c.useState(!1),_e=f["sales-tax-compliance"]?.is_active??!1,a=c.useCallback(async()=>
2{if(p){I(!0),v(null);try{const s=await Ne.getOverview(p,g?N?.id??void 0:void 0);W(s)}catch(s){v(P(s,"Failed to load the returns overview"))}finally{I(!1)}}},[p,g,N?.id]);c.useEffect(()=>{a()},[a]),c.useEffect(()=>{if(!x||w)return;const s=Number(h.get("open_package_id")),t=Number(h.get("open_return_id")),n=h.get("state"),i=h.get("period_end");if(!s&&!t&&!n)return;const u=x.rows.find(r=>s>0&&r.package?.id===s||t>0&&r.legacy_return_id===t||!s&&!t&&n===r.state&&(!i||i===r.period_end));u&&!u.access_restricted&&Q(u);const o=new URLSearchParams(h);o.delete("open_package_id"),o.delete("open_return_id"),o.delete("state"),o.delete("period_end"),j(o,{replace:!0})},[x,w,h,j]);const l=c.useCallback(async()=>{if(!p)return null;try{const s=await Ne.getLatestBulkGeneration(p);return $(s),s}catch{return null}},[p]);c.useEffect(()=>{l()},[l]);const m=c.useCallback(async()=>{if(p)try{te(await re.list(p))}catch{te([])}},[p]);c.useEffect(()=>{m()},[m]);const S=b!=null&&ze.includes(b.status);c.useEffect(()=>{if(!S)return;const s=window.setInterval(()=>{l().then(t=>{t&&!ze.includes(t.status)&&a()})},2500);return()=>window.clearInterval(s)},[S,l,a]);const pe=c.useMemo(()=>(x?.rows??[]).filter(s=>(!U||s.state===U)&&(!Y||s.status===Y)).map((s,t)=>({row:s,index:t})).sort((s,t)=>{const n=Ge[s.row.status]??50,i=Ge[t.row.status]??50;return n!==i?n-i:s.row.state!==t.row.state?s.row.state.localeCompare(t.row.state):s.index-t.index}).map(s=>s.row),[x,U,Y]),be=c.useMemo(()=>Array.from(new Set((x?.rows??[]).map(s=>s.state))).sort(),[x]),de=c.useMemo(()=>{const s=new Map;return(x?.rows??[]).forEach(t=>{s.has(t.state)||s.set(t.state,new Map);const n=s.get(t.state);t.locations.forEach(i=>{n.set(i.location_id,i.location_name??`Location ${i.location_id}`)}),t.location_id!=null&&!n.has(t.location_id)&&n.set(t.location_id,t.location_name??`Location ${t.location_id}`)}),s},[x]),ne=c.useMemo(()=>{const s=new Map;return(x?.rows??[]).forEach(t=>{s.has(t.state)||s.set(t.state,{locations:new Map,hasJoint:!1});const n=s.get(t.state);t.locations.forEach(i=>{n.locations.set(i.location_id,i.location_name??`Location ${i.location_id}`)}),t.filing_mode==="joint"&&(n.hasJoint=!0)}),Array.from(s.entries()).map(([t,n])=>({state:t,locations:Array.from(n.locations.values()),hasJoint:n.hasJoint})).sort((t,n)=>t.state.localeCompare(n.state))},[x]),k=s=>{le(t=>{const n=new Set(t);return n.has(s)?n.delete(s):n.add(s),n})},ye=c.useMemo(()=>{if(!x)return[];const s=x.summary;return[{key:"overdue",label:"Overdue",value:s.overdue,helper:"Prepare and file these now.",metricClass:"strc-metric--danger"},{key:"due_soon",label:"Due soon",value:s.due_soon,helper:"Coming due — get ahead of them.",metricClass:"strc-metric--warning"},{key:"ready",label:"Ready",value:s.ready,helper:"Figures ready to prepare.",metricClass:"strc-metric--ready"},{key:"needs_attention",label:"Needs attention",value:s.needs_attention,helper:"Blockers to resolve first.",metricClass:"strc-metric--warning"},{key:"filed",label:"Filed",value:s.filed,helper:"Filed or confirmed in Prophit.",metricClass:"strc-metric--filed"},{key:"unsupported",label:"Not yet supported",value:s.unsupported,helper:"Workpapers only for now.",metricClass:"strc-metric--muted"}]},[x]),me=s=>{const n=(s.access_restricted?`restricted-${[...s.member_location_ids??[]].sort((i,u)=>i-u).join("-")}`:null)??s.filing_unit_key??(s.location_id!=null?`loc-${s.location_id}`:"org");return`${s.state}:${n}:${s.period_end??"setup"}:${s.filing_frequency??""}:${s.account_key}`},he=s=>{if(s.access_restricted)return;if(s.state_pack_support!=="unsupported"){Q(s);return}if(s.status==="setup_required"||!s.period_end){d("/sales-tax-compliance");return}const t=new URLSearchParams({view:"filing",focus_state:s.state,focus_period_end:s.period_end});d(`/sales-tax-compliance?${t.toString()}`)},Ae=s=>{X(t=>{const n=new Set(t);return n.has(s)?n.delete(s):n.add(s),n})},je=async s=>{if(p){K(!0),v(null),R(null);try{const t=s?(x?.rows??[]).filter(i=>D.has(me(i))&&(i.member_location_ids?.length??0)>0&&i.period_start&&i.period_end&&i.filing_frequency).map(i=>({state:i.state,account_key:i.account_key,account_profile_id:i.account_profile_id,marketplace_filing_role:i.marketplace_filing_role,location_id:i.location_id,filing_unit_key:i.filing_unit_key,member_location_ids:i.member_location_ids,period_start:i.period_start,period_end:i.period_end,filing_frequency:i.filing_frequency})):void 0;if(s&&(!t||t.length===0)){v("Your selection no longer matches any rows — refresh the table and reselect."),X(new Set);return}const n=await Ne.startBulkGeneration(p,t&&t.length>0?{selected_rows:t}:void 0,g?N?.id:void 0);$(n),Z(!1),X(new Set),R("Return package generation queued — progress appears below.")}catch(t){v(P(t,"Could not start return generation"))}finally{K(!1)}}},fe=async()=>
2{if(!(!p||!b)){K(!0),v(null);try{const s=await Ne.retryBulkGenerationFailed(p,b.id);$(s),R("Retry queued for failed returns.")}catch(s){v(P(s,"Could not retry failed returns"))}finally{K(!1)}}},ge=async(s,t)=>{if(!p||!s.period_start||!s.period_end||!s.filing_frequency)return;const n=me(s);B(n),R(null),v(null);try{s.package?(await H.refreshPackage(s.package.id,p,s.location_id??void 0),R(`${s.state} ${s.period_end} package refreshed.`)):(await H.createPackage({state:s.state,period_start:s.period_start,period_end:s.period_end,filing_frequency:s.filing_frequency,location_id:s.location_id,location_ids:s.member_location_ids?.length?s.member_location_ids:void 0,filing_unit_key:s.filing_unit_key,account_profile_id:t??s.account_profile_id},p,s.location_id??void 0),R(`${s.state} ${s.period_end} package generated.`)),await a()}catch(i){v(P(i,"Package action failed"))}finally{B(null)}},xe=async(s,t)=>{if(!(!p||!s.package)){R(null),v(null);try{const i=((await H.listArtifacts(s.package.id,p,s.location_id??void 0)).items||[]).find(o=>String(o.kind)===t);if(!i||i.id==null){v("Artifact is not available yet — generate or refresh the package first.");return}const u=Ct[t]??"pdf";await H.downloadArtifact(s.package.id,Number(i.id),`${s.state}_${s.period_start}_${s.period_end}_${t}.${u}`,p,s.location_id??void 0)}catch(n){v(P(n,"Download failed"))}}};if(!A&&N&&!_e)return e.jsx("div",{className:"dashboard-page returns-center-page sales-tax-returns-page","data-testid":"strc-no-access",children:e.jsx("div",{className:"dashboard-page__container returns-center-page__container",children:e.jsx("main",{className:"dashboard-main returns-center-page__main",children:e.jsxs("section",{className:"dashboard-category",children:[e.jsx("h2",{children:"Sales Tax Returns"}),e.jsx("p",{children:"The Sales Tax Compliance module is not enabled for this location, so the org-wide returns view is unavailable. Contact your administrator to enable it."})]})})})});const ue=x?.summary.generate_eligible??0,Ee=T||S||ue===0,ve=b?.result_summary?.totals?.failed??0,ke=b?.status==="complete";return e.jsxs("div",{className:"dashboard-page returns-center-page sales-tax-returns-page","data-testid":"sales-tax-returns-center",children:[e.jsx("div",{className:"dashboard-page__container returns-center-page__container",children:e.jsxs("main",{className:"dashboard-main returns-center-page__main",children:[e.jsxs("section",{className:"dashboard-hero returns-center-hero",children:[e.jsxs("div",{className:"returns-center-hero__header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Sales Tax Returns"}),e.jsx("p",{children:"Every sales tax return across the states and locations you can access — what is overdue, coming due, ready to prepare, or blocked. Prophit prepares the figures and filing documents; you file with the state. Nothing is filed or remitted from here."}),e.jsx("p",{className:"returns-center-scope-note",children:"One command view for cross-location filing: prepare each location's return here, then open the location-scoped Sales Tax Compliance workflow to file."})]}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--secondary",onClick:()=>ae(!0),title:"Workflow roles — preparer, reviewer, and approver defaults for this filing unit","aria-label":"Configure workflow roles","data-testid":"strc-workflow-gear",children:"⚙ Roles"}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--secondary",onClick:()=>{a()},disabled:_,children:_?"Refreshing…":"Refresh"}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--secondary",onClick:()=>d("/dashboard"),children:"Back to dashboard"})]}),e.jsxs("div",{className:"returns-center-scope-summary",children:[e.jsxs("span",{className:"returns-center-pill returns-center-pill--neutral",children:["Organization: ",O?.name||"Select an organization"]}),e.jsxs("span",{className:"returns-center-pill returns-center-pill--neutral",children:["Active location remains: ",N?.name||"Not selected"]})]})]}),p&&e.jsx(We,{mode:"returns",orgId:p,locationId:g?N?.id:void 0,compact:!0}),x&&e.jsx("section",{className:"strc-summary-grid","data-testid":"strc-summary",children:ye.map(s=>e.jsxs("article",{className:"returns-center-summary-card",children:[e.jsx("span",{className:"returns-center-summary-card__label",children:s.label}),e.jsx("strong",{className:`returns-center-summary-card__value strc-metric ${s.metricClass}`,children:s.value}),e.jsx("span",{className:"returns-center-summary-card__helper",children:s.helper})]},s.key))}),ne.length>0&&e.jsxs("section",{className:"strc-coverage","data-testid":"strc-coverage",children:[e.jsxs("div",{className:"strc-coverage__header",children:[e.jsx("h2",{children:"Return coverage by state"}),e.jsx("p",{children:"Locations you can access, grouped by filing state. Same-state locations that share a state registration can file one joint return."})]}),e.jsx("div",{className:"strc-coverage__grid",children:ne.map(s=>e.jsxs("article",{className:"strc-coverage-card","data-testid":"strc-coverage-card","data-state":s.state,children:[e.jsxs("div",{className:"strc-coverage-card__header",children:[e.jsx("h3",{children:s.state}),e.jsx("span",{className:`strc-chip ${s.hasJoint?"strc-chip--joint":"strc-chip--generic"}`,children:s.hasJoint?"Joint filing":"Independent"})]}),e.jsx("p",{className:"strc-coverage-card__locations",children:s.locations.join(" · ")||"No visible locations"}),e.jsxs("span",{className:"strc-coverage-card__meta",children:[s.locations.length," location",s.locations.length===1?"":"s"]})]},s.state))})]}),e.jsxs("div",{className:"strc-toolbar",children:[e.jsxs("select",{value:U,onChange:s=>
2z(s.target.value),"data-testid":"strc-state-filter",className:"strc-select","aria-label":"Filter by state",children:[e.jsx("option",{value:"",children:"All states"}),be.map(s=>e.jsx("option",{value:s,children:s},s))]}),e.jsxs("select",{value:Y,onChange:s=>J(s.target.value),"data-testid":"strc-status-filter",className:"strc-select","aria-label":"Filter by status",children:[e.jsx("option",{value:"",children:"All statuses"}),Object.entries(Ie).map(([s,t])=>e.jsx("option",{value:s,children:t},s))]}),e.jsxs("label",{className:"strc-check",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:s=>G(s.target.checked)}),"Only ",N?.name??"current location"]}),q&&e.jsxs("button",{type:"button",className:"returns-center-button returns-center-button--secondary",onClick:()=>ee(!0),"data-testid":"strc-manage-joint-filing",children:["Manage joint filing",V.length>0?` (${V.length})`:""]}),e.jsx("span",{className:"strc-toolbar__spacer"}),e.jsx("button",{type:"button",className:"returns-center-button returns-center-button--primary",onClick:()=>{je(!1)},disabled:Ee,"data-testid":"strc-bulk-generate",title:ue===0?"No returns are ready to generate — rows that already have packages, need setup, or are unsupported are skipped.":void 0,children:S?"Generating…":`Generate ready returns (${ue})`}),D.size>0&&e.jsxs("button",{type:"button",className:"returns-center-button returns-center-button--secondary",onClick:()=>{je(!0)},disabled:T||S,"data-testid":"strc-bulk-generate-selected",children:["Generate selected (",D.size,")"]})]}),b&&e.jsxs("div",{className:"strc-batch","data-testid":"strc-bulk-status",children:[e.jsxs("div",{className:"strc-batch__row",children:[e.jsx("span",{className:`strc-batch__pill ${S?"strc-batch__pill--active":ke&&!ve?"strc-batch__pill--done":"strc-batch__pill--warn"}`,children:S?`Generating return packages… ${b.progress_pct}%`:ke?ve?"Batch finished with failures":"Batch complete":b.status==="failed_retryable"?"Batch could not be queued — retry":"Batch failed"}),e.jsx("span",{className:"strc-batch__message","data-testid":"strc-bulk-message",children:b.message??""}),b.result_summary?.totals&&e.jsxs("span",{className:"strc-batch__counts","data-testid":"strc-bulk-counts",children:[b.result_summary.totals.generated," generated"," · ",b.result_summary.totals.skipped," skipped"," · ",b.result_summary.totals.failed," failed"," · ",b.result_summary.totals.total," total"]}),e.jsxs("span",{className:"strc-batch__actions",children:[(b.result_summary?.items?.length??0)>0&&e.jsx("button",{type:"button",className:"strc-link",onClick:()=>Z(s=>!s),"data-testid":"strc-bulk-details-toggle",children:C?"Hide details":"Show details"}),!S&&ve>0&&e.jsx("button",{type:"button",className:"strc-link",onClick:()=>{fe()},disabled:T,"data-testid":"strc-bulk-retry",children:"Retry failed returns"})]})]}),C&&(b.result_summary?.items?.length??0)>0&&e.jsxs("table",{className:"strc-batch__details","data-testid":"strc-bulk-details",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"State"}),e.jsx("th",{children:"Location"}),e.jsx("th",{children:"Period"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:(b.result_summary?.items??[]).map((s,t)=>e.jsxs("tr",{"data-testid":"strc-bulk-item","data-item-status":s.status,children:[e.jsx("td",{children:s.state}),e.jsx("td",{children:s.location_name??"—"}),e.jsx("td",{style:{whiteSpace:"nowrap"},children:s.period_start?`${ie(s.period_start)} – ${ie(s.period_end)}`:"—"}),e.jsxs("td",{children:[e.jsx("span",{className:s.status==="generated"?"strc-cell-strong":s.status==="failed"?"strc-cell-due--overdue":void 0,children:wt[s.status]??s.status}),s.status==="skipped"&&(s.skip_label||s.skip_reason)&&e.jsxs("span",{className:"strc-cell-sub",children:[" — ",s.skip_label??s.skip_reason]}),s.status==="failed"&&s.error&&e.jsxs("span",{className:"strc-cell-sub",children:[" — ",s.error]})]})]},`${s.state}-${s.location_id}-${s.period_end}-${t}`))})]})]}),L&&e.jsx("div",{className:"returns-center-banner returns-center-banner--success","data-testid":"strc-action-message",children:L}),M&&e.jsx("div",{className:"returns-center-banner returns-center-banner--error","data-testid":"strc-error",children:M}),e.jsx("section",{className:"strc-table-card",children:_&&!x?e.jsx("p",{className:"strc-loading",children:"Loading returns…"}):pe.length===0?e.jsxs("div",{className:"strc-empty","data-testid":"strc-empty",children:[e.jsx("p",{className:"strc-empty__title",children:"No returns to show."}),e.jsx("p",{children:"Returns appear once filing setup is active for a state in Sales Tax Compliance and sales data has been uploaded."})]}):e.jsx("div",{className:"strc-table-scroll",children:e.jsxs("table",{className:"strc-table","data-testid":"strc-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{"aria-label":"Select for generation",style:{width:"28px"}}),e.jsx("th",{children:"State"}),e.jsx("th",{children:"Location"}),e.jsx("th",{children:"Period"}),e.jsx("th",{children:"Due date"}),e.jsx("th",{className:"strc-num",children:"Remittance"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Documents"}),e.jsx("th",{children:"Next step"})]})}),e.jsx("tbody",{children:pe.map(s=>{const t=me(s),n=bt[s.status]??"strc-status-pill--muted",i=Ie[s.status]??s.status,u=E===t,o=s.state_pack_support!=="unsupported",r=!s.package||!["soft_filed","filed_confirmed"].includes(s.package.status),y=jt(s);return e.jsxs("tr",{"data-testid":"strc-row","data-state":s.state,"data-status":s.status,className:s.overdue?"strc-row--overdue":void 0,onClick:()=>he(s),"aria-disabled":s.access_restricted||void 0,children:[e.jsx("td",{onClick:F=>F.stopPropagation(),children:s.bulk_generation?.action==="generate"&&e.jsx("input",{type:"checkbox",checked:D.has(t),onChange:()=>Ae(t),"data-testid":"strc-select-row","aria-label":`Select ${s.state} ${s.period_end??""} for generation`})}),e.jsxs("td",{className:"strc-cell-state",children:[s.state,(s.marketplace_filing_role||s.account_key!=="default")&&e.jsxs("span",{className:"strc-cell-sub","data-testid":"strc-marketplace-role",children:[s.marketplace_filing_role?` · ${s.marketplace_filing_role==="facilitator"?"Facilitator":"Seller"}`:"",s.account_key!=="default"?` · ${s.account_key}`:""]})]}),e.jsxs("td",{onClick:F=>{s.is_multi_location&&F.stopPropagation()},children:[e.jsxs("div",{className:"strc-location-cell",children:[e.jsx("span",{className:"strc-cell-strong",children:s.location_name??"All locations"}),s.filing_mode==="joint"&&e.jsx("span",{className:"strc-chip strc-chip--joint","data-testid":"strc-joint-badge",children:"Joint filing"}),s.is_multi_location&&e.jsxs("span",{className:"strc-chip strc-chip--multi","data-testid":"strc-multi-location-badge",children:[s.location_count," locations"]})]}),s.is_multi_location&&e.jsx("button",{type:"button",className:"strc-link strc-locations-toggle",onClick:()=>k(t),"data-testid":"strc-locations-toggle",children:se.has(t)?"Hide locations":"Locations included"}),s.is_multi_location&&se.has(t)&&e.jsx("ul",{className:"strc-locations-list","data-testid":"strc-locations-list",children:s.locations.map(F=>e.jsxs("li",{children:[e.jsx("span",{children:F.location_name??`Location ${F.location_id}`}),e.jsx("span",{className:"strc-cell-sub",children:Ue(F.remittance)})]},F.location_id))})]}),e.jsxs("td",{style:{whiteSpace:"nowrap"},children:[e.jsx("span",{className:"strc-cell-strong",children:s.period_start?`${ie(s.peri
2od_start)} – ${ie(s.period_end)}`:"—"}),s.filing_frequency?e.jsxs("span",{className:"strc-cell-sub",children:[" · ",s.filing_frequency]}):null]}),e.jsxs("td",{className:`strc-cell-due${s.overdue?" strc-cell-due--overdue":""}`,children:[e.jsx("span",{title:y,className:y?"strc-due-tooltip":void 0,"data-testid":"strc-due-date",children:ie(s.due_date)}),e.jsx(Nt,{confidence:s.deadline_confidence}),s.overdue&&e.jsx("span",{className:"strc-chip strc-chip--overdue",children:"OVERDUE"})]}),e.jsx("td",{className:"strc-num strc-cell-strong",children:Ue(s.remittance)}),e.jsxs("td",{children:[e.jsx("span",{className:`strc-status-pill ${n}`,children:i}),s.blockers.length>0&&e.jsx("div",{className:"strc-blockers",children:s.blockers.join(" · ")}),(s.filing_warnings?.length??0)>0&&e.jsx("div",{className:"strc-blockers","data-testid":"strc-filing-warnings",style:{color:"#854d0e"},children:s.filing_warnings.map(F=>F.message).join(" · ")})]}),e.jsx("td",{onClick:F=>F.stopPropagation(),children:s.artifacts.length===0?e.jsx("span",{className:"strc-docs-empty",children:yt[s.state_pack_support]}):s.artifacts.map(F=>e.jsx("button",{type:"button",className:"strc-link strc-link--block",onClick:()=>{xe(s,F.kind)},"data-testid":`strc-download-${F.kind}`,children:St[F.kind]??F.kind},F.kind))}),e.jsx("td",{onClick:F=>F.stopPropagation(),children:e.jsxs("div",{className:"strc-next-step",children:[e.jsx("button",{type:"button",className:"strc-link",onClick:()=>he(s),disabled:s.access_restricted,"data-testid":"strc-open-detail",children:s.next_action}),o&&r&&s.period_start&&(s.package||s.bulk_generation?.action==="generate")&&e.jsx("button",{type:"button",className:"strc-link",disabled:u,onClick:()=>{ge(s)},"data-testid":"strc-generate",children:u?"Working…":s.package?"Refresh package":"Generate package"}),o&&!s.access_restricted&&e.jsx("button",{type:"button",className:"strc-link",onClick:()=>Q(s),"data-testid":"strc-readiness",children:"Readiness"})]})})]},t)})})]})})}),e.jsxs("p",{className:"strc-footer-note",children:["Looking for purchasing/use tax returns? They live in the"," ",e.jsx("button",{type:"button",className:"strc-link",onClick:()=>d("/returns-center"),children:"Purchasing Returns Center"}),"."]})]})}),ce&&p&&q&&e.jsx(At,{orgId:p,groups:V,locationsByState:de,onClose:()=>ee(!1),onChanged:()=>{m(),a()}}),w&&p&&e.jsx(vt,{orgId:p,locationId:w.location_id,accountKey:w.account_key,filingUnitKey:w.filing_unit_key,packageId:w.package?.id,state:w.state,period:w.period_start&&w.period_end?`${w.period_start}:${w.period_end}`:null,periodLabel:w.period_start?`${ie(w.period_start)} – ${ie(w.period_end)}`:null,onClose:()=>Q(null),onChanged:()=>{a()},onGenerate:w.period_start&&w.period_end&&w.filing_frequency?s=>ge(w,s):void 0}),oe&&p!=null&&e.jsx(ot,{orgId:p,module:"sales",onClose:()=>ae(!1)})]})};export{Mt as SalesTaxReturnsCenter};

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.