1import{r as j,j as i,a as M,g as tt}from"./jsx-runtime-cac1cc29.js";import{c as E,M as Te}from"./Modal-0b988608.js";import{b as U,d as st,e as rt,c as nt,u as it,i as ye}from"./immer-reducer-356bab32.js";import{x as at,s as oe,D as lt,i as we,h as ot}from"./store-af60871a.js";import{i as ke}from"./isEmpty-2c3580ae.js";import{u as F}from"./styled-components.browser.esm-05c658bb.js";import{A as ct}from"./useFeatures-0ddc7fed.js";import{u as Ce}from"./useSelector-6a83d625.js";import{u as ut}from"./useDispatch-70020b5c.js";import"./index-537cb5b1.js";import{u as Ve}from"./QueryClientProvider-98b7e4cc.js";import{a as ze,u as He}from"./useQuery-38f11b02.js";const dt=j.createContext({values:{},resetForm:()=>{},disableAutocomplete:!1});function Ue(t=!0){const e=Ce(({app:r})=>r.integrations.logos),s=ut();return j.useEffect(()=>{!e&&t&&s(at())},[]),e||{}}const Se=[{title:"Small Package Carriers",id:"small_package",parent:"all_carriers"},{title:"LTL Freight Carriers",id:"freight",parent:"all_carriers"},{title:"Cross Border Carriers",id:"cross_border",parent:"all_carriers"},{title:"Same Day Carriers",id:"same_day",parent:"all_carriers"},{title:"White Glove Service",id:"white_glove",parent:"all_carriers"},{title:"In-home Delivery",id:"in_home_delivery",parent:"all_carriers"},{title:"Address Validation",id:"validation"},{title:"Shipping Insurance",id:"insurance"},{title:"Technology Partner",id:"tech_partner"}],ht=["small_package","freight","cross_border","same_day","white_glove","in_home_delivery"];function ft(t){if(t==="all_carriers")return"All Carriers";const e=Se.find(s=>s.id===t);return e?e.title:"All"}function Ms(t){if(t)return t==="all"?Se:Se.filter(e=>e.parent?e.parent===t:!1)}function Ts(t,e,s={}){if(t.category_id!==e&&!(e==="all_carriers"&&ht.includes(t.category_id))){const r=s[t.name];if(r){if(!r.includes(e))return!1}else return!1}return!0}function Be(t,e,s="Bg"){if(!t)return{};const r=e+s;let n={},a=!1;return t[r]&&(a=!0,n.background=t[r]),a?{style:n}:{}}function Vs(t,e){if(e)return ft(e);if(!t)return"";const s=t.indexOf(" (");return s!==-1?t.substr(0,s):t}function zs(t,e){if(!t)return{};const{style:s={}}=Be(t,e),r=t[e+"Bg"],n=r||t[e+"BgAlt"];return n&&(s.borderTopColor=n),s}function Hs(){return i.jsx("div",{"data-testid":"loading-spinner",style:{position:"fixed",zIndex:"1000",background:"#fff",opacity:.75,left:0,top:0,bottom:0,right:0,display:"flex",justifyContent:"center",alignItems:"center"},children:i.jsx("i",{className:"fa fa-spinner fa-spin","aria-hidden":"true",style:{color:"#008cbe",fontSize:"64px"}})})}const pt=M.createContext({close:()=>{}});class re extends j.Component{constructor(){super(...arguments),this.onSelect=(e,s)=>{e.preventDefault(),s&&s.close(),this.props.onSelect&&this.props.onSelect(this.props.value)}}render(){const{title:e,selected:s,delimiter:r,hovered:n,linkClass:a}=this.props;let l=null;return r?i.jsx("li",{children:i.jsx("div",{className:"div-contain",children:i.jsx("div",{className:"divider"})})}):(s&&(l=i.jsx("i",{className:"far fa-check"})),i.jsx(pt.Consumer,{children:o=>i.jsx("li",{"data-testid":e,className:E({selected:s}),role:"option","aria-checked":s,"aria-selected":s,children:i.jsxs("a",{className:E({hover:n},a),href:"#",role:"button",onMouseDown:c=>this.onSelect(c,o),children:[i.jsx("span",{className:"text",children:e}),l]})})}))}}function mt(t,e){return Array.isArray(t)?t.includes(e):!t&&e===""?!0:t===e}class Ge extends j.Component{constructor(e){super(e),this.state={opened:!1,selected:[]},this.toggle=()=>{this.setState({opened:!this.state.opened})},this.hide=()=>{this.setState({opened:!1})},this.select=s=>{const{multiSelect:r}=this.props;if(r){const{selected:n}=this.state;let a=n?Array.from(n).filter(o=>o!==s):[];(!n||!n.includes(s))&&a.push(s);let l={selected:a,userInput:!0};this.setState(l),this.props.onChange&&this.props.onChange(a.length>0?a:[""])}else this.setState({selected:s,opened:!1,userInput:!0}),this.props.onChange&&this.props.onChange(s)},this.handleClickOutside=s=>{this.wrapperRef&&this.wrapperRef.current&&!this.wrapperRef.current.contains(s.target)&&this.hide()},this.getTitleByValue=s=>{const{multiSelect:r}=this.props;if(!this.props.options)return"";const n=this.props.options?this.props.options.filter(this.getValueCmp(s)):[];if(n&&n.length>0)return n.map(a=>a.title).join(", ");{const{askToSelect:a}=this.props;return a&&a.length>0?a:r?"N/A":""}},this.wrapperRef=M.createRef(),this.state={opened:!1,selected:e.selected},this.onCreateNew=this.onCreateNew.bind(this)}componentDidMount(){const{selected:e,forceSelect:s,options:r}=this.props;!e&&s&&this.select(r[0].value)}static getDerivedStateFromProps(e,s){return s.userInput?{...s,selected:s.selected}:{...s,selected:e.selected}}onCreateNew(){const{onCreateNew:e}=this.props;this.setState({opened:!1}),e&&e()}componentDidUpdate(e,s){s.opened&&!this.state.opened?document.removeEventListener("mousedown",this.handleClickOutside):!s.opened&&this.state.opened&&document.addEventListener("mousedown",this.handleClickOutside)}getValueCmp(e){const{multiSelect:s}=this.props;if(s)return n=>e&&e.includes(n.value);const r=Array.isArray(e)?e.join(""):e;return n=>r===n.value}render(){let e="btn-group bootstrap-select show-tick form-control select optional multiselect-ignore";const{opened:s,selected:r}=this.state,{options:n,disabled:a,tooltip:l,allowCreate:o}=this.props;return s&&(e+=" open"),i.jsxs("div",{className:e,ref:this.wrapperRef,children:[i.jsxs("button",{type:"button",className:"btn dropdown-toggle selectpicker btn-default",title:l,onClick:this.toggle,disabled:a,children:[i.jsx("span",{className:"filter-option pull-left",children:this.getTitleByValue(r)}),"Â ",i.jsx("span",{className:"caret"})]}),i.jsx("div",{className:"dropdown-menu open",children:i.jsxs("ul",{className:"dropdown-menu inner selectpicker",role:"menu",children:[n&&n.map((c,u)=>i.jsx(re,{title:c.title,value:c.value,selected:mt(r,c.value),onSelect:this.select},u)),o&&i.jsxs(j.Fragment,{children:[i.jsx(re,{delimiter:!0}),i.jsx(re,{title:"Add New",onSelect:this.onCreateNew},"add_new")]})]})})]})}}Ge.defaultProps={disabled:!1,onChange:()=>{}};const gt=()=>console.error("not implemented!"),Ae=j.createContext({create:gt}),xt=M.memo(({title:t,onSelect:e,value:s,extraClass:r})=>i.jsxs("li",{className:E("srch-choice",r),children:[i.jsx("span",{dangerouslySetInnerHTML:{__html:t}})," ",e&&i.jsx("i",{className:"far fa-times",onClick:()=>{e(s)}})]}));var Le=function(e){return e!==null&&!Array.isArray(e)&&typeof e=="object"},ue={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"};for(var ie=0;ie<24;ie+=1)ue[112+ie]="F"+(ie+1);for(var me=0;me<26;me+=1){var ge=me+65;ue[ge]=[String.fromCharCode(ge+32),String.fromCharCode(ge)]}var h={codes:ue,getCode:function(e){return Le(e)?e.keyCode||e.which||this[e.key]:this[e]},getKey:function(e){var s=Le(e);if(s&&e.key)return e.key;var r=ue[s?e.keyCode||e.which:e];return Array.isArray(r)&&(s?r=r[e.shiftKey?1:0]:r=r[0]),r},Cancel:3,Help:6,Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Convert:28,NonConvert:29,Accept:30,ModeChange:31," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Select:41,Print:42,Execute:43,PrintScreen:44,Insert:45,Delete:46,0:48,")":48,1:49,"!":49,2:50,"@":50,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,9:57,"(":57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,OS:91,ContextMenu:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,NumLock:144,ScrollLock:145,VolumeMute:181,VolumeDown:182,VolumeUp:183,";":186,":":186,"=":187,"+":187,",":188,"<":188,"-":189,_:189,".":190,">":190,"/":191,"?":191,"`":192,"~":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"'":222,'"':222,Meta:224,AltGraph:225,Attn:246,CrSel:247,ExSel:248,EraseEof:249,Play:250,ZoomOut:251};h.Spacebar=h[" "];h.Digit0=h[0];h.Digit1=h[1];h.Digit2=h[2];h.Digit3=h[3];h.Digit4=h[4];h.Digit5=h[5];h.Digit6=h[6];h.Digit7=h[7];h.Digit8=h[8];h.Digit9=h[9];h.Tilde=h["~"];h.GraveAccent=h["`"];h.ExclamationPoint=h["!"];h.AtSign=h["@"];h.PoundSign=h["#"];h.PercentSign=h["%"];h.Caret=h["^"];h.Ampersand=h["&"];h.PlusSign=h["+"];h.MinusSign=h["-"];h.EqualsSign=h["="];h.DivisionSign=h["/"];h.MultiplicationSign=h["*"];h.Comma=h[","];h.Decimal=h["."];
1h.Colon=h[":"];h.Semicolon=h[";"];h.Pipe=h["|"];h.BackSlash=h["\\"];h.QuestionMark=h["?"];h.SingleQuote=h["'"];h.DoubleQuote=h['"'];h.LeftCurlyBrace=h["{"];h.RightCurlyBrace=h["}"];h.LeftParenthesis=h["("];h.RightParenthesis=h[")"];h.LeftAngleBracket=h["<"];h.RightAngleBracket=h[">"];h.LeftSquareBracket=h["["];h.RightSquareBracket=h["]"];var St=h;const X=tt(St);function be(t,e){return Array.isArray(t)?t.includes(String(e))||t.includes(e):!t&&e===""?!0:t===e}function Fe(t,e,s){const r=t?t.toLowerCase():"";return s!=null&&s.length?e&&!(t!=null&&t.length)&&!e.length?s:s.filter(n=>{if(e){if(Array.isArray(e)){if(e.find(a=>a===n.value||String(a)===String(n.value)))return!1}else if(e.includes(n.value))return!1}return n.value===""&&n.title===""?!1:t&&(t==null?void 0:t.length)>0?n.title.toLowerCase().includes(r):!0}):[]}function bt(t,e,s){const r=t?t.toLowerCase():"";if(!(s!=null&&s.length))return[];if(!(t!=null&&t.length)&&!e.length)return s;const n=new Set;for(const l of e)n.add(String(l));const a=[];for(const l of s){if(a.length>=100)return a;l.value===""&&l.title===""||n.has(String(l.value))&&(t&&t.length>0?l.title.toLowerCase().includes(r)&&a.push(l):a.push(l))}return a}function jt(t){const{options:e,disabled:s,selected:r,emptyMessage:n,onChange:a,highlightValue:l,highlightValuePrefix:o,name:c,placeholder:u,id:d}=t,m=U(),p=j.useRef(null),[x,b]=j.useState(""),v=j.useMemo(()=>x?bt(x,r,e):e,[e,x]),_=f=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{b(f)},500)};return j.useEffect(()=>{m.change(`_skip_${c}`,!0)},[]),i.jsx(_t,{options:v,disabled:s,allowCreate:!1,selected:r,emptyMessage:n,onChange:a,highlightValue:l,highlightValuePrefix:o,onSearch:_,placeholder:u,id:d,name:c})}function vt(t){const{disabled:e,onSearch:s,placeholder:r,id:n}=t,[a,l]=j.useState("");return e?null:(j.useEffect(()=>{s(a)},[a]),i.jsx("li",{className:"srch-field",children:i.jsx("input",{id:n,type:"text","aria-autocomplete":"list",autoComplete:"off",value:a,"data-testid":"dws-search-query",placeholder:r,onChange:o=>{l(o.target.value)}})}))}function _t(t){const{disabled:e,options:s,selected:r,emptyMessage:n,highlightValue:a,highlightValuePrefix:l,onSearch:o,placeholder:c,id:u,name:d}=t,m=j.useRef(null),[p,x]=j.useState(!1),b=E("show-tick optional multiselect-ignore searchable-select searchable-select-readonly",{open:p},{disabled:e}),v=()=>{},_=j.useCallback(()=>{x(!p)},[p]),f=!0;return i.jsx(i.Fragment,{children:i.jsx("div",{className:b,ref:m,children:i.jsx("div",{className:"chosen-container chosen-container-multi chosen-with-drop chosen-container-active",children:i.jsxs("ul",{className:"chosen-choices form-control select",onMouseDown:v,children:[i.jsx("i",{id:D(d),className:E("far",{"fa-angle-down":!p,"fa-times":p}),onMouseDown:_,role:"button"}),i.jsx(vt,{id:u,onSearch:o,disabled:e,placeholder:c}),i.jsx(yt,{options:s,select:null,hasSelection:f,opened:p,highlightValue:a,highlightValuePrefix:l,selected:r,emptyMessage:n,toggle:_})]})})})})}const yt=M.memo(t=>{const{options:e,hasSelection:s,emptyMessage:r,opened:n,selected:a,highlightValue:l,highlightValuePrefix:o,select:c,toggle:u}=t;let d=j.useMemo(()=>e.filter(p=>be(a,p.value)).slice(0,100),[e]);if(!e||!e.length||!s)return r?i.jsx("li",{className:"srch-show-more",children:r}):null;const m=n?!1:d.length>20;return n||d.length<=20||(d=d.slice(0,20)),i.jsxs(i.Fragment,{children:[d.map(p=>i.jsx(je,{option:p,highlightValue:l,highlightValuePrefix:o,select:c},p.value)),m&&i.jsx("li",{className:"srch-show-more",children:i.jsx("a",{href:"#",onMouseDown:p=>(p.preventDefault(),u(),!1),children:"Show All..."})})]})});class We extends j.Component{constructor(e){super(e),this.callFocusOrBlur=()=>{const{opened:s}=this.state,{onFocus:r,onBlur:n}=this.props;s&&r?r():n&&n()},this.toggle=()=>{const{disabled:s}=this.props;if(s)return!1;const{opened:r}=this.state;return this.setState({opened:!r,searchValue:"",options:this.filterOptions("")},this.callFocusOrBlur),!1},this.hide=()=>{this.setState({opened:!1,searchValue:"",options:this.filterOptions("")},this.callFocusOrBlur)},this.select=s=>{const{multiSelect:r,highlightValue:n,onChange:a}=this.props;if(!(n&&(n===s||String(s)===String(n))))if(r){const{selected:l}=this.state,o=l?Array.from(l).filter(u=>u!==s):[];(!l||!l.includes(s))&&o.push(s);const c={selected:o,userInput:!0,searchValue:"",options:this.filterOptions("",o)};(!c.options||!c.options.length)&&(c.searchFieldFocused=!1),c.opened=c.options.length>0,this.setState(c,this.callFocusOrBlur),a(o.length>0?o:[""])}else this.setState({selected:s,opened:!1,userInput:!0},this.callFocusOrBlur),a(s)},this.handleClickOutside=s=>{this.wrapperRef&&s.target.isConnected&&this.wrapperRef.current&&!this.wrapperRef.current.contains(s.target)&&this.hide()},this.getTitleByValue=s=>{const{multiSelect:r}=this.props,{options:n}=this.props;if(!n)return"";const a=n?n.filter(this.getValueCmp(s)):[];if(a&&a.length>0)return a.map(o=>o.title).join(", ");const{askToSelect:l}=this.props;return l&&l.length>0?l:r?"N/A":""},this.wrapperRef=M.createRef(),this.searchInputRef=M.createRef(),this.state={opened:!1,selected:e.selected,searchValue:"",hovered:-1,options:this.filterOptions(""),showAll:!1,searchFieldFocused:!1},this.navigate=this.navigate.bind(this),this.scrollSelectedItemIntoView=this.scrollSelectedItemIntoView.bind(this),this.onCreateNew=this.onCreateNew.bind(this),this.onClickInside=this.onClickInside.bind(this)}filterOptions(e=this.state.searchValue,s=this.props.selected){const{options:r}=this.props;return Fe(e,s,r)}componentDidMount(){const{selected:e,forceSelect:s,options:r}=this.props;!e&&s&&this.select(r[0].value)}static getDerivedStateFromProps(e,s){const{selected:r}=e;return{...s,options:Fe(s.searchValue,r,e.options),selected:r}}componentDidUpdate(e,s){const{opened:r}=this.state;s.opened&&!r?document.removeEventListener("mousedown",this.handleClickOutside):!s.opened&&r&&document.addEventListener("mousedown",this.handleClickOutside)}getValueCmp(e){const{multiSelect:s}=this.props;if(s)return n=>e&&e.includes(n.value);const r=Array.isArray(e)?e.join(""):e;return n=>r===n.value}renderLabels(){const{selected:e,showAll:s,opened:r}=this.state,{options:n,highlightValue:a,highlightValuePrefix:l}=this.props;let o=e&&e.length&&(Array.isArray(e)?!!e.filter(c=>c!=="").length:!0);if(!n||!n.length||!o){const{emptyMessage:c}=this.props;return c?i.jsx("li",{className:"srch-show-more",children:c}):null}return r||e.length<=20||s?n.filter(c=>be(e,c.value)).map(c=>i.jsx(je,{option:c,highlightValue:a,highlightValuePrefix:l,select:this.select},c.value)):i.jsxs(i.Fragment,{children:[n.filter(c=>be(e,c.value)).slice(0,20).map(c=>i.jsx(je,{option:c,highlightValue:a,highlightValuePrefix:l,select:this.select},c.value)),i.jsx("li",{className:"srch-show-more",children:i.jsx("a",{href:"#",onMouseDown:c=>(c.preventDefault(),this.setState({showAll:!0}),!1),children:"Show All..."})})]})}navigate(e){const{options:s,hovered:r,selected:n,searchValue:a}=this.state,l=X.getCode(e);if(l===X.Backspace){if(!a.length){const{options:d,highlightValue:m}=this.props,p=d.map(_=>_.value).filter(_=>n.includes(_));let x=p.length-1;if(x<0)return;if(m&&String(p[x])===String(m)){if(!x)return;x--}
1n.splice(n.indexOf(p[x]),1);const b=this.filterOptions(void 0,n),v={selected:n,options:b};b.length>0&&(v.opened=!0),this.setState(v,this.callFocusOrBlur)}return}if(l===X.Enter){e.preventDefault(),r!==-1&&s[r]&&this.setState({searchValue:""},()=>{this.select(s[r].value)});return}const c={[X.ArrowUp]:-1,[X.ArrowDown]:1}[l];if(c===void 0)return;let u=r+c;u<0?u=s.length-1:u>s.length-1&&(u=0),this.setState({hovered:u},this.scrollSelectedItemIntoView)}renderSearch(){const{disabled:e,placeholder:s,id:r}=this.props,{searchValue:n}=this.state;return e?null:i.jsx("li",{className:"srch-field",children:i.jsx("input",{type:"text","aria-autocomplete":"list",autoComplete:"off",value:n,ref:this.searchInputRef,placeholder:s,id:r,"data-testid":r,onFocus:a=>this.setState({opened:!0,searchFieldFocused:!0},this.callFocusOrBlur),onBlur:a=>{this.handleClickOutside(a),this.setState({searchFieldFocused:!1})},onChange:a=>{const l=a.target.value;this.setState({searchValue:l,hovered:-1},()=>{this.filterOptions(l)})},onKeyDown:this.navigate})})}isHovered(e){const{hovered:s}=this.state;return s!==-1?e===s:!1}scrollSelectedItemIntoView(){const{current:e}=this.wrapperRef;if(!e)return;const s=e.querySelector("div.d-menu");if(!s)return;const r=s.querySelector("a.hover");if(!r)return;const n=r.parentNode;if(!n)return;const a=e.querySelector(".chosen-container");if(!a)return;const l=n.offsetTop-a.clientHeight,o=l<s.scrollTop,c=l+n.clientHeight>s.scrollTop+s.clientHeight;o?s.scrollTop=l:c&&(s.scrollTop=l+n.clientHeight-s.clientHeight)}onCreateNew(){const{onCreateNew:e}=this.props;this.setState({opened:!1},this.callFocusOrBlur),e&&e()}onClickInside(e){const{disabled:s}=this.props;if(s)return;const{opened:r}=this.state;r||e.target&&e.target.className&&e.target.className.indexOf("chosen-choices")===0&&(this.setState({opened:!0},this.callFocusOrBlur),this.searchInputRef&&this.searchInputRef.current&&setTimeout(()=>{const{current:n}=this.searchInputRef;n&&n.focus()},1))}render(){const{allowCreate:e,disabled:s,name:r}=this.props,{opened:n,options:a,searchValue:l}=this.state,o=E("show-tick optional multiselect-ignore searchable-select",{open:n},{disabled:s});return i.jsxs("div",{className:o,ref:this.wrapperRef,children:[i.jsx("div",{className:"chosen-container chosen-container-multi chosen-with-drop chosen-container-active",children:i.jsxs("ul",{id:`${r}-selected-multiselect`,"data-testid":`${r}-selected-multiselect`,className:E("chosen-choices form-control select",this.props.className,{disabled:s}),onMouseDown:this.onClickInside,children:[i.jsx("i",{id:D("test"),className:E("far",{"fa-angle-down":!n,"fa-times":n}),onMouseDown:this.toggle,role:"button"}),this.renderLabels(),a&&!a.length&&!l?null:this.renderSearch()]})}),i.jsx("div",{className:"d-menu open",children:i.jsxs("ul",{id:`${r}-inner-selectpicker`,className:"inner selectpicker","aria-multiselectable":"true",role:"listbox",children:[a==null?void 0:a.map((c,u)=>i.jsx(re,{title:c.title,value:c.value,selected:!1,hovered:this.isHovered(u),onSelect:this.select},c.value)),a!=null&&a.length?null:i.jsx("li",{children:i.jsx("span",{className:"empty",children:"No results found"})}),e&&i.jsx(re,{title:"Add New",linkClass:"new",onSelect:this.onCreateNew},"add_new")]})})]})}}We.defaultProps={disabled:!1,onChange:()=>{}};const je=M.memo(({option:t,highlightValue:e,highlightValuePrefix:s,select:r})=>{let n;const{value:a}=t;let{title:l}=t;return e&&String(e)===String(a)&&(l=s+l,n="default"),i.jsx(xt,{title:l,value:a,onSelect:r,extraClass:n})});function wt(t){const{selected:e}=t;return Array.isArray(e)&&e.length>5e3?i.jsx(jt,{...t}):i.jsx(We,{...t})}const Ct=({title:t,value:e,options:s,onSelect:r,addList:n})=>s?i.jsxs("div",{children:[i.jsx("h5",{dangerouslySetInnerHTML:{__html:t}}),s.map(a=>i.jsxs("div",{className:"opt child",onMouseDown:l=>{l.shiftKey?($e(),r(a.value,!0,!0)):r(a.value,!n[a.value])},children:[i.jsx("input",{type:"checkbox",onChange:()=>!1,checked:!!n[a.value],"data-testid":a.value,"data-testlabel":a.title})," ",i.jsx("div",{children:i.jsx("span",{dangerouslySetInnerHTML:{__html:a.title}})})]},a.value))]}):i.jsxs("div",{className:"opt",onMouseDown:a=>{a.shiftKey?($e(),r(e,!0,!0)):r(e,!n[e])},children:[i.jsx("input",{type:"checkbox",onChange:()=>!1,checked:!!n[e],"data-testid":e})," ",i.jsx("div",{children:i.jsx("span",{dangerouslySetInnerHTML:{__html:t}})})]},e);function $e(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty()}const Nt=({title:t,value:e,onRemove:s,isChild:r})=>i.jsxs("div",{className:"r-rw"+(r?" child":""),children:[i.jsx("span",{children:t}),i.jsx("a",{className:"fal fa-times",onClick:()=>{s(e)}})]});function Ie({children:t,listClass:e="list",scrollClass:s="with-scrollbar",maxHeight:r=400}){const n=j.useRef(),[a,l]=j.useState(!1);return j.useEffect(()=>{const{current:o=null}=n;if(o&&o.scrollHeight>r){l(!0);return}l(!1)},[n,t]),i.jsx("div",{className:E(e,{[s]:a}),ref:n,children:t})}const ae=(t,e)=>{const s=t.toLowerCase();return s&&s.length>0?e.filter(r=>{if(r.title.toLowerCase().includes(s))return!0;
1if(r.options){for(const n of r.options)if(n.title.toLowerCase().includes(s))return!0}}).map(r=>{if(!r.options||r.title.toLowerCase().includes(s))return r;const n=r.options.filter(a=>a.title.toLowerCase().includes(s));return{...r,options:n}}):e};class Qe extends j.Component{constructor(e){super(e),this.hide=()=>{this.setState({modalVisible:!1})},this.select=s=>{const{selected:r}=this.state;let n=r?Array.from(r).filter(l=>l!==s):[];(!r||!r.includes(s))&&n.push(s);let a={selected:n,userInput:!0};this.setState(a),this.props.onChange&&this.props.onChange(n.length>0?n:[""])},this.handleClickOutside=s=>{this.wrapperRef&&this.wrapperRef.current&&!this.wrapperRef.current.contains(s.target)&&this.hide()},this.wrapperRef=M.createRef(),this.listRef=M.createRef(),this.modalListRef=M.createRef(),this.state={opened:!1,selected:e.selected,modalVisible:!1,addList:{},searchValue:"",options:ae("",this.props.options),selectAll:!1},this.onCreateNew=this.onCreateNew.bind(this),this.clearAll=this.clearAll.bind(this),this.onGroupSelected=this.onGroupSelected.bind(this),this.saveSelection=this.saveSelection.bind(this),this.selectAll=this.selectAll.bind(this)}static getDerivedStateFromProps(e,s){return s.userInput?{...s,selected:s.selected}:{...s,selected:e.selected}}onCreateNew(){const{onCreateNew:e}=this.props;this.setState({opened:!1}),e&&e()}componentDidUpdate(e,s){s.opened&&!this.state.opened?document.removeEventListener("mousedown",this.handleClickOutside):!s.opened&&this.state.opened&&document.addEventListener("mousedown",this.handleClickOutside)}getValueCmp(e){return s=>e&&e.includes(s.value)}clearAll(e){e.preventDefault(),this.setState({selected:[]}),this.props.onChange&&this.props.onChange([""])}renderSelection(){const{options:e,entityName:s}=this.props,{selected:r}=this.state,n={};if(!r||!r.length||r.length===1&&r[0]==="")return i.jsx("input",{className:"form-control",disabled:"",placeholder:`No ${s} Selected`,onClick:()=>this.setState({searchValue:"",modalVisible:!0,selectAll:!1,options:ae("",this.props.options),addList:Array.isArray(this.state.selected)?this.state.selected.reduce((a,l)=>(a[l]=!0,a),{}):{}})});for(const a of e)if(a.options)for(const l of a.options)r.includes(l.value)&&(n[a.title]||(n[a.title]=[]),n[a.title].push(l));else{if(!r.includes(a.value))continue;n[0]||(n[0]=[]),n[0].push(a)}return i.jsxs("div",{className:"results",children:[i.jsxs("div",{className:"r-hd",children:[i.jsxs("span",{children:["Selected ",s]}),i.jsx("a",{onClick:this.clearAll,children:"clear all"})]}),i.jsx(Ie,{children:Object.entries(n).map(([a,l])=>i.jsxs(j.Fragment,{children:[a!=="0"?i.jsx("div",{className:"r-sb-hd",dangerouslySetInnerHTML:{__html:a}}):null,l.map(o=>i.jsx(Nt,{...o,onRemove:this.select,isChild:a!=="0"},o.value))]},a))})]})}onGroupSelected(e,s,r){this.setState(n=>{const a={selectAll:!1,addList:{...n.addList},lastSelection:s?e:null},{lastSelection:l}=n,{options:o}=this.props;let c=s,u=[e];if(r&&l){const d=[];for(const x of o)if(x.options)for(const b of x.options)d.push(b.value);else d.push(x.value);const m=d.indexOf(l),p=d.indexOf(e);u=d.slice(Math.min(m,p),Math.max(m,p)+1)}if(c&&u.length!==-1){let d=!0;for(const m of u)a.addList[m]||(d=!1);c=!d}for(const d of u)c?a.addList[d]=!0:delete a.addList[d];return o.length===Object.values(a.addList).length&&(a.selectAll=!0),a})}renderOptions(){const{options:e}=this.state;return e&&e.map((s,r)=>i.jsx(Ct,{title:s.title,value:s.value,options:s.options,addList:this.state.addList,onSelect:this.onGroupSelected},r))}saveSelection(){const{addList:e}=this.state,s=Object.keys(e).map(n=>parseInt(n)).filter((n,a,l)=>l.indexOf(n)===a);let r={selected:s,userInput:!0,addList:[]};this.setState(r),this.props.onChange&&this.props.onChange(s.length>0?s:[""]),this.hide()}selectAll(e){const{options:s,selectAll:r}=this.state,n=Object.keys(this.state.addList).length,a=this.props.options.length,l=r||a===n;let o={...this.state.addList};const c=e?e.currentTarget.checked:!l;for(const u of s)if(u.options)for(const d of u.options)o[d.value]=c;else o[u.value]=c;o=Object.keys(o).reduce((u,d)=>o[d]?{...u,[d]:o[d]}:{...u},{}),this.setState({selectAll:c,addList:o})}renderSelectAll(){const{selectAll:e,addList:s}=this.state,r=Object.keys(s).length,n=this.props.options.length,a=e||n===r;return i.jsxs("div",{className:"slct-all opt",onClick:l=>this.selectAll(null),children:[i.jsx("input",{type:"checkbox",checked:a,onChange:this.selectAll})," ",i.jsx("span",{children:"Select All"}),i.jsxs(i.Fragment,{children:[r||0," selected"]})]})}renderSearch(){return i.jsxs("div",{className:"srch",children:[i.jsx("i",{className:"far fa-search"}),i.jsx("input",{type:"text",placeholder:"Search",onChange:e=>{const s=e.target.value;this.setState({searchValue:s,options:ae(s,this.props.options)})}})]})}renderMissingDataMessage(e){if(e)return null;const{searchValue:s}=this.state,{missingDataNote:r}=this.props,n=s?`There are no methods that match "${s}"`:r||"There are no methods that match";return i.jsx("p",{className:"text-center mt30",children:n})}render(){const{title:e,hint:s,required:r,meta:n,entityName:a}=this.props,{modalVisible:l,options:o}=this.state,c=n?(n.error||n.submitError)&&n.touched:!1,u=o&&o.length>0;return i.jsxs("div",{className:"md-ms",children:[i.jsxs("div",{className:E("form-group",{required:r,"has-error":c}),children:[i.jsx("label",{className:"control-label",children:e}),this.renderSelection(),i.jsx("p",{className:"help-block",children:s}),c&&i.jsxs("span",{className:"help-block",children:[i.jsx("i",{className:"fa fa-exclamation-circle"})," ",n.error?n.error:n.submitError]})]}),i.jsxs("button",{className:"btn btn-primary",type:"button",onClick:()=>this.setState({searchValue:"",modalVisible:!0,selectAll:!1,options:ae("",this.props.options),addList:Array.isArray(this.state.selected)?this.state.selected.reduce((d,m)=>(d[m]=!0,d),{}):{}}),children:["Add ",a]}),l&&i.jsxs(Te,{contentWrapClass:"mbasic mlist mlist-modal",onClose:this.hide,children:[i.jsxs("div",{className:"mlist-header",children:[e&&i.jsx("div",{className:"mlist-title",children:e}),this.renderSearch()]}),i.jsxs(Ie,{maxHeight:360,children:[u?this.renderSelectAll():null,this.renderOptions(),this.renderMissingDataMessage(u)]}),i.jsxs("div",{className:"actions",children:[i.jsx("button",{className:"btn btn-bl-o",type:"button",onClick:this.hide,children:"Cancel"}),i.jsx("button",{className:"btn btn-primary",type:"button",onClick:this.saveSelection,disabled:!u,children:"Apply"})]})]})]})}}Qe.defaultProps={disabled:!1,entityName:"Methods",onChange:()=>{}};const kt="/images/radio-unselected.svg",At="/images/radio-selected.svg",ve=16,Ke=8,Us=ve+Ke,Lt=F.label` 2 cursor: pointer; 3 display: flex !important;
4 align-items: flex-start; 5 margin-bottom: 8px; 6 font-weight: 400; 7 line-height: 20px; 8 font-size: 14px; 9`,Ft=F.div` 10 cursor: pointer; 11 width: ${ve}px; 12 min-width: ${ve}px; 13 height: 15px; 14 margin-right: ${Ke}px; 15 margin-top: 2px; 16 background-image: url('${kt}'); 17`,$t=F.input` 18 display: none; 19 visibility: hidden; 20 21 &:checked + div { 22 background-image: url('${At}'); 23 } 24`,It=F.div` 25 font-style: normal; 26 font-weight: 400; 27 font-size: 14px; 28 line-height: 20px; 29 color: ${({theme:t})=>t.colors.grey5}; 30 margin-bottom: 10px; 31 margin-top: 4px; 32`,Dt=({labelFor:t,className:e,disabled:s,required:r,checked:n,title:a,hint:l,...o})=>{const c=(e||"control-label optional")+(n?" active":"");return i.jsx(i.Fragment,{children:i.jsxs(Lt,{htmlFor:t,className:c,children:[i.jsx($t,{disabled:s,...o,id:t,type:"radio",className:"optional",...r?{"aria-required":"true"}:null,checked:n}),i.jsx(Ft,{}),i.jsxs("div",{children:[a,l&&i.jsx(It,{children:l})]})]})})};function xe(t){return String(t).length>0}const le=t=>Number.parseFloat(t)===0,De=(t,e,s)=>{if(!s)return e==="true"||e==="false"||typeof e=="boolean"?Re(t)===Re(e):t===e;if(typeof t=="string"&&typeof e=="string"&&!qt(s))return Rt(t,e,s);switch(s){case"has_less_than":return!t||!Array.isArray(t)?!0:t.filter(xe).length<e;case"has_more_than":return!t||!Array.isArray(t)?!1:t.filter(xe).length>e}if(Array.isArray(t))switch(s){case"nin":return!t.includes(e);case"is_empty":return!t||t.filter(xe).length===0;default:return t.includes(e)}if(Array.isArray(e))switch(s){case"nin":return!e.includes(t);default:return e.includes(t)}const r=Number.parseFloat(String(t)),n=Number.parseFloat(e);switch(s){case"lte":return isNaN(r)||isNaN(n)?!0:r<=n;case"gte":return isNaN(r)||isNaN(n)?!0:r>=n;case"lt_or_zero":return isNaN(r)||isNaN(n)||le(r)&&le(n)?!0:r<n;case"gt_or_zero":return isNaN(r)||isNaN(n)||le(r)&&le(n)?!0:r>n;case"lt":return isNaN(r)||isNaN(n)?!0:r<n;case"gt":return isNaN(r)||isNaN(n)?!0:r>n;case"is_empty":return!t;case"is_not_empty":return!!t;case"not_zero":return parseFloat(r)!==0;case"not":return isNaN(r)||isNaN(n)?!0:r!==n;case"neq":return t!==e;default:return t===e}};function Re(t){return typeof t=="boolean"?t:t==="true"}const Rt=(t,e,s)=>{switch(s){case"not":return t!==e;case"neq":return t!==e;default:return t===e}};function qt(t){return["lt","gt","lte","gte","not_zero","gt_or_zero","lt_or_zero"].includes(t)}const qe=(t,e)=>{if(!t)return!1;const s=t.toLocaleLowerCase().replace(".","");return Array.isArray(e)?e.includes(s):e===s},Et=t=>{if(!t)return!1;const e=t.toLocaleLowerCase().replace(".","");return e!=="bigcommerce"&&e!=="woocommerce"&&e!=="shopify"&&e!=="salesforce"&&e!=="commercetools"&&e!=="cartcom"&&e!=="shopware"},Bs=t=>t?t.toLocaleLowerCase().replace(".","")==="shopify":!1,Ot=(t,e)=>{if(!t)return!1;if(Array.isArray(e)){for(const s of e)if(!t.includes(s))return!1;return!0}else return t.includes(e)},Pt=(t,e)=>{if(!t)return!1;for(const s of e)if(t.includes(s))return!0;return!1},Mt=t=>{var e,s,r;return(r=(s=(e=window==null?void 0:window.appData)==null?void 0:e.current_user)==null?void 0:s.preview_features)==null?void 0:r.includes(t)},Tt=(t,e)=>{if(!e)return!1;if(t==="dhl")return["dhl",null,"",void 0].includes(e.landing_cost_provider);if(t==="hurricane")return["hurricane"].includes(e.landing_cost_provider)};function ee(t,e,s={}){const{enabledFeatures:r,platform:n,plan:a,userSettings:l,renderedFields:o,isDefaultValue:c,carriersLimit:u,carriersCount:d,originsLimit:m,originsCount:p,quickRulesLimit:x,quickRulesCount:b,crossBorderSettings:v}=e;let _=!0;for(const f of t)if(f.field){const g=f.field;if(!g.name){console.error("fieldDef.name is missing!",JSON.stringify(f));continue}if(!De(s[g.name],g.value,g.op))return!1}else if(f.platform){if(!qe(n,f.platform))return!1}else if(f.platform_neq){if(qe(n,f.platform_neq))return!1}else{if(f.all_plans)return!0;if(f.plan){if(!Ee(a,f.plan))return!1}else{if(f.upsell_plan)return zt({plan:a,platform:n,upsellPlans:f.upsell_plan});if(f.plan_neq){if(Ee(a,f.plan_neq))return!1}else if(f.magento_platform!==void 0){if(!f.magento_platform||!Et(n))return!1}else if(f.feature){if(!Ot(r,f.feature))return!1}else if(f.preview_feature){if(!Mt(f.preview_feature))return!1}else if(f.any_feature){if(!Pt(r,f.any_feature))return!1}else if(f.user_settings_any_set){if(!l)return!1;for(const g of f.user_settings_any_set)if(l[g])return!0;return!1}else if(f.user_settings){if(!l)return!1;for(const[g,C]of Object.entries(f.user_settings))if(typeof C=="object"){const y=Object.entries(C)[0];if(!De(l[g],y[1],y[0]))return!1}else if(C!==l[g])return!1}else if(f.available_carriers){const g=u-d;return g===f.available_carriers?!0:(g>f.available_carriers||g===0,!1)}else if(f.available_origins){const g=m-p;return g===f.available_origins?!0:(g>f.available_origins||g===0,!1)}else if(f.available_quick_rules){const g=x-b;return g===f.available_quick_rules?!0:(g>f.available_quick_rules||g===0,!1)}else if(f.or){let g=!1;for(const C of f.or)if(ee([C],e,s)){g=!0;break}if(!g)return!1}else if(f.and){for(const g of f.and)if(!ee([g],e,s))return!1;return!0}else if(f.not){if(ee(f.not,e,s))return!1}else{if(f.non_default_value_for)return!(ee(f.non_default_value_for,e,s)&&c);if(f==="non_default_value")return!c;if(f.visible){if(!o||o[f.visible]===void 0)return!1}else if(f.cross_border_provider)return Tt(f.cross_border_provider,v)}}}return _}const Vt={upsctpent:"enterprise",upsctppro:"pro",upsctp:"starter",freeupsaccesspoint:"free"};function Ee(t,e){let s=Array.isArray(e)?e:[e];const r=Vt[t];return r?s.includes(r):s.includes(t)}const zt=({plan:t,platform:e,upsellPlans:s})=>!(ct[e]||[]).filter(a=>s.includes(a)).includes(t);function Gs(t,e){if(Array.isArray(t))return!t.length&&(!e||e===""||e===0);if(typeof e=="string"&&e.length&&/[\d-]/.test(e))try{return parseInt(t)?parseFloat(e)===parseFloat(t):!0}catch{return e===t}return e===t}function Oe(t,e,s){if(typeof t=="object"){for(const[r,n]of Object.entries(t))if(ee(n,{},s))return r}else return e[0].value}const Ht=j.createContext({isEmbedded:!1,onCreate:t=>{},getCustomData:t=>{},setCustomData:(t,e)=>{}}),Ut="_checkboxLabel_11wmm_2",Bt={checkboxLabel:Ut},Ws=t=>t?void 0:"Required",Qs=t=>(t||(t=[]),[{title:"",value:""}
32,...t]),O=t=>{const{error:e,label:s,infoLink:r,labelTag:n,hint:a,hintPosition:l,extraHint:o,meta:c={},children:u,labelClassName:d,rootClassName:m="form-group",className:p,fullWidth:x,oneLine:b,inputGroup:v,widgetWrapClass:_,required:f,name:g,removeFieldDiv:C,hideTitleAndHint:y,prefix:N}=t;let I="",R="control-label select optional";d&&(R=`${R} ${d}`);let P="";b&&(I=""),v&&(P+="input-group"),N&&(P+="control-with-prefix"),_&&(P+=" "+_),x&&(I=""),p&&(I+=" "+p),f&&(I+=" required");const B=(c.error||c.submitError)&&c.touched||e,S=c.error||e||c.submitError,k=Array.isArray(S)&&S.length>1?S.join(". "):S,V=i.jsxs(i.Fragment,{children:[" ",l==="top"&&a?i.jsx("p",{className:"hint hint-top",dangerouslySetInnerHTML:{__html:a}}):null,u,B&&i.jsxs("span",{className:"help-block",children:[i.jsx("i",{className:"fa fa-exclamation-circle"})," ",k]}),a&&!y&&l!=="top"?i.jsx("p",{className:"help-block",dangerouslySetInnerHTML:{__html:a}}):null,o&&i.jsx("p",{className:"help-block warn-txt",dangerouslySetInnerHTML:{__html:o}})]});return i.jsxs("div",{className:m+I+(B?" has-error":""),children:[n||(s&&!y?i.jsxs(i.Fragment,{children:[i.jsx("label",{className:R,onClick:is,htmlFor:g?D(g):s||void 0,children:s}),r&&i.jsx("a",{className:"control-label--info-link",href:r,target:"_blank",children:i.jsx("i",{class:"fas fa-info-circle"})})]}):null),C?V:i.jsxs("div",{className:P.trim(),children:[N?i.jsx("span",{className:"input-prefix",children:N}):void 0,V]})]})},Z=({unit:t,children:e,pullLeft:s=!1})=>{const{distance_unit:r,volume_unit:n,weight_unit:a}=Ce(({app:{user_settings:{distance_unit:l="KM",volume_unit:o="m",weight_unit:c="kg"}={}}={}})=>({distance_unit:l,volume_unit:o,weight_unit:c}));if(t){switch(t){case"volume":t=n;break;case"weight":t=a;break;case"distance":t=r;break}const l=i.jsx("span",{className:"input-group-addon",children:t});return i.jsxs("div",{className:"input-group",children:[s&&l,e,!s&&l]})}return e},Gt=t=>{const{error:e,title:s,infoLink:r,input:n,meta:a,hint:l,unit:o,disabled:c,compact:u,fullWidth:d,className:m,oneLine:p,input:{type:x},readOnly:b,required:v,leftIcon:_,rightLabel:f,hideTitleAndHint:g,prefix:C}=t,y=j.useContext(dt),N={};return y&&y.disableAutocomplete&&(N.autoComplete="new-password"),i.jsx(O,{error:e,meta:a,label:s,infoLink:r,name:n.name,hint:l,compact:u,fullWidth:d,className:m,oneLine:p,required:v,hideTitleAndHint:g,prefix:C,children:i.jsx(Z,{unit:o,children:i.jsxs("div",{className:_?"input-group":"",children:[_&&i.jsx("span",{className:"input-group-addon",children:i.jsx("span",{className:"fa fa-"+_})}),i.jsx("input",{className:"form-control string optional",readOnly:b||c,placeholder:t.placeholder,...pe(n),id:D(n.name),type:x||"text",...v?{"aria-required":"true"}:null,...N}),f&&i.jsx("span",{className:"input-group-addon",children:f})]})})})},Wt=t=>{const{title:e,input:s,unit:r,disabled:n,required:a,error:l}=t;return i.jsx(O,{error:l,label:e,name:s.name,...t,children:i.jsx(Z,{unit:r,children:i.jsx("input",{id:D(s.name),type:"text",className:"form-control string optional input-sm",readOnly:n,placeholder:t.placeholder,...pe(s),...a?{"aria-required":"true"}:null})})})},Ks=t=>{const{title:e,input:s,meta:r,hint:n,unit:a,disabled:l,readOnly:o,compact:c,oneLine:u,required:d,error:m}=t;return i.jsx(O,{error:m,meta:r,name:s.name,label:e,hint:n,compact:c,oneLine:u,required:d,children:i.jsx(Z,{unit:a,children:i.jsx("textarea",{id:D(s.name),rows:3,className:"form-control string optional",disabled:l,readOnly:o,...s,...d?{"aria-required":"true"}:null})})})};function Qt(t,e,s){if(e){if(e==="positive"){s({target:{value:t.target.value.replace("-","")}});return}if(e==="negative"){s({target:{value:"-"+t.target.value.replace("-","")}});return}}s(t)}function Kt(t,e){return t?e.toString().replace("-",""):e}function Ze(t,e){const s={...pe(t)},r=s.onChange;return s.onChange=n=>Qt(n,e,r),s.value=Kt(e,s.value),s}const Zs=t=>{const{title:e,input:s,meta:r,hint:n,step:a,min:l,max:o,unit:c,disabled:u,readOnly:d,fullWidth:m,compact:p,small:x,oneLine:b,required:v,leftIcon:_,rightLabel:f,hideTitleAndHint:g,prefix:C,transformValue:y,error:N}=t;let I="form-control string optional";x&&(I+=" input-sm");const R=Ze(s,y);return i.jsx(O,{error:N,meta:r,label:e,hint:n,compact:p,fullWidth:m,oneLine:b,required:v,hideTitleAndHint:g,prefix:C,name:R.name,children:i.jsx(Z,{unit:c,children:i.jsxs("div",{className:_||f?"input-group":"",children:[_&&i.jsx("span",{className:"input-group-addon",children:i.jsx("span",{className:"fa fa-"+_})}),i.jsx("input",{id:D(R.name),className:I,disabled:u,readOnly:d,step:"any",placeholder:t.placeholder,min:l,max:o,...R,...v?{"aria-required":"true"}:null,type:"number"}),f&&i.jsx("span",{className:"input-group-addon",children:f})]})})})},Ys=t=>{const{title:e,input:s,meta:r,hint:n,min:a,max:l,error:o,disabled:c,readOnly:u,fullWidth:d,compact:m,small:p,oneLine:x,required:b,leftIcon:v,hideTitleAndHint:_,transformValue:f,rightLabel:g}=t,{app:{user_settings:{currency_symbol:C="$"}={}}={}}=oe.getState();let y="form-control string optional";p&&(y+=" input-sm");const N=Ze(s,f);return i.jsx(O,{error:o,meta:r,label:e,hint:n,compact:m,fullWidth:d,oneLine:x,required:b,hideTitleAndHint:_,children:i.jsx(Z,{unit:C,pullLeft:!0,children:i.jsxs("div",{className:v||g?"input-group":"",children:[v&&i.jsx("span",{className:"input-group-addon",children:i.jsx("span",{className:"fa fa-"+v})}),i.jsx("input",{type:"number",className:y,disabled:c,readOnly:u,step:"any",min:a,max:l,placeholder:t.placeholder,...N,...b?{"aria-required":"true"}:null})]})})})};async function Zt(t,e,s,r,n){const{app:{option_sources:a,entity:{option_sources:l}={}}}=oe.getState();if(n){const o=r.textFieldName?r.textFieldName:r.input.name;r.multiSelect?s.change(o,[]):s.change(o,"")}if(Array.isArray(t)&&(t=String(t.find(o=>!!o))),t){const o="states_"+t;let c={...a,...l};if(c[o]||await oe.dispatch(lt(t)),!r.multiSelect){const{app:{option_sources:d,entity:{option_sources:m}={}}}=oe.getState();c={...d,...m};const p=c[o];p&&(p.length>0?n&&(s.change(r.idFieldName,p[0].value),r.textFieldName&&s.change(r.textFieldName,"")):n&&s.change(r.idFieldName,""))}}}const Yt=t=>{const{options:e={},children:s}=t,{countryField:r}=e,[n,a]=j.useState(0),l=rt(e.countryField,{}),o=U(),c=async()=>
32{if(!l)return;const{input:{value:u}}=l;u!==n&&(a(u),await Zt(u,r,o,e,n!==0))};return j.useEffect(()=>{c()},[l]),s},Js=t=>{var r;const e=((r=t==null?void 0:t.options)==null?void 0:r.length)>0?es:t.small?Wt:Gt,s=i.jsx(e,{...t});return t.countryField?i.jsx(Yt,{options:t,children:s}):s},Jt=({error:t,title:e,hint:s,options:r,input:n,meta:a,compact:l,small:o,disabled:c,fullWidth:u,oneLine:d,readOnly:m,multiSelect:p,forceSelect:x,defaultValue:b,skipNotExists:v,className:_,widgetWrapClass:f,size:g,required:C,updateOnChange:y,onlyOptions:N,hideTitleAndHint:I,prefix:R})=>{const[P,B]=j.useState({}),S=U(),k=st(),V=de({value:n.value,options:r,onlyOptions:N}),W=j.useContext(Ht);let Y="form-control select";o&&(Y+=" input-sm");const Q={};p&&(Q.multiple="multiple"),g&&g>0&&(Q.size=g),!n.multiple&&!p&&Array.isArray(n.value)&&(Q.value=n.value.length?n.value[0]:"");const J=()=>{if(k.values){const w=String(k.values[n.name]);let A=k.values[y.$set_in];A||(A=[]);let q=!1;A.find($=>w===$||w===String($))||(A.push(w),q=!0);const L="$set_in_"+n.name;if(q){let $=W.getCustomData(L);$&&A.length>1&&(A=A.filter(G=>String(G)!==String($))),S.change(y.$set_in,[...new Set(A)]),W.setCustomData(L,w)}else W.getCustomData(L)||W.setCustomData(L,w)}},z=ke(n.value)?!0:!!n.value&&!!(r!=null&&r.find(w=>String(w.value)===String(n.value))),K=!n.value&&!a.touched&&r&&r.length;return j.useEffect(()=>{if(x&&K||v&&!z){const w=Oe(x,r,k.values);w&&S.change(n.name,w)}y&&y.$set_in&&J()},[z]),j.useEffect(()=>{if(x&&(!n.value||n.value==="")&&r&&r.length>0){const w=Oe(x,r,k.values);S.change(n.name,w)}},[r]),j.useEffect(()=>{if(y&&y.$set_from_data){const w=y.$set_from_data.data_key,A=y.$set_from_data.form_key,q=r.find(L=>`${L.value}`==`${n.value}`);if(q){const L=q.data[w];S.change(A,L)}}},[n.value]),j.useEffect(()=>{if(a.modified&&(y!=null&&y.$clear_fields)){const w=y.$clear_fields;S.batch(()=>{w.forEach(A=>{S.change(A,null)})})}},[n.value]),j.useEffect(()=>{if(a.modified&&y){const w=y[n.value?n.value.toString():""];let A;y.$set_in?A=J:w?A=()=>{const q={};for(const[L,$]of Object.entries(w)){const G=k.values?k.values[L]:null;G&&(q[L]=G),S.change(L,$)}for(const[L,$]of Object.entries(P))q[L]||S.change(L,$);B({...P,...q})}:A=()=>{for(const[q,L]of Object.entries(P))(k.values?k.values[q]:null)||S.change(q,L)},A&&setTimeout(()=>S.batch(A),0)}},[n.value]),i.jsx(O,{error:t,meta:a,label:e,hint:s,compact:l,fullWidth:u,oneLine:d,className:_,widgetWrapClass:f||"",required:C,name:n.name,hideTitleAndHint:I,prefix:R,children:i.jsx("select",{...n,className:Y,id:D(n.name),disabled:c||m,defaultValue:b,...Q,...C?{"aria-required":"true"}:null,value:n.value&&!ke(String(n.value))?n.value:null,children:V})})};function Xt(t){return typeof t=="boolean"?t:typeof t=="string"?t==="true"?!0:t==="false"?!1:U().getState().values[t]:!!t}const es=t=>{const{className:e,error:s,title:r,extraHint:n,hint:a,options:l,onlyOptions:o=[],optionGroups:c,input:u,meta:d,disabled:m,readOnly:p,compact:x,multiSelect:b,forceSelect:v,emptyMessage:_,askToSelect:f,tooltip:g,oneLine:C,size:y,required:N,searchable:I,allowCreate:R,modal:P,entityName:B,onFocus:S,onBlur:k,placeholder:V,updateOnChange:W,onCreateOption:Y,hideTitleAndHint:Q,prefix:J}=t,z=(l==null?void 0:l.filter(w=>u.value&&u.value===w.value||!(o!=null&&o.length)||o.includes(w.value)))||[];let K={...d};if(v&&(!z||z.length===0||u.value==="")&&(K.error=_,K.touched=!0),P)return i.jsx(Qe,{className:e,disabled:m||p,hint:a,options:z,title:r,onChange:u.onChange,multiSelect:b,selected:u.value,forceSelect:v,askToSelect:f,tooltip:g,required:N,meta:K,entityName:B,missingDataNote:t.missingDataNote});if(c)return ss(t);if(I&&b){const w={},A=m||Xt(p!=="undefined"?p:m!=="undefined"?m:!1);if(t.highlightValue){const $=U().getState().values;if($){const G=$[t.highlightValue];w.highlightValue=G,w.highlightValuePrefix=t.highlightValuePrefix}}const q=z.length>100?n:void 0;return i.jsx(O,{className:e,error:s,meta:K,label:r,hint:a,extraHint:q,compact:x,oneLine:C,required:N,name:u.name,hideTitleAndHint:Q,prefix:J,children:i.jsx(Ae.Consumer,{children:L=>i.jsx(wt,{id:D(u.name),disabled:A,options:z,name:u.name,onChange:$=>{const G=$==null?void 0:$.filter(Ne=>Ne!==""&&Ne!==null);u.onChange(G)},multiSelect:b,emptyMessage:_,selected:u.value,forceSelect:v,askToSelect:f,tooltip:g,allowCreate:R,onCreateNew:Y||(()=>L.create(t)),onFocus:S,onBlur:k,placeholder:V,...w})})})}
32else return b&&!y?i.jsx(O,{className:e,error:s,meta:K,label:r,hint:a,compact:x,oneLine:C,required:N,hideTitleAndHint:Q,prefix:J,children:i.jsx(Ae.Consumer,{children:w=>i.jsx(Ge,{disabled:m||p,options:z,onChange:u.onChange,multiSelect:b,selected:u.value,forceSelect:v,askToSelect:f,tooltip:g,allowCreate:R,onCreateNew:()=>w.create(t)})})}):Jt(t)};function de({value:t,options:e,onlyOptions:s=[]}){return(e||[]).filter(r=>t===r.value||!s.length||s.includes(r.value)).map(r=>Array.isArray(r.value)?i.jsx("optgroup",{label:r.title,children:de(r.value)}):r.value===null?i.jsx("option",{disabled:!0,selected:!0,value:!0,children:`${r.title} ${r.url?`- ${r.url}`:""}`}):i.jsx("option",{value:r.value,children:`${r.title} ${r.url?`- ${r.url}`:""}`},r.value))}const ts=({fieldName:t,groupFilterValue:e,options:s})=>{const r=U(),n=j.useRef(e);return j.useEffect(()=>{var l,o;if(n.current!==e){const c=(s||[]).find(d=>String(d.value)===String(e)),u=(o=(l=c==null?void 0:c.options)==null?void 0:l[0])==null?void 0:o.value;r.change(t,u!==void 0?u:""),n.current=e}},[e]),null},ss=t=>{const{input:e,meta:s,title:r,hint:n,compact:a,disabled:l,oneLine:o,multiSelect:c,options:u,size:d,required:m,error:p,filterGroupByField:x,groupFilterValue:b}=t;let v,_=l;if(x)if(!b)v=[i.jsx("option",{value:"",children:"Select a carrier first"},"__filter_group_placeholder")],_=!0;else{const g=(u||[]).find(C=>String(C.value)===String(b));v=g?de({options:g.options}):[]}else v=u?u.map(g=>Array.isArray(g.options)?i.jsx("optgroup",{label:g.title,children:de({options:g.options})},g.title):i.jsx("option",{value:g.value,children:g.title},g.value)):[];const f={};return c&&(f.multiple="multiple"),i.jsxs(O,{error:p,meta:s,name:e.name,label:r,hint:n,compact:a,oneLine:o,required:m,children:[i.jsx("select",{id:D(e.name),className:"form-control select optional",disabled:_,...e,...f,size:c?d||15:1,...m?{"aria-required":"true"}:null,children:v}),x&&i.jsx(ts,{fieldName:e.name,groupFilterValue:b,options:u})]})},Xs=({input:t,meta:e,title:s,hint:r,compact:n,disabled:a,oneLine:l,required:o,error:c})=>i.jsx(O,{error:c,name:t.name,meta:e,label:s,hint:r,compact:n,oneLine:l,required:o,children:i.jsxs("select",{id:D(t.name),className:"form-control select optional",disabled:a,...t,...o?{"aria-required":"true"}:null,children:[i.jsx("option",{value:"true",children:"Yes"}),i.jsx("option",{value:"false",children:"No"})]})}),er=({input:t,title:e,disabled:s,className:r=null,required:n})=>i.jsx("div",{className:"checkbox"+(r?" "+r:""),children:i.jsxs("label",{className:`control-label optional ${Bt.checkboxLabel}`,children:[i.jsx("input",{className:"form-control optional",disabled:s,type:"checkbox",...t,...n?{"aria-required":"true"}:null})," ",i.jsx("div",{className:"toggle",children:e})]})}),tr=({input:t,meta:e,title:s,hint:r,compact:n,disabled:a,className:l,fullWidth:o,oneLine:c,required:u,readOnly:d,updateOnChange:m,tooltip:p,renderTitle:x,error:b,bold:v=!0})=>{const _=U(),f=D(t.name),g=x?x():s;return i.jsx(O,{error:b,meta:e,hint:r,compact:n,fullWidth:o,className:l,oneLine:c,required:u,removeFieldDiv:!0,children:i.jsxs("div",{className:"form-check",children:[i.jsx("input",{id:f,className:"form-check-input optional",disabled:a||d,type:"checkbox",...t,...u?{"aria-required":"true"}:null,onChange:C=>{if(m){const y=C.target.checked;y in m&&_.batch(()=>{for(const[N,I]of Object.entries(m[y]))_.change(N,I)})}return t.onChange(C)},title:p}),i.jsx("label",{className:E("form-check-label optional",{bold:v}),htmlFor:f,children:g})]})})},rs=t=>{const{input:e,title:s,disabled:r,labelClassName:n,required:a}=t,l=n||"control-label optional",o=D(e.name)+"-"+String(e.value).toLowerCase().replace(/[^\w]+/i,"-");return i.jsx(Dt,{className:l,labelFor:o,disabled:r,required:a,title:s,...e})},sr=t=>{const{title:e,input:s,meta:r,hint:n,unit:a,disabled:l,compact:o,oneLine:c,required:u,options:d}=t;return i.jsx(O,{rootClassName:"",labelClassName:"form-group-title",meta:r,name:s.name,label:e?`${e}:`:null,hint:n,compact:o,oneLine:c,required:u,children:i.jsx(Z,{unit:a,children:d.map(m=>rs({input:{...s,value:m.value,checked:s.value===m.value},title:m.title,disabled:l,required:u}))})})},rr=t=>{const{title:e,input:s,meta:r,hint:n,disabled:a,compact:l,fullWidth:o,className:c,oneLine:u,input:{type:d},readOnly:m,required:p,error:x}=t;let b=s.value;return b.indexOf("shq")===0&&(b=s.value.substr(3)),i.jsx(O,{error:x,name:s.name,meta:r,label:e,hint:n,compact:l,fullWidth:o,className:c,oneLine:u,required:p,children:i.jsx(Z,{unit:"shq",pullLeft:!0,children:i.jsx("input",{id:D(s.name),className:"form-control string optional",type:d||"text",disabled:a,readOnly:m,...s,value:b,...p?{"aria-required":"true"}:null})})})},ns=t=>{const{fieldProps:{options:e,meta:s,input:r,dataSourceIdField:n,dataSourceField:a}}=t,[l,o]=j.useState({values:{}}),c=U();return j.useEffect(()=>{const{values:u}=l;if(e&&n){const d=u[n];r.onChange(e[d])}else if(a&&!s.touched&&!s.visited&&!(u._created||u.id>0)){const d=u[a];d!==void 0&&c.change(r.name,d.replace(/\s/g,"_"))}else{const d=u[r.name];d!==void 0&&d.includes(" ")&&c.change(r.name,d.replace(/\s/g,"_"))}},[l]),i.jsx(nt,{onChange:u=>o(u)})},nr=t=>{const{title:e,hint:s,input:r,meta:n,compact:a,oneLine:l,dataSourceIdField:o,required:c,error:u}=t;let d={...n};const m={};return o&&(m.disabled="disabled"),i.jsxs(O,{error:u,meta:d,label:e,hint:s,name:r.name,compact:a,oneLine:l,required:c,children:[i.jsx("input",{type:"text",...r,value:r.value?r.value:"",className:"form-control string optional",id:D(r.
32name),...m,...c?{"aria-required":"true"}:null}),i.jsx(ns,{fieldProps:t})]})},ir=t=>{const{input:e,setValue:s}=t,r=U();return j.useEffect(()=>{r.change(e.name,s)},[]),i.jsx("input",{...pe(e),type:"hidden"})};function is(t){if(t.target&&t.target.nextSibling){const e=t.target.nextSibling.querySelector("input, select, textarea");e&&(e.tagName==="INPUT"&&e.type==="checkbox"?e.click():e.focus())}}function pe(t){return t.value||t.value===0?t:{...t,value:""}}function D(t){return"field-"+t}const te=F.div` 33 display: flex; 34 justify-content: center; 35 align-items: center; 36 margin-right: 12px; 37 background-color: ${({theme:t})=>t.colors.dkblue1}; 38 border: 1px solid rgba(0, 0, 0, 0.1); 39 border-radius: 6px; 40 41 i { 42 color: ${({theme:t})=>t.colors.white}; 43 font-size: 24px; 44 } 45`,se=F.span``,as=F.input` 46 width: 18px; 47 height: 18px; 48 accent-color: ${({theme:t})=>t.colors.dkblue1}; 49 cursor: pointer; 50 margin-right: 15px !important; 51`,ne=F.h4` 52 font-weight: 700; 53 line-height: 22px; 54 color: ${({theme:t})=>t.colors.grey3}; 55 margin: 0; 56 text-align: left; 57`,ls=F.h3` 58 font-weight: 700; 59 text-transform: uppercase; 60 font-size: 12px; 61 line-height: 26px; 62 margin: 0; 63 text-align: left; 64 color: ${({theme:t})=>t.colors.orange}; 65`,ce=F.p` 66 font-weight: 400; 67 line-height: 26px; 68 color: ${({theme:t})=>t.colors.greybluedk}; 69 margin: 0; 70 text-align: left; 71`,_e=F.p` 72 font-weight: 500; 73 line-height: 24px; 74 color: ${({theme:t})=>t.colors.dkblue2}; 75 margin: 0; 76 text-align: left; 77`,he=F.div` 78 display: flex; 79 align-items: center; 80 justify-content: space-between; 81 border: 1px solid rgba(0, 0, 0, 0.1); 82 margin: 1px; 83 padding: 12px; 84 color: ${({theme:t})=>t.colors.white}; 85 border-radius: 12px; 86 width: 100%; 87 transition: background-color 0.4s ease; 88 background-color: ${({theme:t})=>t.colors.white}; 89 90 &.checked { 91 border: ${({theme:t})=>`2px solid ${t.colors.dkblue1}`}; 92 margin: 0; 93 background-color: ${({theme:t})=>t.colors.white}; 94 } 95 96 &.hasCheckbox:hover { 97 border: ${({theme:t})=>`2px solid ${t.colors.dkblue1}`}; 98 margin: 0; 99 cursor: pointer; 100 } 101 102 ${se} { 103 margin-right: 10px; 104 105 i { 106 font-size: 14px; 107 color: ${({theme:t})=>t.colors.dkblue1}; 108 } 109 } 110 111 &.disabled { 112 &:hover { 113 background-color: ${({theme:t})=>t.colors.white}; 114 } 115 116 ${te} { 117 background-color: ${({theme:t})=>t.colors.greyb}; 118 } 119 120 ${ne} { 121 color: ${({theme:t})=>t.colors.greybluelt4}; 122 } 123 124 ${ce} { 125 color: ${({theme:t})=>t.colors.greybluelt4}; 126 } 127 } 128 129 &.mb-3 { 130 margin-bottom: 12px; 131 } 132 133 &.navigateble { 134 ${se} i { 135 font-size: 14px; 136 color: ${({theme:t})=>t.colors.dkblue1}; 137 } 138 } 139 140 &.clickable { 141 cursor: pointer; 142 143 &:hover { 144 background-color: ${({theme:t})=>t.colors.greyfa}; 145 } 146 } 147 148 &.warning { 149 ${se} i { 150 color: ${({theme:t})=>t.colors.yellowdk2}; 151 font-size: 24px; 152 } 153 } 154 155 &.success { 156 ${se} i { 157 color: ${({theme:t})=>t.colors.green1}; 158 font-size: 24px; 159 } 160 } 161 162 &.variantCarrier { 163 ${te} { 164 background-color: ${({theme:t})=>t.colors.white}; 165 166 & > div { 167 border-radius: 6px; 168 width: 100%; 169 height: 100%; 170 background-size: 70px !important; 171 background-repeat: no-repeat !important; 172 background-position: center center !important; 173 } 174 } 175 } 176 177 &.sizeSmall { 178 ${ne} { 179 font-size: 16px; 180 } 181 182 ${ce} { 183 font-size: 16px; 184 } 185 186 ${_e} { 187 font-size: 14px; 188 } 189 190 ${te} { 191 width: 56px; 192 height: 56px; 193 } 194 } 195 196 &.sizeMedium { 197 ${ne} { 198 font-size: 18px; 199 } 200 201 ${ce} { 202 font-size: 16px; 203 } 204 205 ${_e} { 206 font-size: 14px; 207 } 208 209 ${te} { 210 width: 72px; 211 height: 72px; 212 } 213 } 214`,os=F.div` 215 display: flex; 216 flex-direction: column; 217 218 & > label { 219 margin-bottom: 14px; 220 221 &:last-child { 222 margin-bottom: 0px; 223 } 224 } 225 226 input:checked ~ ${he} { 227 border: ${({theme:t})=>`2px solid ${t.colors.dkblue1}`}; 228 margin: 0; 229 background-color: ${({theme:t})=>t.colors.white}; 230 } 231 232 input[disabled] ~ ${he} { 233 cursor: auto; 234 235 ${ne} { 236 color: #bbbbbb; 237 } 238 239 i { 240 color: #bbbbbb; 241 } 242 } 243`,cs=F.div` 244 display: flex; 245 flex-direction: column; 246 padding: 20px; 247 background: ${({theme:t})=>t.colors.greenlt1}; 248 border: ${({theme:t})=>`1px solid ${t.colors.greenlt2}`}; 249 border-radius: 6px; 250 251 ${he} { 252 margin-bottom: 14px; 253 cursor: initial; 254 background: ${({theme:t})=>t.colors.white}; 255 256 &:last-child { 257 margin-bottom: 0px; 258 } 259 } 260`,T={InputLabels:os,SuccessCard:cs,Icon:te,SubIcon:se,Checkbox:as,Title:ne,RequiredTitle:ls,Note:ce,FieldDescription:_e,GoalItem:he},fe={usps:{title:"USPS®",note:"Online rates"},fedEx:{title:"FedEx",note:"List rates"},ups:{title:"UPS®",note:"Published daily rates"}},us={carrier:"variantCarrier"},ds={small:"sizeSmall",medium:"sizeMedium"},hs=t=>i.jsx("div",{...t}),Ye=({component:t,componentProps:e,title:s,note:r,logo:n,variant:a,size:l="medium",success:o=!1,warning:c=!1,checked:u=!1,showCheckbox:d=!1,navigateble:m=!1,disabled:p=!1,infoTooltip:x,onClick:b,className:v,isRequiredGoal:_})=>{const f=t||hs;return i.jsxs(T.GoalItem,{as:f,className:E(v,us[a],ds[l],{checked:u,success:o,warning:c,navigateble:m,disabled:p,clickable:!!b,hasCheckbox:d}),...e,onClick:b,children:[i.jsxs("div",{className:"flex",children:[d&&i.jsx(T.Checkbox,{type:"checkbox",checked:u,readOnly:!0}),i.jsx(T.Icon,{children:n}),i.jsxs("div",{children:[_&&i.jsx(T.RequiredTitle,{children:"Action required"}),i.jsx(T.Title,{children:s}),i.jsx(T.Note,{children:r})]})]}),i.jsx(fs,{success:o,warning:c,navigateble:m,infoTooltip:x})]})},fs=({success:t,warning:e,navigateble:s,infoTooltip:r})=>{const n=it();return t?i.jsx(T.SubIcon,{children:i.jsx("i",{className:"fas fa-check-circle"})}):e?i.jsx(T.SubIcon,{children:i.jsx("i",{className:"fas fa-circle-exclamation"})}):r?i.jsx(T.SubIcon,{ref:n.ref,"data-place":"top","data-tip":r,children:i.jsx("i",{className:"far fa-info-circle ",...n.props})}):s?i.jsx(T.SubIcon,{children:i.jsx("i",{className:"fa fa-arrow-right"})}):null},ar=({carrierType:t,success:e=null})=>{const s=Ue();return i.jsx(Ye,{success:e,variant:"carrier",title:fe[t].title,note:fe[t].note,logo:i.jsx("div",{style:Je(s,t)})})},lr=({carrierType:t,checked:e=!1})=>{const s=Ue();return i.jsx(Ye,{checked:e,showCheckbox:!0,variant:"carrier",title:fe[t].title,note:fe[t].note,logo:i.jsx("div",{style:Je(s,t)})})},Je=(t,e)=>({backgroundColor:"white",...Be(t,e).style,backgroundImage:`url(${t[e]})`});async function ps(t,e){var n,a;const r=(n=(await we.get(`/ratesmgr/integrations/tokens?website_id=${t}&integrations[integration_type]=${e}`)).data.tokens)==null?void 0:n.sort((l,o)=>new Date(l.createdAt).getTime()-new Date(o.createdAt).getTime());return(a=r==null?void 0:r[r.length-1])==null?void 0:a.token}function or({websiteId:t,integrationType:e}){const{data:s,isLoading:r}=He(["tokens",e,t],()=>ps(t,e));return{token:s,isGettingToken:r}}async function ms({websiteId:t,token:e}){return(await we.delete(`/ratesmgr/integrations/tokens?website_id=${t}&token=${e}`)).data}function cr(){const t=Ve(),{isLoading:e,mutate:s}=ze(r=>ms(r),{onSuccess:(r,n)=>{t.invalidateQueries("tokens"),t.invalidateQueries(n.websiteId.toString())}});return{deleteToken:s,isDeletingToken:e}}async function gs({websiteId:t,integrationType:e}){return(await we.post("/ratesmgr/integrations/tokens",{website_id:t,integrations:{integration_type:e}})).data.token}function ur(){const t=Ve(),{isLoading:e,data:s,mutate:r}=ze(gs,{onSuccess:(n,a)=>{t.invalidateQueries("tokens"),t.invalidateQueries(a.toString())}});return{token:s,create:r,isFetchingToken:e}}const Xe=(t,e={},s)=>({steps:t,currentState:s||t[0],currentStep:s||t[0],context:e,isDone:!1});
260class et extends ye.ImmerReducer{setCurrentStep(e){this._validateStep(e),this.draftState.currentStep=e}setCurrentState(e){this._validateStep(e),this.draftState.currentState=e}setContext(e){const s=typeof e=="function"?e(this.draftState.context):e;this.draftState.context=s}submitStep(e){const s=this.draftState.currentState,r=this.draftState.steps.indexOf(s),n=this.draftState.steps[r+1];n&&(this.setCurrentStep(n),this.setCurrentState(n)),e&&(this.draftState.context=e)}skipStep(e,s){this._validateStep(e);const r=this.draftState.steps.indexOf(e),n=this.draftState.steps[r+1];n&&(this.setCurrentStep(n),this.setCurrentState(n)),s&&(this.draftState.context=s)}resetState(e){this._validateStep(e),this.draftState.currentState=e,this.draftState.currentStep=e}reset(){this.draftState=Xe(this.draftState.steps)}setSteps(e){const s=[...this.draftState.steps],r=s.indexOf(this.draftState.currentStep),n=s.indexOf(this.draftState.currentState);e.includes(this.draftState.currentState)||(this.draftState.currentState=s[n-1]),e.includes(this.draftState.currentStep)||(this.draftState.currentStep=s[r-1]),this.draftState.steps=e}_validateStep(e){if(!this.draftState.steps.includes(e))throw`Unsupported step ${e}`}}const H=ye.createActionCreators(et),xs=ye.createReducerFunction(et),dr=({context:t,defaultContext:e,onCompleted:s,children:r,initialStep:n,steps:a})=>{const[l,o]=j.useReducer(xs,j.useMemo(()=>Xe(a,e,n),[a,e])),c={state:l,dispatch:o,onCompleted:s};return i.jsx(t.Provider,{value:c,children:r})},hr=({context:t})=>{const{state:e,onCompleted:s,dispatch:r}=M.useContext(t),{steps:n,currentState:a,currentStep:l,context:o,isDone:c}=e,u=n[n.indexOf(l)-1],d=n[n.indexOf(l)+1],m=S=>{r(H.setSteps(S))},p=S=>{r(H.setCurrentStep(S))},x=S=>{r(H.setCurrentState(S))},b=S=>{r(H.setContext(S))},v=S=>{r(H.setContext(k=>({...k,...S})))},_=S=>{r(H.resetState(S))},f=()=>{r(H.reset())},g=S=>{d?r(H.submitStep(S)):s(S||o)},C=(S,k=null)=>{if(!n.includes(S))throw`Unsupported step ${S}`;n[n.indexOf(S)+1]?r(H.skipStep(S,k)):s(k||o)},y=(S=null)=>{C(l,S)},N=S=>{const k=n.indexOf(S),V=n.indexOf(a),W=[...n.slice(0,V),a];return k===0||W.includes(S)},I=(S=null)=>{a!==l?P():g(S)},R=N(u)?()=>p(u):null,P=N(d)?()=>p(d):null,B={currentStep:n.indexOf(l)+1,totalCount:n.length};return{state:e,steps:n,dispatch:r,resetState:_,reset:f,setCurrentState:x,setCurrentStep:p,prevStep:R,nextStep:P,skipStep:C,skipCurrentStep:y,setContext:b,addToContext:v,context:o,submitStep:I,setStep:p,currentStep:l,currentState:a,isDone:c,pagination:B,setSteps:m}},Ss=F.h2` 261 text-align: center; 262 font-weight: 400; 263 font-size: 24px; 264 margin-bottom: 15px !important; 265`,fr=F.h2` 266 display: flex; 267 gap: 4px; 268 font-weight: 700; 269 font-size: ${({theme:t})=>t.fontSizes.medium}; 270`;F.span` 271 color: ${({theme:t})=>t.colors.shqred3}; 272`;const bs=F.h5` 273 text-align: center; 274 line-height: 26px; 275 font-size: 16px; 276 margin-bottom: 32px; 277 278 &.transparent { 279 background: transparent; 280 } 281 282 &.left { 283 text-align: left; 284 } 285 286 &.small { 287 font-size: 14px; 288 line-height: 26px; 289 margin-bottom: 24px; 290 font-weight: 400; 291 292 label { 293 font-size: 14px; 294 line-height: 26px; 295 margin-bottom: 24px; 296 font-weight: 400; 297 } 298 } 299`,js=F.h4` 300 text-align: center; 301 font-weight: 600; 302 font-size: 18px; 303 margin-bottom: 15px; 304`,pr=({children:t,title:e,hint:s,subTitle:r})=>i.jsxs("div",{children:[e&&i.jsx(Ss,{children:e}),s&&i.jsx(bs,{children:s}),r&&i.jsx(js,{children:r}),t]});function vs(){const[t,e]=j.useState(window.Routes);return j.useEffect(()=>{e(window.Routes)},[window.Routes]),t}const _s={id:"enterprise",display_name:"Enterprise",name:"enterprise",cost:"none",price:"none",currency_code:"none",billing_frequency:"none",description:"Let us be your shipping experts. Get access to all ShipperHQ carriers and features, plus dedicated support to help tackle challenging shipping requirements.",limits:[],services:["unlimited_features_access","dedicated_account_manager","configuration_service","strategic_consulting","dedicated_support"],available_features:[],not_available_features:[]},ys=({name:t})=>ot.get(`/ratesmgr/billing/show_plan_details?plan_name=${t}`).then(({data:e})=>e),Pe=({name:t})=>{const e=()=>t?t==="enterprise"?_s:ys({name:t}):{},{data:s,...r}=He(["plan_billing",t],e);return{planBilling:s,...r}},ws={basic_support:"AI-powered Support",phone_support:"AI-powered + Phone Support",priority_support:"Priority support",configuration_assistance:"Configuration assistance",unlimited_features_access:"Custom feature limit",dedicated_account_manager:"Dedicated support",configuration_service:"Account setup and configuration services",strategic_consulting:"Access to our Customer Success Team"},Cs={basic_support:"fa-comment-alt",phone_support:"fa-comment-alt-plus",priority_support:"fa-user-headset",configuration_assistance:"fa-tools",unlimited_features_access:"fa-infinity",dedicated_account_manager:"fa-user-check",configuration_service:"fa-tools",strategic_consulting:"fa-bullseye-arrow"},Me=({planBilling:t,upgrade:e})=>{const s=t.name==="enterprise";return i.jsxs("div",{className:E("plan-card",{enterprise:s}),children:[i.jsx("div",{className:E("plan-card__nav-header",{upgrade:e}),children:e?"Upgrade to:":"Current plan:"}),i.jsx("div",{className:"plan-card__content",children:i.jsxs("div",{className:"plan-card__header",children:[i.jsx("div",{className:"plan-card__title",children:i.jsx("h3",{children:i.jsx("strong",{children:t.display_name})})}),s?i.jsx(i.Fragment,{children:i.jsx("div",{className:"plan-card__contact_us",children:"Contact us for pricing"})}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"plan-card__price",children:`${t.currency_code}${t.price}/mo`}),parseInt(t.price)!==0&&i.jsx("div",{className:"plan-card__note",children:`billed ${t.billing_frequency}`})]})]})}),t.description&&i.jsx("div",{className:"plan-card__description",children:t.description}),i.jsx("ul",{className:"plan-card__limits",children:t.limits.map((r,n)=>i.jsxs("li",{children:[i.jsx("strong",{children:r.max_allowed}
304),"Â ",r.title,r.limits_exceeded&&i.jsx("i",{"data-testid":`limits-${t.name}-${r.id}`,className:"fas fa-triangle-exclamation danger ml-1"})]},`limit-${n}`))}),i.jsxs("ul",{className:"plan-card__services",children:[t.services.map((r,n)=>i.jsxs("li",{children:[i.jsx("i",{className:`fas ${Cs[r]}`}),ws[r]]},`feature-${n}`)),s?i.jsx(i.Fragment,{}):t.not_available_features.length>0?i.jsxs("li",{children:[i.jsx("i",{className:"fas fa-lock"}),"Restricted Feature Access"]}):i.jsxs("li",{children:[i.jsx("i",{className:"fas fa-unlock"}),"Access to All Features"]}),t.not_available_features.map(r=>i.jsxs("li",{className:"disabled",children:[i.jsx("i",{className:"far fa-times"}),r]},`notAvailable-${r}`)),t.available_features.map(r=>i.jsxs("li",{children:[i.jsx("i",{className:"far fa-check"}),r]},`available-${r}`))]})]})},Ns="compare-plans",mr=({currentPlan:t,upgradePlan:e,open:s,onClose:r,onUpgrade:n})=>{const a=vs(),{planBilling:l}=Pe({name:t}),{planBilling:o}=Pe({name:e}),{currentUser:c={},marketing_site_url:u}=Ce(({app:{current_user:p,marketing_site_url:x}})=>({currentUser:p,marketing_site_url:x})),d=a.edit_ratesmgr_profile_path(c.id,{section:"pricing_plans"});if(!s||!(l!=null&&l.id)||!(o!=null&&o.id))return null;const m=p=>{p.preventDefault(),p.stopPropagation(),n(o)};return i.jsxs(Te,{title:i.jsx("strong",{children:"Upgrade to activate this feature"}),onClose:r,modalName:Ns,children:[i.jsxs("div",{className:"plan-compare-cards",children:[i.jsx(Me,{planBilling:l}),i.jsx(Me,{planBilling:o,upgrade:!0})]}),i.jsxs("div",{className:"plan-compare-actions",children:[o.name==="enterprise"?i.jsx("a",{className:"btn btn-primary",href:`${u}/enterprise-contact`,target:"_blank",children:"Speak to an Expert"}):i.jsx("button",{"data-testid":"confirmUpgradePlan",className:"btn btn-primary",onClick:m,children:"Upgrade Plan"}),i.jsx("a",{className:"primary-link-lg",href:d,children:"See all plans"})]})]})};export{Ns as $,ae as A,Ie as B,lr as C,pt as D,Nt as E,O as F,Ct as G,Qe as H,mr as I,Gs as J,Js as K,Hs as L,dt as M,rr as N,nr as O,sr as P,Xs as Q,Dt as R,Ye as S,Ys as T,Zs as U,ir as V,dr as W,Ss as X,bs as Y,vs as Z,Je as _,Bs as a,Wt as a0,zs as a1,Vs as a2,Ms as a3,ft as a4,Se as a5,Ts as a6,Ht as a7,Ae as a8,Oe as a9,wt as aa,ar as ab,Ks as b,tr as c,Jt as d,rs as e,Gt as f,er as g,D as h,Et as i,T as j,or as k,Be as l,ur as m,cr as n,hr as o,es as p,Qs as q,Ws as r,qe as s,Us as t,Ue as u,fr as v,pr as w,De as x,re as y,ee as z}; 305//# sourceMappingURL=ComparePlanModal-06e18f4b.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.