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]="7666da62-76bc-57f4-9c69-f2a30055b996")}catch(e){}}(); 2import{e as I,r as o,k as l,j as e,n as i,T as n,A as h,av as f,l as O,B as F,o as g,cv as j,an as K,F as x,cw as k,N,z as Y,x as q,aA as U,ab as L,C as Q,t as T,cx as Z,cy as G,cz as J,u as V,U as ee,cA as A,cB as te,cC as ie,aN as E,am as re,aI as ne,P as le}from"./index-DmqEQZ_1.js";import{u as ae,f as se}from"./useIsUsOriginFulfillmentOrderEnabled-CK21FqVF.js";import{D as oe,L as de}from"./LoadingState-DSS5trsQ.js";import"./countries-BhE82V1V.js";const ce=5,pe=500,me=["xlsx","xls","csv"].join(", "),ue="Spaceship_Pro_Bulk_Import_Fulfillment_Order_Template.xlsx",he=e(j,{scale:20}),ge=g("div",{target:"e1l8g1ty1"})({name:"13ku56z",styles:"display:flex;flex-direction:column;height:100%"}),fe=g("div",{target:"e1l8g1ty0"})({name:"xdvdnl",styles:"margin-top:auto"}),ve=({title:r,onTemplateDownloaded:p})=>{const{t}=I(),d=o.useCallback(()=>{window.open(`https://${window.location.host}/assets/templates/${ue}`,"_blank"),p()},[p]);return l(h,{title:`2. ${r}`,children:[e(h.Section,{children:l(i,{vertical:!0,children:[e(i.Item,{children:e(n,{as:"p",variant:"bodyMd",color:"subdued",children:t("pages.importFulfillmentOrder.uploadFile.description")})}),l(i.Item,{children:[e(n,{as:"p",variant:"bodySm",fontWeight:"semibold",children:t("pages.importFulfillmentOrder.uploadFile.requirements")}),e(n,{as:"p",variant:"bodySm",color:"subdued",children:t("pages.importFulfillmentOrder.uploadFile.maxFileSize",{size:`${ce}MB`})}),e(n,{as:"p",variant:"bodySm",color:"subdued",children:t("pages.importFulfillmentOrder.uploadFile.maxRowLimit",{limit:pe})}),e(n,{as:"p",variant:"bodySm",color:"subdued",children:t("pages.importFulfillmentOrder.uploadFile.supportedFileTypes",{types:me})})]})]})}),e(h.Section,{children:l(i,{wrap:!1,alignment:"center",children:[e(i.Item,{fill:!0,children:l(ge,{children:[e(n,{as:"h2",variant:"headingMd",children:e(i,{alignment:"center",spacing:"extraTight",children:e(i.Item,{children:t("pages.importFulfillmentOrder.downloadTemplate.title")})})}),e(f,{heightSpace:"2"}),e(n,{as:"p",color:"subdued",variant:"bodyMd",children:e(O,{i18nKey:"pages.importFulfillmentOrder.downloadTemplate.content",components:{b:e("strong",{})}})}),e(f,{heightSpace:"2"}),e(fe,{children:e(F,{icon:he,onClick:d,children:t("pages.importFulfillmentOrder.uploadFile.button.downloadTemplate")})})]})}),e(i.Item,{children:e("img",{src:oe,alt:"Download shipment template",width:100})})]})})]})},Se=Object.freeze({fulfillmentOrderRef:"Order Ref. *",finalShippingTaxTerm:"Tax Term",finalShippingPurpose:"Shipment Purpose",receiverName:"Receiver Name *",receiverCompany:"Receiver Company",receiverPhoneCountryCode:"Receiver Dialing Code",receiverPhone:"Receiver Phone *",receiverEmail:"Receiver Email",receiverCountry:"Receiver Country/Region *",receiverAddressLine1:"Receiver Address Line 1 (Max. 48 Characters) *",receiverAddressLine2:"Receiver Address Line 2 (Max. 48 Characters)",receiverCity:"Receiver City *",receiverState:"Receiver State",receiverPostalCode:"Receiver Postal Code",receiverIsResidential:"Residential Address? (Y/N)",receiverTaxId:"Receiver Tax ID",itemQty:"Quantity *",itemSku:"SKU *",isOfflineDelivery:"Self-Arrange Delivery (Y/N)",finalShippingCarrierServiceSlug:"Carrier Service",finalShipmentTags:"Tags",remarks:"Remarks"}),be=({title:r,warehouseOptions:p,selectedWarehouse:t,onChange:d})=>{const{t:a}=I();return t?l(h,{sectioned:!0,title:`1. ${r}`,children:[e(K,{required:!0,label:a("pages.importFulfillmentOrder.step.selectWarehouse.selection.label"),placeholder:a("pages.importFulfillmentOrder.step.selectWarehouse.selection.placeholder"),options:p,value:t.value,onChange:d}),t&&l(x,{children:[e(f,{heightSpace:"5"}),l(i,{vertical:!0,spacing:"extraTight",distribution:"fill",children:[e(n,{as:"p",variant:"bodyMd",children:k({addressLine1:t.address.addressLine1,addressLine2:t.address.addressLine2})}),e(n,{as:"p",variant:"bodyMd",color:"subdued",children:k({city:t.address.city,state:t.address.state,postalCode:t.address.postalCode})}),e(n,{as:"p",variant:"bodyMd",color:"subdued",children:`${t.address.country}`})]})]})]}):null},Ie=()=>{const{t:r}=I();return e(de,{title:r("shipment.importShipment.importingState.title"),description:e(n,{as:"p",variant:"bodyMd",color:"subdued",children:e(O,{i18nKey:"shipment.importShipment.importingState.description",components:{strong:e("strong",{})}})})})},z=g("div",{target:"en4k28o6"})({name:"3zy121",styles:"margin:20px"}),$=g("div",{target:"en4k28o5"})({name:"1azakc",styles:"text-align:center"}),D=g("div",{target:"en4k28o4"})({name:"1pzk433",styles:"width:100px"}),ye=g("div",{target:"en4k28o3"})({name:"126n5fk",styles:"padding:15px 20px"}),Ce=g("ul",{target:"en4k28o2"})("padding-left:20px;margin:0;color:",T.colors["text-critical"],";"),Fe=g(Q,{target:"en4k28o1"})("width:60px;height:60px;color:",T.colors["icon-success"],";"),Oe=g(Z,{target:"en4k28o0"})("width:60px;height:60px;color:",T.colors["icon-critical"],";"),we=({result:r,onClickImportAgain:p})=>{const{t}=I();return l(h,{children:[e(h.Section,{children:e(z,{children:l(i,{vertical:!0,alignment:"center",children:[e(Fe,{}),e(n,{as:"h1",variant:"headingLg",children:t("shipment.importShipment.importResult.success.title")}),e($,{children:e(n,{as:"p",variant:"bodyMd",color:"subdued",children:e(O,{i18nKey:"pages.importFulfillmentOrder.importResult.success.description",components:{br:e("br",{})},values:{totalCount:r.totalFulfillmentOrders}})})})]})})}),e(h.Section,{children:l(i,{distribution:"trailing",spacing:"none",children:[e(F,{onClick:p,children:t("pages.importFulfillmentOrder.importResult.button.importAgain")}),e(f,{widthSpace:"2"}),e(F,{primary:!0,url:Y.fulfillmentOrders({tab:q.UNFULFILLED}),children:t("pages.importFulfillmentOrder.importResult.button.goToList")})]})})]})},Re=({result:r,onClickImportAgain:p})=>{const{t}=I();return l(h,{children:[e(h.Section,{children:e(z,{children:l(i,{vertical:!0,alignment:"center",children:[e(Oe,{}),e(n,{as:"h1",variant:"headingLg",children:t("shipment.importShipment.importResult.failed.title")}),e($,{children:e(n,{as:"p",variant:"bodyMd",color:"subdued",children:e(O,{i18nKey:"pages.importFulfillmentOrder.importResult.failed.description",components:{br:e("br",{}),strong:e("strong",{})},values:{failedCount:r.errors.length,totalCount:r.totalRows}})})}),l("div",{children:[e(f,{heightSpace:"2"}),e(F,{primary:!0,onClick:()=>p(),children:t("pages.importFulfillmentOrder.importResult.button.importAgain")})]})]})})}),e(h.Section,{flush:!0,children:e(ye,{children:l(i,{children:[e(i.Item,{children:e(D,{children:e(n,{as:"p",variant:"bodyMd",color:"subdued",children:t("shipment.importShipment.importResult.failed.column.rowIndex")})})}),e(i.Item,{fill:!0,children:e(n,{as:"p",variant:"bodyMd",color:"subdued",children:t("shipment.importShipment.importResult.failed.column.orderRef")})}),e(n,{as:"p",variant:"bodyMd",color:"subdued",children:t("shipment.importShipment.importResult.failed.column.reasons")})]})})}),r.errors.map(d=>e(h.Section,{children:l(i,{vertical:!0,spacing:"baseTight",children:[e(i.Item,{children:l(i,{alignment:"center",children:[e(i.Item,{children:e(D,{children:e(n,{as:"p",variant:"bodyMd",color:"subdued",children:d.rowIndex})})}),e(i.Item,{fill:!0,children:e(n,{as:"p",variant:"bodyMd",fontWeight:"bold",children:d.orderRef??"--"})}),e(i.Item,{children:e(U,{message:`${d.errors.length}`,fieldID:`${d.rowIndex}`})})]})}),e(i.Item,{children:e(Ce,{children:d.errors.map((a,c)=>{var v,S,u,s;return e("li",{children:e(n,{as:"p",variant:"bodyMd",breakWord:!0,children:t(`pages.importFulfillmentOrder.importResult.failed.reasons.${L(a.code)}`,{field:t(`shipment.importFulfillmentOrder.fieldsMapping.field.${L(a.field)}.label`,a.field),senderCountry:(v=a.meta)==null?void 0:v.senderCountry,receiverCountry:(S=a.meta)==null?void 0:S.receiverCountry,min:(u
2=a.meta)==null?void 0:u.minimum,max:(s=a.meta)==null?void 0:s.maximum})})},c)})})})]})},d.rowIndex))]})},xe=r=>N(r.result).with({success:!0},()=>e(we,{...r})).with({success:!1},()=>e(Re,{...r})).otherwise(()=>null),W=5,B=500,P=B+1,Te=({disabled:r,onFileUploaded:p})=>{const{t}=I(),[d,a]=o.useState([]),c=o.useRef(null),v=o.useCallback(()=>{a([]),c.current&&(c.current.value="",c.current.click())},[]),S=o.useCallback(async u=>{var C;const s=(C=u.target.files)==null?void 0:C[0];if(!s)return;const b=[];s.size>W*1024*1024&&b.push(t("shipment.importShipment.uploadFile.error.maxFileSize",{size:`${W}MB`}));const y=(await G(s,P+1)).filter(R=>R.length>0);if(y.length>P&&b.push(t("shipment.importShipment.uploadFile.error.maxRowLimit",{limit:B})),b.length>0){a(b);return}const w=J(y);p({file:s,headers:w,rowCount:y.length-1})},[p,t]);return l("div",{children:[e(f,{heightSpace:"4"}),d.map(u=>l(x,{children:[e(f,{heightSpace:"1"}),e(U,{message:u,fieldID:"upload"},u)]})),e(i,{alignment:"center",distribution:"trailing",children:l("div",{children:[e("label",{htmlFor:"upload",children:e(F,{primary:!0,disabled:r,onClick:v,children:t("shipment.importShipment.uploadFile.button.upload")})}),e("input",{ref:c,hidden:!0,type:"file",accept:".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",onChange:S})]})}),e(f,{heightSpace:"4"})]})},Me=3,Ee=()=>{var _;const{t:r}=I(),{userOrganization:p}=V(),{warehouseOptions:t,isLoading:d}=ee(),a=ae(),c=o.useMemo(()=>se(t,{isUsOriginFulfillmentOrderEnabled:a}),[t,a]),v=p.id,[S,u]=o.useState("upload_file"),[s,b]=o.useState(((_=A(c))==null?void 0:_.value)??null),y=o.useCallback(m=>{b(m)},[]),w=o.useCallback(()=>{},[]),{mutateAsync:C,data:R}=te({mutation:{onSuccess:()=>{}}}),M=o.useCallback(async m=>{try{return u("importing"),await ie(Me*1e3)(C(m))}finally{u("result")}},[C]),H=o.useCallback(async m=>{s&&await M({orgId:v,data:{file:m.file,orgWarehouseId:s,fieldsMapping:Se}})},[M,v,s]),X=o.useCallback(()=>{u("upload_file")},[]);return o.useEffect(()=>{window.scrollTo(0,0)},[S]),o.useEffect(()=>{var m;s||b(((m=A(c))==null?void 0:m.value)??null)},[s,c]),e(le,{narrowWidth:!0,title:r("shipment.importShipment.title"),children:e(E,{children:e(E.Section,{children:N({step:S}).with({step:"upload_file"},()=>l(x,{children:[c.length===0&&!d?e(re,{status:"warning",children:r("pages.importFulfillmentOrder.step.selectWarehouse.noWarehouse")}):e(be,{title:r("pages.importFulfillmentOrder.step.selectWarehouse.title"),warehouseOptions:c,selectedWarehouse:c.find(m=>m.value===s),onChange:y}),e(ve,{title:r("pages.importFulfillmentOrder.step.detailsAndDownloadTemplate.title"),onTemplateDownloaded:w}),e(Te,{disabled:!c.some(m=>m.value===s),onFileUploaded:H})]})).with({step:"importing"},()=>e(Ie,{})).with({step:"result"},()=>e(xe,{result:ne(R),onClickImportAgain:X})).exhaustive()})})})};export{Ee as default}; 3//# debugId=7666da62-76bc-57f4-9c69-f2a30055b996 4//# sourceMappingURL=index-aCohX34e.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.