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]="03bc5f24-108f-5fce-9573-3d99f37d78bb")}catch(e){}}(); 2import{e as Q,w as Re,fx as st,fV as it,q as K,r as s,c as ee,aC as Pe,aK as Se,aL as Z,z as ue,fz as ot,k as b,n as d,j as e,T as C,$ as He,a0 as ke,a1 as Ie,B as ye,N as te,bX as fe,a8 as _e,o as N,t as Ae,u as Ge,_ as Fe,fW as lt,fX as O,ag as ct,W as Oe,X as dt,Y as ut,s as pt,m as gt,Z as Be,a2 as ht,cM as mt,L as Ct,ad as G,bC as Qe,aF as bt,ac as Je,b1 as Xe,ae as Ze,av as St,fs as vt,aH as ft,a7 as yt,eH as Ee,D as At,fY as kt,V as xe,M as $e,l as It,F as Mt,af as Tt,A as ve,bK as Lt,P as Ne}from"./index-DmqEQZ_1.js";import{E as We}from"./ExportShipmentsButton-DGF8y-k6.js";import{B as wt,a as Rt}from"./BulkApplyShippingRulesModal-C-Q_hu7z.js";import{A as et,M as xt}from"./types-BWwAlU9l.js";import{B as je}from"./BulkEditShipmentTagsModal-tM_Sv-LA.js";import{B as Dt}from"./useBulkCancelShipmentPageData-sW-MVe01.js";import{E as Pt}from"./empty-shipment-0z4UaUEC.js";import{C as Ke}from"./CustomEmptyState-t0kq3jiO.js";import{I as U,C as _t}from"./IndexTableCell-C9o6fpFn.js";import{F as Ft,T as ze,S as Ot}from"./TableListPaginator-CK5HvAHX.js";import{S as Ue,u as Bt}from"./useConnectedStoreOptions-WzZ30A_b.js";import{u as Et}from"./useDateRangePicker-jUwaBI32.js";import{u as $t}from"./useIndexTableSelectionState-D3KujluR.js";import{C as Te}from"./connectedStoreFilterType-qLEqpdoF.js";import{S as de}from"./sortOrder-CV10GBqu.js";import{o as Nt}from"./omit-Ccfueyna.js";import{u as Wt,O as Le}from"./useCountryListFilterOptions-CKVJU3qI.js";import{T as jt}from"./TableListClearAllFiltersButton-DlTFT1wp.js";import{u as Kt}from"./useOrgCarrierServiceOptions-DbK4lkm6.js";import{u as zt}from"./useShipmentTagOptions-Bs4s7X_O.js";import{C as Ut}from"./CloneShipmentModal-8GcME8dL.js";import{E as qt}from"./EditShipmentTagsModal-B5LzqRvt.js";import{u as Vt}from"./useCarrierLogo-BBrwri0x.js";import{u as Yt}from"./useCountry-C6qYWgzP.js";import{u as Ht}from"./useCreateShipmentError-EKsbrwzP.js";import{O as Gt}from"./index-SH1odjlJ.js";import{O as tt}from"./OverflowText-BY_PSFIW.js";import{F as rt}from"./FeatureIndicatorsStack-DrcxmfPf.js";import{S as at}from"./RiskMinor.svg-DPmRfNw-.js";import{M as Qt}from"./MobileIndexTableWrapper-DMPHdq70.js";import{O as Jt}from"./bucket-10-B1mB5QUF.js";import"./PageAction-BToGa3gb.js";import"./file-exports-CwR4w7fO.js";import"./orgCarrierAccountStatus-D983TzTG.js";import"./index-Dv-nuHuD.js";import"./saved-packagings-Cqik7MtN.js";import"./packagingType-CtI31ra9.js";import"./ResourceList-P0Q034_L.js";import"./ChargeableWeightCalculationBanner-DJTA_zhB.js";import"./InternationalShipmentPackageLimitBanner-BrX5-yve.js";import"./List-DKaonmcQ.js";import"./shipment-BFTbbL-x.js";import"./AddressDropdown-BNkRy0rC.js";import"./useUserAddressBook-DPdWQnIJ.js";import"./saved-addresses-Dkxscrd1.js";import"./addressType-Dq-BWODb.js";import"./useShipmentPurposeOptions-DQzxgrku.js";import"./ss-care-DVsimFIe.js";import"./useTaxTermOptions-DnXpojCw.js";import"./useIossEnabled-DKjuasn8.js";import"./shippingConfigIossNumberDtoStatus-B0SmbTHA.js";import"./countries-BhE82V1V.js";import"./IossNumberDropdown-DhlG3bWd.js";import"./reduce-Cdvw38gs.js";import"./groupBy-DBLwNMIR.js";import"./_createAggregator-B587KDqf.js";import"./ShipmentTagsSelect-C1X_tELp.js";import"./_baseUnset-DvIg8w3J.js";import"./last-DXTTfs9a.js";import"./SkeletonDisplayText-6JVwGM8Z.js";import"./SkeletonBodyText-DISN5OIt.js";import"./SkeletonThumbnail-CUsX453v.js";import"./useCountryOptions-hLpn5iu0.js";import"./carrier-services-qYSKLoQ3.js";import"./empty-CmuRKk3V.js";import"./zonos-logo-CKwfRRSC.js";import"./CustomCarrierAccount-CkgVtrdQ.js";import"./SsCare-DjqZHPOn.js";import"./ShipmentTagsSection-BKOIB7EP.js";import"./merchantOfRecord-DdjkzC68.js";const z={updated_at:"updated_at",order_ref:"order_ref"},Xt=100,Zt=N("div",{target:"e1yym2t61"})("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: ",Ae.breakpoints["breakpoints-md"],"){padding:var(--p-space-4) var(--p-space-5) var(--p-space-3);}@media (max-width: ",Ae.breakpoints["breakpoints-sm"],"){position:fixed;}"),er=N("div",{target:"e1yym2t60"})({name:"19mh0x6",styles:"display:flex;align-items:center;justify-content:flex-end"}),qe=({selectedShipments:t,refetch:o,clearSelection:u})=>{const{t:a}=Q(),i=Re(),{setShipments:M}=st(),{setShipments:n}=it(),{value:y,toggle:A}=K(!1),{value:R,toggle:l}=K(!1),{value:k,toggle:c}=K(!1),{value:D,toggle:p}=K(!1),{value:x,toggle:m}=K(!1),f=s.useCallback(()=>{A(),u(),o()},[u,o,A]),L=s.useCallback(()=>
2{l(),u(),o()},[u,o,l]),E=s.useCallback(()=>{c(),u(),o()},[u,o,c]),w=s.useCallback(()=>{p(),u(),o()},[u,o,p]),B=s.useCallback(()=>{ee.track({event:"bulk_shipments_order_initiated",properties:{shipment_cnt:t.length,shipment_pkg_qty:t.reduce((r,T)=>r+T.packages.length,0),shipment_carriers:Pe(t.map(r=>r.carrierSlug)),shipment_carrier_services:Pe(t.map(r=>{var T;return(T=r.carrierService)==null?void 0:T.slug}))}});const _=r=>{var P,h;if(!r.carrierService)throw new Error("Missing carrierService");const T=r._activeAddressValidation;return{id:r.id,status:r.status,merchantOfRecord:r.merchantOfRecord,orderRef:r.orderRef??null,senderAddress:{name:r.senderAddress.name??null,country:r.senderAddress.country??null},receiverAddress:{name:r.receiverAddress.name??null,country:r.receiverAddress.country??null},receiverAddressValidationStatus:r.receiverAddressValidationStatus??null,addressValidation:T?{errors:T.errors,warnings:T.warnings,errorKeys:T.errorKeys,warningKeys:T.warningKeys}:null,carrierService:{name:r.carrierService.name??null,carrierSlug:r.carrierSlug,slug:r.carrierService.slug,carrierLogoUrl:r.carrierService.carrierLogoUrl,carrierName:r.carrierService.carrierName,handoverMethod:r.carrierService.handoverMethod,isDirectPickupBypassSchedule:r.carrierService.isDirectPickupBypassSchedule},orgCarrierAccount:r.orgCarrierAccount,orgCarrierServiceGroup:null,result:{type:"initial"},ssid:r.ssid,totalPackages:r.packages.length,totalItemsCount:Se(r.packages,Z.flatMap(I=>I.items),Z.reduce((I,g)=>I+g.qty,0)),currency:"HKD",prepaidDetails:{totalFee:_e(r.totalFee)?null:new fe(r.totalFee),totalFeeBreakdown:r.totalFeeBreakdown,isUsingOrgCarrierAccount:r.isUsingOrgCarrierAccount,isDirectPayment:((P=r.selectedQuote)==null?void 0:P.isDirectPayment)??!1,orgCarrierAccountTotalCost:_e(r.orgCarrierAccountTotalCost)?null:new fe(r.orgCarrierAccountTotalCost),directPaymentTotalCost:(h=r.selectedQuote)!=null&&h.directPaymentTotalCost?new fe(r.selectedQuote.directPaymentTotalCost):null},isCoverageEnabled:r.isCoverageEnabled,isCoverageSupported:r.isCoverageSupported}};Se(t,Z.map(_),M),i(ue.bulkBuyShipments({previousList:ot.FAILED_CREATIONS}))},[t,i,M]),$=s.useCallback(()=>{const _=r=>{var T;if(!r.carrierService)throw new Error("Missing carrierService");return{id:r.id,merchantOfRecord:r.merchantOfRecord,orderRef:r.orderRef??null,senderAddress:{name:r.senderAddress.name??null,country:r.senderAddress.country??null},receiverAddress:{name:r.receiverAddress.name??null,country:r.receiverAddress.country??null},carrierService:{name:r.carrierService.name??null,carrierSlug:r.carrierSlug,slug:r.carrierService.slug,carrierLogoUrl:r.carrierService.carrierLogoUrl},orgCarrierAccount:r.orgCarrierAccount?{id:r.orgCarrierAccount.id,name:r.orgCarrierAccount.name,accountNumber:r.orgCarrierAccount.accountNumber}:null,status:Dt.INITIAL,ssid:r.ssid,currency:r.currency,totalFee:r.totalFee,totalPackages:r.packages.length,totalItemsCount:Se(r.packages,Z.flatMap(P=>P.items),Z.reduce((P,h)=>P+h.qty,0)),isUsingOrgCarrierAccount:((T=r.selectedQuote)==null?void 0:T.isUsingOrgCarrierAccount)??!1,isCoverageEnabled:r.isCoverageEnabled}};Se(t,Z.map(_),n),i(ue.bulkCancelShipments())},[t,n,i]),W=s.useMemo(()=>[{items:[{content:a("pages.shipments.tableList.bulkActions.bulkEdit",{count:t.length}),onAction:A},{disabled:t.length===0,content:a("pages.shipments.tableList.bulkActions.bulkApplyShippingRules",{count:t.length}),onAction:l}]},{items:[{content:a("pages.shipments.tableList.bulkActions.addTags",{count:t.length}),onAction:c},{content:a("pages.shipments.tableList.bulkActions.removeTags",{count:t.length}),onAction:p}]},{items:[{destructive:!0,content:a("pages.shipments.tableList.bulkActions.bulkCancel",{count:t.length}),onAction:$}]}],[a,t.length,A,l,c,p,$]);return t.length===0?null:b(Zt,{children:[b(d,{alignment:"center",distribution:"fill",children:[e(C,{as:"p",variant:"bodyMd",children:a("pages.shipments.tableList.selectedCountWithLimit",{count:t.length,limit:Xt})}),e(d.Item,{fill:!0,children:e(er,{children:b(He,{children:[e(ke,{active:x,activator:e(ye,{onClick:m,disclosure:x?"down":"up",children:a("pages.shipments.tableList.bulkActions.moreOptions")}),autofocusTarget:"first-node",onClose:m,children:e(Ie,{actionRole:"menuitem",sections:W})}),e(ye,{primary:!0,onClick:B,children:a("pages.shipments.tableList.bulkActions.bulkBuy",{count:t.length})})]})})})]}),y&&e(wt,{selectedShipments:t,onClose:A,onEditSettled:f}),te({isBulkApplyShippingRulesModalOpened:R,selectedShipmentCount:t.length}).with({isBulkApplyShippingRulesModalOpened:!0,selectedShipmentCount:1},()=>e(et,{shipment:t[0],onClose:l,onSettled:L})).with({isBulkApplyShippingRulesModalOpened:!0},()=>e(Rt,{shipments:t,onClose:l,onSettled:L})).otherwise(()=>null),k&&e(je,{mode:"add",shipmentIds:t.map(_=>_.id),onClose:c,onSettled:E}),D&&e(je,{mode:"remove",shipmentIds:t.map(_=>_.id),onClose:p,onSettled:w})]})},tr=50,rr=Object.freeze(["orderReference","reasons","receiver","carrierService","featureIndicators","sender","orderSource","ssid","actions"]),nt=s.createContext(null),ar=({children:t})=>{const[o,u]=s.useState(1),[a]=s.useState(tr),[i,M]=s.useState(""),[n,y]=s.useState([]),[A,R]=s.useState([]),[l,k]=s.useState([]),[c,D]=s.useState([]),[p,x]=s.useState([]),{dateRange:m,dateRangeMonthYear:f,formattedDateRange:L,disableDates:E,setDateRange:w,handleDateRangeChange:B,handleDateRangeMonthYearChange:$}=Et(),[W,_]=s.useState(z.updated_at),[r,T]=s.useState(de.desc),P=i.trim()!==""||m!==void 0||n.length>0||A.length>0||((l==null?void 0:l.length)??0)>0||((c==null?void 0:c.length)??0)>0||((p==null?void 0:p.length)??0)>0,{userOrganization:h}=Ge(),I=s.useMemo(()=>{var v,Y;return{keyword:i,fromDate:(v=m==null?void 0:m.start)==null?void 0:v.startOf("day").toISO(),toDate:(Y=m==null?void 0:m.end)==null?void 0:Y.endOf("day").toISO(),senderCountries:n.length>0?n:void 0,receiverCountries:A.length>0?A:void 0,carrierServiceSlugs:l.length>0?l:void 0,connectedStoreIds:(c==null?void 0:c.filter(X=>X!==Ue).length)>0?c:void 0,connectedStoreFilterType:te({includeNotConnected:c==null?void 0:c.includes(Ue),connectedStoreIdsLength:(c==null?void 0:c.length)??0}).with({includeNotConnected:!0,connectedStoreIdsLength:1},()=>Te.NOT_CONNECTED).with({includeNotConnected:!0,connectedStoreIdsLength:Fe.not(1)},()=>Te.ID_OR_NOT_CONNECTED).with({includeNotConnected:!1,connectedStoreIdsLength:Fe.not(0)},()=>Te.ID).otherwise(()=>{}),shipmentTagIds:(p==null?void 0:p.length)>0?p:void 0}},[l,c,m==null?void 0:m.end,m==null?void 0:m.start,n,A,p,i]),{data:g={items:[],meta:{total:0,page:1,lastPage:1,limit:a}},isLoading:S,isFetching:F,refetch:q}=lt((h==null?void 0:h.id)??"",{page:o,perPage:a,sortField:W,sortOrder:r,...I},{query:{keepPreviousData:!0,onSettled:()=>{P&&ee.track({event:"listing_searched",properties:{keyword:I.keyword,filter_options:Nt(I,"keyword")}})}}}),J=s.useMemo(()=>[...rr],[]),re=s.useMemo(()=>({totalItemCount:g.meta.total,totalPageCount:g.meta.lastPage,currentItemCount:g.items.length,currentPage:g.meta.page}),[g.items.length,g.meta.lastPage,g.meta.page,g.meta.total]),H=s.useCallback(v=>{u(v),ee.track({event:"listing_page_switched",properties:{from_page:o,to_page:v}})}
2,[o]),pe=s.useMemo(()=>({change:H,next:()=>H(Math.min(o+1,g.meta.lastPage)),previous:()=>H(Math.max(o-1,1))}),[o,H,g.meta.lastPage]),V=s.useMemo(()=>({field:W,order:r}),[W,r]),ae=s.useMemo(()=>({changeField:_,changeOrder:T}),[]),ge=s.useMemo(()=>({hasAnyFilter:P,searchKeyword:i,senderCountries:n,receiverCountries:A,carrierServiceSlugs:l,connectedStoreIds:c,shipmentTagIds:p,draftCreationDateRange:m,draftCreationDateRangeMonthYear:f,formattedDraftCreationDateRange:L,disableDraftCreationDateRange:E}),[P,i,n,A,l,c,p,m,f,L,E]),ne=s.useMemo(()=>{const v=()=>u(1),Y=()=>M(""),X=()=>y([]),oe=()=>R([]),be=()=>k([]),le=()=>D([]),j=()=>x([]),De=()=>w(void 0);return{changeSearchKeyword:O(M,v),clearSearchKeyword:()=>{O(Y,v)(),ee.track({event:"listing_search_keyword_cleared",properties:void 0})},changeSenderCountries:O(y,v),clearSenderCountries:O(X,v),changeReceiverCountries:O(R,v),clearReceiverCountries:O(oe,v),changeCarrierServiceSlugs:O(k,v),clearCarrierServiceSlugs:O(be,v),changeConnectedStoreIds:O(D,v),clearConnectedStoreIds:O(le,v),changeShipmentTagIds:O(x,v),clearShipmentTagIds:O(j,v),changeDraftCreationDateRange:O(B,v),clearDraftCreationDateRange:O(De,v),changeDraftCreationDateRangeMonthYear:$,clearAll:()=>{O(Y,X,oe,be,le,j,De,v)(),ee.track({event:"listing_search_all_filters_cleared",properties:void 0})}}},[B,$,w]),{selectedResources:se,handleSelectionChange:he,clearSelection:ie,areAllResourcesSelectedForThisPage:me}=$t({resources:g==null?void 0:g.items,maxSelections:xt,resourceIdResolver:v=>`${v.id}`,pageLimit:a}),Ce=s.useMemo(()=>({isLoading:S,isFetching:F,items:g.items,refetch:q,visibleColumnIds:J,paginationState:re,paginationAction:pe,sorterState:V,sorterAction:ae,filterState:ge,filterAction:ne,selectedResources:se,handleSelectionChange:he,clearSelection:ie,areAllResourcesSelectedForThisPage:me}),[S,F,g.items,q,J,re,pe,V,ae,ge,ne,se,he,ie,me]);return e(nt.Provider,{value:Ce,children:t})},Me=()=>{const t=s.useContext(nt);if(t===null)throw new Error("useFailedCreationShipmentsContext must be used within a FailedCreationShipmentsContextProvider");return t},ce=N("div",{target:"e1auhlvj2"})({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;}}"}),nr=N("div",{target:"e1auhlvj1"})({name:"xh0ihz",styles:"& .Polaris-Button__Icon{line-height:0;}"}),sr=N("div",{target:"e1auhlvj0"})({name:"1j6ew5d",styles:"& .Polaris-ActionList__Item.Polaris-ActionList--active svg{fill:var(--p-icon-success);}"}),ir=()=>{var _,r,T,P;const{t}=Q(),{sorterState:o,sorterAction:u,filterState:a,filterAction:i}=Me(),{countriesByContinent:M,countries:n}=Wt(),{carrierServices:y,carrierServicesGroupedByCarrierName:A}=Kt(),{connectedStoreOptions:R}=Bt(),{shipmentTagOptions:l}=zt(),{value:k,setFalse:c,toggle:D}=K(!1),[p,x]=s.useState("");ct(()=>i.changeSearchKeyword(p),500,[p]);const m=s.useCallback(h=>{i.changeSenderCountries(h)},[i]),f=s.useCallback(h=>{i.changeReceiverCountries(h)},[i]),L=s.useMemo(()=>{const h=[];if(a.formattedDraftCreationDateRange.start&&a.formattedDraftCreationDateRange.end&&h.push({key:"creationDate",label:`${t("pages.shipments.tableList.filters.creationDate.label")}: ${a.formattedDraftCreationDateRange.start} - ${a.formattedDraftCreationDateRange.end}`,onRemove:i.clearDraftCreationDateRange}),a.connectedStoreIds.length>0){const I=a.connectedStoreIds.slice(0,3),g=`${t("pages.shipments.tableList.filters.orderSource.label")}: ${R.filter(F=>I.includes(F.value)).map(F=>F.label).join(",")}`,S=a.connectedStoreIds.slice(3);h.push({key:"orderSource",label:a.connectedStoreIds.length>3?`${g} ${t("pages.shipments.tableList.filters.andWithCount",{count:S.length})}`:g,onRemove:i.clearConnectedStoreIds})}if(a.carrierServiceSlugs.length>0){const I=a.carrierServiceSlugs.slice(0,3).map(F=>{var q;return((q=y.find(J=>J.value===F))==null?void 0:q.label)??F}).join(", "),g=a.carrierServiceSlugs.slice(3),S=t("pages.shipments.tableList.filters.carrierService.label");h.push({key:"carrierService",label:a.carrierServiceSlugs.length>3?`${S}: ${I} ${t("pages.shipments.tableList.filters.andWithCount",{count:g.length})}`:`${S}: ${I}`,onRemove:i.clearCarrierServiceSlugs})}if(a.senderCountries.length>0){const I=n.filter(S=>a.senderCountries.includes(S.value)).slice(0,3).map(S=>S.label).join(", "),g=a.senderCountries.slice(3);h.push({key:"senderCountry",label:a.senderCountries.length>3?`${t("pages.shipments.tableList.filters.senderCountry.label")}: ${I} ${t("pages.shipments.tableList.filters.andWithCount",{count:g.length})}`:`${t("pages.shipments.tableList.filters.senderCountry.label")}: ${n.filter(S=>a.senderCountries.includes(S.value)).map(S=>S.label).join(", ")}`,onRemove:i.clearSenderCountries})}if(a.receiverCountries.length>0){const I=n.filter(S=>a.receiverCountries.includes(S.value)).slice(0,3).map(S=>S.label).join(", "),g=a.receiverCountries.slice(3);h.push({key:"receiverCountry",label:a.receiverCountries.length>3?`${t("pages.shipments.tableList.filters.receiverCountry.label")}: ${I} ${t("pages.shipments.tableList.filters.andWithCount",{count:g.length})}`:`${t("pages.shipments.tableList.filters.receiverCountry.label")}: ${n.filter(S=>a.receiverCountries.includes(S.value)).map(S=>S.label).join(", ")}`,onRemove:i.clearReceiverCountries})}if(a.shipmentTagIds.length>0){const I=a.shipmentTagIds.slice(0,3),g=`${t("pages.shipments.tableList.filters.shipmentTags.label")}: ${l.filter(F=>I.includes(F.value)).map(F=>F.label).join(", ")}`,S=a.shipmentTagIds.slice(3);h.push({key:"shipmentTags",label:a.shipmentTagIds.length>3?`${g} ${t("pages.shipments.tableList.filters.andWithCount",{count:S.length})}`:g,onRemove:i.clearShipmentTagIds})}return h},[a.formattedDraftCreationDateRange.start,a.formattedDraftCreationDateRange.end,a.connectedStoreIds,a.carrierServiceSlugs,a.senderCountries,a.receiverCountries,a.shipmentTagIds,t,i.clearDraftCreationDateRange,i.clearConnectedStoreIds,i.clearCarrierServiceSlugs,i.clearSenderCountries,i.clearReceiverCountries,i.clearShipmentTagIds,R,y,n,l]),E=s.useMemo(()=>[{title:t("pages.shipments.tableList.sorters.title"),items:[{prefix:e(Oe,{label:!0,checked:o.field===z.updated_at}),content:t("pages.shipments.tableList.sorters.fields.updatedAt.label"),onAction:()=>u.changeField(z.updated_at)},{prefix:e(Oe,{label:!0,checked:o.field===z.order_ref}),content:t("pages.shipments.tableList.sorters.fields.orderRef.label"),onAction:()=>u.changeField(z.order_ref)}]},{items:[{prefix:e(dt,{}),active:o.order===de.asc,content:te(o.field).with(z.updated_at,()=>t("pages.shipments.tableList.sorters.orders.oldestFirst.label")).with(z.order_ref,()=>t("pages.shipments.tableList.sorters.orders.aToZ.label")).exhaustive(),onAction:()=>u.changeOrder(de.asc)},{prefix:e(ut,{}),active:o.order===de.desc,content:te(o.field).with(z.updated_at,()=>t("pages.shipments.tableList.sorters.orders.newestFirst.label")).with(z.order_ref,()=>t("pages.shipments.tableList.sorters.orders.zToA.label")).exhaustive(),onAction:()=>u.changeOrder(de.desc)}]}],[u,o.field,o.order,t]),w=s.useCallback(h=>{x(h)},[]),B=s.useCallback(()=>{x(""),i.clearSearchKeyword()},[i]),$=s.useCallback(()=>{i.clearAll()},[i]),W=pt();return b(d,{spacing:"loose",children:[e(d.Item,{fill:!0,children:b(d,{spacing:"tight",children:[e(d.Item,{fill:!0,children:e(Ft,{filters:[{key:"creationDate",label:t("pages.shipments.tableList.filters.creationDate.label"),filter:e(gt,{allowRange:!0,multiMonth:!0,month:a.draftCreationDateRangeMonthYear.month,year:a.draftCreationDateRangeMonthYear.year,selected:a.draftCreationDateRange?{start:a.draftCreationDateRange.start.toJSDate(),end:a.draftCreationDateRange.end.toJSDate()}:void 0,disableDatesBefore:(r=(_=a.disableDraftCreationDateRange)==null?void 0:_.before)==null?void 0:r.toJSDate(),disableDatesAfter:(P=(T=a.disableDraftCreationDateRange)==null?void 0:T.after)==null?void 0:P.toJSDate(),onMonthChange:i.changeDraftCreationDateRangeMonthYear,onChange:i.changeDraftCreationDateRange}),shortcut:!0},{key:"orderSource",label:t("pages.shipments.tableList.filters.orderSource.label"),filter:e(ce,{children:e(Be,{allowMultiple:!0,selected:a.connectedStoreIds,options:R,onChange:i.changeConnectedStoreIds})}),shortcut:!0},{key:"carrierService",label:t("pages.shipments.tableList.filters.carrierService.label"),filter:e(ce,{children:e(Be,{allowMultiple:!0,selected:a.carrierServiceSlugs,sections:Object.entries(A).map(([h,I])=>({title:h,options:I})),onChange:i.changeCarrierServiceSlugs})}),shortcut:!0},{key:"senderCountry",label:t("pages.shipments.tableList.filters.senderCountry.label"),filter:e(ce,{children:e(Le,{labelHidden:!0,allowMultiple:!0,label:t("form.fields.country.label"),placeholder:t("form.fields.country.placeholder"),selected:a.senderCountries,sections:M,onChange:m})}),hideClearButton:!0,shortcut:!0},{key:"receiverCountry",label:t("pages.shipments.tableList.filters.receiverCountry.label"),filter:e(ce,{children:e(Le,{labelHidden:!0,allowMultiple:!0,label:t("form.fields.country.label"),placeholder:t("form.fields.country.placeholder"),selected:a.receiverCountries,sections:M,onChange:f})}),hideClearButton:!0,shortcut:!0},{key:"shipmentTags",label:t("pages.shipments.tableList.filters.shipmentTags.label"),filter:e(ce,{children:e(Le,{labelHidden:!0,allowMultiple:!0,label:t("form.fields.shipmentTags.label"),placeholder:t("form.fields.shipmentTags.placeholder.search"),selected:a.shipmentTagIds,sections:[{options:l}],onChange:i.changeShipmentTagIds})}),hideClearButton:!0,shortcut:!0}],appliedFilters:L,queryValue:p,queryPlaceholder:t("pages.shipments.tableList.filters.searchField.placeholder"),onQueryChange:w,onQueryClear:B,onClearAll:$})}),e(d.Item,{children:e(nr,{children:e(He,{segmented:!0,children:e(ke,{active:k,activator:e(ye,{onClick:D,icon:e(ht,{size:20})}),onClose:c,children:e(sr,{children:e(Ie,{sections:E})})})})})})]})}),W&&e(d.Item,{children:e(jt,{disabled:!a.hasAnyFilter,onClick:$})})]})},we=N(tt,{target:"e1whfiz62"})({name:"1lsto0t",styles:"max-width:250px"}),or=N(U,{target:"e1whfiz61"})({name:"51hfk1",styles:"max-width:320px"}),lr=N(U,{target:"e1whfiz60"})({name:"1u2ihad",styles:"width:var(--p-space-32)"}),cr=({index:t,selected:o,closeMenu:u,rowActions:a,showMenu:i,activator:M,shipment:n,formattedCreatedAt:y,senderCountryName:A,receiverCountryName:R,failedReason:l,visibleColumnIds:k,carrierLogo:c})=>{const{t:D}=Q(),{id:p,ssid:x}=n;return e(Ze.Row,{id:`${p}`,position:t,selected:o,onClick:()=>{},children:k.map(m=>e(mt.Fragment,{children:te({...n,columnId:m}).with({columnId:"ssid"},()=>e(U,{children:e(C,{as:"p",variant:"bodyMd",children:x})})).with({columnId:"orderReference"},({orderRef:f})=>
2b(U,{children:[e(Ct,{to:ue.editShipment({id:String(p),previousList:Qe.FAILED_CREATIONS,reviewAndBuy:!0}),style:{color:"inherit"},children:((f==null?void 0:f.length)??0)>30?e(G,{content:f,children:e(we,{children:e(C,{as:"span",variant:"bodyMd",children:f})})}):e(C,{as:"p",variant:"bodyMd",children:f})}),e(C,{variant:"bodyMd",as:"span",color:"subdued",children:y})]})).with({columnId:"carrierService"},()=>e(U,{children:b(d,{alignment:"center",wrap:!1,children:[e(bt,{source:c,alt:n.carrierService.name??"",size:"small"}),e(C,{as:"p",variant:"bodyMd",children:n.carrierService.name??"--"})]})})).with({columnId:"sender"},()=>{var f,L;return b(U,{children:[(f=n.senderAddress)!=null&&f.name&&n.senderAddress.name.length>30?e(G,{content:n.senderAddress.name,children:e(we,{children:e(C,{as:"span",variant:"bodyMd",children:n.senderAddress.name})})}):e(C,{as:"p",variant:"bodyMd",children:((L=n.senderAddress)==null?void 0:L.name)??"--"}),e(C,{variant:"bodyMd",as:"span",color:"subdued",children:A??"--"})]})}).with({columnId:"receiver"},()=>{var f,L;return b(U,{children:[(f=n.receiverAddress)!=null&&f.name&&n.receiverAddress.name.length>30?e(G,{content:n.receiverAddress.name,children:e(we,{children:e(C,{as:"span",variant:"bodyMd",children:n.receiverAddress.name})})}):e(C,{as:"p",variant:"bodyMd",children:((L=n.receiverAddress)==null?void 0:L.name)??"--"}),e(C,{variant:"bodyMd",as:"span",color:"subdued",children:R??"--"})]})}).with({columnId:"orderSource"},({store:f,isShopifyZonosOrder:L})=>e(U,{children:e(Gt,{orderSource:f,isShopifyZonosOrder:L})})).with({columnId:"reasons"},()=>e(or,{children:l&&e(G,{content:l.translated?b(d,{vertical:!0,spacing:"loose",children:[e(C,{as:"p",variant:"bodyMd",children:l.translated}),b(d.Item,{children:[e(C,{as:"p",variant:"bodySm",color:"subdued",children:D("pages.shipments.tableList.errorDetails.original")}),e(C,{as:"p",variant:"bodySm",color:"subdued",children:l.original})]}),b(d,{spacing:"tight",alignment:"center",children:[e(Xe,{size:24}),e(C,{as:"p",variant:"bodySm",color:"subdued",children:D("pages.shipments.tableList.errorDetails.translatedBy")})]})]}):l.original,children:e(Je,{items:[{status:"critical",icon:at,title:l.translated??l.original,truncate:!0}]})})})).with({columnId:"featureIndicators"},()=>e(U,{children:e(rt,{...n})})).with({columnId:"actions"},()=>e(lr,{children:e("div",{onMouseLeave:u,children:e(d,{alignment:"center",wrap:!1,children:e(ke,{active:i,activator:M,onClose:u,children:e("div",{onMouseLeave:u,children:e(Ie,{actionRole:"menuitem",sections:a})})})})})})).exhaustive()},m))})},Ve=N(tt,{target:"e1v3rpn80"})({name:"1lsto0t",styles:"max-width:250px"}),dr=({index:t,selected:o,closeMenu:u,rowActions:a,showMenu:i,activator:M,shipment:n,formattedCreatedAt:y,senderCountryName:A,receiverCountryName:R,failedReason:l})=>{const{t:k}=Q(),{id:c,ssid:D}=n;return e(Ze.Row,{id:`${c}`,position:t,selected:o,onClick:()=>{},children:e(Qt,{children:b(d,{vertical:!0,spacing:"tight",children:[e(d.Item,{children:b(d,{alignment:"center",children:[e(d.Item,{children:e(rt,{...n})}),e(d.Item,{fill:!0}),e(d.Item,{children:e("div",{onMouseLeave:u,children:a.length!==0&&e(ke,{active:i,activator:M,onClose:u,children:e("div",{onMouseLeave:u,children:e(Ie,{actionRole:"menuitem",sections:a})})})})})]})}),e(d.Item,{children:b(d,{vertical:!0,spacing:"none",children:[e(d.Item,{children:e(d,{alignment:"center",spacing:"tight",children:e(d.Item,{children:e(C,{variant:"bodyMd",as:"span",color:"subdued",children:y})})})}),e(d.Item,{children:e(C,{as:"span",variant:"bodyMd",color:"subdued",children:`${D}${n.orderRef?` ⢠${n.orderRef}`:""}`})})]})}),e(d.Item,{children:e(St,{heightSpace:"1"})}),e(d.Item,{children:l&&e(G,{content:l.translated?b(d,{vertical:!0,children:[e(C,{as:"p",variant:"bodyMd",children:l.translated}),b(d.Item,{children:[e(C,{as:"p",variant:"bodySm",color:"subdued",children:k("pages.shipments.tableList.errorDetails.original")}),e(C,{as:"p",variant:"bodySm",color:"subdued",children:l.original})]}),b(d,{spacing:"tight",alignment:"center",children:[e(Xe,{size:24}),e(C,{as:"p",variant:"bodySm",color:"subdued",children:k("pages.shipments.tableList.errorDetails.translatedBy")})]})]}):l.original,children:e(Je,{items:[{status:"critical",icon:at,title:l.translated??l.original}]})})}),e(d.Item,{children:b(d,{alignment:"center",children:[e(d.Item,{children:e(vt,{size:"24",color:"var(--p-icon)"})}),e(d.Item,{children:b(d,{vertical:!0,spacing:"none",children:[e(d.Item,{children:n.senderAddress.name&&n.senderAddress.name.length>30?e(G,{content:n.senderAddress.name,children:e(Ve,{children:e(C,{truncate:!0,as:"span",variant:"bodyMd",children:n.senderAddress.name})})}):e("p",{children:b(C,{as:"p",variant:"bodyMd",children:[n.senderAddress.name??"--"," ",b(C,{variant:"bodyMd",as:"span",color:"subdued",children:["(",A??"--",")"]})]})})}),e(d.Item,{children:n.receiverAddress.name&&n.receiverAddress.name.length>30?e(G,{content:n.receiverAddress.name,children:e(Ve,{children:e(C,{truncate:!0,as:"span",variant:"bodyMd",children:n.receiverAddress.name})})}):e("p",{children:b(C,{as:"p",variant:"bodyMd",children:[n.receiverAddress.name??"--"," ",b(C,{variant:"bodyMd",as:"span",color:"subdued",children:["(",R??"--",")"]})]})})})]})})]})})]})})})},ur=({shipment:t,index:o,selected:u,clearSelection:a,refetch:i})=>{const{id:M,senderAddress:n,receiverAddress:y,createdAt:A,errors:R,errorSummary:l}=t,{t:k,i18n:c}=Q(),D=Re(),{userOrganization:p}=Ge(),{getCountryByAlpha2:x}=Yt(),{getErrorMessage:m}=Ht(),{refetch:f}=ft(),{visibleColumnIds:L,refetch:E}=Me(),{formatDate:w}=yt(),B=s.useMemo(()=>{var j;return(j=x(n==null?void 0:n.country))==null?void 0:j.name[Ee[c.language]]},[x,c.language,n==null?void 0:n.country]),$=s.useMemo(()=>{var j;return(j=x(y==null?void 0:y.country))==null?void 0:j.name[Ee[c.language]]},[x,c.language,y==null?void 0:y.country]),W=s.useMemo(()=>{const j=At.fromISO(A);return w(j)},[A,w]),_=Vt(t.carrierService.carrierLogoUrl),r=s.useMemo(()=>R.length===0?null:{original:R.map(j=>m(j.message)).join(" "),translated:l},[l,R,m]),{value:T,setTrue:P,setFalse:h}
2=K(!1),{value:I,setTrue:g,setFalse:S}=K(!1),{value:F,setTrue:q,setFalse:J}=K(!1),re=s.useCallback(async()=>{q()},[q]),H=s.useMemo(()=>e(ye,{onClick:P,plain:!0,monochrome:!0,icon:e(Jt,{size:24})}),[P]),{value:pe,toggle:V}=K(!1),{mutateAsync:ae,isLoading:ge}=kt(),ne=s.useCallback(()=>{h(),D(ue.editShipment({id:String(M),previousList:Qe.FAILED_CREATIONS,reviewAndBuy:!0}))},[h,D,M]),se=s.useCallback(()=>{h(),V()},[h,V]),he=s.useCallback(async()=>{V(),await ae({orgId:p==null?void 0:p.id,shipmentId:M}),ee.track({event:"shipment_order_cancelled",properties:{shipment_id:t.id,from_country:t.senderAddress.country,from_state:t.senderAddress.state??null,from_city:t.senderAddress.city??null,to_country:t.receiverAddress.country,to_state:t.receiverAddress.state??null,to_city:t.receiverAddress.city??null,shipment_carrier:t.carrierSlug,shipment_carrier_service:t.carrierService.slug,shipment_currency:t.currency,shipment_price:parseFloat(t.totalFee),currency:t.currency,revenue:new fe(t.totalFee).negated().toNumber(),shipment_coverage_is_enabled:t.isCoverageEnabled}}),a(),f(),E()},[ae,a,M,E,f,t.carrierService.slug,t.carrierSlug,t.currency,t.id,t.isCoverageEnabled,t.receiverAddress.city,t.receiverAddress.country,t.receiverAddress.state,t.senderAddress.city,t.senderAddress.country,t.senderAddress.state,t.totalFee,V,p==null?void 0:p.id]),ie=s.useCallback(async()=>{g()},[g]),{value:me,setTrue:Ce,setFalse:v}=K(!1),Y=s.useCallback(async()=>{Ce()},[Ce]),X=s.useCallback(()=>{v(),i()},[v,i]),oe=s.useMemo(()=>[{items:[{content:k("pages.shipments.editShipment"),onAction:ne},{content:k("pages.shipments.cloneShipment"),onAction:ie},{content:k("pages.shipments.applyShippingRules"),onAction:Y},{content:k("pages.shipments.editShipmentTags"),onAction:re}]},{items:[{content:k("pages.shipments.cancelAndRefund.button.cancelAndRefund"),destructive:!0,onAction:se}]}],[k,ne,ie,Y,re,se]),be=xe(),le=s.useMemo(()=>({index:o,selected:u,closeMenu:h,showMenu:T,activator:H,shipment:t,formattedCreatedAt:W,senderCountryName:B,receiverCountryName:$,failedReason:r,rowActions:oe,visibleColumnIds:L,carrierLogo:_}),[H,_,h,r,W,o,$,oe,u,B,t,T,L]);return b(Mt,{children:[be?e(dr,{...le}):e(cr,{...le}),pe&&e($e,{open:!0,fullScreen:!0,title:k("pages.shipments.cancelAndRefund.title",{shipmentSsid:t.ssid}),primaryAction:{content:k("pages.shipments.cancelAndRefund.submit"),loading:ge,onAction:he},onClose:V,children:e($e.Section,{children:e("p",{children:e(It,{i18nKey:"pages.shipments.cancelAndRefund.confirmation",values:{orderRef:t.orderRef,currency:t.currency,totalFee:t.totalFee},components:[e("strong",{})]})})})}),I&&e(Ut,{shipmentId:t.id,onClose:S}),F&&e(qt,{shipmentId:t.id,shipmentTags:t.shipmentTags,onClose:J,refetch:E}),me&&e(et,{shipment:t,onClose:v,onSettled:X})]})},pr=s.memo(ur),gr=N("div",{target:"er04g701"})({name:"2ewnbj",styles:"padding:14px 14px 14px 20px"}),hr=N("div",{target:"er04g700"})(({$isMobile:t})=>t&&` 3 .Polaris-IndexTable__StickyTable--condensed { 4 border-bottom: 1px solid var(--p-border-subdued); 5 } 6 7 .Polaris-IndexTable--condensedRow { 8 border-top: 0; 9 border-bottom: 8px solid var(--p-surface-neutral-subdued); 10 } 11 12 .Polaris-IndexTable--condensedRow:last-child { 13 border-bottom: 0; 14 }`,";"),Ye=()=>{const{t}=Q(),o=Re(),{isLoading:u,isFetching:a,items:i,visibleColumnIds:M,paginationState:n,paginationAction:y,filterState:A,refetch:R,selectedResources:l,handleSelectionChange:k,clearSelection:c,areAllResourcesSelectedForThisPage:D}=Me(),p=s.useMemo(()=>Tt(M.map(w=>({id:w,title:te(w).with("ssid",()=>t("pages.shipments.tableList.columns.ssid.label")).with("orderReference",()=>t("pages.shipments.tableList.columns.orderReference.label")).with("carrierService",()=>t("pages.shipments.tableList.columns.carrierService.label")).with("sender",()=>t("pages.shipments.tableList.columns.sender.label")).with("receiver",()=>t("pages.shipments.tableList.columns.receiver.label")).with("orderSource",()=>t("pages.shipments.tableList.columns.orderSource.label")).with("reasons",()=>t("pages.shipments.tableList.columns.reasons.label")).with("actions","featureIndicators",()=>"").exhaustive()}
14))),[t,M]),x=s.useMemo(()=>{const w=[];return n.totalPageCount>1&&w.push({content:t("pages.shipments.tableList.bulkActions.cancelSelection"),onAction:c}),w},[c,n.totalPageCount,t]),m=A.hasAnyFilter||n.totalItemCount>0,f=i.length>0,L=n.totalPageCount>1,E=xe();return b(ve,{children:[m&&e(ve.Section,{children:e(ir,{})}),f&&e(ve.Section,{flush:!0,children:e(gr,{children:e(ze,{currentItemsCount:n.currentItemCount,totalItemsCount:n.totalItemCount,currentPageIndex:n.currentPage,totalPagesCount:n.totalPageCount,onPageChange:y.change,onPreviousPage:y.previous,onNextPage:y.next})})}),e(hr,{$isMobile:E,children:e(_t,{lastColumnSticky:!0,itemCount:u?1:n.currentItemCount,selectedItemsCount:D?"All":l.length,headings:p,loading:a,resourceName:{singular:"",plural:""},onSelectionChange:k,promotedBulkActions:x,condensed:E,emptyState:A.hasAnyFilter?e(Ke,{title:t("pages.shipments.emptyState.notFound.title")}):e(Ke,{title:t("pages.shipments.emptyState.notFound.title"),desc:t("pages.shipments.emptyState.actionRequired.failedCreation.desc"),image:Pt,action:{content:t("pages.shipments.emptyState.actions.goToDrafts"),onAction(){o(ue.draftShipments({tab:Lt.IN_PROGRESS}))}}}),children:u?Array.from({length:10}).map((w,B)=>e(Ot,{index:B,columns:M.length},B)):i.map((w,B)=>{const $=!!l.find(W=>W.id===w.id);return e(pr,{selected:$,shipment:w,index:B,clearSelection:c,refetch:R},w.id)})})}),L&&e(ve.Section,{children:e(ze,{currentItemsCount:n.currentItemCount,totalItemsCount:n.totalItemCount,currentPageIndex:n.currentPage,totalPagesCount:n.totalPageCount,onPageChange:y.change,onPreviousPage:y.previous,onNextPage:y.next})})]})},mr=N("div",{target:"e1bxi0k11"})("height:100%;.Polaris-Page{margin-bottom:calc(0px - var(--p-space-4));}@media (max-width: ",Ae.breakpoints["breakpoints-sm"],"){.Polaris-Page{margin-bottom:calc(100px + var(--p-space-4));}}"),Cr=N("div",{target:"e1bxi0k10"})("height:100%;.Polaris-Page{margin-bottom:calc(0px - var(--p-space-4));}@media (max-width: ",Ae.breakpoints["breakpoints-sm"],"){.Polaris-Page{margin-bottom:calc(100px + var(--p-space-4));}}.Polaris-Header-Title{font-size:1rem;}.Polaris-Page-Header__Actions{gap:0.5rem;}"),br=()=>{const{t}=Q(),o=Me();return xe()?b(Cr,{children:[e(Ne,{fullWidth:!0,title:t("pages.shipments.actionRequiredShipments"),secondaryActions:e(We,{variant:"label_failed"}),children:e(Ye,{})}),o.selectedResources.length>0&&e(qe,{selectedShipments:o.selectedResources,refetch:o.refetch,clearSelection:o.clearSelection})]}):b(mr,{children:[e(Ne,{fullWidth:!0,title:t("pages.shipments.actionRequiredShipments"),secondaryActions:e(We,{variant:"label_failed"}),children:e(Ye,{})}),o.selectedResources.length>0&&e(qe,{selectedShipments:o.selectedResources,refetch:o.refetch,clearSelection:o.clearSelection})]})},Fa=()=>e(ar,{children:e(br,{})});export{Fa as ActionRequiredShipments,br as ActionRequiredShipmentsContent,Fa as default}; 15//# debugId=03bc5f24-108f-5fce-9573-3d99f37d78bb 16//# sourceMappingURL=index-CxzVVyDM.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.