PageSourceSearch

https://app.zoca.com/assets/CustomRequestsPage-Cw6E1oRn.js

js zoca.com collected 2026-09-30 09:41:30 UTC 12,731 bytes, 1 lines download raw bytes

1import{j as e,r as a,R as O}from"./vendor-react-Dw2zQmPu.js";import{c as w}from"./app-cn-C2LL9ulS.js";import{S as V}from"./SkeletonPageShell-Bc1v7UbZ.js";import{al as Y,N as Z,t as C,S,R as $}from"./app-core-DTTgVEgu.js";import{T as M}from"./TopBar-MjVkmRVM.js";import{B as N}from"./button-CFi0D1K4.js";import{az as J,t as D,a5 as A,aa as Q,a6 as X,av as ee,bJ as te,a1 as se}from"./vendor-ui-mAy9LocR.js";import{u as W,R as re,l as ae,a as oe,b as ne}from"./RequestDetailChat-BYrOrhsH.js";import{S as ie}from"./SkeletonBlocks-D-0xzD__.js";import{b as le}from"./vendor-tanstack-Dk5vt_tN.js";import{T as ce}from"./TrialBlockedState-aCqbmtrW.js";import{u as de}from"./useTrialGating-BYssbf5Y.js";import{V as ue}from"./app-shared-QFLrTdTF.js";import{u as me}from"./usemobile-BuLrGuzN.js";import{u as he}from"./useElementWidth-BO7e4rI9.js";import{u as xe}from"./usePageViewOnce-C4HHing9.js";import{u as pe}from"./vendor-router-CtopkIuN.js";import"./commonjs-helpers-C05_-Ghz.js";import"./skeleton-BJiIkxs-.js";import"./SkeletonChart-CxY70CDJ.js";import"./skeletonRows-bFntY3QY.js";import"./vendor-utils-CQ_dDVxl.js";import"./vendor-redux-CqVJnD2r.js";import"./vite-preload-helper-BXl3LOEh.js";import"./activatable-cWgvSTbQ.js";import"./app-back-btn-wWeMZhZJ.js";import"./useZocaAppActions-B3KlgEzE.js";import"./useFtuxAnchorRect-CoIvPJl_.js";import"./vendor-radix-guzGw5-0.js";import"./SearchInput-DTaqHUou.js";import"./input-group-DrMNcVmx.js";import"./input-D2ulylI3.js";import"./textarea-BekLdUF0.js";import"./LinkifiedText-DHKv-Y2N.js";import"./dateTime-B1i2cMJw.js";import"./momentTokens-BIaQGjeF.js";import"./vendor-date-fns-D1v0qsob.js";import"./useCopyToClipboard-AYtsMeHZ.js";import"./card-B8ye2dFa.js";import"./useTrialChecklist-D1cu0VDF.js";import"./billingApi-CqqpMSlc.js";import"./vendor-lodash-DVjWl2dU.js";function z(){return e.jsx(N,{asChild:!0,variant:"outline",children:e.jsxs("a",{href:Y,target:"_blank",rel:"noopener noreferrer","aria-label":"Help Center (opens in a new tab)",title:"Help Center (opens in a new tab)",children:[e.jsx(J,{className:"size-4 shrink-0","aria-hidden":"true"}),"Help Center"]})})}const ge=5*6e4,fe=h=>{const x=Z()||"",{createRequest:l,isCreating:p}=W(),{data:b=[],isLoading:j}=le({queryKey:[re.REQUESTS_CATEGORIES,x],queryFn:()=>ae({entityId:x}),enabled:!!x,staleTime:ge}),[o,n]=a.useState("category"),[s,u]=a.useState([]),[c,m]=a.useState([]),[t,k]=a.useState(""),y=a.useMemo(()=>s.length===0?[]:s[s.length-1]?.children??[],[s]),E=a.useMemo(()=>y.length>0&&y.every(r=>!r.children?.length),[y]),d=s[0]??null,R=a.useMemo(()=>s.slice(1),[s]),T=a.useCallback(r=>{C(S.REQUESTS_CATEGORY_SELECT,{category_id:r.id,category_title:r.title,has_children:!!r.children?.length}),u([r]),m([]),n(r.children?.length?"subcategory":"form")},[]),L=a.useCallback(r=>{u(g=>[...g,r]),m([]),n(r.children?.length?"subcategory":"form")},[]),I=a.useCallback(r=>{m(g=>g.some(v=>v.id===r.id)?g.filter(v=>v.id!==r.id):[...g,r])},[]),B=a.useCallback(()=>{n("form")},[]),F=a.useCallback(()=>{if(s.length<=1){u([]),n("category");return}u(r=>r.slice(0,-1)),m([])},[s.length]),i=a.useCallback(()=>{d?.children?.length?n("subcategory"):(u([]),n("category")),m([])},[d]),_=a.useCallback(()=>{const r=t.trim(),g=d?.requestTemplateId;if(!r||g==null)return;const q=[...R];c.length>0&&q.push(c);const v={category:d?.id,categoryText:d?.title,description:r,subCategories:q.map(f=>Array.isArray(f)?f.map(P=>P.title):f.title)};q.forEach((f,P)=>{const K=P+1;v[`subCategory${K}`]=Array.isArray(f)?f.map(G=>G.id):f.id}),C(S.REQUESTS_SUBMIT_CLICK,{category_id:d?.id??"",description_length:r.length,subcategory_depth:q.length}),l({templateId:g,additionalData:v},{onSuccess:f=>{C(S.REQUESTS_SUBMIT_SUCCESS,{request_id:f?.requestId??"",category_id:d?.id??""}),D.success("Request submitted."),h(f)},onError:f=>{C(S.REQUESTS_SUBMIT_FAILURE,{category_id:d?.id??"",error_type:f?.name??"unknown"}),D.error("Couldn't submit your request - please try again.")}})},[t,d,R,c,l,h]),U=a.useMemo(()=>{const r=s.map(g=>g.title);return c.length>0&&r.push(c.map(g=>g.title).join(", ")),r.join(" › ")},[s,c]),H=o==="form"&&t.trim().length>0&&!p&&d?.requestTemplateId!=null;return{step:o,categories:b,isCategoriesLoading:j,currentDepthItems:y,isLastDepth:E,leafSelections:c,breadcrumb:U,description:t,setDescription:k,isCreating:p,canSubmitForm:H,handlePickRoot:T,handlePickRadio:L,handleToggleCheckbox:I,handleSubcategoryContinue:B,handleBackFromSubcategory:F,handleBackFromForm:i,handleSubmit:_}},be=({onCancel:h,onSubmitted:x})=>{const{step:l,categories:p,isCategoriesLoading:b,currentDepthItems:j,isLastDepth:o,leafSelections:n,breadcrumb:s,description:u,setDescription:c,isCreating:m,canSubmitForm:t,handlePickRoot:k,handlePickRadio:y,handleToggleCheckbox:E,handleSubcategoryContinue:d,handleBackFromSubcategory:R,handleBackFromForm:T,handleSubmit:L}=fe(x),I=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border/60 shrink-0",children:[e.jsx(N,{variant:"ghost",size:"icon",onClick:h,className:"h-7 w-7 shrink-0",children:e.jsx(A,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Choose a category"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:b?e.jsx(ie,{rows:5,lead:"tile"}):p.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-10",children:"No categories available. Try again in a moment."}):e.jsx("ul",{className:"space-y-2",children:p.map(i=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>k(i),disabled:i.isDisabled,className:w("w-full flex items-center gap-3 px-3 py-3 rounded-lg border border-border/60 bg-background hover:bg-muted/40 text-left transition-colors",i.isDisabled&&"opacity-50 cursor-not-allowed"),children:[e.jsx("span",{className:"flex-1 text-sm text-foreground",children:i.title}),e.jsx(Q,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})},i.id))})})]}),B=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border/60 shrink-0",children:[e.jsx(N,{variant:"ghost",size:"icon",onClick:R,className:"h-7 w-7 shrink-0",children:e.jsx(A,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:o?"Pick all that apply":"Choose subcategory"})]}),s&&e.jsx("div",{className:"px-4 py-2 border-b border-border/40 bg-muted/20 shrink-0",children:e.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:s})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-10",children:"Nothing more to pick here. Continue to describe your request."}):e.jsx("ul",{className:"space-y-2",children:j.map(i=>{const _=n.some(U=>U.id===i.id);return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:o?()=>E(i):()=>y(i),className:w("w-full flex items-center gap-3 px-3 py-3 rounded-lg border bg-background hover:bg-muted/40 text-left transition-colors",_?"border-primary":"border-border/60"),children:[e.jsx("span",{className:"flex-1 text-sm text-foreground",children:i.title}
1),o?e.jsx("span",{className:w("h-4 w-4 rounded border flex items-center justify-center shrink-0",_?"bg-primary border-primary":"border-border"),children:_&&e.jsx("svg",{viewBox:"0 0 16 16",className:"h-3 w-3 text-primary-foreground",children:e.jsx("path",{d:"M3 8l3.5 3.5L13 5",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):e.jsx(Q,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})},i.id)})})}),o&&e.jsx("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border/60 shrink-0",children:e.jsx(N,{size:"sm",onClick:d,disabled:n.length===0,className:w("ml-auto text-xs",n.length===0&&"opacity-60"),children:"Continue"})})]}),F=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border/60 shrink-0",children:[e.jsx(N,{variant:"ghost",size:"icon",onClick:T,className:"h-7 w-7 shrink-0",children:e.jsx(A,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"New request"})]}),s&&e.jsx("div",{className:"px-4 py-2 border-b border-border/40 bg-muted/20 shrink-0",children:e.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:s})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[e.jsx("label",{className:"block text-xs font-medium text-muted-foreground",children:"Describe what you'd like changed"}),e.jsx("textarea",{value:u,onChange:i=>c(i.target.value),placeholder:"Tell us what you need…",rows:8,className:"w-full bg-background border border-border rounded-lg px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary resize-none",autoFocus:!0}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Our team will reply inside this request. You can keep chatting in the same thread until it's resolved."})]}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border/60 shrink-0",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:h,className:"text-xs",children:"Cancel"}),e.jsx(N,{size:"sm",onClick:L,disabled:!t,className:w("ml-auto gap-1.5 text-xs",!t&&"opacity-60"),children:m?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-3.5 w-3.5 animate-spin"}),"Submitting…"]}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),"Submit request"]})})]})]});return e.jsxs("div",{className:"flex flex-col h-full",children:[l==="category"&&I(),l==="subcategory"&&B(),l==="form"&&F()]})},je=O.memo(be);function ye(){const h=W(),[x,l]=a.useState(null),[p,b]=a.useState(null),[j,o]=a.useState("list"),n=a.useMemo(()=>{if(!x)return null;const t=h.items.find(k=>k.requestId===x);return t||(p&&p.requestId===x?p:null)},[x,h.items,p]),s=a.useCallback(t=>{C(S.REQUESTS_ROW_CLICK,{request_id:t.requestId,...t.status&&{status:t.status}}),b(null),l(t.requestId),o("detail")},[]),u=a.useCallback(()=>{C(S.REQUESTS_NEW_REQUEST_CLICK,{}),l(null),b(null),o("create")},[]),c=a.useCallback(()=>{C(S.REQUESTS_BACK_TO_LIST_CLICK,{}),l(null),b(null),o("list")},[]),m=a.useCallback(t=>{if(!t?.requestId){o("list");return}b(t),l(t.requestId),o("detail")},[]);return a.useEffect(()=>{if(j!=="detail"||n)return;const t=window.setTimeout(()=>{l(null),b(null),o("list")},3e3);return()=>window.clearTimeout(t)},[j,n]),{items:h.items,isLoading:h.isLoading,activeRequest:n,view:j,handleSelectRequest:s,handleStartCreate:u,handleBackToList:c,handleCreated:m}}const Ce=700,Se=()=>{const h=pe(),x=$(),{isTrialStarted:l,isLoading:p}=de(),{isFromApp:b}=ue(),j=me(),[o,n]=he(Ce),s=j||n,{items:u,isLoading:c,activeRequest:m,view:t,handleSelectRequest:k,handleStartCreate:y,handleBackToList:E,handleCreated:d}=ye();if(xe(()=>C(S.REQUESTS_VIEW,{request_count:u.length,is_empty:u.length===0}),!c),!p&&!l&&!b)return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(M,{title:"Support",actions:e.jsx(z,{})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(ce,{icon:e.jsx(te,{className:"h-6 w-6 text-primary"}),title:"Start your trial to use Support",description:"Begin your Zoca trial to raise and track support requests with our team.",ctaLabel:"Go to Home",onCtaClick:()=>h(x("/dashboard"))})})]});const R=!s||t==="list",T=!s||t!=="list";return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(M,{title:"Support",actions:e.jsx(z,{})}),e.jsxs("div",{ref:o,className:"flex flex-1 min-h-0",children:[e.jsx("div",{className:w("bg-background overflow-hidden",R?"flex flex-col":"hidden",s?"flex-1":"w-[360px] shrink-0 border-r border-border"),children:e.jsx(oe,{items:u,isLoading:c,onSelect:k,onCreate:y})}),e.jsxs("div",{className:w("flex-col min-w-0 bg-background flex-1",T?"flex":"hidden"),children:[t==="detail"&&m&&e.jsx(ne,{request:m,onBack:E,showBack:s}),t==="detail"&&!m&&e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsx(V,{bubbles:4})}),t==="create"&&e.jsx(je,{onCancel:E,onSubmitted:d}),t==="list"&&!s&&e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center text-center px-6",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-muted/60 flex items-center justify-center mb-3",children:e.jsx(se,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No request selected"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-[300px]",children:"Pick a request on the left to read its thread, or start a new one to share what you need."})]})]})]})]})},ut=O.memo(Se);export{ut 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.