1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c2300d90-d3a8-52e0-9054-412cc6dba40a")}catch(e){}}(); 2import{u as De,a4 as ut,e as Re,q as B,r as s,c as J,aK as Ke,aL as Be,k as d,n,j as e,T as _,$ as Je,a0 as we,a1 as Le,B as le,o as U,t as Qe,W as Ue,N as Te,X as pt,Y as ht,s as mt,m as gt,Z as bt,a2 as Ct,w as Ze,a7 as ft,eH as ze,b3 as Ve,D as vt,bQ as St,bT as _t,g8 as At,z as he,bR as Xe,V as Fe,M as We,_ as ie,l as Ae,C as yt,cx as Ge,F as kt,fs as Tt,ad as Ie,aF as et,cL as It,bV as tt,c6 as Mt,ae as nt,L as Rt,g9 as wt,af as Lt,ag as Et,aN as He,A as ye,bK as Pt,P as xt,ga as Nt}from"./index-DmqEQZ_1.js";import{E as Ot}from"./empty-shipment-0z4UaUEC.js";import{C as Ye}from"./CustomEmptyState-t0kq3jiO.js";import{I as q,C as $t}from"./IndexTableCell-C9o6fpFn.js";import{M as Dt,a as Bt}from"./MobileIndexTableWrapper-DMPHdq70.js";import{F as Ut,T as je,S as zt}from"./TableListPaginator-CK5HvAHX.js";import{u as Vt}from"./useDateRangePicker-jUwaBI32.js";import{u as Wt}from"./useIndexTableSelectionState-D3KujluR.js";import{u as Gt}from"./usePaginationMetadata-Bc3tMKhH.js";import{S as pe}from"./sortOrder-CV10GBqu.js";import{E as Ht}from"./ExportShipmentsButton-DGF8y-k6.js";import{B as qe}from"./BulkEditShipmentTagsModal-tM_Sv-LA.js";import{u as st}from"./useDownloadShippingDocuments-Bn9Y9VAr.js";import{u as Yt,O as Oe}from"./useCountryListFilterOptions-CKVJU3qI.js";import{T as jt}from"./TableListClearAllFiltersButton-DlTFT1wp.js";import{u as qt}from"./useOrgCarrierServiceOptions-DbK4lkm6.js";import{u as Kt}from"./useShipmentTagOptions-Bs4s7X_O.js";import{C as Jt}from"./CopyToClipboardButton-D05Iw1QK.js";import{M as Qt}from"./MobileCopyToClipboardButton-26B057I0.js";import{O as Zt}from"./index-SH1odjlJ.js";import{O as Xt}from"./OverflowText-BY_PSFIW.js";import{C as at}from"./CloneShipmentModal-8GcME8dL.js";import{F as rt}from"./FeatureIndicatorsStack-DrcxmfPf.js";import{M as Ft,R as en}from"./RequestInTransitReturnConfirmModal-Dp0rJLbY.js";import{R as ot}from"./ReturnShipmentIndicator-ClSKjtNF.js";import{E as it}from"./EditShipmentTagsModal-B5LzqRvt.js";import{u as tn}from"./useCarrierLogo-BBrwri0x.js";import{u as nn}from"./useCountry-C6qYWgzP.js";import{C as sn}from"./carrier-BOl6OKCc.js";import{O as an}from"./bucket-10-B1mB5QUF.js";import{o as rn}from"./omit-Ccfueyna.js";import"./SkeletonDisplayText-6JVwGM8Z.js";import"./SkeletonBodyText-DISN5OIt.js";import"./SkeletonThumbnail-CUsX453v.js";import"./PageAction-BToGa3gb.js";import"./file-exports-CwR4w7fO.js";import"./ShipmentTagsSelect-C1X_tELp.js";import"./_baseUnset-DvIg8w3J.js";import"./last-DXTTfs9a.js";import"./shippingLabelSize-K15_mY2G.js";import"./useCountryOptions-hLpn5iu0.js";import"./countries-BhE82V1V.js";import"./groupBy-DBLwNMIR.js";import"./_createAggregator-B587KDqf.js";import"./carrier-services-qYSKLoQ3.js";import"./index-tVVBEcEv.js";import"./zonos-logo-CKwfRRSC.js";import"./CustomCarrierAccount-CkgVtrdQ.js";import"./SsCare-DjqZHPOn.js";import"./ShipmentTagsSection-BKOIB7EP.js";import"./merchantOfRecord-DdjkzC68.js";import"./shipment-BFTbbL-x.js";import"./empty-CmuRKk3V.js";const K={label_created_at:"label_created_at",order_ref:"order_ref"};var S=(t=>(t.SENDER_COUNTRY="senderCountry",t.RECEIVER_COUNTRY="receiverCountry",t.DATE_RANGE="labelCreatedDate",t.CARRIER_SERVICE="carrierService",t.SHIPMENT_TAG="shipmentTags",t))(S||{});const $e=100,on=U("div",{target:"e1ut68b91"})("position:sticky;bottom:0;left:0;right:0;background-color:#fff;padding:var(--p-space-4) var(--p-space-6);box-shadow:0px 3px 6px -3px rgba(23, 24, 24, 0.08),0px 8px 20px -4px rgba(23, 24, 24, 0.12);z-index:40;@media (max-width: ",Qe.breakpoints["breakpoints-md"],"){padding:var(--p-space-4) var(--p-space-5) var(--p-space-3);}"),ln=U("div",{target:"e1ut68b90"})({name:"19mh0x6",styles:"display:flex;align-items:center;justify-content:flex-end"}),cn=({selectedShipments:t,refetch:y,clearSelection:p})=>{const{userOrganization:T}=De();ut(T);const{t:c}=Re(),{value:m,toggle:r}=B(!1),{value:R,toggle:g}=B(!1),{value:v,toggle:I}=B(!1),u=s.useMemo(()=>t.length,[t]),{mutateAsync:A}=st(),b=s.useCallback(async()=>{await A(t.map(C=>{const{id:M,trackingNumber:P,labelUrl:H,thermalLabelUrl:f,commercialInvoiceUrl:N,packingSlipUrl:O,orderRef:z=""}=C;return{id:M,trackingNumber:P,labelUrl:H,thermalLabelUrl:f,commercialInvoiceUrl:N,packingSlipUrl:O,orderRef:z}})),J.track({event:"bulk_shipments_docs_downloaded",properties:{shipment_cnt:t.length,shipment_carriers:t.map(C=>C.carrierSlug),shipment_carrier_services:t.map(C=>C.carrierService.slug),shipment_org_carrier_account_ids:Ke(t,Be.map(C=>{var M;return(M=C.orgCarrierAccount)==null?void 0:M.id}),Be.compact)}})},[A,t]),L=s.useCallback(()=>{r(),p(),y()},[p,y,r]),h=s.useCallback(()=>{g(),p(),y()},[p,y,g]),E=s.useMemo(()=>[{items:[{content:c("pages.shipments.tableList.bulkActions.addTags",{count:t.length}),onAction:r},{content:c("pages.shipments.tableList.bulkActions.removeTags",{count:t.length}),onAction:g}]}],[t.length,c,r,g]);return d(on,{children:[d(n,{alignment:"center",distribution:"fill",children:[e(_,{variant:"bodyMd",as:"span",fontWeight:"semibold",children:u===0?c("pages.shipments.tableList.selectTips"):c("pages.shipments.tableList.selectedCountWithLimit",{count:u,limit:$e})}),e(n.Item,{fill:!0,children:e(ln,{children:d(Je,{children:[e(we,{active:v,activator:e(le,{onClick:I,disclosure:v?"down":"up",children:c("pages.shipments.tableList.bulkActions.moreOptions")}),autofocusTarget:"first-node",onClose:I,children:e(Le,{actionRole:"menuitem",sections:E})}),e(le,{primary:!0,disabled:t.length===0,onClick:b,children:c("pages.shipments.downloadShippingDocument",{count:t.length})})]})})})]}),m&&e(qe,{mode:"add",shipmentIds:t.map(C=>C.id),onClose:r,onSettled:L}),R&&e(qe,{mode:"remove",shipmentIds:t.map(C=>C.id),onClose:g,onSettled:h})]})},ke=U("div",{target:"erc8liv2"})({name:"12ls1rh",styles:".Polaris-OptionList{margin-top:-8px;padding:0;.Polaris-Box{border:none;padding:0;}.Polaris-OptionList__Title,.Polaris-OptionList-Option__Label{padding-left:0;padding-right:0;}}"}),dn=U("div",{target:"erc8liv1"})({name:"xh0ihz",styles:"& .Polaris-Button__Icon{line-height:0;}"}),un=U("div",{target:"erc8liv0"})({name:"1j6ew5d",styles:"& .Polaris-ActionList__Item.Polaris-ActionList--active svg{fill:var
2(--p-icon-success);}"}),pn=({searchInput:t,senderCountryFilter:y,receiverCountryFilter:p,dateRangeFilter:T,carrierServiceFilter:c,shipmentTagIdFilter:m,formattedDateRangeFilter:r,dateRangeMonthYear:R,disableDates:g,sortField:v,sortOrder:I,onQueryChange:u,onQueryClear:A,onSenderCountryFilterChange:b,onSenderCountryFilterClear:L,onReceiverCountryFilterChange:h,onReceiverCountryFilterClear:E,onCarrierServiceFilterChange:C,onCarrierServiceFilterClear:M,onShipmentTagIdFilterChange:P,onShipmentTagIdFilterClear:H,onDateRangeFilterChange:f,onDateRangeFilterClear:N,onDateRangeMonthYearChange:O,onSortFieldChange:z,onSortOrderChange:V})=>{const{t:i}=Re(),{countriesByContinent:ee,countries:W}=Yt(),{carrierServices:Y,carrierServicesGroupedByCarrierName:ae}=qt(),{shipmentTagOptions:Q}=Kt(),{value:ce,setFalse:Z,toggle:X}=B(!1),o=s.useMemo(()=>{const x=[];if(r!=null&&r.start&&r.end&&x.push({key:S.DATE_RANGE,label:`${i(`pages.shipments.tableList.filters.${S.DATE_RANGE}.label`)}: ${r.start} - ${r.end}`,onRemove:N}),c&&c.length>0){const w=c.slice(0,3).map(ne=>{var se;return((se=Y.find(re=>re.value===ne))==null?void 0:se.label)??ne}).join(", "),$=c.slice(3),l=i(`pages.shipments.tableList.filters.${S.CARRIER_SERVICE}.label`);x.push({key:S.CARRIER_SERVICE,label:c.length>3?`${l}: ${w} ${i("pages.shipments.tableList.filters.andWithCount",{count:$.length})}`:`${l}: ${w}`,onRemove:M})}if(y.length>0){const w=W.filter(l=>y.includes(l.value)).slice(0,3).map(l=>l.label).join(", "),$=y.slice(3);x.push({key:S.SENDER_COUNTRY,label:y.length>3?`${i(`pages.shipments.tableList.filters.${S.SENDER_COUNTRY}.label`)}: ${w} ${i("pages.shipments.tableList.filters.andWithCount",{count:$.length})}`:`${i(`pages.shipments.tableList.filters.${S.SENDER_COUNTRY}.label`)}: ${W.filter(l=>y.includes(l.value)).map(l=>l.label).join(", ")}`,onRemove:L})}if(p.length>0){const w=W.filter(l=>p.includes(l.value)).slice(0,3).map(l=>l.label).join(", "),$=p.slice(3);x.push({key:S.RECEIVER_COUNTRY,label:p.length>3?`${i(`pages.shipments.tableList.filters.${S.RECEIVER_COUNTRY}.label`)}: ${w} ${i("pages.shipments.tableList.filters.andWithCount",{count:$.length})}`:`${i(`pages.shipments.tableList.filters.${S.RECEIVER_COUNTRY}.label`)}: ${W.filter(l=>p.includes(l.value)).map(l=>l.label).join(", ")}`,onRemove:E})}if(m.length>0){const w=W.filter(l=>m.includes(l.value)).slice(0,3).map(l=>l.label).join(", "),$=m.slice(3);x.push({key:S.SHIPMENT_TAG,label:m.length>3?`${i(`pages.shipments.tableList.filters.${S.SHIPMENT_TAG}.label`)}: ${w} ${i("pages.shipments.tableList.filters.andWithCount",{count:$.length})}`:`${i(`pages.shipments.tableList.filters.${S.SHIPMENT_TAG}.label`)}: ${Q.filter(l=>m.includes(l.value)).map(l=>l.label).join(", ")}`,onRemove:H})}return x},[c,Y,y,p,W,m,Q,r.end,r.start,M,L,E,H,N,i]),F=s.useMemo(()=>[{title:i("pages.shipments.tableList.sorters.title"),items:[{prefix:e(Ue,{label:!0,checked:v===K.label_created_at}),content:i("pages.shipments.tableList.sorters.fields.labelCreatedAt.label"),onAction:()=>z(K.label_created_at)},{prefix:e(Ue,{label:!0,checked:v===K.order_ref}),content:i("pages.shipments.tableList.sorters.fields.orderRef.label"),onAction:()=>z(K.order_ref)}]},{items:[{prefix:e(pt,{fill:"#006D41"}),active:I===pe.asc,content:Te(v).with(K.label_created_at,()=>i("pages.shipments.tableList.sorters.orders.oldestFirst.label")).with(K.order_ref,()=>i("pages.shipments.tableList.sorters.orders.aToZ.label")).exhaustive(),onAction:()=>V(pe.asc)},{prefix:e(ht,{}),active:I===pe.desc,content:Te(v).with(K.label_created_at,()=>i("pages.shipments.tableList.sorters.orders.newestFirst.label")).with(K.order_ref,()=>i("pages.shipments.tableList.sorters.orders.zToA.label")).exhaustive(),onAction:()=>V(pe.desc)}]}],[z,V,v,I,i]),te=s.useCallback(()=>{A(),J.track({event:"listing_search_keyword_cleared",properties:void 0})},[A]),k=s.useCallback(()=>{A(),N(),M(),L(),E(),J.track({event:"listing_search_all_filters_cleared",properties:void 0})},[M,L,E,N,A]),j=mt();return d(n,{spacing:"loose",children:[e(n.Item,{fill:!0,children:d(n,{spacing:"tight",children:[e(n.Item,{fill:!0,children:e(Ut,{filters:[{key:S.DATE_RANGE,label:i(`pages.shipments.tableList.filters.${S.DATE_RANGE}.label`),filter:e(gt,{allowRange:!0,multiMonth:!0,month:R.month,year:R.year,selected:T?{start:T==null?void 0:T.start.toJSDate(),end:T==null?void 0:T.end.toJSDate()}:void 0,disableDatesBefore:g==null?void 0:g.before.toJSDate(),disableDatesAfter:g==null?void 0:g.after.toJSDate(),onMonthChange:O,onChange:f}),shortcut:!0},{key:S.CARRIER_SERVICE,label:i(`pages.shipments.tableList.filters.${S.CARRIER_SERVICE}.label`),filter:e(ke,{children:e(bt,{allowMultiple:!0,selected:c??[],sections:Object.entries(ae).map(([x,w])=>({title:x,options:w})),onChange:C})}),shortcut:!0},{key:S.SENDER_COUNTRY,label:i(`pages.shipments.tableList.filters.${S.SENDER_COUNTRY}.label`),filter:e(ke,{children:e(Oe,{labelHidden:!0,allowMultiple:!0,label:i("form.fields.country.label"),placeholder:i("form.fields.country.placeholder"),selected:y??[],sections:ee,onChange:b})}),hideClearButton:!0,shortcut:!0},{key:S.RECEIVER_COUNTRY,label:i(`pages.shipments.tableList.filters.${S.RECEIVER_COUNTRY}.label`),filter:e(ke,{children:e(Oe,{labelHidden:!0,allowMultiple:!0,label:i("form.fields.country.label"),placeholder:i("form.fields.country.placeholder"),selected:p??[],sections:ee,onChange:h})}),hideClearButton:!0,shortcut:!0},{key:S.SHIPMENT_TAG,label:i(`pages.shipments.tableList.filters.${S.SHIPMENT_TAG}.label`),filter:e(ke,{children:e(Oe,{labelHidden:!0,allowMultiple:!0,label:i("form.fields.shipmentTags.label"),placeholder:i("form.fields.shipmentTags.placeholder.search"),selected:m,sections:[{options:Q}],onChange:P})}),hideClearButton:!0,shortcut:!0}],appliedFilters:o,queryValue:t,queryPlaceholder:i("pages.shipments.tableList.filters.searchField.placeholderWithTrackingNo"),onQueryChange:u,onQueryClear:te,onClearAll:k})}),e(n.Item,{children:e(dn,{children:e(Je,{segmented:!0,children:e(we,{active:ce,activator:e(le,{onClick:X,icon:e(Ct,{size:20})}),onClose:Z,children:e(un,{children:e(Le,{sections:F})})})})})})]})}),j&&e(n.Item,{children:e(jt,{disabled:t.trim()===""&&o.length===0,onClick:k})})]})},hn=U(q,{target:"e148hoby2"})({name:"1u2ihad",styles:"width:var(--p-space-32)"}),Me=U(Xt,{target:"e148hoby1"})({name:"1lsto0t",styles:"max-width:250px"}),mn=U("div",{target:"e148hoby0"})({name:"vza5a8",styles:"a{width:100%;}.Polaris-Button__Text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}"}),gn=({shipment:t,index:y,selected:p,disabled:T,formattedLabelCreatedAt:c,senderCountryName:m,receiverCountryName:r,carrierLogo:R,dropdownActions:g,activator:v,showMenu:I,closeMenu:u,handleTrackingNumberClick:A,handleTrackingNumberCopy:b,showCloneShipmentModal:L,closeCloneShipmentModal:h,showEditShipmentTagsModal:E,closeEditShipmentTagsModal:C,refetch:M})=>d(nt.Row,{id:t.id,position:y,selected:p,disabled:T,onClick:()=>{},children:[e(Dt,{children:d(n,{vertical:!0,distribution:"center",spacing:"tight",children:[e(n.Item,{children:d(n,{alignment:"center",children:[e(n.Item,{children:e(rt,{...t})}),e(n.Item,{fill:!0}),e(n.Item,{children:e(n,{distribution:"center",children:e("div",{onMouseLeave:u,children:e(n,{alignment:"center",wrap:!1,children:g.length>0&&e(we,{active:I,activator:v,autofocusTarget:"first-node",onClose:u,children:e("div",{onMouseLeave:u,children:e(Le,{actionRole:"menuitem",items:g})})})})})})})]})}),e(n.Item,{children:e(n,{alignment:"center",spacing:"tight",children:e(_,{variant:"bodyMd",as:"span",color:"subdued",children:c})})}),d(n.Item,{children:[e(_,{as:"p",variant:"bodyMd",color:"subdued",children:`${t.ssid}${t.orderRef?` ⢠${t.orderRef}`:""}`}),e(ot,{show:!!t.toReturnShipmentId})]}),e(n.Item,{children:d(n,{alignment:"center",children:[e(n.Item,{children:e(Tt,{size:"24",color:"var(--p-icon)"})}),e(n.Item,{children:d(n,{vertical:!0,spacing:"none",children:[e(n.Item,{children:t.senderAddress.name&&t.senderAddress.name.length>30?e(Ie,{content:t.senderAddress.name,children:e(Me,{children:e(_,{truncate:!0,as:"span",variant:"bodyMd",children:t.senderAddress.name})})}):e("p",{children:d(_,{as:"p",variant:"bodyMd",children:[t.senderAddress.name??"--"," ",d(_,{variant:"bodyMd",as:"span",color:"subdued",children:["(",m??"--",")"]})]})})}),e(n.Item,{children:t.receiverAddress.name&&t.receiverAddress.name.length>30?e(Ie,{content:t.receiverAddress.name,children:e(Me,{children:e(_,{truncate:!0,as:"span",variant:"bodyMd",children:t.receiverAddress.name})})}):e("p",{children:d(_,{as:"p",variant:"bodyMd",children:[t.receiverAddress.name??"--"," ",d(_,{variant:"bodyMd",as:"span",color:"subdued",children:["(",r??"--",")"]})]})})})]})})]})}),e(n.Item,{children:d(n,{alignment:"center",children:[e(n.Item,{children:e(et,{source:R,alt:t.carrierService.name??"",size:"extraSmall"})}),e(n.Item,{fill:!0,children:e(_,{truncate:!0,as:"p",variant:"bodyMd",children:t.carrierService.name??"--"})})]})}),e(n.Item,{children:d(n,{alignment:"center",wrap:!1,children:[e(n.Item,{children:e(It,{size:"24",color:"var(--p-icon)"})}),e(n.Item,{fill:!0,children:e(tt,{children:e(n,{spacing:"tight",alignment:"center",wrap:!1,children:e(n.Item,{children:d(n,{spacing:"extraTight",alignment:"center",wrap:!1,children:[e(n.Item,{children:e(Mt,{size:"16",color:"var(--p-icon)"})}),e(n.Item,{children:e(mn,{children:e(le,{plain:!0,monochrome:!0,external:!0,url:t.trackingUrl,onClick:A,children:t.trackingNumber??""})})})]})})})})}),e(n.Item,{}),e(n.Item,{children:e(Qt,{text:t.trackingNumber??"",onCopy:b})})]})})]})}),L&&e(at,{shipmentId:t.id,onClose:h}),E&&e(it,{shipmentId:t.id,shipmentTags:t.shipmentTags,onClose:C,refetch:M})]}),bn=({shipment:t,index:y,selected:p,disabled:T,formattedLabelCreatedAt:c,senderCountryName:m,receiverCountryName:r,carrierLogo:R,dropdownActions:g,activator:v,showMenu:I,closeMenu:u,handleTrackingNumberClick:A,handleTrackingNumberCopy:b,t:L,showCloneShipmentModal:h,closeCloneShipmentModal:E,showEditShipmentTagsModal:C,closeEditShipmentTagsModal:M,refetch:P})=>d(nt.Row,{id:t.id,position:y,selected:p,disabled:T,onClick:()=>{},children:[e(q,{children:d(n,{vertical:!0,spacing:"none",children:[e(Rt,{to:he.viewShipment({i
2d:t.id,previousList:Xe.DOWNLOAD_AND_PRINT}),style:{color:"inherit"},children:e(_,{as:"p",variant:"bodyMd",children:t.orderRef})}),e(ot,{show:!!t.toReturnShipmentId}),e(_,{variant:"bodyMd",as:"span",color:"subdued",children:c})]})}),e(q,{children:d(n,{wrap:!1,children:[e(Jt,{text:t.trackingNumber??"",label:L("pages.shipments.tableList.columns.shipmentTrackingNumber.label"),onCopy:b}),e(tt,{children:e(le,{plain:!0,monochrome:!0,external:!0,url:t.trackingUrl,onClick:A,children:t.trackingNumber??""})})]})}),d(q,{children:[e(Ie,{content:t.receiverAddress.name,children:e(Me,{children:e(_,{as:"span",variant:"bodyMd",children:t.receiverAddress.name})})}),e(_,{variant:"bodyMd",as:"span",color:"subdued",children:r})]}),e(q,{children:d(n,{alignment:"center",wrap:!1,children:[e(et,{source:R,alt:t.carrierService.name??"",size:"small"}),e(_,{as:"p",variant:"bodyMd",children:t.carrierService.name??"--"})]})}),e(q,{children:e(rt,{...t})}),d(q,{children:[e(Ie,{content:t.senderAddress.name,children:e(Me,{children:e(_,{as:"span",variant:"bodyMd",children:t.senderAddress.name})})}),e(_,{variant:"bodyMd",as:"span",color:"subdued",children:m})]}),e(q,{children:e(Zt,{orderSource:t.store,isShopifyZonosOrder:t==null?void 0:t.isShopifyZonosOrder})}),e(q,{children:e(_,{as:"p",variant:"bodyMd",children:t.ssid})}),e(hn,{children:e("div",{onMouseLeave:u,children:e(n,{alignment:"center",wrap:!1,children:g.length>0&&e(we,{active:I,activator:v,autofocusTarget:"first-node",onClose:u,children:e("div",{onMouseLeave:u,children:e(Le,{actionRole:"menuitem",items:g})})})})})}),h&&e(at,{shipmentId:t.id,onClose:E}),C&&e(it,{shipmentId:t.id,shipmentTags:t.shipmentTags,onClose:M,refetch:P})]}),Cn=({shipment:t,index:y,selected:p,disabled:T,refetch:c,showToast:m})=>{var Se,oe;const{t:r,i18n:R}=Re(),g=Ze(),{formatDate:v}=ft(),{getCountryByAlpha2:I}=nn(),{userOrganization:u,userOrgConfigs:A}=De(),b=s.useMemo(()=>{var a;return(a=I(t.senderAddress.country))==null?void 0:a.name[ze[R.language]]},[I,R.language,t.senderAddress.country]),L=s.useMemo(()=>{var a;return(a=I(t.receiverAddress.country))==null?void 0:a.name[ze[R.language]]},[I,R.language,t.receiverAddress.country]),h=s.useMemo(()=>Ke(t.labelCreatedAt,Ve(a=>vt.fromISO(a)),Ve(v)),[v,t.labelCreatedAt]),E=tn(t.carrierService.carrierLogoUrl),{value:C,setTrue:M,setFalse:P}=B(!1),{value:H,setTrue:f,setFalse:N}=B(!1),{value:O,setTrue:z,setFalse:V}=B(!1),{value:i,setTrue:ee,setFalse:W}=B(!1),{value:Y,setTrue:ae,setFalse:Q}=B(!1),{value:ce,toggle:Z}=B(!1),X=s.useCallback(()=>{J.track({event:"shipment_tracking_link_clicked",properties:{shipment_id:t.id}})},[t.id]),o=s.useCallback(()=>{J.track({event:"shipment_tracking_no_copied",properties:{shipment_id:t.id}})},[t.id]),{mutateAsync:F,isLoading:te}=st(),{mutateAsync:k,isLoading:j}=St(),{mutateAsync:x}=_t(),{mutateAsync:w,isLoading:$,error:l,isSuccess:ne,reset:se}=At(),re=s.useCallback(async()=>{const{id:a,trackingNumber:D,labelUrl:_e,thermalLabelUrl:Ne,commercialInvoiceUrl:lt="",packingSlipUrl:ct="",orderRef:dt=""}=t;F([{id:a,trackingNumber:D,labelUrl:_e,thermalLabelUrl:Ne,commercialInvoiceUrl:lt,packingSlipUrl:ct,orderRef:dt}])},[F,t]),me=e(le,{onClick:M,plain:!0,monochrome:!0,icon:e(an,{size:24})}),ge=s.useCallback(()=>{g(he.viewShipment({id:t.id,previousList:Xe.DOWNLOAD_AND_PRINT}))},[g,t.id]),be=s.useCallback(async()=>{const a=await x({orgId:u.id,shipmentId:t.id});J.track({event:"shipment_draft_created",properties:{shipment_id:a.id,cloned_from_shipment_id:void 0,to_return_shipment_id:t.id,from_country:a.senderAddress.country??null,from_state:a.senderAddress.state??null,from_city:a.senderAddress.city??null,to_country:a.receiverAddress.country??null,to_state:a.receiverAddress.state??null,to_city:a.receiverAddress.city??null,to_address_is_residential:a.receiverAddress.isResidential??null}}
2),g(he.editShipment({id:a.id}))},[x,g,t.id,u]),Ce=s.useCallback(async()=>{f()},[f]),fe=s.useCallback(async()=>{ae()},[ae]),Ee=s.useCallback(async()=>{await k({shipmentId:t.id,orgId:u.id}),J.track({event:"shipment_marked_as_delivered",properties:{shipment_id:t.id}}),V(),c(),m()},[V,k,c,t.id,m,u]),ve=s.useCallback(()=>{P(),Z()},[P,Z]),Pe=s.useCallback(async()=>{await w({shipmentId:t.id,orgId:u.id})},[w,t.id,u]),G=s.useCallback(()=>{se(),Z(),c()},[c,se,Z]),de=s.useMemo(()=>t.carrierSlug===sn.SPACESHIP_AIR,[t.carrierSlug]),ue=s.useMemo(()=>{const a=[{content:r("pages.shipments.downloadShippingDocument"),disabled:te,onAction:re},{content:r("pages.shipments.viewShipment"),onAction:ge}];return A!=null&&A.isReturnEnabled&&a.push({content:r("pages.shipments.shipmentReturn.requestReturn"),disabled:de||t.isUsingOrgCarrierAccount,onAction:ee},{content:r("pages.shipments.shipmentReturn.postDeliveryReturn.create"),disabled:!t.isPostDeliveryReturnEnabled,onAction:be}),a.push({content:r("pages.shipments.cloneShipment"),onAction:Ce},{content:r("pages.shipments.editShipmentTags"),onAction:fe},{content:r("pages.shipments.markAsDelivered"),onAction:z},{content:r("pages.shipments.cancelAndRefund.button.cancelAndRefund"),destructive:!0,onAction:ve}),a},[ve,re,Ce,be,fe,ge,te,de,z,ee,t.isPostDeliveryReturnEnabled,t.isUsingOrgCarrierAccount,r,A==null?void 0:A.isReturnEnabled]),xe=Fe();return d(kt,{children:[xe?e(gn,{shipment:t,index:y,selected:p,disabled:T,formattedLabelCreatedAt:h,senderCountryName:b,receiverCountryName:L,carrierLogo:E,dropdownActions:ue,activator:me,showMenu:C,openMenu:M,closeMenu:P,handleTrackingNumberClick:X,handleTrackingNumberCopy:o,t:r,showCloneShipmentModal:H,closeCloneShipmentModal:N,showEditShipmentTagsModal:Y,closeEditShipmentTagsModal:Q,refetch:c}):e(bn,{shipment:t,index:y,selected:p,disabled:T,formattedLabelCreatedAt:h,senderCountryName:b,receiverCountryName:L,carrierLogo:E,dropdownActions:ue,activator:me,showMenu:C,openMenu:M,closeMenu:P,handleTrackingNumberClick:X,handleTrackingNumberCopy:o,t:r,showCloneShipmentModal:H,closeCloneShipmentModal:N,showEditShipmentTagsModal:Y,closeEditShipmentTagsModal:Q,refetch:c}),O&&e(Ft,{isMarkingAsDelivered:j,handleMarkAsDelivered:Ee,closeConfirmMarkAsDeliveredModal:V}),i&&e(en,{isConfirmingShipped:!0,shipmentId:t.id,onClose:()=>{W(),c()}}),ce&&e(We,{open:!0,fullScreen:!0,title:r("pages.shipments.cancelShipmentModal.title"),primaryAction:Te({isSuccess:ne,errorCode:(Se=l==null?void 0:l.response)==null?void 0:Se.data.code}).with({isSuccess:!1,errorCode:ie.nullish},()=>({content:r("pages.shipments.cancelShipmentModal.submit"),loading:$,onAction:Pe,destructive:!0})).with({isSuccess:!0},()=>({content:r("pages.shipments.cancelShipmentModal.button.understand"),onAction:G})).with({errorCode:"ERR_PRO_API_SHIPMENT_INVALID_STATUS"},()=>({content:r("pages.shipments.cancelShipmentModal.button.understand"),onAction:G})).with({errorCode:ie.not(ie.nullish)},()=>({content:r("pages.shipments.cancelShipmentModal.button.understand"),onAction:()=>G})).otherwise(()=>{}),onClose:G,children:e(We.Section,{children:e("p",{children:Te({isSuccess:ne,errorCode:(oe=l==null?void 0:l.response)==null?void 0:oe.data.code}).with({isSuccess:!1,errorCode:ie.nullish},()=>e(Ae,{i18nKey:"pages.shipments.cancelShipmentModal.confirmation",values:{ssid:t.ssid}})).with({isSuccess:!0},()=>d(n,{vertical:!0,alignment:"center",children:[e(n.Item,{fill:!0,children:e(yt,{color:"var(--p-icon-success)",size:32})}),e(n.Item,{fill:!0,children:e(_,{as:"h1",variant:"headingLg",children:r("pages.shipments.cancelShipmentModal.result.success.title")})}),e(n.Item,{children:e(_,{as:"span",variant:"bodyMd",alignment:"center",children:e(Ae,{i18nKey:"pages.shipments.cancelShipmentModal.result.success.message",values:{ssid:t.ssid}})})})]})).with({errorCode:"ERR_PRO_API_SHIPMENT_INVALID_DELIVERY_STATUS"},()=>d(n,{vertical:!0,alignment:"center",children:[e(n.Item,{fill:!0,children:e(Ge,{color:"var(--p-icon-critical)",size:"32"})}),e(n.Item,{children:e(_,{as:"h1",variant:"headingLg",children:r("pages.shipments.cancelShipmentModal.result.failed.title")})}),e(n.Item,{children:e(_,{as:"span",variant:"bodyMd",alignment:"center",children:e(Ae,{i18nKey:"pages.shipments.cancelShipmentModal.result.failed.inTransitMessage",values:{ssid:t.ssid}})})})]})).with({errorCode:ie.not(ie.nullish)},()=>d(n,{vertical:!0,alignment:"center",children:[e(n.Item,{fill:!0,children:e(Ge,{color:"var(--p-icon-critical)",size:"32"})}),e(n.Item,{children:e(_,{as:"h1",variant:"headingLg",children:r("pages.shipments.cancelShipmentModal.result.failed.title")})}),e(n.Item,{children:e(_,{as:"span",variant:"bodyMd",alignment:"center",children:e(Ae,{i18nKey:"pages.shipments.cancelShipmentModal.result.failed.message",values:{ssid:t.ssid}})})})]})).otherwise(()=>null)})})})]})},fn=s.memo(Cn),vn=U("div",{target:"e1976cw52"})({name:"2ewnbj",styles:"padding:14px 14px 14px 20px"}),Sn=U("div",{target:"e1976cw51"})("height:100%;.Polaris-Page{margin-bottom:calc(0px - var(--p-space-4));}",({$isMobile:t})=>t&&` 3 @media (max-width: ${Qe.breakpoints["breakpoints-sm"]}) { 4 .Polaris-Page { 5 margin-bottom: calc(100px + var(--p-space-4)); 6 } 7 } 8 9 .Polaris-Button--primary { 10 border-radius: 4px; 11 padding: 0.5rem 1rem; 12 } 13 14 .Polaris-Header-Title { 15 font-size: 1rem; 16 } 17 18 .Polaris-Button__Content { 19 font-size: 14px; 20 } 21 22 .Polaris-Page-Header__Actions { 23 gap: 0.5rem; 24 }`,";"),_n=U("div",{target:"e1976cw50"})(({$isMobile:t})=>t&&` 25 .Polaris-IndexTable__StickyTable--condensed { 26 border-bottom: 1px solid var(--p-border-subdued); 27 } 28 29 .Polaris-IndexTable--condensedRow { 30 border-top: 0; 31 width: calc(100% + ${Bt}px); 32 border-bottom: 8px solid var(--p-surface-neutral-subdued); 33 } 34 35 .Polaris-IndexTable--condensedRow:last-child { 36 border-bottom: 0; 37 }`,";"),An=Object.freeze(["orderReference","shipmentTrackingNumber","receiver","carrierService","featureIndicators","sender","orderSource","ssid","actions"]),As=()=>{const{t}=Re(),y=Ze(),[p,T]=s.useState(1),[c]=s.useState(50),[m,r]=s.useState(""),[R,g]=s.useState(""),[v,I]=s.useState([]),[u,A]=s.useState([]),[b,L]=s.useState(),[h,E]=s.useState([]),[C,M]=s.useState(K.label_created_at),[P,H]=s.useState(pe.desc),{dateRange:f,dateRangeMonthYear:N,formattedDateRange:O,disableDates:z,setDateRange:V,handleDateRangeChange:i,handleDateRangeMonthYearChange:ee}=Vt(),W=s.useMemo(()=>["shipments","downloadAndPrint",c,m,u,b,O.start,O.end,C,P],[b,c,O.end,O.start,u,m,C,P]),{userOrganization:Y}=De(),{value:ae,setFalse:Q,setTrue:ce}=B(!1),Z=s.useMemo(()=>m.length>0||v.length>0||u.length>0||(b??[]).length>
370||((h==null?void 0:h.length)??0)>0||f!==void 0,[b,f,v.length,u.length,m.length,h==null?void 0:h.length]),X=s.useMemo(()=>{var a,D;return{keyword:m,senderCountries:v.length>0?v:void 0,receiverCountries:u.length>0?u:void 0,carrierServiceSlugs:(b??[]).length>0?b:void 0,shipmentTagIds:(h==null?void 0:h.length)>0?h:void 0,labelCreatedFromDate:(a=f==null?void 0:f.start)==null?void 0:a.startOf("day").toISO(),labelCreatedToDate:(D=f==null?void 0:f.end)==null?void 0:D.endOf("day").toISO()}},[b,f==null?void 0:f.end,f==null?void 0:f.start,v,u,h,m]),{data:o,isLoading:F,refetch:te}=wt((Y==null?void 0:Y.id)??"",{page:p,perPage:c,sortField:C,sortOrder:P,...X},{query:{onSettled:()=>{Z&&J.track({event:"listing_searched",properties:{keyword:X.keyword,filter_options:rn(X,"keyword")}})}}}),{cachedMetadata:k}=Gt(o==null?void 0:o.meta),{selectedResources:j,handleSelectionChange:x,clearSelection:w,areAllResourcesSelectedForThisPage:$}=Wt({resources:o==null?void 0:o.items,maxSelections:$e,resourceIdResolver:a=>a.id,pageLimit:k==null?void 0:k.limit}),l=s.useMemo(()=>Lt(An.map((a,D)=>({id:`${D}-heading`,title:t(`pages.shipments.tableList.columns.${a}.label`,"")}))),[t]),ne=s.useCallback(a=>{g(a)},[]),se=s.useCallback(()=>{g(""),r("")},[]),re=s.useCallback(a=>{I(a)},[I]),me=s.useCallback(()=>{I([])},[I]),ge=s.useCallback(a=>{A(a)},[A]),be=s.useCallback(()=>{A([])},[A]),Ce=s.useCallback(()=>{V(void 0)},[V]),fe=s.useCallback(a=>{L(a)},[]),Ee=s.useCallback(()=>{L(void 0)},[]),ve=s.useCallback(a=>{E(a)},[]),Pe=s.useCallback(()=>{E([])},[]),G=s.useCallback(a=>{T(a),J.track({event:"listing_page_switched",properties:{from_page:p,to_page:a}})},[p]),de=s.useCallback(()=>{G(p-1)},[p,G]),ue=s.useCallback(()=>{G(p+1)},[p,G]),xe=s.useMemo(()=>((o==null?void 0:o.meta.total)??0)>c,[o==null?void 0:o.meta.total,c]),Se=s.useMemo(()=>F||!!(o!=null&&o.items.length)||m||f||v.length>0||u.length>0||((b==null?void 0:b.length)??0)>0||((h==null?void 0:h.length)??0)>0,[b==null?void 0:b.length,f,F,v.length,u.length,h==null?void 0:h.length,m,o==null?void 0:o.items.length]);Et(()=>{r(R)},500,[R]),s.useEffect(()=>{T(1),w()},[w,W]);const oe=Fe();return d(Sn,{$isMobile:oe,children:[e(xt,{fullWidth:!0,title:t("pages.shipments.downloadAndPrint.title"),secondaryActions:e(Ht,{variant:"unshipped_label_created"}),children:e(He,{children:e(He.Section,{children:d(ye,{children:[Se&&e(ye.Section,{children:e(pn,{searchInput:R,senderCountryFilter:v,receiverCountryFilter:u,carrierServiceFilter:b,shipmentTagIdFilter:h,dateRangeFilter:f,dateRangeMonthYear:N,formattedDateRangeFilter:O,disableDates:z,sortField:C,sortOrder:P,onQueryChange:ne,onQueryClear:se,onSenderCountryFilterChange:re,onSenderCountryFilterClear:me,onReceiverCountryFilterChange:ge,onReceiverCountryFilterClear:be,onCarrierServiceFilterChange:fe,onCarrierServiceFilterClear:Ee,onShipmentTagIdFilterChange:ve,onShipmentTagIdFilterClear:Pe,onDateRangeFilterChange:i,onDateRangeFilterClear:Ce,onDateRangeMonthYearChange:ee,onSortFieldChange:M,onSortOrderChange:H})}),!!(o!=null&&o.items.length)&&e(ye.Section,{flush:!0,children:e(vn,{children:e(je,{currentItemsCount:(o==null?void 0:o.items.length)??0,totalItemsCount:(k==null?void 0:k.total)??0,currentPageIndex:p,totalPagesCount:(k==null?void 0:k.lastPage)??0,onPageChange:G,onPreviousPage:de,onNextPage:ue})})}),e(_n,{$isMobile:oe,children:d($t,{lastColumnSticky:!0,itemCount:(o==null?void 0:o.meta.total)??1,selectedItemsCount:$?"All":j.length,headings:l,loading:F,resourceName:{singular:"",plural:""},onSelectionChange:x,condensed:oe,emptyState:m.length||f?e(Ye,{title:t("pages.shipments.emptyState.notFound.title")}):e(Ye,{title:t("pages.shipments.emptyState.notFound.title"),desc:t("pages.shipments.emptyState.downloadAndPrint.desc"),image:Ot,action:{content:t("pages.shipments.emptyState.actions.goToDrafts"),onAction(){y(he.draftShipments({tab:Pt.IN_PROGRESS}))}}}),children:[!o&&Array.from({length:10}).map((a,D)=>e(zt,{index:D,columns:l.length},D)),o==null?void 0:o.items.map((a,D)=>{const _e=!!j.find(Ne=>Ne.id===a.id);return e(fn,{shipment:a,index:D,selected:_e,disabled:j.length>=$e&&!_e,refetch:te,showToast:ce},a.id)})]})}),xe&&e(ye.Section,{children:e(je,{currentItemsCount:(o==null?void 0:o.items.length)??0,totalItemsCount:(k==null?void 0:k.total)??0,currentPageIndex:p,totalPagesCount:(k==null?void 0:k.lastPage)??0,onPageChange:T,onPreviousPage:de,onNextPage:ue})})]})})})}),j.length>0&&e(cn,{selectedShipments:j,clearSelection:w,refetch:te}),ae&&e(Nt,{content:t("pages.shipments.markAsDeliveredModal.success"),action:{content:t("common.view"),onAction:()=>{window.location.replace(he.trackShipments())}},onDismiss:Q})]})};export{As as DownloadAndPrint,As as default}; 38//# debugId=c2300d90-d3a8-52e0-9054-412cc6dba40a 39//# sourceMappingURL=index-TWwwetKq.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.