1import{r as t,ay as $,bt as e1,fj as t1,aS as r1,d as l1,j as e,bk as y,bd as l,T as g,bS as B,W as P,X as I,fk as s1,fl as i1,a4 as a1,a1 as n1}from"./index-2CwtICst.js";import{M as K}from"./modal_component-CQ9TsgKw.js";import{a as R}from"./modal_header-Zzno9Dew.js";import"./index-BC4zRIry.js";import"./DialogWrap-DDRffVA8.js";import"./Portal-m7W4unkL.js";import"./getScrollBarSize-CHB1zEd-.js";import"./useId-BeW6vcu-.js";const q=r=>t.createElement("svg",{width:50,height:50,viewBox:"0 0 50 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},t.createElement("g",{clipPath:"url(#clip0_155_29)"},t.createElement("path",{d:"M42.0322 42.0371L39.8278 44.5657C36.8696 47.9592 31.6727 48.3151 28.2791 45.3568C25.6921 43.1014 25.4207 39.1394 27.6761 36.5523L31.1586 32.5577C32.2744 31.2776 34.2345 31.1434 35.5143 32.2592L41.7337 37.6813C43.0136 38.797 43.1478 40.7572 42.0322 42.0371Z",fill:"#2861FC"}),t.createElement("path",{d:"M9.77097 7.34256L6.61308 9.71527C3.27561 12.2227 2.59658 17.0052 5.10412 20.3425L5.46163 20.8185C7.52326 23.5625 11.4551 24.1207 14.1991 22.0591L18.436 18.8756C19.7934 17.8557 20.0698 15.9106 19.0498 14.553L14.0934 7.95644C13.0737 6.59892 11.1285 6.32278 9.77097 7.34256Z",fill:"#2861FC"}),t.createElement("path",{d:"M29.0326 45.9394C29.0326 45.9394 21.8432 42.1371 15.0358 34.8161C8.22836 27.4952 4.58098 19.5464 4.58098 19.5464L13.9515 22.2232C13.9515 22.2232 11.6422 24.3208 18.4498 31.6418C25.2572 38.9626 27.6137 36.6108 27.6137 36.6108L29.0326 45.9394Z",fill:"#2861FC"}),t.createElement("g",{opacity:.2},t.createElement("path",{d:"M12.9407 17.1358C13.0349 17.0728 16.3625 14.4623 16.3625 14.4623C16.543 14.3266 17.587 13.7083 17.561 12.5716L19.0497 14.5532C20.0697 15.9106 19.7934 17.8559 18.436 18.8758L14.1991 22.0592C14.1075 22.128 14.0144 22.1935 13.9202 22.2564C13.7922 22.4048 13.3273 23.0753 13.7439 24.6007C12.5139 22.064 11.1129 18.8549 12.9407 17.1358Z",fill:"#120405"}),t.createElement("path",{d:"M15.0356 34.8162C11.3718 30.8761 8.62413 26.7548 6.86686 23.788C9.60485 27.7102 13.0463 31.1399 14.7393 32.9606C24.5142 43.4728 32.7585 44.4211 38.495 38.01C38.863 37.5987 40.0737 36.2599 38.7817 35.1114C38.7629 35.0947 38.7483 35.0806 38.7359 35.0681L41.734 37.6816C43.0137 38.7974 43.148 40.7575 42.0324 42.0374L39.828 44.566C37.0807 47.7174 32.4034 48.2473 29.0323 45.9375L29.0326 45.9395C29.0326 45.9395 21.8432 42.1372 15.0356 34.8162Z",fill:"#120405"})),t.createElement("path",{opacity:.2,d:"M6.0198 15.6898C6.88791 16.0751 7.99399 15.4807 8.49046 14.3623C8.98692 13.2438 8.68562 12.0249 7.81765 11.6395C6.94954 11.2542 5.84346 11.8486 5.347 12.967C4.8504 14.0856 5.15169 15.3046 6.0198 15.6898Z",fill:"#FFF59C"}),t.createElement("path",{opacity:.4,d:"M25.9074 5.11262C30.9248 5.27804 35.8531 7.34521 39.5148 11.2832C43.1761 15.2208 44.8803 20.2854 44.6814 25.301",stroke:"#0F48E3",strokeWidth:.988429,strokeMiterlimit:10,strokeLinecap:"round"}),t.createElement("path",{opacity:.8,d:"M25.6578 10.6346C29.2641 10.7566 32.8058 12.2439 35.4377 15.0745C38.0674 17.9026 39.2936 21.5388 39.1562 25.1412",stroke:"#0F48E3",strokeWidth:.988429,strokeMiterlimit:10,strokeLinecap:"round"}),t.createElement("path",{d:"M25.407 16.1572C27.6025 16.2358 29.7571 17.1428 31.3596 18.8664C32.9577 20.5851 33.7061 22.7926 33.6298 24.9821",stroke:"#0F48E3",strokeWidth:.988429,strokeMiterlimit:10,strokeLinecap:"round"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_155_29"},t.createElement("rect",{width:50,height:50,fill:"white"})))),o1=r=>t.createElement("svg",{width:52,height:54,viewBox:"0 0 52 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},t.createElement("path",{d:"M33.2323 31.6239L29.7497 35.6186C27.5995 38.0849 27.7829 41.822 30.1111 44.071L30.3429 44.2837C33.5906 47.1149 38.5111 46.8735 41.4723 43.8078L41.752 43.5023L43.9567 40.9736C45.0028 39.7735 44.9137 37.9547 43.7808 36.8606L43.6677 36.757L37.4482 31.3356C36.2484 30.2895 34.4302 30.3781 33.3359 31.5108L33.2323 31.6239Z",fill:"#D93E3E",stroke:"#D93E3E",strokeWidth:.197686}),t.createElement("path",{d:"M8.67154 8.79528C5.48058 11.1926 4.75167 15.6985 6.95933 18.9722L7.1819 19.2844L7.53936 19.7607C9.50479 22.3766 13.1985 22.9741 15.8825 21.1645L16.1388 20.9816L20.3759 17.7984C21.6486 16.8421 21.9393 15.0447 21.0587 13.7388L20.9701 13.614L16.0139 7.01757C15.0576 5.74466 13.2601 5.45404 11.9542 6.33469L11.8294 6.4233L8.67154 8.79528Z",fill:"#D93E3E",stroke:"#D93E3E",strokeWidth:.197686}),t.createElement("path",{d:"M6.83924 18.8602C6.9519 19.0912 7.12064 19.4297 7.34436 19.8587C7.79182 20.7166 8.45972 21.9371 9.33978 23.386C10.9901 26.1032 13.3868 29.6229 16.4795 33.063L17.1074 33.7498C20.5051 37.4039 23.9984 40.181 26.6426 42.0438C27.9646 42.9752 29.0745 43.6779 29.8531 44.1477C30.2422 44.3824 30.5488 44.5589 30.7578 44.6768C30.8133 44.708 30.8629 44.734 30.9043 44.757L29.5396 35.7875C29.4555 35.8405 29.3339 35.9059 29.1691 35.9594C28.8237 36.0714 28.2975 36.1366 27.5615 35.9694C26.1845 35.6564 24.0703 34.53 21.0027 31.3698L20.3767 30.7106C16.9682 27.0451 15.8291 24.6737 15.5503 23.2071C15.4106 22.4724 15.4865 21.9635 15.6031 21.6342C15.6599 21.4737 15.7257 21.3565 15.7796 21.2781L6.76383 18.7021C6.7855 18.7472 6.81001 18.8004 6.83924 18.8602Z",fill:"#D93E3E",stroke:"#D93E3E",strokeWidth:.197686}),t.createElement("g",{opacity:.2},t.createElement("path",{d:"M15.0081 16.2093C14.1315 17.0338 14.0185 18.2219 14.2913 19.543C14.5143 20.6228 14.9945 21.7718 15.4974 22.8492C15.3878 21.8306 15.7213 21.3364 15.8443 21.1936L15.8531 21.1831L15.8647 21.1753L16.1388 20.9811L20.3758 17.7979C21.6485 16.8415 21.9395 15.044 21.0587 13.7382L20.9694 13.6142L19.6429 11.8468C19.5494 12.5916 19.0251 13.0911 18.6875 13.3512L18.421 13.5433L18.4203 13.544C18.4187 13.5452 18.4158 13.5466 18.4128 13.5489C18.4065 13.5539 18.397 13.5614 18.3849 13.5709C18.3605 13.59 18.3248 13.618 18.2794 13.6536C18.1882 13.7251 18.0575 13.8277 17.9008 13.9506C17.5874 14.1963 17.1683 14.5248 16.7466 14.855C16.3249 15.1851 15.8999 15.5172 15.5747 15.7707C15.2849 15.9968 15.0684 16.1632 15.0081 16.2079L15.0081 16.2093Z",fill:"#120405",stroke:"#D93E3E",strokeWidth:.197686}),t.createElement("path",{d:"M10.1719 24.7203C11.75 27.1902 13.8458 30.1268 16.4319 33.0106L17.1077 33.7504C20.5056 37.4045 23.9994 40.181 26.6436 42.0437C27.9653 42.9749 29.0742 43.6779 29.8528 44.1476C30.2421 44.3825 30.5491 44.5596 30.7582 44.6774C30.8126 44.708 30.861 44.7336 30.9019 44.7563L30.8965 44.7267L31.0875 44.8579C34.3137 47.0682 38.7512 46.6453 41.4926 43.7867L41.7526 43.503L43.9566 40.9737C45.0026 39.7737 44.9139 37.9556 43.7814 36.8613L43.6683 36.7577L41.3615 34.7451C41.3909 34.8205 41.413 34.8962 41.4291 34.9718C41.4963 35.2875 41.4516 35.5946 41.3537 35.8717C41.2078 36.2844 40.9418 36.6413 40.7408 36.8802L40.5683 37.
10774C37.6802 40.3052 34.1508 41.6875 30.1125 40.9307C26.2083 40.1989 21.8422 37.4699 17.1239 32.5152L16.6661 32.0291C15.2515 30.5078 12.6058 27.8506 10.1719 24.7203Z",fill:"#120405",stroke:"#D93E3E",strokeWidth:.197686})),t.createElement("path",{opacity:.2,d:"M9.77679 10.7311C9.0284 10.399 8.05213 10.8535 7.53392 11.8108L7.4367 12.0087C6.95226 13.0999 7.26061 14.2467 8.05862 14.6011C8.85678 14.9553 9.91497 14.4151 10.3994 13.3242C10.8535 12.3013 10.6102 11.2293 9.92045 10.8072L9.77679 10.7311Z",fill:"#FFF59C",stroke:"#D93E3E",strokeWidth:.197686}),t.createElement("path",{opacity:.4,d:"M27.9078 4.11067C32.9252 4.27608 37.8536 6.34326 41.5153 10.2813C45.1766 14.2188 46.8807 19.2835 46.6818 24.2991",stroke:"#D93E3E",strokeWidth:.988429,strokeMiterlimit:10,strokeLinecap:"round"}),t.createElement("path",{opacity:.8,d:"M27.6582 9.63269C31.2646 9.75465 34.8062 11.2419 37.4381 14.0725C40.0678 16.9007 41.294 20.5368 41.1566 24.1392",stroke:"#D93E3E",strokeWidth:.988429,strokeMiterlimit:10,strokeLinecap:"round"}),t.createElement("path",{d:"M27.4074 15.1552C29.6029 15.2338 31.7575 16.1409 33.36 17.8644C34.9581 19.5832 35.7065 21.7906 35.6302 23.9802",stroke:"#D93E3E",strokeWidth:.988429,strokeMiterlimit:10,strokeLinecap:"round"}),t.createElement("line",{x1:50.1806,y1:1.86207,x2:1.9047,y2:52.5517,stroke:"#F99898",strokeWidth:2.5})),c1="_container_19l6v_10",d1="_iconContainer_19l6v_14",C1="_confirmButton_19l6v_34",h1="_cancelButton_19l6v_41",u1="_goBackButton_19l6v_48",m1="_noteContainer_19l6v_55",a={container:c1,iconContainer:d1,confirmButton:C1,cancelButton:h1,goBackButton:u1,noteContainer:m1},j1=({onClose:r,shipmentIds:f,onCancel:n,isBulkAction:w=!1,onSuccess:k})=>{const[o,N]=t.useState(!1),{query:j,removeParam:H}=$(),_=j.order_status,A=_==="pending",{shipfastOrders:b,reloadShipfastOrders:Q}=e1(),M=j.selectAll==="true",{params:U}=t1(),D=()=>A?"order_and_address_confirmation":"ndr_management",{shipfastProfile:C}=r1(),{isShipfastChildUser:F,userUuid:T}=l1(),h=b==null?void 0:b.filter(s=>f.includes(s.id)),c=f==null?void 0:f.length,x=h==null?void 0:h.filter(s=>{var i,p,L;return((i=s.attributes)==null?void 0:i.callable)&&((L=(p=s.attributes)==null?void 0:p.enabled_agent)==null?void 0:L.agent_key)}).map(s=>s.id),d=x==null?void 0:x.length,u=d===0,W=async()=>{N(!0),w?I("shipfast_orders_bulk_ai_call_button_clicked",{tab:_,client_id:C==null?void 0:C.id,user_uuid:T,is_child_user:F}):I("shipfast_orders_ai_call_button_clicked",{tab:_,client_id:C==null?void 0:C.id,user_uuid:T,is_child_user:F});const{ok:s,data:i}=w?await s1({agentKey:D(),shipmentIds:x,selectAll:M,queryParams:M?{...U,search:j.search}:{}}):await i1({agentKey:D(),shipmentId:x[0]});s?(a1("Call(s) triggered successfully"),Q(),H("selected_order_ids"),k==null||k(),r()):n1((i==null?void 0:i.error)||"Failed to trigger call"),N(!1)},Y=u?"#D93E3E12":"var(--shipfast-primary-color-8)",z=u?e.jsx(o1,{}):e.jsx(q,{}),G=u?"Call cannot be processed":"Confirm Call Processing",X=u?"#D93E3E":"#3D3D6B",J=A?"order_and_address_confirmation":"ndr_management",m=h==null?void 0:h.reduce((s,i)=>{var L,O;const p=(O=(L=i==null?void 0:i.attributes)==null?void 0:L.calls)==null?void 0:O.find(v=>{var S;return((S=v==null?void 0:v.agent)==null?void 0:S.key)===J});return s+((p==null?void 0:p.status)=="completed"?1:0)},0),E=c-(m+d),Z=c!=d,V=m==0?e.jsxs("span",{children:[e.jsx("b",{children:"Note: "}),"Of the ",e.jsx("b",{children:c})," selected"," ",y("order",c),","," ",e.jsx("b",{children:E})," ",E>1?"are":"is"," ","ineligible"]}):E==0?e.jsxs("span",{children:[e.jsx("b",{children:"Note: "}),"Of the ",e.jsx("b",{children:c})," selected"," ",y("order",c),","," ",e.jsx("b",{children:m})," ",m>1?"have":"has"," ","already completed AI call(s)"]}):e.jsxs("span",{children:[e.jsx("b",{children:"Note: "}),"Of the ",e.jsx("b",{children:c})," selected orders,"," ",e.jsx("b",{children:E})," ",E>1?"are":"is"," ","ineligible and ",e.jsx("b",{children:m})," ",m>1?"have":"has"," already completed AI call(s)"]});return M?e.jsx(K,{hideHeader:!0,onClose:n||r,width:"small",children:e.jsxs(l,{vertical:!0,className:a.container,gap:24,children:[e.jsx(l,{justify:"flex-end",children:e.jsx(R,{onClose:n||r})}),e.jsx(l,{className:a.iconContainer,justify:"center",align:"center",style:{backgroundColor:"var(--shipfast-primary-color-8)"},children:e.jsx(q,{})}),e.jsxs(l,{vertical:!0,gap:0,align:"center",children:[e.jsx(g.Title,{level:4,style:{color:"#3D3D6B"},children:"Confirm Call Processing"}),e.jsx(g.Text,{type:"secondary",style:{textAlign:"center"},children:"You have selected all the orders to initiate call processing."})]}),e.jsxs(l,{justify:"center",gap:12,children:[e.jsx(B,{onClick:n||r,disabled:o,className:a.cancelButton,children:"CANCEL"}),e.jsx(P,{onClick:W,type:"primary",disabled:o,loading:o,className:a.confirmButton,children:"CONFIRM"})]})]})}):e.jsx(K,{hideHeader:!0,onClose:n||r,width:"small",children:e.jsxs(l,{vertical:!0,className:a.container,gap:24,children:[e.jsx(l,{justify:"flex-end",children:e.jsx(R,{onClose:n||r})}),e.jsx(l,{className:a.iconContainer,justify:"center",align:"center",style:{backgroundColor:Y},children:z}),e.jsxs(l,{vertical:!0,gap:0,align:"center",children:[e.jsx(g.Title,{level:4,style:{color:X},children:G}),u?e.jsx(g.Text,{type:"secondary",style:{textAlign:"center"},children:"No selected orders are eligible for AI call"}):Z?e.jsxs(g.Text,{type:"secondary",style:{textAlign:"center"},children:["By confirming, call will be processed for"," ",e.jsx("b",{children:d})," ",y("order",d),e.jsx("br",{})]}):e.jsxs(g.Text,{type:"secondary",style:{textAlign:"center"},children:["You have selected ",e.jsx("b",{children:d})," ",y("order",d)," to initiate call",e.jsx("br",{}),"processing."]})]}),Z&&e.jsx(l,{className:a.noteContainer,children:V}),u?e.jsx(l,{justify:"center",gap:12,children:e.jsx(B,{onClick:n||r,disabled:o,className:a.goBackButton,children:"GO BACK"})}):e.jsxs(l,{justify:"center",gap:12,children:[e.jsx(B,{onClick:n||r,disabled:o,className:a.cancelButton,children:"CANCEL"}),e.jsx(P,{onClick:W,type:"primary",disabled:o,loading:o,className:a.confirmButton,children:"CONFIRM"})]})]})})};export{j1 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.