1"use strict";(self.webpackChunk_vndr_ship_client=self.webpackChunk_vndr_ship_client||[]).push([[5122,5634,5685],{52655(e,t,s){s.d(t,{A:()=>a});s(64419);var n=s(63584),i=s(5924),l=s(63203);const a=e=>{var t,s,a,o;let r=e.address;const d=null===r||void 0===r||null===(t=r.verifications)||void 0===t||null===(s=t.delivery)||void 0===s?void 0:s.errors;if(!((null===d||void 0===d?void 0:d.length)&&!1===(null===r||void 0===r||null===(a=r.verifications)||void 0===a||null===(o=a.delivery)||void 0===o?void 0:o.success)))return null;const c=(0,n.hq)({errorList:d});return(0,l.jsx)(i.A,{children:c})}},70086(e,t,s){s.d(t,{A:()=>m});var n=s(39698),i=s(64419),l=s(71889),a=s(68163),o=s(6601),r=s(79626),d=s(38935),c=s(70680),u=s(48923),h=s(63203);const m=e=>{let t=e.handleSubmit,s=e.currentRange,m=void 0===s?null:s,p=e.showRangeText,v=e.isFilterOption,w=e.handleClose,x=e.activeDateRange,g=void 0===x?null:x,y=e.className,f=e.version,b=void 0===f?null:f,j=e.loading,A=e.id,S=void 0===A?(0,l.uniqueId)("daterangemodal-"):A,C=e.labelProps,N=e.label,I=void 0===N?"Time Period":N,D=e.required,k=void 0!==D&&D,P=e.showLabel,E=void 0===P||P,R=e.buttonClass,T=void 0===R?"":R,F=e.containerClasses,O=e.bypassPresets,_=e.placeholder,B=e.clearable;const U=(0,i.useState)(!1),L=(0,n.A)(U,2),W=L[0],z=L[1],M=(0,i.useState)({}),q=(0,n.A)(M,2),V=q[0],K=q[1];(0,i.useEffect)(()=>{if(m)K(m);else if(_)K({});else{const e=new Date;K({startDate:(0,d.Ay)(new Date(e.getFullYear(),e.getMonth(),1),null,!0).format(c.DX),endDate:(0,d.Ay)(new Date(e.getFullYear(),e.getMonth()+1,0),null,!0).format(c.DX)})}},[m,_]);const Y=()=>{if("v2"===b){const e=(null===V||void 0===V?void 0:V.startDate)&&(null===V||void 0===V?void 0:V.endDate);return(0,h.jsxs)("div",{className:(0,u.cn)("tw-grid tw-items-center tw-gap-1.5",F),children:[E&&(0,h.jsxs)(r.J,{htmlFor:S,className:null===C||void 0===C?void 0:C.className,children:[I,k&&I?(0,h.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"}):null]}),(0,h.jsxs)(o.$n,{onClick:()=>z(!0),size:"small",disabled:j,className:(0,u.cn)("tw-flex tw-items-center tw-gap-2 focus-visible:tw-ring-offset-0 focus-visible:tw-ring-primary",T),children:[(0,h.jsx)(a.ado,{width:20,height:20}),(0,h.jsx)("div",{children:e?"".concat((0,d.Ay)(V.startDate,null,!0).format("MMM DD, YYYY")," - ").concat((0,d.Ay)(V.endDate,null,!0).format("MMM DD, YYYY")):_||"Select Date Range"}),B&&e&&(0,h.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"tw-w-4 tw-h-4 tw-text-red-500 tw-cursor-pointer tw-ml-1",onClick:e=>{e.stopPropagation(),K({}),t({startDate:null,endDate:null})},children:[(0,h.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,h.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})]})]})}return(0,h.jsxs)("div",{className:(0,u.cn)("flex tw-items-center tw-pt-3 tw-cursor-pointer tw-text-secondary tw-font-semibold tw-gap-1 tw-fill-secondary",y),onClick:()=>z(!0),children:[(0,h.jsxs)("div",{children:[(0,d.Ay)(null===V||void 0===V?void 0:V.startDate,null,!0).format("MMM-DD")," -"," ",(0,d.Ay)(null===V||void 0===V?void 0:V.endDate,null,!0).format("MMM-DD")]}),(0,h.jsx)(a.ado,{})]})};return!W&&p?Y():(0,h.jsxs)(h.Fragment,{children:[W&&Y(),(0,h.jsx)(o.aF,{maxWidth:"md",customWidth:900,fullWidth:!1,open:W||v,title:"Select Date Range",handleClose:()=>{z(!1),K(m||{}),w&&w()},actions:[{isClose:!0},{isPrimary:!0,onClick:()=>{const e={startDate:(0,d.Fr)(null===V||void 0===V?void 0:V.startDate),endDate:(0,d.Fr)(null===V||void 0===V?void 0:V.endDate)};t(e,g),z(!1)},label:"Submit",disabled:!(null!==V&&void 0!==V&&V.startDate)||!(null!==V&&void 0!==V&&V.endDate)}],children:W||v?(0,h.jsx)(o.Ur,{initialDateFrom:null!==m&&void 0!==m&&m.startDate?(0,d.Ay)(m.startDate,null,!0).format("YYYY-MM-DD"):void 0,initialDateTo:null!==m&&void 0!==m&&m.endDate?(0,d.Ay)(m.endDate,null,!0).format("YYYY-MM-DD"):void 0,onUpdate:e=>{let t=e.range;K({startDate:t.from,endDate:t.to})},bypassPresets:O}):null})]})}},67163(e,t,s){s.d(t,{A:()=>h});var n=s(86558),i=s(54917),l=s(37348),a=s(33240),o=s(79626),r=s(6601),d=s(41501),c=s(71889),u=s(63203);const h=e=>{let t=e.label,s=void 0===t?"Dimensions":t,h=e.lengthName,m=e.widthName,p=e.heightName,v=e.type,w=void 0===v?"number":v,x=e.unitsName,g=e.required,y=void 0!==g&&g,f=e.hideLabel,b=void 0!==f&&f,j=e.hideUnitField,A=void 0!==j&&j,S=e.setFieldValue,C=e.useWithoutFormik,N=void 0!==C&&C,I=e.values,D=e.noErrMsg,k=void 0!==D&&D;return N?(0,u.jsxs)("div",{className:"tw-flex tw-flex-col tw-flex-[2] tw-w-full",children:[!b&&(0,u.jsxs)(o.J,{children:[s,y?(0,u.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"}):""]}),(0,u.jsxs)("div",{className:"tw-flex tw-gap-2 tw-mt-1",children:[(0,u.jsx)(r.A_,{"data-cy":"dimensions-field-length",type:w,endAdornmentClass:"!tw-pr-2",className:"[&::-webkit-inner-spin-button]:tw-appearance-none !tw-pr-6 !tw-pl-1",wrapperClass:"tw-flex-1",endAdornment:(0,u.jsx)("div",{className:"tw-font-medium tw-right-4",children:"L"}),min:.01,onChange:e=>{const t=e.target.value;S(h,S&&t<0?0:t)},value:(0,c.get)(I,h)}),(0,u.jsx)(r.A_,{wrapperClass:"tw-flex-1",type:w,endAdornmentClass:"!tw-pr-2",className:"[&::-webkit-inner-spin-button]:tw-appearance-none !tw-pr-6 !tw-pl-1","data-cy":"dimensions-field-width",endAdornment:(0,u.jsx)("div",{className:"tw-font-medium tw-right-4",children:"W"}),min:.01,onChange:e=>{const t=e.target.value;S(m,S&&t<0?0:t)},value:(0,c.get)(I,m)}),(0,u.jsx)(r.A_,{"data-cy":"dimensions-field-height",type:w,endAdornmentClass:"!tw-pr-2",className:"[&::-webkit-inner-spin-button]:tw-appearance-none !tw-pr-6 !tw-pl-1",wrapperClass:"tw-flex-1",endAdornment:(0,u.jsx)("div",{className:"tw-font-medium tw-right-4",children:"H"}),min:.01,onChange:e=>{const t=e.target.value;S(p,S&&t<0?0:t)},value:(0,c.get)(I,p)}),A?null:(0,u.jsx)(d.l6,{wrapperClass:"tw-flex-1","data-cy":"dimensions-field-units",isTouchedByDefault:!0,options:Object.values(a.A).map(e=>({label:e,value:e})),onChange:e=>{S(x,e.value)},value:(0,c.get)(I,x)})]})]}):(0,u.jsxs)("div",{className:"tw-flex tw-flex-col tw-flex-[2] tw-w-full",children:[!b&&(0,u.jsxs)(o.J,{children:[s,y?(0,u.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"}):""]}),(0,u.jsxs)("div",{className:"tw-flex tw-gap-2 tw-mt-1",children:[(0,u.jsx)(n.B0,{name:h,component:i.A,"data-cy":"dimensions-field-length",type:w,endAdornmentClass:"!tw-pr-2",className:"[&::-webkit-inner-spin-button]:tw-appearance-none !tw-pr-6 !tw-pl-1",wrapperClass:"tw-flex-1",endAdornment:(0,u.jsx)("div",{className:"tw-font-medium tw-right-4",children:"L"}),min:0,onChange:e=>{S&&e<0&&S(h,0)},noErrMsg:k}),(0,u.jsx)(n.B0,{name:m,wrapperClass:"tw-flex-1",type:w,endAdornmentClass:"!tw-pr-2",className:"[&::-webkit-inner-spin-button]:tw-appearance-none !tw-pr-6 !tw-pl-1",component:i.A,"data-cy":"dimensions-field-width",endAdornment:(0,u.jsx)("div",{className:"tw-font-medium tw-right-4",children:"W"}),min:0,onChange:e=>{S&&e<0&&S(m,0)},noErrMsg:k}),(0,u.jsx)(n.B0,{name:p,component:i.A,"data-cy":"dimensions-field-height",type:w,endAdornmentClass:"!tw-pr-2",className:"[&::-webkit-inner-spin-button]:tw-appearance-none !tw-pr-6 !tw-pl-1",wrapperClass:"tw-flex-1",endAdornment:(0,u.jsx)("div",{className:"tw-font-medium tw-right-4",children:"H"}),min:0,onChange:e=>{S&&e<0&&S(p,0)},noErrMsg:k}),A?null:(0,u.jsx)(n.B0,{name:x,wrapperClass:"tw-flex-1",component:l.A,"data-cy":"dimensions-field-units",isTouchedByDefault:!0,options:Object.values(a.A).map(e=>({label:e,value:e}))})]})]})}},32200(e,t,s){s.d(t,{A:()=>r});s(64419);var n=s(2444),i=s(11506),l=s(29425),a=s(5924),o=s(63203);const r=e=>{let t=e.isActive,s=void 0===t?null:t,r=e.weight,d=void 0===r?0:r,c=e.unit,u=void 0===c?i.Ay.POUNDS:c,h=e.shipmentId,m=void 0===h?null:h,p=e.rates,v=void 0===p?[]:p,w=e.className,x=void 0===w?"":w;
1const g=(0,n.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.orders)||void 0===t?void 0:t.selectedRateIdMap)||{}});if(!s||!d||!parseFloat(d))return null;let y=parseFloat(d);if(u!==i.Ay.POUNDS){y=(0,l.v)({from:u,value:y})[i.Ay.POUNDS]||0}if(y<=5.5)return null;if(m&&g[m]&&null!==v&&void 0!==v&&v.length){if(!(null===v||void 0===v?void 0:v.find(e=>e.id===g[m])).service.toLowerCase().includes("air"))return null}return(0,o.jsx)("div",{className:"tw-pl-4 tw-mt-4",children:(0,o.jsx)(a.A,{className:"!tw-text-primary !tw-border-primary tw-font-medium ".concat(x),defaultCollapsed:!0,shortMessage:"This shipment will require a Hazmat Class 9 diamond label.",children:(0,o.jsxs)("span",{children:["This shipment will require a Hazmat Class 9 diamond label to comply with title"," ",(0,o.jsx)("a",{className:"tw-text-inherit tw-underline",href:"https://www.ecfr.gov/current/title-49",target:"_blank",rel:"noreferrer",children:"49 CFR"})," ","and/or additional carrier policies. For any questions about hazardous material shipment preparation, call UPS Hazmat support at ",(0,o.jsx)("b",{className:"tw-text-nowrap",children:"1-800-554-9964"})," or FedEx Hazmat support at",(0,o.jsx)("b",{className:"tw-text-nowrap",children:" 1-800-463-3339"}),"."]})})})}},5924(e,t,s){s.d(t,{A:()=>r});var n=s(39698),i=s(64419),l=s(68163),a=s(48923),o=s(63203);const r=e=>{let t=e.className,s=e.children,r=e.renderMoreInfo,d=e.onDismiss,c=e.shortMessage,u=e.defaultCollapsed,h=void 0!==u&&u;const m=i.useState(h),p=(0,n.A)(m,2),v=p[0],w=p[1],x=!!c;return(0,o.jsxs)("div",{className:(0,a.cn)("tw-relative tw-py-2 tw-rounded-lg tw-text-red-600 tw-px-2 tw-border tw-border-solid tw-border-red-600",x&&!v||d?"tw-pr-8":"",t),children:[x&&!v&&(0,o.jsx)(l.bm,{onClick:()=>w(!0),className:"tw-absolute tw-top-2 tw-right-2 tw-cursor-pointer"}),!x&&d?(0,o.jsx)("button",{type:"button",onClick:d,"aria-label":"Dismiss",className:"tw-absolute tw-top-2 tw-right-2 tw-cursor-pointer tw-border-0 tw-bg-transparent tw-p-0 tw-leading-none tw-text-current tw-opacity-70 hover:tw-opacity-100",children:(0,o.jsx)(l.bm,{})}):null,v?(0,o.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-2 tw-cursor-pointer",onClick:()=>w(!1),children:[(0,o.jsx)(l.N5l,{className:"tw-flex-none"}),(0,o.jsx)("div",{className:"tw-flex-1",children:c}),(0,o.jsx)(l.P6n,{className:"tw-flex-none"})]}):x?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-2",children:[(0,o.jsx)(l.N5l,{className:"tw-flex-none"}),(0,o.jsx)("div",{className:"tw-flex-1",children:s})]}),(null===r||void 0===r?void 0:r())||null]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"tw-flex tw-items-center",children:[(0,o.jsx)("div",{className:"tw-mr-2",children:(0,o.jsx)(l.N5l,{className:"tw-mt-1"})}),s]}),(null===r||void 0===r?void 0:r())||null]})]})}},68824(e,t,s){s.d(t,{A:()=>w});var n=s(98477),i=s(39698),l=s(64419),a=s(35912),o=s(6601),r=s(68163),d=s(48725),c=s.n(d),u=s(63203);const h={flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:16,borderWidth:4,borderRadius:".75rem",borderColor:"#eeeeee",borderStyle:"dashed",outline:"none",transition:"border .24s ease-in-out",minHeight:"6rem",cursor:"pointer"},m={borderColor:"#E7942F"},p={borderColor:"#B06100"},v={borderColor:"#CA4941"},w=e=>{var t,s,d;let w=e.onFileChange,x=e.dropzoneProps,g=e.mainFileType,y=e.isLoading,f=e.defaultFiles,b=void 0===f?[]:f,j=e.renderCustomSelectedFiles,A=e.hideList,S=e.className,C=e.textClassName,N=e.customText;const I=(0,l.useState)(null),D=(0,i.A)(I,2),k=D[0],P=D[1],E=(0,l.useState)(b),R=(0,i.A)(E,2),T=R[0],F=R[1],O=null===x||void 0===x?void 0:x.multiple,_=Object.keys(null!==(t=null===x||void 0===x?void 0:x.accept)&&void 0!==t?t:{}),B=null!==(s=null===x||void 0===x?void 0:x.maxSize)&&void 0!==s?s:5242880,U=(0,l.useCallback)((e,t)=>{if(P(null),t&&t.length)return t[0].errors.find(e=>"file-too-large"===e.code)?P("File size must be less than ".concat(B/1024/1024,"MB.")):P("File types allowed: ".concat(_.join(", "),"."));
1(O?e:[e[0]]).forEach(e=>{const t=new FileReader,s=e;t.readAsArrayBuffer(e),t.onabort=()=>console.log("file reading was aborted"),t.onerror=()=>console.log("file reading has failed"),t.onload=()=>{const n=t.result,i={name:c()(e.name),type:e.type,size:e.size,binary:s,data:n};F(e=>O?e.concat(i):[i]),w&&w({file:O?T.concat(i):i,setDropError:P,newFiles:[i]})}})},[g,w,O,T]),L=(e,t,s)=>{e.stopPropagation(),F(e=>e.filter((e,s)=>s!==t)),w&&w({deletionIndex:t,deletionFile:s,file:T.filter((e,s)=>s!==t),setDropError:P})},W=(0,a.VB)((0,n.A)({onDrop:U},x)),z=W.getRootProps,M=W.getInputProps,q=W.isFocused,V=W.isDragAccept,K=W.isDragReject,Y=(0,l.useMemo)(()=>(0,n.A)((0,n.A)((0,n.A)((0,n.A)({},h),q?m:{}),V?p:{}),K?v:{}),[q,V,K]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",(0,n.A)((0,n.A)({},z({style:Y,className:S})),{},{className:S,children:[(0,u.jsx)("input",(0,n.A)({},M())),j&&null!==T&&void 0!==T&&T.length?j({selectedFiles:T,handleDelete:L}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{style:{display:"flex",alignItems:"center"},children:y?(0,u.jsx)(o.P,{size:16}):(0,u.jsxs)("div",{className:"tw-flex tw-flex-col tw-items-center",children:[(0,u.jsx)("div",{children:(0,u.jsx)(o.$n,{variant:"outlined",size:"small",children:"Browse"})}),(0,u.jsx)(o.o5,{variant:"body2",className:C,children:N||"or drop your ".concat(g?"".concat(null===(d=g.toLowerCase)||void 0===d?void 0:d.call(g)):""," file here")})]})}),T.length&&!A?(0,u.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-mt-2",children:T.map((e,t)=>(0,u.jsxs)(o.o5,{variant:"body2",className:"tw-flex tw-items-center tw-gap-2",children:[e.name," ",(0,u.jsx)(r.epd,{className:"tw-cursor-pointer",onClick:s=>L(s,t,e)})]},t))}):null]})]})),k&&(0,u.jsx)("div",{className:"tw-text-red-600",children:k})]})}},91610(e,t,s){s.d(t,{A:()=>c});var n=s(98477),i=s(39698),l=s(37643),a=(s(64419),s(6601)),o=s(35912),r=s(63203);const d=["label","format","error"],c=e=>{let t=e.label,s=e.format,c=e.error,u=(0,l.A)(e,d);const h=(0,o.Mt)((0,n.A)((0,n.A)({},u.field),u.form)),m=(0,i.A)(h,3),p=m[0],v=m[1],w=m[2],x=c||(v.touched&&v.error?v.error:null);return(0,r.jsxs)("div",{className:"tw-flex tw-flex-col",children:[(0,r.jsx)(a.lr,(0,n.A)((0,n.A)((0,n.A)({},p),u),{},{label:t,format:s,value:p.value,onChange:e=>{w.setValue(e),w.setTouched(!0),null!==u&&void 0!==u&&u.onChange&&u.onChange(e)},style:(0,n.A)({height:u.inputHeight},x?{borderColor:"#CA4941",borderWidth:1,borderStyle:"solid",borderRadius:4}:{}),onBlur:()=>w.setTouched(!0)})),x?(0,r.jsx)("div",{className:"tw-text-red-600 tw-text-sm tw-whitespace-nowrap",children:x}):null]})}},11518(e,t,s){s.d(t,{A:()=>v});var n=s(39698),i=s(64419),l=s(6601),a=s(68163),o=s(86417),r=s(40754),d=s(82391),c=s(29891),u=s(63203);const h={paddingBottom:5},m={storeUrl:"".concat(d.nv,"/Assets/bigCommerce_store_url.png"),storeUrlText:"Store URL",storeApiPath:"".concat(d.nv,"/Assets/bigCommerce_api_path.png"),storeApiPathText:"API Path",storeContext:"".concat(d.nv,"/Assets/bigCommerce_vndr_context.png"),storeContextText:"Context"},p={integration:"".concat(d.nv,"/Assets/klaviyo-integration.webp"),apiKeys:"".concat(d.nv,"/Assets/klaviyo-new-private-api-key.webp"),selectTrigger:"".concat(d.nv,"/Assets/klaviyo-select-trigger.webp"),eventVariables:"".concat(d.nv,"/Assets/klaviyo-event-variables.webp")},v=e=>{var t;let s=e.platformType,v=e.customModalTitle,w=e.customContent,x=void 0===w?null:w,g=e.customButtonLabel,y=void 0===g?null:g,f=e.hideText,b=void 0!==f&&f,j=(e.buttonClassName,e.redirectTo),A=void 0===j?null:j;const S=(0,i.useState)(!1),C=(0,n.A)(S,2),N=C[0],I=C[1];return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.o5,{className:"flex align-items-center tw-mb-4",children:[b?"":"Click to view",(0,u.jsx)("span",{onClick:()=>{null!==A&&void 0!==A&&A.length?window.open(A,"_blank"):I(!0)},className:"tw-cursor-pointer tw-text-black tw-ml-1 tw-underline",children:null!==y&&void 0!==y?y:"Instructions"})]}),(0,u.jsx)(l.aF,{open:N,title:"".concat(null!==(t=null!==y&&void 0!==y?y:v)&&void 0!==t?t:"Instructions"),handleClose:()=>I(!1),maxWidth:"md",children:(0,u.jsx)("div",{children:null!==x&&void 0!==x?x:s===o.hb.shopify?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.o5,{
1children:["Connect your store quickly and easily in 6 steps (3 minutes).",(0,u.jsx)("br",{}),"This will allow you to sync your Shopify store orders, customers, and products for streamlined shipment processing."]}),(0,u.jsxs)("ol",{children:[(0,u.jsx)("li",{style:h,children:"Login to your Shopify admin account"}),(0,u.jsxs)("li",{style:h,children:["Navigate to apps ",(0,u.jsx)(a.j0j,{})," Develop apps for your store"]}),(0,u.jsx)("li",{style:h,children:"Create An App"}),(0,u.jsx)("li",{style:h,children:"Name the app for your reference"}),(0,u.jsxs)("li",{style:h,children:[(0,u.jsx)("span",{style:{color:"#CA4941"},children:"IMPORTANT!"})," Set the appropriate permissions (see permissions below)"]}),(0,u.jsx)("li",{style:h,children:"(FOR PRIVATE APP) Copy paste the API Key, Password and Secret Key below"}),(0,u.jsx)("li",{style:h,children:"(FOR CUSTOM APP) Copy paste the API Key, Admin API Access Token and API Secret Key below"})]}),(0,u.jsxs)(l.o5,{children:[(0,u.jsx)("b",{children:"Required Permissions"}),(0,u.jsx)("br",{}),"Customers: Read access",(0,u.jsx)("br",{}),"Draft orders: Read and Write",(0,u.jsx)("br",{}),"Fulfillment services: Read and Write",(0,u.jsx)("br",{}),"GDPR data requests: Read access",(0,u.jsx)("br",{}),"Inventory: Read and Write",(0,u.jsx)("br",{}),"Locations: Read access",(0,u.jsx)("br",{}),"Merchant-managed fulfillment orders: Read and Write",(0,u.jsx)("br",{}),"Order editing: Read and Write",(0,u.jsx)("br",{}),"Orders: Read and Write",(0,u.jsx)("br",{}),"Product listings: Read and Write",(0,u.jsx)("br",{}),"Products: Read and Write",(0,u.jsx)("br",{}),"Shipping: Read and Write",(0,u.jsx)("br",{}),"Third-party fulfillment orders: Read and Write",(0,u.jsx)("br",{}),"You must also check the Storefront API checkbox to allow this app to access your storefront data using the Storefront API",(0,u.jsx)("br",{}),(0,u.jsx)("br",{}),"Here is a step by step video:"]}),(0,u.jsxs)("video",{style:{width:"100%"},controls:!0,controlsList:"nodownload",children:[(0,u.jsx)("source",{src:"".concat(d.nv,"/app-settings/get_started_videos/Shopify2.mp4"),type:"video/mp4"}),(0,u.jsx)("source",{src:"".concat(d.nv,"/app-settings/get_started_videos/Shopify2.mp4"),type:"video/ogg"}),"Your browser does not support the video tag."]})]}):s===o.hb.woocommerce?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.o5,{children:["Connect your store quickly and easily in 2 steps (1 minute).",(0,u.jsx)("br",{}),"This will allow you to sync your WooCommerce store orders, customers, and products for streamlined shipment processing."]}),(0,u.jsxs)("ol",{style:{marginTop:15},children:[(0,u.jsxs)("li",{style:h,children:["Copy/Paste your Woocommerce Domain below and click"," ",(0,u.jsx)("b",{children:"Integrate"})," button"]}),(0,u.jsx)("li",{style:h,children:"Follow the OAuth process and give access to your Woocommerce store"}),(0,u.jsxs)("li",{style:h,children:["(Optional) Please ensure you have one of these plugins installed and active (you only need one, not both). This allows us to pass tracking information back to your store once you mark an order as fulfilled.",(0,u.jsx)("br",{}),"- WooCommerce Shipment Tracking (",(0,u.jsx)("a",{href:"https://woocommerce.com/products/shipment-tracking",target:"_blank",rel:"noopener noreferrer",children:"https://woocommerce.com/products/shipment-tracking"}),") ",(0,u.jsx)("br",{}),"- Advanced Shipment Tracking (",(0,u.jsx)("a",{href:"https://wordpress.org/plugins/woo-advanced-shipment-tracking",target:"_blank",rel:"noopener noreferrer",children:"https://wordpress.org/plugins/woo-advanced-shipment-tracking"}),")"]}),(0,u.jsxs)("li",{style:h,children:["(Optional) Download, Install and Activate this plugin:\xa0",(0,u.jsx)("a",{href:"".concat(d.nv,"/Assets/Plugins/ShipFare-Live-Rates-WooCommerce.zip"),target:"_blank",rel:"noopener noreferrer",children:"ShipFare Live Rates For Woocommerce"}),"\xa0 to manage Live Rates. This is only required if you would like to show ShipFare Rates at your WooCommerce store checkout.",(0,u.jsxs)("div",{children:["After installing the plugin, activate ShipFare Live Shipping service by going to, Preset -",">"," Stores -",">"," Checkout Options, and click Activate for the respective store."]}),(0,u.jsx)("div",{style:{color:"red"},children:"IMPORTANT:"})," Verify the ShipFare Live Rates service and settings on your Woocommerce store by:",(0,u.jsxs)("ol",{type:"i",children:[(0,u.jsxs)("li",{style:h,children:["Go to your WooCommerce -",">"," Settings -",">"," Shipping -",">"," ","ShipFare Rates and make sure Live Rates is active and Origin information is filled out."]}),(0,u.jsxs)("li",{style:h,children:["Go to your WooCommerce -",">"," Settings -",">"," Shipping -",">"," ","Shipping Zones and add ShipFare Rates to any desired zone."]})]})]})]})]}):s===o.hb.bigcommerce?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.o5,{
1children:["Connect your store quickly and easily in 11 steps (3 minutes).",(0,u.jsx)("br",{}),"This will allow you to sync your BigCommerce store orders, customers, and products for streamlined shipment processing."]}),(0,u.jsxs)("ol",{children:[(0,u.jsx)("li",{style:h,children:"Log into your BigCommerce Store"}),(0,u.jsx)("li",{style:h,children:"Copy store URL from your browser address bar"}),(0,u.jsx)("img",{src:m.storeUrl,alt:m.storeUrlText,style:{width:500,height:"auto",padding:8}}),(0,u.jsxs)("li",{style:h,children:["Go to\xa0",(0,u.jsx)("b",{children:"Advanced\xa0Settings"})," in the left main menu"]}),(0,u.jsxs)("li",{style:h,children:["Click\xa0",(0,u.jsx)("b",{children:"API Accounts"}),". Please note that this option will be enabled only for store owner"]}),(0,u.jsxs)("li",{style:h,children:["Click\xa0",(0,u.jsx)("b",{children:"Create API Account"}),"\xa0and choose\xa0",(0,u.jsx)("b",{children:"Create V2/V3 API token"})]}),(0,u.jsx)("li",{style:h,children:"Type the name of the app (it can be anything for your reference)"}),(0,u.jsxs)("li",{style:h,children:["There you will find\xa0",(0,u.jsx)("b",{children:"API Path"}),"\xa0box. Copy the part of the value that placed between\xa0",(0,u.jsx)("b",{children:"api.bigcommerce.com"}),"\xa0and\xa0",(0,u.jsx)("b",{children:"/v3/"}),"\xa0as shown below"]}),(0,u.jsx)("img",{src:m.storeApiPath,alt:m.storeApiPathText,style:{width:500,height:"auto",padding:8}}),(0,u.jsxs)(l.o5,{sx:{fontSize:"14px"},children:["Paste value into ShipFare in ",(0,u.jsx)("b",{children:"Context"})," field"]}),(0,u.jsx)("br",{}),(0,u.jsx)("img",{src:m.storeContext,alt:m.storeContextText,style:{width:500,height:"auto",padding:8}}),(0,u.jsxs)("li",{style:h,children:[(0,u.jsx)("span",{style:{color:"#CA4941"},children:"IMPORTANT!"})," Set app permissions as follows:"]}),(0,u.jsxs)(l.o5,{sx:{fontSize:"14px"},children:[(0,u.jsx)("b",{children:"Content"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Checkout Content"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Customers"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Customers Login"}),"\xa0- login",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Information Settings"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Marketing"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Orders"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Order Transactions"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Products"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Themes"}),"\xa0- modify",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Carts"}),"\xa0- modify",(0,u.jsx)("br",{})]}),(0,u.jsxs)("li",{style:h,children:["Click the\xa0",(0,u.jsx)("b",{children:"Save"}),"\xa0button. A window will appear containing\xa0",(0,u.jsx)("b",{children:"BigCommerce API Credential"}),"\xa0with ",(0,u.jsx)("b",{children:"Client\xa0ID"}),"\xa0and\xa0",(0,u.jsx)("b",{children:"Access Token"})]}),(0,u.jsx)("li",{style:h,children:"Paste below values in ShipFare -"}),(0,u.jsxs)(l.o5,{sx:{fontSize:"14px"},children:[(0,u.jsx)("b",{children:"Big Commerce Domain"}),"\xa0- From Step 2",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Context"}),"\xa0- From Step 7",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Client Id"}),"\xa0- From Step 9",(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Access Token"}),"\xa0- From Step 9",(0,u.jsx)("br",{})]}),(0,u.jsxs)("li",{style:h,children:["Click ",(0,u.jsx)("b",{children:"Integrate"})," button to complete the integration"]})]})]}):s===o.hb.squarespace?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.o5,{children:["Connect your store quickly and easily in 13 steps (3 minutes).",(0,u.jsx)("br",{}),"This will allow you to sync your Squarespace store orders and products for streamlined shipment processing."]}),(0,u.jsxs)("ol",{children:[(0,u.jsx)("li",{style:h,children:"Login to your store and go to config page (Example: https://mauve-grey-enyb.squarespace.com/config)"}),(0,u.jsxs)("li",{style:h,children:["Go to ",(0,u.jsx)("b",{children:"Settings"})," option in left navigation bar"]}),(0,u.jsxs)("li",{style:h,children:["Click on ",(0,u.jsx)("b",{children:"Developer Tools"}),"\xa0 option in left navigation bar"]}),(0,u.jsxs)("li",{style:h,children:["Click on ",(0,u.jsx)("b",{children:"Developer API Keys"}),"\xa0 option in left navigation bar"]}),(0,u.jsxs)("li",{style:h,children:["Click\xa0",(0,u.jsx)("b",{children:"Generate Key"})]}),(0,u.jsx)("li",{style:h,children:"Add a Key Name and "}),(0,u.jsxs)("li",{style:h,children:[(0,u.jsx)("span",{style:{color:"#CA4941"},children:"IMPORTANT!"})," Click the check mark to set permissions and allow access to:"]}),(0,u.jsxs)(l.o5,{sx:{fontSize:"14px"},children:[(0,u.jsx)("b",{children:"Forms(Read Only)"}),(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Products(Read and Write)"}),(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Inventory(Read and Write)"}),(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Orders(Read and Write)"}),(0,u.jsx)("br",{}),(0,u.jsx)("b",{children:"Transactions and Profiles (Read Only)"}),(0,u.jsx)("br",{})]}),(0,u.jsxs)("li",{style:h,children:["Click on ",(0,u.jsx)("b",{children:"GENERATE KEY"})]}),(0,u.jsx)("li",{style:h,children:"Copy the the generated key before closing the dialog."}),(0,u.jsx)("li",{style:h,children:"In ShipFare, go to Presets -> Stores -> Add Store -> Select Squarespace"}),(0,u.jsx)("li",{style:h,children:"Provide your store URL (Example: https://mauve-grey-enyb.squarespace.com)"}),(0,u.jsx)("li",{style:h,children:"Provide you API key generated from the store."}),(0,u.jsx)("li",{style:h,children:"Click Integrate to complete the integration."})]})]}):"ups"===s?(0,u.jsx)(u.Fragment,{children:(0,u.jsxs)("ol",{children:[(0,u.jsxs)("li",{style:h,children:["Visit"," ",(0,u.jsx)("a",{href:"https://developer.ups.com/",target:"_blank",rel:"noopener noreferrer",children:"https://developer.ups.com/"})]}),(0,u.jsx)("li",{style:h,children:"Login to your UPS pick up account. You will need to create one if you don't have one already. ShipFare does not supply pickup accounts and it is completely independent from your shipping account with us."}),(0,u.jsxs)("li",{style:h,children:["Open dropdown on top right corner ","->"," Click Apps ","->"," Add Apps"]}),(0,u.jsx)("li",{style:h,children:"When asked which scenario best describes you, choose the first one: I want to integrate UPS technology into my business"}),(0,u.jsx)("li",{style:h,children:"Enter all contact details"}),(0,u.jsx)("li",{style:h,children:"Make sure that OAuth and Pickup products are selected when adding products"}),(0,u.jsx)("li",{style:h,children:"Copy/Paste Your Client ID and Client Secret to ShipFare along with UPS account number and username"})]})}):s===o.hb.grazeCart?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.o5,{
1children:["Connect your store quickly and easily in 2 steps (1 minute).",(0,u.jsx)("br",{}),"This will allow you to sync your GrazeCart store orders for streamlined shipment processing."]}),(0,u.jsxs)("ol",{children:[(0,u.jsx)("li",{style:h,children:"Enter you GrazeCart store URL"}),(0,u.jsx)("li",{style:h,children:"Enter your API Key"}),(0,u.jsx)("li",{style:h,children:"Click Integrate to complete the integration."})]})]}):s===o.hb.jetti?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.o5,{children:["Connect your store quickly and easily in 4 steps (2 minutes).",(0,u.jsx)("br",{}),"This will allow you to fetch Rates and Label directly in your Jetti account."]}),(0,u.jsxs)("ol",{children:[(0,u.jsx)("li",{style:h,children:"Enable the Jetti integration on ShipFare."}),(0,u.jsxs)("li",{style:h,children:["Create your new ShipFare Api Key (if not already created). Go to API and ",(0,u.jsx)("b",{children:"Generate"})," new key."]}),(0,u.jsxs)("li",{style:h,children:["Open you Jetti account and navigate to"," ",(0,u.jsxs)("b",{children:["Integrations -",">"," Custom Carrier"]}),"."]}),(0,u.jsxs)("li",{style:h,children:["Enter any unique Name, and the following Rate, Label and Tracking endpoints respectively:",(0,u.jsx)("br",{}),"Rate endpoint: ".concat(d.aY,"/api/v1/liveShipping/getJettiRates?api_key=<VNDR_API_KEY>"),(0,u.jsx)("br",{}),"Label endpoint: ".concat(d.aY,"/api/v1/liveShipping/getJettiLabel?api_key=<VNDR_API_KEY>"),(0,u.jsx)("br",{}),"Tracking endpoint: ".concat(d.aY,"/api/v1/liveShipping/getJettiTracking?api_key=<VNDR_API_KEY>")]})]})]}):s===r.h9.klaviyo?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h1",{className:"tw-font-medium tw-text-3xl lg:tw-text-4xl tw-text-center tw-mb-8 tw-mt-0",children:"Integrating ShipFare with Klaviyo"}),(0,u.jsxs)("p",{children:["Visit"," ",(0,u.jsx)("a",{className:"tw-text-secondary tw-underline",href:"https://www.klaviyo.com/settings/account/api-keys",children:"Klaviyo API Keys"})," ","settings page."]}),(0,u.jsxs)("ul",{className:"tw-list-disc tw-list-inside tw-pl-4 tw-mb-4",children:[(0,u.jsx)("li",{children:"Navigate to Settings by clicking at the bottom left logo."}),(0,u.jsx)("li",{children:"Click on API keys."}),(0,u.jsx)("li",{children:"Scroll to Private API Keys section and click on Create Private API Key."})]}),(0,u.jsx)("p",{children:(0,u.jsx)("img",{className:"tw-rounded-2xl",src:p.integration,alt:"Klaviyo API keys settings page"})}),(0,u.jsx)("p",{children:"Name the API key and give Read/Write access for Events & Metrics."}),(0,u.jsx)("p",{children:(0,u.jsx)("img",{className:"tw-rounded-2xl",src:p.apiKeys,alt:"Klaviyo new private api key"})}),(0,u.jsxs)("p",{children:["Copy the created key, visit"," ",(0,u.jsx)("a",{className:"tw-text-secondary tw-underline",href:"".concat(d.GG,"/preset/tracking-templates"),children:"Track & Notify"})," ","ShipFare settings page and enter the API key."]}),(0,u.jsx)("h2",{className:"tw-font-medium tw-text-3xl lg:tw-text-4xl tw-text-center",children:"Designing Emails in Klaviyo"}),(0,u.jsx)("div",{className:"tw-mt-4",children:"You can use the event variable below to design your perfect email."}),(0,u.jsx)("div",{className:"tw-mt-2",children:(0,u.jsxs)(l.QT,{children:[(0,u.jsx)(l.A0,{children:(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nd,{children:"Property Name"}),(0,u.jsx)(l.nd,{children:"Example Data"}),(0,u.jsx)(l.nd,{children:"Notes"})]})}),(0,u.jsxs)(l.BF,{children:[(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{children:"Carrier"}),(0,u.jsx)(l.nA,{children:"UPS"}),(0,u.jsx)(l.nA,{})]}),(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{children:"DeliveryDate"}),(0,u.jsx)(l.nA,{children:"April 24, 2025"}),(0,u.jsx)(l.nA,{})]}),(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{className:"!tw-align-top",children:"Items"}),(0,u.jsxs)(l.nA,{children:[(0,u.jsxs)("div",{className:"tw-flex tw-gap-1",children:[(0,u.jsx)(c.A,{}),(0,u.jsx)("span",{children:"JSON"})]}),(0,u.jsx)("div",{className:"tw-mt-4",children:(0,u.jsx)("pre",{className:"tw-font-medium",children:"{\n 'Name': 'ORGANIC JUICE CLEANSE - 3-DAY SIGNATURE',\n 'Quantity': 1,\n 'Price': '$179.00'\n}"})})]}),(0,u.jsx)(l.nA,{})]}),(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{children:"OrderNumber"}),(0,u.jsx)(l.nA,{children:"#12345"}),(0,u.jsx)(l.nA,{})]}),(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{children:"OrderTotal"}),(0,u.jsx)(l.nA,{children:"73.06"}),(0,u.jsx)(l.nA,{})]}),(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{className:"!tw-align-top",children:"ShippingAddress"}),(0,u.jsxs)(l.nA,{children:[(0,u.jsxs)("div",{className:"tw-flex tw-gap-1",children:[(0,u.jsx)(c.A,{}),(0,u.jsx)("span",{children:"JSON"})]}),(0,u.jsx)("div",{className:"tw-mt-4",children:(0,u.jsx)("pre",{className:"tw-font-medium",children:'{\n "Street1": "173 Lenox Rd",\n "City": "Brooklyn",\n "State": "NY",\n "Zip": "11226"\n}'})})]}),(0,u.jsx)(l.nA,{})]}),(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{children:"TrackingNumber"}),(0,u.jsx)(l.nA,{children:"1Z81R2X90105639207"}),(0,u.jsx)(l.nA,{})]}),(0,u.jsxs)(l.Hj,{children:[(0,u.jsx)(l.nA,{children:"TrackingPageUrl"}),(0,u.jsx)(l.nA,{children:"https://www.ups.com/track?tracknum=1ZA75Y171330159806"}),(0,u.jsx)(l.nA,{})]})]})]})}),(0,u.jsx)("h2",{className:"tw-text-2xl lg:tw-text-3xl tw-mt-10",children:"Instructions"}),(0,u.jsxs)("ol",{className:"tw-list-inside tw-pl-4 tw-list-decimal tw-mt-4",children:[(0,u.jsxs)("li",{children:["Visit"," ",(0,u.jsx)("a",{className:"tw-text-secondary tw-underline",rel:"nofollow",href:"https://www.klaviyo.com/flows?page=1",children:"Klaviyo Flows"})," ","page and create a new flow."]}),(0,u.jsx)("li",{children:"Click on Your Metrics and API."}),(0,u.jsxs)("li",{children:["You will now see a list of all available triggers, so scroll down until you see triggers starting with ShipFare -.",(0,u.jsx)("p",{className:"tw-mt-4",children:(0,u.jsx)("img",{className:"tw-rounded-2xl",src:p.selectTrigger,alt:"Klaviyo select trigger"})})]}),(0,u.jsxs)("li",{children:["Below is a sample email template of how event variables can be used when you start designing your email.",(0,u.jsx)("p",{className:"tw-mt-4",children:(0,u.jsx)("img",{className:"tw-rounded-2xl",src:p.eventVariables,alt:"Klaviyo variables"})})]})]})]}):"easypostInsurance"===s?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l.o5,{
1children:"General Claim Details:"}),(0,u.jsxs)("ol",{children:[(0,u.jsx)("li",{style:h,children:"All claims regarding damage or theft are to be submitted to ShipFare within thirty (30) days of the shipment creation date."}),(0,u.jsx)("li",{style:h,children:"All claims regarding loss are to be submitted to ShipFare after thirty (30) days of the shipment creation date, but no later than sixty (60) days of the shipment creation."}),(0,u.jsx)("li",{style:h,children:"The package recipient should hold damaged items in the event they are requested during claim processing. FAILURE TO RETAIN DAMAGED PROPERTY MAY AFFECT FINAL SETTLEMENT OF CLAIM."}),(0,u.jsx)("li",{style:h,children:"WARNING: Any fraudulent claims will endanger the shipper and/or package recipient to prosecution for mail fraud under the Federal Criminal Code."}),(0,u.jsx)("li",{style:h,children:"All monetary values must be submitted in USD"})]}),(0,u.jsx)(l.o5,{children:"Lost Claim Details:"}),(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{style:h,children:'For any package that shows "delivered" in tracking but wasn\'t received by the customer, please file a theft claim (we consider mis-delivery a theft claim as well)'}),(0,u.jsx)("li",{style:h,children:"Please note that payout would automatically happen 60 days after package acceptance date"})]}),(0,u.jsx)(l.o5,{children:"Please enter the details surrounding your claim below"})]}):void 0})})]})}},82407(e,t,s){s.d(t,{A:()=>o});s(64419);var n=s(2444),i=s(78270),l=s(61385),a=s(63203);const o=()=>{const e=(0,i.useLocation)(),t=(0,n.useSelector)(e=>({isAuthenticated:e.auth.user&&e.auth.user._id})).isAuthenticated;if((0,l.if)()){const e=(0,l.LR)()||"/protection-claim";return(0,a.jsx)(i.Redirect,{to:e})}return(0,a.jsx)(i.Redirect,{to:{pathname:t?"/":"/login",state:{from:e}}})}},1592(e,t,s){s.d(t,{A:()=>w});var n=s(39698),i=s(64419),l=s(68163),a=s(6696),o=s.n(a),r=s(6601),d=s(20910),c=s(42664),u=s(29254),h=s(41501),m=s(63203);const p=Object.values(c.x).map(e=>({label:e,value:e})),v=Object.values(c.y).map(e=>({label:e,value:e})),w=e=>{let t=e.page,s=void 0===t?1:t,a=e.total,c=void 0===a?0:a,w=e.limit,x=void 0===w?100:w,g=e.history,y=e.className,f=e.customQsParamHandler,b=void 0===f?null:f,j=e.loading,A=e.customPaginationHandler,S=void 0!==A&&A,C=e.setPaginationData,N=e.shortPageLimit,I=void 0!==N&&N,D=e.small,k=void 0!==D&&D;const P=parseInt(s)||1,E=parseInt(x)||100,R=(P-1)*E+1;let T=P*E;T>c&&(T=c);const F=Math.ceil(c/E);let O=!0,_=!0;P<=1&&(O=!1),P>=F&&(_=!1);const B=(0,i.useState)(P),U=(0,n.A)(B,2),L=U[0],W=U[1],z=(0,i.useState)(E),M=(0,n.A)(z,2),q=M[0],V=M[1],K=(0,d.Ay)({history:g});(0,i.useEffect)(()=>{L!==P&&W(P),q!==E&&V(E)},[P,E]);const Y=e=>{W(e),(e=>{let t=e.updatedPage,s=void 0===t?null:t,n=e.updatedLimit;const i=s||L,l=(void 0===n?null:n)||q;if(P!==i||E!==l){let e=[];b?e=b(K):Object.keys(K).forEach(t=>{["page","limit"].includes(t)||("custom_filters"===t?e.push(o().stringify({custom_filters:K[t]})):e.push("".concat(t,"=").concat(encodeURIComponent(K[t]))))});let t=i,s=l;if(t<1?t=1:t>F&&(t=F),s<1&&(s=1),W(t),V(s),S&&C)return void C({page:t,limit:s});e.push("page=".concat(encodeURIComponent(t))),e.push("limit=".concat(encodeURIComponent(s))),g.push("".concat(g.location.pathname,"?").concat(e.join("&")))}})({updatedPage:e})};return F&&1!==F?(0,m.jsxs)("div",{className:"tw-flex tw-flex-col sm:tw-flex-row tw-flex-wrap tw-items-center sm:tw-justify-between tw-gap-2 ".concat(k?"sm:tw-gap-2 tw-text-xs tw-mt-2":"sm:tw-gap-4 tw-text-sm tw-mt-4"," tw-w-full tw-relative tw-z-[100] ").concat(y||""),children:[(0,m.jsxs)("div",{children:["Showing ",(0,u.thousandsFormat)(R),"-",(0,u.thous
1andsFormat)(T)," of"," ",(0,u.thousandsFormat)(c)]}),(0,m.jsxs)("div",{className:"tw-flex tw-w-full sm:tw-w-auto tw-justify-between ".concat(k?"sm:tw-gap-2":"sm:tw-gap-4"," tw-items-center"),children:[(0,m.jsxs)("div",{className:"tw-flex tw-gap-1 tw-items-center",children:[(0,m.jsx)(r.$n,{iconButton:!0,size:"small",className:"!tw-p-0 tw-z-50",disabled:!O||j,onClick:()=>Y(P-1),children:(0,m.jsx)(l.JGc,{className:k?"tw-text-base":""})}),(0,m.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-1",children:[(0,m.jsx)("div",{className:"".concat(k?"tw-w-9":"tw-w-12"," tw-z-50"),children:(0,m.jsx)(h.A_,{variant:"outlined",value:L,onChange:e=>W(e.target.value),onBlur:()=>Y(L),style:{height:k?26:32,padding:0,textAlign:"center"},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Y(L))},className:"tw-z-50"})}),"of ",(0,u.thousandsFormat)(F)]}),(0,m.jsx)(r.$n,{iconButton:!0,className:"!tw-p-0 tw-z-50",size:"small",disabled:!_||j,onClick:()=>Y(P+1),children:(0,m.jsx)(l.c_$,{className:k?"tw-text-base":""})})]}),(0,m.jsxs)("div",{className:"tw-flex tw-items-center ".concat(k?"tw-gap-1":"tw-gap-2"),children:[(0,m.jsx)("span",{className:"tw-text-nowrap",children:"Rows Per Page:"}),(0,m.jsx)("div",{style:{width:k?"4rem":"4.5rem"},children:(0,m.jsx)(h.l6,{name:"recordsLimit",options:I?v:p,value:{label:q||20,value:q||20},disabled:j,className:"".concat(k?"tw-h-[28px]":"tw-h-[36px]"," tw-z-50"),onChange:e=>{const t=null===e||void 0===e?void 0:e.value;if(!t)return;const s=L,n=t;if(P!==s||E!==n){let e=[];b?e=b(K):Object.keys(K).forEach(t=>{["page","limit"].includes(t)||("custom_filters"===t?e.push(o().stringify({custom_filters:K[t]})):e.push("".concat(t,"=").concat(encodeURIComponent(K[t]))))});let t=s,i=n;if(t<1?t=1:t>F&&(t=F),i<1&&(i=1),W(t),V(i),S&&C)return void C({page:t,limit:i});e.push("page=".concat(encodeURIComponent(t))),e.push("limit=".concat(encodeURIComponent(i))),g.push("".concat(g.location.pathname,"?").concat(e.join("&")))}}})})]})]})]}):null}},83311(e,t,s){s.d(t,{A:()=>j});var n=s(39698),i=s(64419),l=s(27027),a=s(42716),o=s(74535),r=s(8945),d=s(5019),c=s(3566),u=s(62659),h=s(27296),m=s(48923),p=s(63203);const v="included",w="excluded",x="unlimited",g={"ACCOUNTS & CONNECTIONS":{"Store Integrations":[1,2,3,x],"External Carrier Accounts":[0,2,3,x],Users:[1,2,x,x],"Preferred Service Logic":[v,v,v,v],"Local Couriers Connection":[v,v,v,v],"Pick-Up Account Connection":[v,v,v,v],"Full Perishability Coverage":[v,v,v,v]},"LABELS & PACKING CONFIGURATION":{"Packing Slip Customization":[v,v,v,v],"Comprehensive Mapping":[v,v,v,v],"Duplicate Label Safeguard":[w,v,v,v],"Combinable Orders":[w,v,v,v],"Box Splitting Algorithm":[w,v,v,v],"Product Kitting":[w,v,v,v]},"BRANDED TRACKING PAGE & NOTIFICATIONS":{"Branded Notifications":[v,v,v,v],"Branded Tracking Page":[w,v,v,v],"Klaviyo Integration":[w,v,v,v],"Late Shipment Alerts":[w,v,v,v]},"LEAD TIMES & LIVE RATES":{"Live Rates at Checkout":[w,w,v,v],"Rate Rounding & Markup":[w,w,v,v],"Service Display Logic":[w,w,v,v],"Live Shipping Schedule":[w,w,v,v],"Delivery Date Picker":[w,w,v,v],"Delivery Promise":[w,w,v,v]},"ADVANCED FEATURES":{"Claim Management":[v,v,v,v],"Dry Ice Compliance":[v,v,v,v],"Confidence Scores":[w,v,v,v],"Live Weather Tracking":[w,v,v,v],"Zone Mapping":[w,v,v,v],"Rule Automations":[w,3,x,x],"Order Protection":[w,w,v,v],"Branded Claim Flow":[w,w,v,v],"API Access":[w,w,w,v],"Priority Support":[w,w,w,v],"Custom Built Integrations":[w,w,w,v]}},y={start:{name:"Start",monthlyPrice:"$0",description:"For low-volume perishable shippers where only basic print-and-ship functionality is required.",labelPrice:"$0.99",items:["Local Couriers Connection","1 Store / 0 External Carrier","1 User","Product & Service Mapping","Full Perishability Coverage","Claim Management","Packing Slip Customization","Branded Notifications","Dry Ice Compliance"],colorText:"tw-text-blue-600",colorBorder:"tw-border-blue-600",colorBg:"tw-bg-blue-600"},grow:{name:"Grow",monthlyPrice:"$79",description:"For perishable operations looking for weather, fulfillment, and delivery failure safeguards.",labelPrice:"$0.40",items:["2 Stores / 2 External C
1arriers","2 Users","Live Weather Tracking","Zone Mapping","3 Rule Automations","Confidence Scores","Late Shipment Alerts","Combinable Orders","Box Splitting Algorithm","Branded Tracking Page","Klaviyo Integration","Duplicate Label Safeguard"],colorText:"tw-text-orange-600",colorBorder:"tw-border-orange-600",colorBg:"tw-bg-orange-600"},scale:{name:"Scale",monthlyPrice:"$199",description:"Built for brands who want to optimize checkout conversion and post-purchase experience.",labelPrice:"$0.20",items:["3 Stores / 3 External Carriers","Unlimited Users","Unlimited Rule Automations","Live Rates at Checkout","Rate Rounding & Markup","Live Shipping Schedule","Order Protection","Branded Claim Flow","Delivery Date Picker","Delivery Promise"],colorText:"tw-text-purple-600",colorBorder:"tw-border-purple-600",colorBg:"tw-bg-purple-600",mostPopular:!0},enterprise:{name:"Enterprise",monthlyPrice:"$399",description:"Designed for large perishable shippers who require prioritized support and maximum capabilities.",labelPrice:"$0.10",items:["Unlimited Stores & Exter
1nal Carriers","Priority Support","API Access","Custom Built Integrations"],colorText:"tw-text-green-600",colorBorder:"tw-border-green-600",colorBg:"tw-bg-green-600"}},f={start:{icon:(0,p.jsx)(r.A,{className:"tw-w-6 tw-h-6 tw-text-slate-500"}),bgStyle:{backgroundColor:"#f1f5f9"}},grow:{icon:(0,p.jsx)(c.A,{className:"tw-w-6 tw-h-6 tw-text-secondary"}),bgStyle:{background:"linear-gradient(135deg, #EDF1FA, #D6DFF5)"}},scale:{icon:(0,p.jsx)(h.A,{className:"tw-w-6 tw-h-6 tw-text-white"}),bgStyle:{backgroundColor:"rgba(255,255,255,0.15)"}},enterprise:{icon:(0,p.jsx)(d.A,{className:"tw-w-6 tw-h-6",style:{color:"#b45309"}}),bgStyle:{background:"linear-gradient(135deg, #FFF3DC, #FFE5A8)"}}},b=e=>e===v?(0,p.jsx)(l.A,{className:"tw-w-5 tw-h-5 tw-text-green-500 tw-mx-auto",strokeWidth:3}):e===w?(0,p.jsx)(u.A,{className:"tw-w-5 tw-h-5 tw-text-slate-300 tw-mx-auto",strokeWidth:2}):e===x?(0,p.jsx)(o.A,{className:"tw-w-5 tw-h-5 tw-text-secondary tw-mx-auto"}):(0,p.jsx)("span",{className:"tw-text-base tw-font-bold tw-text-secondary",children:e}),j=e=>{let t=e.selectedPlanAfterTrial,s=e.onSelectPlan,o=e.scheduledDowngradePlan;const d=Object.keys(y),c=d.indexOf(t),u=(e,s)=>{if(!t)return"Get Started";if(o===e)return"Downgrade Scheduled";const n=d.indexOf(e);return n===c?"Current Plan":n<c?"Downgrade to ".concat(s):"Upgrade to ".concat(s)},h=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!s)return n?(0,p.jsx)("a",{href:"https://ship.shipfare.com/register",className:"tw-block tw-no-underline",children:(0,p.jsxs)("div",{className:"tw-relative tw-inline-flex tw-w-full tw-items-center tw-justify-center tw-overflow-hidden tw-font-medium tw-rounded-lg tw-shadow-2xl",style:{backgroundColor:"hsl(var(--primary))"},children:[(0,p.jsxs)("span",{className:"tw-absolute tw-inset-0 tw-w-full tw-h-full tw-animate-spin",style:{animationDuration:"5s"},children:[(0,p.jsx)("span",{className:"tw-absolute tw-bottom-0 tw-left-0 tw-w-32 tw-h-24 -tw-ml-10 tw-rounded-full tw-blur-md",style:{background:"linear-gradient(to right, #9333ea, #d8b4fe)"}}),(0,p.jsx)("span",{className:"tw-absolute tw-bottom-0 tw-right-0 tw-w-32 tw-h-24 -tw-mr-10 tw-rounded-full tw-blur-md",style:{background:"linear-gradient(to right, #9333ea, #d8b4fe)"}})]}),(0,p.jsx)("span",{className:"tw-relative tw-text-white tw-font-semibold tw-py-3",children:"Start Free Trial"})]})}):(0,p.jsx)("a",{href:"https://ship.shipfare.com/register",className:"tw-block tw-no-underline tw-text-center tw-rounded-lg tw-py-3 tw-px-6 tw-border tw-border-solid tw-border-secondary tw-text-secondary tw-font-semibold hover:tw-bg-secondary hover:tw-text-white tw-transition-colors",children:"Get Started"});const i=d.indexOf(e)===c||o===e;return(0,p.jsx)("button",{onClick:()=>!i&&s(e),disabled:i,className:(0,m.cn)("tw-rounded-lg tw-w-full tw-py-3 tw-px-6 tw-block tw-border tw-border-solid tw-font-semibold tw-cursor-pointer tw-transition-colors",i?"tw-bg-gray-100 tw-text-gray-400 tw-border-gray-200 !tw-cursor-not-allowed":n?"tw-bg-primary tw-border-primary tw-text-white hover:tw-opacity-90":"tw-bg-secondary tw-border-secondary tw-text-white hover:tw-opacity-90"),children:u(e,t.name)})};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("section",{className:"tw-pb-16 tw-bg-white",id:"plans",children:(0,p.jsxs)("div",{className:"tw-mx-auto tw-px-6 tw-max-w-[1570px]",children:[(0,p.jsx)("div",{className:"tw-text-center",children:(0,p.jsxs)("div",{className:"tw-inline-flex tw-items-center tw-gap-2 tw-bg-white tw-border tw-border-solid tw-rounded-lg tw-px-4 tw-py-2 tw-mb-6 tw-shadow-sm",style:{borderColor:"rgba(61, 84, 144, 0.2)"},children:[(0,p.jsx)(r.A,{className:"tw-w-5 tw-h-5 tw-text-secondary"}),(0,p.jsx)("span",{className:"tw-text-sm tw-font-bold tw-text-secondary",children:"Plans For Any Company Size"})]})}),(0,p.jsxs)("div",{className:"tw-text-center tw-mb-12",children:[(0,p.jsx)("h2",{className:"tw-text-3xl lg:tw-text-4xl tw-font-black tw-text-secondary tw-mt-0 tw-mb-3",children:"Our Perishable Shipping Platform Plans"}),(0,p.jsxs)("p",{className:"tw-text-slate-500 tw-font-medium tw-max-w-xl tw-mx-auto tw-m-0",children:["Plans are based on monthly"," ",(0,p.jsx)("strong",{className:"tw-text-secondary",children:"shipment volume, shipping complexity, and delivery risk management needs."})]})]}
1),(0,p.jsx)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 xl:tw-grid-cols-4 tw-gap-6 tw-items-start",children:Object.entries(y).map((e,t)=>{let s=(0,n.A)(e,2),i=s[0],a=s[1];const o=Object.values(y)[t-1];return a.mostPopular?((e,t,s)=>{const n=f[e];return(0,p.jsxs)("div",{className:"tw-rounded-2xl tw-p-8 tw-flex tw-flex-col tw-relative",style:{background:"linear-gradient(160deg, #3D5490 0%, #49629D 60%, #5571B0 100%)"},children:[(0,p.jsx)("div",{className:"tw-absolute -tw-top-4 tw-left-1/2 -tw-translate-x-1/2 tw-text-white tw-text-xs tw-font-black tw-px-4 tw-py-1.5 tw-rounded-xl tw-whitespace-nowrap",style:{backgroundColor:"hsl(var(--primary))",boxShadow:"0 4px 14px rgba(234, 146, 30, 0.4)"},children:"\u2605 BEST FOR SHOPIFY USERS"}),(0,p.jsx)("div",{className:"tw-absolute tw-top-4 tw-right-4 tw-text-white tw-text-xs tw-font-bold tw-px-3 tw-py-1 tw-rounded-lg",style:{backgroundColor:"rgba(255,255,255,0.15)"},children:"28-Day Free Trial"}),(0,p.jsxs)("div",{className:"tw-mb-6",children:[(0,p.jsx)("div",{className:"tw-w-12 tw-h-12 tw-rounded-2xl tw-flex tw-items-center tw-justify-center tw-mb-4",style:n.bgStyle,children:n.icon}),(0,p.jsx)("h3",{className:"tw-text-2xl tw-font-black tw-mt-0 tw-mb-1",children:(0,p.jsx)("span",{className:"tw-text-purple-600 tw-bg-purple-300 tw-rounded-lg tw-px-2 tw-py-0.5",children:t.name})}),(0,p.jsx)("p",{className:"tw-m-0 tw-font-medium tw-leading-relaxed",style:{color:"rgba(255,255,255,0.7)"},children:t.description})]}),(0,p.jsxs)("div",{className:"tw-mb-6 tw-pb-6",style:{borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[(0,p.jsxs)("div",{className:"tw-flex tw-items-baseline tw-gap-1",children:[(0,p.jsx)("span",{className:"tw-text-4xl tw-font-black tw-text-white",children:t.monthlyPrice}),(0,p.jsx)("span",{className:"tw-font-semibold",style:{color:"rgba(255,255,255,0.6)"},children:"/month"})]}),(0,p.jsxs)("div",{className:"tw-text-primary tw-font-bold tw-mt-1",children:["+ ",t.labelPrice," Per Label"]})]}),(0,p.jsxs)("ul",{className:"tw-space-y-3 tw-mb-8 tw-flex-1 tw-p-0 tw-m-0 tw-list-none",children:[s&&(0,p.jsxs)("li",{className:"tw-flex tw-items-start tw-gap-2.5 tw-font-medium tw-text-primary",children:[(0,p.jsx)(l.A,{className:"tw-w-4 tw-h-4 tw-mt-0.5 tw-flex-shrink-0",strokeWidth:3}),(0,p.jsxs)("span",{className:"tw-font-bold",children:["Everything in"," ",(0,p.jsx)("span",{className:s.colorText,children:s.name})]})]}),t.items.map((e,t)=>(0,p.jsxs)("li",{className:"tw-flex tw-items-start tw-gap-2.5 tw-font-medium",style:{color:"rgba(255,255,255,0.8)"},children:[(0,p.jsx)(l.A,{className:"tw-w-4 tw-h-4 tw-mt-0.5 tw-flex-shrink-0",style:{color:"rgba(255,255,255,0.6)"},strokeWidth:3}),e]},t))]}),h(e,t,!0)]},e)})(i,a,o):((e,t,s)=>{const n=f[e];return(0,p.jsxs)("div",{className:"tw-bg-white tw-rounded-2xl tw-border tw-border-solid tw-border-slate-200 tw-shadow-lg tw-p-8 tw-flex tw-flex-col",children:[(0,p.jsxs)("div",{className:"tw-mb-6",children:[(0,p.jsx)("div",{className:"tw-w-12 tw-h-12 tw-rounded-2xl tw-flex tw-items-center tw-justify-center tw-mb-4",style:n.bgStyle,children:n.icon}),(0,p.jsx)("h3",{className:(0,m.cn)("tw-text-2xl tw-font-black tw-mt-0 tw-mb-1",t.colorText),children:t.name}),(0,p.jsx)("p",{className:"tw-text-slate-500 tw-font-medium tw-leading-relaxed tw-m-0",children:t.description})]}),(0,p.jsxs)("div",{className:"tw-mb-6 tw-pb-6 tw-border-0 tw-border-b tw-border-solid tw-border-slate-100",children:[(0,p.jsxs)("div",{className:"tw-flex tw-items-baseline tw-gap-1",children:[(0,p.jsx)("span",{className:"tw-text-4xl tw-font-black tw-text-secondary",children:t.monthlyPrice}),(0,p.jsx)("span",{className:"tw-text-slate-400 tw-font-semibold",children:"/month"})]}),(0,p.jsxs)("div",{className:"tw-text-primary tw-font-bold tw-mt-1",children:["+ ",t.labelPrice," Per Label"]})]}),(0,p.jsxs)("ul",{className:"tw-space-y-3 tw-mb-8 tw-flex-1 tw-p-0 tw-m-0 tw-list-none",children:[s&&(0,p.jsxs)("li",{className:"tw-flex tw-items-start tw-gap-2.5 tw-font-medium tw-text-secondary",children:[(0,p.jsx)(l.A,{className:"tw-w-4 tw-h-4 tw-mt-0.5 tw-flex-shrink-0",strokeWidth:3}),(0,p.jsxs)("span",{className:"tw-font-bold",children:["Everything in"," ",(0,p.jsx)("span",{className:s.colorText,children:s.name})]})]}),t.items.map((e,t)=>(0,p.jsxs)("li",{className:"tw-flex tw-items-start tw-gap-2.5 tw-font-medium tw-text-slate-600",children:[(0,p.jsx)(l.A,{className:"tw-w-4 tw-h-4 tw-mt-0.5 tw-flex-shrink-0 tw-text-green-500",strokeWidth:3}),e]},t))]}),h(e,t)]},e)})(i,a,o)})})]})}),(0,p.jsx)("section",{className:"tw-py-20",style:{background:"linear-gradient(160deg, #FDFAF4 0%, #FAF
15E8 50%, #F5EDD6 100%)"},children:(0,p.jsxs)("div",{className:"tw-max-w-7xl tw-mx-auto tw-px-6",children:[(0,p.jsxs)("div",{className:"tw-text-center tw-mb-12",children:[(0,p.jsxs)("div",{className:"tw-inline-flex tw-items-center tw-gap-2 tw-bg-white tw-border tw-border-solid tw-rounded-lg tw-px-4 tw-py-2 tw-mb-5 tw-shadow-sm",style:{borderColor:"rgba(61, 84, 144, 0.2)"},children:[(0,p.jsx)(a.A,{className:"tw-w-5 tw-h-5 tw-text-secondary"}),(0,p.jsx)("span",{className:"tw-text-sm tw-font-bold tw-text-secondary",children:"Compare Plans"})]}),(0,p.jsx)("h2",{className:"tw-text-3xl lg:tw-text-4xl tw-font-black tw-text-secondary tw-mt-0 tw-mb-3",children:"Review Features Side by Side"}),(0,p.jsx)("p",{className:"tw-text-slate-500 tw-font-medium tw-m-0",children:"Review our features by plan to decide what's best for your business."})]}),(0,p.jsx)("div",{className:"tw-bg-white tw-rounded-2xl tw-shadow-lg tw-border tw-border-solid tw-border-slate-100 tw-overflow-hidden",children:(0,p.jsx)("div",{className:"tw-overflow-x-auto",children:(0,p.jsxs)("table",{className:"tw-w-full",style:{minWidth:"700px",borderCollapse:"collapse"},children:[(0,p.jsx)("thead",{children:(0,p.jsxs)("tr",{style:{backgroundColor:"#dbe1f4"},children:[(0,p.jsx)("th",{className:"tw-text-left tw-py-5 tw-px-6",children:(0,p.jsxs)("div",{className:"tw-text-xl tw-font-bold tw-text-secondary tw-uppercase tw-tracking-wider",children:["28-Day Free"," ",(0,p.jsx)("span",{className:"tw-text-purple-600 tw-font-bold",children:"Scale"})," ","Trial"]})}),Object.entries(y).map(e=>{let t=(0,n.A)(e,2),s=t[0],i=t[1];return(0,p.jsxs)("th",{className:"tw-py-5 tw-px-4 tw-text-center",children:[(0,p.jsx)("div",{className:(0,m.cn)("tw-font-black tw-text-2xl lg:tw-text-3xl",i.colorText),children:i.name}),(0,p.jsxs)("div",{className:"tw-text-base tw-font-semibold tw-mt-0.5",style:{color:"#1E2D50"},children:[i.monthlyPrice,"/mo + ",i.labelPrice,"/label"]})]},s)})]})}),(0,p.jsx)("tbody",{children:Object.entries(g).map(e=>{let t=(0,n.A)(e,2),s=t[0],l=t[1];return(0,p.jsxs)(i.Fragment,{children:[(0,p.jsx)("tr",{children:(0,p.jsx)("td",{colSpan:5,className:"tw-py-3 tw-px-6 tw-text-base tw-font-black tw-text-secondary tw-uppercase tw-tracking-wider",style:{backgroundColor:"#EEF1FA"},children:s})}),Object.entries(l).map(e=>{let t=(0,n.A)(e,2),s=t[0],i=t[1];return(0,p.jsxs)("tr",{className:"hover:tw-bg-slate-50",style:{borderBottom:"1px solid #f1f5f9"},children:[(0,p.jsx)("td",{className:"tw-py-4 tw-px-6 tw-text-base tw-font-medium tw-text-slate-600",children:s}),i.map((e,t)=>(0,p.jsx)("td",{className:"tw-py-4 tw-px-4 tw-text-center tw-text-base tw-font-bold tw-text-secondary",children:b(e)},t))]},s)})]},s)})})]})})})]})})]})}},78373(e,t,s){s.d(t,{A:()=>a});var n=s(68163),i=s(48923),l=s(63203);const a=e=>{let t=e.className,s=e.children;return(0,l.jsx)("div",{className:(0,i.cn)("tw-py-2 tw-rounded-lg tw-text-green-800 tw-px-2 tw-border tw-border-solid tw-border-green-200 tw-bg-green-200",t),children:(0,l.jsxs)("div",{className:"tw-flex tw-items-center",children:[(0,l.jsx)("div",{className:"tw-mr-2",children:(0,l.jsx)(n.rAV,{className:"tw-mt-1"})}),s]})})}},72491(e,t,s){s.d(t,{K:()=>r});var n=s(98477),i=s(37643),l=(s(64419),s(6601)),a=s(63203);const o=["value","index","children"],r=e=>{let t=e.value,s=e.index,r=e.children,d=(0,i.A)(e,o);return(0,a.jsx)("div",(0,n.A)((0,n.A)({role:"tabpanel",hidden:t!==s,id:"tab-panel-".concat(s),className:"".concat(d.className||"")},d),{},{"aria-labelledby":"tab-panel-".concat(s),children:t===s&&(0,a.jsx)(l.az,{children:r})}))}},21596(e,t,s){s.d(t,{A:()=>r});var n=s(98477),i=s(64419),l=s(6601),a=s(63203);const o=e=>(0,a.jsx)(l.Kx,(0,n.A)((0,n.A)({in:!0},e),{},{timeout:1e3,children:(0,a.jsx)(l.hZ,(0,n.A)({sx:{height:"2px",backgroundColor:"#E7942F","& .MuiLinearProgress-bar":{backgroundColor:"#E7942F"}}},e))})),r=e=>t=>(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(o,{}),children:(0,a.jsx)(e,(0,n.A)({},t))})},5122(e,t,s){s.r(t),s.d(t,{default:()=>w});var n=s(98477),i=s(39698),l=s(86558),a=s(2444),o=s(78270),r=s(15955),d=s(6601),c=s(1739),u=s(82391),h=s(82458),m=s(64419),p=s(61969),v=s(63203);function w(){const e=(0,p.A)(),t=e.toastError,s=e.toastSuccess,w=(0,o.useHistory)(),x=(0,a.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),g=(0,m.useState)(!1),y=(0,i.A)(g,2),f=y[0],b=y[1],j=()=>{var e;null!==x&&void 0!==x&&x._id?null!==x&&void 0!==x&&null!==(e=x.onboarding)&&void 0!==e&&e.isCompleted?w.goBack():w.push("/onboarding-wizard"):w.push("/login")};return(0,v.jsxs)("div",{className:"tw-py-12 tw-mb-12 tw-pl-4 tw-pr-4 md:tw-pl-0 md:tw-pr-0",children:[(0,v.jsx)("div",{className:"tw-max-w-56 tw-mx-auto tw-pb-12",children:(0,v.jsx)("img",{src:u.HX,alt:"logo"})}),(0,v.jsx)(l.l1,{initialValues:{applyNow:{companyName:"",phoneNumber:"",industry:"",website:"",address:{address1:"",address2:"",city:"",state:"",country:"",zip:""}}},validationSchema:h._L,enableReinitialize:!0,onSubmit:async e=>{try{await c.Km.post("/email/apply-shipfare-plus-rates",(0,n.A)((0,n.A)({}
1,e.applyNow),{},{userId:null===x||void 0===x?void 0:x._id,isPublicRoute:!0})),b(!0),s("ShipFare Plus Rates applied successfully")}catch(l){var i;console.error(l),null!==l&&void 0!==l&&null!==(i=l.response)&&void 0!==i&&i.data&&"string"===typeof l.response.data&&t(l.response.data)}},children:e=>{let s=e.values,n=e.errors,i=e.setFieldValue,a=e.isSubmitting,o=e.submitForm;return(0,v.jsx)(l.lV,{className:"tw-max-w-2xl tw-mx-auto tw-w-full",children:f?(0,v.jsx)(v.Fragment,{children:(0,v.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:[(0,v.jsxs)(d.Zp,{className:"tw-max-w-2xl tw-mx-auto tw-w-full !tw-gap-0 tw-text-center","data-cy":"apply-shipfare-plus-card",children:[(0,v.jsx)("div",{className:"tw-text-5xl",children:"\ud83d\ude0e"}),(0,v.jsx)("div",{className:"tw-text-3xl tw-font-medium tw-text-secondary tw-mt-2",children:"Application Submitted!"}),(0,v.jsx)("div",{className:"tw-mt-2",children:"We sent your information over to the carriers and will let you know if approved within 1-2 business days. Please continue onboarding!"})]}),(0,v.jsx)("div",{className:"tw-max-w-2xl tw-mx-auto tw-w-full tw-mt-4",children:(0,v.jsx)(d.$n,{onClick:j,children:"Back"})})]})}):(0,v.jsx)(r.A,{values:s,setFieldValue:i,errors:n,user:x,isPublic:!0,toastError:t,onBack:j,renderActions:()=>(0,v.jsxs)("div",{className:"tw-flex tw-items-center tw-pt-0 tw-justify-between",children:[(0,v.jsx)(d.$n,{onClick:j,children:"Back"}),(0,v.jsx)(d.$n,{type:"submit",variant:"contained",color:"secondary",disabled:a,onClick:o,children:a?"Applying...":"Apply"})]})})})}})]})}},15634(e,t,s){s.r(t),s.d(t,{default:()=>p});var n=s(39698),i=s(64419),l=s(78270),a=s(2444),o=s(6601),r=s(1739),d=s(82391),c=s(20910),u=s(55948),h=s(61969),m=s(63203);const p=()=>{const e=(0,l.useHistory)(),t=(0,a.useDispatch)(),s=(0,h.A)(),p=s.toastError,v=s.toastSuccess,w=(0,i.useState)(""),x=(0,n.A)(w,2),g=x[0],y=x[1],f=(0,a.useSelector)(e=>!(!e.auth.user||!e.auth.user._id)),b=(0,a.useSelector)(e=>e.auth.squareAuthInProgress);(0,i.useEffect)(()=>{document.title="Validate Square Token - ShipFare"},[]);return(0,i.useEffect)(()=>{b||(async()=>{const s=(0,c.Ay)({history:e});if(f)await(async s=>{try{var n;const e={code:s.code,userAgent:window.navigator.userAgent},i=await r.Km.post("/private-app/square/accessToken",e);null!==i&&void 0!==i&&null!==(n=i.data)&&void 0!==n&&n._id&&(0,a.vA)(()=>{t((0,u.QO)({user:i.data})),v("Square Store added successfully")});const l=window.location.origin;window.location.href=l}catch(h){var i,l,o,d,c;console.log(h),y(null!==(i=null===h||void 0===h||null===(l=h.response)||void 0===l||null===(o=l.data)||void 0===o?void 0:o.message)&&void 0!==i?i:"Something went wrong"),null!==h&&void 0!==h&&null!==(d=h.response)&&void 0!==d&&d.data&&p(null===h||void 0===h||null===(c=h.response)||void 0===c?void 0:c.data),e.push("/dashboard")}})(s);else{if(localStorage.getItem(d.cb))window.location.href=d.GG;else{const e="".concat(d.GG,"/register");localStorage.setItem(d.cb,"".concat(window.location.href,"&isSquareIntegration=true")),window.location.href=e}}(0,u.lB)({squareAuthInProgress:!1})})()},[]),null!==g&&void 0!==g&&g.length?(0,m.jsx)(o.o5,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"calc(100vh - 200px)"},className:"tw-text-lg tw-font-bold tw-text-red-500",children:g}):(0,m.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"calc(100vh - 200px)"},children:(0,m.jsx)(o.P,{color:"primary",size:60})})}},34634(e,t,s){s.d(t,{A:()=>d});var n=s(39698),i=s(6601),l=s(64419),a=s(38935),o=s(70086),r=s(63203);function d(e){let t=e.open,s=e.onClose,d=e.onSubmit,c=e.edit,u=e.addToBatch,h=e.defaultDescription,m=e.defaultLabel,p=e.handleCancelBatch;const v=(0,l.useState)(m),w=(0,n.A)(v,2),x=w[0],g=w[1],y=(0,l.useState)(h),f=(0,n.A)(y,2),b=f[0],j=f[1],A=(0,l.useState)(null),S=(0,n.A)(A,2),C=S[0],N=S[1];(0,l.useEffect)(()=>{g(m),j(h)},[m,h]),(0,l.useEffect)(()=>{t||N(null)},[t]);return(0,r.jsx)(i.aF,{open:t,handleClose:s,title:c?"Editing Batch":u?"Add To Batch":"Create Batch",maxWidth:"xs",customWidth:"36rem",actionOverrideClasses:c||u?"!tw-justify-between":"",actions:[{label:"Delete Batch",variant:"contained",color:"error",hide:!c,onClick:()=>p()},{label:"Back",hide:!u,variant:"outlined",color:"inherit",onClick:()=>s()},{isPrimary:!0,label:c?"Save":"Create",onClick:()=>{const e={label:x,notes:b};null!==C&&void 0!==C&&C.startDate&&null!==C&&void 0!==C&&C.endDate&&(e.dateRangeStart=(0,a.Ay)(C.startDate).startOf("day").toISOString(),e.dateRangeEnd=(0,a.Ay)(C.endDate).endOf("day").toISOString()),d(e)}}],children:(0,r.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,r.jsx)(i.A_,{label:"Name",value:x,onChange:e=>g(e.target.value)}),(0,r.jsx)(i.A_,{label:"Notes",multiline:!0,minRows:4,value:b,onChange:e=>j(e.target.value)}),!c&&!u&&(0,r.jsx)("div",{children:(0,r.jsx)(o.A,{label:"Automatically add shipments with Ship By dates in this range (optional)",handleSubmit:e=>N(e),currentRange:C,showRangeText:!0,isFilterOption:!1,version:"v2",placeholder:"Select Date Range",buttonClass:"tw-max-w-64"})})]})})}},46334(e,t,s){s.d(t,{A:()=>g});var n=s(98477),i=s(39698),l=s(64419),a=s(2444),o=s(78270),r=s(55948),d=s(1739),c=s(96978),u=s(6601),h=s(58687),m=s(71715
1),p=s(82391),v=s(61969),w=s(63203);const x="stripe"===p.uj?(0,l.lazy)(()=>s.e(27).then(s.bind(s,70027))):()=>null,g=e=>{let t=e.isOpen,s=e.closeModal,g=e.onComplete,y=e.editingCard,f=void 0===y?null:y;const b=(0,l.useState)(!1),j=(0,i.A)(b,2),A=j[0],S=j[1],C=(0,l.useState)({number:"",expiry:"",cvc:"",name:"",focus:"",zip:""}),N=(0,i.A)(C,2),I=N[0],D=N[1];(0,l.useEffect)(()=>{null!==f&&void 0!==f&&f.id&&D({number:"************".concat(f.last4),expiry:"".concat(f.expiry_month,"/").concat(f.expiry_year.toString().substring(2)),cvc:"***",name:"*******",focus:"expiry",zip:"*****"})},[null===f||void 0===f?void 0:f.id]);const k=(0,a.useDispatch)(),P=(0,v.A)(),E=P.toastError,R=P.toastSuccess,T=(0,o.useHistory)(),F=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{let t;if(S(!0),null!==f&&void 0!==f&&f.id){const s=await d.Km.post("/payments/update-card",(0,n.A)((0,n.A)({},I),{},{id:f.id,token:e}));t=s.data}else{const s=await(0,h.A)({action:m.oZ}),i=await d.Km.post("/payments/add-card",(0,n.A)((0,n.A)({},I),{},{token:e}),{headers:{"X-Recaptcha":s.token}});t=i.data}(0,a.vA)(()=>{k((0,r.QO)({user:t.user})),R(t.message)}),S(!1),s(),g&&g()}catch(t){S(!1),(0,a.vA)(()=>{var e,s,n,i,l,a,o;E((null===t||void 0===t||null===(e=t.response)||void 0===e||null===(s=e.data)||void 0===s?void 0:s.message)||(null===t||void 0===t||null===(n=t.response)||void 0===n?void 0:n.data)||(null===t||void 0===t?void 0:t.message)||"Something Went Wrong"),null!==t&&void 0!==t&&null!==(i=t.response)&&void 0!==i&&null!==(l=i.data)&&void 0!==l&&l.user&&k((0,r.QO)({user:t.response.data.user})),null!==t&&void 0!==t&&null!==(a=t.response)&&void 0!==a&&null!==(o=a.data)&&void 0!==o&&o.redirect&&T.push("/dashboard")})}};return(0,w.jsx)(u.aF,{open:t,title:null!==f&&void 0!==f&&f.id?"Update Card":"Add New Card",handleClose:A?()=>{}:s,actions:[{isClose:!0},{isPrimary:!0,onClick:()=>F(),label:null!==f&&void 0!==f&&f.id?"Update Card":"Add Card",disabled:A||!(null!==I&&void 0!==I&&I.name)||!(null!==I&&void 0!==I&&I.number)||!(null!==I&&void 0!==I&&I.cvc)||!(null!==I&&void 0!==I&&I.expiry),loading:A}
1],hideActions:"stripe"===p.uj,children:(0,w.jsx)("div",{style:{padding:"20px 0px"},children:"stripe"===p.uj?t?(0,w.jsx)(l.Suspense,{fallback:null,children:(0,w.jsx)(x,{handleSubmit:F,handleClose:s,loading:A})}):null:(0,w.jsx)(c.A,{card:I,setCard:D,submitting:A,editingCard:f})})})}},96978(e,t,s){s.d(t,{A:()=>o});var n=s(98477),i=s(6601),l=(s(64419),s(81544)),a=(s(2691),s(63203));const o=e=>{let t=e.card,s=e.setCard,o=e.submitting,r=e.editingCard;const d=e=>{const t=e.replace(/\D+/g,"");return t.length>=3?"".concat(t.slice(0,2),"/").concat(t.slice(2,4)):t},c=e=>{const t=e.target,i=t.name,l=t.value;s("number"===i||"cvc"===i?e=>(0,n.A)((0,n.A)({},e),{},{[i]:l.replace(/\D+/g,"")}):"expiry"===i?e=>(0,n.A)((0,n.A)({},e),{},{[i]:d(l)}):e=>(0,n.A)((0,n.A)({},e),{},{[i]:l}))},u=e=>{s(t=>(0,n.A)((0,n.A)({},t),{},{focus:e.target.name}))};return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{children:(0,a.jsx)(l.A,{number:t.number,expiry:t.expiry,cvc:t.cvc,name:t.name,focused:t.focus})}),(0,a.jsxs)("div",{className:"tw-grid lg:tw-grid-cols-2 tw-gap-4 tw-mt-8",children:[(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsxs)("label",{htmlFor:"name",className:"tw-text-sm",children:["Name",(0,a.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,a.jsx)(i.A_,{name:"name",placeholder:"Name on Card",variant:"outlined",size:"small",value:null===t||void 0===t?void 0:t.name,disabled:o||!(null===r||void 0===r||!r.id),onChange:c,onFocus:u})]}),(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsxs)("label",{htmlFor:"name",className:"tw-text-sm",children:["Card Number",(0,a.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,a.jsx)(i.A_,{type:"tel",name:"number",placeholder:"Card Number",variant:"outlined",size:"small",value:null===t||void 0===t?void 0:t.number,disabled:o||!(null===r||void 0===r||!r.id),onChange:c,onFocus:u,maxLength:16})]})]}),(0,a.jsxs)("div",{className:"tw-grid lg:tw-grid-cols-3 tw-gap-4 tw-mt-4",children:[(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsxs)("label",{htmlFor:"name",className:"tw-text-sm",children:["Valid Through",(0,a.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,a.jsx)(i.A_,{name:"expiry",type:"tel",placeholder:"Expiration Date",variant:"outlined",size:"small",value:null===t||void 0===t?void 0:t.expiry,disabled:o,onChange:c,onFocus:u})]}),(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsxs)("label",{htmlFor:"name",className:"tw-text-sm",children:["CVS",(0,a.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,a.jsx)(i.A_,{type:"tel",name:"cvc",placeholder:"CVS",variant:"outlined",size:"small",value:null===t||void 0===t?void 0:t.cvc,disabled:o||!(null===r||void 0===r||!r.id),onChange:c,onFocus:u})]}),(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsx)("label",{htmlFor:"name",className:"tw-text-sm",children:"Postal Code"}),(0,a.jsx)(i.A_,{name:"zip",placeholder:"Zip code",variant:"outlined",size:"small",value:null===t||void 0===t?void 0:t.zip,disabled:o||!(null===r||void 0===r||!r.id),onChange:c,onFocus:u})]})]})]})}},92810(e,t,s){s.d(t,{A:()=>z});var n=s(98477),i=s(39698),l=s(64419),a=s(2444),o=s(11841),r=s(29254),d=s(6601),c=s(41501),u=s(79626),h=s(20574),m=s(55948),p=s(54917),v=s(37348),w=s(32200),x=s(67163),g=s(82458),y=s(71551),f=s(33240),b=s(11506),j=s(75320),A=s(34745),S=s(40859),C=s(2532),N=s(13599),I=s(29425),D=s(1739),k=s(71889),P=s(307),E=s(49883),R=s(56795),T=s(50500);const F="dryIceTermsConfirmedSession";var O=s(61969),_=s(63203);const B=e=>{var t,s,o;let r=e.values,h=e.errors,m=e.setFieldValue,p=e.setValues;const v=(0,l.useState)(!1),w=(0,i.A)(v,2),x=w[0],g=w[1],y=(0,a.useSelector)(e=>{var t,s,n,i,l,a,o,r,d,c;return!(null===e||void 0===e||null===(t=e.auth)||void 0===t||null===(s=t.easypostCarrierAccounts)||void 0===s||!s.find(e=>"FedexAccount"===(null===e||void 0===e?void 0:e.type)))||!(null===e||void 0===e||null===(n=e.auth)||void 0===n||null===(i=n.user)||void 0===i||null===(l=i.vndrRatesConfig)||void 0===l||null===(a=l.fedex)||void 0===a||!a.active||null===e||void 0===e||null===(o=e.auth)||void 0===o||null===(r=o.user)||void 0===r||null===(d=r.vndrRatesConfig)||void 0===d||null===(c=d.fedex)||void 0===c||!c.allowed)});(0,l.useEffect)(()=>{f()},[r.dimensions.length,r.dimensions.width,r.dimensions.height]);const f=()=>{if(r.weight.manualWeight)return;
1const e=r.dimensions,t=e.length,s=e.width,n=e.height;m("weight.value",parseFloat((2*(t*s+t*n+n*s)*.00126).toFixed(2)))},C=(e,t,s)=>{s("dimensions[".concat(e,"]"),parseFloat(t)),s("weight.manualWeight",!1)},N=(()=>{const e=[];return y&&e.push(...j.ib.map(e=>({label:e.name,value:e.id,boxValues:e,group:"FedEx Standard Boxes"}))),e})();return(0,_.jsxs)("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4",children:[(0,_.jsxs)("div",{className:"input-group",children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm",children:["Enter Outer Dimensions (in)",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]})}),(0,_.jsx)(d.fE,{fullWidth:!0,className:"tw-max-w-full",showDimensionUnit:!1,error:S.UU[null===h||void 0===h||null===(t=h.dimensions)||void 0===t?void 0:t.length]||S.UU[null===h||void 0===h||null===(s=h.dimensions)||void 0===s?void 0:s.width]||S.UU[null===h||void 0===h||null===(o=h.dimensions)||void 0===o?void 0:o.height]?"Dimension is required":null,lengthProps:{name:"values.dimensions.length",value:r.dimensions.length,"data-cy":"new-box-outer-dimensions-length",max:(0,A.i2)(r.dimensions.units),validate:(0,A.u8)(r.dimensions.units),onChange:e=>C("length",e,m)},widthProps:{name:"values.dimensions.width",value:r.dimensions.width,"data-cy":"new-box-outer-dimensions-width",max:(0,A.i2)(r.dimensions.units),validate:(0,A.u8)(r.dimensions.units),onChange:e=>C("width",e,m)},heightProps:{name:"values.dimensions.height",value:r.dimensions.height,"data-cy":"new-box-outer-dimensions-height",max:(0,A.i2)(r.dimensions.units),validate:(0,A.u8)(r.dimensions.units),onChange:e=>C("height",e,m)}})]}),(0,_.jsxs)("div",{className:"input-group",children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm tw-mt-2",children:["Estimated Weight",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"}),(0,_.jsx)(T.A,{information:R.A.BOX_OUTER_EST_WEIGHT})]})}),(0,_.jsx)(d.rs,{inputProps:{name:"values.weight.value",value:(()=>{if(!(0,A.gf)(r.weight.value))return"";return(0,I.v)({from:r.weight.units,value:parseFloat(r.weight.value||0)})[b.Ay.POUNDS]||0})(),max:(0,A.k0)(r.weight.units),validate:(0,A.mD)(r.weight.units),error:x?(0,A.mD)(r.weight.units)(r.weight.value):null,onBlur:()=>g(!0),onChange:e=>{g(!0),m("weight.value",parseFloat(e)),m("weight.manualWeight",!0)}},weightUnitProps:{name:"values.weight.units",value:b.Ob[b.Ay.POUNDS]}}),x&&(0,A.mD)(r.weight.units)(r.weight.value)&&(0,_.jsx)("p",{className:"tw-p-0 tw-m-0 tw-text-red-600 tw-text-sm",children:(0,A.mD)(r.weight.units)(r.weight.value)})]}),N.length?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"tw-grid tw-place-items-center tw-font-bold tw-flex-1",children:"Or"}),(0,_.jsx)("div",{className:"tw-grid tw-place-items-center tw-flex-1",children:(0,_.jsx)(c.l6,{placeholder:"Box",value:null===r||void 0===r?void 0:r.preDefinedBox,name:"preselect_box",isClearable:!0,options:N,onChange:e=>{var t,s;if(!e)return void m("preDefinedBox",null);const i=(0,n.A)((0,n.A)({},r),{},{name:e.label,dimensions:(0,n.A)((0,n.A)({},r.dimensions),null===(t=e.boxValues)||void 0===t?void 0:t.dimensions),internalDimensions:(0,n.A)((0,n.A)({},r.internalDimensions),{},{manualDimensions:!1}),weight:(0,n.A)((0,n.A)((0,n.A)({},r.weight),null===(s=e.boxValues)||void 0===s?void 0:s.weight),{},{manualWeight:!0}),preDefinedBox:e});p(i)}})})]}):null]})},U=e=>{let t=e.values,s=e.setFieldValue;(0,l.useEffect)(()=>{n()},[t.liner.thickness,t.liner.sku]);const n=()=>
1{if(t.liner.dimensions.weight.manualWeight)return;const e=t.dimensions,n=e.length,i=e.width,l=e.height,a=parseFloat(t.liner.dimensions.width);if(isNaN(a))return;const o=2*(n*i+n*l+i*l)*a,r=C.B8[t.liner.sku];s("liner.dimensions.weight.value",Number((o*r).toFixed(2)))},a=(e,t,s)=>{if("linerType"===e&&(s("liner.sku",t),s("liner.title",C.Ke[t])),"linerThickness"===e){s("liner.thickness",t);const e="N/A"!==t?parseFloat(t.replace("in","")):0;s("liner.dimensions.length",e),s("liner.dimensions.width",e),s("liner.dimensions.height",e),s("internalDimensions.manualDimensions",!1)}s("liner.dimensions.weight.manualWeight",!1)};return(0,_.jsxs)("section",{children:[(0,_.jsxs)("div",{className:"tw-text-center tw-space-x-4",children:[(0,_.jsx)(d.$n,{className:t.hasLiner?"!tw-bg-secondary !tw-text-white":"!tw-border-secondary",onClick:()=>s("hasLiner",!0),children:"Liner"}),(0,_.jsx)(d.$n,{className:t.hasLiner?"!tw-border-secondary":"!tw-bg-secondary !tw-text-white",onClick:()=>{s("hasLiner",!1),s("liner.dimensions.weight.value",parseFloat(t.liner.dimensions.weight.value)||0)},children:"No Liner"})]}),(0,_.jsxs)(d.SD,{in:t.hasLiner,className:"tw-mt-4",children:[(0,_.jsxs)("div",{className:"input-group",children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm !tw-inline",children:["What type of insulating liner do you use for this box?",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]})}),(0,_.jsx)(d.B0,{name:"liner.sku",wrapperClass:"tw-flex-1",className:"tw-max-w-32",component:v.A,isTouchedByDefault:!0,onChange:e=>{a("linerType",e,s)},options:Object.entries(C.Ke).map(e=>{let t=(0,i.A)(e,2),s=t[0];return{label:t[1],value:s}})})]}),(0,_.jsxs)("div",{className:"input-group",children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm tw-mt-4",children:["Liner thickness?",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]})}),(0,_.jsx)(d.B0,{name:"liner.thickness",wrapperClass:"tw-flex-1",className:"tw-max-w-32",component:v.A,isTouchedByDefault:!0,onChange:e=>{a("linerThickness",e,s)},options:C.tt.map(e=>({label:e,value:e}))})]}),(0,_.jsxs)("div",{className:"input-group",children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm tw-mt-4",children:["Estimated Weight",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"}),(0,_.jsx)(T.A,{information:R.A.BOX_LINER_EST_WEIGHT})]})}),(0,_.jsx)(d.rs,{className:"",error:t.hasLiner?(0,A.mD)(t.weight.units)(t.liner.dimensions.weight.value):null,inputProps:{name:"values.liner.dimensions.weight.value",value:t.liner.dimensions.weight.value,max:(0,A.k0)(t.weight.units),validate:(0,A.mD)(t.weight.units),onChange:e=>{s("liner.dimensions.weight.value",parseFloat(e)),s("liner.dimensions.weight.manualWeight",!0)}},weightUnitProps:{name:"values.liner.dimensions.weight.units",value:b.Ob[t.weight.units]}})]})]})]})},L=e=>{let t=e.values,s=e.isSubmitting,a=e.setFieldValue;const o=(()=>{const e=(0,l.useState)(0),t=(0,i.A)(e,2)[1];return{hasConfirmedThisSession:"true"===sessionStorage.getItem(F),markConfirmed:(0,l.useCallback)(()=>{sessionStorage.setItem(F,"true"),t(e=>e+1)},[])}})(),r=o.hasConfirmedThisSession,c=o.markConfirmed,h=(0,l.useState)(!1),m=(0,i.A)(h,2),g=m[0],y=m[1],j=(0,l.useState)(t.coolant.dimensions.weight.value),S=(0,i.A)(j,2),C=S[0],D=S[1];(0,l.useEffect)(()=>{D((e=>{const t=(0,I.v)({from:b.Ay.POUNDS,value:e});return(0,E.N)(parseFloat((t[b.Ay.OUNCES]||0).toFixed(2)))})(t.coolant.dimensions.weight.value))},[]);return(0,_.jsxs)("section",{children:[(0,_.jsxs)("div",{className:"tw-text-center tw-space-x-4",children:[(0,_.jsx)(d.$n,{className:t.hasDryIce?"!tw-bg-secondary !tw-text-white":"!tw-border-secondary",onClick:()=>{r?(a("hasDryIce",!0),a("hasIcePack",!1)):y(!0)},children:"Dry Ice"}),(0,_.jsx)(d.$n,{className:t.hasIcePack?"!tw-bg-secondary !tw-text-white":"!tw-border-secondary",onClick:()=>{a("hasIcePack",!0),a("hasDryIce",!1)},children:"Ice Packs"}),(0,_.jsx)(d.$n,{className:"tw-mt-2 md:tw-mt-0 ".concat(t.hasDryIce||t.hasIcePack?"!tw-border-secondary":"!tw-bg-secondary !tw-text-white"),onClick:()=>{a("hasDryIce",!1),a("hasIcePack",!1)},children:"No Coolant"})]}),(0,_.jsxs)(d.SD,{in:t.hasDryIce,className:t.hasDryIce?"tw-mt-4":"",children:[(0,_.jsx)(w.A,{className:"tw-mb-4",isActive:(null===t||void 0===t?void 0:t.hasDryIce)||"dryIce"===t.coolantType,weight:null===t||void 0===t?void 0:t.dryIceWeight,unit:null===t||void 0===t?void 0:t.dryIceWeightUnit}),(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm",children:["Average Dry Ice Amount",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,_.jsx)(d.$k,{error:t.hasDryIce?(0,A.mD)(null===t||void 0===t?void 0:t.dryIceWeightUnit)(null===t||void 0===t?void 0:t.dryIceWeight):null,inputProps:{name:"dryIceWeight",onCh
1ange:e=>{a("dryIceWeight",e?parseFloat(e):"")},type:"number",disabled:s,max:(0,A.k0)(null===t||void 0===t?void 0:t.dryIceWeightUnit),validate:(0,A.mD)(null===t||void 0===t?void 0:t.dryIceWeightUnit),value:null===t||void 0===t?void 0:t.dryIceWeight},selectProps:{options:Object.values(b.Ay).map(e=>({label:b.Ob[e],value:e})),onChange:e=>{a("dryIceWeightUnit",e)},disabled:s,value:null===t||void 0===t?void 0:t.dryIceWeightUnit,name:"dryIceWeightUnit"},forDryIce:!0})]}),(0,_.jsx)(d.SD,{in:t.hasIcePack,className:t.hasIcePack?"tw-mt-4":"",children:(0,_.jsxs)("div",{className:"tw-flex tw-gap-4",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm",children:["Ice Pack Size",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]})}),(0,_.jsxs)("div",{className:"tw-mt-1",children:[(0,_.jsx)(d.B0,{name:"coolant.sku",placeholder:"Select Size",options:N.zd.map(e=>{let t=e.label;return{label:t,value:t}}),component:v.A,onChange:e=>(e=>{const s="Custom"===e?{length:0,width:0,height:0,ounces:0}:(0,N.oT)(e),i=s.length,l=s.width,o=s.height,r=s.ounces,d=(0,I.v)({from:b.Ay.OUNCES,value:r}),c=(0,n.A)((0,n.A)({},t.coolant),{},{sku:e,title:"Ice Pack - ".concat(e),dimensions:(0,n.A)((0,n.A)({},t.coolant.dimensions),{},{length:i,width:l,height:o,units:f.A.INCHES,weight:{value:parseFloat(parseFloat((d[b.Ay.POUNDS]||0).toFixed(2))),units:b.Ay.POUNDS}})});a("coolant",c)})(e),isRequired:!0}),"Custom"===t.coolant.sku&&(0,_.jsxs)("div",{className:"tw-max-w-96 tw-mt-1",children:[(0,_.jsx)(x.A,{hideLabel:!0,lengthName:"
1coolant.dimensions.length",widthName:"coolant.dimensions.width",heightName:"coolant.dimensions.height",unitsName:"coolant.dimensions.units"}),(0,_.jsx)(d.rs,{className:"tw-mt-2",error:(0,A.mD)(t.coolant.dimensions.weight.units)(C),inputProps:{name:"coolant.dimensions.weight.value",value:C,max:(0,A.k0)(t.coolant.dimensions.weight.units),validate:(0,A.mD)(t.coolant.dimensions.weight.units),onChange:e=>{const t=(0,I.v)({from:b.Ay.OUNCES,value:e});D(e),a("coolant.dimensions.weight.value",parseFloat(parseFloat((t[b.Ay.POUNDS]||0).toFixed(2))))}},weightUnitProps:{name:"coolant.dimensions.weight.units",value:b.Ob[b.Ay.OUNCES]}})]})]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm",children:["Qty",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]})}),(0,_.jsx)("div",{className:"tw-mt-1",children:(0,_.jsx)(d.D0,{name:"coolant.quantity",component:p.A,className:"tw-max-w-24",type:"number",onBlur:()=>a("coolant.quantity",parseInt(t.coolant.quantity)||1),onFocus:e=>e.target.select(),min:1,step:1})})]})]})}),(0,_.jsx)(d.aF,{open:g,title:"Dry Ice",handleClose:()=>y(!1),maxWidth:"xs",confirmationActions:!0,actions:[{isPrimary:!0,label:"Confirm",onClick:()=>{c(),a("hasDryIce",!0),a("hasIcePack",!1),y(!1)},variant:"contained",className:"!tw-bg-green-500"}],children:(0,_.jsx)(T.A,{returnTextOnly:!0,information:R.A.DRY_ICE})})]})},W=e=>{var t,s,n,a,o,r,c,m,v,w,x,g,y,j,S,C;let D=e.values,k=e.setFieldValue,P=e.setStep;const E=(0,l.useState)(!1),R=(0,i.A)(E,2),T=R[0],F=R[1];(0,l.useEffect)(()=>{O()},[]);const O=()=>{var e;if(null!==D&&void 0!==D&&null!==(e=D.internalDimensions)&&void 0!==e&&e.manualDimensions)return;const t=(parseFloat(D.dimensions.length)||0)-(D.hasLiner&&parseFloat(D.liner.dimensions.length)||0),s=(parseFloat(D.dimensions.width)||0)-(D.hasLiner&&parseFloat(D.liner.dimensions.width)||0),n=(parseFloat(D.dimensions.height)||0)-(D.hasLiner&&parseFloat(D.liner.dimensions.height)||0);k("internalDimensions.length",parseFloat(t>0?t:D.dimensions.length)),k("internalDimensions.width",parseFloat(s>0?s:D.dimensions.width)),k("internalDimensions.height",parseFloat(n>0?n:D.dimensions.height))},B=()=>{if(!D.hasDryIce&&!D.hasIcePack)return 0;if(D.hasDryIce){const e=(0,I.v)({from:D.dryIceWeightUnit,value:parseFloat(D.dryIceWeight||0)});return parseFloat((e[b.Ay.POUNDS]||0).toFixed(2))}{const e=D.coolant.dimensions.weight.value,t=(0,I.v)({from:b.Ay.POUNDS,value:parseFloat(e||0)});return parseFloat((t[b.Ay.POUNDS]||0).toFixed(2))*parseInt(D.coolant.quantity)}},U=()=>{if(!D.hasLiner)return 0;const e=(0,I.v)({from:D.liner.dimensions.weight.units,value:D.liner.dimensions.weight.value});return parseFloat((e[b.Ay.POUNDS]||0).toFixed(2))},L=()=>{const e=(0,I.v)({from:D.weight.units,value:parseFloat(D.weight.value||0)});return parseFloat((e[b.Ay.POUNDS]||0).toFixed(2))},W=(e,t)=>{k(e,parseFloat(t)),k("internalDimensions.manualDimensions",!0)};return(0,_.jsxs)("div",{className:"tw-grid tw-grid-cols-1",children:[(0,_.jsxs)("div",{className:"input-group",children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsxs)(u.J,{className:"tw-mb-1.5 tw-text-sm",children:["Box Name",(0,_.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]})}),(0,_.jsx)(d.D0,{name:"name","data-cy":"new-box-name",component:p.A,isRequired:!0})]}),(0,_.jsxs)("div",{className:"input-group tw-mt-4",children:[(0,_.jsx)("div",{className:"tw-flex tw-space-x-1 tw-items-center",children:(0,_.jsx)(u.J,{className:"tw-mb-1.5 tw-text-sm",children:"Box SKU"})}),(0,_.jsx)(d.D0,{name:"sku","data-cy":"new-box-sku",component:p.A})]}),(0,_.jsxs)("div",{className:"tw-mt-4 tw-flex tw-justify-between tw-items-center tw-gap-2",children:[(0,_.jsxs)("div",{children:["Box:"," ",(0,_.jsx)("span",{className:"tw-font-medium",children:"".concat(D.name," (").concat(L()," ").concat(b.Ob[b.Ay.POUNDS],")")})]}),(0,_.jsx)("div",{className:"tw-cursor-pointer tw-flex tw-items-center",onClick:()=>P(0),children:(0,_.jsx)(h.ff,{})})]}),(0,_.jsxs)("div",{className:"tw-mt-2 tw-flex tw-justify-between tw-items-center tw-gap-2",children:[(0,_.jsxs)("div",{children:["Outer Dimensions:"," ",(0,_.jsxs)("span",{className:"tw-font-medium",children:["".concat(D.dimensions.length,"L x ").concat(D.dimensions.width,"W x ").concat(D.dimensions.height,"H")," ",D.dimensions.units]})]}),(0,_.jsx)("div",{className:"tw-cursor-pointer tw-flex tw-items-center",onClick:()=>P(0),children:(0,_.jsx)(h.ff,{})})]}),(0,_.jsxs)("div",{className:"tw-mt-2 tw-flex tw-justify-between tw-items-center tw-gap-2",children:[(0,_.jsxs)("div",{children:["Inner Dimensions:"," ",(0,_.jsxs)("span",{className:"tw-font-medium",children:["".concat((null===D||void 0===D||null===(t=D.internalDimensions)||void 0===t?void 0:t.length)||0,"L x ").concat((null===D||void 0===D||null===(s=D.internalDimensions)||void 0===s?void 0:s.width)||0,"W x ").concat((null===D||void 0===D||null===(n=D.internalDimensions)||void 0===n?void 0:n.height)||0,"H")," ",D.dimensions.units]})]}),(0,_.jsx)("div",{className:"tw-cursor-pointer tw-flex tw-items-center",onClick:()=>F(!T),children:(0,_.jsx)(h.ff,{})})]}),T&&(0,_.jsx)("div",{className:"tw-mt-2 tw-flex tw-justify-between tw-items-center",children:(0,_.jsx)(d.fE,{fullWidth:!0,className:"tw-max-w-full",lengthProps:{name:"values.internalDimensions.length",value:null===D||void 0===D||null===(a=D.internalDimensions)||void 0===a?void 0:a.length,max:(0,A.i2)(null===D||void 0===D||null===(o=D.internalDimensions)||void 0===o?void 0:o.units),validate:(0,A.u8)(null===D||void 0===D||null===(r=D.internalDimensions)||void 0===r?void 0:r.units),onChange:e=>W("internalDimensions.length",e)},widthProps:{name:"values.internalDimensions.width",value:null!==(c=null===D||void 0===D||null===(m=D.internalDimensions)||void 0===m?void 0:m.width)&&void 0!==c?c:0,max:(0,A.i2)(null===D||void 0===D||null===(v=D.internalDimensions)||void 0===v?void 0:v.units),validate:(0,A.u8)(null===D||void 0===D||null===(w=D.internalDimensions)||void 0===w?void 0:w.units),onChange:e=>W("internalDimensions.width",e)},heightProps:{name:"values.internalDimensions.height",value:null!==(x=null===D||void 0===D||null===(g=D.internalDimensions)||void 0===g?void 0:g.height)&&void 0!==x?x:0,max:(0,A.i2)(null===D||void 0===D||null===(y=D.internalDimensions)||void 0===y?void 0:y.units),validate:(0,A.u8)(null===D||void 0===D||null===(j=D.internalDimensions)||void 0===j?void 0:j.units),onChange:e=>W("internalDimensions.height",e)},selectProps:{name:"values.internalDimensions.units",options:Object.values(f.A).map(e=>({label:e,value:e})),value:null!==(S=null===D||void 0===D||null===(C=D.internalDimensions)||void 0===C?void 0:C.units)&&void 0!==S?S:0,onChange:e=>k("internalDimensions.units",e)}})}),(0,_.jsxs)("div",{className:"tw-mt-2 tw-flex tw-justify-between tw-items-center tw-gap-2",children:[(0,_.jsxs)("div",{children:["Liner:"," ",(0,_.jsx)("span",{className:"tw-font-medium",children:"".concat(D.hasLiner?D.liner.title:"No Liner"," (").concat(U()," ").concat(b.Ob[b.Ay.POUNDS],")")})]}),(0,_.jsx)("div",{className:"tw-cursor-pointer tw-flex tw-items-center",onClick:()=>P(1),children:(0,_.jsx)(h.ff,{})})]}),(0,_.jsxs)("div",{className:"tw-mt-2 tw-flex tw-justify-between tw-items-center tw-gap-2",children:[(0,_.jsxs)("div",{children:["Coolant:"," ",(0,_.jsx)("span",{className:"tw-font-medium",children:"".concat(D.hasDryIce||D.hasIcePack?D.hasDryIce?"Dry Ice":"(".concat(D.coolant.quantity,") Ice Packs - ").concat((0,N.fU)(D.coolant.dimensions)):"No Coolant"," (").concat(B()," ").concat(b.Ob[b.Ay.POUNDS],")")})]}),(0,_.jsx)("div",{className:"tw-cursor-pointer tw-flex tw-items-center",onClick:()=>P(2),children:(0,_.jsx)(h.ff,{})})]}),(0,_.jsx)("div",{className:"tw-mt-2 tw-flex tw-justify-between tw-items-center tw-text-lg",children:(0,_.jsxs)("div",{className:"tw-font-bold",children:["Total Weight: ",parseFloat(L()+U()+B()).toFixed(2)," (",b.Ob[b.Ay.POUNDS],")"]})})]})},z=e=>{var t;let s=e.editBox,c=e.handleClose,u=e.initialValues,h=void 0===u?{}:u,p=e.active,v=e.submittingBox,w=void 0===v?e=>e:v,x=e.submittingNewBox,f=e.packageEdit,S=void 0!==f&&f,C=e.preventCreateOrUpdate,N=void 0!==C&&C,I=e.isCustomOneTime,E=void 0!==I&&I,R=e.showSaveCheckbox,T=void 0!==R&&R;const F=(0,a.useDispatch)(),z=(0,O.A)(),M=z.toastError,q=z.toastSuccess,V=(0,a.useSelector)(e=>{var t;return{user:null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}}).user,K=(0,l.useState)(0),Y=(0,i.A)(K,2),G=Y[0],H=Y[1],$=l.useRef(!1),Q=null===V||void 0===V||null===(t=V.boxes)||void 0===t?void 0:t.find(e=>e.default);(0,l.useEffect)(()=>{p&&(H(s?3:0),$.current=!1)},[p,s]);const J=l.useMemo(()=>{var e,t,i;let l=(0,n.A)({},Object.keys(h||{}).length?(0,k.cloneDeep)(h):(0,j.s$)({id:(0,o.A)(),user:V,default:!Q}));l.calculatedWeights||(l.calculatedWeights=(0,y.A)({box:l,boxDryIce:!0})),s&&("liner"in l&&"coolant"in l||(l=(0,n.A)((0,n.A)((0,n.A)({},l),(0,j.LO)()),{},{hasLiner:!1})),l.weight.manualWeight=!0,l.liner.dimensions.weight.manualWeight=!0,l.useInternalDimensions&&(l.internalDimensions.manualDimensions=!0),"dryIceWeightUnit"in l||(l.dryIceWeightUnit=b.Ay.POUNDS)),l.weightToShow||(l.weightToShow=l.weight.units);return(0,P.No)({user:V,feature:P.cc.box_packing_algo})&&(l.useInBoxPackingAlgo=!1),l.maxItemsEnabled=!!parseInt((null===(e=l)||void 0===e?void 0:e.maxItemsAllowed)||0),l.maxWeightEnabled=!!parseFloat((null===(t=l)||void 0===t||null===(i=t.weight)||void 0===i?void 0:i.maxWeightAllowed)||0),s||(l.name=""),l},[null===h||void 0===h?void 0:h.id]);if(!p)return null;const Z=e=>{let t=e.box;H(0),c({box:t})},X=e=>{var t,s,n,i,l,a;return!(0!==G||(0,A.gf)(e.dimensions.length)&&(0,A.gf)(e.dimensions.width)&&(0,A.gf)(e.dimensions.height)&&(0,A.gf)(e.weight.value))||(!(0!==G||!((0,A.u8)(e.dimensions.units)(e.dimensions.length)||(0,A.u8)(e.dimensions.units)(e.dimensions.width)||(0,A.u8)(e.dimensions.units)(e.dimensions.height)||(0,A.mD)(e.weight.units)(e.weight.value)))||(!(1!==G||!e.hasLiner||(0,A.gf)(e.liner.dimensions.weight.value)&&!(0,A.mD)(e.weight.units)(e.liner.dimensions.weight.value))||(!(2!==G||!(e.hasIcePack&&!e.coolant.sku||e.hasDryIce&&(!parseFloat(e.dryIceWeight)||(0,A.mD)(null===e||void 0===e?void 0:e.dryIceWeightUnit)(null===e||void 0===e?void 0:e.dryIceWeight))))||(!(2!==G||!e.hasIcePack||(0,A.gf)(e.coolant.dimensions.length)&&(0,A.gf)(e.coolant.dimensions.width)&&(0,A.gf)(e.coolant.dimensions.height))||(!(3!==G||(0,A.gf)(null===e||void 0===e||null===(t=e.internalDimensions)||void 0===t?void 0:t.length)&&(0,A.gf)(null===e||void 0===e||null===(s=e.internalDimensions)||void 0===s?void 0:s.width)&&(0,A.gf)(null===e||void 0===e||null===(n=e.internalDimensions)||void 0===n?void 0:n.height))||(3===G&&(!parseFloat(null===e||void 0===e||null===(i=e.internalDimensions)||void 0===i?void 0:i.length)>0||!parseFloat(null===e||void 0===e||null===(l=e.internalDimensions)||void 0===l?void 0:l.width)>0||!parseFloat(null===e||void 0===e||null===(a=e.internalDimensions)||void 0===a?void 0:a.height)>0)||3===G&&!e.name))))))},ee=E&&!T?"Custom One Time Box - ":"",te={0:"".concat(ee,"Outer Box"),1:"".concat(ee,"Liner"),2:"".concat(ee,"Coolant"),3:"".concat(ee,"Box Summary")}
1,se={0:e=>{let t=e.values,s=e.errors,n=e.setFieldValue,i=e.setValues,l=e.isSubmitting;return(0,_.jsx)(B,{values:t,errors:s,setFieldValue:n,setValues:i,isSubmitting:l})},1:e=>{let t=e.values,s=e.setFieldValue,n=e.isSubmitting;return(0,_.jsx)(U,{values:t,setFieldValue:s,isSubmitting:n})},2:e=>{let t=e.values,s=e.setFieldValue,n=e.isSubmitting;return(0,_.jsx)(L,{values:t,setFieldValue:s,isSubmitting:n,user:V})},3:e=>{let t=e.values,s=e.setFieldValue,n=e.setStep;return(0,_.jsx)(W,{values:t,setFieldValue:s,setStep:n})}};return(0,_.jsx)(d.ZL,{children:(0,_.jsx)(d.l1,{enableReinitialize:!0,validationSchema:g.fB,initialValues:J,onSubmit:async(e,t)=>{let i=t.setSubmitting,l=t.resetForm;try{i(!0),w(!0);const t=(0,n.A)((0,n.A)({},e),{},{cost:parseFloat(100*e.cost),maxItemsAllowed:e.maxItemsEnabled&&parseInt(e.maxItemsAllowed)||0,useInternalDimensions:!0,dimensions:(0,n.A)((0,n.A)({},e.dimensions),{},{length:parseFloat(e.dimensions.length)||0,width:parseFloat(e.dimensions.width)||0,height:parseFloat(e.dimensions.height)||0,volume:parseFloat((0,r.floatToTwo)(e.dimensions.length*e.dimensions.width*e.dimensions.height))}),internalDimensions:{length:parseFloat(e.internalDimensions.length)||0,width:parseFloat(e.internalDimensions.width)||0,height:parseFloat(e.internalDimensions.height)||0,units:e.internalDimensions.units,volume:parseFloat((0,r.floatToTwo)(e.internalDimensions.length*e.internalDimensions.width*e.internalDimensions.height))},weight:(0,n.A)((0,n.A)({},e.weight),{},{maxWeightAllowed:e.maxWeightEnabled&&parseFloat(e.weight.maxWeightAllowed)||0}),liner:(0,n.A)((0,n.A)({},e.liner),{},{quantity:parseInt(e.liner.quantity),dimensions:(0,n.A)((0,n.A)({},e.liner.dimensions),{},{length:parseFloat(e.liner.dimensions.length),width:parseFloat(e.liner.dimensions.width),height:parseFloat(e.liner.dimensions.height),weight:{value:parseFloat(e.liner.dimensions.weight.value),units:e.liner.dimensions.weight.units}})}),coolant:(0,n.A)((0,n.A)({},e.coolant),{},{quantity:parseInt(e.coolant.quantity),dimensions:(0,n.A)((0,n.A)({},e.coolant.dimensions),{},{length:parseFloat(e.coolant.dimensions.length),width:parseFloat(e.coolant.dimensions.width),height:parseFloat(e.coolant.dimensions.height),weight:{value:parseFloat(e.coolant.dimensions.weight.value),units:e.coolant.dimensions.weight.units}})})}),d=[];delete t.maxItemsEnabled,delete t.maxWeightEnabled,delete t.preDefinedBox,t.hasLiner&&d.push(t.liner),t.hasIcePack&&d.push(t.coolant);const c={active:t.hasDryIce,weight:t.dryIceWeight,unit:t.dryIceWeightUnit};t.calculatedWeights=(0,y.A)({box:t,packagings:d,dryIce:c});const u=T?!$.current:N;let h,p;if(!u){if(s&&null!==s&&void 0!==s&&s.isExistingBox){const e=(await D.Km.patch("/box/".concat(t.id),t)).data;h=e.user,p=e.message}else{const e=(await D.Km.post("/box/new",{box:t})).data;h=e.user,p=e.message}F((0,m.QO)({user:h})),q(p)}if(i(!1),l(),S)if(u)Z({box:(0,n.A)((0,n.A)({},t),{},{isCustom:!0})});else{var a,o;const e=null===(a=h)||void 0===a||null===(o=a.boxes)||void 0===o?void 0:o.find(e=>e.name===t.name);Z({box:null!==e&&void 0!==e?e:t})}else Z({box:null});w(!1)}catch(h){var d,c,u;console.log((null===h||void 0===h?void 0:h.response)||h),i(!1),w(!1),M((null===h||void 0===h||null===(d=h.response)||void 0===d||null===(c=d.data)||void 0===c?void 0:c.message)||(null===h||void 0===h||null===(u=h.response)||void 0===u?void 0:u.data)||(null===h||void 0===h?void 0:h.message))}},children:e=>{let t=e.isSubmitting,s=e.submitForm,i=e.values,l=e.errors,a=e.setFieldValue,r=e.setValues;return(0,_.jsx)(d.lV,{children:(0,_.jsx)(d.aF,{open:p,title:te[G],paperStyle:{maxWidth:500},handleClose:t||x?()=>{}:()=>Z({box:null!==i&&void 0!==i&&i.isExistingBox?null:(0,n.A)((0,n.A)({},i),{},{id:(0,o.A)()})}),actions:[{label:"Back",onClick:()=>H(G-1),disabled:t,variant:"outlined","data-cy":"new-box-back-button",wrapperClassName:"tw-mr-auto",color:"inherit",hide:0===G},...T?[{label:"Use Once",variant:"contained",color:"secondary",onClick:()=>{$.current=!1,s()},"data-cy":"new-box-use-once-button",disabled:t||x||X(i),hide:3!==G}]:[],{isPrimary:!0,onClick:T?()=>{$.current=!0,s()}:s,label:T?"Save Box":"Save","data-cy":"new-box-save-button",disabled:t||x||X(i),loading:t||x,hide:3!==G},{label:"Next",variant:"contained","data-cy":"new-box-next-button",onClick:()=>{H(G+1)},disabled:t||X(i),hide:3===G}],children:se[G]({values:i,errors:l,setFieldValue:a,isSubmitting:t,submitForm:s,setValues:r,setStep:H})})})}})})}},23750(e,t,s){s.d(t,{A:()=>P});var n=s(98477),i=s(39698),l=s(64419),a=s(2444),o=s(6601),r=s(68163),d=s(54917),c=s(1739),u=s(55948),h=s(81926),m=s(82458),p=s(72491),v=s(50732),w=s(37348),x=s(94023),g=s(48923),y=s(48057),f=s(75732),b=s(23061),j=s(57043),A=s(59782),S=s(44663),C=s(5923),N=(s(84289),s(93359),s(82391)),I=s(63203);A.EA.workerSrc="".concat(N.nv,"/Assets/react-pdf-worker-5.3.93.min.mjs");const D=e=>{let t=e.pdfUrl,s=e.handleChecked,n=e.label;const a=(0,l.useState)(null),r=(0,i.A)(a,2),d=r[0],c=r[1],u=(0,l.useState)(!1),h=(0,i.A)(u,2),m=h[0],p=h[1],v=(0,l.useState)(!1),w=(0,i.A)(v,2),x=w[0],g=w[1],y=(0,l.useState)(!0),f=(0,i.A)(y,2),b=f[0],j=f[1],A=(0,l.useRef)(null);return(0,I.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,I.jsx)("div",{ref:A,style:{height:700,overflowY:"scroll",border:"1px solid #ccc"},onScroll:()=>{if(A.current&&!m){const e=A.current;e.scrollTop+e.clientHeight>=e.scrollHeight-5&&p(!0)}},children:(0,I.jsx)(S.A,{file:t,onLoadSuccess:function(e){let t=e.numPages;c(t),j(!1)},children:b?(0,I.jsx)(o.P,{}):Array.from(new Array(d),(e,t)=>(0,I.jsx)(C.A,{pageNumber:t+1,className:"tw-flex tw-justify-center",scale:2},"page_".concat(t+1)))})}),!b&&(0,I.jsx)(o.Sc,{color:"primary",checked:x,onChange:()=>{g(!x),null===s||void 0===s||s(!x)},label:n||"I accept the terms and conditions",disabled:!m,fullWidth:!1,labelPlacement:"end"})]})};var k=s(61969);const P=e=>{let t=e.active,s=e.handleClose,A=e.onComplete,S=e.user,C=e.carrierAccounts;const P=(0,l.useRef)(),E=(0,a.useDispatch)(),R=(0,k.A)(),T=R.toastError,F=R.toastSuccess,O=(0,l.useState)(null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration?"eula":""),_=(0,i.A)(O,2),B=_[0],U=_[1],L=(0,l.useState)([]),W=(0,i.A)(L,2),z=W[0],M=W[1],q=(0,l.useState)([]),V=(0,i.A)(q,2),K=V[0],Y=V[1],G=(0,l.useState)(""),H=(0,i.A)(G,2),$=H[0],Q=H[1],J=(0,l.useState)({}),Z=(0,i.A)(J,2),X=Z[0],ee=Z[1],te=(0,l.useState)(!1),se=(0,i.A)(te,2),ne=se[0],ie=se[1],le=(0,l.useState)(!1),ae=(0,i.A)(le,2),oe=ae[0],re=ae[1],de=(0,l.useState)(!1),ce=(0,i.A)(de,2),ue=ce[0],he=ce[1],me=(0,l.useState)(!1),pe=(0,i.A)(me,2),ve=pe[0],we=pe[1];let xe={type:h.Ay.fedex,description:"",accountNumber:"",shippingStreet:"",shippingCity:"",shippingState:"",shippingZipCode:"",shippingCountry:"US",corporateFirstName:"",corporateLastName:"",corporateJobTitle:"",corporateCompanyName:(null===S||void 0===S?void 0:S.companyName)||"",corporatePhone:"",corporateEmail:"",corporateStreet:"",corporateCity:"",corporateState:"",corporateZipCode:"",corporateCountry:"US"};null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration&&(xe={type:h.Ay.fedex,description:"",accountNumber:"",name:(null===S||void 0===S?void 0:S.companyName)||(null===S||void 0===S?void 0:S.name)||"",street:"",city:"",state:"",zipCode:"",country:"US",validationStep:"address"},"oauth"===B&&(xe=(0,n.A)({invoiceNumber:"",invoiceCurrency:"USD",invoiceDate:"",invoiceAmount:"","2faOption":"EMAIL",validationType:0,validationStep:"pinGeneration"},X)),"pinInput"===B&&(xe=(0,n.A)((0,n.A)({},X),{},{validationStep:"pin"})));const ge=()=>{var e;s(),U(null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration?"eula":""),M([]),Y([]),Q(""),ee({}),re(!1),ie(!1),he(!1),we(!1),null!==P&&void 0!==P&&null!==(e=P.current)&&void 0!==e&&e.resetForm&&P.current.resetForm()},ye=e=>{let t=e.isSubmitting,s=e.setFieldValue,n=e.values;const i=[{label:"Select State",value:null},...(()=>{var e;return(null===(e=y.Ay[(null===n||void 0===n?void 0:n.corporateCountry)||"US"])||void 0===e?void 0:e.map(e=>({label:e.name,value:e.abbreviation})))||[]})()],l=[{label:"Select State",value:null},...(()=>{var e;return(null===(e=y.Ay[(null===n||void 0===n?void 0:n.shippingCountry)||"US"])||void 0===e?void 0:e.map(e=>({label:e.name,value:e.abbreviation})))||[]})()];return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:(0,g.cn)("tw-grid tw-gri
1d-cols-1 md:tw-grid-cols-2 tw-gap-4",ne&&"md:tw-grid-cols-4"),children:[(0,I.jsx)(o.D0,{component:d.A,name:"accountNumber",label:"FedEx Account Number",required:!0,autoCapitalize:"off",disabled:t,isRequired:!0,placeholder:"123456789"}),(0,I.jsx)(o.D0,{component:d.A,name:"description",label:"Account Nickname",autoCapitalize:"off",disabled:t,isRequired:!0})]}),(0,I.jsxs)("div",{className:(0,g.cn)("tw-grid tw-grid-cols-1 tw-gap-4 tw-mt-4",ne&&"md:tw-grid-cols-2 lg:tw-gap-8"),children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:"tw-text-lg tw-font-medium tw-text-secondary",children:"Company Information"}),(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,I.jsx)(o.D0,{component:d.A,name:"corporateFirstName",label:"First Name",autoCapitalize:"off",disabled:t,placeholder:"John",isRequired:!0,autoComplete:"company"}),(0,I.jsx)(o.D0,{component:d.A,name:"corporateLastName",label:"Last Name",autoCapitalize:"off",disabled:t,placeholder:"Doe",isRequired:!0}),(0,I.jsx)(o.D0,{component:d.A,name:"corporateJobTitle",label:"Job Title",autoCapitalize:"off",disabled:t,placeholder:"Mr. Manager",isRequired:!0}),(0,I.jsx)(o.D0,{name:"corporatePhone",label:"Phone",component:j.Ay,autoCapitalize:"off",disabled:t,placeholder:"123-123-1234",isRequired:!0,autoComplete:"phone"})]}),(0,I.jsx)("div",{className:"tw-mt-4",children:(0,I.jsx)(o.D0,{component:d.A,name:"corporateEmail",label:"Email",autoCapitalize:"off",disabled:t,placeholder:"[email protected]",isRequired:!0,autoComplete:"email"})}),(0,I.jsx)("div",{className:"tw-mt-4",children:(0,I.jsx)(x.A,{label:"Street",placeholder:"1234 Example St. Suite 123",value:null===n||void 0===n?void 0:n.corporateStreet,onChange:e=>{s("corporateStreet",e),ne||s("shippingStreet",e)},setAutoCompleteAddress:e=>{s("corporateStreet",e.address1),s("corporateCity",e.city),s("corporateZipCode",e.zip),s("corporateCountry",e.country||"US"),s("corporateState",e.state),ne||(s("shippingStreet",e.address1),s("shippingCity",e.city),s("shippingZipCode",e.zip),s("shippingCountry",e.country||"US"),s("shippingState",e.state))},disabled:t,isRequired:!0,isTouchedByDefault:oe,autoComplete:"address-line1"})}),(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,I.jsx)(o.D0,{component:d.A,name:"corporateCity",label:"City",autoCapitalize:"off",disabled:t,placeholder:"San Francisco",isRequired:!0,onChange:e=>{s("corporateCity",e),ne||s("shippingCity",e)},autoComplete:"address-level2"}),(0,I.jsx)(o.D0,{name:"corporateState",component:w.A,label:"State",handleChange:e=>{s("corporateState",e),ne||s("shippingState",e)},options:i,isRequired:!0,disabled:t,placeholder:"CA",autoComplete:"address-level1"})]}),(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,I.jsx)(o.D0,{component:d.A,name:"corporateZipCode",label:"Postal Code",autoCapitalize:"off",disabled:t,placeholder:"94104",isRequired:!0,onChange:e=>{s("corporateZipCode",e),ne||s("shippingZipCode",e)},autoComplete:"postal-code"}),(0,I.jsx)(o.D0,{name:"corporateCountry",label:"Country",value:(null===n||void 0===n?void 0:n.corporateCountry)||"US",component:w.A,margin:"dense",options:f.A.map(e=>({label:e.name,value:e.code})),isRequired:!0,handleChange:e=>{(0,b.nt)({country:e})?(s("corporateState","PR"),ne||s("shippingState","PR")):(s("corporateState",""),ne||s("shippingState","")),s("corporateCountry",e||"US"),ne||s("shippingCountry",e||"US")},autoComplete:"country-name"})]}),(0,I.jsx)("div",{className:"tw-flex tw-items-center tw-mt-4",children:(0,I.jsx)(o.dO,{value:ne,checked:ne,onChange:()=>{const e=!ne;e?(s("shippingStreet",""),s("shippingCity",""),s("shippingZipCode",""),s("shippingCountry","US"),s("shippingState","")):(s("shippingStreet",n.corporateStreet),s("shippingCity",n.corporateCity),s("shippingZipCode",n.corporateZipCode),s("shippingCountry",n.corporateCountry||"US"),s("shippingState",n.corporateState)),ie(e)},label:"Enter different billing address information",fullWidth:!1,labelPlacement:"end"})})]}),ne?(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:"tw-text-lg tw-font-medium tw-text-secondary",children:"Address Information"}),(0,I.jsx)("div",{className:"tw-mt-4",children:(0,I.jsx)(x.A,{label:"Street",placeholder:"1234 Example St. Suite 123",value:null===n||void 0===n?void 0:n.shippingStreet,onChange:e=>s("shippingStreet",e),setAutoCompleteAddress:e=>{s("shippingStreet",e.address1),s("shippingCity",e.city),s("shippingZipCode",e.zip),s("shippingCountry",e.country||"US"),s("shippingState",e.state)},disabled:t,isRequired:!0,isTouchedByDefault:oe,autoComplete:"address-line1"})}
1),(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,I.jsx)(o.D0,{component:d.A,name:"shippingCity",label:"City",autoCapitalize:"off",disabled:t,placeholder:"San Francisco",isRequired:!0,autoComplete:"address-level2"}),(0,I.jsx)(o.D0,{name:"shippingState",component:w.A,label:"State",options:l,isRequired:!0,disabled:t,placeholder:"CA",autoComplete:"address-level1"})]}),(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,I.jsx)(o.D0,{component:d.A,name:"shippingZipCode",label:"Postal Code",autoCapitalize:"off",disabled:t,placeholder:"94104",isRequired:!0,autoComplete:"postal-code"}),(0,I.jsx)(o.D0,{name:"shippingCountry",label:"Country",value:(null===n||void 0===n?void 0:n.shippingCountry)||"US",component:w.A,margin:"dense",options:f.A.map(e=>({label:e.name,value:e.code})),isRequired:!0,handleChange:e=>{(0,b.nt)({country:e})?s("shippingState","PR"):s("shippingState",""),s("shippingCountry",e||"US")},autoComplete:"country-name"})]})]}):null]})]})},fe=e=>{let t=e.isSubmitting,s=e.values,n=e.setFieldValue;if("eula"===B)return(0,I.jsx)(D,{pdfUrl:"".concat(N.nv,"/Assets/fedex_eula_v1.pdf"),label:"I accept the terms of FedEx EULA to start shipping",handleChecked:e=>he(e)});if("pinInput"===B)return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("div",{className:"tw-text-lg tw-font-medium tw-text-secondary tw-mb-2",children:"Enter Pin"}),(0,I.jsx)(o.A_,{variant:"outlined",value:$,onChange:e=>Q(e.target.value),placeholder:"Enter pin",required:!0})]});const i=s.validationType,l=[{label:"Select State",value:null},...(()=>{var e;return(null===(e=y.Ay[(null===s||void 0===s?void 0:s.corporateCountry)||"US"])||void 0===e?void 0:e.map(e=>({label:e.name,value:e.abbreviation})))||[]})()];return(0,I.jsxs)(I.Fragment,{children:["oauth"!==B?(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4",children:[(0,I.jsx)(o.D0,{component:d.A,name:"accountNumber",label:"FedEx Account Number",required:!0,autoCapitalize:"off",disabled:t||"address"!==B,isRequired:!0,placeholder:"123456789"}),(0,I.jsx)(o.D0,{component:d.A,name:"description",label:"Account Nickname",autoCapitalize:"off",disabled:t||"address"!==B})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:"tw-text-lg tw-font-medium tw-text-secondary tw-mt-2",children:"Account Information"}),(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-2",children:[(0,I.jsx)(o.D0,{component:d.A,name:"name",label:"Account Holder Name",autoCapitalize:"off",disabled:t||"address"!==B,placeholder:"John",isRequired:!0,autoComplete:"name"}),(0,I.jsx)(x.A,{label:"Street",placeholder:"1234 Example St. Suite 123",value:null===s||void 0===s?void 0:s.street,onChange:e=>n("street",e),setAutoCompleteAddress:e=>{n("street",e.address1),n("city",e.city),n("zipCode",e.zip),n("country",e.country),n("state",e.state)},disabled:t||"address"!==B,isRequired:!0,isTouchedByDefault:oe,autoComplete:"address-line1"}),(0,I.jsx)(o.D0,{component:d.A,name:"city",label:"City",autoCapitalize:"off",disabled:t||"address"!==B,placeholder:"San Francisco",isRequired:!0,autoComplete:"address-level2"}),(0,I.jsx)(o.D0,{name:"state",component:w.A,label:"State",options:l,isRequired:!0,disabled:t||"address"!==B,placeholder:"CA",autoComplete:"address-level1"}),(0,I.jsx)(o.D0,{component:d.A,name:"zipCode",label:"Postal Code",autoCapitalize:"off",disabled:t||"address"!==B,placeholder:"94104",isRequired:!0,autoComplete:"postal-code"}),(0,I.jsx)(o.D0,{name:"country",label:"Country",value:(null===s||void 0===s?void 0:s.country)||"US",component:w.A,margin:"dense",options:f.A.map(e=>({label:e.name,value:e.code})),isRequired:!0,handleChange:e=>{(0,b.nt)({country:e})?n("state","PR"):n("state",""),n("country",e)},disabled:t||"address"!==B,autoComplete:"country-name"})]})]})]}):null,"oauth"===B?(0,I.jsxs)("div",{className:"tw-mb-2",children:[(0,I.jsx)(v.A,{className:"tw-font-semibold",children:"Select option to validate your FedEx Account"}),(0,I.jsxs)(o.tU,{TabIndicatorProps:{style:{backgroundColor:"#E7942F"}},value:i,textColor:"inherit",onChange:(e,t)=>
1{n("validationType",t),n("validationStep",0===t?"pinGeneration":"invoice")},style:{marginBottom:10,marginTop:-8},variant:"fullWidth",children:[K.includes("pin")?(0,I.jsx)(o.oz,{style:{textTransform:"inherit",paddingLeft:0,paddingRight:0},className:"tab-button ".concat(0===i?"tab-button-selected":""),label:(0,I.jsx)("div",{className:"tw-text-xl tw-font-bold ".concat(0===i?"tw-text-secondary":""),children:"2FA"})}):null,K.includes("invoice")?(0,I.jsx)(o.oz,{style:{textTransform:"inherit",paddingLeft:15,paddingRight:0},className:"tab-button ".concat(1===i?"tab-button-selected":""),label:(0,I.jsx)("div",{className:"tw-text-xl tw-font-bold ".concat(1===i?"tw-text-secondary":""),children:"Invoice"})}):null]}),K.includes("pin")?(0,I.jsx)(p.K,{value:i,index:0,children:(0,I.jsx)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-2",children:(0,I.jsx)(o.D0,{name:"2faOption",label:"2FA Option",component:w.A,isRequired:!0,options:z,disabled:t,labelProps:{className:"tw-text-lg tw-font-medium tw-text-secondary tw-mt-2 tw-mb-2"}})})}):null,K.includes("invoice")?(0,I.jsxs)(p.K,{value:i,index:1,children:[(0,I.jsx)("div",{className:"tw-text-lg tw-font-medium tw-text-secondary tw-mt-2",children:"Invoice Details (within last 90 days)"}),(0,I.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-2",children:[(0,I.jsx)(o.D0,{component:d.A,name:"invoiceNumber",label:"Invoice Number",autoCapitalize:"off",disabled:t,isRequired:!0}),(0,I.jsx)(o.D0,{component:d.A,name:"invoiceCurrency",label:"Invoice Currency",autoCapitalize:"off",disabled:t,placeholder:"USD",isRequired:!0}),(0,I.jsx)(o.D0,{component:d.A,name:"invoiceDate",label:"Invoice Date",autoCapitalize:"off",disabled:t,placeholder:"YYYY-MM-DD",isRequired:!0}),(0,I.jsx)(o.D0,{component:d.A,name:"invoiceAmount",label:"Invoice Amount",autoCapitalize:"off",disabled:t,placeholder:"99.99",isRequired:!0})]})]}):null]}):null,ve?(0,I.jsx)("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-center tw-font-semibold tw-text-orange-600",children:"We are unable to process this request. Please try again later or call FedEx Customer Service and ask for technical support."}):null]})};let be=m.Q4;null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration&&(be="oauth"===B?m.qS:m.F1);let je="sm";return null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration?"eula"===B?je="lg":"pinInput"===B&&(je="xs"):ne&&(je="md"),(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(o.l1,{enableReinitialize:!0,validationSchema:be,innerRef:P,initialValues:xe,onSubmit:async(e,t)=>{let s=t.setSubmitting;try{var i;if(null===C||void 0===C?void 0:C.find(t=>{var s,n,i,l;return(null===t||void 0===t||null===(s=t.credentials)||void 0===s||null===(n=s.account_number)||void 0===n?void 0:n.trim())===(null===e||void 0===e||null===(i=e.accountNumber)||void 0===i?void 0:i.trim())&&(null===t||void 0===t||null===(l=t.readable)||void 0===l?void 0:l.toLowerCase())===h.Ay.fedex.toLowerCase()}))return void T("This FedEx account number already exists in your ShipFare account.");"pinInput"===B&&(e.pinCode=$),e.accountNumber=null===(i=e.accountNumber)||void 0===i?void 0:i.trim().replace(/[^a-zA-Z0-9]/g,"");const t=(0,n.A)({},e),s=(await c.Km.post("/carriers/new",e)).data;if("address"===B&&!0!==(null===s||void 0===s?void 0:s.carrierCreated)){var l,o,r;let e;const n=[];return null!==s&&void 0!==s&&null!==(l=s.options)&&void 0!==l&&null!==(o=l.pinOptions)&&void 0!==o&&o.length&&(M(s.options.pinOptions),n.push("pin"),e=0,t["2faOption"]=s.options.pinOptions[0].value),null!==s&&void 0!==s&&null!==(r=s.options)&&void 0!==r&&r.invoice&&(n.push("invoice"),0!==e&&(e=1)),t.validationType=e,t.validationStep=0===e?"pinGeneration":"invoice",Y(n),U("oauth"),void ee(t)}if("oauth"===B&&"pinGeneration"===e.validationStep)return t.validationStep="pin",U("pinInput"),ee(t),void F(s.status);null!==s&&void 0!==s&&s.carriers&&A(s.carriers),(0,a.vA)(()=>{F("Carrier account created successfully"),console.log(s.user),E((0,u.QO)({user:s.user}))}),ge()}catch(y){var d,m,p,v,w,x,g;let e="Error creating new carrier";"string"===typeof((null===y||void 0===y||null===(d=y.response)||void 0===d||null===(m=d.data)||void 0===m?void 0:m.message)||(null===y||void 0===y||null===(p=y.response)||void 0===p?void 0:p.data)||(null===y||void 0===y?void 0:y.message))&&(e=(null===y||void 0===y||null===(v=y.response)||void 0===v||null===(w=v.data)||void 0===w?void 0:w.message)||(null===y||void 0===y||null===(x=y.response)||void 0===x?void 0:x.data)||(null===y||void 0===y?void 0:y.message)),["We are unable to process this request. Please try again later or call FedEx Customer Service and ask for technical support.".toLowerCase(),"We are unable to process this request. Please try again later or contact FedEx Customer Service.".toLowerCase()].includes(null===(g=e)||void 0===g?void 0:g.toLowerCase())&&we(!0),T(e)}s(!1)},children:e=>{let s=e.isSubmitting,n=e.submitForm,i=e.setFieldValue,l=e.values;return(0,I.jsx)(o.lV,{children:(0,I.jsx)(o.aF,{open:t,maxWidth:je,title:"Add Your FedEx Account",handleClose:s?()=>{}:ge,actions:[{isClose:!0,disabled:s},{isPrimary:!0,onClick:()=>U("address"),hide:!(null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration)||"eula"!==B,label:"Next",loading:s,disabled:s||!ue},{isPrimary:!0,onClick:()=>{re(!0),n()},hide:!(null===S||void 0===S||!S.useDirectManualCarrierIntegration)&&"eula"===B,label:null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration?"oauth"===B?"Validate":"pinInput"===B?"Verify":(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r.OMN,{})," Add"]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r.OMN,{})," Add"]}),loading:s,disabled:s||"pinInput"===B&&!(null!==$&&void 0!==$&&$.length)}],children:null!==S&&void 0!==S&&S.useDirectManualCarrierIntegration?fe({isSubmitting:s,values:l,setFieldValue:i}):ye({isSubmitting:s,setFieldValue:i,values:l})})})}})})}},93236(e,t,s){s.d(t,{A:()=>g});var n=s(98477),i=s(64419),l=s(6601),a=s(68163),o=s(2444),r=s(54917),d=s(1739),c=s(55948),u=s(81926),h=s(82458),m=s(38935),p=s(82391),v=s(16565),w=s(61969),x=s(63203);const g=e=>{let t=e.active,s=e.handleClose,g=e.onComplete,y=e.user,f=e.carrierAccounts,b=e.isOnboardingFlow,j=void 0!==b&&b;const A=(0,i.useRef)(),S=(0,o.useDispatch)(),C=(0,w.A)(),N=C.toastError,I=C.toastSuccess,D={type:u.Ay.ups,description:"",accountNumber:""},k=()=>{var e;s(),null!==A&&void 0!==A&&null!==(e=A.current)&&void 0!==e&&e.resetForm&&A.current.resetForm()};return(0,x.jsx)(x.Fragment,{children:(0,x.jsx)(l.l1,{enableReinitialize:!0,validationSchema:h.gG,innerRef:A,initialValues:D,onSubmit:async(e,t)=>{let s=t.setSubmitting;try{var i;if(null===f||void 0===f?void 0:f.find(t=>{var s,n,i,l;return(null===t||void 0===t||null===(s=t.credentials)||void 0===s||null===(n=s.account_number)||void 0===n?void 0:n.trim())===(null===e||void 0===e||null===(i=e.accountNumber)||void 0===i?void 0:i.trim())&&(null===t||void 0===t||null===(l=t.readable)||void 0===l?void 0:l.toLowerCase())===u.Ay.ups.toLowerCase()}))return void N("This UPS account number already exists in your ShipFare account.");const t=(0,n.A)({},e);if(null!==t&&void 0!==t&&null!==(i=t.invoiceDate)&&void 0!==i&&i.length&&(t.invoiceDate=(0,m.Ay)(t.invoiceDate).format("YYYYMMDD")),null!==y&&void 0!==y&&y.useDirectManualCarrierIntegration){j&&localStorage.setItem("redirectBackToOnboarding","true");const e="".concat(window.location.origin,"/ups/token"),s=(0,v.PM)();return sessionStorage.setItem("ups_integration_data",JSON.stringify((0,n.A)((0,n.A)({},t),{},{nonce:s,redirectUri:e}))),window.open("".concat(p.nL.baseUri,"/security/v1/oauth/authorize?client_id=").concat(p.nL.manualCarrierClientId,"&redirect_uri=").concat(e,"&response_type=code&state=").concat(s),"_self"),null===g||void 0===g||g(),void k()}const s=(await d.Km.post("/carriers/new",t)).data;(0,o.vA)(()=>{S((0,c.lB)({refreshCarriersServices:!0})),I("Carrier account created successfully")}),window.open(s.oAuthRedirectUrl,"_self"),null===g||void 0===g||g(),k()}catch(a){var l;N((null===a||void 0===a||null===(l=a.response)||void 0===l?void 0:l.data)||(null===a||void 0===a?void 0:a.message)||"Error creating new carrier")}s(!1)},children:e=>{let s=e.isSubmitting,n=e.submitForm;return(0,x.jsx)(l.lV,{children:(0,x.jsx)(l.aF,{open:t,title:"Add Carrier",paperStyle:{maxWidth:512},handleClose:s?()=>{}:k,actions:[{isClose:!0,disabled:s},{isPrimary:!0,onClick:n,label:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a.OMN,{})," Add"]}),loading:s,disabled:s}],children:(0,x.jsxs)("div",{className:"tw-flex tw-flex-col sm:tw-flex-row tw-gap-4 tw-my-4",children:[(0,x.jsx)(l.D0,{component:r.A,name:"accountNumber",label:"UPS Account Number",autoCapitalize:"off",disabled:s,placeholder:"12A34B",isRequired:!0,wrapperClass:"tw-w-full"}),(0,x.jsx)(l.D0,{component:r.A,name:"description",label:"Account Nickname",autoCapitalize:"off",disabled:s,wrapperClass:"tw-w-full"})]})})})}})})}},31365(e,t,s){s.d(t,{A:()=>b});var n=s(98477),i=s(39698),l=s(64419),a=s(6601),o=s(2444),r=s(54917),d=s(1739),c=s(55948),u=s(81926),h=s(82458),m=s(16565),p=s(82391),v=s(94023),w=s(37348),x=s(48057),g=s(57043),y=s(61969),f=s(63203);const b=e=>{let t=e.active,s=e.handleClose,b=e.onComplete,j=e.user,A=e.carrierAccounts,S=e.isOnboardingFlow,C=void 0!==S&&S;const N=(0,l.useRef)(),I=(0,o.useDispatch)(),D=(0,y.A)(),k=D.toastError,P=D.toastSuccess,E=(0,l.useState)(!1),R=(0,i.A)(E,2),T=R[0],F=R[1],O=!p.zF&&(null===j||void 0===j?void 0:j.useDirectManualCarrierIntegration),_=O?{type:u.Ay.usps,description:"",accountNumber:""}:{type:u.Ay.usps,description:"",accountHolderName:"",streetAddress:"",city:"",state:"",zipCode:"",phoneNumber:"",emailAddress:"",shipperIdentifier:""},B=()=>{var e;s(),F(!1),null!==N&&void 0!==N&&null!==(e=N.current)&&void 0!==e&&e.resetForm&&N.current.resetForm()},U=[{label:"Select State",value:null},...(()=>{var e;return(null===(e=x.Ay.US)||void 0===e?void 0:e.map(e=>({label:e.name,value:e.abbreviation})))||[]})()],L=e=>{let t=e.isSubmitting,s=e.setFieldValue,n=e.values;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:"tw-grid tw-gri
1d-cols-1 md:tw-grid-cols-2 tw-gap-4",children:[(0,f.jsx)(a.D0,{component:r.A,name:"description",label:"Account Nickname",autoCapitalize:"off",disabled:t,isRequired:!0}),(0,f.jsx)(a.D0,{component:r.A,name:"shipperIdentifier",label:"Shipper Identifier (Optional)",autoCapitalize:"off",disabled:t})]}),(0,f.jsxs)("div",{className:"tw-grid tw-grid-cols-1 tw-mt-4",children:[(0,f.jsx)("div",{className:"tw-text-lg tw-font-medium tw-text-secondary",children:"Production Credentials"}),(0,f.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,f.jsx)(a.D0,{component:r.A,name:"accountHolderName",label:"Account Holder Name",autoCapitalize:"off",disabled:t,isRequired:!0,placeholder:"John Doe",autoComplete:"name"}),(0,f.jsx)(a.D0,{name:"phoneNumber",label:"Phone",component:g.Ay,autoCapitalize:"off",disabled:t,placeholder:"123-123-1234",isRequired:!0,autoComplete:"phone"})]}),(0,f.jsx)("div",{className:"tw-mt-4",children:(0,f.jsx)(a.D0,{component:r.A,name:"emailAddress",label:"Email",autoCapitalize:"off",disabled:t,placeholder:"[email protected]",isRequired:!0,autoComplete:"email"})}),(0,f.jsx)("div",{className:"tw-mt-4",children:(0,f.jsx)(v.A,{label:"Street",placeholder:"1234 Example St. Suite 123",value:null===n||void 0===n?void 0:n.streetAddress,onChange:e=>s("streetAddress",e),setAutoCompleteAddress:e=>{s("streetAddress",e.address1),s("city",e.city),s("state",e.state),s("zipCode",e.zip)},disabled:t,isRequired:!0,isTouchedByDefault:T,autoComplete:"address-line1"})}),(0,f.jsxs)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,f.jsx)(a.D0,{component:r.A,name:"city",label:"City",autoCapitalize:"off",disabled:t,placeholder:"San Francisco",isRequired:!0,autoComplete:"address-level2"}),(0,f.jsx)(a.D0,{name:"state",component:w.A,label:"State",options:U,isRequired:!0,disabled:t,placeholder:"CA",autoComplete:"address-level1"})]}),(0,f.jsx)("div",{className:"tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:(0,f.jsx)(a.D0,{component:r.A,name:"zipCode",label:"Zip Code",autoCapitalize:"off",disabled:t,placeholder:"94104",isRequired:!0,autoComplete:"postal-code"})})]})]})},W=e=>{let t=e.isSubmitting;return(0,f.jsxs)("div",{className:"tw-flex tw-gap-4 tw-my-4",children:[(0,f.jsx)(a.D0,{component:r.A,name:"accountNumber",label:"USPS Account Number",autoCapitalize:"off",disabled:t,wrapperClass:"tw-w-full"}),(0,f.jsx)(a.D0,{component:r.A,name:"description",label:"Account Nickname",autoCapitalize:"off",disabled:t,wrapperClass:"tw-w-full"})]})};return(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(a.l1,{enableReinitialize:!0,validationSchema:O?h.oC:h.F4,innerRef:N,initialValues:_,onSubmit:async(e,t)=>{let s=t.setSubmitting;try{if(null===A||void 0===A?void 0:A.find(t=>{var s,n,i,l;return(null===t||void 0===t||null===(s=t.credentials)||void 0===s||null===(n=s.account_number)||void 0===n?void 0:n.trim())===(null===e||void 0===e||null===(i=e.accountNumber)||void 0===i?void 0:i.trim())&&(null===t||void 0===t||null===(l=t.readable)||void 0===l?void 0:l.toLowerCase())===u.Ay.usps.toLowerCase()}))return void k("This USPS account number already exists in your ShipFare account.");if(O){C&&localStorage.setItem("redirectBackToOnboarding","true");const t="".concat(window.location.origin,"/usps/token"),s=(0,m.PM)();return sessionStorage.setItem("usps_integration_data",JSON.stringify((0,n.A)((0,n.A)({},e),{},{nonce:s,redirectUri:t}))),window.open("".concat(p.eM.baseUri,"/oauth2/v3/authorize?client_id=").concat(p.eM.clientId,"&redirect_uri=").concat(t,"&response_type=code&state=").concat(s),"_self"),null===b||void 0===b||b(),void B()}const t=(await d.Km.post("/carriers/new",e)).data;b(t.carriers),(0,o.vA)(()=>{P("Carrier account created successfully"),I((0,c.QO)({user:t.user}))}),B()}catch(l){var i;k((null===l||void 0===l||null===(i=l.response)||void 0===i?void 0:i.data)||(null===l||void 0===l?void 0:l.message)||"Error creating new carrier")}s(!1)},children:e=>{let s=e.isSubmitting,n=e.submitForm,i=e.values,l=e.setFieldValue;return(0,f.jsx)(a.lV,{children:(0,f.jsx)(a.aF,{open:t,maxWidth:"sm",title:"Add Your USPS Account",handleClose:s?()=>{}:B,actions:[{isClose:!0,disabled:s},{isPrimary:!0,onClick:()=>{F(!0),n()},label:"Create",loading:s,disabled:s}],children:O?W({isSubmitting:s}):L({isSubmitting:s,setFieldValue:l,values:i})})})}})})}},171(e,t,s){s.d(t,{A:()=>w});var n=s(98477),i=s(39698),l=s(64419),a=s(6601),o=s(2444),r=s(54917),d=s(1739),c=s(55948),u=s(4721),h=s(70038),m=s(86417),p=s(61969),v=s(63203);const w=e=>{var t;let s=e.active,w=e.handleClose,x=e.selectedShop,g=void 0===x?{}:x,y=e.webhooks,f=e.fetchingWebhooks,b=e.onComplete,j=e.user;const A=(0,l.useRef)(),S=(0,o.useDispatch)(),C=(0,p.A)(),N=C.toastError,I=C.toastSuccess,D=(0,l.useState)(!1),k=(0,i.A)(D,2),P=k[0],E=k[1],R=(0,l.useState)(0),T=(0,i.A)(R,2),F=T[0],O=T[1],_=(0,l.useState)(g),B=(0,i.A)(_,2),U=B[0],L=B[1],W=(0,l.useState)(!0),z=(0,i.A)(W,2),M=z[0],q=z[1],V=(0,l.useState)(!1),K=(0,i.A)(V,2),Y=K[0],G=K[1],H=(0,l.useState)(null!==(t=j.bigCommerceAccountEmail)&&void 0!==t?t:j.email),$=(0,i.A)(H,2),Q=$[0],J=$[1];(0,l.useEffect)(()=>{var e;const t=null===j||void 0===j||null===(e=j.shopDomains)||void 0===e?void 0:e.find(e=>(null===e||void 0===e?void 0:e.shop)===(null===g||void 0===g?void 0:g.shop));L(t)},[F,g]);const Z={bigCommerceAccountEmail:j.email},X=()=>{var e;q(!0),w(),null!==A&&void 0!==A&&null!==(e=A.current)&&void 0!==e&&e.resetForm&&A.current.resetForm()},ee=async()=>{E(!0);try{const e=(await d.Km.post("/private-app/credentials/remove",{platformType:m.hb.bigcommerce,shopDomain:U.shop})).data;(0,o.vA)(()=>{S((0,c.QO)({user:e.user})),I(e.message)}),O(F+1),X()}catch(t){var e;console.log((null===t||void 0===t?void 0:t.response)||t),N((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Integration")}E(!1)},te=async()=>{E(!0);try{const e=(await d.FH.post("/user/v1/company/edit",{bigCommerceAccountEmail:Q})).data;(0,o.vA)(()=>{S((0,c.QO)({user:e.user})),I(u.lw.BIGCOMMERCE_EMAIL_SAVE)}),O(F+1)}catch(e){console.log((null===e||void 0===e?void 0:e.response)||e)}E(!1),G(!0)};return(0,v.jsx)(v.Fragment,{children:(0,v.jsx)(a.l1,{enableReinitialize:!0,innerRef:A,initialValues:Z,onSubmit:async(e,t)=>{let s=t.setSubmitting;try{var i;let t;const s=e.shop.replace(/\/$/,"");if(null!==U&&void 0!==U&&U.shop){const i=await d.Km.post("/private-app/credentials/update",(0,n.A)((0,n.A)({},e),{},{platformType:m.hb.bigcommerce,shopDomain:e.originalShop,updatedS
1hopDomain:s}));t=i.data}else{const i=await d.Km.post("/private-app/credentials/new",(0,n.A)((0,n.A)({},e),{},{platformType:m.hb.bigcommerce,shop:s}));t=i.data}const l=null===(i=t.user.shopDomains)||void 0===i?void 0:i.find(e=>e.shop===s&&e.platformType===m.hb.bigcommerce);b(l,!1),(0,o.vA)(()=>{S((0,c.QO)({user:t.user})),I(t.message)}),O(F+1)}catch(a){var l;N((null===a||void 0===a||null===(l=a.response)||void 0===l?void 0:l.data)||(null===a||void 0===a?void 0:a.message)||"Error Adding App Credentials")}s(!1)},children:e=>{let t=e.isSubmitting,n=e.submitForm,i=e.values;return(0,v.jsx)(a.lV,{children:(0,v.jsx)(a.aF,{open:s,title:"Store Connection",handleClose:t||P?()=>{}:X,hideActions:Y,actions:[{isClose:!0,hide:Y},{label:"Next",disabled:P||!Q,onClick:te,hide:Y,loading:P,color:"secondary"}],children:Y?(0,v.jsx)(h.A,{isCreating:!(null!==U&&void 0!==U&&U.shop),currentStatus:null!==U&&void 0!==U&&U.shop?"Active":"Inactive",isSubmitting:t,loading:P,onEdit:()=>{q(!0)},onIntegrate:n,allowEdit:M,editable:!0,webhooks:y,fetchingWebhooks:f,storePlatform:"".concat(m.hb.bigcommerce),storeUrl:null===U||void 0===U?void 0:U.shop,onReturn:X,onRemoveIntegration:ee,isInvalid:!i.apiContext||!i.apiClientId||!i.accessToken||!i.clientSecret||!i.shop,hideCreatingActions:!0,onSaveBigCommerceEmail:te,renderCreatingFields:()=>(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(a.o5,{style:{marginBottom:10},children:"Install Our Official BigCommerce App to instantly sync orders, customers, and products, provide live shipping rates, and unlock powerful features."}),(0,v.jsx)("div",{className:"tw-grid tw-place-items-center tw-p-4",children:(0,v.jsx)(a.$n,{color:"secondary",variant:"contained",fullWidth:!0,style:{marginTop:20},onClick:()=>window.open("https://www.bigcommerce.com/apps/shipfare","_self"),children:"Install BigCommerce App"})})]})}):(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{children:"Enter the email of your BigCommerce store owner. (Look under Settings > Users to find it.)"}),(0,v.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-mt-4",children:(0,v.jsx)(a.D0,{component:r.A,name:"bigCommerceAccountEmail",value:Q,disabled:!M&&!(null===U||void 0===U||!U.shop),isRequired:!0,onChange:e=>J(e)})})]})})})}})})}},70038(e,t,s){s.d(t,{A:()=>o});var n=s(6601),i=s(37708),l=s(71889),a=s(63203);const o=e=>{let t=e.isCreating,s=e.currentStatus,o=e.storeUrl,r=e.editable,d=void 0!==r&&r,c=e.storePlatform,u=e.loading,h=e.allowEdit,m=e.webhooks,p=e.hideReauthorize,v=void 0===p||p,w=e.hideCreatingActions,x=void 0!==w&&w,g=e.isSubmitting,y=e.hideEditButton,f=void 0!==y&&y,b=e.onRemoveIntegration,j=e.onEdit,A=e.onReauthorize,S=e.fetchingWebhooks,C=e.onRemoveWebhooks,N=e.onRefreshWebhooks,I=e.onReturn,D=e.onIntegrate,k=e.renderCreatingFields,P=e.isInvalid,E=void 0!==P&&P;e.onSaveBigCommerceEmail;return t?(0,a.jsxs)("div",{children:[null===k||void 0===k?void 0:k(),x?null:(0,a.jsxs)("div",{className:"tw-m-4 tw-mr-0 tw-flex tw-space-x-4 tw-justify-end",children:[(0,a.jsx)(n.$n,{disabled:g||u,loading:g||u,onClick:I,style:{fontSize:14,height:38},className:"tw-border tw-border-solid tw-bg-white tw-text-black tw-border-gray-300 tw-px-3 tw-py-2 tw-rounded-md hover:tw-border-gray-700 tw-transition-colors tw-duration-300 tw-z-50",children:"Close"}),(0,a.jsx)(n.$n,{color:"primary",disabled:g||u,loading:g||u,onClick:D,style:{fontSize:14,height:38},children:"Integrate"})]})]}):(0,a.jsxs)("div",{className:"ship-modal-content",children:[(0,a.jsx)("div",{className:"tw-font-bold tw-text-base tw-text-secondary",children:"Store Details"}),(0,a.jsxs)("ul",{className:"tw-pl-0",children:[(0,a.jsxs)("li",{className:"tw-flex tw-justify-between tw-gap-4",children:[(0,a.jsx)("span",{children:"Current Status:"}),(0,a.jsx)("span",{children:s})]}),(0,a.jsxs)("li",{className:"tw-flex tw-justify-between tw-gap-4",children:[(0,a.jsx)("span",{children:"Store URL:"}),(0,a.jsx)("span",{children:o})]}),(0,a.jsxs)("li",{className:"tw-flex tw-justify-between tw-gap-4",children:[(0,a.jsx)("span",{children:"Store Platform:"}),(0,a.jsx)("span",{children:(0,l.capitalize)(c)})]})]}),d?null===k||void 0===k?void 0:k():null,(0,a.jsxs)("div",{className:"tw-m-4 tw-mr
1-0 tw-flex tw-space-x-4 tw-justify-end",children:[(0,a.jsx)(a.Fragment,{children:d&&!f?h?(0,a.jsx)(n.$n,{type:"submit",variant:"outlined",disabled:g||u||E,loading:g||u,onClick:D,style:{fontSize:14,height:38},children:"Update"}):(0,a.jsx)(n.$n,{type:"submit",variant:"outlined",disabled:g||u,loading:g||u,onClick:j,style:{fontSize:14,height:38},children:"Edit"}):null}),(0,a.jsx)(n.$n,{color:"error",variant:"outlined",disabled:g||u,loading:g||u,onClick:b,style:{fontSize:14,height:38},children:"Remove Integration"}),v?null:(0,a.jsx)(n.$n,{disabled:g||u,loading:g||u,onClick:A,style:{fontSize:14,height:38},children:"Re-Authorize"})]}),m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"tw-font-bold tw-text-base tw-text-secondary tw-mt-4",children:"Store Access Permissions"}),(0,a.jsx)("ul",{className:"mt-1 tw-pl-0",children:S?(0,a.jsx)("div",{style:{textAlign:"center"},children:(0,a.jsx)(n.P,{})}):Object.values(i.xQ).map(e=>{const t=null===m||void 0===m?void 0:m.find(t=>t.address===e.address);return(0,a.jsx)("li",{className:"tw-capitalize tw-list-none",children:t?(0,a.jsx)("span",{children:e.topic}):(0,a.jsx)("span",{className:"tw-text-red-600",children:e.topic})},e.topic)})}),(0,a.jsxs)("div",{className:"tw-m-4 tw-mr-0 tw-flex tw-space-x-4 tw-justify-end",children:[(null===m||void 0===m?void 0:m.length)>0?(0,a.jsx)(n.$n,{color:"error",variant:"outlined",disabled:g||u||S,loading:g||u||S,onClick:C,style:{fontSize:14,height:38},children:"Remove Webhooks"}):null,(0,a.jsx)(n.$n,{variant:"contained",disabled:g||u||S,loading:g||u||S,onClick:N,style:{fontSize:14,height:38},children:"Refresh Webhooks"})]})]}):null]})}},65097(e,t,s){s.d(t,{A:()=>w});var n=s(98477),i=s(39698),l=s(64419),a=s(6601),o=s(2444),r=s(54917),d=s(1739),c=s(55948),u=s(86417),h=s(11518),m=s(70038),p=s(61969),v=s(63203);const w=e=>{let t=e.active,s=e.handleClose,w=e.selectedShop,x=void 0===w?{}:w,g=e.onComplete,y=e.user;const f=(0,l.useRef)(),b=(0,o.useDispatch)(),j=(0,p.A)(),A=j.toastError,S=j.toastSuccess,C=(0,l.useState)(!1),N=(0,i.A)(C,2),I=N[0],D=N[1],k=(0,l.useState)(0),P=(0,i.A)(k,2),E=P[0],R=P[1],T=(0,l.useState)(x),F=(0,i.A)(T,2),O=F[0],_=F[1],B=(0,l.useState)(!0),U=(0,i.A)(B,2),L=U[0],W=U[1];(0,l.useEffect)(()=>{var e;
1const t=null===y||void 0===y||null===(e=y.shopDomains)||void 0===e?void 0:e.find(e=>(null===e||void 0===e?void 0:e.shop)===(null===x||void 0===x?void 0:x.shop));_(t)},[E,x]);const z={shop:(null===O||void 0===O?void 0:O.shop)||"",storeKey:"",originalShop:(null===O||void 0===O?void 0:O.shop)||""},M=()=>{var e;W(!0),s(),null!==f&&void 0!==f&&null!==(e=f.current)&&void 0!==e&&e.resetForm&&f.current.resetForm()},q=async()=>{D(!0);try{const e=(await d.Km.post("/private-app/credentials/remove",{platformType:u.hb.grazeCart,shopDomain:O.shop})).data;(0,o.vA)(()=>{b((0,c.QO)({user:e.user})),S(e.message)}),R(E+1),M()}catch(t){var e;console.log((null===t||void 0===t?void 0:t.response)||t),A((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Integration")}D(!1)};return(0,v.jsx)(v.Fragment,{children:(0,v.jsx)(a.l1,{enableReinitialize:!0,innerRef:f,initialValues:z,onSubmit:async(e,t)=>{let s=t.setSubmitting;try{var i;let t;const s=e.shop.replace(/\/$/,""),l=(0,n.A)((0,n.A)({},e),{},{apiKey:e.storeKey});if(null!==O&&void 0!==O&&O.shop){const i=await d.Km.post("/private-app/credentials/update",(0,n.A)((0,n.A)({},l),{},{platformType:u.hb.grazeCart,shopDomain:e.originalShop,updatedShopDomain:s}));t=i.data}else{const e=await d.Km.post("/private-app/credentials/new",(0,n.A)((0,n.A)({},l),{},{platformType:u.hb.grazeCart,shop:s}));t=e.data}const a=null===(i=t.user.shopDomains)||void 0===i?void 0:i.find(e=>e.shop===s&&e.platformType===u.hb.grazeCart);g(a,!1),(0,o.vA)(()=>{b((0,c.QO)({user:t.user})),S(t.message)}),R(E+1)}catch(a){var l;A((null===a||void 0===a||null===(l=a.response)||void 0===l?void 0:l.data)||(null===a||void 0===a?void 0:a.message)||"Error Adding App Credentials")}s(!1)},children:e=>{let s=e.isSubmitting,n=e.submitForm,i=e.values;return(0,v.jsx)(a.lV,{children:(0,v.jsx)(a.aF,{open:t,title:"Store Connection",handleClose:s||I?()=>{}:M,hideActions:!0,children:(0,v.jsx)(m.A,{showAll:!(null===O||void 0===O||!O.shop),isCreating:!(null!==O&&void 0!==O&&O.shop),currentStatus:null!==O&&void 0!==O&&O.shop?"Active":"Inactive",isSubmitting:s,loading:I,storePlatform:"".concat(u.hb.grazeCart),storeUrl:null===O||void 0===O?void 0:O.shop,hideReauthorize:!0,editable:!0,allowEdit:L,onEdit:()=>{W(!0)},onIntegrate:n,onReturn:M,onRemoveIntegration:q,isInvalid:!i.storeKey||!i.shop,renderCreatingFields:()=>(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.A,{platformType:u.hb.grazeCart}),(0,v.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:[(0,v.jsx)(a.D0,{component:r.A,name:"shop",label:"Shop URL",placeholder:"https://myfarm.grazecart.com",autoCapitalize:"off",disabled:!L&&!(null===O||void 0===O||!O.shop),isRequired:!0}),(0,v.jsx)(a.D0,{component:r.A,name:"storeKey",label:"API Key",autoComplete:"off",autoCapitalize:"off",disabled:!L&&!(null===O||void 0===O||!O.shop),isRequired:!0})]})]})})})})}})})}},51236(e,t,s){s.d(t,{A:()=>x});var n=s(98477),i=s(39698),l=s(64419),a=s(6601),o=s(2444),r=s(5924),d=s(78373),c=s(1739),u=s(55948),h=s(86417),m=s(51548),p=s(70038),v=s(61969),w=s(63203);const x=e=>{let t=e.active,s=e.handleClose,x=e.selectedShop,g=void 0===x?{}:x,y=e.webhooks,f=e.fetchingWebhooks,b=e.isOnboarding,j=e.fetchPrivateAppWebhooks,A=e.onComplete,S=e.user;const C=(0,l.useRef)(),N=(0,o.useDispatch)(),I=(0,v.A)(),D=I.toastError,k=I.toastSuccess,P=(0,l.useState)(!1),E=(0,i.A)(P,2),R=E[0],T=E[1],F=(0,l.useState)(0),O=(0,i.A)(F,2),_=O[0],B=O[1],U=(0,l.useState)(g),L=(0,i.A)(U,2),W=L[0],z=L[1],M=(0,l.useState)(""),q=(0,i.A)(M,2),V=q[0],K=q[1],Y=(0,l.useState)(""),G=(0,i.A)(Y,2),H=G[0],$=G[1],Q=(0,l.useState)(!1),J=(0,i.A)(Q,2),Z=J[0],X=J[1],ee=(0,l.useState)("enter-url"),te=(0,i.A)(ee,2),se=te[0],ne=te[1];(0,l.useEffect)(()=>{var e,t,s;let i=null===S||void 0===S||null===(e=S.shopDomains)||void 0===e?void 0:e.find(e=>(null===e||void 0===e?void 0:e.shop)===(null===g||void 0===g?void 0:g.shop));i=i?(0,n.A)({},i):null,null!==(t=i)&&void 0!==t&&null!==(s=t.shop)&&void 0!==s&&s.length&&(i.shop=(0,m.w$)(i.shop)),z(i)},[_,g]);let ie={shop:(null===W||void 0===W?void 0:W.shop)||"",apiKey:null!==W&&void 0!==W&&W.shop?"******************************":"",apiPassword:null!==W&&void 0!==W&&W.shop?"******************************":"",sharedSecret:null!==W&&void 0!==W&&W.shop?"******************************":"",showManualInstru
1ctions:!(null===W||void 0===W||!W.shop),originalShop:(null===W||void 0===W?void 0:W.shop)||""};const le=()=>{var e;ne("enter-url"),K(""),$(""),X(!1),s(),null!==C&&void 0!==C&&null!==(e=C.current)&&void 0!==e&&e.resetForm&&C.current.resetForm()},ae=async()=>{T(!0);try{let e=(0,m.w$)(W.shop);e="https://".concat(e,".myshopify.com");const t=(await c.Km.post("/private-app/credentials/remove",{platformType:h.hb.shopify,shopDomain:e})).data;(0,o.vA)(()=>{N((0,u.QO)({user:t.user})),k(t.message)}),B(_+1),le()}catch(t){var e;console.log((null===t||void 0===t?void 0:t.response)||t),D((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Integration")}T(!1)},oe=async()=>{try{T(!0);let e=(0,m.w$)(W.shop);e="https://".concat(e,".myshopify.com");const t=(await c.Km.post("/webhooks/remove",{platformType:h.hb.shopify,shopDomain:e})).data;await j(W,!0),t.success?(0,o.vA)(()=>{k(t.message)}):D(t),B(_+1)}catch(t){var e;D((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Webhooks")}T(!1)},re=async()=>{try{T(!0);let e=(0,m.w$)(W.shop);e="https://".concat(e,".myshopify.com");const t=(await c.Km.post("/webhooks/refresh",{platformType:h.hb.shopify,shopDomain:e})).data;await j(W,!1),t.success?(0,o.vA)(()=>{k(t.message)}):D(t.message),B(_+1)}catch(t){var e;D((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Refreshing Webhooks")}T(!1)},de=()=>{(0,m.VI)({currentShop:W})},ce=async()=>{if(V.trim()){T(!0),$("");try{let e=V.trim();e.startsWith("http://")||e.startsWith("https://")||(e="https://".concat(e)),e=e.replace(/\/+$/,"");const t=(await c.Km.post("/private-app/shopify/detect-store",{websiteUrl:e})).data;if(t.myshopifyDomain){const e=t.myshopifyDomain.replace(".myshopify.com","");$(e),X(!0)}}catch(e){}T(!1),ne("confirm-domain")}},ue=()=>{ne("enter-url"),$(""),X(!1)};return(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(a.l1,{enableReinitialize:!0,innerRef:C,initialValues:ie,onSubmit:async(e,t)=>{let s=t.setSubmitting;try{var i;let t,s=(0,m.w$)(e.shop);if(s="https://".concat(s,".myshopify.com"),null!==W&&void 0!==W&&W.shop){const i=await c.Km.post("/private-app/credentials/update",(0,n.A)((0,n.A)({},e),{},{platformType:h.hb.shopify,shopDomain:e.originalShop,updatedShopDomain:s}));t=i.data}else{const i=await c.Km.post("/private-app/credentials/new",(0,n.A)((0,n.A)({},e),{},{platformType:h.hb.shopify,shop:s}));t=i.data}const l=null===(i=t.user.shopDomains)||void 0===i?void 0:i.find(e=>e.shop===s&&e.platformType===h.hb.shopify);A(l,!1),(0,o.vA)(()=>{N((0,u.QO)({user:t.user})),k(t.message)}),B(_+1)}catch(a){var l;D((null===a||void 0===a||null===(l=a.response)||void 0===l?void 0:l.data)||(null===a||void 0===a?void 0:a.message)||"Error Adding App Credentials")}s(!1)},children:e=>{let s=e.isSubmitting;return(0,w.jsx)(a.lV,{children:(0,w.jsx)(a.aF,{open:t,title:"Store Connection",handleClose:s||R?()=>{}
1:le,hideActions:!(null===W||void 0===W||!W.shop),actionOverrideClasses:"enter-url"!==se?"!tw-justify-between":"",actions:null!==W&&void 0!==W&&W.shop?void 0:"enter-url"===se?[{label:"Next",disabled:R||!V.trim(),loading:R,onClick:ce,color:"secondary"}]:[{label:"Back",onClick:ue,color:"inherit",variant:"outlined"},{label:"Install App",color:"secondary",disabled:!H.trim(),onClick:()=>{var e;b&&localStorage.setItem("redirectBackToOnboarding","true"),window.location.href=(e=H,(0,m.VI)({currentShop:{shop:e},returnResult:!0}))}}],children:(0,w.jsx)(p.A,{hideCreatingActions:!0,currentStatus:null!==W&&void 0!==W&&W.shop?"Active":"Inactive",isSubmitting:s,loading:R,webhooks:y,fetchingWebhooks:f,storePlatform:h.hb.shopify,storeUrl:null===W||void 0===W?void 0:W.shop,isCreating:!(null!==W&&void 0!==W&&W.shop),hideReauthorize:!(null!==S&&void 0!==S&&S.shopifySignup),onRemoveIntegration:ae,onReauthorize:de,onRefreshWebhooks:re,onRemoveWebhooks:oe,renderCreatingFields:()=>(0,w.jsx)("div",{className:" tw-w-full",children:"enter-url"===se?(0,w.jsxs)("div",{children:[(0,w.jsx)(a.o5,{style:{marginBottom:20},children:"Please provide your store website URL"}),(0,w.jsx)(a.A_,{label:"Your Store Website URL",required:!0,placeholder:"https://yourdomain.com",value:V,onChange:e=>K(e.target.value)})]}):(0,w.jsxs)("div",{children:[Z?(0,w.jsx)(d.A,{className:"tw-w-full tw-mb-4",children:(0,w.jsx)("span",{children:"We automatically detected your myShopify URL based on the website you provided."})}):H.trim()?null:(0,w.jsx)(r.A,{className:"tw-w-full tw-mb-4 !tw-text-yellow-800 !tw-border-yellow-400 tw-bg-yellow-50",children:(0,w.jsx)("span",{children:"Could not detect a Shopify store URL. Please provide your myShopify domain."})}),(0,w.jsx)(a.A_,{label:"Your myShopify store handle",required:!0,adornmentClasses:"!tw-pl-16 !tw-pr-32",startAdornment:"https://",endAdornment:".myshopify.com",value:H,onChange:e=>$(e.target.value)})]})})})})})}})})}},11975(e,t,s){s.d(t,{A:()=>v});var n=s(98477),i=s(39698),l=s(64419),a=s(2444),o=s(6601),r=s(1739),d=s(55948),c=s(86417),u=s(70038),h=s(90717),m=s(61969),p=s(63203);const v=e=>{let t=e.active,s=e.handleClose,v=e.selectedShop,w=void 0===v?{}:v,x=e.user;const g=(0,a.useDispatch)(),y=(0,m.A)(),f=y.toastError,b=y.toastSuccess,j=(0,l.useState)(!1),A=(0,i.A)(j,2),S=A[0],C=A[1],N=(0,l.useState)(0),I=(0,i.A)(N,2),D=I[0],k=I[1],P=(0,l.useState)(w),E=(0,i.A)(P,2),R=E[0],T=E[1],F=(0,l.useState)(!0),O=(0,i.A)(F,2),_=O[0],B=(O[1],(0,l.useState)("")),U=(0,i.A)(B,2),L=U[0],W=U[1];(0,l.useEffect)(()=>{var e;let t=null===x||void 0===x||null===(e=x.shopDomains)||void 0===e?void 0:e.find(e=>(null===e||void 0===e?void 0:e.shop)===(null===w||void 0===w?void 0:w.shop));t=t?(0,n.A)({},t):null,T(t)},[D,w]);const z=()=>{s()},M=async()=>{C(!0);try{const e=(await r.Km.post("/private-app/square/accessToken",{platformType:c.hb.square,accessToken:L})).data;(0,a.vA)(()=>{g((0,d.QO)({user:e.user})),b(e.message)}),k(D+1),z()}catch(t){var e;console.log((null===t||void 0===t?void 0:t.response)||t),f((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Adding Integration")}C(!1)};return(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(o.aF,{open:t,title:"Store Connection",handleClose:S?()=>{}:z,hideActions:!0,children:(0,p.jsx)(u.A,{hideCreatingActions:!0,currentStatus:null!==R&&void 0!==R&&R.shop?"Active":"Inactive",loading:S,storePlatform:c.hb.square,storeUrl:null===R||void 0===R?void 0:R.shop,isCreating:!(null!==R&&void 0!==R&&R.shop),onRemoveIntegration:async()=>{C(!0);try{const e=(await r.Km.post("/private-app/credentials/remove",{platformType:c.hb.square,shopDomain:R.shop})).data;(0,a.vA)(()=>{g((0,d.QO)({user:e.user})),b(e.message)}),k(D+1),z()}catch(t){var e;console.log((null===t||void 0===t?void 0:t.response)||t),f((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Integration")}C(!1)},renderCreatingFields:()=>(0,p.jsxs)("div",{className:" tw-w-full",children:[(0,p.jsx)(o.o5,{style:{marginBottom:10},children:"Please Install Our Official Square App On Your Store To Sync Your Orders, Customers, And Products Seamlessly"}),_?(0,p.jsx)("div",{className:"tw-grid tw-place-items-center",children:(0,p.jsx)("div",{className:"tw-grid tw-place-items-center",children:(0,p.jsx)(o.$n,{color:"secondary",variant:"contained",fullWidth:!0,style:{marginTop:20},onClick:()=>window.open((0,h.L4)(),"_self"),children:"Install Square App"})})}):(0,p.jsxs)("div",{children:[(0,p.jsxs)("div",{className:"tw-flex tw-gap-4 tw-items-end",children:[(0,p.jsx)(o.A_,{label:"Square Sandbox Token",required:!0,value:L,onChange:e=>W(e.target.value)}),(0,p.jsx)(o.$n,{color:"primary",variant:"contained",onClick:M,disabled:!L,children:"Install Square App"})]}),(0,p.jsx)("div",{className:"tw-text-sm tw-italic",children:"Please, notice that this only exists in staging and development environment"})]})]})})})})}},64441(e,t,s){s.d(t,{A:()=>y});var n=s(98477),i=s(39698),l=s(64419),a=s(6601),o=s(2444),r=s(11841),d=s(54917),c=s(1739),u=s(55948),h=s(86417),m=s(11518),p=s(70038),v=s(37708),w=s(82391),x=s(61969),g=s(63203);const y=e=>{let t=e.active,s=e.handleClose,y=e.selectedShop,f=void 0===y?{}:y,b=e.onComplete,j=e.user,A=e.webhooks,S=e.fetchingWebhooks,C=e.setFetchingWebhooks,N=e.setWebhooks;const I=(0,l.useRef)(),D=(0,o.useDispatch)(),k=(0,x.A)(),P=k.toastError,E=k.toastSuccess,R=(0,l.useState)(!1),T=(0,i.A)(R,2),F=T[0],O=T[1],_=(0,l.useState)(0),B=(0,i.A)(_,2),U=B[0],L=B[1],W=(0,l.useState)(f),z=(0,i.A)(W,2),M=z[0],q=z[1],V=(0,l.useState)(!0),K=(0,i.A)(V,2),Y=K[0],G=K[1];(0,l.useEffect)(()=>{var e;const t=null===j||void 0===j||null===(e=j.shopDomains)||void 0===e?void 0:e.find(e=>(null===e||void 0===e?void 0:e.shop)===(null===f||void 0===f?void 0:f.shop));q(t)},[U,f]);const H={shop:(null===M||void 0===M?void 0:M.shop)||"",apiKey:"",originalShop:(null===M||void 0===M?void 0:M.shop)||""},$=()=>{var e;G(!0),s(),null!==I&&void 0!==I&&null!==(e=I.current)&&void 0!==e&&e.resetForm&&I.current.resetForm()},Q=async(e,t)=>{try{let s=e.shop;if(C(!0),t)N([]);else{const t=(await c.Km.post("/webhooks/list",{shopDomain:s,platformType:e.platformType})).data;N(t.webhooks)}C(!1)}catch(s){console.log((null===s||void 0===s?void 0:s.response)||s)}},J=async()=>{O(!0);try{const e=(await c.Km.post("/private-app/credentials/remove",{platformType:h.hb.squarespace,shopDomain:M.shop})).data;(0,o.vA)(()=>{D((0,u.QO)({user:e.user})),E(e.message)}),L(U+1),$()}catch(t){var e;console.log((null===t||void 0===t?void 0:t.response)||t),P((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Integration")}O(!1)},Z=async()=>{try{O(!0);const e=(await c.Km.post("/webhooks/remove",{platformType:h.hb.squarespace,shopDomain:M.shop})).data;await Q(M,!0),e.success?(0,o.vA)(()=>{E(e.message)}):P(e),L(U+1)}catch(t){var e;P((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Webhooks")}O(!1)},X=async()=>{try{O(!0);const e=(await c.Km.post("/webhooks/refresh",{platformType:h.hb.squarespace,shopDomain:M.shop})).data;await Q(M,!1),e.success?(0,o.vA)(()=>{E(e.message)}):P(e.message),L(U+1)}catch(t){var e;P((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Refreshing Webhooks")}O(!1)},ee=e=>{const t=w.ZO.clientId,s=w.ZO.oauthUrl,n=w.ZO.oauthRedirectUrl,i=e||M,l=(0,r.A)();localStorage.setItem("squarespace_data",JSON.stringify({stateNonce:l,shop:i.shop}));const a="".concat(s,"?client_id=").concat(t,"&redirect_uri=").concat(n,"&state=").concat(l);window.location.href=a};return(0,g.jsx)(g.Fragment,{children:(0,g.jsx)(a.l1,{enableReinitialize:!0,innerRef:I,initialValues:H,onSubmit:async(e,t)=>{let s=t.setSubmitting;try{var i;let t;const s=e.shop.replace(/\/$/,"");if(null!==M&&void 0!==M&&M.shop){const i=await c.Km.post("/private-app/credentials/update",(0,n.A)((0,n.A)({},e),{},{platformType:h.hb.squarespace,shopDomain:e.originalShop,updatedS
1hopDomain:s}));t=i.data}else{const i=await c.Km.post("/private-app/credentials/new",(0,n.A)((0,n.A)({},e),{},{platformType:h.hb.squarespace,shop:s}));t=i.data}const l=null===(i=t.user.shopDomains)||void 0===i?void 0:i.find(e=>e.shop===s&&e.platformType===h.hb.squarespace);b(l,!1),(0,o.vA)(()=>{D((0,u.QO)({user:t.user})),E(t.message)}),L(U+1),ee(l)}catch(a){var l;P((null===a||void 0===a||null===(l=a.response)||void 0===l?void 0:l.data)||(null===a||void 0===a?void 0:a.message)||"Error Adding App Credentials")}s(!1)},children:e=>{let s=e.isSubmitting,n=e.submitForm,i=e.values;return(0,g.jsx)(a.lV,{children:(0,g.jsxs)(a.aF,{open:t,title:"Store Connection",handleClose:s||F?()=>{}:$,hideActions:!0,children:[(0,g.jsx)(p.A,{isCreating:!(null!==M&&void 0!==M&&M.shop),currentStatus:null!==M&&void 0!==M&&M.shop?"Active":"Inactive",isSubmitting:s,loading:F,storePlatform:"".concat(h.hb.squarespace),storeUrl:null===M||void 0===M?void 0:M.shop,hideReauthorize:!0,editable:!0,allowEdit:Y,onEdit:()=>{G(!0)},onReturn:$,onIntegrate:n,onRemoveIntegration:J,isInvalid:!i.apiKey||!i.shop,renderCreatingFields:()=>(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(m.A,{platformType:h.hb.squarespace}),(0,g.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:[(0,g.jsx)(a.D0,{component:d.A,name:"shop",label:"Squarespace Domain",placeholder:"https://my-store.squarespace.com",autoCapitalize:"off",disabled:!Y&&!(null===M||void 0===M||!M.shop),isRequired:!0}),(0,g.jsx)(a.D0,{component:d.A,name:"apiKey",label:"API Key",autoComplete:"off",autoCapitalize:"off",disabled:!Y&&!(null===M||void 0===M||!M.shop),isRequired:!0})]})]})}),A&&null!==f&&void 0!==f&&f.isOauthVerified?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"tw-font-bold tw-text-base tw-text-secondary tw-mt-4",children:"Store Access Permissions"}),(0,g.jsx)("ul",{className:"mt-1 tw-pl-0",children:S?(0,g.jsx)("div",{style:{textAlign:"center"},children:(0,g.jsx)(a.P,{})}):Object.values(v.Sm).map(e=>{const t=null===A||void 0===A?void 0:A.find(t=>t.address===e.address);return(0,g.jsx)("li",{className:"tw-capitalize tw-list-none",children:t?(0,g.jsx)("span",{children:e.topic}):(0,g.jsx)("span",{className:"tw-text-red-600",children:e.topic})},e.topic)})}),(0,g.jsxs)("div",{className:"tw-m-4 tw-mr-0 tw-flex tw-space-x-4 tw-justify-end",children:[(null===A||void 0===A?void 0:A.length)>0?(0,g.jsx)(a.$n,{color:"error",variant:"outlined",disabled:s||F||S,loading:s||F||S,onClick:Z,style:{fontSize:14,height:38},children:"Remove Webhooks"}):null,(0,g.jsx)(a.$n,{variant:"contained",disabled:s||F||S,loading:s||F||S,onClick:X,style:{fontSize:14,height:38},children:"Refresh Webhooks"})]})]}):null,!f||null!==f&&void 0!==f&&f.isOauthVerified||!A?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"tw-font-bold tw-text-base tw-text-secondary tw-mt-4",children:"Store Access Permissions"}),(0,g.jsx)("div",{children:"Squarespace requires OAuth access to subscribe to Webhooks"}),(0,g.jsx)("div",{className:"tw-m-4 tw-mr-0 tw-flex tw-space-x-4 tw-justify-end",children:(0,g.jsx)(a.$n,{variant:"contained",disabled:s||F||S,loading:s||F||S,onClick:ee,style:{fontSize:14,height:38},children:"Authorize"})})]})]})})}})})}},68878(e,t,s){s.d(t,{A:()=>v});var n=s(98477),i=s(39698),l=s(64419),a=s(2444),o=s(6601),r=s(1739),d=s(55948),c=s(86417),u=s(70038),h=s(90717),m=s(61969),p=s(63203);const v=e=>{let t=e.active,s=e.handleClose,v=e.selectedShop,w=void 0===v?{}:v,x=e.user;const g=(0,a.useDispatch)(),y=(0,m.A)(),f=y.toastError,b=y.toastSuccess,j=(0,l.useState)(!1),A=(0,i.A)(j,2),S=A[0],C=A[1],N=(0,l.useState)(0),I=(0,i.A)(N,2),D=I[0],k=I[1],P=(0,l.useState)(w),E=(0,i.A)(P,2),R=E[0],T=E[1];(0,l.useEffect)(()=>{var e;let t=null===x||void 0===x||null===(e=x.shopDomains)||void 0===e?void 0:e.find(e=>(null===e||void 0===e?void 0:e.shop)===(null===w||void 0===w?void 0:w.shop));t=t?(0,n.A)({},t):null,T(t)},[D,w]);const F=()=>{s()};return(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(o.aF,{open:t,title:"Store Connection",handleClose:S?()=>{}:F,hideActions:!0,children:(0,p.jsx)(u.A,{hideCreatingActions:!0,currentStatus:null!==R&&void 0!==R&&R.shop?"Active":"Inactive",loading:S,storePlatform:c.hb.wix,storeUrl:null===R||void 0===R?void 0:R.shop,isCreating:!(null!==R&&void 0!==R&&R.shop),onRemoveIntegration:async()=>{C(!0);try{const e=(await r.Km.post("/private-app/credentials/remove",{platformType:c.hb.wix,shopDomain:R.shop})).data;(0,a.vA)(()=>{g((0,d.QO)({user:e.user})),b(e.message)}),k(D+1),F()}catch(t){var e;console.log((null===t||void 0===t?void 0:t.response)||t),f((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Integration")}C(!1)},renderCreatingFields:()=>(0,p.jsxs)("div",{className:" tw-w-full",children:[(0,p.jsx)(o.o5,{style:{marginBottom:10},children:"Please Install Our Official Wix App On Your Store To Sync Your Orders, Customers, And Products Seamlessly"}),(0,p.jsx)("div",{className:"tw-grid tw-place-items-center",children:(0,p.jsx)(o.$n,{color:"secondary",variant:"contained",fullWidth:!0,style:{marginTop:20},onClick:()=>window.open((0,h.uy)(),"_self"),children:"Install Wix App"})})]})})})})}},35486(e,t,s){s.d(t,{A:()=>x});var n=s(39698),i=s(64419),l=s(6601),a=s(2444),o=s(54917),r=s(1739),d=s(82391),c=s(55948),u=s(86417),h=s(11518),m=s(20910),p=s(70038),v=s(61969),w=s(63203);const x=e=>{let t=e.active,s=e.handleClose,x=e.selectedShop,g=void 0===x?{}:x,y=e.webhooks,f=e.fetchingWebhooks,b=e.fetchPrivateAppWebhooks,j=(e.onComplete,e.user);const A=(0,i.useRef)(),S=(0,a.useDispatch)(),C=(0,v.A)(),N=C.toastError,I=C.toastSuccess,D=(0,i.useState)(!1),k=(0,n.A)(D,2),P=k[0],E=k[1],R=(0,i.useState)(0),T=(0,n.A)(R,2),F=T[0],O=T[1],_=(0,i.useState)(g),B=(0,n.A)(_,2),U=B[0],L=B[1],W=(0,i.useState)(!1),z=(0,n.A)(W,2),M=z[0],q=z[1];(0,i.useEffect)(()=>{var e;const t=null===j||void 0===j||null===(e=j.shopDomains)||void 0===e?void 0:e.find(e=>(null===e||void 0===e?void 0:e.shop)===(null===g||void 0===g?void 0:g.shop));L(t)},[F,g]);let V={shop:(null===U||void 0===U?void 0:U.shop)||""};const K=()=>{var e;q(!1),s(),null!==A&&void 0!==A&&null!==(e=A.current)&&void 0!==e&&e.resetForm&&A.current.resetForm()},Y=async()=>{E(!0);try{const e=(await r.Km.post("/private-app/credentials/remove",{platformType:u.hb.woocommerce,shopDomain:U.shop})).data;(0,a.vA)(()=>{S((0,c.QO)({user:e.user})),I(e.message)}),O(F+1),K()}catch(t){var e;N((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Integration")}E(!1)},G=async()=>{try{E(!0);const e=(await r.Km.post("/webhooks/remove",{platformType:u.hb.woocommerce,shopDomain:U.shop})).data;await b(U,!0),e.success?(0,a.vA)(()=>{I(e.message)}):N(e),O(F+1)}catch(t){var e;N((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Removing Webhooks")}E(!1)},H=async()=>{try{E(!0);const e=(await r.Km.post("/webhooks/refresh",{platformType:u.hb.woocommerce,shopDomain:U.shop})).data;await b(U,!1),e.success?(0,a.vA)(()=>{I(e.message)}):N(e.message),O(F+1)}catch(t){var e;N((null===t||void 0===t||null===(e=t.response)||void 0===e?void 0:e.data)||(null===t||void 0===t?void 0:t.message)||"Error Refreshing Webhooks")}E(!1)};return(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(l.l1,{enableReinitialize:!0,innerRef:A,initialValues:V,onSubmit:async e=>{let t=e.shop.replace(/\/$/,"");const s=new URL(t);t=s.origin||s.protocol+s.hostname;const n={app_name:d.JB,scope:"read_write",user_id:j._id,return_url:"".concat(window.location.href,"&shop=").concat(t,"&integrationCallback=true"),callback_url:"".concat(d.aY,"/api/v1/private-app/woocommerce/accessToken?shop=").concat(t,"&userId=").concat(j._id)},i="".concat(t,"/wc-auth/v1/authorize?").concat((0,m.uG)(n));window.location.href=i},children:e=>{let s=e.isSubmitting,n=e.submitForm;return(0,w.jsx)(l.lV,{children:(0,w.jsx)(l.aF,{open:t,title:"Store Connection",handleClose:s||P?()=>{}:K,hideActions:!0,children:(0,w.jsx)(p.A,{isCreating:!(null!==U&&void 0!==U&&U.shop),currentStatus:null!==U&&void 0!==U&&U.shop?"Active":"Inactive",isSubmitting:s,loading:P,onEdit:()=>q(!0),onIntegrate:n,allowEdit:M,editable:!0,webhooks:y,fetchingWebhooks:f,storePlatform:"".concat(u.hb.woocommerce),storeUrl:null===U||void 0===U?void 0:U.shop,hideReauthorize:!0,onReturn:K,onRemoveIntegration:Y,onRefreshWebhooks:H,onRemoveWebhooks:G,renderCreatingFields:()=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.A,{platformType:u.hb.woocommerce,redirectTo:"".concat(d.GG,"/docs/woocommerce-integration")}),(0,w.jsx)(l.D0,{component:o.A,name:"shop",label:"Woocommerce Domain",placeholder:"https://my-store.com",disabled:!M&&!(null===U||void 0===U||!U.shop),autoComplete:"off",isRequired:!0})]})})})})}})})}},84594(e,t,s){s.d(t,{A:()=>a});var n=s(6601),i=s(52655),l=s(63203);const a=e=>{var t,s,a,o,r;let d=e.open,c=e.values,u=e.setShowAddressConfirmationModal,h=e.setFieldValue,m=e.onProceedWithSelectedAddress,p=e.onClose;const v=null!==(t=c.address)&&void 0!==t?t:{},w=null===c||void 0===c||null===(s=c.verifications)||void 0===s?void 0:s.suggestedAddress,x=!!w,g=!x&&(null===c||void 0===c||null===(a=c.verifications)||void 0===a?void 0:a.isInvalidStreet2);return(0,l.jsx)(n.aF,{open:d,handleClose:p,title:"Address Warning",hideActions:!0,children:(0,l.jsxs)("div",{children:[x?(0,l.jsx)("section",{children:(0,l.jsx)(n.o5,{className:"tw-text-sm tw-text-secondary tw-font-bold",children:"We were unable to verify your address, but we found a close match. Please carefully review our Recommendation and confirm the ship to address."})}):(0,l.jsx)("section",{children:(0,l.jsx)(n.o5,{className:"tw-text-sm tw-text-secondary tw-font-bold",children:"We were unable to verify your address. Select the address you would like to ship to."})}),(0,l.jsxs)("div",{className:"tw-grid lg:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,l.jsxs)("div",{className:"tw-border tw-border-transparent tw-p-2 tw-rounded-lg",children:[(0,l.jsx)("div",{className:"tw-font-bold",children:"You Entered"}),(0,l.jsxs)("div",{children:[null!==(o=v.street1)&&void 0!==o?o:"",v.street2?", ".concat(v.street2):""]}),(0,l.jsxs)("div",{children:[v.city,", ",v.state," ",v.zipCode]}),(0,l.jsx)("div",{children:null!==v&&void 0!==v&&v.residential?"Residential":"Commercial"})]}),x&&(0,l.jsxs)("div",{className:"tw-border-solid tw-border-secondary tw-p-2 tw-rounded-lg",children:[(0,l.jsx)("div",{className:"tw-font-bold tw-text-secondary",children:"Recommended"}),(0,l.jsxs)("div",{children:[null!==(r=w.street1)&&void 0!==r?r:"",w.street2?", ".concat(w.street2):""]}),(0,l.jsxs)("div",{children:[w.city,", ",w.state," ",w.zip]}),(0,l.jsx)("div",{children:null!==w&&void 0!==w&&w.residential?"Residential":"Commercial"})]})]}),g&&(0,l.jsx)("div",{className:"tw-mt-4",children:(0,l.jsx)(i.A,{address:v})}),(0,l.jsxs)("div",{className:"tw-flex tw-w-full tw-justify-between tw-mt-4",children:[(0,l.jsx)(n.$n,{variant:"outlined",onClick:()=>u(!1),children:"Back"}),(0,l.jsx)("div",{className:"tw-flex tw-space-x-4",children:x?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.$n,{variant:"outlined",onClick:()=>{h("ignoreSuggestedAddress",!0),m()},children:"Use Your Address"}),(0,l.jsx)(n.$n,{variant:"contained",color:"secondary",onClick:()=>
1{h("useSuggestedAddress",!0),m()},children:"Use Recommended"})]}):(0,l.jsx)(n.$n,{variant:"contained",color:"secondary",onClick:()=>u(!1),children:"Re-enter Address"})})]})]})})}},55685(e,t,s){s.r(t),s.d(t,{default:()=>bn});var n=s(64419),i=s(78270),l=s(98435),a=s(99841),o=s(98477),r=s(37643),d=s(2444),c=s(41924),u=s(6601),h=s(2141),m=s(63203);const p=["component","access","permissions","onlyParentAccount"],v=["/orders","/freight-orders","/private-app","/shipments"],w=e=>{let t=e.component,s=e.access,n=e.permissions,l=void 0===n?null:n,w=e.onlyParentAccount,x=void 0!==w&&w,g=(0,r.A)(e,p);const y=(0,d.useSelector)(e=>{var t,s,n,i,l;return{authenticated:null===e||void 0===e||null===(t=e.auth)||void 0===t||null===(s=t.user)||void 0===s?void 0:s._id,userAccessGroup:null===e||void 0===e||null===(n=e.auth)||void 0===n||null===(i=n.user)||void 0===i?void 0:i.group,user:null===e||void 0===e||null===(l=e.auth)||void 0===l?void 0:l.user}}),f=y.authenticated,b=y.userAccessGroup,j=y.user,A=(0,i.useLocation)();if(null!==j&&void 0!==j&&j.needAdminApproval&&v.includes(g.path))return(0,m.jsx)(i.Redirect,{to:{pathname:"/"}});if(f&&(!s||null!==s&&void 0!==s&&s.includes(b))&&(!x||j._id===j.teamId)){let e=!0;const s=(0,a.jL)(j);if(null!==l&&void 0!==l&&l.length&&s){e=l.map(e=>(0,a.Nn)(s.permissionsKeys,e)).every(e=>!0===e)}if(e)return(0,m.jsx)(i.Route,(0,o.A)((0,o.A)({},g),{},{children:(0,m.jsx)(c.A,{context:g.path,children:(0,m.jsx)(u.tH,{FallbackComponent:h.A,children:(0,m.jsx)(t,{})})})}))}return(0,m.jsx)(i.Redirect,{to:{pathname:"/",state:{from:A}}})};var x=s(39698);const g=(0,n.createContext)(),y=(0,n.createContext)(),f={count:0},b=(e,t)=>{switch(t.type){case"INCREMENT":return(0,o.A)((0,o.A)({},e),{},{count:e.count+1});case"DECREMENT":return(0,o.A)((0,o.A)({},e),{},{count:e.count-1});case"RESET":return(0,o.A)((0,o.A)({},e),{},{count:0});default:throw new Error("Unsupported action type ".concat(t.type))}},j=e=>{let t=e.children;const s=(0,n.useReducer)(b,f),i=(0,x.A)(s,2),l=i[0],a=i[1],o=(0,n.useMemo)(()=>[l,a],[l]);return(0,m.jsx)(g.Provider,{value:o[0],children:(0,m.jsx)(y.Provider,{value:o[1],children:t})})},A=e=>{let t=e.contexts,s=e.children;return t.reduceRight((e,t)=>n.cloneElement(t,{children:e}),s)},S=e=>(0,m.jsx)(A,(0,o.A)({contexts:[(0,m.jsx)(j,{})]},e));var C=s(82407),N=s(21596),I=s(55948),D=s(307),k=s(71889),P=s(29254),E=s(1739),R=s(38935),T=s(70680),F=s(46334),O=s(72516),_=s(82391),B=s(18425),U=s(61969);const L=e=>{var t,s,i,l,a,o,r,c,h,p,v,w,g;let y=e.show,f=e.onClose,b=e.selectedPlan,j=e.onUpdateSubscription,A=e.selectedPlanIsAnnual,S=e.currentTier,C=e.user;const N=(0,d.useDispatch)(),L=(0,U.A)(),W=L.toastError,z=L.toastSuccess,M=(0,n.useState)(null),q=(0,x.A)(M,2),V=q[0],K=q[1],Y=(0,n.useState)(!1),G=(0,x.A)(Y,2),H=G[0],$=G[1],Q=(0,n.useState)(!1),J=(0,x.A)(Q,2),Z=J[0],X=J[1],ee=(0,d.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.ach)||{}}),te=ee.loading,se=(0,B.R)(C).renewDate,ne=(0,D.VM)();(0,n.useEffect)(()=>{var e;let t;var s,n,i,l,a,o;null!==C&&void 0!==C&&null!==(e=C.chargebeeData)&&void 0!==e&&e.selectedPaymentSource&&(t=null===C||void 0===C||null===(s=C.paymentAccount)||void 0===s||null===(n=s.instruments)||void 0===n?void 0:n.find(e=>(null===e||void 0===e?void 0:e.id)===C.chargebeeData.selectedPaymentSource&&"card"===(null===e||void 0===e?void 0:e.type)),t||(t=null===C||void 0===C||null===(i=C.plaidBanks)||void 0===i?void 0:i.find(e=>(0,O.FC)(e)===C.chargebeeData.selectedPaymentSource)));t||(t="card"===(null===C||void 0===C?void 0:C.defaultPaymentMode)?null===C||void 0===C||null===(l=C.paymentAccount)||void 0===l||null===(a=l.instruments)||void 0===a?void 0:a.find(e=>{var t;return(null===e||void 0===e?void 0:e.id)===(null===(t=C.paymentAccount)||void 0===t?void 0:t.default)&&"card"===(null===e||void 0===e?void 0:e.type)}):null===C||void 0===C||null===(o=C.plaidBanks)||void 0===o?void 0:o.find(e=>e.isDefault));t&&K((0,O.FC)(t))},[y,null===C||void 0===C||null===(t=C.chargebeeData)||void 0===t?void 0:t.selectedPaymentSource,null===C||void 0===C?void 0:C.defaultPaymentMode,null===C||void 0===C?void 0:C.plaidBanks,null===C||void 0===C||null===(s=C.paymentAccount)||void 0===s?void 0:s.default,null===C||void 0===C||null===(i=C.paymentAccount)||void 0===i?void 0:i.instruments]);const ie=!S||(null!==(l=D.H9[b])&&void 0!==l?l:0)>=(null!==(a=D.H9[S])&&void 0!==a?a:0),le=S&&(null!==(o=D.H9[b])&&void 0!==o?o:0)<(null!==(r=D.H9[S])&&void 0!==r?r:0),ae=le&&!(null!==C&&void 0!==C&&C.selectedPlanIsAnnual),oe=le?(0,D.Yh)({currentTier:S,selectedPlan:b}):null,re=(()=>{var e,t,s,n,i;if(b===ne.trial.key&&!(0,D.qt)(C))return{subscriptionPrice:0,isCharge:!0,inTrial:!0};const l=A?(null===(e=ne[b])||void 0===e?void 0:e.annualPrice)||0:(null===(t=ne[b])||void 0===t?void 0:t.price)||0;if(!S||S===ne.trial.key)return{subscriptionPrice:l,isCharge:!0};const a=null!==C&&void 0!==C&&C.selectedPlanIsAnnual?(null===(s=ne[S])||void 0===s?void 0:s.annualPrice)||0:(null===(n=ne[S])||void 0===n?void 0:n.price)||0,o=null===C||void 0===C||null===(i=C.chargebeeData)||void 0===i?void 0:i.subscriptionDate;if(!o)return{subscriptionPrice:l,isCharge:!0};const r=(0,R.Ay)().diff(o,"days"),d=a/(0,R.Ay)().daysInMonth();let c,u;return ie?(c=l-d*r,u=!0,c=parseFloat((0,P.floatToTwo)(Math.abs(c))),c>l&&(c=l)):(c=-1*(l-(a-d*r)),u=!1,c=parseFloat((0,P.floatToTwo)(Math.abs(c))),c>a&&(c=a)),{subscriptionPrice:c,isCharge:u}})(),de=re.subscriptionPrice,ce=re.isCharge,ue=[],he=null===C||void 0===C||null===(c=C.paymentAccount)||void 0===c||null===(h=c.instruments)||void 0===h?void 0:h.filter(e=>"card"===e.type);null!==C&&void 0!==C&&null!==(p=C.paymentAccount)&&void 0!==p&&null!==(v=p.instruments)&&void 0!==v&&v.length&&ue.push(...he);const me=null===C||void 0===C||null===(w=C.plaidBanks)||void 0===w?void 0:w.filter(e=>(0,O.FC)(e));null!==me&&void 0!==me&&me.length&&ue.push(...me);const pe=(null===(g=ne[b])||void 0===g?void 0:g.name)||"No Subscription";return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(F.A,{isOpen:Z,closeModal:()=>X(!1)}),(0,m.jsx)(u.aF,{maxWidth:"sm",open:y,title:"".concat(ie?"Upgrade":"Downgrade"," to ").concat((0,k.startCase)(b)).concat(A?" - Annual":""),handleClose:()=>{f()},actions:[{isClose:!0},{isPrimary:!0,onClick:async()=>{$(!0);
1try{const e={selectedPlan:b,selectedPlanIsAnnual:A,selectedPaymentSource:V},t=(await E.FH.post("/user/v1/update-subscription",e)).data;(0,d.vA)(()=>{f(),N((0,I.QO)({user:t.user})),z(t.message),N((0,I.lB)({paywallConfig:{show:!1,goBack:!1}})),null===j||void 0===j||j()})}catch(s){var e,t;if(console.log(s),"NO_PAYMENT_METHOD_ERROR"===((null===s||void 0===s||null===(e=s.response)||void 0===e?void 0:e.data)||(null===s||void 0===s?void 0:s.message)))W((0,m.jsxs)("span",{children:["No default payment method found. Visit"," ",(0,m.jsx)("a",{href:"".concat(_.GG,"/billing"),children:(0,m.jsx)("b",{children:"Billing"})}),", set a new primary method, and try again"]}));else W((null===s||void 0===s||null===(t=s.response)||void 0===t?void 0:t.data)||(null===s||void 0===s?void 0:s.message))}$(!1)},label:"Update",disabled:H||te,loading:H||te}],children:(0,m.jsxs)("div",{children:[(0,m.jsxs)(u.o5,{variant:"body1",style:{padding:"10px 0"},children:["Your subscription will be ",ie?"upgraded":"downgraded"," to the"," ",(0,m.jsx)("span",{className:"".concat((0,D.oT)(pe)," !tw-font-bold"),children:pe}),(0,m.jsx)("span",{children:" Plan"}),ae&&se&&(0,m.jsxs)(m.Fragment,{children:[" ","at the end of the billing cycle (",(0,R.Ay)(se).format(T.DX),")"]})]}),oe&&(oe.lostFeatures.length>0||oe.reducedFeatures.length>0)&&(0,m.jsxs)("div",{style:{padding:"10px 0"},children:[(0,m.jsx)(u.o5,{variant:"body1",style:{fontWeight:"bold"},children:"You will lose access to:"}),oe.lostFeatures.map(e=>(0,m.jsx)(u.o5,{variant:"body1",children:(0,m.jsx)("span",{style:{textDecoration:"line-through"},children:e})},e)),oe.reducedFeatures.map(e=>(0,m.jsxs)(u.o5,{variant:"body1",children:[(0,m.jsx)("span",{style:{textDecoration:"line-through"},children:e.from})," \u2192 ",e.to]},e.feature))]}),!ae&&(0,m.jsx)(u.o5,{variant:"body1",style:{padding:"10px 0"},children:ce?(0,m.jsxs)("span",{children:["You'll be charged a ",(0,m.jsx)("b",{children:(0,P.toCurrencyFormat)(de)})," ","plan fee on the ",se?(0,R.Ay)(se).format("Do"):""," ","of every month. Cancel Anytime."]}):(0,m.jsxs)("span",{children:["You'll be credited a"," ",(0,m.jsx)("b",{children:(0,P.toCurrencyFormat)(de)})," to your account for downgrading your subscription."]})})]})})]})};var W=s(68163),z=s(14200),M=s(48923),q=s(83311);const V=e=>{let t=e.setSelectedPlan,s=e.currentTier,n=e.onCancelSubscription,i=e.showPricing,l=e.setShowPricing;const a=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),o=a||{},r=o.isSubscriptionPaused,c=o.isSubscriptionCanceled,h=(0,(0,z.k)().getAvailableAmount)(),p=(0,P.centsToCurrencyFormat)(h),v=p.includes("-"),w="Subscription changes are not allowed until remaining balance of ".concat(p," is settled"),x=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.selectedPlanIsAnnual}),g=(0,D.VM)(),y=g[(0,D.YB)(a)],f=((null===a||void 0===a?void 0:a.chargebeeData)||{}).scheduledDowngrade;return i?(0,m.jsx)(q.A,{selectedPlanAfterTrial:s,scheduledDowngradePlan:null===f||void 0===f?void 0:f.plan,onSelectPlan:e=>{t(e),l(!1)}}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("ul",{className:"tw-text-lg tw-grid tw-grid-cols-2 tw-gap-4 tw-list-none tw-p-0",children:Object.values(g).filter(e=>"trial"!==(null===e||void 0===e?void 0:e.key)).map(e=>{const n=s===e.key&&"v1"===(null===a||void 0===a?void 0:a.subscriptionVersion),i=(null===f||void 0===f?void 0:f.plan)===e.key,l=n||i;return(0,m.jsxs)("li",{className:"tw-text-center tw-border tw-border-solid tw-rounded-lg tw-p-2 hover:tw-bg-orange-100 hover:tw-border-primary tw-transition-colors tw-duration-300 tw-cursor-pointer ".concat(l?"tw-bg-orange-100 !tw-cursor-default tw-border-none":""),onClick:()=>{l||t(e.key)},disabled:l,children:[(0,m.jsx)("div",{className:"".concat((0,D.oT)(e.key)," tw-text-2xl tw-font-bold"),children:(0,k.capitalize)(e.key)}),(0,m.jsxs)("div",{children:[(0,P.toCurrencyFormatNoDecimals)(x?e.annualPrice:e.price),"/",x?"yr":"mo"]}),(0,m.jsxs)("div",{className:"tw-text-xs tw-italic",children:["+ ",(0,P.toCurrencyFormat)(e.labelFee)," Per Label"]}),i&&(0,m.jsx)("div",{className:"tw-text-xs tw-font-semibold tw-text-gray-500 tw-mt-1",children:"Downgrade Scheduled"})]},e.key)})}),(0,m.jsxs)("div",{className:(0,M.cn)("tw-flex tw-w-full tw-justify-between tw-mt-8",(c||r||!(null!==y&&void 0!==y&&y.name))&&"!tw-justify-end"),children:[c||r||null===y||void 0===y||!y.name?null:(0,m.jsx)(u.m_,{classes:"tw-max-w-none",title:v?w:null,children:(0,m.jsx)("span",{children:(0,m.jsx)(u.$
1n,{disabled:v,onClick:n,color:"error",variant:"text",className:"hover:tw-border hover:tw-border-solid hover:tw-border-error",children:"Cancel Plan"})})}),(0,m.jsx)(u.$n,{disabled:v,color:"secondary",variant:"contained",onClick:()=>l(!0),children:"Plan Details"})]})]})};var K=s(46612);const Y=()=>{const e=(0,d.useDispatch)(),t=(0,i.useHistory)(),s=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),l=(0,d.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.paywallConfig)||{}}),a=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.selectedPlanIsAnnual}),o=(0,n.useState)(null),r=(0,x.A)(o,2),c=r[0],h=r[1],p=(0,n.useState)(!1),v=(0,x.A)(p,2),w=v[0],g=v[1],y=(0,n.useState)(!1),f=(0,x.A)(y,2),b=f[0],j=f[1],A=(0,n.useState)(!1),S=(0,x.A)(A,2),C=S[0],N=S[1],k=(0,D.VM)(s),P=(0,D.YB)(s);(0,n.useEffect)(()=>{let e=P;if(l.feature)for(const t of Object.values(k))if(!t.paywalledFeatures.includes(l.feature)){e=t.key;break}e&&!c&&h(e)},[P,l.show,l.feature,k,c]);const E=()=>{sessionStorage.setItem("paywallClosed",!0),e((0,I.lB)({paywallConfig:{show:!1,goBack:!1}})),l.goBack&&("POP"!==t.action?t.goBack():t.push(""))};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(L,{show:w,onClose:()=>{g(!1),E()},selectedPlan:c,selectedPlanIsAnnual:a,currentTier:P,user:s,onUpdateSubscription:(null===l||void 0===l?void 0:l.onUpdateSubscription)||void 0}),(0,m.jsx)(K.A,{isOpen:b,onClose:()=>{j(!1),E()},handleDowngradeToStartPlan:()=>{var e,t;j(!1),h(null===(e=(0,D.VM)())||void 0===e||null===(t=e.start)||void 0===t?void 0:t.key),g(!0)}}),(0,m.jsx)(u.aF,{maxWidth:C?"lg":"xs",hideActions:!0,title:C?(0,m.jsxs)("span",{className:"tw-flex tw-items-center tw-gap-2",children:[(0,m.jsx)(W.JGc,{className:"tw-text-black tw-cursor-pointer",width:"32",height:"32",onClick:()=>N(!1)}),"Pricing"]}):"Select Plan",open:l.show&&!w&&!b,handleClose:()=>{N(!1),E()},actions:[{isClose:!0,hide:!P}],PaperProps:{className:C?"tw-max-w-full":""},contentClass:C&&"!tw-p-0 !tw-pt-4",children:(0,m.jsx)(V,{selectedPlan:c,onCancelSubscription:()=>{j(!0)},setSelectedPlan:e=>{h(e),g(!0)},currentTier:P,showPricing:C,setShowPricing:N})})]})};var G=s(38990),H=s(68202),$=s(49118),Q=s(60729);const J=()=>{var e,t;const s=(0,d.useDispatch)(),i=(0,n.useState)(!1),l=(0,x.A)(i,2),a=l[0],o=l[1],r=(0,n.useState)(!1),c=(0,x.A)(r,2),h=c[0],p=c[1],v=(0,Q.J1)().printWithDryIceLabelCheck,w=(0,d.useSelector)(e=>{var t,s,n,i,l,a;return{purchasedOrders:null===e||void 0===e||null===(t=e.orders)||void 0===t?void 0:t.purchasedOrders,showPrintLabelsModal:null===e||void 0===e||null===(s=e.orders)||void 0===s?void 0:s.showPrintLabelsModal,bulkPrintLabelsReady:null===e||void 0===e||null===(n=e.orders)||void 0===n?void 0:n.bulkPrintLabelsReady,currentOrders:null===e||void 0===e||null===(i=e.orders)||void 0===i?void 0:i.orders,user:null===e||void 0===e||null===(l=e.auth)||void 0===l?void 0:l.user,progressReport:null===e||void 0===e||null===(a=e.auth)||void 0===a?void 0:a.progressReport}}),g=w.purchasedOrders,y=w.showPrintLabelsModal,f=w.bulkPrintLabelsReady,b=w.currentOrders,j=w.user,A=w.progressReport,S=null===A||void 0===A||null===(e=A.bulkBuy)||void 0===e?void 0:e.done,C=null===A||void 0===A||null===(t=A.bulkBuy)||void 0===t?void 0:t.total,N=Math.round(100*S/C),D=[];var k;null!==g&&void 0!==g&&g.orderId||(null===(k=Object.entries(g))||void 0===k||k.forEach(e=>{let t=(0,x.A)(e,1)[0];["tipAmount","amountToPurchase","shipDate","batchId","orderIds","orderNumber","orderId"].includes(t)||D.push({selected:!0,_id:t,user:j,index:-1,currentOrders:b})}));(0,n.useEffect)(()=>{(null===D||void 0===D?void 0:D.length)&&(async()=>{const e=(await E.Km.post("/orders/orders/fetchByIds",D.map(e=>e._id))).data;e&&o(!e.error&&e.some(e=>{var t,s;return!(null!==e&&void 0!==e&&null!==(t=e.errorsAndWarnings)&&void 0!==t&&t.orderError)&&(null===e||void 0===e||null===(s=e.shipments)||void 0===s?void 0:s.some(e=>{var t;return!(null!==e&&void 0!==e&&null!==(t=e.error)&&void 0!==t&&t.shipmentError)}))}))})()},[null===D||void 0===D?void 0:D.length,f]);const P=()=>{p(!1),s((0,I.CW)({showPrintLabelsModal:!1,bulkPrintLabelsReady:!1,purchasedOrders:{}}))},R=async()=>{var e;p(!1);const t=null!==g&&void 0!==g&&g.orderIds?null===g||void 0===g?void 0:g.orderIds:Object.keys(g),n=null===t||void 0===t||null===(e=t.filter(e=>!["tipAmount","amountToPurchase","shipDate","batchId","orderIds","orderNumber","orderId"].includes(e)))||void 0===e?void 0:e.join(",");if(null!==t&&void 0!==t&&t.length)try{const e=(await E.Km.post("/print-history",{search:"?shipmentStatus=processing&create=".concat(G.UG.ALL,"&orderIds=").concat(n),type:H.R.ORDERS,method:H.t.CLIENT,create:G.UG.ALL})).data;s((0,$.p8)(e))}catch(i){console.log((null===i||void 0===i?void 0:i.response)||i)}(0,d.vA)(()=>{var e,t;s((0,I.CW)({showPrintLabelsModal:!1,bulkPrintLabelsReady:!1}));const i=null!==(e=null===(t=Object.keys(g))||void 0===t?void 0:t.filter(e=>"tipAmount"!==e))&&void 0!==e?e:[];null!==i&&void 0!==i&&i.length&&(window.open("/orders/orderbulk-pdf?shipmentStatus=processing&create=".concat(G.UG.ALL,"&orderIds=").concat(n,"&removeInvalidShipments=true"),"_blank"),s((0,I.CW)({purchasedOrders:{}})))})};return(0,m.jsxs)(u.aF,{maxWidth:"xs",open:y,title:"Print Labels",handleClose:P,actions:[{isClose:!0,onClick:()=>
1h?P():p(!0),label:h?"Print Later":"Cancel"},{isPrimary:!0,onClick:()=>{const e=null!==g&&void 0!==g&&g.orderIds?g.orderIds:Object.keys(g).filter(e=>!["tipAmount","amountToPurchase","shipDate","batchId","orderIds","orderNumber","orderId"].includes(e)),t=null===b||void 0===b?void 0:b.filter(t=>e.includes(t._id));v(G.UG.ALL,R,null!==t&&void 0!==t&&t.length?t:null)},label:"Download",loading:!f,disabled:!f||!a}],children:[(0,m.jsxs)("div",{className:"flex align-items-center",style:{gap:8},children:[(0,m.jsx)(u.P,{size:"22px",variant:"determinate",value:f?100:N}),f?(0,m.jsx)(u.o5,{children:"Download all purchased labels"}):(0,m.jsx)(u.o5,{children:"Please, wait until all orders are processed"})]}),h?(0,m.jsx)(u.o5,{color:"error",style:{padding:"0 24px 14px 24px"},children:"Are you sure you want to dismiss? If you close it now, you will be able to print later, but not all orders from this bulk operation at the same time."}):null]})},Z=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=(0,d.useDispatch)(),i=(0,d.useSelector)(e=>{var t,s;return null===e||void 0===e||null===(t=e.auth)||void 0===t||null===(s=t.user)||void 0===s?void 0:s.selectedPlan}
1);(0,n.useEffect)(()=>{!e&&i||sessionStorage.getItem("paywallClosed")||s((0,I.lB)({paywallConfig:{show:!0,goBack:!i||t}}))},[s,i,e,t])};var X=s(45198);const ee=()=>{const e=(0,d.useDispatch)(),t=(0,i.useLocation)(),s=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),l=(0,U.A)(),a=l.toastError,o=l.toastSuccess,r=l.toastInfo,c=(0,n.useRef)(!1),u=(0,n.useCallback)(async()=>{if((0,X.Ay)(t.pathname))return;const s=(await E.FH.get("/users/v1/get-multi-merchants")).data;e((0,I.lB)({linkedAccounts:(null===s||void 0===s?void 0:s.connectedCompanies)||[]}))},[e]),h=(0,n.useCallback)(async e=>{if(!c.current){c.current=!0;try{const t=(await E.FH.post("/users/v1/validate-multi-merchant-keys",e)).data;o((null===t||void 0===t?void 0:t.message)||"Invite accepted successfully"),await u()}catch(d){var t,n,i,l;const o=(null===d||void 0===d||null===(t=d.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.message)||(null===d||void 0===d||null===(i=d.response)||void 0===i?void 0:i.data)||(null===d||void 0===d?void 0:d.message)||"Error accepting invite",c="string"===typeof o&&o.toLowerCase().includes("already connected"),h="string"===typeof o&&o.toLowerCase().includes("no account found");c?(r(o),await u()):h&&e.invitedEmail&&null!==s&&void 0!==s&&s.email&&s.email!==e.invitedEmail&&s.companyEmail!==e.invitedEmail?a("This invite is for ".concat(e.invitedEmail,". You're logged in as ").concat(s.companyEmail||s.email,". Please log out and register with the invited email using the link.")):null!==d&&void 0!==d&&null!==(l=d.response)&&void 0!==l&&l.status?a(o):a("Something went wrong. Please try again.")}finally{c.current=!1,sessionStorage.removeItem("multiMerchant")}}},[s,o,r,a,u]),m=(0,n.useRef)(h);m.current=h,(0,n.useEffect)(()=>{var e,t;let s;try{s=JSON.parse(sessionStorage.getItem("multiMerchant"))}catch(n){sessionStorage.removeItem("multiMerchant")}null!==(e=s)&&void 0!==e&&e.invitingKey&&null!==(t=s)&&void 0!==t&&t.connectionId?m.current(s):u()},[u])},te=()=>{const e=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),t=(0,U.A)(),s=t.toastError,i=t.toastSuccess,l=t.toastInfo,a=(0,n.useRef)(!1);(0,n.useEffect)(()=>{(async()=>{if(a.current)return;const t=sessionStorage.getItem("threePlInvite");if(!t)return;const n=JSON.parse(t),o=n.accountId,r=n.acceptToken,d=n.invitedEmail;if(o){a.current=!0;try{const e={accountId:o};r&&(e.acceptToken=r);const t=(await E.Km.post("/3pl/accept",e)).data;i((null===t||void 0===t?void 0:t.message)||"Invite accepted successfully")}catch(p){var c,u,h,m;const t=(null===p||void 0===p||null===(c=p.response)||void 0===c||null===(u=c.data)||void 0===u?void 0:u.message)||(null===p||void 0===p||null===(h=p.response)||void 0===h?void 0:h.data)||(null===p||void 0===p?void 0:p.message)||"Error accepting invite",n="string"===typeof t&&t.toLowerCase().includes("already connected"),i="string"===typeof t&&t.toLowerCase().includes("no account found");n?l(t):i&&d&&null!==e&&void 0!==e&&e.email&&e.email!==d&&e.companyEmail!==d?s("This invite is for ".concat(d,". You're logged in as ").concat(e.companyEmail||e.email,". Please log out and register with the invited email using the link.")):null!==p&&void 0!==p&&null!==(m=p.response)&&void 0!==m&&m.status?s(t):s("Something went wrong. Please try again.")}finally{a.current=!1,sessionStorage.removeItem("threePlInvite")}}})()},[e,s,i,l])},se=["show","renderContent","manualClose"],ne=()=>{const e=(0,d.useDispatch)(),t=(0,d.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.notificationConfig)||{}}),s=t.show,n=t.renderContent,i=(t.manualClose,(0,r.A)(t,se));return(0,m.jsx)(u.aF,(0,o.A)((0,o.A)({open:!!s,title:null===t||void 0===t?void 0:t.title,fullWidth:null===t||void 0===t?void 0:t.fullWidth,paperStyle:null===t||void 0===t?void 0:t.paperStyle,maxWidth:null===t||void 0===t?void 0:t.maxWidth,handleClose:()=>{var s;e((0,I.lB)({notificationConfig:{show:!1,title:"",fullWidth:!1,paperStyle:{},maxWidth:"md",renderContent:null,manualClose:!0}})),null===t||void 0===t||null===(s=t.handleClose)||void 0===s||s.call(t)}},i),{},{children:(null===n||void 0===n?void 0:n())||null}))},ie=()=>{var e,t;const s=(0,d.useDispatch)(),l=(0,i.useHistory)(),a=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),r=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.notificationConfig}),c=(null===a||void 0===a||null===(e=a.chargebeeData)||void 0===e?void 0:e.renewFailed)&&(null===a||void 0===a||null===(t=a.chargebeeData)||void 0===t?void 0:t.isSubscriptionPaused),h=null===r||void 0===r?void 0:r.manualClose;(0,n.useEffect)(()=>(!c||h||s((0,I.lB)({notificationConfig:{show:!0,fullWidth:!0,maxWidth:"sm",paperStyle:{paddingBottom:16},title:"Subscription Paused Due to Payment Issue",renderContent:()=>(0,m.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,m.jsx)(u.o5,{children:"Your subscription has been paused due to a hiccup with your recent payment. Not to worry, these things happen!"}),(0,m.jsxs)(u.o5,{children:["To resume your subscription, simply head over to \xa0",(0,m.jsx)("a",{href:"#",onClick:e=>{e.preventDefault(),e.stopPropagation(),l.push("/billing"),s((0,I.lB)({notificationConfig:(0,o.A)((0,o.A)({},r),{},{show:!1})}))},children:"Billing"}),", and follow the prompts to resume your subscription."]})]})}}
1)),()=>null),[c,s,null===r||void 0===r?void 0:r.manualClose])},le=()=>{(0,n.useEffect)(()=>{window.location.origin.includes("ship.vndr.com")&&!_.GG.includes("ship.vndr.com")&&(window.location.href=_.GG)},[])};var ae=s(11426),oe=s(4721);const re=()=>{const e=(0,d.useDispatch)(),t=(0,U.A)(),s=t.notifyWarning,l=t.toastError,a=(0,i.useHistory)(),r=(0,d.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.ach)||{}}),c=r.data,u=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),h=(0,n.useCallback)(async(t,s)=>{try{let n="/plaid/update-bank";const i=(await E.Km.post(n,{token:t,metadata:s})).data;(0,d.vA)(()=>{e((0,I.QO)({user:i.user})),e((0,I.Gg)((0,o.A)({notice:i.message||"Bank Successfully Updated"},oe.Ay[null!==i&&void 0!==i&&i.status?i.status.toUpperCase():"SUCCESS"])))}),null!==c&&void 0!==c&&c.onComplete&&c.onComplete()}catch(i){var n;l((null===i||void 0===i||null===(n=i.response)||void 0===n?void 0:n.data)||(null===i||void 0===i?void 0:i.message)||"Something Went Wrong")}e((0,I.lB)({ach:{loading:!1,data:null}})),localStorage.removeItem("plaidToken"),null!==c&&void 0!==c&&c.isOAuth&&a.push("billing")},[e,c,a,l]),p=(0,n.useCallback)(async(t,n)=>{try{if(null!==c&&void 0!==c&&c.accountId&&("TOO_MANY_VERIFICATION_ATTEMPTS"===t.error_code||"requires_credentials"===n.status)){var i;const t=null===u||void 0===u||null===(i=u.plaidBanks)||void 0===i?void 0:i.find(e=>e.accountData.account_id===c.accountId),s=(0,o.A)((0,o.A)({},t.accountData),{},{account:(0,o.A)((0,o.A)({},t.accountData),{},{verification_status:"verification_failed"})});let n="/plaid/update-bank";const l=(await E.Km.post(n,{metadata:s})).data;return(0,d.vA)(()=>{e((0,I.QO)({user:l.user})),e((0,I.Gg)((0,o.A)({notice:l.message||"Bank Successfully Updated"},oe.Ay[null!==l&&void 0!==l&&l.status?l.status.toUpperCase():"SUCCESS"])))}),void(null!==c&&void 0!==c&&c.onComplete&&c.onComplete())}if(null!==c&&void 0!==c&&c.accountId&&"PRODUCT_NOT_READY"===t.error_code){const e=oe.lw.ACCOUNT_NOT_READY;return void s(e)}let l="/logging/new";const a={type:"PLAID",data:{err:t,metadata:n}};if(E.Km.post(l,a),null!==c&&void 0!==c&&c.accountId){const t=c;delete t.accountId,e((0,I.lB)({ach:{loading:!1,data:t}}))}}catch(l){console.log("ERROR"),console.error((null===l||void 0===l?void 0:l.response)||l)}e((0,I.lB)({ach:{loading:!1,data:null}})),localStorage.removeItem("plaidToken"),null!==c&&void 0!==c&&c.isOAuth&&a.push("billing")},[c,e,a,null===u||void 0===u?void 0:u.plaidBanks,s]),v={token:null===c||void 0===c?void 0:c.token,onSuccess:h,onExit:p,receivedRedirectUri:null!==c&&void 0!==c&&c.isOAuth?window.location.href:void 0},w=(0,ae.usePlaidLink)(v),x=w.open,g=w.ready,y=w.error;return(0,n.useEffect)(()=>{y&&l(y)},[y,e,l]),(0,n.useEffect)(()=>{g&&null!==c&&void 0!==c&&c.token&&x()},[g,x,null===c||void 0===c?void 0:c.token,l]),(0,n.useEffect)(()=>{null===c||void 0===c||!c.token||null!==c&&void 0!==c&&c.isOAuth||localStorage.setItem("plaidToken",null===c||void 0===c?void 0:c.token)},[null===c||void 0===c?void 0:c.token,null===c||void 0===c?void 0:c.isOAuth]),(0,m.jsx)(n.Fragment,{})};var de=s(59774);const ce=(0,k.debounce)(e=>e(),1e3),ue=()=>{const e=(0,d.useDispatch)(),t=(0,U.A)().toastError,s=(0,i.useHistory)(),l=(0,d.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.ach)||{}}),a=l.data,r=(0,n.useCallback)(async n=>{try{let t="/payments/add-bank";const s=(await E.Km.post(t,{billingRequest:n})).data;(0,d.vA)(()=>{e((0,I.QO)({user:s.user})),e((0,I.Gg)((0,o.A)({notice:s.message||"Bank Successfully Updated"},oe.Ay[null!==s&&void 0!==s&&s.status?s.status.toUpperCase():"SUCCESS"])))})}catch(p){var i,l,r,c,u,h,m;t((null===p||void 0===p||null===(i=p.response)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.message)||(null===p||void 0===p||null===(r=p.response)||void 0===r?void 0:r.data)||(null===p||void 0===p?void 0:p.message)||"Something Went Wrong"),null!==p&&void 0!==p&&null!==(c=p.response)&&void 0!==c&&null!==(u=c.data)&&void 0!==u&&u.user&&e((0,I.QO)({user:p.response.data.user})),null!==p&&void 0!==p&&null!==(h=p.response)&&void 0!==h&&null!==(m=h.data)&&void 0!==m&&m.redirect&&s.push("/dashboard")}null!==a&&void 0!==a&&a.onComplete&&a.onComplete(),e((0,I.lB)({ach:{loading:!1,data:null}}))}
1,[a,e,s,t]),c=(0,n.useCallback)(async(t,s)=>{try{let e="/logging/new";const n={type:"GoCardless",data:{err:t,metadata:s}};E.Km.post(e,n)}catch(n){console.log("ERROR"),console.error((null===n||void 0===n?void 0:n.response)||n)}null!==a&&void 0!==a&&a.onComplete&&a.onComplete(),e((0,I.lB)({ach:{loading:!1,data:null}}))},[a,e]),u={billingRequestFlowID:null===a||void 0===a?void 0:a.id,environment:_.zU,onSuccess:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return ce(()=>r(...t))},onExit:c},h=(0,de.p)(u),p=h.open,v=h.ready,w=h.error;return(0,n.useEffect)(()=>{w&&t(w)},[w,e,t]),(0,n.useEffect)(()=>{v&&null!==a&&void 0!==a&&a.id&&p()},[v,p,null===a||void 0===a?void 0:a.id,t]),(0,m.jsx)(n.Fragment,{})};var he=s(74496),me=s(46519);const pe="customNotifications",ve=()=>{const e=(0,i.useHistory)(),t=(0,d.useDispatch)(),s=(()=>{const e=(0,d.useDispatch)(),t=(0,i.useLocation)(),s=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.customNotifications)||void 0===t?void 0:t.seenNotifications});return{getCustomNotifications:async()=>{if((0,X.Ay)(t.pathname))return;const s=(0,me.t)(pe,864e5);if(null!==s&&void 0!==s&&s.length)return e((0,I.bp)({notifications:s})),s;try{const t=(await E.Km.get("/custom-alert")).data,s=(null===t||void 0===t?void 0:t.customAlerts)||[];return(0,me.l)(pe,s),e((0,I.bp)({notifications:s})),s}catch(n){console.error("Error fetching custom notifications:",n)}},isValidNotification:e=>{var t,n;return!(null===e||void 0===e||null===(t=e.conditions)||void 0===t||!t.length)&&(!s.includes(e._id)&&(null===e||void 0===e||null===(n=e.conditions)||void 0===n?void 0:n.every(e=>{var t,s;const n=null===(t=he.mZ[e.field])||void 0===t?void 0:t.call(he.mZ),i=null===(s=he.US[e.field])||void 0===s?void 0:s.call(he.US,e.value);return he.sQ[e.validator](n,i)})))}}})(),l=s.getCustomNotifications,a=s.isValidNotification,o={0:"flex-start",1:"center",2:"flex-end"},r=e=>{(0,d.vA)(()=>{t((0,I.lB)({notificationConfig:{show:!1}})),t((0,I.bp)({seenNotification:e._id}))})},c={[he.X2.close]:r,[he.X2.link]:(t,s)=>{r(s),e.push(t)}},u={[he.nJ.custom]:e=>{var t;return(0,m.jsx)("div",{className:"tw-w-full tw-text-center",children:null===e||void 0===e||null===(t=e.details)||void 0===t?void 0:t.textContent})},[he.nJ.image]:e=>{var t,s,n;return(0,m.jsxs)("div",{className:"tw-h-full tw-relative tw-flex tw-justify-center",children:[(0,m.jsx)("span",{onClick:()=>c[he.X2.close](e),className:"tw-cursor-pointer tw-fill-secondary tw-z-50 tw-absolute tw-top-0 tw-right-0",children:(0,m.jsx)(W.bm,{})}),(0,m.jsx)("img",{className:"tw-w-full tw-object-contain ".concat(null!==e&&void 0!==e&&null!==(t=e.position)&&void 0!==t&&t.fullWidth?"":"tw-max-w-sm"),src:null===e||void 0===e||null===(s=e.details)||void 0===s||null===(n=s.image)||void 0===n?void 0:n.src,alt:"notification"})]})},[he.nJ.html]:e=>{var t;return(0,m.jsxs)("div",{className:"tw-w-full tw-relative",children:[(0,m.jsx)("span",{onClick:()=>c[he.X2.close](e),className:"tw-cursor-pointer tw-fill-secondary tw-z-50 tw-absolute tw-top-0 tw-right-0",children:(0,m.jsx)(W.bm,{})}),(0,m.jsx)("div",{dangerouslySetInnerHTML:{__html:null===e||void 0===e||null===(t=e.details)||void 0===t?void 0:t.html}})]})}};(0,n.useEffect)(()=>{(async()=>{const e=await l();if(!e)return;const s=e.find(a);s&&(e=>{var s,n,i;const l=null===e||void 0===e||null===(s=e.actions)||void 0===s?void 0:s.length,a=(null===e||void 0===e?void 0:e.type)!==he.nJ.custom,r=e.position,d=r.col,h=r.row,m=r.fullWidth;t((0,I.lB)({notificationConfig:{show:!0,fullWidth:!0,hideTitleBar:a,title:null===(n=e.details)||void 0===n?void 0:n.title,ignoreDefaultMaxWidth:m,renderChildrenDirectly:a,hideActions:!l,actions:null===(i=e.actions)||void 0===i?void 0:i.map(t=>({label:t.label,isClose:t.type===he.X2.close,onClick:()=>{c[t.type](t.value,e)}})),sx:{"&":{pointerEvents:"none"},"& .MuiDialog-container":{justifyContent:o[d],alignItems:o[h]},"& .MuiDialog-scrollPaper":{pointerEvents:"none",backgroundColor:"transparent","& .MuiPaper-root":{pointerEvents:"auto"}},"& .MuiBackdrop-root":{pointerEvents:"none",backgroundColor:"transparent"}},handleClose:()=>{c[he.X2.close](e)},renderContent:()=>u[e.type](e)}}))})(s)})()},[window.location.pathname])};var we=s(86698);const xe=()=>{const e=(0,d.useDispatch)(),t=(0,i.useLocation)(),s=(0,n.useRef)(t);s.current=t;const l=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.refreshCustomDomains}),a=(0,n.useCallback)(async()=>{try{if((0,X.Ay)(s.current.pathname))return;const t=(await E.FH.get("/user/v1/company/get-custom-domains")).data;e((0,I.lB)({customDomains:t,refreshCustomDomains:!1}))}catch(t){console.log((null===t||void 0===t?void 0:t.response)||t)}},[e]),o=!(0,X.Ay)(t.pathname);(0,n.useEffect)(()=>{o&&l&&a()},[o,a,l])},ge=()=>{const e=(0,d.useDispatch)(),t=(0,i.useLocation)(),s=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.getUserTags}),l=!(0,X.Ay)(t.pathname);(0,n.useEffect)(()=>{l&&s&&(async()=>{try{const t=(await E.Km.get("/tags/all")).data;(0,d.vA)(()=>{e((0,I.Iq)(!1)),e((0,I.AE)(t))})}catch(t){e((0,I.Iq)(!1))}})()},[e,s,l])};var ye=s(38758),fe=s(45598),be=s(25682),je=s(15955);const Ae=()=>((0,n.useEffect)(()=>{var e,t;null===(e=(t=window).confirmMetaPixelRegistration)||void 0===e||e.call(t)},[]),(0,m.jsxs)(u.Zp,{className:"!tw-max-w-xl !tw-mx-auto !tw-text-center !tw-gap-0",children:[(0,m.jsx)("div",{className:"tw-text-5xl tw-text-center",children:"\ud83d\ude4c"}),(0,m.jsx)("div",{className:"tw-text-3xl tw-font-medium tw-text-secondary tw-mt-2",children:"Registration Successful!"}),(0,m.jsx)("div",{className:"tw-mt-2",children:"Now let\u2019s get you all set up."}
1),(0,m.jsx)("div",{className:"tw-mt-4",children:(0,m.jsx)(u.$n,{"data-cy":"registration-successful-button",variant:"contained",type:"submit",children:"Start Onboarding"})})]}));var Se=s(5924),Ce=s(78373),Ne=s(23750),Ie=s(93236),De=s(31365),ke=s(44222),Pe=s(81926),Ee=s(20910);const Re=e=>{var t;e.onChangeCurrentStep,e.steps;let s=e.renderActions,l=(e.values,e.setFieldValue);const a=(0,d.useSelector)(e=>{var t,s;return{carrierAccounts:(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.easypostCarrierAccounts)||[],user:null===e||void 0===e||null===(s=e.auth)||void 0===s?void 0:s.user}}),o=a.carrierAccounts,r=a.user,c=(0,i.useHistory)(),h=(0,Ee.Ay)({history:c}),p="true"===(null===h||void 0===h?void 0:h.carrierIntegrationCallback),v=p&&"1"===(null===h||void 0===h?void 0:h.success)||(null===r||void 0===r||null===(t=r.manualCarrierAccounts)||void 0===t?void 0:t.length)>0,w=p&&"0"===(null===h||void 0===h?void 0:h.success),g=(0,ke.q)().renderAvailableCarriers,y=(0,n.useState)(null),f=(0,x.A)(y,2),b=f[0],j=f[1],A=e=>{l("connectAccount.ownAccountConnected",!0),l("connectAccount.ownAccountCarrier",e)};return(0,m.jsxs)(m.Fragment,{children:[v&&(0,m.jsx)(Ce.A,{className:"tw-max-w-2xl tw-mx-auto tw-w-full tw-mt-8",children:(0,m.jsx)("span",{children:"Carrier account connected successfully!"})}),w&&(0,m.jsx)(Se.A,{className:"tw-max-w-2xl tw-mx-auto tw-w-full tw-mt-8",children:(0,m.jsx)("span",{children:"Failed to connect your carrier account. Please try again."})}),(0,m.jsxs)(u.Zp,{className:"tw-max-w-2xl tw-mx-auto tw-w-full !tw-gap-0 ".concat(p?"tw-mt-4":"tw-mt-8"),"data-cy":"choose-rate-provider-card",children:[(0,m.jsx)("div",{className:"tw-text-3xl lg:tw-text-4xl tw-font-medium tw-text-secondary tw-text-center",children:"Connect Your Own Carrier Account"}),(0,m.jsx)("div",{className:"tw-mt-4 tw-flex tw-justify-center tw-gap-4",children:g({onSelectCarrierType:e=>{j(e)},className:"!tw-size-32"})}),s()]}),(0,m.jsx)(Ie.A,{active:b===Pe.Ay.ups,handleClose:()=>j(null),onComplete:()=>A(Pe.Ay.ups),user:r,carrierAccounts:o,isOnboardingFlow:!0}),(0,m.jsx)(Ne.A,{active:b===Pe.Ay.fedex,handleClose:()=>j(null),onComplete:()=>A(Pe.Ay.fedex),user:r,carrierAccounts:o}),(0,m.jsx)(De.A,{active:b===Pe.Ay.usps,handleClose:()=>j(null),onComplete:()=>A(Pe.Ay.usps),user:r,carrierAccounts:o,isOnboardingFlow:!0})]})};var Te=s(86417),Fe=s(171),Oe=s(65097),_e=s(51236),Be=s(64441),Ue=s(35486),Le=s(11975),We=s(68878),ze=s(67702),Me=s(41501);const qe={shopify:Te.hb.shopify,woocommerce:Te.hb.woocommerce,bigcommerce:Te.hb.bigcommerce,grazeCart:Te.hb.grazeCart,squarespace:Te.hb.squarespace,square:Te.hb.square,wix:Te.hb.wix,other:"Platform Not Shown"},Ve="submittedRequestPlatform",Ke=e=>{var t,s,l;let a=e.renderActions,o=e.currentStep,r=e.onChangeCurrentStep,c=e.values,h=e.setFieldValue;const p=(0,d.useSelector)(e=>e.auth.user),v=(0,ze.g)({typesToRender:qe}).renderAvailablePlatforms,w=(0,i.useHistory)(),g=(0,Ee.Ay)({history:w}),y="true"===(null===g||void 0===g?void 0:g.integrationCallback),f=y&&"1"===(null===g||void 0===g?void 0:g.success)||(null===p||void 0===p||null===(t=p.shopDomains)||void 0===t?void 0:t.length)>0,b=y&&"0"===(null===g||void 0===g?void 0:g.success),j=(0,n.useState)(null),A=(0,x.A)(j,2),S=A[0],C=A[1],N=null===c||void 0===c||null===(s=c.connectStore)||void 0===s?void 0:s.platformType,I=null===c||void 0===c||null===(l=c.connectStore)||void 0===l?void 0:l.otherPlatform,D=e=>h("connectStore.platformType",e),k=e=>h("connectStore.otherPlatform",e);(0,n.useEffect)(()=>{const e="true"===sessionStorage.getItem(Ve);S===qe.other&&e&&P()},[S]);const P=()=>{r(o+1)},E=()=>{C(null),sessionStorage.setItem(Ve,"true"),P()};return S===qe.other?(0,m.jsxs)(u.Zp,{className:"tw-max-w-md tw-mx-auto",children:[(0,m.jsxs)("div",{className:"tw-mt-2 tw-max-w-56",children:[(0,m.jsx)(Me.l6,{label:"What Platform Do You Use?",placeholder:"Select Platform",required:!0,value:N,onChange:e=>{D(e.value)},options:[{label:"Barn2Door",value:"Barn2Door"},{label:"Square Online",value:"Square Online"},{label:"Ecwid",value:"Ecwid"},{label:"Adobe Commerce (Magento)",value:"Adobe Commerce"},{label:"Volusion",value:"Volusion"},{label:"Other",value:"Other"},{label:"None",value:"None"}]}),"Other"===N&&(0,m.jsxs)("div",{className:"tw-mt-2",children:[(0,m.jsxs)("div",{children:["Platform Name",(0,m.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,m.jsx)(u.A_,{placeholder:"",value:I,onChange:e=>{k(e.target.value)}})]})]}),(0,m.jsxs)("div",{className:"tw-flex tw-items-center tw-pt-0 tw-justify-between",children:[(0,m.jsx)(u.$
1n,{onClick:()=>{C(null),D(null),k(null)},children:"Back"}),(0,m.jsx)(u.$n,{variant:"contained",onClick:E,disabled:!N||"Other"===N&&!I,children:"Submit"})]})]}):(0,m.jsxs)(m.Fragment,{children:[f&&(0,m.jsx)(Ce.A,{className:"tw-max-w-2xl tw-mx-auto tw-w-full tw-mt-4",children:(0,m.jsx)("span",{children:"Store connected successfully!"})}),b&&(0,m.jsx)(Se.A,{className:"tw-max-w-2xl tw-mx-auto tw-w-full tw-mt-4",children:(0,m.jsx)("span",{children:"Failed to connect your store. Please try again."})}),(0,m.jsxs)(u.Zp,{className:"tw-max-w-2xl tw-mx-auto tw-w-full ".concat(f||b?"tw-mt-4":""),children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{"data-cy":"connect-store-title",className:"tw-text-3xl lg:tw-text-4xl tw-font-medium tw-text-secondary",children:"Connect Your Store"}),(0,m.jsx)("div",{className:"tw-text-black",children:"Import orders by connecting your store below."}),(0,m.jsx)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4 lg:tw-gap-8 tw-mt-4",children:v({onSelectedPlatformType:C,className:"!tw-h-32 hover:!tw-border-secondary",imageClassName:"!tw-max-w-24 md:!tw-max-w-48",imageStyle:{},renderText:e=>(0,m.jsx)("span",{className:"tw-max-w-48 tw-text-2xl tw-text-center",children:e})})})]}),a()]}),(0,m.jsx)(_e.A,{active:S===Te.hb.shopify,handleClose:()=>C(null),onComplete:P,user:p,isOnboarding:!0}),(0,m.jsx)(Ue.A,{active:S===Te.hb.woocommerce,handleClose:()=>C(null),onComplete:P,user:p,isOnboarding:!0}),(0,m.jsx)(Fe.A,{active:S===Te.hb.bigcommerce,handleClose:()=>C(null),onComplete:P,user:p,isOnboarding:!0}),(0,m.jsx)(Oe.A,{active:S===Te.hb.grazeCart,handleClose:()=>C(null),onComplete:P,user:p,isOnboarding:!0}),(0,m.jsx)(Be.A,{active:S===Te.hb.squarespace,handleClose:()=>C(null),onComplete:P,user:p,isOnboarding:!0}),(0,m.jsx)(Le.A,{active:S===Te.hb.square,handleClose:()=>C(null),onComplete:P,user:p,isOnboarding:!0}),(0,m.jsx)(We.A,{active:S===Te.hb.wix,handleClose:()=>C(null),onComplete:P,user:p,isOnboarding:!0})]})};var Ye=s(68824),Ge=s(54917),He=s(57043),$e=s(37348),Qe=s(94023),Je=s(84594),Ze=s(6936),Xe=s(48057),et=s(77832),tt=s(61538),st=s(75320),nt=s(11841),it=s(40859);const lt=e=>{var t,s,i,l,a,r,c,h,p,v,w,g,y,f;let b=e.open,j=e.onClose,A=e.values,S=e.setFieldValue,C=e.user,N=e.errors,D=e.setErrors;const k=(0,d.useDispatch)(),P=(0,n.useState)(!1),T=(0,x.A)(P,2),F=T[0],O=T[1],_=(0,n.useState)(!1),B=(0,x.A)(_,2),U=B[0],L=B[1],W=(0,n.useState)(null),z=(0,x.A)(W,2),M=z[0],q=z[1],V=null===A||void 0===A||null===(t=A.accountSettings)||void 0===t?void 0:t.newWarehouse,K=()=>S("accountSettings.newWarehouse",(0,st.xC)({default:!1,timezone:(0,R.oA)()})),Y=(e,t)=>{var s;return k((0,I.Gg)((0,o.A)({notice:(null===e||void 0===e||null===(s=e.response)||void 0===s?void 0:s.data)||(null===e||void 0===e?void 0:e.message)||t},oe.Ay.ERROR)))},G=()=>{L(!1),q(null),K(),j()},H=()=>L(!1);(0,n.useEffect)(()=>{if(!U)return;if((null===V||void 0===V||!V.useSuggestedAddress)&&(null===V||void 0===V||!V.ignoreSuggestedAddress))return;(async()=>{try{O(!0);const e=(await E.Km.patch("/warehouses/warehouse/".concat(V.id),V)).data;k((0,I.QO)({user:(0,o.A)({},e.user)})),S("accountSettings.warehouses",e.user.warehouses),G()}catch(e){console.error(e),Y(e,"Failed To Update Warehouse Address"),S("accountSettings.newWarehouse.useSuggestedAddress",!1),S("accountSettings.newWarehouse.ignoreSuggestedAddress",!1)}finally{O(!1)}})()},[null===V||void 0===V?void 0:V.useSuggestedAddress,null===V||void 0===V?void 0:V.ignoreSuggestedAddress]);const $=[{label:"Select State",value:null},...(null===(s=Xe.Ay[(null===A||void 0===A||null===(i=A.accountSettings)||void 0===i||null===(l=i.newWarehouse)||void 0===l||null===(a=l.address)||void 0===a?void 0:a.country)||"US"])||void 0===s?void 0:s.map(e=>({label:e.name,value:e.abbreviation})))||[]];return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.aF,{title:M?"Update Warehouse":"Add Warehouse",open:b&&!U,handleClose:()=>{M&&(q(null),K()),j()},actions:[{label:"Save",disabled:F,loading:F,"data-cy":"add-warehouse-save-button",onClick:async()=>{const e=(0,tt.mU)(A,D),t=e.isValid,s=e.errors;if(t)try{var n,i,l,a,r;O(!0);const e=null===(n=A.accountSettings.warehouses)||void 0===n?void 0:n.find(e=>e.default),t=(0,et.M)({address:(0,o.A)({},A.accountSettings.newWarehouse.address)}).formattedAddress,s=(0,o.A)((0,o.A)({},A.accountSettings.newWarehouse),{},{id:null!==M&&void 0!==M?M:(0,nt.A)(),timezone:A.accountSettings.newWarehouse.timezone||(0,R.oA)(),default:M?A.accountSettings.newWarehouse.default:!e,formattedAddress:t,address:(0,o.A)((0,o.A)({},A.accountSettings.newWarehouse.address),{},{companyName:C.companyName||A.accountSettings.newWarehouse.name,email:C.companyEmail||C.email,phone:(null===(i=(0,Ze.conformToMask)((0,He.WA)((null===(l=A.accountSettings.newWarehouse.address)||void 0===l?void 0:l.phone)||""),(0,He.Jd)(),{guide:!1}))||void 0===i?void 0:i.conformedValue)||"",pickUpNotes:""})}),d=new Set((A.accountSettings.warehouses||[]).map(e=>e.id)),c=(M?await E.Km.patch("/warehouses/warehouse/".concat(M),s):await E.Km.post("/warehouses/new",{warehouse:s})).data;k((0,I.QO)({user:(0,o.A)({},c.user)})),S("accountSettings.warehouses",c.user.warehouses);const u=M?null===(a=c.user.warehouses)||void 0===a?void 0:a.find(e=>e.id===M):null===(r=c.user.warehouses)||void 0===r?void 0:r.find(e=>!d.has(e.id));if(u&&!u.isValid)return q(u.id),S("accountSettings.newWarehouse",u),void L(!0);G()}catch(d){console.error(d),Y(d,"Failed To ".concat(M?"Update":"Create"," Warehouse"))}finally{O(!1)}else D(s)},color:"primary"}],children:[(0,m.jsx)("div",{children:(0,m.jsx)(u.B0,{name:"accountSettings.newWarehouse.name",label:"Warehouse Name",isTouchedByDefault:!0,isRequired:!0,wrapperClass:"tw-flex-1",component:Ge.A,"data-cy":"add-warehouse-name"})}),(0,m.jsx)("div",{className:"tw-mt-4",children:(0,m.jsx)(u.B0,{name:"accountSettings.newWarehouse.address.phone",label:"Warehouse Contact #",isRequired:!0,wrapperClass:"tw-flex-1",component:He.Ay,"data-cy":"add-warehouse-phone"})}),(0,m.jsx)("div",{className:"tw-mt-4",children:(0,m.jsx)(Qe.A,{label:"Address Line 1","data-cy":"add-warehouse-address-line-1",value:null===(r=A.accountSettings)||void 0===r||null===(c=r.newWarehouse)||void 0===c||null===(h=c.address)||void 0===h?void 0:h.street1,onChange:e=>S("accountSettings.newWarehouse.address.street1",e),setAutoCompleteAddress:e=>{var t,s;S("accountSettings.newWarehouse.address",(0,o.A)((0,o.A)({},null===(t=A.accountSettings)||void 0===t||null===(s=t.newWarehouse)||void 0===s?void 0:s.address),{},{state:e.state,country:e.country,city:e.city,street1:e.address1,fullZipCode:e.zip}),!0)},isTouchedByDefault:!(null===N||void 0===N||null===(p=N.accountSettings)||void 0===p||null===(v=p.newWarehouse)||void 0===v||null===(w=v.address)||void 0===w||!w.street1),errMsg:null!==N&&void 0!==N&&null!==(g=N.accountSettings)&&void 0!==g&&null!==(y=g.newWarehouse)&&void 0!==y&&null!==(f=y.address)&&void 0!==f&&f.street1?it.UU[N.accountSettings.newWarehouse.address.street1]:null,isRequired:!0})}),(0,m.jsx)("div",{className:"tw-mt-4",children:(0,m.jsx)(u.B0,{name:"accountSettings.newWarehouse.address.street2",label:"Address Line 2",wrapperClass:"tw-flex-1",component:Ge.A})}
1),(0,m.jsxs)("div",{className:"tw-grid tw-grid-cols-1 lg:tw-grid-cols-3 tw-gap-4 tw-mt-4",children:[(0,m.jsx)(u.B0,{name:"accountSettings.newWarehouse.address.city",label:"City",wrapperClass:"tw-flex-1",component:Ge.A,isRequired:!0,"data-cy":"add-warehouse-city"}),(0,m.jsx)(u.B0,{name:"accountSettings.newWarehouse.address.state",component:$e.A,options:$,label:"State",autoComplete:"address-level1",isRequired:!0}),(0,m.jsx)(u.B0,{name:"accountSettings.newWarehouse.address.fullZipCode",component:Ge.A,label:"Zip Code",placeholder:"Zip","data-cy":"add-warehouse-zip",autoComplete:"postal-code",isRequired:!0})]}),(0,m.jsx)("div",{className:"tw-mt-4",children:(0,m.jsx)(u.B0,{name:"accountSettings.newWarehouse.timezone",component:$e.A,options:R.H8,label:"Timezone",placeholder:"Select a timezone","data-cy":"add-warehouse-timezone",isRequired:!0})})]}),(0,m.jsx)(Je.A,{open:U,values:null!==V&&void 0!==V?V:{},setFieldValue:(e,t)=>S("accountSettings.newWarehouse.".concat(e),t),setShowAddressConfirmationModal:H,onProceedWithSelectedAddress:()=>{},onClose:H})]})};var at=s(51548),ot=s(88141),rt=s(43752),dt=s(82302);const ct=e=>{var t,s,i,l,a,r,c,h,p;let v=e.setFieldValue,w=e.values,g=e.user,y=e.errors,f=e.setErrors,b=e.renderActions;const j=(0,d.useDispatch)(),A=(0,n.useState)(!1),S=(0,x.A)(A,2),C=S[0],N=S[1],D=(0,n.useState)(!1),k=(0,x.A)(D,2),P=k[0],R=k[1];(0,n.useEffect)(()=>{var e,t,s,n,i,l;null!==g&&void 0!==g&&null!==(e=g.shopDomains)&&void 0!==e&&e.length&&(null===(s=(n=window).confirmGTMConversionStoreConnected)||void 0===s||s.call(n));null!==g&&void 0!==g&&null!==(t=g.warehouses)&&void 0!==t&&t.length&&(null===(i=(l=window).confirmGTMConversionAddedWarehouse)||void 0===i||i.call(l))},[g]),(0,n.useEffect)(()=>{var e,t,s,n,i,l,a,r,c;const u=null===g||void 0===g||null===(e=g.shopDomains)||void 0===e?void 0:e[0];if((null===g||void 0===g||null===(t=g.warehouses)||void 0===t||!t.length)&&u&&(null===w||void 0===w||null===(s=w.accountSettings)||void 0===s||!s.warehouseImported))return void(async e=>{try{R(!0);let t=e.shop;e.platformType===Te.hb.shopify&&(t=(0,at.w$)(e.shop),t="https://".concat(t,".myshopify.com"));const s=(await E.Km.post("/warehouses/import",{shopDomain:t,platformType:e.platformType})).data;(0,d.vA)(()=>{j((0,I.QO)({user:(0,o.A)({},s.user)})),v("accountSettings.warehouses",s.user.warehouses||[])})}catch(t){console.error(t)}finally{R(!1),v("accountSettings.warehouseImported",!0)}})(u);v("accountSettings.warehouses",null===g||void 0===g?void 0:g.warehouses);const h=null!==(n=null===g||void 0===g||null===(i=g.warehouses)||void 0===i?void 0:i.find(e=>e.default))&&void 0!==n?n:null===g||void 0===g||null===(l=g.warehouses)||void 0===l?void 0:l[0];if(null===w||void 0===w||null===(a=w.accountSettings)||void 0===a||!a.industry){const e=Object.keys(dt.A).find(e=>dt.A[e]===(null===g||void 0===g?void 0:g.industry))||"";v("accountSettings.industry",e||"")}var m,p;null!==w&&void 0!==w&&null!==(r=w.accountSettings)&&void 0!==r&&r.companyName||null!==g&&void 0!==g&&g.isSignupFromSocialAccount||v("accountSettings.companyName",(null===g||void 0===g?void 0:g.companyName)||(null===h||void 0===h||null===(m=h.address)||void 0===m?void 0:m.companyName)||"");null!==w&&void 0!==w&&null!==(c=w.accountSettings)&&void 0!==c&&c.phone||v("accountSettings.phone",(null===g||void 0===g?void 0:g.phone)||(null===h||void 0===h||null===(p=h.address)||void 0===p?void 0:p.phone)||"")},[null===g||void 0===g?void 0:g.warehouses]);(0,n.useEffect)(()=>{v("accountSettings.logo",null===g||void 0===g?void 0:g.logo)},[null===g||void 0===g?void 0:g.logo]);const T=(null===g||void 0===g||null===(t=g.shopDomains)||void 0===t?void 0:t.length)&&g.shopDomains.find(e=>e.platformType===Te.hb.shopify);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Zp,{className:"tw-max-w-2xl tw-mx-auto tw-w-full !tw-gap-0","data-cy":"account-settings-card",children:[(0,m.jsx)("div",{"data-cy":"shipping-schedule-title",className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight tw-flex tw-justify-between tw-items-center",children:"Company"}),(0,m.jsxs)("div",{className:"tw-mt-2 tw-mb-2",children:["Logo",(0,m.jsx)("br",{}),(0,m.jsx)("span",{className:"tw-text-xs tw-italic tw-text-gray-500",children:"*Recommended size: 32x32px"})]}),w.accountSettings.logo?(0,m.jsxs)("div",{className:"tw-relative tw-w-fit tw-min-w-40",children:[(0,m.jsx)(W.epd,{className:"tw-absolute tw-top-0 tw-right-0 tw-cursor-pointer",onClick:()=>v("accountSettings.logo",null)}),(0,m.jsx)("img",{src:null!==(s=null===(i=w.accountSettings.logo)||void 0===i?void 0:i.src)&&void 0!==s?s:window.URL.createObjectURL(null===(l=w.accountSettings.logo)||void 0===l?void 0:l.binary),className:"tw-size-32 tw-rounded-full tw-object-cover",alt:"logo"})]}):(0,m.jsx)(Ye.A,{hideList:!0,className:"!tw-size-32 !tw-p-[27px] !tw-rounded-full !tw-justify-center !tw-items-center",textClassName:"!tw-text-xs !tw-mt-2 !tw-mb-2",customText:"or Drag/Drop",onFileChange:e=>{var t;
1null===(t=e.newFiles)||void 0===t||t.forEach(e=>{v("accountSettings.logo",e)})},dropzoneProps:{accept:{"image/jpeg":[],"image/jpg":[],"image/png":[],"image/webp":[]}}}),(null===y||void 0===y||null===(a=y.accountSettings)||void 0===a?void 0:a.logo)&&(0,m.jsx)("div",{className:"tw-text-red-600 tw-text-sm",children:"Company Logo is required"}),(0,m.jsxs)("div",{className:"tw-grid tw-grid-cols-1 lg:tw-grid-cols-2 tw-gap-4 tw-mt-4",children:[(0,m.jsx)(u.B0,{name:"accountSettings.companyName",label:"Company Name","data-cy":"account-settings-company-name",wrapperClass:"tw-flex-1",component:Ge.A,isRequired:!0,isTouchedByDefault:!(null===y||void 0===y||null===(r=y.accountSettings)||void 0===r||!r.companyName)}),(0,m.jsx)(u.B0,{name:"accountSettings.phone",label:"Phone Number",isRequired:!0,wrapperClass:"tw-flex-1",component:He.Ay,"data-cy":"add-warehouse-phone",isTouchedByDefault:!(null===y||void 0===y||null===(c=y.accountSettings)||void 0===c||!c.phone)}),(0,m.jsx)(u.B0,{name:"accountSettings.industry",label:"Industry",wrapperClass:"tw-flex-1","data-cy":"accountSettings-industry",component:$e.A,options:Object.entries(dt.A).map(e=>{let t=(0,x.A)(e,2),s=t[0];return{label:t[1],value:s}})})]})]}),(0,m.jsxs)(u.Zp,{className:"tw-max-w-2xl tw-mx-auto tw-w-full tw-mt-6",children:[(0,m.jsxs)("div",{className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight tw-flex tw-justify-between tw-items-center",children:["Warehouse",(null===(h=w.accountSettings.warehouses)||void 0===h?void 0:h.length)>1?"s":"",(0,m.jsxs)(u.$n,{className:"tw-gap-1",variant:"contained",onClick:()=>N(!0),color:"secondary","data-cy":"add-warehouse-button",disabled:P,loading:P,size:"small",children:[(0,m.jsx)(W.OMN,{}),"Add"]})]}),(0,m.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:null!==(p=w.accountSettings.warehouses)&&void 0!==p&&p.length?w.accountSettings.warehouses.map((e,t)=>(0,m.jsxs)("div",{className:"tw-flex tw-justify-between tw-items-center",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"tw-font-semibold",children:e.name}),(0,m.jsx)("div",{children:e.address.address1||e.address.street1}),(0,m.jsxs)("div",{children:[e.address.city,", ",e.address.state," ",e.address.zipCode]})]}),(0,m.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-2",children:[(0,m.jsx)(u.$n,{iconButton:!0,disabled:P,loading:P,onClick:()=>async function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];R(!0);try{const s=(await E.Km.patch("/warehouses/warehouse/default/".concat(e),{isDefault:t})).data;j((0,I.QO)({user:(0,o.A)({},s.user)})),v("accountSettings.warehouses",s.user.warehouses)}catch(s){console.error(s)}finally{R(!1)}}(e.id,!e.default),children:(0,m.jsx)(u.Gg,{height:40,width:40,active:e.default})}),(0,m.jsx)(u.$n,{disabled:P,loading:P,"data-cy":"delete-warehouse-button-".concat(e.name),iconButton:!0,onClick:()=>{(async e=>{R(!0);try{const t=(await E.Km.post("/warehouses/delete",{warehouseIds:[e]})).data;j((0,I.QO)({user:(0,o.A)({},t.user)})),v("accountSettings.warehouses",t.user.warehouses)}catch(t){console.error(t)}finally{R(!1)}})(e.id)},children:(0,m.jsx)(W.epd,{height:30,width:30})})]})]},t)):(0,m.jsxs)("div",{className:"tw-w-full tw-grid tw-place-items-center tw-mb-4",children:[(0,m.jsx)("img",{src:"".concat(_.nv,"/Assets/WAREHOUSE_Illustrations_v01+(1).svg"),alt:"Warehouses",className:"tw-max-h-72 tw-mx-auto tw-mt-5 tw-mb-8"}),(0,m.jsx)("div",{className:"tw-text-center tw-text-xl",children:"This is the address you ship from"}),T&&(0,m.jsxs)("div",{className:"tw-flex tw-gap-1 tw-items-center tw-mt-2 tw-cursor-pointer",children:[(0,m.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:(0,rt.Cn)({platform:Te.hb.shopify,store:T.shop}),children:"Your Store Warehouses"}),(0,m.jsx)(W.GrD,{className:"-tw-mt-2",height:16,width:16,fill:"#551a8b",onClick:()=>window.open((0,rt.Cn)({platform:Te.hb.shopify,store:T.shop}),"_blank")})]})]})}),(0,m.jsx)(ot.A,{name:"accountSettings.warehouses"})]}),(0,m.jsx)("div",{className:"tw-max-w-2xl tw-mx-auto tw-w-full",children:b()}),(0,m.jsx)(lt,{open:C,onClose:()=>N(!1),values:w,user:g,setFieldValue:v,errors:y,setErrors:f})]})};var ut=s(92810),ht=s(86558),mt=s(2532);const pt=e=>{var t;let s=e.user,i=e.renderActions;
1const l=(0,d.useDispatch)(),a=(0,n.useState)(!1),r=(0,x.A)(a,2),c=r[0],h=r[1],p=(0,n.useState)(!1),v=(0,x.A)(p,2),w=v[0],g=v[1],y=(0,n.useState)({}),f=(0,x.A)(y,2),b=f[0],j=f[1];(0,n.useEffect)(()=>{var e,t,n,i,l,a;null!==s&&void 0!==s&&null!==(e=s.boxes)&&void 0!==e&&e.length&&(null===(n=(i=window).confirmGTMConversionAddedBox)||void 0===n||n.call(i));null!==s&&void 0!==s&&null!==(t=s.manualCarrierAccounts)&&void 0!==t&&t.length&&(null===(l=(a=window).confirmGTMConversionConnectedCarrier)||void 0===l||l.call(a))},[s]),(0,n.useEffect)(()=>{!async function(){const e=(null===s||void 0===s?void 0:s.onboarding)||{},t=(await E.FH.post("/user/v1/company/edit",{onboarding:(0,o.A)((0,o.A)({},e),{},{lastStep:"CHOOSE_RATE_PROVIDER"})})).data;l((0,I.QO)({user:t}))}()},[]);const A=(null===s||void 0===s||null===(t=s.boxes)||void 0===t?void 0:t.length)>0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Zp,{className:"tw-max-w-2xl tw-mx-auto tw-w-full !tw-gap-0","data-cy":"box-setup-card",children:[(0,m.jsxs)("div",{className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight tw-flex tw-justify-between tw-items-center",children:["Box Setup",(0,m.jsxs)(u.$n,{className:"tw-gap-1",variant:"contained",onClick:()=>h(!0),color:"secondary",disabled:w,"data-cy":"add-box-button",loading:w,size:"small",children:[(0,m.jsx)(W.OMN,{}),"Add"]})]}),A?(0,m.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-mt-4",children:s.boxes.map((e,t)=>{var s,n,i,a;return(0,m.jsxs)("div",{className:"tw-flex tw-justify-between tw-items-center",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"tw-text-lg",children:e.name}),(0,m.jsxs)("p",{className:"tw-m-0",children:[null===(s=e.dimensions)||void 0===s?void 0:s.length," L x ",null===(n=e.dimensions)||void 0===n?void 0:n.width," W x"," ",null===(i=e.dimensions)||void 0===i?void 0:i.height," H",(null===e||void 0===e?void 0:e.hasLiner)&&", Liner: ".concat(null===e||void 0===e||null===(a=e.liner)||void 0===a?void 0:a.title),e.hasDryIce||e.hasIcePack?", Coolant: ".concat(e.hasDryIce?"Dry Ice":"Ice Packs"):""]})]}),(0,m.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-2",children:[(0,m.jsx)(u.$n,{iconButton:!0,disabled:w,loading:w,className:"tw-w-auto tw-h-auto",onClick:()=>async function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];g(!0);try{const s=(await E.Km.patch("/box/default/".concat(e),{isDefault:t})).data;l((0,I.QO)({user:s.user}))}catch(s){console.error(s)}finally{g(!1)}}(e.id),children:(0,m.jsx)(u.Gg,{height:40,width:40,active:e.default})}),(0,m.jsx)(u.$n,{disabled:w,loading:w,"data-cy":"delete-box-button-".concat(e.name),iconButton:!0,onClick:()=>(async e=>{try{g(!0);const t=(await E.Km.post("/box/delete",{boxIds:[e]})).data;l((0,I.QO)({user:(0,o.A)({},t.user)}))}catch(t){console.error(t)}finally{g(!1)}})(e.id),children:(0,m.jsx)(W.epd,{height:30,width:30})})]})]},t)})}):(0,m.jsxs)("div",{className:"tw-w-full tw-grid tw-place-items-center tw-gap-4 tw-mb-4",children:[(0,m.jsx)("img",{src:"".concat(_.nv,"/Assets/boxes-illustration.svg"),alt:"Boxes",className:"tw-max-h-72 tw-mx-auto tw-mt-8 tw-mb-4"}),(0,m.jsx)("div",{className:"tw-text-center tw-text-xl",children:"Add at least 1 Box"}),(0,m.jsx)("div",{className:"tw-text-center tw-text-xl",children:"Or"}),(0,m.jsx)("div",{className:"tw-text-center tw-text-xl",children:"Select Box Size"}),(0,m.jsx)("div",{className:"tw-text-center tw-min-w-48",children:(0,m.jsx)(u.B0,{isRequired:!0,placeholder:"Select Box Size",name:"discountedRates.boxSize",wrapperClass:"tw-flex-1",component:$e.A,onChange:e=>{e&&(j(e),h(!0))},options:mt.vC.map(e=>({label:e.name,value:e}))})})]}),(0,m.jsx)(ht.Kw,{name:"boxSetup.boxes",component:"div",className:"tw-text-red-600 tw-mt-4"})]}),(0,m.jsx)("div",{className:"tw-max-w-2xl tw-mx-auto tw-w-full",children:i()}),c&&(0,m.jsx)(ut.A,{active:c,initialValues:b,handleClose:e=>{let t=e.box;j(t),h(!1)}})]})};var vt=s(79626),wt=s(91610);const xt=e=>{var t;let s=e.renderActions,i=e.values,l=e.user,a=e.setFieldValue;const o=(0,d.useDispatch)(),r=T.Mq.filter(e=>!e.isWeekend).map(e=>e.fullName);return(0,n.useEffect)(()=>{o((0,I.lB)({refreshCarriersServicesOnboarding:!0}
1)),null!==l&&void 0!==l&&l.timezone&&!i.shippingSchedule.timezone&&a("shippingSchedule.timezone",null===l||void 0===l?void 0:l.timezone)},[null===l||void 0===l?void 0:l.timezone]),(0,n.useEffect)(()=>{var e,t;const s=null===l||void 0===l||null===(e=l.shopDomains)||void 0===e?void 0:e[0];!s||null!==l&&void 0!==l&&l.hasOrder||null!==i&&void 0!==i&&null!==(t=i.accountSettings)&&void 0!==t&&t.ordersImported||(async e=>{try{let t=e.shop;e.platformType===Te.hb.shopify&&(t=(0,at.w$)(e.shop),t="https://".concat(t,".myshopify.com")),await E.Km.post("/orders/import",{shopDomain:t,platformType:e.platformType,onboarding:!0})}catch(t){console.error(t)}finally{a("accountSettings.ordersImported",!0)}})(s)},[null===l||void 0===l?void 0:l.hasOrder]),(0,n.useEffect)(()=>{var e,t;(null===l||void 0===l||!l.hasProduct)&&(null===l||void 0===l||null===(e=l.shopDomains)||void 0===e?void 0:e.length)&&(null===i||void 0===i||null===(t=i.accountSettings)||void 0===t||!t.productsImported)&&(async()=>{var e;const t=null===l||void 0===l||null===(e=l.shopDomains)||void 0===e?void 0:e[0];if(t)try{let e=t.shop;t.platformType===Te.hb.shopify&&(e=(0,at.w$)(t.shop),e="https://".concat(e,".myshopify.com")),await E.Km.post("/products/createAll",{shopDomain:e,platformType:t.platformType,importNewProductsOnly:t.importNewProductsOnly,supressSocket:!0})}catch(s){console.error(s)}finally{a("accountSettings.productsImported",!0)}})()},[null===l||void 0===l?void 0:l.hasProduct,null===l||void 0===l?void 0:l.shopDomains,null===i||void 0===i||null===(t=i.accountSettings)||void 0===t?void 0:t.productsImported]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Zp,{className:"!tw-gap-0 tw-max-w-xl tw-mx-auto",children:[(0,m.jsx)("div",{"data-cy":"shipping-schedule-title",className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight tw-flex tw-justify-between tw-items-center",children:"Shipping Schedule"}),(0,m.jsxs)("div",{className:"tw-pt-0 tw-grid lg:tw-grid-cols-2 tw-gap-8 tw-mt-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)(vt.J,{children:"What days do you ship?"}),(0,m.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-mt-2",children:(0,m.jsx)(u.ED,{name:"shippingSchedule.shipDays",render:e=>r.map((t,s)=>(0,m.jsx)("div",{className:"tw-w-fit",children:(0,m.jsx)(u.Sc,{name:"shippingSchedule.shipDays[".concat(s,"]"),label:t,checked:i.shippingSchedule.shipDays.includes(t),onChange:s=>{var n,l;const a=i.shippingSchedule.shipDays.indexOf(t);a<0?e.push(t):e.remove(a),null===(n=(l=window).confirmGTMConversionUpdatedShippingSchedule)||void 0===n||n.call(l)},labelPlacement:"end",wrapperClass:"tw-flex-1",isRequired:!0})},s))})})]}),(0,m.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,m.jsx)("div",{children:(0,m.jsx)(u.B0,{type:"time",variant:"outlined",innerContainerClasses:"tw-max-w-32",label:"What is your daily cut off time for same day fulfilment?",name:"shippingSchedule.cutOff",component:wt.A,placeholder:"Pick a time",hourCycle:12,margin:"dense",value:i.shippingSchedule.cutOff,setp:300})}),(0,m.jsx)(u.B0,{name:"shippingSchedule.timezone",label:"Timezone",onChange:e=>{var t,s;e&&(a("shippingSchedule.timezone",e),null===(t=(s=window).confirmGTMConversionUpdatedShippingSchedule)||void 0===t||t.call(s))},isRequired:!0,wrapperClass:"tw-flex-1",component:$e.A,options:R.H8})]})]})]}),(0,m.jsx)("div",{className:"tw-max-w-xl tw-mx-auto tw-w-full",children:s()})]})},gt=e=>{var t,s,i,l,a,o,r,c,h,p,v,w;let x=e.renderActions,g=e.values,y=(e.user,e.setFieldValue),f=e.errors;const b=(0,d.useDispatch)(),j=["FedEx","UPS","USPS","Local Couriers","Regional Carriers","None"];(0,n.useEffect)(()=>{b((0,I.lB)({refreshCarriersServicesOnboarding:!0}))},[]);const A=(null===g||void 0===g||null===(t=g.companyCarrierDetails)||void 0===t?void 0:t.carriers)||[],S=A.includes("UPS")||A.includes("FedEx"),C=A.filter(e=>"None"!==e&&(!S||!["USPS","Local Couriers","Regional Carriers"].includes(e))),N=(null===C||void 0===C?void 0:C.length)>0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Zp,{className:"tw-max-w-2xl tw-mx-auto tw-w-full",children:[(0,m.jsx)("div",{"data-cy":"shipping-schedule-title",className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight tw-flex tw-justify-between tw-items-center",children:"Onboarding"}),(0,m.jsxs)("div",{className:"tw-pt-0 tw-space-y-10",children:[(0,m.jsxs)("section",{className:"tw-space-y-2",children:[(0,m.jsxs)(vt.J,{className:"tw-mb-1.5 !tw-inline",children:["What is your average weekly shipping volume?",(0,m.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,m.jsx)(u.B0,{name:"companyCarrierDetails.shipmentVolume",placeholder:"Select volume",value:null===g||void 0===g||null===(s=g.companyCarrierDetails)||void 0===s?void 0:s.shipmentVolume,isRequired:!0,wrapperClass:"tw-flex-1 tw-max-w-72","data-cy":"companyCarrierDetails-shipmentVolume",component:$e.A,options:[{label:"0 (We haven't started shipping yet)",value:"
10"},{label:"1-50 Shipments",value:"1-50"},{label:"100-500 Shipments",value:"100-500"},{label:"500+ Shipments",value:"500+"}],isTouchedByDefault:!(null===f||void 0===f||null===(i=f.companyCarrierDetails)||void 0===i||!i.shipmentVolume)})]}),(0,m.jsxs)("section",{children:[(0,m.jsxs)(vt.J,{className:"!tw-inline",children:["Which carriers do you currently use for your shipping?",(0,m.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,m.jsx)("div",{className:"tw-flex tw-flex-wrap tw-gap-4 tw-mt-3",children:(0,m.jsx)(u.ED,{name:"companyCarrierDetails.carriers",render:e=>j.map((t,s)=>{var n,i;return(0,m.jsx)("div",{className:"tw-w-fit",children:(0,m.jsx)(u.Sc,{name:"companyCarrierDetails.carriers[".concat(s,"]"),label:t,checked:null===g||void 0===g||null===(n=g.companyCarrierDetails)||void 0===n||null===(i=n.carriers)||void 0===i?void 0:i.includes(t),onChange:s=>{var n,i;const l=null===g||void 0===g||null===(n=g.companyCarrierDetails)||void 0===n||null===(i=n.carriers)||void 0===i?void 0:i.indexOf(t);l<0?e.push(t):e.remove(l)},labelPlacement:"end",wrapperClass:"tw-flex-1",isRequired:!0})},s)})})}),(null===f||void 0===f||null===(l=f.companyCarrierDetails)||void 0===l?void 0:l.carriers)&&(0,m.jsx)(ot.A,{error:f.companyCarrierDetails.carriers,isTouchedByDefault:!0})]}),N&&(0,m.jsxs)("section",{className:"tw-space-y-2",children:[(0,m.jsxs)(vt.J,{className:"tw-mb-1.5 !tw-inline",children:["Do you already have a direct agreement with ".concat(C.map(e=>e).join(", "),"?"),(0,m.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,m.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,m.jsx)(u.$n,{variant:"true"===(null===g||void 0===g||null===(a=g.companyCarrierDetails)||void 0===a?void 0:a.carrierAgreement)?"contained":void 0,onClick:()=>{y("companyCarrierDetails.carrierAgreement","true")},children:"Yes"}),(0,m.jsx)(u.$n,{variant:"false"===(null===g||void 0===g||null===(o=g.companyCarrierDetails)||void 0===o?void 0:o.carrierAgreement)?"contained":void 0,color:"false"===(null===g||void 0===g||null===(r=g.companyCarrierDetails)||void 0===r?void 0:r.carrierAgreement)?"secondary":void 0,onClick:()=>{y("companyCarrierDetails.carrierAgreement","false")},children:"No"})]}),(null===f||void 0===f||null===(c=f.companyCarrierDetails)||void 0===c?void 0:c.carrierAgreement)&&(0,m.jsx)(ot.A,{error:f.companyCarrierDetails.carrierAgreement,isTouchedByDefault:!0})]}),(0,m.jsxs)("section",{className:"tw-space-y-2",children:[(0,m.jsxs)(vt.J,{className:"tw-mb-1.5 !tw-inline",children:["Are you interested in applying for",(0,m.jsx)("span",{className:"tw-text-primary tw-font-bold",children:" ShipFare"}),(0,m.jsx)("span",{className:"tw-text-secondary tw-font-bold",children:"+ "}),"(Discounted overnight rates)?",(0,m.jsx)("span",{className:"tw-text-red-600 tw-pl-1",children:"*"})]}),(0,m.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,m.jsx)(u.$n,{variant:"true"===(null===g||void 0===g||null===(h=g.companyCarrierDetails)||void 0===h?void 0:h.applyShipFareRates)?"contained":void 0,onClick:()=>{y("companyCarrierDetails.applyShipFareRates","true")},children:"Yes"}),(0,m.jsx)(u.$n,{variant:"false"===(null===g||void 0===g||null===(p=g.companyCarrierDetails)||void 0===p?void 0:p.applyShipFareRates)?"contained":void 0,color:"false"===(null===g||void 0===g||null===(v=g.companyCarrierDetails)||void 0===v?void 0:v.applyShipFareRates)?"secondary":void 0,onClick:()=>{y("companyCarrierDetails.applyShipFareRates","false")},children:"No"})]}),(null===f||void 0===f||null===(w=f.companyCarrierDetails)||void 0===w?void 0:w.applyShipFareRates)&&(0,m.jsx)(ot.A,{error:f.companyCarrierDetails.applyShipFareRates,isTouchedByDefault:!0})]})]})]}),(0,m.jsx)("div",{className:"tw-max-w-2xl tw-mx-auto tw-w-full",children:x()})]})},yt=e=>{var t;let s=e.setFieldValue,i=e.values,l=e.renderActions;const a=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.services}),o=(null===(t=i.preferredServices)||void 0===t?void 0:t.selectedServices)||[],r=(0,d.useDispatch)(),c=(0,n.useState)(null),h=(0,x.A)(c,2),p=h[0],v=h[1],w=(0,n.use
1State)((null===i||void 0===i?void 0:i.connectAccount.ownAccountCarrier)||"ups"),g=(0,x.A)(w,2),y=g[0],f=g[1];(0,n.useEffect)(()=>{r((0,I.lB)({refreshCarriersServicesOnboarding:(0,nt.A)()}))},[]);const b=null!==i&&void 0!==i&&i.connectAccount.ownAccountCarrier?[null===i||void 0===i?void 0:i.connectAccount.ownAccountCarrier]:["ups","fedex","usps","Local Couriers"],j=e=>"fedex"===e?"FedEx":"Local Couriers"===e?"Local Couriers":e.toUpperCase();return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Zp,{className:"tw-max-w-xl tw-mx-auto !tw-gap-0",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{"data-cy":"preferred-services-title",className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight tw-flex tw-justify-between tw-items-center",children:"Preferred Services"}),(0,m.jsx)("div",{className:"tw-text-sm dark:tw-text-gray-400",children:"Prioritize the top 3 services used in your business."})]}),(0,m.jsx)("div",{className:"tw-space-y-4 tw-mt-4",children:o.map((e,t)=>{var n;const i=!!e,l=o[t];return(0,m.jsx)("div",{"data-cy":"preferred-services-".concat(t),onClick:()=>{v(t)},className:(0,M.cn)("tw-px-4 tw-py-2 tw-cursor-pointer tw-text-center tw-rounded tw-border-solid tw-relative",i?"tw-border":"tw-border-2 tw-border-dashed tw-border-gray-300 tw-text-gray-400 tw-flex tw-justify-center tw-items-center tw-gap-1"),children:i?(0,m.jsxs)(m.Fragment,{children:[j(null===l||void 0===l?void 0:l.carrier)," - ",null===l||void 0===l||null===(n=l.service)||void 0===n?void 0:n.serviceLabel,(0,m.jsx)("div",{className:"tw-cursor-pointer tw-absolute tw-top-2 tw-right-2",onClick:e=>{e.stopPropagation(),s("preferredServices.selectedServices",o.map((e,s)=>s!==t?e:null))},children:(0,m.jsx)(W.epd,{})})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(W.OMN,{}),"Select Service"]})},t)})}),(0,m.jsx)(ot.A,{name:"preferredServices.selectedServices"})]}),(0,m.jsx)("div",{className:"tw-max-w-xl tw-mx-auto tw-w-full",children:l()}),(0,m.jsxs)(u.aF,{title:"Select Service",actions:[{isClose:!0}],open:null!==p,handleClose:()=>v(null),children:[(0,m.jsx)("div",{className:"tw-flex tw-flex-wrap tw-justify-center tw-gap-4",children:b.map(e=>(0,m.jsx)(u.$n,{color:y===e?"secondary":"inherit",variant:y===e?"contained":"outlined",onClick:()=>{f(e)},children:j(e)},e))}),(0,m.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-mt-4",children:Object.entries(a).filter(e=>{let t=(0,x.A)(e,1)[0];return b.includes(t)}).map((e,t)=>{let n=(0,x.A)(e,2),i=n[0],l=n[1];return y!==i?null:(0,m.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:(0,m.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:l.filter(e=>{var t,s,n,l,a,r;const d=!(null!==o&&void 0!==o&&o.filter(t=>{var s;return(null===t||void 0===t?void 0:t.carrier)===i&&(null===t||void 0===t||null===(s=t.service)||void 0===s?void 0:s.serviceLabel)===e.serviceLabel}).length),c=!(null!==(t=e.serviceLabel)&&void 0!==t&&null!==(s=t.toLowerCase)&&void 0!==s&&null!==(n=s.call(t))&&void 0!==n&&n.includes("worldwide")),u=!(null!==(l=e.serviceLabel)&&void 0!==l&&null!==(a=l.toLowerCase)&&void 0!==a&&null!==(r=a.call(l))&&void 0!==r&&r.includes("international"));return d&&c&&u}).map((e,t)=>(0,m.jsx)("div",{"data-cy":"preferred-services-modal-".concat(null===e||void 0===e?void 0:e.serviceLabel),onClick:()=>{var t,n;s("preferredServices.selectedServices",o.map((t,s)=>s===p?{service:e,carrier:i}:t)),v(null),null===(t=(n=window).confirmGTMConversionAddedPreferredService)||void 0===t||t.call(n)},className:"tw-cursor-pointer tw-p-1 tw-px-2 tw-rounded hover:tw-bg-secondary-light",children:null===e||void 0===e?void 0:e.serviceLabel},t))})},t)})})]})]})},ft=e=>{var t,s,i,l,a,o;let r=e.renderActions,c=e.values,h=e.setFieldValue,p=e.errors;const v=(0,d.useDispatch)();return(0,n.useEffect)(()=>{v((0,I.lB)({refreshCarriersServicesOnboarding:!0}))},[]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Zp,{className:"tw-max-w-xl tw-mx-auto tw-w-full",children:[(0,m.jsx)("div",{"data-cy":"shipping-schedule-title",className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight tw-flex tw-justify-between tw-items-center",children:"Days In Transit"}),(0,m.jsxs)("div",{className:"tw-pt-0 tw-space-y-10",children:[(0,m.jsxs)("section",{className:"tw-space-y-2",children:[(0,m.jsx)(vt.J,{className:"tw-mb-1.5",children:"What is the maximum days in transit acceptable for your products?"}),(0,m.jsx)(u.B0,{name:"daysInTransit.maxTransitDays",placeholder:"Select Days",value:null===c||void 0===c||null===(t=c.daysInTransit)||void 0===t?void 0:t.maxTransitDays,isRequired:!0,wrapperClass:"tw-flex-1 tw-max-w-48","data-cy":"daysInTransit-maxTransitDays",component:$e.A,options:[{label:"1 Day",value:"1"},{label:"2 Days",value:"2"},{label:"3 Days",value:"3"},{label:"4 Days",value:"4"},{label:"5 Days",value:"5"}
1],isTouchedByDefault:!(null===p||void 0===p||null===(s=p.daysInTransit)||void 0===s||!s.maxTransitDays)})]}),(0,m.jsxs)("section",{className:"tw-space-y-2",children:[(0,m.jsx)(vt.J,{className:"tw-mb-1.5",children:"Do you want us to always preselect your cheapest Preferred Service within this transit time?"}),(0,m.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,m.jsx)(u.$n,{variant:"true"===(null===c||void 0===c||null===(i=c.daysInTransit)||void 0===i?void 0:i.selectCheapestService)?"contained":void 0,onClick:()=>{h("daysInTransit.selectCheapestService","true")},children:"Yes"}),(0,m.jsx)(u.$n,{variant:"false"===(null===c||void 0===c||null===(l=c.daysInTransit)||void 0===l?void 0:l.selectCheapestService)?"contained":void 0,color:"false"===(null===c||void 0===c||null===(a=c.daysInTransit)||void 0===a?void 0:a.selectCheapestService)?"secondary":void 0,onClick:()=>{h("daysInTransit.selectCheapestService","false")},children:"No"})]}),(null===p||void 0===p||null===(o=p.daysInTransit)||void 0===o?void 0:o.selectCheapestService)&&(0,m.jsx)(ot.A,{error:p.daysInTransit.selectCheapestService,isTouchedByDefault:!0})]})]})]}),(0,m.jsx)("div",{className:"tw-max-w-xl tw-mx-auto tw-w-full",children:r()})]})};var bt=s(95379);const jt=e=>{var t;let s=e.user,l=e.values,a=e.renderActions;const r=(0,d.useDispatch)(),c=(0,i.useHistory)(),h=(null===s||void 0===s?void 0:s.onboarding)||{},p=(null===h||void 0===h?void 0:h.ownAccountConnected)||(null===l||void 0===l||null===(t=l.connectAccount)||void 0===t?void 0:t.ownAccountConnected),v=null===s||void 0===s?void 0:s.appliedForSFPlus;(0,n.useEffect)(()=>{(async()=>{var e,t;const n=null===l||void 0===l||null===(e=l.connectStore)||void 0===e?void 0:e.platformType,i=null===l||void 0===l||null===(t=l.connectStore)||void 0===t?void 0:t.otherPlatform;if(n)try{await E.Km.post("/email/request-platform",{company:s.companyName,email:s.email||s.companyEmail,platform:"Other"===n?i:n})}catch(a){console.error(a)}})(),(null===h||void 0===h||!h.isCompleted)&&(async()=>{r((0,I.QO)({user:{onboarding:(0,o.A)((0,o.A)({},h),{},{isCompleted:!0})}}));try{var e,t,n;const i=(await E.FH.post("/user/v1/company/edit",{onboarding:(0,o.A)((0,o.A)({},h),{},{lastStep:"CONGRATULATIONS",isCompleted:!0,applyShipfarePlus:!(null===s||void 0===s||!s.appliedForSFPlus),ownAccountConnected:!(null===l||void 0===l||null===(e=l.connectAccount)||void 0===e||!e.ownAccountConnected)})})).data;null===(t=(n=window).confirmGTMConversionOnboarding)||void 0===t||t.call(n),r((0,I.QO)({user:i}))}catch(i){r((0,I.QO)({user:{onboarding:h}})),console.error(i)}})()},[]),(0,n.useEffect)(()=>{(async()=>{try{await E.Km.post("/email/registration-complete")}catch(e){console.error(e)}})()},[]),(0,n.useEffect)(()=>{const e=Date.now()+5e3,t={startVelocity:30,spread:360,ticks:60,zIndex:0},s=(e,t)=>Math.random()*(t-e)+e,n=setInterval(()=>{const i=e-Date.now();if(i<=0)return clearInterval(n);const l=i/5e3*25;(0,bt.t)((0,o.A)((0,o.A)({},t),{},{particleCount:l,origin:{x:s(.1,.3),y:Math.random()-.2}})),(0,bt.t)((0,o.A)((0,o.A)({},t),{},{particleCount:l,origin:{x:s(.7,.9),y:Math.random()-.2}}))},250);return()=>clearInterval(n)},[]),(0,n.useEffect)(()=>{var e,t;null===(e=(t=window).confirmMetaPixelRegistrationComplete)||void 0===e||e.call(t)},[]);const w=v?()=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"tw-text-5xl tw-text-center",children:"\ud83c\udf89"}),(0,m.jsx)("div",{className:"tw-text-lg lg:tw-text-2xl tw-text-center tw-text-secondary tw-font-bold","data-cy":"congratulations-title",children:p?"Congratulations! You\u2019re ready to start shipping with us.":"Amazing! You\u2019re almost ready to start shipping with us."})]}):()=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"tw-text-5xl tw-text-center",children:"\ud83c\udf8a"}),(0,m.jsx)("div",{className:"tw-text-lg lg:tw-text-2xl tw-text-center tw-text-secondary tw-font-bold","data-cy":"congratulations-title",children:"Excellent! You\u2019re ready to start shipping with us."}),(0,m.jsx)("div",{className:"tw-mt-4 tw-text-center",children:"Now come in and let us show you around!"})]});return(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)(u.Zp,{className:"tw-max-w-3xl tw-mx-auto tw-w-full !tw-gap-0","data-cy":"congratulations-card",children:[w(),(0,m.jsxs)("div",{className:"tw-mt-4 tw-text-center tw-space-x-4",children:[(0,m.jsx)(u.$
1n,{"data-cy":"book-demo-button",className:"tw-w-fit",variant:"contained",color:"secondary",onClick:()=>{var e;null!==s&&void 0!==s&&null!==(e=s.shopDomains)&&void 0!==e&&e.length?window.open("https://calendly.com/alex-shipfare/onboarding","_blank"):window.open("https://calendly.com/alex-shipfare/no-store","_blank")},children:"Book a Demo"}),(0,m.jsx)(u.$n,{variant:"contained","data-cy":"congratulations-button",className:"tw-w-fit",onClick:()=>{c.push("/dashboard")},children:"Enter App"})]}),a()]})})},At=e=>{let t=e.values;const s=(0,n.useRef)(!1),i=(0,d.useDispatch)();return(0,n.useEffect)(()=>{s.current?i((0,I.wc)({values:t})):s.current=!0},[t]),null},St=[{label:"Connect Store",stepKeys:["CONNECT_STORE"],widthClass:"tw-max-w-2xl"},{label:"Account",stepKeys:["ACCOUNT_SETTINGS"],widthClass:"tw-max-w-2xl"},{label:"Carrier Details",stepKeys:["COMPANY_CARRIER_DETAILS"],widthClass:"tw-max-w-2xl"},{label:"Rates",stepKeys:["CHOOSE_RATE_PROVIDER","APPLY_NOW"],widthClass:"tw-max-w-2xl"},{label:"Boxes",stepKeys:["BOX_SETUP"],widthClass:"tw-max-w-2xl"},{label:"Shipping Schedule",stepKeys:["SHIPPING_SCHEDULE"],widthClass:"tw-max-w-xl"},{label:"Preferred Services",stepKeys:["PREFERRED_SERVICES"],widthClass:"tw-max-w-xl"},{label:"Days in Transit",stepKeys:["DAYS_IN_TRANSIT"],widthClass:"tw-max-w-xl"}],Ct=e=>{let t=e.steps,s=e.currentStep;const n=Object.keys(t).find(e=>t[e]===s),i=St.findIndex(e=>e.stepKeys.includes(n));return-1===i?null:(0,m.jsxs)("div",{className:(0,M.cn)("tw-mx-auto tw-w-full tw-pb-8 tw-transition-all tw-duration-500 tw-ease-out",St[i].widthClass),"data-cy":"onboarding-progress-bar",children:[(0,m.jsxs)("div",{className:"tw-flex tw-items-center tw-justify-between tw-mb-2",children:[(0,m.jsx)("span",{className:"tw-text-sm tw-font-medium tw-text-secondary",children:St[i].label}),(0,m.jsxs)("span",{className:"tw-text-sm tw-text-muted-foreground",children:["Step ",i+1," of ",St.length]})]}),(0,m.jsx)("div",{className:"tw-flex tw-gap-1.5",children:St.map((e,t)=>{const s=t<i;return(0,m.jsx)("div",{className:"tw-flex-1 tw-h-1.5 tw-rounded-full tw-overflow-hidden tw-bg-gray-200",role:"progressbar","aria-label":e.label,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s?100:0,children:(0,m.jsx)("div",{className:(0,M.cn)("tw-h-full tw-rounded-full tw-bg-primary tw-transition-all tw-duration-500 tw-ease-out",s?"tw-w-full":"tw-w-0")})},e.label)})})]})};var Nt=s(49013),It=s(61440),Dt=s(42663);const kt=()=>{const e=(0,i.useHistory)(),t=(0,d.useSelector)(e=>e.auth.user),s=(0,tt.JG)(t,!(null===t||void 0===t||!t._id));(0,n.useEffect)(()=>{if(!s)return;let t=null;const n=e.block((s,n)=>{if("POP"!==n||(0,X.UD)(s.pathname))return;const i=e.location,l=i.pathname,a=i.search,o=i.hash;return t=setTimeout(()=>e.replace({pathname:l,search:a,hash:o}),0),!1});return()=>{clearTimeout(t),n()}},[e,s])},Pt={REGISTRATION_SUCCESSFUL:0,CONNECT_STORE:1,ACCOUNT_SETTINGS:2,COMPANY_CARRIER_DETAILS:3,CHOOSE_RATE_PROVIDER:4,APPLY_NOW:5,BOX_SETUP:6,SHIPPING_SCHEDULE:7,PREFERRED_SERVICES:8,DAYS_IN_TRANSIT:9,CONGRATULATIONS:10},Et={REGISTRATION_SUCCESSFUL:"REGISTRATION_SUCCESSFUL",CONNECT_STORE:"REGISTRATION_SUCCESSFUL",ACCOUNT_SETTINGS:"CONNECT_STORE",COMPANY_CARRIER_DETAILS:"ACCOUNT_SETTINGS",CHOOSE_RATE_PROVIDER:"COMPANY_CARRIER_DETAILS",APPLY_NOW:"COMPANY_CARRIER_DETAILS",BOX_SETUP:"CHOOSE_RATE_PROVIDER",SHIPPING_SCHEDULE:"BOX_SETUP",PREFERRED_SERVICES:"SHIPPING_SCHEDULE",DAYS_IN_TRANSIT:"PREFERRED_SERVICES",CONGRATULATIONS:"CONGRATULATIONS"},Rt=()=>{var e,t,s;const l=(0,i.useHistory)();kt();const a=(0,d.useSelector)(e=>e.auth.user),r=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.services}),c=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.carriers}),h=(0,d.useSelector)(e=>e.onboarding),p=(0,d.useDispatch)(),v=(0,U.A)(),w=v.toastError,g=v.toastSuccess,y=(0,Nt.sf)();(0,n.useEffect)(()=>{null!==a&&void 0!==a&&a._id&&y&&y.identify(a._id,{email:a.email,name:a.companyName})},[null===a||void 0===a?void 0:a._id,y]);const f=(0,be.Io)({user:a}
1),b=f.weightUnit,j=f.dimensionUnit,A=(0,n.useState)(Pt.REGISTRATION_SUCCESSFUL),S=(0,x.A)(A,2),C=S[0],N=S[1],D=(0,n.useState)(null),k=(0,x.A)(D,2),P=k[0],F=k[1],O=(0,Ee.Ay)({history:l}),B=(null===a||void 0===a?void 0:a.onboarding)||{},L=null===O||void 0===O||null===(e=O.step)||void 0===e||null===(t=e.toString())||void 0===t?void 0:t.toUpperCase(),W=e=>{N(e)};(0,n.useEffect)(()=>{const e=localStorage.getItem(_.cb);e&&(localStorage.removeItem(_.cb),e.includes("isSquareIntegration")?(async e=>{try{var t;const s={code:new URL(e).searchParams.get("code"),userAgent:window.navigator.userAgent},n=await E.Km.post("/private-app/square/accessToken",s);null!==n&&void 0!==n&&null!==(t=n.data)&&void 0!==t&&t._id&&(0,d.vA)(()=>{p((0,I.QO)({user:n.data})),g("Square Store added successfully")})}catch(s){console.log("Failed to install Square Store")}})(e):e.includes("shopify")?(async e=>{try{var t;const s=new URL(e),n={client_id:_.$K,client_secret:_.k3,code:s.searchParams.get("code"),shop:s.searchParams.get("shop"),host:s.searchParams.get("host"),userAgent:window.navigator.userAgent},i=await E.Km.post("/private-app/shopify/accessToken",n);null!==i&&void 0!==i&&null!==(t=i.data)&&void 0!==t&&t._id&&(0,d.vA)(()=>{p((0,I.QO)({user:i.data})),g("Shopify Store added successfully")})}catch(s){console.log("Failed to install Shopify Store",s)}})(e):e.includes("wix")&&(async e=>{try{var t;const s=new URL(e),n={code:s.searchParams.get("code"),state:s.searchParams.get("state"),instanceId:s.searchParams.get("instanceId"),userAgent:window.navigator.userAgent},i=await E.Km.post("/private-app/wix/accessToken",n);null!==i&&void 0!==i&&null!==(t=i.data)&&void 0!==t&&t._id&&(0,d.vA)(()=>{p((0,I.QO)({user:i.data})),g("Wix Store added successfully")})}catch(s){console.log("Failed to install Wix Store")}})(e))},[]),(0,n.useEffect)(()=>{const e="true"===(null===O||void 0===O?void 0:O.integrationCallback)&&"1"===(null===O||void 0===O?void 0:O.success),t="true"===(null===O||void 0===O?void 0:O.carrierIntegrationCallback),s=h.step?h.step:Pt.REGISTRATION_SUCCESSFUL;L||N(e?Pt.ACCOUNT_SETTINGS:t?Pt.CHOOSE_RATE_PROVIDER:s),h.values&&F(h.values),e&&l.push("/onboarding-wizard")},[]),(0,n.useEffect)(()=>{const e=Pt[L];e&&N(e)},[L]),(0,n.useEffect)(()=>{var e;C===Pt.APPLY_NOW&&null!==a&&void 0!==a&&null!==(e=a.onboarding)&&void 0!==e&&e.isCompleted&&l.push("/dashboard")},[C,null===a||void 0===a||null===(s=a.onboarding)||void 0===s?void 0:s.isCompleted]),(0,n.useEffect)(()=>{(0,I.UQ)("show")},[window.Beacon]),(0,n.useEffect)(()=>{const e=document.createElement("script");return e.innerHTML="\n (function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:3658830,hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n ",_.KV&&document.head.appendChild(e),()=>{_.KV&&document.head.removeChild(e)}},[]),(0,n.useLayoutEffect)(()=>{const e=document.createElement("script");return e.innerHTML="\n !function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '3150070408497451');\n fbq('track', 'PageView');\n ",_.KV&&document.head.appendChild(e),()=>{_.KV&&document.head.removeChild(e)}},[]),(0,n.useEffect)(()=>{var e,t;p((0,I.wc)({step:C}));const s=Object.keys(Pt).find(e=>Pt[e]===C);null===y||void 0===y||y.capture("onboarding_".concat(s).toLowerCase(),{step:s,step_number:C,user_id:null===a||void 0===a?void 0:a._id});const n=Et[s],i=null!==(e=Pt[null===B||void 0===B?void 0:B.lastStep])&&void 0!==e?e:-1,l=null!==(t=Pt[n])&&void 0!==t?t:-1;C!==Pt.CONGRATULATIONS&&l>i&&(async()=>{try{const e=(await E.FH.post("/user/v1/company/edit",{onboarding:(0,o.A)((0,o.A)({},B),{},{lastStep:n})})).data;p((0,I.QO)({user:e}))}catch(e){console.error(e)}})()},[C]);const z={[Pt.REGISTRATION_SUCCESSFUL]:{render:e=>(0,m.jsx)(Ae,(0,o.A)({},e)),onSubmit:async()=>{N(Pt.CONNECT_STORE)}},[Pt.CONNECT_STORE]:{render:e=>(0,m.jsx)(Ke,(0,o.A)({},e))},[Pt.ACCOUNT_SETTINGS]:{render:e=>(0,m.jsx)(ct,(0,o.A)({},e)),onSubmit:async e=>{var t,s,n,i;let l=e.values,o=e.setErrors;if(!(0,tt.O$)(l,o).isValid)return;const r=new FormData;var d;
1null!==(t=l.accountSettings.logo)&&void 0!==t&&t.binary&&(r.append("logo",null===(d=l.accountSettings.logo)||void 0===d?void 0:d.binary),r.append("logoOptions",!0));r.append("companyName",l.accountSettings.companyName),r.append("name",l.accountSettings.companyName),r.append("phone",l.accountSettings.phone),r.append("companyPhone",l.accountSettings.phone),r.append("industry",l.accountSettings.industry?dt.A[l.accountSettings.industry]:""),null!==a&&void 0!==a&&null!==(s=a.shopDomains)&&void 0!==s&&s.length&&r.append("website",a.shopDomains[0].shop);const c=(await E.FH.post("/user/v1/company/edit",r)).data;p((0,I.QO)({user:c})),N(e=>e+1),null===(n=(i=window).confirmGTMConversionUpdatedCompany)||void 0===n||n.call(i)}},[Pt.COMPANY_CARRIER_DETAILS]:{render:e=>(0,m.jsx)(gt,(0,o.A)({},e)),onSubmit:async e=>{var t;let s=e.values,n=e.setErrors;if(!(0,tt.j1)(s,n).isValid)return;const i=(await E.FH.post("/user/v1/company/edit?onboarding=true",{onboarding:(0,o.A)((0,o.A)({},B),{},{companyCarrierDetails:s.companyCarrierDetails})})).data;p((0,I.QO)({user:i})),"true"===(null===s||void 0===s||null===(t=s.companyCarrierDetails)||void 0===t?void 0:t.applyShipFareRates)?N(Pt.APPLY_NOW):N(Pt.CHOOSE_RATE_PROVIDER)}},[Pt.APPLY_NOW]:{render:e=>{var t,s;const n="true"===(null===(t=e.values)||void 0===t||null===(s=t.companyCarrierDetails)||void 0===s?void 0:s.applyShipFareRates);return(0,m.jsx)(je.A,(0,o.A)((0,o.A)({},e),{},{toastError:w,onNext:()=>N(n?Pt.CHOOSE_RATE_PROVIDER:Pt.BOX_SETUP),onBack:()=>N(n?Pt.COMPANY_CARRIER_DETAILS:Pt.APPLY_NOW-1)}))},onSubmit:async e=>{var t;let s=e.values,n=e.setErrors,i=e.setFieldError;e.setFieldValue;const l="true"===(null===s||void 0===s||null===(t=s.companyCarrierDetails)||void 0===t?void 0:t.applyShipFareRates);if(_.Zj)return void N(l?Pt.CHOOSE_RATE_PROVIDER:Pt.BOX_SETUP);if(null!==a&&void 0!==a&&a.appliedForSFPlus)return void N(l?Pt.CHOOSE_RATE_PROVIDER:Pt.BOX_SETUP);if((0,tt.av)(s,n).isValid)try{await E.Km.post("/email/apply-shipfare-plus-rates",(0,o.A)((0,o.A)((0,o.A)({},(null===s||void 0===s?void 0:s.applyNow)||{}),(null===s||void 0===s?void 0:s.companyCarrierDetails)||{}),{},{userId:null===a||void 0===a?void 0:a._id})),p((0,I.QO)({user:{appliedForSFPlus:!0}}));const e=(null===a||void 0===a?void 0:a.onboarding)||{},t=(await E.FH.post("/user/v1/company/edit",{onboarding:(0,o.A)((0,o.A)({},e),{},{lastStep:"APPLY_NOW"})})).data;p((0,I.QO)({user:(0,o.A)((0,o.A)({},t),{},{appliedForSFPlus:!0})}))}catch(d){var r;console.error(d),i("applyNow.error",d),null!==d&&void 0!==d&&null!==(r=d.response)&&void 0!==r&&r.data&&"string"===typeof d.response.data&&w(d.response.data)}}},[Pt.CHOOSE_RATE_PROVIDER]:{render:e=>(0,m.jsx)(Re,(0,o.A)({},e)),onSubmit:async()=>{var e;null!==a&&void 0!==a&&null!==(e=a.manualCarrierAccounts)&&void 0!==e&&e.length||null!==a&&void 0!==a&&a.appliedForSFPlus?N(Pt.BOX_SETUP):N(Pt.APPLY_NOW)}},[Pt.BOX_SETUP]:{render:e=>(0,m.jsx)(pt,(0,o.A)({},e)),onSubmit:async e=>{var t;let s=e.setErrors;null!==a&&void 0!==a&&null!==(t=a.boxes)&&void 0!==t&&t.length?N(e=>e+1):s({boxSetup:{boxes:"Please add a box"}})}},[Pt.SHIPPING_SCHEDULE]:{render:e=>(0,m.jsx)(xt,(0,o.A)({},e)),onSubmit:async e=>{let t=e.values,s=e.setErrors;if(!(0,tt.No)(t,s).isValid)return;const n=(0,o.A)({},(0,ye.QU)((0,R.Ay)().get("year"))),i={};Object.keys(n).forEach(e=>{i[e]=!0});const l=(await E.FH.post("/user/v1/company/edit?onboarding=true",{shippingSchedule:{active:!0,dailyMap:(0,It.L)(T.Mq,t.shippingSchedule.shipDays,t.shippingSchedule.cutOff),overrideDates:[],selectedHolidays:i},timezone:t.shippingSchedule.timezone})).data;p((0,I.QO)({user:l})),N(e=>e+1)}},[Pt.PREFERRED_SERVICES]:{render:e=>(0,m.jsx)(yt,(0,o.A)({},e)),onSubmit:async e=>{var t,s,n,i;let l=e.values,a=e.setErrors;if(!(0,tt.hA)(l,a).isValid)return;if(!(null===(t=l.preferredServices)||void 0===t||null===(s=t.selectedServices)||void 0===s?void 0:s.some(e=>e)))return void N(e=>e+1);const d=l.preferredServices.selectedServices.filter(e=>!!e),u=null===(n=d[0])||void 0===n?void 0:n.carrier,h=null===(i=d[0])||void 0===i?void 0:i.service,m=Object.keys(r).reduce((e,t)=>{const s=r[t],n=d.filter(e=>e.carrier===t).map(e=>e.service),i=s.filter(e=>!n.some(t=>(null===t||void 0===t?void 0:t.serviceLabel)===(null===e||void 0===e?void 0:e.serviceLabel)));return e[t]=[...n,...i],e},{}),v=[...c].sort((e,t)=>
1e.carrierValue===u?-1:t.carrierValue===u?1:0),w=null===d||void 0===d?void 0:d.map(e=>{const t=v.find(t=>t.carrierValue===e.carrier),s=(0,o.A)((0,o.A)({},t),e.service);return delete s.active,s}),x=(await E.FH.post("/user/v1/company/edit?onboarding=true",{preferredCarrierServices:w,shipmentPreferences:{carrierPreferences:v,servicePreferences:m},defaultSelectedRate:{carrier:u,service:null===h||void 0===h?void 0:h.serviceValue}})).data;p((0,I.QO)({user:x.user})),N(e=>e+1)}},[Pt.DAYS_IN_TRANSIT]:{render:e=>(0,m.jsx)(ft,(0,o.A)({},e)),onSubmit:async e=>{let t=e.values;const s={label:"Any",value:10};"1"===t.daysInTransit.maxTransitDays?(s.label="1 Day",s.value=1):"2"===t.daysInTransit.maxTransitDays?(s.label="2 Days",s.value=2):"3"===t.daysInTransit.maxTransitDays&&(s.label="3 Days",s.value=3);const n=(await E.FH.post("/user/v1/company/edit?onboarding=true",{defaultSelectedRate:(0,o.A)((0,o.A)({},a.defaultSelectedRate||{}),{},{useCheapestRate:"true"===t.daysInTransit.selectCheapestService,transitDays:s}),onboarding:(0,o.A)((0,o.A)({},B),{},{daysInTransit:t.daysInTransit})})).data;p((0,I.QO)({user:n})),N(e=>e+1)}},[Pt.CONGRATULATIONS]:{render:e=>(0,m.jsx)(jt,(0,o.A)({},e))}},M=()=>{var e,t;return C===Pt.CHOOSE_RATE_PROVIDER?!(null!==a&&void 0!==a&&null!==(t=a.manualCarrierAccounts)&&void 0!==t&&t.length):null===a||void 0===a||null===(e=a.shopDomains)||void 0===e||!e.length||![Pt.CONNECT_STORE].includes(C)},q=()=>{var e;return C!==Pt.CHOOSE_RATE_PROVIDER||!(null===a||void 0===a||null===(e=a.manualCarrierAccounts)||void 0===e||!e.length)};return(0,m.jsxs)("div",{className:"tw-py-12 tw-mb-12 tw-pl-4 tw-pr-4 md:tw-pl-0 md:tw-pr-0",children:[(0,m.jsx)("div",{className:"tw-max-w-56 tw-mx-auto tw-pb-12",children:(0,m.jsx)("img",{src:_.HX,alt:"logo"})}),(0,m.jsx)(Ct,{steps:Pt,currentStep:C}),(0,m.jsx)(u.l1,{enableReinitialize:!0,initialValues:null!==P&&void 0!==P?P:{discountedRates:{shipFromZip:"",shipToZip:"",insurance:"no",declaredValue:"$0",addressType:fe.A.RESIDENTIAL,dimensions:{length:"0",width:"0",height:"0",units:j,weight:{units:b,value:"0"}}},applyNow:{companyName:null!==a&&void 0!==a&&a.isSignupFromSocialAccount?"":a.companyName,phoneNumber:a.companyPhone,industry:"",website:"",address:{address1:"",address2:"",city:"",state:"",country:"",zip:""}},connectAccount:{ownAccountConnected:!1,ownAccountCarrier:""},connectStore:{platformType:null,otherPlatform:null},accountSettings:{logo:null,companyName:"",phone:"",industry:"",warehouses:[],newWarehouse:(0,st.xC)({default:!0,timezone:(0,R.oA)()})},shippingSchedule:{shipDays:["Monday","Tuesday","Wednesday","Thursday"],cutOff:"",timezone:""},preferredServices:{selectedServices:Array(3).fill(null)},defaultSelectedBox:{},companyCarrierDetails:{shipmentVolume:"",carriers:[],carrierAgreement:"",applyShipFareRates:""},daysInTransit:{maxTransitDays:"",selectCheapestService:""}},onSubmit:async(e,t)=>{let s=t.setSubmitting,n=t.setFieldValue,i=t.setErrors,l=t.setFieldError;try{var a;s(!0);const t=null===(a=z[C])||void 0===a?void 0:a.onSubmit;t&&await t({values:e,setFieldValue:n,setErrors:i,setFieldError:l})}catch(o){console.error(o)}finally{s(!1)}},children:e=>{var t,s,n,i,l;let o=e.values,r=e.setFieldValue,d=e.setErrors,c=e.errors,h=e.isSubmitting;const p=(0,Dt.um)(a),v=[{id:"back",label:"Back",className:"tw-mr-auto",type:"button","data-cy":"back-button",onClick:()=>N(e=>{var t;return e===Pt.APPLY_NOW&&"true"===(null===o||void 0===o||null===(t=o.companyCarrierDetails)||void 0===t?void 0:t.applyShipFareRates)?Pt.COMPANY_CARRIER_DETAILS:e!==Pt.BOX_SETUP||null!==a&&void 0!==a&&a.appliedForSFPlus?e-1:Pt.CHOOSE_RATE_PROVIDER}),hide:[Pt.DISCOUNTED_RATES,Pt.CONGRATULATIONS,Pt.CONNECT_STORE].includes(C)||C===Pt.APPLY_NOW&&_.Zj&&!(null!==a&&void 0!==a&&a.appliedForSFPlus)},{id:"next",label:"Next","data-cy":"next-button",type:"button",onClick:()=>{C===Pt.CHOOSE_RATE_PROVIDER?N(Pt.BOX_SETUP):N(e=>e+1)},hide:M()},{id:"next-first",label:"Connect My Own Carrier",variant:"contained",color:"secondary",type:"button","data-cy":"next-first-button",onClick:()=>N(e=>e+1),hide:![Pt.DISCOUNTED_RATES].includes(C)||!!p},{id:"next-first",label:"Start Setup",variant:"contained",color:"secondary",type:"button","data-cy":"next-first-button",onClick:()=>N(e=>e+2),hide:![Pt.DISCOUNTED_RATES].includes(C)||!p},{id:"next-submit",label:(()=>{var e,t;if(C!==Pt.PREFERRED_SERVICES)return"Next";const s=null===(e=o.preferredServices)||void 0===e||null===(t=e.selectedServices)||void 0===t?void 0:t.some(e=>e),n=null===o||void 0===o?void 0:o.connectAccount.ownAccountConnected;return s||n?"Next":"Skip"})(),type:"submit","data-cy":"next-submit-button",variant:"contained",loading:h,disabled:h||C===Pt.BOX_SETUP&&!(null!==a&&void 0!==a&&null!==(t=a.boxes)&&void 0!==t&&t.length)||C===Pt.ACCOUNT_SETTINGS&&!(null!==a&&void 0!==a&&null!==(s=a.warehouses)&&void 0!==s&&s.length),hide:![Pt.ACCOUNT_SETTINGS,Pt.BOX_SETUP,Pt.SHIPPING_SCHEDULE,Pt.PREFERRED_SERVICES,Pt.COMPANY_CARRIER_DETAILS,Pt.DAYS_IN_TRANSIT].includes(C)},{id:"skip",label:"Skip",type:"button","data-cy":"skip-button",onClick:()=>{C===Pt.CHOOSE_RATE_PROVIDER&&null!==a&&void 0!==a&&a.appliedForSFPlus?N(Pt.BOX_SETUP):N(e=>e+1)},hide:q()},{id:"apply-now",label:"Apply for ShipFare+","data-cy":"apply-now-button",variant:"contained",type:"button",onClick:()=>N(Pt.APPLY_NOW),hide:![Pt.DISCOUNTED_RATES].includes(C)},{id:"apply",label:null!==a&&void 0!==a&&a.appliedForSFPlus?"Next":"Apply","data-cy":"apply-button",variant:"contained",color:null!==a&&void 0!==a&&a.appliedForSFPlus?void 0:"secondary",loading:h,disabled:h,type:"submit",hide:![Pt.APPLY_NOW].includes(C)||_.Zj&&!(null!==a&&void 0!==a&&a.appliedForSFPlus)}];return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(At,{values:o}),(0,m.jsx)(u.lV,{children:null!==(n=null===(i=z[C])||void 0===i||null===(l=i.render)||void 0===l?void 0:l.call(i,{values:o,steps:Pt,user:a,errors:c,isSubmitting:h,currentStep:C,setFieldValue:r,renderActions:()=>v.filter(e=>!e.hide).length?(0,m.jsx)("div",{className:"tw-mt-6 tw-gap-1 md:tw-gap-4 tw-flex tw-justify-end",children:v.map(e=>
1e.hide?null:(0,m.jsx)(u.$n,{onClick:e.onClick,variant:e.variant,disabled:e.disabled,"data-cy":e["data-cy"],loading:e.loading,type:e.type,color:e.color,className:e.className,children:e.label},e.id))}):null,setErrors:d,onChangeCurrentStep:W}))&&void 0!==n?n:null})]})}})]})},Tt=()=>{const e=(0,i.useHistory)(),t=(0,d.useDispatch)(),s=(0,n.useState)(""),l=(0,x.A)(s,2),a=l[0],r=l[1];return(0,n.useEffect)(()=>{document.title="Squarespace OAuth - ShipFare"},[]),(0,n.useEffect)(()=>{let s=!0;return(async()=>{try{const n=(0,Ee.Ay)({history:e}),i=n.code,l=n.state;if(n.error)return void(s&&r("Access Denied"));const a=JSON.parse(localStorage.getItem("squarespace_data")||"");if(null===a||void 0===a||!a.stateNonce||null===a||void 0===a||!a.shop)throw new Error("Squarespace request validation failed!");localStorage.removeItem("squarespace_data");const c=a.stateNonce,u=a.shop;if(!(l===c)||!s)throw new Error("Squarespace request validation failed!");const h=(await E.Km.post("/private-app/squarespace/token",{platformType:Te.hb.squarespace,shopDomain:u,code:i})).data;(0,d.vA)(()=>{t((0,I.QO)({user:h})),t((0,I.Gg)((0,o.A)({notice:"OAuth successful. Webhooks are registered successfully for your ".concat(u," store"),autoHideDuration:3e4,closeOnClickAway:!1},oe.Ay.SUCCESS)))}),e.push("/preset/stores")}catch(n){s&&r(n.message)}})(),()=>{s=!1}},[]),null!==a&&void 0!==a&&a.length?(0,m.jsx)(u.o5,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"calc(100vh - 200px)"},className:"tw-text-lg tw-font-bold tw-text-red-500",children:a}):(0,m.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"calc(100vh - 200px)"},children:(0,m.jsx)(u.P,{color:"primary",size:60})})};var Ft=s(56795);const Ot=()=>{const e=(0,d.useDispatch)(),t=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.dryIceTermsModal}),s=(0,n.useState)(!1),i=(0,x.A)(s,2),l=i[0],a=i[1],r=null===t||void 0===t?void 0:t.open,c=null===t||void 0===t?void 0:t.tooltipType,h=!(null===t||void 0===t||!t.viewOnly),p=!(null===t||void 0===t||!t.manual),v=c===Ft.A.DRY_ICE_LABEL,w=()=>e((0,Q.Hs)()),g=()=>e((0,Q.a1)()),y=(e=>{var t,s,i,l;let a=e.tooltipType,r=e.acceptTermsActionCallback;const c=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}
1),u=(0,d.useDispatch)(),h=(0,n.useState)(!1),m=(0,x.A)(h,2),p=m[0],v=m[1],w={[Ft.A.DRY_ICE]:!(null===c||void 0===c||null===(t=c.acceptedTerms)||void 0===t||!t.includes(Ft.A.DRY_ICE)),[Ft.A.DRY_ICE_LABEL]:!(null===c||void 0===c||null===(s=c.acceptedTerms)||void 0===s||!s.includes(Ft.A.DRY_ICE_LABEL))},g=e=>async()=>{v(!0);try{var t;const s=null!==(t=c.acceptedTerms)&&void 0!==t?t:[],n=(0,o.A)((0,o.A)({},(null===c||void 0===c?void 0:c.acceptedTermsDetails)||{}),{},{[e]:{date:(new Date).toISOString(),userId:c._id,userName:c.name,userEmail:c.email}}),i=(await E.FH.post("/user/v1/company/edit",{acceptedTerms:s.concat(e),acceptedTermsDetails:n})).data;(0,d.vA)(()=>{u((0,I.QO)({user:i}))}),v(!1)}catch(s){v(!1)}finally{null===r||void 0===r||r()}},y={[Ft.A.DRY_ICE]:g(Ft.A.DRY_ICE),[Ft.A.DRY_ICE_LABEL]:g(Ft.A.DRY_ICE_LABEL)};return{hasAcceptedTerms:null===(i=w[a])||void 0===i||i,acceptTermsAction:null!==(l=y[a])&&void 0!==l?l:null,submitting:p}})({tooltipType:c,acceptTermsActionCallback:()=>{g(),w()}}),f=y.acceptTermsAction,b=y.submitting,j=()=>
1{if(v&&!p&&!l)return g(),void w();f()},A=v&&!h&&!p;return(0,m.jsx)(u.aF,{open:r,title:v?"Dry Ice Label Printing Requirements":"Dry Ice",handleClose:w,children:v?(0,m.jsxs)("div",{className:"tw-flex tw-flex-col tw-text-base",children:[(0,m.jsx)("div",{className:"tw-text-center",children:(0,m.jsx)("img",{className:"tw-max-h-96 tw-mx-auto",src:"".concat(_.nv,"/Assets/dry-ice-diagram.jpg"),alt:"Dry Ice Diagram"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"tw-text-lg tw-font-bold",children:"Requirements:"}),(0,m.jsxs)("ul",{className:"tw-list-disc tw-pl-5 tw-m-0",children:[(0,m.jsx)("li",{children:'Length of the Diamond MUST measure at least 100mm or 3.95" across each opposite corner'}),(0,m.jsx)("li",{children:'UN 1845 and Dry Ice declaration text MUST measure at least 12mm or .48" tall'}),(0,m.jsx)("li",{children:'Ensure that all padding is removed when printing on 4" x 6" labels'})]})]}),(0,m.jsx)("div",{className:"tw-mt-4 tw-font-bold tw-text-red-500",children:"Failure to meet these size requirements will result in your shipments being returned or discarded by the carrier without recourse."}),h?(0,m.jsx)("div",{className:"tw-w-full tw-flex tw-justify-end tw-mt-2",children:(0,m.jsx)(u.$n,{variant:"outlined",onClick:w,children:"Close"})}):(0,m.jsxs)("div",{className:"tw-flex tw-items-center tw-mt-2 ".concat(A?"tw-justify-between":"tw-justify-end"),children:[A&&(0,m.jsx)(u.Sc,{checked:l,onChange:()=>a(e=>!e),label:"Don't Show Again",labelPlacement:"end",fullWidth:!1}),(0,m.jsx)(u.$n,{color:"secondary",variant:"contained",loading:b,disabled:b,onClick:j,children:"Acknowledge"})]})]}):(0,m.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-base",children:[(0,m.jsxs)("div",{children:["It is ",(0,m.jsx)("strong",{children:"critical"})," that you and your team maintain strict compliance with"," ",(0,m.jsx)("a",{href:"https://www.ecfr.gov/current/title-49/subtitle-B/chapter-I/subchapter-C/part-173/subpart-E/section-173.217",target:"_blank",rel:"noreferrer",children:"CFR 49"})," ","and/or"," ",(0,m.jsx)("a",{href:"https://www.iata.org/contentassets/b08040a138dc4442a4f066e6fb99fe2a/en_form_dryice.pdf",target:"_blank",rel:"noreferrer",children:"IATA"})," ","when shipping hazardous materials like Dry Ice."]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("strong",{children:"Failure to declare Dry Ice"})," on a package will result in immediate suspension of your shipping account, and will result in your shipments getting held, returned, or destroyed by the carrier with zero recourse."]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("strong",{children:"DECLARE IT!"})," ","Always print and apply the labels that we provide (UN 1845 or Class 9 Diamond) on the outside of each and every package containing Dry Ice. For further guidance on how to declare Dry Ice, please see our"," ",(0,m.jsx)("a",{href:"".concat(_.GG,"/docs/how-do-i-use-dry-ice"),target:"_blank",rel:"noreferrer",children:"help doc"})," ","on the matter."]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("strong",{children:"Train ALL employees and individuals"})," involved in your packaging and fulfillment department to declare, pack, label, double-check, and triple-check that all packages containing Dry Ice are compliant."]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("strong",{children:"Call the Hazardous Material Support Center At 1-800-554-9964"})," ","with any questions regarding compliance of the packaging and labeling of your shipments."]}),(0,m.jsx)("div",{className:"tw-w-full tw-flex tw-flex-row-reverse",children:h?(0,m.jsx)(u.$n,{variant:"outlined",onClick:w,children:"Close"}):(0,m.jsx)(u.$n,{color:"secondary",variant:"contained",loading:b,disabled:b,onClick:j,children:"I Understand and Agree"})})]})})};var _t=s(63584),Bt=s(84545);const Ut=()=>{const e=(0,d.useDispatch)(),t=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),s=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.progressReport}),i=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.orders)||void 0===t?void 0:t.processedOrders}),l=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.orders)||void 0===t?void 0:t.orders}),a=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.storeOpsResults}),r=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.lastOverallStats}),c=(0,d.useSelector)(e=>null===e||void 0===e?void 0:e.notifications),u=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.orders)||void 0===t?void 0:t.allFilterOrdersSearch}),h=(0,n.useRef)(!1),m=(0,n.useRef)(!1),p=(0,n.useRef)(0),v=(0,n.useRef)(i);v.current=i;const w=(0,n.useRef)(r);w.current=r,(0,n.useEffect)(()=>{const n=async()=>{const i=v.current,r=Object.keys(i);if(r.length||u)if(h.current)m.current=!0;else{h.current=!0;try{let n="/orders/byIds";u&&(n+=u);const h=(await E.Dp.post(n,{orderIds:u?null:r,forBulkStats:!0,allFilterOrdersSearch:!!u})).data,m=(null===h||void 0===h?void 0:h.orders)||[];let p={success:[],failed:[],warnings:[]};const v={totalEditable:0,totalPurchasable:0,totalRefundable:0,totalFulfillable:0,totalUnFulfillable:0,totalPrintable:0};let g=Object.keys(i);if(u&&(g=m.map(e=>
1e._id)),g.forEach(e=>{var t,s;let n=null===m||void 0===m?void 0:m.find(t=>t._id===e);n||(n=null===l||void 0===l?void 0:l.find(t=>t._id===e)),n&&null!==(t=n)&&void 0!==t&&null!==(s=t.shipments)&&void 0!==s&&s.length&&(n.shipments.forEach((e,t)=>{var s,i,l,a,r,d,c,u,h,m,w,x,g,y,f,b,j,A,S,C,N,I,D;const k={isEditable:e.isEditable,isPurchasable:e.isPurchasable,isRefundable:e.isRefundable,isFulfillable:e.isFulfillable,isUnFulfillable:e.isUnFulfillable,isPrintable:e.isPrintable};k.isEditable&&(v.totalEditable+=1),k.isPurchasable&&(v.totalPurchasable+=1),k.isRefundable&&(v.totalRefundable+=1),k.isFulfillable&&(v.totalFulfillable+=1),k.isUnFulfillable&&(v.totalUnFulfillable+=1),k.isPrintable&&(v.totalPrintable+=1);const P={orderNumber:n.orderNumber,shipmentNumber:t+1,orderId:n._id,shipmentId:null===e||void 0===e||null===(s=e.createdShipment)||void 0===s?void 0:s.id};var E;if(null!==e&&void 0!==e&&null!==(i=e.error)&&void 0!==i&&null!==(l=i.shipmentError)&&void 0!==l&&l.length||null!==(a=n.error)&&void 0!==a&&a.message||null!==e&&void 0!==e&&null!==(r=e.error)&&void 0!==r&&null!==(d=r.message)&&void 0!==d&&d.length)p.failed.push((0,o.A)((0,o.A)({},P),{},{info:(0,_t.QX)({errorObject:null!==(E=null===e||void 0===e?void 0:e.error)&&void 0!==E?E:n.error})}));else if(null!==(c=n)&&void 0!==c&&c.hasAddressError&&null!==(u=n)&&void 0!==u&&null!==(h=u.shippingAddress)&&void 0!==h&&null!==(m=h.verifications)&&void 0!==m&&m.customError){var R,T,F,O;p.warnings.push((0,o.A)((0,o.A)((0,o.A)({},P),k),{},{info:"".concat(n.shippingAddress.verifications.customError," ").concat((0,_t.hq)({errorList:(null===(R=n)||void 0===R||null===(T=R.shippingAddress)||void 0===T||null===(F=T.verifications)||void 0===F||null===(O=F.delivery)||void 0===O?void 0:O.errors)||[]}))}))}else if(null===(w=n)||void 0===w||!w.hasAddressError||null===(x=n)||void 0===x||null===(g=x.shippingAddress)||void 0===g||null===(y=g.verifications)||void 0===y||!y.suggestedAddress||null!==e&&void 0!==e&&null!==(f=e.label)&&void 0!==f&&f.id)if(null===(b=n)||void 0===b||!b.hasAddressError||null===(j=n)||void 0===j||null===(A=j.shippingAddress)||void 0===A||!A.verifications||null!==(S=n)&&void 0!==S&&null!==(C=S.shippingAddress)&&void 0!==C&&null!==(N=C.verifications)&&void 0!==N&&null!==(I=N.delivery)&&void 0!==I&&I.success||null!==e&&void 0!==e&&null!==(D=e.label)&&void 0!==D&&D.id)p.success.push((0,o.A)((0,o.A)({},P),k));else{var _,B,U,L;p.warnings.push((0,o.A)((0,o.A)((0,o.A)({},P),k),{},{info:(0,_t.hq)({errorList:(null===(_=n)||void 0===_||null===(B=_.shippingAddress)||void 0===B||null===(U=B.verifications)||void 0===U||null===(L=U.delivery)||void 0===L?void 0:L.errors)||[]})}))}else{var W;p.warnings.push((0,o.A)((0,o.A)((0,o.A)({},P),k),{},{info:"".concat(n.shippingAddress.verifications.message," ").concat((0,_t.hq)({address:null===(W=n)||void 0===W?void 0:W.shippingAddress}))}))}}),p=(0,o.A)((0,o.A)({},p),v))}),a){let n=p;var x;if("Order CSV import"===(null===c||void 0===c?void 0:c.bulkOpsType))n=null===s||void 0===s||null===(x=s.csvProgress)||void 0===x?void 0:x.find(e=>"orderImport"===(null===e||void 0===e?void 0:e.entity));const i={type:null===c||void 0===c?void 0:c.type,message:"Bulk Buy"===(null===c||void 0===c?void 0:c.bulkOpsType)?c.message:c.notice,bulkOpsType:null===c||void 0===c?void 0:c.bulkOpsType,teamId:null===t||void 0===t?void 0:t.teamId,bulkOpsResult:n,overallStats:w.current||null,customType:null===c||void 0===c?void 0:c.customType};(0,Bt.UI)(i),(0,d.vA)(()=>{e((0,I.QO)({storeOpsResults:!1,lastBulkOpsResult:i,lastOverallStats:null})),e((0,I.Iq)(!0)),e((0,I.dk)()),e((0,I.CW)({allFilterOrdersSelected:!1,allFilterOrdersSearch:null}))})}}finally{h.current=!1,m.current&&p.current<3?(m.current=!1,p.current+=1,setTimeout(n,0)):(m.current=!1,p.current=0)}}else e((0,I.QO)({storeOpsResults:!1}))};a&&(p.current=0,n())},[a])},Lt=(e,t)=>{var s,n,i,l,a,o,r,d,c,u,h,m,p,v,w,x,g,y,f,b,j,A,S,C,N,I,D,k,P,E;const R="processing"===(null===e||void 0===e||null===(s=e.bulkEdit)||void 0===s?void 0:s.status)&&(null===e||void 0===e||null===(n=e.bulkEdit)||void 0===n?void 0:n.done)<=(null===e||void 0===e||null===(i=e.bulkEdit)||void 0===i?void 0:i.total)&&Object.keys((null===e||void 0===e||null===(l=e.bulkEdit)||void 0===l?void 0:l.orderDetails)||{}).length,T="processing"===(null===e||void 0===e||null===(a=e.bulkBuy)||void 0===a?void 0:a.status)&&(null===e||void 0===e||null===(o=e.bulkBuy)||void 0===o?void 0:o.done)<=(null===e||void 0===e||null===(r=e.bulkBuy)||void 0===r?void 0:r.total)&&Object.keys((null===e||void 0===e||null===(d=e.bulkBuy)||void 0===d?void 0:d.orderDetails)||{}).length,F="processing"===(null===e||void 0===e||null===(c=e.bulkRefund)||void 0===c?void 0:c.status)&&(null===e||void 0===e||null===(u=e.bulkRefund)||void 0===u?void 0:u.done)<=(null===e||void 0===e||null===(h=e.bulk
1Refund)||void 0===h?void 0:h.total)&&Object.keys((null===e||void 0===e||null===(m=e.bulkRefund)||void 0===m?void 0:m.orderDetails)||{}).length,O="processing"===(null===e||void 0===e||null===(p=e.bulkFulfill)||void 0===p?void 0:p.status)&&(null===e||void 0===e||null===(v=e.bulkFulfill)||void 0===v?void 0:v.done)<=(null===e||void 0===e||null===(w=e.bulkFulfill)||void 0===w?void 0:w.total)&&Object.keys((null===e||void 0===e||null===(x=e.bulkFulfill)||void 0===x?void 0:x.orderDetails)||{}).length,_="processing"===(null===e||void 0===e||null===(g=e.bulkStatus)||void 0===g?void 0:g.status)&&(null===e||void 0===e||null===(y=e.bulkStatus)||void 0===y?void 0:y.done)<=(null===e||void 0===e||null===(f=e.bulkStatus)||void 0===f?void 0:f.total)&&Object.keys((null===e||void 0===e||null===(b=e.bulkStatus)||void 0===b?void 0:b.orderDetails)||{}).length,B="processing"===(null===e||void 0===e||null===(j=e.bulkReturn)||void 0===j?void 0:j.status)&&(null===e||void 0===e||null===(A=e.bulkReturn)||void 0===A?void 0:A.done)<=(null===e||void 0===e||null===(S=e.bulkReturn)||void 0===S?void 0:S.total),U="processing"===(null===e||void 0===e||null===(C=e.bulkOrderDuplicate)||void 0===C?void 0:C.status)&&(null===e||void 0===e||null===(N=e.bulkOrderDuplicate)||void 0===N?void 0:N.done)<=(null===e||void 0===e||null===(I=e.bulkOrderDuplicate)||void 0===I?void 0:I.total),L=null===e||void 0===e||null===(D=e.csvProgress)||void 0===D?void 0:D.find(e=>"orderImport"===e.entity),W="processing"===(null===L||void 0===L?void 0:L.status),z=null===e||void 0===e||null===(k=e.importProgress)||void 0===k?void 0:k.find(e=>"order"===e.entity),M="processing"===(null===z||void 0===z?void 0:z.status),q=null===e||void 0===e||null===(P=e.importProgress)||void 0===P?void 0:P.find(e=>"product"===e.entity),V="processing"===(null===q||void 0===q?void 0:q.status),K=null===e||void 0===e||null===(E=e.importProgress)||void 0===E?void 0:E.find(e=>"customer"===e.entity),Y="processing"===(null===K||void 0===K?void 0:K.status);return{isAnyBulkOpInProgress:!!(R||T||F||O||_||B||U||W||null!==t&&void 0!==t&&t.allSelectInProgress),isAnyImportOpInProgress:!!(M||V||Y),editInProcess:R,buyInProcess:T,refundInProcess:F,fulfillInProcess:O,updateStatusInProcess:_,returnInProcess:B,duplicateInProcess:U,allSelectInProgress:null===t||void 0===t?void 0:t.allSelectInProgress,orderCsvInProcess:W,orderSyncInProcess:M,productSyncInProcess:V,customerSyncInProcess:Y}},Wt=()=>{const e=(0,d.useDispatch)(),t=(0,d.useSelector)(e=>{var t,s,n;return{showPrintLabelsModal:null===e||void 0===e||null===(t=e.orders)||void 0===t?void 0:t.showPrintLabelsModal,user:null===e||void 0===e||null===(s=e.auth)||void 0===s?void 0:s.user,progressReport:null===e||void 0===e||null===(n=e.auth)||void 0===n?void 0:n.progressReport}}),s=t.showPrintLabelsModal,i=t.user,l=t.progressReport,a=(0,n.useRef)(null),o=(0,n.useRef)(0),r=(0,n.useRef)(null),c=(0,n.useRef)(0),u=(0,n.useRef)(null),h=(0,n.useRef)(0),m=Lt(l,i),p=m.isAnyBulkOpInProgress,v=m.isAnyImportOpInProgress;(0,n.useEffect)(()=>(u.current&&(clearInterval(u.current),a.current=null,o.current=null,r.current=null),h.current=0,(p||v)&&(a.current=new Date,o.current=0,r.current=l,u.current=setInterval(async()=>{var t,n;let l,d;try{const e=(await E.Dp.get("/shipments/progress-report/polling")).data;l=e.progressReport,d=e.user,c.current=0}catch(T){return console.log("Error in progress report polling - Count: ".concat(c.current+1,": "),T),a.current=new Date,void(c.current>=10?(clearInterval(u.current),a.current=null,o.current=0,r.current=null,c.current=0):c.current+=1)}if(!l)return;const m=Lt(l,d||i),p=m.isAnyBulkOpInProgress,v=m.isAnyImportOpInProgress,w=m.editInProcess,x=m.buyInProcess,g=m.refundInProcess,y=m.fulfillInProcess,f=m.updateStatusInProcess,b=m.returnInProcess,j=m.duplicateInProcess,A=m.orderCsvInProcess,S=m.allSelectInProgress,C=m.orderSyncInProcess,N=m.productSyncInProcess,D=m.customerSyncInProcess;x?h.current+=1:h.current=0,e((0,I.N6)(l)),s&&"processed"===(null===(t=l)||void 0===t||null===(n=t.bulkBuy)||void 0===n?void 0:n.status)&&e((0,I.CW)({allSelectInProgress:!1,bulkPrintLabelsReady:!0,allFilterOrdersSelected:!1}));const P=(0,R.Ay)().diff((0,R.Ay)(a.current),"seconds")>=30;if(P&&(0,k.isEqual)(r.current,l)){if(x&&h.current>=30||!x){if(p||o.current>2){const t=[];
1w&&t.push("bulkEdit"),x&&t.push("bulkBuy"),g&&t.push("bulkRefund"),y&&t.push("bulkFulfill"),f&&t.push("bulkStatus"),b&&t.push("bulkReturn"),j&&t.push("bulkOrderDuplicate"),A&&t.push("csvProgress"),S&&t.push("allSelectInProgress"),v&&t.push("importProgress"),e((0,I.C3)({operations:t})),x&&e((0,I.CW)({loading:!1,showPrintLabelsModal:!1,bulkPrintLabelsReady:!1}))}if(v&&o.current<=2){const t=[];C&&t.push("orderSync"),N&&t.push("productSync"),D&&t.push("customerSync");try{const s=(await E.Dp.post("/shipments/progress-report/restart",{operations:t})).data;e((0,I.N6)(s)),r.current=s}catch(T){console.log("Error restarting import ops: ",T)}o.current+=1}a.current=new Date,h.current=0}}else P&&(r.current=l,a.current=new Date)},8e3)),()=>{u.current&&(clearInterval(u.current),u.current=null,a.current=null,o.current=null,r.current=null,h.current=0)}),[p,v])},zt=()=>{var e,t;const s=(0,d.useDispatch)(),i=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user});(0,n.useEffect)(()=>{var e,t;const n=(0,Pe.lV)(),l=null===n||void 0===n?void 0:n.some(e=>{var t;return!(null!==i&&void 0!==i&&null!==(t=i.acceptedTerms)&&void 0!==t&&t.some(t=>t===e))}),a=!(null!==i&&void 0!==i&&i.hasOrder)||(0,Dt._)(i)||(0,R.Ay)(i.createdAt).isAfter((0,R.Ay)("2026-05-01")),o=!(null===i||void 0===i||null===(e=i.vndrRatesConfig)||void 0===e||null===(t=e.vndrRates)||void 0===t||!t.allowed);l&&a&&o&&s((0,I.lB)({shipfarePlusTos:{show:!0}}))},[s,null===i||void 0===i?void 0:i.acceptedTerms,null===i||void 0===i?void 0:i.hasOrder,null===i||void 0===i||null===(e=i.vndrRatesConfig)||void 0===e||null===(t=e.vndrRates)||void 0===t?void 0:t.allowed])},Mt=()=>{const e=(0,d.useDispatch)(),t=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),s=(0,d.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.shipfarePlusTos)||{}}),i=(0,n.useState)(!1),l=(0,x.A)(i,2),a=l[0],r=l[1],c=(0,n.useState)([]),h=(0,x.A)(c,2),p=h[0],v=h[1],w=(0,n.useState)(!1),g=(0,x.A)(w,2),y=g[0],f=g[1],b=!(null===s||void 0===s||!s.manual);(0,n.useEffect)(()=>{s.show&&r(!0)},[s.show]);const j=(0,Pe.lV)();return(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(u.aF,{maxWidth:"sm",withCloseButton:b,disableEscapeKeyDown:!b,title:(0,m.jsxs)(m.Fragment,{children:["Confirm ",(0,m.jsx)("span",{className:"tw-text-primary",children:"ShipFare"}),(0,m.jsx)("span",{className:"tw-text-secondary",children:"+"})," UPS Terms & Restrictions"]}),open:a,handleClose:b?()=>{e((0,I.lB)({shipfarePlusTos:{show:!1,manual:!1}}
1)),r(!1)}:()=>{},actions:[{label:"Confirm",loading:y,disabled:(null===p||void 0===p?void 0:p.length)!==(null===j||void 0===j?void 0:j.length)||y,onClick:async()=>{(null===p||void 0===p?void 0:p.length)===(null===j||void 0===j?void 0:j.length)&&await(async()=>{f(!0);try{var s;const n=new Set(null!==(s=t.acceptedTerms)&&void 0!==s?s:[]),i=(0,o.A)({},(null===t||void 0===t?void 0:t.acceptedTermsDetails)||{});p.forEach(e=>{n.add(e),i[e]={date:(new Date).toISOString(),userId:t._id,userName:t.name,userEmail:t.email}});const l=(await E.FH.post("/user/v1/company/edit",{acceptedTerms:Array.from(n),acceptedTermsDetails:i})).data;(0,d.vA)(()=>{e((0,I.QO)({user:l}))}),e((0,I.lB)({shipfarePlusTos:{show:!1,manual:!1}})),r(!1)}catch(n){console.error(n)}finally{f(!1)}})()}}],children:(0,m.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,m.jsx)("section",{className:"tw-text-5xl tw-text-center",children:"\ud83c\udf89"}),(0,m.jsxs)("section",{className:"tw-text-2xl tw-text-secondary tw-font-bold tw-text-center",children:["Congratulations! You've been approved for ",(0,m.jsx)("span",{className:"tw-text-primary",children:"ShipFare"}),(0,m.jsx)("span",{className:"tw-text-secondary",children:"+"})," UPS rates."]}),(0,m.jsx)("section",{children:"Before you begin shipping, please review the following important UPS Terms and Restrictions."}),(0,m.jsxs)("section",{className:"tw-space-y-4",children:[(0,m.jsxs)("div",{children:["I have read and agree to the"," ",(0,m.jsx)("a",{href:"https://www.ups.com/assets/resources/webcontent/en_US/terms_service_us.pdf",target:"_blank",rel:"noopener noreferrer",children:"UPS Tariff Terms"}),(0,m.jsx)("span",{className:"!tw-no-underline",children:","})," ",(0,m.jsx)("a",{href:"https://www.ups.com/assets/resources/webcontent/en_US/UTA.pdf",target:"_blank",rel:"noopener noreferrer",children:"UPS Supplemental Terms"}),(0,m.jsx)("span",{className:"!tw-no-underline",children:","})," ",(0,m.jsx)("a",{href:"https://www.ups.com/us/en/support/shipping-support/shipping-special-care-regulated-items/prohibited-items.page",target:"_blank",rel:"noopener noreferrer",children:"UPS List of Restricted Items"}),(0,m.jsx)("span",{className:"!tw-no-underline"})]}),(0,m.jsx)("div",{className:"tw-flex tw-items-center tw-gap-2",children:(0,m.jsx)(u.Sc,{labelClassName:"!tw-font-bold",fullWidth:!1,labelPlacement:"end",checked:(null===p||void 0===p?void 0:p.length)===(null===j||void 0===j?void 0:j.length),onChange:()=>{v((null===p||void 0===p?void 0:p.length)===(null===j||void 0===j?void 0:j.length)?[]:j)},label:"I Agree to UPS Terms of Use."})})]})]})})})},qt=()=>{var e,t;const s=(0,d.useDispatch)(),i=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user});(0,n.useEffect)(()=>{var e,t;const n=(0,Pe.Ts)(),l=null===n||void 0===n?void 0:n.some(e=>{var t;return!(null!==i&&void 0!==i&&null!==(t=i.acceptedTerms)&&void 0!==t&&t.some(t=>t===e))}),a=!(null!==i&&void 0!==i&&i.hasOrder)||(0,Dt._)(i)||(0,R.Ay)(i.createdAt).isAfter((0,R.Ay)("2026-05-01")),o=!(null===i||void 0===i||null===(e=i.vndrRatesConfig)||void 0===e||null===(t=e.fedex)||void 0===t||!t.allowed);l&&a&&o&&s((0,I.lB)({shipfarePlusTosFedex:{show:!0}}))},[s,null===i||void 0===i?void 0:i.acceptedTerms,null===i||void 0===i?void 0:i.hasOrder,null===i||void 0===i||null===(e=i.vndrRatesConfig)||void 0===e||null===(t=e.fedex)||void 0===t?void 0:t.allowed])},Vt=()=>{const e=(0,d.useDispatch)(),t=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),s=(0,d.useSelector)(e=>{var t;return(null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.shipfarePlusTosFedex)||{}}),i=(0,n.useState)(!1),l=(0,x.A)(i,2),a=l[0],r=l[1],c=(0,n.useState)([]),h=(0,x.A)(c,2),p=h[0],v=h[1],w=(0,n.useState)(!1),g=(0,x.A)(w,2),y=g[0],f=g[1],b=!(null===s||void 0===s||!s.manual),j=(0,Pe.Ts)();(0,n.useEffect)(()=>{s.show&&r(!0)},[s.show]);return(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(u.aF,{maxWidth:"sm",withCloseButton:b,disableEscapeKeyDown:!b,title:(0,m.jsxs)(m.Fragment,{children:["Confirm ",(0,m.jsx)("span",{className:"tw-text-primary",children:"ShipFare"}),(0,m.jsx)("span",{className:"tw-text-secondary",children:"+"})," FedEx Terms & Restrictions"]}),open:a,handleClose:b?()=>{e((0,I.lB)({shipfarePlusTosFedex:{show:!1,manual:!1}}
1)),r(!1)}:()=>{},actions:[{label:"Confirm",loading:y,disabled:(null===p||void 0===p?void 0:p.length)!==(null===j||void 0===j?void 0:j.length)||y,onClick:async()=>{(null===p||void 0===p?void 0:p.length)===(null===j||void 0===j?void 0:j.length)&&await(async()=>{f(!0);try{var s;const n=new Set(null!==(s=t.acceptedTerms)&&void 0!==s?s:[]),i=(0,o.A)({},(null===t||void 0===t?void 0:t.acceptedTermsDetails)||{});p.forEach(e=>{n.add(e),i[e]={date:(new Date).toISOString(),userId:t._id,userName:t.name,userEmail:t.email}});const l=(await E.FH.post("/user/v1/company/edit",{acceptedTerms:Array.from(n),acceptedTermsDetails:i})).data;(0,d.vA)(()=>{e((0,I.QO)({user:l}))}),e((0,I.lB)({shipfarePlusTosFedex:{show:!1,manual:!1}})),r(!1)}catch(n){console.error(n)}finally{f(!1)}})()}}],children:(0,m.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,m.jsx)("section",{className:"tw-text-5xl tw-text-center",children:"\ud83c\udf89"}),(0,m.jsxs)("section",{className:"tw-text-2xl tw-text-secondary tw-font-bold tw-text-center",children:["Congratulations! You've been approved for"," ",(0,m.jsx)("span",{className:"tw-text-primary",children:"ShipFare"}),(0,m.jsx)("span",{className:"tw-text-secondary",children:"+"})," FedEx rates."]}),(0,m.jsxs)("section",{children:["Before you begin shipping, please review and agree to the following"," ",(0,m.jsx)("a",{href:"https://www.fedex.com/en-us/terms-of-use.html",target:"_blank",rel:"noreferrer",children:"FedEx Terms of Use"})," ","and verify that all shipments with"," ",(0,m.jsx)("a",{href:"https://www.fedex.com/en-us/service-guide/dangerous-goods-hazardous-materials.html#dangerous-goods",target:"_blank",rel:"noreferrer",children:"Dangerous Goods or Hazardous Materials"})," ","will be tendered to FedEx in accordance with"," ",(0,m.jsx)("a",{href:"https://www.ecfr.gov/current/title-49/subtitle-B",target:"_blank",rel:"noreferrer",children:"49 CFR Subtitle B"}),"."]}),(0,m.jsxs)("section",{className:"tw-space-y-4",children:[(0,m.jsxs)("div",{children:["I have read and agree to"," ",(0,m.jsx)("a",{href:"https://www.fedex.com/en-us/terms-of-use.html",target:"_blank",rel:"noreferrer",children:"FedEx Terms of Use"})," ","and fully understand how to identify and ship"," ",(0,m.jsx)("a",{href:"https://www.fedex.com/en-us/service-guide/dangerous-goods-hazardous-materials.html#dangerous-goods",target:"_blank",rel:"noreferrer",children:"Dangerous Goods or Hazardous Materials"})," ","such as"," ",(0,m.jsx)("a",{href:"https://www.fedex.com/en-us/shipping/how-to-ship-dry-ice.html",target:"_blank",rel:"noreferrer",children:"Dry Ice"})," ","in accordance with the law."]}),(0,m.jsx)("div",{className:"tw-flex tw-items-center tw-gap-2",children:(0,m.jsx)(u.Sc,{labelClassName:"!tw-font-bold",fullWidth:!1,labelPlacement:"end",checked:(null===p||void 0===p?void 0:p.length)===(null===j||void 0===j?void 0:j.length),onChange:()=>{v((null===p||void 0===p?void 0:p.length)===(null===j||void 0===j?void 0:j.length)?[]:j)},label:"I Agree to FedEx Terms of Use."})})]})]})})})};var Kt=s(5122),Yt=s(15634),Gt=s(33886),Ht=s(2601),$t=s(1592),Qt=s(50500),Jt=s(34634);function Zt(){const e=(0,Gt.A)(),t=e.getUserBatches,s=e.handleNewBatch,l=(0,i.useHistory)(),a=(0,d.useSelector)(e=>e.auth.user),o=(0,n.useState)([]),r=(0,x.A)(o,2),c=r[0],h=r[1],p=(0,n.use
1State)(0),v=(0,x.A)(p,2),w=v[0],g=v[1],y=(0,n.useState)(!1),f=(0,x.A)(y,2),b=f[0],j=f[1],A=(0,n.useState)(!1),S=(0,x.A)(A,2),C=S[0],N=S[1],I=(0,n.useState)(!1),D=(0,x.A)(I,2),k=D[0],P=D[1],E=(0,n.useState)(a.lastBatchNumber?parseInt(a.lastBatchNumber,10)+1:1e5),F=(0,x.A)(E,2),O=F[0],_=F[1],B=(0,Ee.Ay)({history:l}),U=(null===B||void 0===B?void 0:B.page)||1,L=(null===B||void 0===B?void 0:B.limit)||10;(0,n.useEffect)(()=>{(async()=>{try{var e;j(!0);const s=(await t(U,L)).data;h(null===s||void 0===s?void 0:s.batches),g(null===s||void 0===s?void 0:s.total),null!==s&&void 0!==s&&null!==(e=s.batches)&&void 0!==e&&e.length&&_(parseInt(s.batches[0].batchNumber+1))}catch(s){console.log(s)}finally{j(!1)}})()},[U,L,k]);const z=()=>{N(!1)},M=[{head:"Number",field:"batchNumber",render:(e,t)=>(0,m.jsx)(Ht.N_,{to:"/batch/".concat(t.id),children:t.label||t.batchNumber})},{head:"Order Count",field:"totalOrders"},{head:"Date Created",field:"createdAt",render:(e,t)=>(0,R.Ay)(t.createdAt).format(T.DX)},{head:"Notes",field:"notes"}];return(0,m.jsxs)(m.Fragment,{children:[(null===c||void 0===c?void 0:c.length)>0?(0,m.jsxs)("div",{className:"tw-max-w-lg tw-mx-auto",children:[(0,m.jsx)(u.$n,{onClick:()=>l.push("/shipments"),className:"tw-mb-4",children:"Back"}),(0,m.jsxs)("div",{className:"tw-flex tw-justify-between",children:[(0,m.jsxs)("div",{className:"tw-text-xl lg:tw-text-3xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight",children:["Batches"," ",(0,m.jsx)(Qt.A,{information:Ft.A.BATCHES,className:"!tw-ml-0"})]}),(0,m.jsxs)(u.$n,{variant:"contained",color:"primary",onClick:()=>N(!0),children:[(0,m.jsx)(W.OMN,{}),"Create Batch"]})]}),(0,m.jsxs)("div",{className:"tw-mt-4",children:[(0,m.jsx)(u.XI,{columns:M,data:c}),(0,m.jsx)($t.A,{page:U,limit:L,total:w,history:l,loading:b,shortPageLimit:!0})]})]}):(0,m.jsxs)("div",{className:"tw-max-w-lg tw-mx-auto",children:[" ",(0,m.jsx)(u.$n,{onClick:()=>l.push("/shipments"),className:"tw-mb-4",children:"Back"}),(0,m.jsx)(u.Zp,{children:b?(0,m.jsx)("div",{className:"tw-w-full tw-grid tw-place-items-center",children:(0,m.jsx)(u.P,{})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"tw-text-secondary tw-text-center tw-mt-4",children:[(0,m.jsx)("div",{className:"tw-text-3xl",children:"\xaf\\_(\u30c4)_/\xaf"}),(0,m.jsx)("div",{className:"tw-text-xl tw-font-bold tw-mt-2",children:"No Batches Found!"})]}),(0,m.jsxs)("div",{className:"tw-justify-center tw-flex tw-items-center tw-gap-2",children:[(0,m.jsxs)(u.$n,{onClick:()=>N(!0),className:"tw-gap-2",variant:"contained",color:"secondary",children:[(0,m.jsx)(W.OMN,{}),"Create Batch"]}),(0,m.jsx)(Qt.A,{information:Ft.A.BATCHES,className:"!tw-ml-0 !tw-mt-0"})]})]})})]}),(0,m.jsx)(Jt.A,{defaultLabel:O,open:C,onClose:z,onSubmit:async e=>{try{var t;const n=await s(e);_(Number(e.label)+1),z(),P(!k),null!==n&&void 0!==n&&null!==(t=n.batch)&&void 0!==t&&t.id&&l.push("/batch/".concat(n.batch.id))}catch(n){console.log(n)}}})]})}const Xt=()=>{const e=(0,i.useHistory)(),t=(0,d.useDispatch)(),s=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),l=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.showBillingDisabledModal}),o=null===s||void 0===s?void 0:s.billingStatus,r=()=>{t((0,I.lB)({showBillingDisabledModal:!1}))},c=(0,n.useMemo)(()=>{var e;let t=null;if(o===a.BS.rejected?t=oe.lw.BILLING_STATUS_REJECTED:o===a.BS.hidden&&(t=oe.lw.BILLING_STATUS_HIDDEN),t&&null!==s&&void 0!==s&&s.appliedForSFPlus&&(t=t.replace("or apply for ShipFare+","or await your ShipFare+ approval")),null!==(e=t)&&void 0!==e&&e.includes("ShipFare+")){const e=t.split(" ShipFare+ ");t=(0,m.jsxs)("span",{children:[(0,m.jsx)("span",{children:e[0]}),(0,m.jsx)("span",{className:"tw-text-primary tw-font-bold",children:" ShipFare"}),(0,m.jsx)("span",{className:"tw-text-secondary tw-font-bold",children:"+ "}),(0,m.jsx)("span",{children:e[1]})]})}return t},[o,s]);return(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)(u.aF,{open:l,handleClose:r,hideActions:!0,title:"Billing Disabled!",children:[(0,m.jsx)("div",{children:(0,oe.DN)(c)}),o===a.BS.hidden?(0,m.jsxs)("div",{className:"tw-flex tw-justify-center tw-gap-4 tw-mt-8",children:[(0,m.jsx)(u.$
1n,{color:"primary",variant:"contained",onClick:()=>{r(),e.push("/preset/carrier-accounts?filter=custom&carrier-modal=open")},children:"Connect Carrier"}),null!==s&&void 0!==s&&s.appliedForSFPlus?null:(0,m.jsx)(u.$n,{color:"secondary",variant:"contained",onClick:()=>{r(),e.push("/apply")},children:"Apply For ShipFare+"})]}):null]})})},es=()=>{const e=(0,i.useHistory)(),t=(0,d.useDispatch)(),s=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),l=(0,n.useState)(!1),a=(0,x.A)(l,2),o=a[0],r=a[1],c=(0,n.useState)(!1),h=(0,x.A)(c,2),p=h[0],v=h[1];(0,n.useEffect)(()=>{null!==s&&void 0!==s&&s.useDirectManualCarrierIntegration||"true"===sessionStorage.getItem("showDirectIntegrationModalBypass")||r(!0)},[null===s||void 0===s?void 0:s.useDirectManualCarrierIntegration]);const w=()=>{r(!1),sessionStorage.setItem("showDirectIntegrationModalBypass","true")};return(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)(u.aF,{open:o,handleClose:w,hideActions:!0,hideTitleBar:!0,PaperProps:{className:"tw-p-2"},children:[(0,m.jsx)("div",{className:"tw-flex tw-justify-end",children:(0,m.jsx)("span",{onClick:w,className:"tw-cursor-pointer tw-fill-secondary tw-z-50",children:(0,m.jsx)(W.bm,{})})}),(0,m.jsx)("div",{className:"tw-flex tw-items-center tw-justify-center",children:(0,m.jsx)("img",{className:"tw-max-h-48 tw-mx-auto",src:"".concat(_.nv,"/Assets/carrier-illustration.svg"),alt:"Connect Carrier Account"})}),(0,m.jsxs)("section",{children:[(0,m.jsx)("h3",{className:"tw-text-xl lg:tw-text-2xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight",children:"Reconnect Your Carrier Accounts"}),(0,m.jsx)("p",{className:"tw-mt-4 tw-font-bold",children:"We have upgraded our integrations with UPS and FedEx!"}),(0,m.jsx)("p",{children:"With this update, you\u2019ll now notice:"}),(0,m.jsxs)("ul",{className:"tw-list-disc tw-list-inside tw-m-0 tw-p-0",children:[(0,m.jsx)("li",{children:"Proof of delivery images in app"}),(0,m.jsx)("li",{children:"Faster status updates"}),(0,m.jsx)("li",{children:"Fewer connection errors and outages"})]}),(0,m.jsxs)("p",{className:"tw-mt-4",children:["Simply ",(0,m.jsx)("strong",{children:"reconnect"})," your carrier accounts (non-ShipFare+) to upgrade and avoid any interruptions by"," ",(0,m.jsx)("strong",{children:"March 13th, 12 pm PST"}),". Anyone who doesn\u2019t upgrade their carrier accounts by that time will be disconnected automatically, potentially causing a disruption. Thank you for your attention and happy shipping!"]}),(0,m.jsx)("div",{className:"tw-mt-4 tw-text-center",children:(0,m.jsx)(u.$n,{color:"primary",variant:"contained",disabled:p,onClick:async()=>{v(!0);try{const e=(await E.FH.post("/user/v1/company/edit",{useDirectManualCarrierIntegration:!0})).data;t((0,I.QO)({user:e}))}catch(s){console.log(s)}v(!1),e.push("/preset/carrier-accounts?filter=custom"),w()},children:"Connect Carriers"})})]})]})})};var ts=s(62132),ss=s(14103);const ns=()=>{const e=(0,d.useDispatch)(),t=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),s=(0,n.useState)(!1),i=(0,x.A)(s,2),l=i[0],a=i[1],o=(0,n.useState)(!1),r=(0,x.A)(o,2),c=r[0],h=r[1],p=(0,ss.A)({onSuccess:()=>{e((0,I.QO)({user:{dismissedPasskeyPrompt:!0}})),a(!1)}}),v=p.register,w=p.registering,g=(0,n.useCallback)(async()=>{try{let s=!1;try{s="1"===sessionStorage.getItem("freshLogin")}catch(e){console.log(e)}if(!s)return;try{sessionStorage.removeItem("freshLogin")}catch(e){console.log(e)}if(null===t||void 0===t||!t._id||null!==t&&void 0!==t&&t.dismissedPasskeyPrompt||!(0,ts.zZ)())return;const n=(await E.FH.get("/passkeys/v1/")).data;null!==n&&void 0!==n&&n.length||a(!0)}catch(s){}finally{h(!0)}},[null===t||void 0===t?void 0:t._id,null===t||void 0===t?void 0:t.dismissedPasskeyPrompt]);(0,n.useEffect)(()=>{if(!c&&null!==t&&void 0!==t&&t._id){const e=setTimeout(g,2e3);return()=>clearTimeout(e)}},[null===t||void 0===t?void 0:t._id,c,g]);return(0,m.jsx)(u.aF,{open:l,handleClose:()=>!w&&a(!1),hideTitleBar:!0,hideActions:!0,renderChildrenDirectly:!0,maxWidth:"sm",paperStyle:{maxWidth:500},children:(0,m.jsxs)("div",{className:"tw-p-6",children:[(0,m.jsxs)("div",{className:"tw-flex tw-items-center tw-mb-4 tw-gap-2",children:[(0,m.jsx)("div",{className:"tw-bg-primary/10 tw-rounded-full",children:(0,m.jsx)(W.$A8,{width:28,height:28,fill:"var(--primary)"})}),(0,m.jsx)("div",{children:(0,m.jsx)(u.o5,{className:"!tw-text-lg
1!tw-font-semibold !tw-text-gray-900",children:"Enable Passkey Login"})})]}),(0,m.jsx)(u.o5,{className:"!tw-text-md !tw-mb-4",children:"Sign in faster next time using your fingerprint, face, or device PIN \u2014 no password or verification code needed."}),(0,m.jsx)(u.o5,{className:"!tw-text-sm !tw-text-gray-600 !tw-mb-6",children:"You can manage your passkeys anytime from Account Settings."}),(0,m.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:[(0,m.jsxs)(u.$n,{variant:"contained",color:"primary",className:"!tw-rounded-full !tw-py-2.5 !tw-text-sm !tw-font-medium",onClick:v,disabled:w,children:[w?(0,m.jsx)(u.P,{size:18,className:"tw-mr-2"}):(0,m.jsx)(W.$A8,{width:18,height:18,className:"tw-mr-2",fill:"white"}),w?"Setting up...":"Set up Passkey"]}),(0,m.jsx)(u.$n,{variant:"text",className:"!tw-text-gray-500 !tw-text-sm",onClick:()=>a(!1),disabled:w,children:"Not now"}),(0,m.jsx)("button",{type:"button",className:"tw-text-sm tw-text-red-500 tw-bg-transparent tw-border-none tw-cursor-pointer tw-mt-1 hover:tw-text-red-700 tw-transition-colors",onClick:async()=>{a(!1);try{const t=(await E.FH.post("/user/v1/profile/edit",{dismissedPasskeyPrompt:!0})).data;e((0,I.QO)({user:t.user}))}catch(t){}},disabled:w,children:"Don't show this again"})]})]})})},is=(0,N.A)((0,n.lazy)(()=>s.e(9475).then(s.bind(s,29475)))),ls=(0,N.A)((0,n.lazy)(()=>s.e(7134).then(s.bind(s,37134)))),as=(0,N.A)((0,n.lazy)(()=>s.e(1011).then(s.bind(s,71011)))),os=(0,N.A)((0,n.lazy)(()=>s.e(3390).then(s.bind(s,61009)))),rs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(2512)]).then(s.bind(s,92512)))),ds=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(3655),s.e(3380)]).then(s.bind(s,63380)))),cs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(7166)]).then(s.bind(s,57166)))),us=(0,N.A)((0,n.lazy)(()=>s.e(2971).then(s.bind(s,32971)))),hs=(0,N.A)((0,n.lazy)(()=>s.e(5396).then(s.bind(s,85396)))),ms=(0,N.A)((0,n.lazy)(()=>s.e(3275).then(s.bind(s,3275)))),ps=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(9459),s.e(387)]).then(s.bind(s,10387)))),vs=(0,N.A)((0,n.lazy)(()=>s.e(925).then(s.bind(s,30925)))),ws=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(9459),s.e(7209)]).then(s.bind(s,27209)))),xs=(0,N.A)((0,n.lazy)(()=>s.e(4849).then(s.bind(s,64849)))),gs=(0,N.A)((0,n.lazy)(()=>s.e(730).then(s.bind(s,10730)))),ys=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(690),s.e(8231),s.e(2479)]).then(s.bind(s,12479)))),fs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(2580)]).then(s.bind(s,32580)))),bs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(2094),s.e(6567),s.e(5738),s.e(1919),s.e(1869),s.e(824),s.e(690),s.e(8231),s.e(1360),s.e(3655),s.e(4207),s.e(401)]).then(s.bind(s,40401)))),js=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(4311),s.e(4512),s.e(3204)]).then(s.bind(s,43204)))),As=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1359)]).then(s.bind(s,11359)))),Ss=(0,N.A)((0,n.lazy)(()=>s.e(9362).then(s.bind(s,49362)))),Cs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(690),s.e(5988)]).then(s.bind(s,35988)))),Ns=(0,N.A)((0,n.lazy)(()=>s.e(1722).then(s.bind(s,61722)))),Is=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1919),s.e(1869),s.e(6714),s.e(7884)]).then(s.bind(s,72847)))),Ds=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(1087),s.e(6516)]).then(s.bind(s,56516)))),ks=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(1087),s.e(1250)]).then(s.bind(s,1250)))),Ps=(0,N.A)((0,n.lazy)(()=>s.e(6019).then(s.bind(s,86019)))),Es=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(6796)]).then(s.bind(s,76796)))),Rs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(1869),s.e(7959)]).then(s.bind(s,27959)))),Ts=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(4392),s.e(8424)]).then(s.bind(s,48424)))),Fs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(989),s.e(8224)]).then(s.bind(s,48224)))),Os=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(989),s.e(7553)]).then(s.bind(s,77553)))),_s=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(2953),s.e(7398),s.e(8817),s.e(8824)]).then(s.bind(s,18824)))),Bs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(2953),s.e(8817),s.e(7435)]).then(s.bind(s,97435)))),Us=(0,N.A)((0,n.lazy)(()=>s.e(532).then(s.bind(s,80532)))),Ls=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(7803)]).then(s.bind(s,67803)))),Ws=(0,N.A)((0,n.lazy)(()=>s.e(571).then(s.bind(s,10571)))),zs=(0,N.A)((0,n.lazy)(()=>s.e(2749).then(s.bind(s,2749)))),Ms=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(1869),s.e(2289)]).then(s.bind(s,22289)))),qs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(4392),s.e(8416)]).then(s.bind(s,78416)))),Vs=(0,N.A)((0,n.lazy)(()=>s.e(6751).then(s.bind(s,96751)))),Ks=(0,N.A)((0,n.lazy)(()=>s.e(6460).then(s.bind(s,26460)))),Ys=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(1087),s.e(7305)]).then(s.bind(s,17305)))),Gs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(6714),s.e(4331)]).then(s.bind(s,14331)))),Hs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(1919),s.e(1869),s.e(3297),s.e(5870)]).then(s.bind(s,65870)))),$s=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1919),s.e(1869),s.e(1087),s.e(6262)]).then(s.bind(s,23148)))),Qs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(1360),s.e(4366)]).then(s.bind(s,68979)))),Js=(0,N.A)((0,n.lazy)(()=>
1Promise.all([s.e(824),s.e(9813)]).then(s.bind(s,69813)))),Zs=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(824),s.e(7390)]).then(s.bind(s,17390)))),Xs=(0,N.A)((0,n.lazy)(()=>s.e(1238).then(s.bind(s,71238)))),en=(0,N.A)((0,n.lazy)(()=>s.e(4056).then(s.bind(s,14056)))),tn=(0,N.A)((0,n.lazy)(()=>s.e(1907).then(s.bind(s,91907)))),sn=(0,N.A)((0,n.lazy)(()=>s.e(1962).then(s.bind(s,51962)))),nn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(1869),s.e(3298)]).then(s.bind(s,73298)))),ln=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(4221)]).then(s.bind(s,14221)))),an=(0,N.A)((0,n.lazy)(()=>s.e(2416).then(s.bind(s,82416)))),on=(0,N.A)((0,n.lazy)(()=>s.e(9294).then(s.bind(s,29294)))),rn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(8913)]).then(s.bind(s,1294)))),dn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(4515)]).then(s.bind(s,34515)))),cn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(599)]).then(s.bind(s,90599)))),un=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(524)]).then(s.bind(s,80524)))),hn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(8380)]).then(s.bind(s,78380)))),mn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(7448)]).then(s.bind(s,47448)))),pn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(6657)]).then(s.bind(s,36657)))),vn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(6412)]).then(s.bind(s,66412)))),wn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1869),s.e(7875),s.e(4012),s.e(3797)]).then(s.bind(s,73797)))),xn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(692)]).then(s.bind(s,10692)))),gn=(0,N.A)((0,n.lazy)(()=>Promise.all([s.e(5738),s.e(1919),s.e(1869),s.e(7875),s.e(6142),s.e(4012),s.e(9781)]).then(s.bind(s,19781)))),yn=(0,N.A)((0,n.lazy)(()=>s.e(508).then(s.bind(s,508)))),fn=(0,N.A)((0,n.lazy)(()=>s.e(2126).then(s.bind(s,52126)))),bn=()=>{const e=l.A.MERCHANT_ADMIN;return le(),Z(),ie(),ee(),te(),(()=>{const e=(0,d.useDispatch)(),t=(0,i.useLocation)(),s=(0,n.useRef)(t);s.current=t;const l=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.refreshCarriersServices}),a=(0,d.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.refreshCarriersServicesOnboarding}),r=(0,n.useCallback)(async()=>{try{const t=s.current.pathname;if((0,X.Ay)(t)&&!(0,X.UD)(t))return;const n=(await E.Km.get("/easypost/active-carriers-services".concat((0,X.UD)(t)||a?"?onboarding=true":""))).data,i=[...n.carriers],l=(0,o.A)({},n.services);e((0,I.lB)({carriers:i,services:l,easypostCarrierAccounts:n.easypostCarriers,refreshCarriersServices:!1,refreshCarriersServicesOnboarding:!1}))}catch(t){console.log((null===t||void 0===t?void 0:t.response)||t)}},[e]),c=!(0,X.Ay)(t.pathname)||(0,X.UD)(t.pathname);(0,n.useEffect)(()=>{c&&(l||a)&&r()},[c,r,l,a])})(),ve(),(0,we.S)(),xe(),ge(),Ut(),Wt(),zt(),qt(),(0,m.jsxs)(S,{children:[(0,m.jsx)(Y,{}),(0,m.jsx)(Mt,{}),(0,m.jsx)(Vt,{}),(0,m.jsx)(ne,{}),(0,m.jsx)(re,{}),(0,m.jsx)(ue,{}),(0,m.jsx)(Xt,{}),(0,m.jsx)(es,{}),(0,m.jsx)(Ot,{}),(0,m.jsx)(J,{}),(0,m.jsx)(ns,{}),(0,m.jsx)(rs,{children:(0,m.jsxs)(i.Switch,{children:[(0,m.jsx)(i.Redirect,{exact:!0,from:"/settings",to:"/settings/users"}),(0,m.jsx)(i.Redirect,{exact:!0,from:"/preset",to:"/preset/options"}),(0,m.jsx)(i.Redirect,{exact:!0,from:"/",to:"/dashboard"}),(0,m.jsx)(w,{exact:!0,path:"/dashboard",component:ds}),(0,m.jsx)(w,{exact:!0,path:"/settings/account",component:cs}),(0,m.jsx)(w,{exact:!0,path:"/settings/account/sessions",component:us}),(0,m.jsx)(w,{exact:!0,path:"/settings/account/update-password",component:hs}),(0,m.jsx)(w,{path:"/auth/reset-password/:token",component:ms}),(0,m.jsx)(w,{path:"/user/:userId",component:ps}),(0,m.jsx)(w,{exact:!0,path:"/settings/private-app",component:vs,access:[e],permissions:[a.I1.ACCESS_API]}),(0,m.jsx)(w,{exact:!0,path:"/settings/users",component:ws,access:[e],permissions:[a.I1.EDIT_COMPANY]}),(0,m.jsx)(w,{path:"/settings/users/:id",component:xs,access:[e],permissions:[a.I1.EDIT_USERS]}),(0,m.jsx)(w,{path:"/preset/options",component:_s,access:[e],permissions:[a.I1.EDIT_OPTIONS]}),(0,m.jsx)(w,{path:"/preset/stores",component:Bs,access:[e],permissions:[a.I1.EDIT_INTEGRATIONS]}),(0,m.jsx)(w,{path:"/preset/boxes",component:gs,access:[e],permissions:[a.I1.EDIT_BOXES]}),(0,m.jsx)(w,{exact:!0,path:"/preset/customers",component:ys,access:[e],permissions:[a.I1.CUSTOMERS,a.I1.EDIT_CUSTOMERS]}),(0,m.jsx)(w,{path:"/preset/customers/:id",component:fs,access:[e],permissions:[a.I1.CUSTOMERS,a.I1.EDIT_CUSTOMERS]}),(0,m.jsx)(w,{exact:!0,path:"/orders/orderbulk-pdf",component:js,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{exact:!0,path:"/batch/:id/orderbulk-pdf",component:js,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{exact:!0,path:"/orders/manifest-pdf",component:As,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{path:"/orders",component:bs,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{path:"/shipments",component:bs,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{exact:!0,path:"/3pl",component:sn,access:[e]}),(0,m.jsx)(w,{path:"/preset/products",component:Cs,access:[e],permissions:[a.I1.PRODUCTS,a.I1.EDIT_PRODUCTS]}),(0,m.jsx)(w,{path:"/preset/warehouses",component:Ns,access:[e],permissions:[a.I1.EDIT_WAREHOUSES]}),(0,m.jsx)(w,{exact:!0,path:"/billing",component:Is,access:[e],permissions:[a.I1.BILLING]}),(0,m.jsx)(w,{exact:!0,path:"/claims/merchant-claims",component:Ds,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/claims/merchant-claims/view/:id",component:Ds,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/claims/merchant-claims/:id",component:ks,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/claims/merchant-claims/claim-pdf/:id",component:Vs,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/claims/merchant-claims/invoice-pdf",component:Fs,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/preset/carrier-accounts",component:Ps,access:[e],permissions:[a.I1.EDIT_CARRIERS]}),(0,m.jsx)(w,{exact:!0,path:"/preset/tracking-templates",component:Es,access:[e],permissions:[a.I1.CUSTOMIZE_EMAILS]}),(0,m.jsx)(w,{exact:!0,path:"/billing/invoice-pdf/:id",component:Fs,access:[e],permissions:[a.I1.BILLING,a.I1.VIEW_BILLING_ACTIVITY]}),(0,m.jsx)(w,{exact:!0,path:"/billing/invoicebulk-pdf",component:Os,access:[e],permissions:[a.I1.BILLING,a.I1.VIEW_BILLING_ACTIVITY]}),(0,m.jsx)(w,{exact:!0,path:"/partners/lateshipment",component:Us}),(0,m.jsx)(w,{exact:!0,path:"/shopify/install",component:is}),(0,m.jsx)(w,{exact:!0,path:"/shopify/token",component:ls}),(0,m.jsx)(w,{exact:!0,path:"/square/token",component:Yt.default}),(0,m.jsx)(w,{exact:!0,path:"/wix/install",component:as}),(0,m.jsx)(w,{exact:!0,path:"/wix/token",component:os}),(0,m.jsx)(w,{path:"/terms",component:Ls}),(0,m.jsx)(w,{path:"/dpa",component:Ls}),(0,m.jsx)(w,{path:"/shortlink",component:Ws}),(0,m.jsx)(w,{path:"/pricing",component:ln}),(0,m.jsx)(w,{exact:!0,path:"/plaid-oauth",component:zs,access:[e]}),(0,m.jsx)(w,{exact:!0,path:"/tracking-page",component:Rs}),(0,m.jsx)(w,{exact:!0,path:"/tracking-page/:id",component:Ts}),(0,m.jsx)(w,{exact:!0,path:"/tracking",component:Rs}),(0,m.jsx)(w,{exact:!0,path:"/tracking/:id",component:Ts}),(0,m.jsx)(w,{exact:!0,path:"/template-edit/:type/:statusType",component:qs}),(0,m.jsx)(w,{exact:!0,path:"/template-preview",component:Ms,access:[e]}),(0,m.jsx)(w,{exact:!0,path:"/batch/:id",component:bs,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{exact:!0,path:"/batch",component:Zt,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{exact:!0,path:"/preferred-vendors",component:Ks,access:[e]}),(0,m.jsx)(w,{exact:!0,path:"/claims/gsr",component:Gs,access:[e],permissions:[a.I1.CLAIMS]}),(0,m.jsx)(w,{exact:!0,path:"/claims/order-protection-claims/:id",component:$s,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/claims/order-protection-claims",component:Ys,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/protection-claim/:id",component:Hs,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/protection-claim",component:Hs,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/order-protection-terms",component:en,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/full-coverage-terms",component:Xs,access:[e],permissions:[a.I1.VIEW_CLAIM_TRACKING]}),(0,m.jsx)(w,{exact:!0,path:"/onboarding-wizard",component:Rt,access:[e]}),(0,m.jsx)(w,{exact:!0,path:"/squarespace-oauth",component:Tt}),(0,m.jsx)(w,{exact:!0,path:"/pickups",component:Qs,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}
1),(0,m.jsx)(w,{exact:!0,path:"/bulk-stats",component:Js,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{exact:!0,path:"/bulk-stats/:id",component:Zs,access:[e],permissions:[a.I1.ORDERS,a.I1.VIEW_PRINT_ORDERS]}),(0,m.jsx)(w,{exact:!0,path:"/default-tracking",component:nn}),(0,m.jsx)(w,{exact:!0,path:"/track",component:nn}),(0,m.jsx)(w,{exact:!0,path:"/ups/token",component:an}),(0,m.jsx)(w,{exact:!0,path:"/usps/token",component:on}),(0,m.jsx)(w,{exact:!0,path:"/blog",component:rn}),(0,m.jsx)(w,{exact:!0,path:"/blog/does-fedex-ship-frozen-foods",component:dn}),(0,m.jsx)(w,{exact:!0,path:"/blog/does-ups-ship-frozen-food",component:cn}),(0,m.jsx)(w,{exact:!0,path:"/blog/dryice",component:un}),(0,m.jsx)(w,{exact:!0,path:"/blog/e-fish-seafood-shipping",component:hn}),(0,m.jsx)(w,{exact:!0,path:"/blog/gtfo",component:mn}),(0,m.jsx)(w,{exact:!0,path:"/blog/shipping-food-to-canada",component:pn}),(0,m.jsx)(w,{exact:!0,path:"/terms-of-use",component:vn}),(0,m.jsx)(w,{exact:!0,path:"/contact-us",component:wn}),(0,m.jsx)(w,{exact:!0,path:"/docs/:id",component:tn}),(0,m.jsx)(w,{exact:!0,path:"/docs",component:tn}),(0,m.jsx)(w,{exact:!0,path:"/referral",component:xn}),(0,m.jsx)(w,{exact:!0,path:"/request-a-demo",component:Ss}),(0,m.jsx)(w,{exact:!0,path:"/apply",component:Kt.default}),(0,m.jsx)(i.Redirect,{exact:!0,from:"/shipfare-plus-apply",to:"/apply"}),(0,m.jsx)(w,{exact:!0,path:"/calculator",component:gn}),(0,m.jsx)(w,{exact:!0,path:"/checkout-analyzer",component:yn}),(0,m.jsx)(w,{exact:!0,path:"/checkout-analyzer/report/:id",component:fn}),(0,m.jsx)(i.Route,{children:(0,m.jsx)(C.A,{})})]})})]})}},33886(e,t,s){s.d(t,{A:()=>x});var n=s(98477),i=s(39698),l=s(64419),a=s(2444),o=s(2601),r=s(11841),d=s(55948),c=s(1739),u=s(35912),h=s(28617),m=s(60729),p=s(61969),v=s(63203);const w="/batch-orders",x=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const s=(0,a.useDispatch)(),x=(0,p.A)(),g=x.toastError,y=x.toastSuccess,f=x.toastWarning,b=(0,u.yK)().deselectAllOrders,j=(0,m.J1)().printWithDryIceLabelCheck,A=(0,l.useState)(!1),S=(0,i.A)(A,2),C=S[0],N=S[1],I=(0,l.useState)(null),D=(0,i.A)(I,2),k=D[0],P=D[1],E=(0,a.useSelector)(e=>e.orders.batchValidationData),R=null!==(e=(0,a.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.orders)||void 0===t?void 0:t.batches}))&&void 0!==e?e:[],T=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return await c.Km.get("".concat(w,"/batches?page=").concat(e,"&limit=").concat(t))};(0,l.useEffect)(()=>{t&&(async()=>{try{const e=(await T()).data;(0,a.vA)(()=>{s((0,d.SY)(e))})}catch(e){console.log(e)}})()},[s,t]);const F=async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];N(!0);const i={batchId:e,includeOrderIds:t,adjustBatchOrders:n};try{var l,r,u;const n=(await c.Km.post("".concat(w,"/update"),i)).data,h=null===n||void 0===n||null===(l=n.allBatches)||void 0===l?void 0:l.batches,m=(null===h||void 0===h||null===(r=h.find)||void 0===r?void 0:r.call(h,t=>t.id===e))||(null===R||void 0===R||null===(u=R.find)||void 0===u?void 0:u.call(R,t=>t.id===e)),p=1!==(Array.isArray(t)?t.length:t&&"object"===typeof t?Object.keys(t).length:1),x=(null===m||void 0===m?void 0:m.label)||(null===m||void 0===m?void 0:m.batchNumber),g=null===m||void 0===m?void 0:m.batchNumber,f=(0,v.jsxs)("div",{children:[(0,v.jsxs)("span",{children:[p?"Orders":"Order"," added to Batch"]})," ",(0,v.jsx)(o.N_,{to:"/batch/".concat(m.id),children:x||g}),"."]});(0,a.vA)(()=>{y(f),s((0,d.SY)({batches:n.allBatches.batches})),p&&b()})}catch(h){(0,a.vA)(()=>{var e,t;g(null!==(e=null===(t=h.data)||void 0===t?void 0:t.message)&&void 0!==e?e:"Error Adding Order to Batch")})}finally{N(!1)}};return{batchLoading:C,batchPageData:k,validationData:E,getUserBatches:T,handleNewBatch:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};N(!0);try{var t,i;const l=(await c.Km.post("".concat(w,"/create"),(0,n.A)((0,n.A)({},e),{},{label:null===(t=e.label)||void 0===t||null===(i=t.toString())||void 0===i?void 0:i.trim()}))).data;return(0,a.vA)(()=>{var e;s((0,d.SY)({batch:l.batch})),y(null!==(e=l.message)&&void 0!==e?e:"Batch Created Successfully")}),l}catch(l){(0,a.vA)(()=>{var e;g(null!==(e=l.data.message)&&void 0!==e?e:"Error Creating Batch")})}finally{N(!1)}},setBatchPageData:P,handleAddToBatch:F,handleUpdateBatch:async(e,t,s)=>{N(!0);try{const i=(await c.Km.post("".concat(w,"/update"),(0,n.A)({batchId:e},t))).data;(0,a.vA)(()=>{var e;P((0,n.A)((0,n.A)({},i.updatedBatch),{},{orders:s})),y(null!==(e=i.message)&&void 0!==e?e:"Batch Updated Successfully")}),window.location.reload()}catch(i){(0,a.vA)(()=>{var e,t;g(null!==(e=null===i||void 0===i||null===(t=i.data)||void 0===t?void 0:t.message)&&void 0!==e?e:"Error Updating Batch")})}finally{N(!1)}},handleCancelBatch:async e=>{N(!0);try{const t=(await c.Km.post("".concat(w,"/cancel/").concat(e))).data;(0,a.vA)(()=>{var n;s((0,d.N7)({batchId:e})),y(null!==(n=t.message)&&void 0!==n?n:"Batch Successfully Deleted")})}catch(t){(0,a.vA)(()=>{var e;g(null!==(e=t.data.message)&&void 0!==e?e:"Error Deleting Batch")})}finally{N(!1)}},resetValidationData:()=>{s((0,d.SY)({validationData:{showModal:!1}}))},handleDeleteFromBatch:async(e,t)=>{N(!0);const n={batchId:e,excludeOrderIds:t};try{const e=(await c.Km.post("".concat(w,"/update"),n)).data;(0,a.vA)(()=>{var t;y(null!==(t=e.message)&&void 0!==t?t:"Order excluded from Batch Successfully"),s((0,d.SY)({batches:e.allBatches.batches})),s((0,d.zC)({key:"orders",val:!0,topic:h.r.remove_from_batch,count:1})),b()})}catch(i){(0,a.vA)(()=>{var e;g(null!==(e=i.data.message)&&void 0!==e?e:"Error Excluding Order to Batch")})}finally{N(!1)}},handleValidateAddToBatch:async(e,t)=>{N(!0);const i={batchId:null===e||void 0===e?void 0:e.id,includeOrderIds:t};try{const l=(await c.Km.post("".concat(w,"/validate-update"),i)).data;if(null===l||void 0===l||!l.allowed)return void s((0,d.SY)({validationData:(0,n.A)({showModal:!0,ordersCount:null===l||void 0===l?void 0:l.count,batchNumber:null===e||void 0===e?void 0:e.batchNumber},i)}));await F(null===e||void 0===e?void 0:e.id,t)}catch(l){(0,a.vA)(()=>{var e,t;g(null!==(e=null===l||void 0===l||null===(t=l.data)||void 0===t?void 0:t.message)&&void 0!==e?e:"Error validating, please try again")})}finally{N(!1)}},handleDownloadBatchLabels:(e,t)=>{j(t,async()=>{try{const n=(0,r.A)();sessionStorage.tabId=n;const i=(await c.Km.post("/orders/generatePdf?batchId=".concat(e),{create:t,tabId:n})).data;if(i.message&&f(i.message),i.selectedOrders&&Object.keys((null===i||void 0===i?void 0:i.selectedOrders)||{}).length)return s((0,d.CW)({selectedOrders:i.selectedOrders})),window.open("/orders/orderbulk-pdf?create=".concat(t,"&isBulk=true"),"_blank"),void(0,a.vA)(()=>{s((0,d.CW)({allSelectInProgress:!1})),b()})}catch(n){console.error((null===n||void 0===n?void 0:n.response)||n),g("Failed To Generate PDF")}})}}}},44222(e,t,s){s.d(t,{q:()=>a});var n=s(71889),i=s(81926),l=s(63203);const a=()=>{const e=(0,i.Nx)(),t={[i.Ay.ups]:"tw-h-24",[i.Ay.fedex]:"tw-h-12",[i.Ay.usps]:"tw-h-14"};return{renderAvailableCarriers:s=>{let a=s.onSelectCarrierType,o=s.selectedCarrierType,r=s.className;return e.map((e,s)=>(0,l.jsx)("div",{onClick:()=>a(e),className:"tw-p-4 hover:tw-shadow-lg tw-transition-shadow tw-duration-300 tw-rounded-lg tw-cursor-pointer tw-border tw-border-solid tw-text-center tw-flex tw-items-center tw-justify-center tw-h-[90px] tw-w-full lg:tw-w-[150px] ".concat(o===e?"tw-border-solid tw-border-primary":""," ").concat(r||""),children:i.lY[e]?(0,l.jsx)("img",{src:i.lY[e],alt:e,className:"tw-mx-auto ".concat(t[e])}):(0,n.capitalize)(e)},s))}}}},14103(e,t,s){s.d(t,{A:()=>d});var n=s(39698),i=s(64419),l=s(62132),a=s(1739),o=s(61969);const r=()=>{const e=navigator.userAgent;let t="Browser";e.includes("Chrome")&&!e.includes("Edg")?t="Chrome":e.includes("Safari")&&!e.includes("Chrome")?t="Safari":e.includes("Firefox")?t="Firefox":e.includes("Edg")&&(t="Edge");let s="";return e.includes("Mac OS")?s="macOS":e.includes("Windows")?s="Windows":e.includes("Android")?s="Android":e.includes("iPhone")||e.includes("iPad")?s="iOS":e.includes("Linux")&&(s="Linux"),s?"".concat(t," on ").concat(s):t},d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onSuccess,s=e.deviceName;const d=(0,o.A)(),c=d.toastSuccess,u=d.toastError,h=(0,i.useState)(!1),m=(0,n.A)(h,2),p=m[0],v=m[1];return{register:async()=>{v(!0);try{const e=(await a.FH.post("/passkeys/v1/register/options")).data,n=await(0,l.Ct)({optionsJSON:e});await a.FH.post("/passkeys/v1/register/verify",{credential:n,deviceName:s||r()}),c("Passkey registered successfully!"),null===t||void 0===t||t()}catch(n){if("InvalidStateError"===n.name)u("This device already has a passkey registered.");else if("NotAllowedError"===n.name)u("Passkey registration was cancelled");else{var e;const t=null===n||void 0===n||null===(e=n.response)||void 0===e?void 0:e.data;u("string"===typeof t?t:(null===t||void 0===t?void 0:t.message)||(null===n||void 0===n?void 0:n.message)||"Failed to register passkey")}}finally{v(!1)}},registering:p}}}
1,67702(e,t,s){s.d(t,{g:()=>r});var n=s(71889),i=s(2444),l=s(86417),a=s(82391),o=s(63203);const r=e=>{let t=e.typesToRender,s=void 0===t?l.hb:t,r=e.typeLogoToRender,d=void 0===r?l.uU:r;const c=(0,i.useSelector)(e=>e.auth.user),u=[s.custom,s.amazon,s.jetti,s.freshly];a.KV&&!a.Ew.squareEnabledTeamIds.includes(null===c||void 0===c?void 0:c.teamId)&&u.push(s.square);const h=Object.values(s).filter(e=>!u.includes(e));return{renderAvailablePlatforms:e=>{let t=e.className,s=e.imageClassName,i=e.selectedPlatformType,l=e.onSelectedPlatformType,a=e.renderText;const r=[];return h.forEach((e,c)=>{var u;r.push((0,o.jsx)("div",{onClick:()=>l(e),className:"tw-p-4 hover:tw-shadow-lg tw-border-solid tw-transition-shadow tw-duration-300 tw-rounded-lg tw-cursor-pointer tw-border tw-h-24 tw-flex tw-items-center tw-justify-center ".concat(i===e?"tw-border-primary":""," ").concat(t||""),children:d[e]?(0,o.jsx)("img",{className:s,src:d[e],alt:e}):null!==(u=null===a||void 0===a?void 0:a(e))&&void 0!==u?u:(0,n.capitalize)(e)}))}),r}}}},49118(e,t,s){s.d(t,{Wj:()=>i,dt:()=>a,p8:()=>l});var n=s(6059);const i=e=>({type:n.uK,payload:e}),l=e=>({type:n.vc,payload:e}),a=e=>({type:n.Fn,payload:e})}}]);
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.