@freightos/fusion-location-input 2.2.0-fds → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/asset-manifest.json +3 -1
- package/build/index.html +1 -1
- package/build/main.bundle.js +150 -2
- package/build/main.bundle.js.map +1 -1
- package/build/precache-manifest.4034cb7dfab33db082e1ebb1efc8d639.js +10 -0
- package/build/service-worker.js +39 -0
- package/package.json +1 -1
- package/build/main.bundle.js.LICENSE.txt +0 -14
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.js": "/main.bundle.js",
|
|
4
|
+
"main.js.map": "/main.bundle.js.map",
|
|
4
5
|
"index.html": "/index.html",
|
|
5
|
-
"
|
|
6
|
+
"precache-manifest.4034cb7dfab33db082e1ebb1efc8d639.js": "/precache-manifest.4034cb7dfab33db082e1ebb1efc8d639.js",
|
|
7
|
+
"service-worker.js": "/service-worker.js"
|
|
6
8
|
},
|
|
7
9
|
"entrypoints": [
|
|
8
10
|
"main.bundle.js"
|
package/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Fusion location input</title><script
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Fusion location input</title></head></html><script src="http://ship.freightos.local:8800/FusionLocationInput/main.bundle.js"></script>
|
package/build/main.bundle.js
CHANGED
|
@@ -1,3 +1,151 @@
|
|
|
1
|
-
|
|
2
|
-
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("@freightos/design-system"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash"),require("react"),require("styled-components")):"function"===typeof define&&define.amd?define("FusionLocationInput",["@freightos/design-system","@freightos/freightos-i18n","@freightos/http-client","lodash","react","styled-components"],e):"object"===typeof exports?exports.FusionLocationInput=e(require("@freightos/design-system"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash"),require("react"),require("styled-components")):t.FusionLocationInput=e(t["@freightos/design-system"],t["@freightos/freightos-i18n"],t["@freightos/http-client"],t.lodash,t.react,t["styled-components"])}(self,(t,e,n,o,r,i)=>(()=>{"use strict";var a={2(t){t.exports=n},45(t,e,n){n.d(e,{A:()=>r});var o=n(587);function r(t,e){if(null==t)return{};var n,r,i=(0,o.A)(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},79(t,e,n){n.d(e,{Et:()=>f,LB:()=>v,Sd:()=>g,V5:()=>h,jl:()=>S,tk:()=>y});var o,r,i,a,s,l,c,d=n(528),u=n(186),p=n(694),m=n.n(p);const f=(0,p.createGlobalStyle)(o||(o=(0,d.A)(["\n .ant-select-dropdown {\n .ant-select-dropdown-menu {\n max-height: 400px;\n padding: 0 !important;\n margin-top: 0 !important;\n }\n }\n"]))),h=m()(u.Select)(r||(r=(0,d.A)(["\n\t.ant-select-selection__rendered {\n\t\tmin-width: 100% !important;\n\t}\n\n\tli.ant-select-selection__choice {\n\t\tborder-radius: ",";\n\t\tborder: none;\n\t\tborder-color: ",";\n\t\tcolor: ",";\n\t\tbackground-color: ",";\n\t\tline-height: 10px !important;\n\t\tmargin-right: ",";\n\t\twidth: fit-content;\n\t\tmax-width: 90px;\n\t\theight: "," !important;\n\t\t","\n\n\t\t.ant-select-selection__choice__remove {\n\t\t\tcolor: ",";\n\t\t\tmargin-top: "," !important;\n\t\t}\n\n\t\t.ant-select-selection__choice__content {\n\t\t\tline-height: "," !important;\n\t\t\theight: "," !important;\n\t\t}\n\t}\n\n\tli.ant-select-selection__choice__disabled {\n\t\tborder: none;\n\t\tbackground-color: transparent;\n\t\tpadding: 0;\n\t\tpadding-left: 0;\n\t\twidth: fit-content;\n\t}\n\n\t.ant-select-dropdown .ant-select-not-found {\n\t\tcursor: pointer !important;\n\t}\n\n\t.ant-select-selection-selected-value {\n\t\tmax-width: 280px !important;\n\t}\n\n\tli.ant-select-search.ant-select-search--inline {\n\t\tmargin-left: -1px !important;\n\t}\n\t.ant-select-search__field {\n\t\tcolor: "," !important;\n\t}\n\t","\n"])),u.tokens.fdsBorderRadiusXl,u.tokens.fdsColorPrimaryBlue,u.tokens.fdsColorPrimaryBlue,u.tokens.fdsColorPrimaryBlue10,u.tokens.fdsComponentSpacingXxs,u.tokens.fdsSizeMd,t=>{let{size:e}=t;return"large"===e?"\n\t\t\tmargin-top: ".concat(u.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"},u.tokens.fdsColorPrimaryBlue,u.tokens.fdsComponentSpacingXs,u.tokens.fdsSizeMd,u.tokens.fdsSizeMd,u.tokens.fdsColorPrimaryGray80,t=>{let{$hasError:e}=t;return e&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(u.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(u.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(u.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(u.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")}),y=m().span(i||(i=(0,d.A)(["\n\tfont-size: "," !important;\n"])),u.tokens.fdsFontSizeSm),g=m().div(a||(a=(0,d.A)(["\n\tfont-size: "," !important;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 2;\n\t-webkit-box-orient: vertical;\n"])),u.tokens.fdsFontSizeSm),S=m()(u.Menu)(s||(s=(0,d.A)(["\n\tcursor: pointer !important;\n\n\t.ant-menu-item-group-title {\n\t\tpadding: 0;\n\t\tcolor: ",";\n\t}\n\n\t.ant-menu-item {\n\t\tpadding: 0;\n\t\twhite-space: normal;\n\t\tline-height: normal;\n\n\t\t&:hover {\n\t\t\tbackground-color: #f5f5f5;\n\t\t}\n\t}\n"])),u.tokens.fdsBodyTextColorDisabled),v=m().div(l||(l=(0,d.A)(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),u.tokens.fdsFontSizeSm,u.tokens.fdsSizeSm,u.tokens.fdsHeadingsFontFamily);m()(u.Icon)(c||(c=(0,d.A)(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"])))},104(t,e,n){n.d(e,{z:()=>i});var o=n(751),r=n(916);const i=async t=>{await(0,o.p)({method:"put",url:"".concat(r.E2,"/backend/api.php"),options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:t}})}},123(t){var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(r){return!1}}()?Object.assign:function(t,r){for(var i,a,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l<arguments.length;l++){for(var c in i=Object(arguments[l]))n.call(i,c)&&(s[c]=i[c]);if(e){a=e(i);for(var d=0;d<a.length;d++)o.call(i,a[d])&&(s[a[d]]=i[a[d]])}}return s}},147(t,e,n){n.d(e,{A:()=>p});var o=n(155),r=n(186),i=n(817),a=n(591),s=n(916),l=n(414),c=n(672),d=n(176),u=n(579);const p=t=>{var e,n,p;let{search:m,index:f,dataTestId:h}=t;const y=m.platform_type,g=(0,c.Yy)(m),{units:S,volume:v,weight:T,weightUnit:E,volumeUnit:A}=(0,o.useMemo)(()=>(0,c.VH)(m),[m]),O=1===m.commodity.length&&m.commodity[0].is_temperature,L=null!==(e=m.commodity_temperature)&&void 0!==e&&e.tempRange&&O?s.FW[null===(n=m.commodity_temperature)||void 0===n?void 0:n.tempRange][null===(p=m.commodity_temperature)||void 0===p?void 0:p.temperatureSystem]:"";return(0,u.jsx)(i.A,{spacing:a.o.XSMALL,alignItems:"center",fullWidth:!0,children:y===s.MM.QUOTATION?(0,u.jsxs)(l.XY,{alignItems:"center",spacing:a.o.SMALL,style:{flex:1},children:[g.map((t,e)=>(0,u.jsx)(l.q7,{type:t,size:"tiny","data-test-id":"".concat(h,"rs-package-icon-").concat(f,"-").concat(e)},"".concat(f,"-").concat(e))),(0,u.jsx)(d.A,{text:m.commodity.map(t=>t.label).join(", "),testId:"".concat(h,"rs-commodity-").concat(f)})]}):(0,u.jsxs)(l.XY,{alignItems:"center",spacing:a.o.SMALL,children:[(0,u.jsxs)(i.A,{alignItems:"center",spacing:a.o.XSMALL,"data-test-id":"rs-".concat(f,"-units"),children:[S,"\xa0",g.map((t,e)=>(0,u.jsx)(l.q7,{type:t,size:"tiny","data-test-id":"".concat(h,"rs-package-icon-").concat(f,"-").concat(e)},"".concat(f,"-").concat(e)))]}),(0,u.jsxs)("span",{"data-test-id":"".concat(h,"rs-volume-").concat(f),children:[v,"\xa0",A]}),T&&(0,u.jsxs)("span",{"data-test-id":"".concat(h,"rs-weight-").concat(f),children:[T,"\xa0",E]}),(0,u.jsx)(d.A,{text:m.commodity.map(t=>t.label).join(", "),testId:"".concat(h,"rs-commodity-").concat(f)}),O&&(0,u.jsxs)(i.A,{alignItems:"center",spacing:a.o.XSMALL,"data-test-id":"".concat(h,"rs-temperature-").concat(f),children:[(0,u.jsx)(r.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(h,"rs-temperature-icon-").concat(f)}),(0,u.jsx)("span",{style:{whiteSpace:"nowrap"},children:L})]})]})},f)}},153(t,e,n){n(123);var o=n(155),r=60103;if(e.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var i=Symbol.for;r=i("react.element"),e.Fragment=i("react.fragment")}var a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,n){var o,i={},c=null,d=null;for(o in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(d=e.ref),e)s.call(e,o)&&!l.hasOwnProperty(o)&&(i[o]=e[o]);if(t&&t.defaultProps)for(o in e=t.defaultProps)void 0===i[o]&&(i[o]=e[o]);return{$$typeof:r,type:t,key:c,ref:d,props:i,_owner:a.current}}e.jsx=c,e.jsxs=c},155(t){t.exports=r},176(t,e,n){n.d(e,{A:()=>s});var o=n(155),r=n(186),i=n(414),a=n(579);const s=t=>{let{text:e="",testId:n,isPort:s,isLocationLabel:l=!1,children:c=null}=t;const d=(0,o.useRef)(null),[u,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>{(()=>{if(d.current){const t=d.current,e=t.scrollWidth>t.clientWidth;p(e)}})()},[e]);const m=(0,a.jsx)(i.CJ,{ref:d,"data-test-id":n,$isLocationLabel:l,$isPort:s,children:c||e});return u?(0,a.jsx)(r.Tooltip,{title:e,"data-test-id":"".concat(n,"-tooltip"),children:(0,a.jsx)(i.CJ,{ref:d,"data-test-id":n,$isLocationLabel:l,$isPort:s,children:c||e})}):m}},186(e){e.exports=t},198(t){t.exports=e},284(t,e,n){function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}n.d(e,{A:()=>o})},302(t,e,n){n.d(e,{A:()=>a});n(155);var o=n(186),r=n(79),i=n(579);const a=t=>{let{omittedPorts:e,dataTestId:n}=t;const a=e.map(t=>{var e;return null===(e=JSON.parse(t.key))||void 0===e?void 0:e.selectedValue});return(0,i.jsx)(o.Tooltip,{title:a.join(","),children:(0,i.jsx)(r.tk,{"data-test-id":"".concat(n,"-extra-ports"),children:"+".concat(e.length)})})}},324(t,e,n){n.d(e,{$C:()=>s,DS:()=>c,GB:()=>l,Ot:()=>o,Xf:()=>r,au:()=>i,nE:()=>a});const o="",r={AIRPORT:"airport",SEAPORT:"seaport",FULFILLMENT_CENTER:"fulfillment_center",ADDRESS_BOOK:"address_book",LAST_MILE_ADDRESS:"last_mile_address",ADDRESS:"address"},i={[r.AIRPORT]:{label:"Airports",key:r.AIRPORT,icon:"mode-air"},[r.SEAPORT]:{label:"Ports",key:r.SEAPORT,icon:"mode-ship"},[r.FULFILLMENT_CENTER]:{label:"Fulfillment centers",key:r.FULFILLMENT_CENTER,icon:"fulfillment-center"},[r.ADDRESS_BOOK]:{key:r.ADDRESS_BOOK,groupedBy:"address"},[r.LAST_MILE_ADDRESS]:{key:r.LAST_MILE_ADDRESS,groupedBy:"address"},[r.ADDRESS]:{label:"Address",key:r.ADDRESS,icon:"location"}},a={SINGLE:"single",MULTIPLE:"multiple"},s={ORIGIN:"origin",DESTINATION:"destination"},l=3,c=2},327(t,e,n){n.d(e,{A:()=>r});var o=n(284);function r(t,e){if("object"!=(0,o.A)(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=(0,o.A)(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}},379(t,e,n){n.d(e,{A:()=>i});var o=n(467);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach(function(e){(0,o.A)(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}},403(t,e,n){n.d(e,{A:()=>l});n(155);var o=n(186),r=n(198),i=n(79),a=n(519),s=n(579);const l=t=>{let{isLoading:e,recentSearches:n,searchKey:l,dataTestId:c,setIsOpen:d,onRecentSearchSelect:u,initialValues:p}=t;return l||n&&0!==n.length?e?(0,s.jsx)(o.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!l.trim()?(0,s.jsx)(a.A,{recentSearches:n,dataTestId:c,setIsOpen:d,onRecentSearchSelect:u,initialValues:p}):l.trim()?(0,s.jsx)(i.LB,{children:(0,s.jsx)(r.TranslatableText,{stringId:"No matching results",module:r.TRANSLATION_MODULES.SearchAndBook})}):null:null}},414(t,e,n){n.d(e,{CJ:()=>S,H4:()=>v,XY:()=>T,li:()=>E,q7:()=>g,sj:()=>y,uS:()=>h});var o,r,i,a,s,l,c,d=n(528),u=n(186),p=n(694),m=n.n(p),f=n(817);const h=m().div(o||(o=(0,d.A)(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),u.tokens.fdsColorPrimaryGray60,u.tokens.fdsSizeXs,u.tokens.fdsFontWeightRegular,u.tokens.fdsComponentSpacingSm,u.tokens.fdsComponentSpacingSm),y=m()(f.A)(r||(r=(0,d.A)(["\n\tpadding-left: 0 !important;\n"]))),g=m()(u.Icon)(i||(i=(0,d.A)(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),S=m().span(a||(a=(0,d.A)(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),u.tokens.fdsColorPrimaryGray80,t=>{let{$isLocationLabel:e}=t;return!e&&"\n\t\tfont-size: 10px; //TODO: FSN-145\n\t\tline-height: 15px;\n\t"},t=>{let{$isPort:e}=t;if(void 0!==e)return"min-width: ".concat(e?"65px":"55px",";")}),v=m()(u.Avatar)(s||(s=(0,d.A)(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),u.tokens.fdsColorPrimaryGray20,u.tokens.fdsSizeSm,u.tokens.fdsSizeSm),T=m()(f.A)(l||(l=(0,d.A)(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),E=m()(f.A)(c||(c=(0,d.A)(["\n\t:last-child {\n\t\tpadding-bottom: 0 !important;\n\t}\n"])))},467(t,e,n){n.d(e,{A:()=>r});var o=n(922);function r(t,e,n){return(e=(0,o.A)(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},519(t,e,n){n.d(e,{A:()=>u});n(155);var o=n(186),r=n(198),i=n(591),a=n(79),s=n(757),l=n(598),c=n(414),d=n(579);const u=t=>{let{recentSearches:e,setIsOpen:n,dataTestId:u,onRecentSearchSelect:p,initialValues:m}=t;const f=e?(0,s.CK)(e):[];return(0,d.jsxs)(a.jl,{children:[(0,d.jsxs)(c.uS,{children:[(0,d.jsx)(o.Icon,{"data-test-id":"".concat(u,"rs-icon"),color:o.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),(0,d.jsx)(r.TranslatableText,{stringId:"Recent searches"})]}),(0,d.jsx)(c.li,{direction:i.I.VERTICAL,fullWidth:!0,children:f.map((t,e)=>(0,d.jsx)(l.Z,{onRecentSearchSelect:p,initialValues:m,search:t,index:e,setIsOpen:n,dataTestId:u},t.id))})]})}},528(t,e,n){function o(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}n.d(e,{A:()=>o})},579(t,e,n){t.exports=n(153)},587(t,e,n){function o(t,e){if(null==t)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(-1!==e.indexOf(o))continue;n[o]=t[o]}return n}n.d(e,{A:()=>o})},591(t,e,n){n.d(e,{I:()=>i,o:()=>r});var o=n(186);const r={XXLARGE:o.tokens.fdsComponentSpacingXxl,XLARGE:o.tokens.fdsComponentSpacingXl,LARGE:o.tokens.fdsComponentSpacingLg,MEDIUM:o.tokens.fdsComponentSpacingMd,SMALL:o.tokens.fdsComponentSpacingSm,XSMALL:o.tokens.fdsComponentSpacingXs,XXSMALL:o.tokens.fdsComponentSpacingXxs,NONE:0},i={VERTICAL:"vertical",HORIZONTAL:"horizontal"}},595(t,e,n){n.d(e,{MN:()=>E,Sn:()=>b,dK:()=>w,hy:()=>h,jj:()=>A,mG:()=>L,nq:()=>j,vJ:()=>T,zU:()=>y});var o=n(45),r=n(379),i=(n(155),n(186)),a=n(198),s=n(817),l=n(591),c=n(961),d=n(324),u=n(79),p=n(579);const m=["address"],f=t=>(t||"").trim().toUpperCase(),h=t=>{const e=(t=>{try{return"string"===typeof t?JSON.parse(t):null}catch(e){return null}})(null===t||void 0===t?void 0:t.key);return f((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))},y=t=>new Set((t||[]).map(t=>f((null===t||void 0===t?void 0:t.code)||(null===t||void 0===t?void 0:t.selectedValue)))),g=t=>{const e=[];JSON.stringify(t,(t,n)=>(e.push(t),n));const n=Array.from(new Set(e)).sort();return JSON.stringify(t,n)},S=t=>{const{displayLabel:e,selectedValue:n,formattedNameOrAddress:o,code:r,countryCode:i,stateOrProvince:a,city:s,latitude:l,longitude:c,postalOrZipCode:d,sourceType:u,locationType:p,type:m,countryName:f}=t||{};return{displayLabel:e,selectedValue:n||r,formattedNameOrAddress:o,code:r||n,country:i,countryName:f,stateOrProvince:null!==a&&void 0!==a?a:null,city:null!==s&&void 0!==s?s:null,latitude:null!==l&&void 0!==l?l:null,longitude:null!==c&&void 0!==c?c:null,postalOrZipCode:null!==d&&void 0!==d?d:null,sourceType:null!==u&&void 0!==u?u:null,locationType:null!==p&&void 0!==p?p:null,type:null!==m&&void 0!==m?m:u}},v=t=>{try{const e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(I(t.key)):t;return g(S(e))}catch(e){return g(S(t))}},T=t=>{const e=t=>(t=>{if(t){var e;const n=t.label||t.selectedValue;return{key:v(t),label:n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Icon,{type:t.sourceType?null===(e=d.au[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",(0,p.jsx)(u.tk,{children:n})]}):void 0}}})(t);return Array.isArray(t)?t.map(e):e(t)},E=(t,e)=>{if((t||[]).some(t=>{var e;return(null===t||void 0===t||null===(e=t.options)||void 0===e?void 0:e.length)>0}))return t.map(t=>{var n;const o=Object.values(d.au).find(e=>e.label===t.label),r=null===o||void 0===o?void 0:o.icon;return(0,p.jsx)(i.Select.OptGroup,{label:(0,p.jsxs)("span",{style:{fontFamily:"Open Sans"},children:[(0,p.jsx)(i.Icon,{size:"tiny",type:r}),"\xa0 \xa0",t.label]}),"data-test-id":"".concat(e,"-group-").concat(t.label),children:null===(n=t.options)||void 0===n?void 0:n.map(n=>{const{countryCode:o,selectedValue:a,displayLabel:c,type:m}=n;return(0,p.jsx)(i.Option,{value:v(n),title:a,"data-test-id":"".concat(e,"-").concat(t.label,"-").concat(a),style:{paddingLeft:"8px"},label:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Icon,{type:r,size:"tiny"}),"\xa0",(0,p.jsx)(u.tk,{children:a})]}),children:(0,p.jsxs)(s.A,{fullWidth:!0,justifyContent:"space-between",children:[(0,p.jsxs)(s.A,{spacing:l.o.XSMALL,children:[(0,p.jsx)("span",{children:(0,p.jsx)(i.Avatar,{type:"flag",country:o,size:"small",style:{width:i.tokens.fdsSizeSm,height:i.tokens.fdsSizeSm}})}),(0,p.jsx)(u.Sd,{children:c})]}),m===d.Xf.FULFILLMENT_CENTER&&(0,p.jsx)(i.Icon,{type:"amazon",size:"small"}),m===d.Xf.ADDRESS_BOOK&&(0,p.jsx)(i.Chip,{type:"neutral",iconType:"address-book"})]})},n.code)})},t.label)})},A=(t,e,n)=>async i=>{if(!i)return[];const a=t!==d.Ot?[t]:e;let s=(await(0,c.V)(a,i,n)).results;return s[d.Xf.ADDRESS]&&(s=(t=>{let e=(0,r.A)({},t);const n=t[d.Xf.ADDRESS].filter(t=>t.sourceType===d.Xf.FULFILLMENT_CENTER);if(n.length>0){const{address:t}=e,i=(0,o.A)(e,m);e=(0,r.A)((0,r.A)({},i),{},{[d.Xf.FULFILLMENT_CENTER]:n,address:t.filter(t=>t.type!==d.Xf.FULFILLMENT_CENTER)})}return e})(s)),Object.keys(s).map(t=>{var e;return{label:(null===(e=d.au[t])||void 0===e?void 0:e.label)||t,options:s[t].map(t=>(0,r.A)((0,r.A)({},t),{},{type:t.sourceType}))}})},O=async(t,e)=>{const n=Array.isArray(t)?t:[t];e((await Promise.all(n.map(async t=>{try{const e=null===t||void 0===t?void 0:t.key,n=I(e),o=JSON.parse(n);return(0,r.A)({key:n},o)}catch(e){return}}))).filter(Boolean))},L=(t,e,n,o,r)=>{if(e===d.nE.MULTIPLE){const e=Array.isArray(t)?t:[];if(e.length<=n)o(e),O(e,r);else{var s,l;const t=(null===(s=JSON.parse(null===(l=e[0])||void 0===l?void 0:l.key))||void 0===s?void 0:s.sourceType)===d.Xf.AIRPORT?n>1?"airports":"airport":n>1?"ports":"port";i.Message.danger((0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(a.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",(0,p.jsx)(a.TranslatableText,{stringId:t})]}))}}else o(t),O(t,r)},b=t=>t&&(t===d.Xf.ADDRESS||t===d.Xf.LAST_MILE_ADDRESS||t===d.Xf.ADDRESS_BOOK||t===d.Xf.FULFILLMENT_CENTER),I=t=>"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t,_=/^[^-]*-\s*(.+?),/,C=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=(t,e)=>[...t[d.Xf.ADDRESS]||[],...t[d.Xf.FULFILLMENT_CENTER]||[]].filter(t=>((t,e)=>{if(!t.displayLabel)return!1;const n=t.displayLabel.match(_);if(null===n||void 0===n||!n[1])return!1;const o=n[1].trim(),r=e.trim().split(/\s+/).map(C);return new RegExp("\\b".concat(r.join("\\s+"),"\\b"),"i").test(o)})(t,e)),j=t=>!!t&&(Array.isArray(t)?t.length>0:Object.keys(t).length>0),w=async t=>{let{autofillLocationAddress:e,autofillLocationCode:n,supportedLocationModes:o,customer:i,userCountryCode:a}=t;if(!e&&!n)return null;let s=null;if(e){const{results:t={}}=await(0,c.V)(o,e,i);s=((t,e)=>0===t.length?null:1!==t.length&&e&&t.find(t=>{var n;return(null===(n=t.countryCode)||void 0===n?void 0:n.toLowerCase())===e.toLowerCase()})||t[0])(x(t,e),a)}if(!s&&n){const{results:t={}}=await(0,c.V)(o,n,i);s=((t,e)=>{const n=t[d.Xf.AIRPORT]||[],o=t[d.Xf.SEAPORT]||[],r=f(e);return[...n,...o].find(t=>f(null===t||void 0===t?void 0:t.code)===r)})(t,n)}return s?(t=>{const e=t.selectedValue||t.displayLabel||t.code,n=(0,r.A)((0,r.A)({},t),{},{selectedValue:e,displayLabel:t.displayLabel||e,country:t.countryCode||t.country,type:t.type||t.sourceType});return n.country&&delete n.countryCode,{key:JSON.stringify(n),label:e}})(s):null}},598(t,e,n){n.d(e,{Z:()=>d});n(155);var o=n(186),r=n(591),i=n(104),a=n(414),s=n(663),l=n(147),c=n(579);const d=t=>{let{search:e,index:n,setIsOpen:d,dataTestId:u,onRecentSearchSelect:p}=t;return(0,c.jsxs)(a.sj,{direction:r.I.VERTICAL,fullWidth:!0,spacing:r.o.XSMALL,style:{padding:o.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(u,"rs-card-").concat(n),onClick:()=>{(async()=>{p(e);try{await(0,i.z)(e.id)}catch(t){console.error(t)}d(!1)})()},children:[(0,c.jsx)(s.A,{search:e,index:n,dataTestId:u}),(0,c.jsx)(l.A,{search:e,index:n,dataTestId:u})]},e.id)}},603(t,e,n){n.d(e,{D:()=>u});var o,r,i,a,s=n(528),l=n(694),c=n.n(l),d=n(591);const u=c().div(o||(o=(0,s.A)(["\n\tdisplay: flex;\n\tflex-direction: ",";\n\tflex-wrap: ",";\n\talign-items: ",";\n\tjustify-content: ",";\n\tbox-sizing: border-box;\n\n\t","\n\t",";\n"])),t=>{let{$direction:e}=t;return e===d.I.VERTICAL?"column":"row"},t=>{let{$wrap:e}=t;return e?"wrap":"nowrap"},t=>{let{$alignItems:e}=t;return e},t=>{let{$justifyContent:e}=t;return e},t=>{let{$fullWidth:e}=t;return e&&(0,l.css)(r||(r=(0,s.A)(["\n\t\t\twidth: 100%;\n\t\t"])))},t=>{let{$direction:e,$spacing:n}=t;return e===d.I.VERTICAL?(0,l.css)(i||(i=(0,s.A)(["\n\t\t\t\t\t> *:not(:first-child) {\n\t\t\t\t\t\tmargin-top: ",";\n\t\t\t\t\t}\n\t\t\t "])),n):(0,l.css)(a||(a=(0,s.A)(["\n\t\t\t\t\t> *:not(:first-child) {\n\t\t\t\t\t\tmargin-left: ",";\n\t\t\t\t\t}\n\t\t\t "])),n)})},663(t,e,n){n.d(e,{A:()=>u});n(155);var o=n(186),r=n(817),i=n(591),a=n(414),s=n(672),l=n(176),c=n(324),d=n(579);const u=t=>{let{search:e,index:n,dataTestId:u}=t;const p=e.origin.length>1,m=e.destination.length>1,f=p?(0,s.Kh)(e.origin):{[e.origin[0].country]:e.origin},h=m?(0,s.Kh)(e.destination):{[e.destination[0].country]:e.destination};return(0,d.jsxs)(r.A,{alignItems:"center",spacing:i.o.XSMALL,fullWidth:!0,children:[Object.keys(f).map(t=>{const e=f[t].map(t=>t.selectedValue).join(", ");return(0,d.jsxs)(l.A,{text:e,isLocationLabel:!0,testId:"".concat(u,"-origin-").concat(n),isPort:f[t][0].type===c.Xf.SEAPORT,children:[(0,d.jsx)(a.H4,{type:"flag",country:t,size:"small","data-test-id":"".concat(u,"-origin-flag-").concat(n),style:{marginRight:"4px"}}),e]},t)}),(0,d.jsx)(o.Icon,{type:"arrow-forward",style:{marginRight:0,color:o.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(h).map(t=>{const e=h[t].map(t=>t.selectedValue).join(", ");return(0,d.jsxs)(l.A,{text:e,isLocationLabel:!0,testId:"".concat(u,"-destination-").concat(n),isPort:h[t][0].type===c.Xf.SEAPORT,children:[(0,d.jsx)(a.H4,{type:"flag",country:t,size:"small","data-test-id":"".concat(u,"-destination-flag-").concat(n),style:{marginRight:"4px"}}),e]},t)})]})}},672(t,e,n){n.d(e,{Kh:()=>i,VH:()=>s,Yy:()=>a});var o=n(916);const r=t=>t?t.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0",i=t=>{const e=t.reduce((t,e)=>{const n=e.country;return t[n]||(t[n]=[]),t[n].push(e),t},{});return Object.keys(e).forEach(t=>{e[t].sort((t,e)=>t.selectedValue.localeCompare(e.selectedValue))}),e},a=t=>{const e=t.shipment_details.type;if(e===o.E4.TOTALS)return["box-total"];if(e===o.E4.UNITS){const e=t.shipment_details[o.jM.UNITS_SHIPMENT];if((null===e||void 0===e?void 0:e.packageType)===o.iE.BOX){return e.boxPackages.reduce((t,e)=>{var n,o;const r=null===(n=e.type)||void 0===n||null===(o=n.value)||void 0===o?void 0:o.icon;return t.includes(r)||t.push(r),t},[])}return(null===e||void 0===e?void 0:e.packageType)===o.iE.ULD?["uld"]:["box"]}return e===o.E4.CONTAINER?["container"]:["box"]},s=t=>{const e=t.shipment_details.type;if(t.platform_type===o.MM.QUOTATION)return{units:0,volume:0,weight:0,weightUnit:o.YB.KG,volumeUnit:o.Q4.CBM};switch(e){case o.E4.CONTAINER:{var n;let e=0,r=0;return null===(n=t.shipment_details[o.jM.CONTAINER_PACKAGES])||void 0===n||n.forEach(t=>{const n=Number(t.units)||0;if(n>0){e+=n;const i=parseInt(t.dimensions.value,10);r+=n*(i/o.PR)}}),{units:e,volume:r,weight:null,weightUnit:null,volumeUnit:"TEU"}}case o.E4.UNITS:{const e=t.shipment_details[o.jM.UNITS_SHIPMENT],n=(null===e||void 0===e?void 0:e.volumeUnit)===o.Q4.CFT?o.vP:o.g1;if((null===e||void 0===e?void 0:e.packageType)===o.iE.BOX){const t=r(null===e||void 0===e?void 0:e.boxPackages.reduce((t,e)=>t+parseFloat(e.width||"0")*parseFloat(e.height||"0")*parseFloat(e.length||"0")*parseFloat(e.units||"0")/n,0)),o=r(e.boxPackages.reduce((t,e)=>t+parseFloat(e.weight||"0"),0));return{units:e.boxPackages.reduce((t,e)=>t+parseFloat(e.units||"0"),0),volume:t,weight:o,weightUnit:e.weightUnit,volumeUnit:e.volumeUnit}}if((null===e||void 0===e?void 0:e.packageType)===o.iE.ULD){const t=r(e.uldPackages.reduce((t,e)=>t+parseFloat(e.volume||"0"),0)),n=r(e.uldPackages.reduce((t,e)=>t+parseFloat(e.weight||"0"),0));return{units:e.uldPackages.length,volume:t,weight:n,weightUnit:e.weightUnit,volumeUnit:e.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:o.YB.KG,volumeUnit:o.Q4.CBM}}case o.E4.TOTALS:{var i,a,s,l,c;const e=r(parseFloat((null===(i=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===i?void 0:i.volume)||"0")),n=r(parseFloat((null===(a=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===a?void 0:a.weight)||"0"));return{units:(null===(s=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===s?void 0:s.units)||0,volume:e,weight:n,weightUnit:(null===(l=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===l?void 0:l.weightUnit)||o.YB.KG,volumeUnit:(null===(c=t.shipment_details[o.jM.TOTALS_SHIPMENT])||void 0===c?void 0:c.volumeUnit)||o.Q4.CBM}}default:return{units:0,volume:0,weight:0,weightUnit:o.YB.KG,volumeUnit:o.Q4.CBM}}}},694(t){t.exports=i},751(t,e,n){n.d(e,{p:()=>a});var o=n(379),r=n(2),i=n.n(r);const a=async t=>{let{method:e,url:n="",data:r={},options:a={}}=t;const s=(()=>{if("get"===e){return[Object.keys(r).length?"".concat(n,"?").concat(new URLSearchParams(r).toString()):n,a]}if("post"===e){const t=(0,o.A)((0,o.A)({},null===a||void 0===a?void 0:a.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[n,r,(0,o.A)((0,o.A)({},a),{},{headers:t})]}return[n,r,a]})();return await i()[e](...s)}},757(t,e,n){n.d(e,{CK:()=>r});var o=n(916);const r=t=>[...t].sort((t,e)=>{const n=new Date(Math.max(new Date(t.last_time_used_date).getTime(),new Date(t.saved_update_date).getTime()));return new Date(Math.max(new Date(e.last_time_used_date).getTime(),new Date(e.saved_update_date).getTime())).getTime()-n.getTime()}).slice(0,o.Dy)},773(t){t.exports=o},817(t,e,n){n.d(e,{A:()=>c});var o=n(379),r=n(45),i=(n(155),n(591)),a=n(603),s=n(579);const l=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"],c=t=>{let{direction:e=i.I.HORIZONTAL,alignItems:n="start",spacing:c=i.o.NONE,wrap:d,justifyContent:u,fullWidth:p}=t,m=(0,r.A)(t,l);return(0,s.jsx)(a.D,(0,o.A)((0,o.A)({},m),{},{$direction:e,$alignItems:n,$spacing:c,$wrap:d,$justifyContent:u,$fullWidth:p,children:m.children}))}},866(t,e,n){n.d(e,{A:()=>f});var o=n(379),r=n(45),i=n(155),a=n(186),s=n(773),l=n(324),c=n(79),d=n(403),u=n(927),p=n(579);const m=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"],f=t=>{let{fetchOptions:e,renderedOptions:n,recentSearches:f=[],hasError:h,mode:y,dataTestId:g,value:S,debounceTimeout:v=800,activeLocationMode:T,defaultLocation:E,onChange:A}=t,O=(0,r.A)(t,m);const[L,b]=(0,i.useState)([]),[I,_]=(0,i.useState)(!1),[C,x]=(0,i.useState)(""),j=(0,i.useRef)(0),[w,P]=(0,i.useState)(!1),[N,R]=(0,i.useState)(l.GB),k=(0,i.useRef)();(0,i.useEffect)(()=>{S&&0!==S.length||w||(b([]),x(""))},[S,w]),(0,i.useEffect)(()=>(T!==l.Ot&&b(t=>t.filter(t=>t.label===l.au[T].label)),P(!1),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{document.activeElement.blur(),document.body.click();const t=document.querySelector(".ant-select-focused");t&&t.classList.remove("ant-select-focused"),R(l.GB)},100),()=>{k.current&&clearTimeout(k.current)}),[T]);const M=(0,i.useMemo)(()=>(0,s.debounce)(async t=>{x(t),j.current+=1;const n=j.current;b([]),_(!0);let o=null;try{const r=await e(t);n===j.current&&(b(r),o=r)}catch(r){console.error("Error fetching options:",r),n===j.current&&a.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."})}finally{if(n===j.current)return _(!1),o}},v),[e,v]);(0,i.useEffect)(()=>{if(null===E||void 0===E||!E.code)return;(async()=>{try{b([]),_(!0);const t=await e(E.code);if(b(t),!t||0===t.length)return;let n=null;if(E.type){const e=t.find(t=>{var e;return t.label.toLowerCase()===(null===(e=l.au[E.type])||void 0===e?void 0:e.label.toLowerCase())});null!==e&&void 0!==e&&e.options&&(n=e.options.find(t=>t.code.toLowerCase()===E.code.toLowerCase()||t.selectedValue.toLowerCase()===E.code.toLowerCase()))}if(n||(n=t.map(t=>t.options).flat().find(t=>t.code.toLowerCase()===E.code.toLowerCase()||t.selectedValue.toLowerCase()===E.code.toLowerCase())),n&&A){const t={key:JSON.stringify(n),label:n.selectedValue||n.displayLabel||n.code};A([t])}}catch(t){u.A.isLocal()&&console.error("Error loading default location:",t)}finally{_(!1)}})()},[null===E||void 0===E?void 0:E.code,null===E||void 0===E?void 0:E.type]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c.Et,{}),(0,p.jsx)(c.V5,(0,o.A)((0,o.A)({maxTagCount:N,onSearch:M,$hasError:h,loading:I,options:L,filterOption:!1,notFoundContent:(0,p.jsx)(d.A,{isLoading:I,recentSearches:f,searchKey:C,dataTestId:g,setIsOpen:P,onRecentSearchSelect:O.onRecentSearchSelect,initialValues:O.initialValues}),mode:y,"data-test-id":"".concat(g,"-selector"),allowClear:y===l.nE.SINGLE,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:t=>{R(t?l.DS:l.GB),b([]),x(""),P(t)},open:w&&(I||C.trim()||(null===f||void 0===f?void 0:f.length)>0),value:S,onChange:A},O),{},{children:n(L)}))]})}},916(t,e,n){n.d(e,{Dy:()=>T,E2:()=>o,E4:()=>f,FW:()=>u,MM:()=>p,PR:()=>m,Q4:()=>g,YB:()=>S,g1:()=>y,iE:()=>v,jM:()=>r,vP:()=>h});const o="/webcargo-alpha",r={ORIGIN:"origin",DESTINATION:"destination",TOTALS_SHIPMENT:"totalShipment",UNITS_SHIPMENT:"unitsShipment",CONTAINER_SHIPMENT:"containerShipment",COMMODITY:"commodity",SHIPMENT_TYPE:"shipmentType",UNITS:"units",VOLUME:"volume",VOLUME_UNIT:"volumeUnit",WEIGHT:"weight",WEIGHT_UNIT:"weightUnit",TURNABLE:"turnable",STACKABLE:"stackable",DEFINE_EACH_UNIT_DIMENSIONS:"defineEachUnitDimensions",DEFINE_EACH_UNIT_WEIGHT:"defineEachUnitWeight",UNIT_DIMENSIONS:"unitDimensions",UNIT_WEIGHTS:"unitWeights",LENGTH:"length",HEIGHT:"height",WIDTH:"width",TYPE:"type",DIMENSION_UNIT:"dimensionUnit",BOX_PACKAGES:"boxPackages",ULD_PACKAGES:"uldPackages",PACKAGE_TYPE:"packageType",TOTAL_WEIGHT:"totalWeight",CONTAINER_PACKAGES:"containerPackages",DIMENSIONS:"dimensions",FULLFILLMENT_DETAILS:"fullfillmentDetails",IS_FULLFILLMENT:"isFullfillment",COMMODITY_TEMPERATURE:"commodityTemperature",BATTERY_HS_CODE:"batteryHsCode",SUPPORTED_FREIGHT_TYPES:"supportedFreightTypes"},i="celsius",a="fahrenheit",s="FRO",l="COL",c="ERT",d="CRT",u={[s]:{[i]:"-10\xbaC or below",[a]:"14\xbaF or below"},[l]:{[i]:"From +2\xbaC To +8\xbaC",[a]:"From 35.6\xbaF To 46.4\xbaF"},[c]:{[i]:"From +2\xbaC To +25\xbaC",[a]:"From 35.6\xbaF To 77\xbaF"},[d]:{[i]:"From +15\xbaC To +25\xbaC",[a]:"From 59\xbaF To 77\xbaF"}},p={BOOKING:"booking",QUOTATION:"quotation",BI:"bi"},m=20,f={UNITS:"units",TOTALS:"totals",CONTAINER:"container"},h=1728,y=1e6,g={CBM:"CBM",CFT:"CFT"},S={KG:"kg",LB:"lb"},v={BOX:"box",ULD:"uld"},T=6},922(t,e,n){n.d(e,{A:()=>i});var o=n(284),r=n(327);function i(t){var e=(0,r.A)(t,"string");return"symbol"==(0,o.A)(e)?e:e+""}},927(t,e,n){n.d(e,{A:()=>o});class o{static isProduction(){return"prod"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.REACT_APP_CUSTOM_ENV}static isTest(){return"test"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.REACT_APP_CUSTOM_ENV}static isLocal(){return"dev"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.REACT_APP_CUSTOM_ENV}}},961(t,e,n){n.d(e,{V:()=>s});var o=n(379),r=n(2),i=n.n(r),a=n(324);const s=async(t,e,n)=>{try{const r=t.reduce((t,e)=>(0,o.A)((0,o.A)({},t),{},{[a.au[e].key]:(0,o.A)((0,o.A)({type:e.toUpperCase()},null!==n&&void 0!==n&&n.code?{searchTerm:n.name}:{}),a.au[e].groupedBy?{groupedBy:a.au[e].groupedBy}:{})}),{});return(await i().post("/geocoder/api/v3/geocoder/locations",{query:e,limit:5,sources:r})).data}catch(r){return console.error("Error fetching locations:",r),{results:{}}}}}},s={};function l(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return a[t](n,n.exports,l),n.exports}l.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return l.d(e,{a:e}),e},l.d=(t,e)=>{for(var n in e)l.o(e,n)&&!l.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),l.r=t=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var c={};l.r(c),l.d(c,{default:()=>E});var d=l(379),u=l(45),p=l(155),m=l(186),f=l(198),h=l(866),y=l(302),g=l(324),S=l(595),v=l(579);const T=["value","onChange","hasError","dataTestId","isOriginLocation","maxPorts","supportedLocationModes","customer","defaultLocation","autofillLocationAddress","autofillLocationCode","userCountryCode"],E=t=>{let{value:e,onChange:n,hasError:o,dataTestId:r="location-input",isOriginLocation:i=!0,maxPorts:a=1,supportedLocationModes:s,customer:l,defaultLocation:c,autofillLocationAddress:E,autofillLocationCode:A,userCountryCode:O}=t,L=(0,u.A)(t,T);const[b,I]=(0,p.useState)(e),[_,C]=(0,p.useState)(1===s.length?s[0]:g.Ot),[x,j]=(0,p.useState)((0,S.Sn)(_)||_===g.Ot?g.nE.SINGLE:g.nE.MULTIPLE),w=(0,p.useRef)(e),P=(0,p.useRef)(null);(0,p.useEffect)(()=>{(0,S.Sn)(_)?j(g.nE.SINGLE):j(g.nE.MULTIPLE)},[_]),(0,p.useEffect)(()=>{I(e),w.current=e,Array.isArray(e)&&e.length>0?C(e[0].type):null!==c&&void 0!==c&&c.type?C(c.type):C(g.Ot)},[e,null===c||void 0===c?void 0:c.type]);const N=(0,p.useRef)({onChange:n,selectionMode:x,maxPorts:a});return(0,p.useEffect)(()=>{N.current={onChange:n,selectionMode:x,maxPorts:a}},[n,x,a]),(0,p.useEffect)(()=>{const t="".concat(E||"","::").concat(A||"");if(!E&&!A)return;if(t===P.current)return;const e=w.current,{selectionMode:n,maxPorts:o}=N.current,r=n===g.nE.MULTIPLE&&"number"===typeof o&&o>1&&Array.isArray(e)&&e.length<o;if((0,S.nq)(e)&&!r)return;(async()=>{try{const e=await(0,S.dK)({autofillLocationAddress:E,autofillLocationCode:A,supportedLocationModes:s,customer:l,userCountryCode:O});if(!e)return;const{onChange:n,selectionMode:o,maxPorts:r}=N.current,i=w.current;if(o===g.nE.MULTIPLE&&"number"===typeof r&&r>1&&Array.isArray(i)){const t=(0,S.hy)(e),a=(0,S.zU)(i);if(!t||a.has(t))return;const s=(0,S.vJ)(i)||[],l=[...Array.isArray(s)?s.filter(Boolean):[],e].slice(0,r);(0,S.mG)(l,o,r,I,n)}else o===g.nE.MULTIPLE?(0,S.mG)([e],o,r,I,n):(0,S.mG)(e,o,r,I,n);P.current=t}catch(e){console.error("Error performing autofill:",e)}})()},[E,A,s,l,O]),(0,v.jsx)(h.A,(0,d.A)({mode:x,dataTestId:r,hasError:o,placeholder:(0,v.jsx)(f.TranslatableText,{style:{fontSize:m.tokens.fdsFontSizeBase},stringId:"Select ".concat(i?g.$C.ORIGIN:g.$C.DESTINATION)}),value:(0,S.vJ)(b),fetchOptions:(0,S.jj)(_,s,l),renderedOptions:t=>(0,S.MN)(t,r),onChange:t=>{(0,S.mG)(null!==t&&void 0!==t?t:[],x,a,I,n),C(g.Ot)},activeLocationMode:_,maxTagPlaceholder:t=>(0,v.jsx)(y.A,{omittedPorts:t,dataTestId:r}),defaultLocation:c},L))};return c})());
|
|
1
|
+
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):"function"===typeof define&&define.amd?define("FusionLocationInput",["react","@freightos/design-system","styled-components","@freightos/freightos-i18n","@freightos/http-client","lodash"],t):"object"===typeof exports?exports.FusionLocationInput=t(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):e.FusionLocationInput=t(e.React,e["@freightos/design-system"],e["styled-components"],e["@freightos/freightos-i18n"],e["@freightos/http-client"],e.lodash)}(this,(function(e,t,n,o,r,a){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="http://ship.freightos.local:8800/FusionLocationInput/",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=r},function(e,t){e.exports=a},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t);var o=n(0),r=n.n(o),a=n(1),i=n(3),l=n(5);const s="airport",c="seaport",d="fulfillment_center",u="address_book",p="last_mile_address",m="address",f={[s]:{label:"Airports",key:s,icon:"mode-air"},[c]:{label:"Ports",key:c,icon:"mode-ship"},[d]:{label:"Fulfillment centers",key:d,icon:"fulfillment-center"},[u]:{key:u,groupedBy:"address"},[p]:{key:p,groupedBy:"address"},[m]:{label:"Address",key:m,icon:"location"}},g="single",y="multiple",h="origin",v="destination";var b=n(2),S=n.n(b);const E=b.createGlobalStyle`
|
|
2
|
+
.ant-select-dropdown {
|
|
3
|
+
.ant-select-dropdown-menu {
|
|
4
|
+
max-height: 400px;
|
|
5
|
+
padding: 0 !important;
|
|
6
|
+
margin-top: 0 !important;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,O=S()(a.Select)`
|
|
10
|
+
.ant-select-selection__rendered {
|
|
11
|
+
min-width: 100% !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
li.ant-select-selection__choice {
|
|
15
|
+
border-radius: ${a.tokens.fdsBorderRadiusXl};
|
|
16
|
+
border: none;
|
|
17
|
+
border-color: ${a.tokens.fdsColorPrimaryBlue};
|
|
18
|
+
color: ${a.tokens.fdsColorPrimaryBlue};
|
|
19
|
+
background-color: ${a.tokens.fdsColorPrimaryBlue10};
|
|
20
|
+
line-height: 10px !important;
|
|
21
|
+
margin-right: ${a.tokens.fdsComponentSpacingXxs};
|
|
22
|
+
width: fit-content;
|
|
23
|
+
max-width: 90px;
|
|
24
|
+
height: ${a.tokens.fdsSizeMd} !important;
|
|
25
|
+
${e=>{let{size:t}=e;return"large"===t?`\n\t\t\tmargin-top: ${a.tokens.fdsComponentSpacingSm} !important;\n\t\t`:"\n\t\t\tmargin-top: 5px !important;\n\t\t"}}
|
|
26
|
+
|
|
27
|
+
.ant-select-selection__choice__remove {
|
|
28
|
+
color: ${a.tokens.fdsColorPrimaryBlue};
|
|
29
|
+
margin-top: ${a.tokens.fdsComponentSpacingXs} !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ant-select-selection__choice__content {
|
|
33
|
+
line-height: ${a.tokens.fdsSizeMd} !important;
|
|
34
|
+
height: ${a.tokens.fdsSizeMd} !important;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
li.ant-select-selection__choice__disabled {
|
|
39
|
+
border: none;
|
|
40
|
+
background-color: transparent;
|
|
41
|
+
padding: 0;
|
|
42
|
+
padding-left: 0;
|
|
43
|
+
width: fit-content;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ant-select-dropdown .ant-select-not-found {
|
|
47
|
+
cursor: pointer !important;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ant-select-selection-selected-value {
|
|
51
|
+
max-width: 280px !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
li.ant-select-search.ant-select-search--inline {
|
|
55
|
+
margin-left: -1px !important;
|
|
56
|
+
}
|
|
57
|
+
.ant-select-search__field {
|
|
58
|
+
color: ${a.tokens.fdsColorPrimaryGray80} !important;
|
|
59
|
+
}
|
|
60
|
+
${e=>{let{$hasError:t}=e;return t&&`\n\t\t.ant-select-selection {\n\t\t\tcolor: ${a.tokens.fdsColorSemanticRed};\n \t\tborder: 1px solid ${a.tokens.fdsColorSemanticRed};\n \t\tbackground-color: ${a.tokens.fdsColorSemanticRed10};\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ${a.tokens.fdsColorSemanticRed};\n\t\t}\n\t`}}
|
|
61
|
+
`,C=S.a.span`
|
|
62
|
+
font-size: ${a.tokens.fdsFontSizeSm} !important;
|
|
63
|
+
`,$=S.a.div`
|
|
64
|
+
font-size: ${a.tokens.fdsFontSizeSm} !important;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
display: -webkit-box;
|
|
68
|
+
-webkit-line-clamp: 2;
|
|
69
|
+
-webkit-box-orient: vertical;
|
|
70
|
+
`,w=S()(a.Menu)`
|
|
71
|
+
cursor: pointer !important;
|
|
72
|
+
|
|
73
|
+
.ant-menu-item-group-title {
|
|
74
|
+
padding: 0;
|
|
75
|
+
color: ${a.tokens.fdsBodyTextColorDisabled};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ant-menu-item {
|
|
79
|
+
padding: 0;
|
|
80
|
+
white-space: normal;
|
|
81
|
+
line-height: normal;
|
|
82
|
+
|
|
83
|
+
&:hover {
|
|
84
|
+
background-color: #f5f5f5;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`,T=S.a.div`
|
|
88
|
+
font-size: ${a.tokens.fdsFontSizeSm};
|
|
89
|
+
line-height: ${a.tokens.fdsSizeSm};
|
|
90
|
+
font-family: ${a.tokens.fdsHeadingsFontFamily};
|
|
91
|
+
`,k=(S()(a.Icon)`
|
|
92
|
+
margin-right: 0 !important;
|
|
93
|
+
vertical-align: bottom;
|
|
94
|
+
`,{XXLARGE:a.tokens.fdsComponentSpacingXxl,XLARGE:a.tokens.fdsComponentSpacingXl,LARGE:a.tokens.fdsComponentSpacingLg,MEDIUM:a.tokens.fdsComponentSpacingMd,SMALL:a.tokens.fdsComponentSpacingSm,XSMALL:a.tokens.fdsComponentSpacingXs,XXSMALL:a.tokens.fdsComponentSpacingXxs,NONE:0}),L={VERTICAL:"vertical",HORIZONTAL:"horizontal"},_="totalShipment",x="unitsShipment",I="containerPackages",j="celsius",P="fahrenheit",A={["FRO"]:{[j]:"-10\xbaC or below",[P]:"14\xbaF or below"},["COL"]:{[j]:"From +2\xbaC To +8\xbaC",[P]:"From 35.6\xbaF To 46.4\xbaF"},["ERT"]:{[j]:"From +2\xbaC To +25\xbaC",[P]:"From 35.6\xbaF To 77\xbaF"},["CRT"]:{[j]:"From +15\xbaC To +25\xbaC",[P]:"From 59\xbaF To 77\xbaF"}},R="quotation",F="units",M="totals",U="container",z="CBM",N="CFT",V="kg",D="box",W="uld";var X=n(4),B=n.n(X);const q=async e=>{await(async e=>{let{method:t,url:n="",data:o={},options:r={}}=e;const a=(()=>{if("get"===t){return[Object.keys(o).length?`${n}?${new URLSearchParams(o).toString()}`:n,r]}if("post"===t){const e={...null===r||void 0===r?void 0:r.headers,accept:"application/json","content-type":"multipart/form-data"};return[n,o,{...r,headers:e}]}return[n,o,r]})();return await B.a[t](...a)})({method:"put",url:"/webcargo-alpha/backend/api.php",options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:e}})},G=S.a.div`
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: ${e=>{let{$direction:t}=e;return t===L.VERTICAL?"column":"row"}};
|
|
97
|
+
flex-wrap: ${e=>{let{$wrap:t}=e;return t?"wrap":"nowrap"}};
|
|
98
|
+
align-items: ${e=>{let{$alignItems:t}=e;return t}};
|
|
99
|
+
justify-content: ${e=>{let{$justifyContent:t}=e;return t}};
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
|
|
102
|
+
${e=>{let{$fullWidth:t}=e;return t&&b.css`
|
|
103
|
+
width: 100%;
|
|
104
|
+
`}}
|
|
105
|
+
${e=>{let{$direction:t,$spacing:n}=e;return t===L.VERTICAL?b.css`
|
|
106
|
+
> *:not(:first-child) {
|
|
107
|
+
margin-top: ${n};
|
|
108
|
+
}
|
|
109
|
+
`:b.css`
|
|
110
|
+
> *:not(:first-child) {
|
|
111
|
+
margin-left: ${n};
|
|
112
|
+
}
|
|
113
|
+
`}};
|
|
114
|
+
`;var K=e=>{let{direction:t=L.HORIZONTAL,alignItems:n="start",spacing:o=k.NONE,wrap:a,justifyContent:i,fullWidth:l,...s}=e;return r.a.createElement(G,Object.assign({},s,{$direction:t,$alignItems:n,$spacing:o,$wrap:a,$justifyContent:i,$fullWidth:l}),s.children)};const H=S.a.div`
|
|
115
|
+
color: ${a.tokens.fdsColorPrimaryGray60};
|
|
116
|
+
font-size: ${a.tokens.fdsSizeXs};
|
|
117
|
+
font-weight: ${a.tokens.fdsFontWeightRegular};
|
|
118
|
+
margin-bottom: ${a.tokens.fdsComponentSpacingSm};
|
|
119
|
+
i {
|
|
120
|
+
margin-right: ${a.tokens.fdsComponentSpacingSm};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
`,J=S()(K)`
|
|
124
|
+
padding-left: 0 !important;
|
|
125
|
+
`,Z=S()(a.Icon)`
|
|
126
|
+
margin-right: 0 !important;
|
|
127
|
+
vertical-align: bottom;
|
|
128
|
+
`,Y=S.a.span`
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
min-width: 0;
|
|
131
|
+
color: ${a.tokens.fdsColorPrimaryGray80};
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
text-overflow: ellipsis;
|
|
134
|
+
${e=>{let{$isLocationLabel:t}=e;return!t&&"\n\t\tfont-size: 10px; //TODO: FSN-145\n\t\tline-height: 15px;\n\t"}}
|
|
135
|
+
${e=>{let{$isPort:t}=e;if(void 0!==t)return`min-width: ${t?"65px":"55px"};`}};
|
|
136
|
+
`,Q=S()(a.Avatar)`
|
|
137
|
+
border: 1px solid ${a.tokens.fdsColorPrimaryGray20};
|
|
138
|
+
width: ${a.tokens.fdsSizeSm};
|
|
139
|
+
height: ${a.tokens.fdsSizeSm};
|
|
140
|
+
`,ee=S()(K)`
|
|
141
|
+
overflow: hidden !important;
|
|
142
|
+
font-size: 10px; //TODO: FSN-145
|
|
143
|
+
line-height: 15px;
|
|
144
|
+
flex: 1;
|
|
145
|
+
min-width: 0;
|
|
146
|
+
`,te=S()(K)`
|
|
147
|
+
:last-child {
|
|
148
|
+
padding-bottom: 0 !important;
|
|
149
|
+
}
|
|
150
|
+
`,ne=e=>e?e.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0",oe=e=>{const t=e.reduce((e,t)=>{const n=t.country;return e[n]||(e[n]=[]),e[n].push(t),e},{});return Object.keys(t).forEach(e=>{t[e].sort((e,t)=>e.selectedValue.localeCompare(t.selectedValue))}),t};var re=e=>{let{text:t="",testId:n,isPort:i,isLocationLabel:l=!1,children:s=null}=e;const c=Object(o.useRef)(null),[d,u]=Object(o.useState)(!1);Object(o.useEffect)(()=>{(()=>{if(c.current){const e=c.current,t=e.scrollWidth>e.clientWidth;u(t)}})()},[t]);const p=r.a.createElement(Y,{ref:c,"data-test-id":n,$isLocationLabel:l,$isPort:i},s||t);return d?r.a.createElement(a.Tooltip,{title:t,"data-test-id":n+"-tooltip"},r.a.createElement(Y,{ref:c,"data-test-id":n,$isLocationLabel:l,$isPort:i},s||t)):p};var ae=e=>{let{search:t,index:n,dataTestId:o}=e;const i=t.origin.length>1,l=t.destination.length>1,s=i?oe(t.origin):{[t.origin[0].country]:t.origin},d=l?oe(t.destination):{[t.destination[0].country]:t.destination};return r.a.createElement(K,{alignItems:"center",spacing:k.XSMALL,fullWidth:!0},Object.keys(s).map(e=>{const t=s[e].map(e=>e.selectedValue).join(", ");return r.a.createElement(re,{key:e,text:t,isLocationLabel:!0,testId:`${o}-origin-${n}`,isPort:s[e][0].type===c},r.a.createElement(Q,{type:"flag",country:e,size:"small","data-test-id":`${o}-origin-flag-${n}`,style:{marginRight:"4px"}}),t)}),r.a.createElement(a.Icon,{type:"arrow-forward",style:{marginRight:0,color:a.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(d).map(e=>{const t=d[e].map(e=>e.selectedValue).join(", ");return r.a.createElement(re,{key:e,text:t,isLocationLabel:!0,testId:`${o}-destination-${n}`,isPort:d[e][0].type===c},r.a.createElement(Q,{type:"flag",country:e,size:"small","data-test-id":`${o}-destination-flag-${n}`,style:{marginRight:"4px"}}),t)}))};var ie=e=>{var t,n,i;let{search:l,index:s,dataTestId:c}=e;const d=l.platform_type,u=(e=>{const t=e.shipment_details.type;if(t===M)return["box-total"];if(t===F){const t=e.shipment_details[x];if((null===t||void 0===t?void 0:t.packageType)===D){return t.boxPackages.reduce((e,t)=>{var n,o;const r=null===(n=t.type)||void 0===n||null===(o=n.value)||void 0===o?void 0:o.icon;return e.includes(r)||e.push(r),e},[])}return(null===t||void 0===t?void 0:t.packageType)===W?["uld"]:["box"]}return t===U?["container"]:["box"]})(l),{units:p,volume:m,weight:f,weightUnit:g,volumeUnit:y}=Object(o.useMemo)(()=>(e=>{const t=e.shipment_details.type;if(e.platform_type===R)return{units:0,volume:0,weight:0,weightUnit:V,volumeUnit:z};switch(t){case U:{var n;let t=0,o=0;return null===(n=e.shipment_details[I])||void 0===n||n.forEach(e=>{const n=Number(e.units)||0;if(n>0){t+=n;const r=parseInt(e.dimensions.value,10);o+=n*(r/20)}}),{units:t,volume:o,weight:null,weightUnit:null,volumeUnit:"TEU"}}case F:{const t=e.shipment_details[x],n=(null===t||void 0===t?void 0:t.volumeUnit)===N?1728:1e6;if((null===t||void 0===t?void 0:t.packageType)===D){const e=ne(null===t||void 0===t?void 0:t.boxPackages.reduce((e,t)=>e+parseFloat(t.width||"0")*parseFloat(t.height||"0")*parseFloat(t.length||"0")*parseFloat(t.units||"0")/n,0)),o=ne(t.boxPackages.reduce((e,t)=>e+parseFloat(t.weight||"0"),0));return{units:t.boxPackages.reduce((e,t)=>e+parseFloat(t.units||"0"),0),volume:e,weight:o,weightUnit:t.weightUnit,volumeUnit:t.volumeUnit}}if((null===t||void 0===t?void 0:t.packageType)===W){const e=ne(t.uldPackages.reduce((e,t)=>e+parseFloat(t.volume||"0"),0)),n=ne(t.uldPackages.reduce((e,t)=>e+parseFloat(t.weight||"0"),0));return{units:t.uldPackages.length,volume:e,weight:n,weightUnit:t.weightUnit,volumeUnit:t.volumeUnit}}return{units:0,volume:0,weight:0,weightUnit:V,volumeUnit:z}}case M:{var o,r,a,i,l;const t=ne(parseFloat((null===(o=e.shipment_details[_])||void 0===o?void 0:o.volume)||"0")),n=ne(parseFloat((null===(r=e.shipment_details[_])||void 0===r?void 0:r.weight)||"0"));return{units:(null===(a=e.shipment_details[_])||void 0===a?void 0:a.units)||0,volume:t,weight:n,weightUnit:(null===(i=e.shipment_details[_])||void 0===i?void 0:i.weightUnit)||V,volumeUnit:(null===(l=e.shipment_details[_])||void 0===l?void 0:l.volumeUnit)||z}}default:return{units:0,volume:0,weight:0,weightUnit:V,volumeUnit:z}}})(l),[l]),h=1===l.commodity.length&&l.commodity[0].is_temperature,v=(null===(t=l.commodity_temperature)||void 0===t?void 0:t.tempRange)&&h?A[null===(n=l.commodity_temperature)||void 0===n?void 0:n.tempRange][null===(i=l.commodity_temperature)||void 0===i?void 0:i.temperatureSystem]:"";return r.a.createElement(K,{spacing:k.XSMALL,alignItems:"center",fullWidth:!0,key:s},d===R?r.a.createElement(ee,{alignItems:"center",spacing:k.SMALL,style:{flex:1}},u.map((e,t)=>r.a.createElement(Z,{type:e,key:`${s}-${t}`,size:"tiny","data-test-id":`${c}rs-package-icon-${s}-${t}`})),r.a.createElement(re,{text:l.commodity.map(e=>e.label).join(", "),testId:`${c}rs-commodity-${s}`})):r.a.createElement(ee,{alignItems:"center",spacing:k.SMALL},r.a.createElement(K,{alignItems:"center",spacing:k.XSMALL,"data-test-id":`rs-${s}-units`},p,"\xa0",u.map((e,t)=>r.a.createElement(Z,{type:e,key:`${s}-${t}`,size:"tiny","data-test-id":`${c}rs-package-icon-${s}-${t}`}))),r.a.createElement("span",{"data-test-id":`${c}rs-volume-${s}`},m,"\xa0",y),f&&r.a.createElement("span",{"data-test-id":`${c}rs-weight-${s}`},f,"\xa0",g),r.a.createElement(re,{text:l.commodity.map(e=>e.label).join(", "),testId:`${c}rs-commodity-${s}`}),h&&r.a.createElement(K,{alignItems:"center",spacing:k.XSMALL,"data-test-id":`${c}rs-temperature-${s}`},r.a.createElement(a.Icon,{type:"temperature-low",size:"tiny","data-test-id":`${c}rs-temperature-icon-${s}`}),r.a.createElement("span",{style:{whiteSpace:"nowrap"}},v))))};const le=e=>{let{search:t,index:n,setIsOpen:o,dataTestId:i,onRecentSearchSelect:l}=e;return r.a.createElement(J,{direction:L.VERTICAL,fullWidth:!0,spacing:k.XSMALL,key:t.id,style:{padding:a.tokens.fdsComponentSpacingSm},"data-test-id":`${i}rs-card-${n}`,onClick:()=>{(async()=>{l(t);try{await q(t.id)}catch(e){console.error(e)}o(!1)})()}},r.a.createElement(ae,{search:t,index:n,dataTestId:i}),r.a.createElement(ie,{search:t,index:n,dataTestId:i}))};var se=e=>{let{recentSearches:t,setIsOpen:n,dataTestId:o,onRecentSearchSelect:l,initialValues:s}=e;const c=t?(e=>[...e].sort((e,t)=>{if(e.is_saved!==t.is_saved)return e.is_saved?-1:1;if(e.is_saved&&t.is_saved){const n=new Date(e.saved_update_date).getTime();return new Date(t.saved_update_date).getTime()-n}const n=new Date(Math.max(new Date(e.last_time_used_date).getTime(),new Date(e.saved_update_date||0).getTime())).getTime();return new Date(Math.max(new Date(t.last_time_used_date).getTime(),new Date(t.saved_update_date||0).getTime())).getTime()-n}).slice(0,6))(t):[];return r.a.createElement(w,null,r.a.createElement(H,null,r.a.createElement(a.Icon,{"data-test-id":o+"rs-icon",color:a.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),r.a.createElement(i.TranslatableText,{stringId:"Recent searches"})),r.a.createElement(te,{direction:L.VERTICAL,fullWidth:!0},c.map((e,t)=>r.a.createElement(le,{onRecentSearchSelect:l,initialValues:s,search:e,index:t,key:e.id,setIsOpen:n,dataTestId:o}))))};var ce=e=>{let{isLoading:t,recentSearches:n,searchKey:o,dataTestId:l,setIsOpen:s,onRecentSearchSelect:c,initialValues:d}=e;return o||n&&0!==n.length?t?r.a.createElement(a.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!o.trim()?r.a.createElement(se,{recentSearches:n,dataTestId:l,setIsOpen:s,onRecentSearchSelect:c,initialValues:d}):o.trim()?r.a.createElement(T,null,r.a.createElement(i.TranslatableText,{stringId:"No matching results",module:i.TRANSLATION_MODULES.SearchAndBook})):null:null};class de{static isProduction(){return"prod"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}static isTest(){return"test"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}static isLocal(){return"dev"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).REACT_APP_CUSTOM_ENV}}var ue=e=>{let{fetchOptions:t,renderedOptions:n,recentSearches:i=[],hasError:s,mode:c,dataTestId:d,value:u,debounceTimeout:p=800,activeLocationMode:m,defaultLocation:y,onChange:h,...v}=e;const[b,S]=Object(o.useState)([]),[C,$]=Object(o.useState)(!1),[w,T]=Object(o.useState)(""),k=Object(o.useRef)(0),[L,_]=Object(o.useState)(!1),[x,I]=Object(o.useState)(3),j=Object(o.useRef)();Object(o.useEffect)(()=>{u&&0!==u.length||L||(S([]),T(""))},[u,L]),Object(o.useEffect)(()=>(""!==m&&S(e=>e.filter(e=>e.label===f[m].label)),_(!1),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{document.activeElement.blur(),document.body.click();const e=document.querySelector(".ant-select-focused");e&&e.classList.remove("ant-select-focused"),I(3)},100),()=>{j.current&&clearTimeout(j.current)}),[m]);const P=Object(o.useMemo)(()=>Object(l.debounce)(async e=>{T(e),k.current+=1;const n=k.current;S([]),$(!0);let o=null;try{const r=await t(e);n===k.current&&(S(r),o=r)}catch(r){console.error("Error fetching options:",r),n===k.current&&a.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."})}finally{if(n===k.current)return $(!1),o}},p),[t,p]);Object(o.useEffect)(()=>{if(!(null===y||void 0===y?void 0:y.code))return;(async()=>{try{S([]),$(!0);const e=await t(y.code);if(S(e),!e||0===e.length)return;let n=null;if(y.type){const t=e.find(e=>{var t;return e.label.toLowerCase()===(null===(t=f[y.type])||void 0===t?void 0:t.label.toLowerCase())});(null===t||void 0===t?void 0:t.options)&&(n=t.options.find(e=>e.code.toLowerCase()===y.code.toLowerCase()||e.selectedValue.toLowerCase()===y.code.toLowerCase()))}if(n||(n=e.map(e=>e.options).flat().find(e=>e.code.toLowerCase()===y.code.toLowerCase()||e.selectedValue.toLowerCase()===y.code.toLowerCase())),n&&h){const e={key:JSON.stringify(n),label:n.selectedValue||n.displayLabel||n.code};h([e])}}catch(e){de.isLocal()&&console.error("Error loading default location:",e)}finally{$(!1)}})()},[null===y||void 0===y?void 0:y.code,null===y||void 0===y?void 0:y.type]);return r.a.createElement(r.a.Fragment,null,r.a.createElement(E,null),r.a.createElement(O,Object.assign({maxTagCount:x,onSearch:P,$hasError:s,loading:C,options:b,filterOption:!1,notFoundContent:r.a.createElement(ce,{isLoading:C,recentSearches:i,searchKey:w,dataTestId:d,setIsOpen:_,onRecentSearchSelect:v.onRecentSearchSelect,initialValues:v.initialValues}),mode:c,"data-test-id":d+"-selector",allowClear:c===g,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:e=>{I(e?2:3),S([]),T(""),_(e)},open:L&&(C||w.trim()||(null===i||void 0===i?void 0:i.length)>0),value:u,onChange:h},v),n(b)))};var pe=e=>{let{omittedPorts:t,dataTestId:n}=e;const o=t.map(e=>{var t;return null===(t=JSON.parse(e.key))||void 0===t?void 0:t.selectedValue});return r.a.createElement(a.Tooltip,{title:o.join(",")},r.a.createElement(C,{"data-test-id":n+"-extra-ports"},"+"+t.length))};const me=async(e,t,n)=>{try{const o=e.reduce((e,t)=>({...e,[f[t].key]:{type:t.toUpperCase(),...(null===n||void 0===n?void 0:n.code)?{searchTerm:n.name}:{},...f[t].groupedBy?{groupedBy:f[t].groupedBy}:{}}}),{});return(await B.a.post("/geocoder/api/v3/geocoder/locations",{query:t,limit:5,sources:o})).data}catch(o){return console.error("Error fetching locations:",o),{results:{}}}},fe=e=>(e||"").trim().toUpperCase(),ge=e=>{const t=(e=>{try{return"string"===typeof e?JSON.parse(e):null}catch{return null}})(null===e||void 0===e?void 0:e.key);return fe((null===t||void 0===t?void 0:t.code)||(null===t||void 0===t?void 0:t.selectedValue))},ye=e=>{const t=[];JSON.stringify(e,(e,n)=>(t.push(e),n));const n=Array.from(new Set(t)).sort();return JSON.stringify(e,n)},he=e=>{const{displayLabel:t,selectedValue:n,formattedNameOrAddress:o,code:r,countryCode:a,stateOrProvince:i,city:l,latitude:s,longitude:c,postalOrZipCode:d,sourceType:u,locationType:p,type:m,countryName:f}=e||{};return{displayLabel:t,selectedValue:n||r,formattedNameOrAddress:o,code:r||n,country:a,countryName:f,stateOrProvince:null!==i&&void 0!==i?i:null,city:null!==l&&void 0!==l?l:null,latitude:null!==s&&void 0!==s?s:null,longitude:null!==c&&void 0!==c?c:null,postalOrZipCode:null!==d&&void 0!==d?d:null,sourceType:null!==u&&void 0!==u?u:null,locationType:null!==p&&void 0!==p?p:null,type:null!==m&&void 0!==m?m:u}},ve=e=>{try{const t="string"===typeof(null===e||void 0===e?void 0:e.key)?JSON.parse($e(e.key)):e;return ye(he(t))}catch{return ye(he(e))}},be=e=>{const t=e=>(e=>{if(e){var t;const n=e.label||e.selectedValue;return{key:ve(e),label:n?r.a.createElement(r.a.Fragment,null,r.a.createElement(a.Icon,{type:e.sourceType?null===(t=f[e.sourceType])||void 0===t?void 0:t.icon:"location",size:"tiny"}),"\xa0",r.a.createElement(C,null,n)):void 0}}})(e);return Array.isArray(e)?e.map(t):t(e)},Se=(e,t,n)=>async o=>{if(!o)return[];const r=""!==e?[e]:t;let a=(await me(r,o,n)).results;return a[m]&&(a=(e=>{let t={...e};const n=e[m].filter(e=>e.sourceType===d);if(n.length>0){const{address:e,...o}=t;t={...o,[d]:n,address:e.filter(e=>e.type!==d)}}return t})(a)),Object.keys(a).map(e=>{var t;return{label:(null===(t=f[e])||void 0===t?void 0:t.label)||e,options:a[e].map(e=>({...e,type:e.sourceType}))}})},Ee=async(e,t)=>{const n=Array.isArray(e)?e:[e];t((await Promise.all(n.map(async e=>{try{const t=null===e||void 0===e?void 0:e.key,n=$e(t);return{key:n,...JSON.parse(n)}}catch(t){return}}))).filter(Boolean))},Oe=(e,t,n,o,l)=>{if(t===y){const t=Array.isArray(e)?e:[];if(t.length<=n)o(t),Ee(t,l);else{var c,d;const e=(null===(c=JSON.parse(null===(d=t[0])||void 0===d?void 0:d.key))||void 0===c?void 0:c.sourceType)===s?n>1?"airports":"airport":n>1?"ports":"port";a.Message.danger(r.a.createElement(r.a.Fragment,null,r.a.createElement(i.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",r.a.createElement(i.TranslatableText,{stringId:e})))}}else o(e),Ee(e,l)},Ce=e=>e&&(e===m||e===p||e===u||e===d),$e=e=>"string"===typeof e?e.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):e,we=/^[^-]*-\s*(.+?),/,Te=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ke=(e,t)=>[...e[m]||[],...e[d]||[]].filter(e=>((e,t)=>{if(!e.displayLabel)return!1;const n=e.displayLabel.match(we);if(!(null===n||void 0===n?void 0:n[1]))return!1;const o=n[1].trim(),r=t.trim().split(/\s+/).map(Te);return new RegExp(`\\b${r.join("\\s+")}\\b`,"i").test(o)})(e,t)),Le=async e=>{let{autofillLocationAddress:t,autofillLocationCode:n,supportedLocationModes:o,customer:r,userCountryCode:a}=e;if(!t&&!n)return null;let i=null;if(t){const{results:e={}}=await me(o,t,r);i=((e,t)=>{if(0===e.length)return null;if(1===e.length||!t)return e[0];return e.find(e=>{var n;return(null===(n=e.countryCode)||void 0===n?void 0:n.toLowerCase())===t.toLowerCase()})||e[0]})(ke(e,t),a)}if(!i&&n){const{results:e={}}=await me(o,n,r);i=((e,t)=>{const n=e[s]||[],o=e[c]||[],r=fe(t);return[...n,...o].find(e=>fe(null===e||void 0===e?void 0:e.code)===r)})(e,n)}return i?(e=>{const t=e.selectedValue||e.displayLabel||e.code,n={...e,selectedValue:t,displayLabel:e.displayLabel||t,country:e.countryCode||e.country,type:e.type||e.sourceType};return n.country&&delete n.countryCode,{key:JSON.stringify(n),label:t}})(i):null};t.default=e=>{let{value:t,onChange:n,hasError:l,dataTestId:s="location-input",isOriginLocation:c=!0,maxPorts:p=1,supportedLocationModes:m,customer:b,defaultLocation:S,autofillLocationAddress:E,autofillLocationCode:O,userCountryCode:w,...T}=e;const[L,_]=Object(o.useState)(t),[x,I]=Object(o.useState)(1===m.length?m[0]:""),[j,P]=Object(o.useState)(Ce(x)||""===x?g:y),A=Object(o.useRef)(t),R=Object(o.useRef)(null);Object(o.useEffect)(()=>{Ce(x)?P(g):P(y)},[x]),Object(o.useEffect)(()=>{_(t),A.current=t,Array.isArray(t)&&t.length>0?I(t[0].type):(null===S||void 0===S?void 0:S.type)?I(S.type):I("")},[t,null===S||void 0===S?void 0:S.type]);const F=Object(o.useRef)({onChange:n,selectionMode:j,maxPorts:p});return Object(o.useEffect)(()=>{F.current={onChange:n,selectionMode:j,maxPorts:p}},[n,j,p]),Object(o.useEffect)(()=>{const e=`${E||""}::${O||""}`;if(!E&&!O)return;if(e===R.current)return;const t=A.current,{selectionMode:n,maxPorts:o}=F.current,r=n===y&&"number"===typeof o&&o>1&&Array.isArray(t)&&t.length<o;if((e=>!!e&&(Array.isArray(e)?e.length>0:Object.keys(e).length>0))(t)&&!r)return;(async()=>{try{const t=await Le({autofillLocationAddress:E,autofillLocationCode:O,supportedLocationModes:m,customer:b,userCountryCode:w});if(!t)return;const{onChange:n,selectionMode:o,maxPorts:r}=F.current,a=A.current;if(o===y&&"number"===typeof r&&r>1&&Array.isArray(a)){const e=ge(t),i=new Set((a||[]).map(e=>fe((null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.selectedValue))));if(!e||i.has(e))return;const l=be(a)||[],s=[...Array.isArray(l)?l.filter(Boolean):[],t].slice(0,r);Oe(s,o,r,_,n)}else Oe(o===y?[t]:t,o,r,_,n);R.current=e}catch(t){console.error("Error performing autofill:",t)}})()},[E,O,m,b,w]),r.a.createElement(ue,Object.assign({mode:j,dataTestId:s,hasError:l,placeholder:r.a.createElement(i.TranslatableText,{style:{fontSize:a.tokens.fdsFontSizeBase},stringId:"Select "+(c?h:v)}),value:be(L),fetchOptions:Se(x,m,b),renderedOptions:e=>((e,t)=>{if((e||[]).some(e=>{var t;return(null===e||void 0===e||null===(t=e.options)||void 0===t?void 0:t.length)>0}))return e.map(e=>{var n;const o=Object.values(f).find(t=>t.label===e.label),i=null===o||void 0===o?void 0:o.icon;return r.a.createElement(a.Select.OptGroup,{label:r.a.createElement("span",{style:{fontFamily:"Open Sans"}},r.a.createElement(a.Icon,{size:"tiny",type:i}),"\xa0 \xa0",e.label),key:e.label,"data-test-id":`${t}-group-${e.label}`},null===(n=e.options)||void 0===n?void 0:n.map(n=>{const{countryCode:o,selectedValue:l,displayLabel:s,type:c}=n;return r.a.createElement(a.Option,{value:ve(n),title:l,"data-test-id":`${t}-${e.label}-${l}`,style:{paddingLeft:"8px"},label:r.a.createElement(r.a.Fragment,null,r.a.createElement(a.Icon,{type:i,size:"tiny"}),"\xa0",r.a.createElement(C,null,l)),key:n.code},r.a.createElement(K,{fullWidth:!0,justifyContent:"space-between"},r.a.createElement(K,{spacing:k.XSMALL},r.a.createElement("span",null,r.a.createElement(a.Avatar,{type:"flag",country:o,size:"small",style:{width:a.tokens.fdsSizeSm,height:a.tokens.fdsSizeSm}})),r.a.createElement($,null,s)),c===d&&r.a.createElement(a.Icon,{type:"amazon",size:"small"}),c===u&&r.a.createElement(a.Chip,{type:"neutral",iconType:"address-book"})))}))})})(e,s),onChange:e=>{Oe(null!==e&&void 0!==e?e:[],j,p,_,n),I("")},activeLocationMode:x,maxTagPlaceholder:e=>r.a.createElement(pe,{omittedPorts:e,dataTestId:s}),defaultLocation:S},T))}}])}));
|
|
3
151
|
//# sourceMappingURL=main.bundle.js.map
|
package/build/main.bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.bundle.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,kBAAZC,SAA0C,kBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,4BAA6B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EAAgBhQ,EAAqB8P,EAC7F,MAAWC,IAAwB9Z,EAAAA,GAAYE,UAC9C0J,EAAAA,EAAAA,IAAqB,CAACkB,GAAQgP,EAAqBC,EAAgBhQ,EAAqB8P,IAExFjQ,EAAAA,EAAAA,IAAqBkB,EAAOgP,EAAqBC,EAAgBhQ,EAAqB8P,GAGvFP,EAAgChc,QAAUkc,CAC3C,CAAE,MAAOjN,GACRC,QAAQD,MAAM,6BAA8BA,EAC7C,GAGD+N,IACE,CAACjP,EAAyBC,EAAsBhD,EAAwBC,EAAUgD,KAGpFjR,EAAAA,EAAAA,KAACigB,EAAAA,GAAczR,EAAAA,EAAAA,GAAA,CACdtB,KAAMqC,EACN3Q,WAAYA,EACZwZ,SAAUA,EACV8H,aACClgB,EAAAA,EAAAA,KAACuH,EAAAA,iBAAgB,CAChB1G,MAAO,CAAEsf,SAAUpmB,EAAAA,OAAOqmB,iBAC1B5Y,SAAQ,UAAAjN,OAAYokB,EAAmB9Y,EAAAA,GAAcC,OAASD,EAAAA,GAAcE,eAG9EsC,OAAO8D,EAAAA,EAAAA,IAAsByS,GAC7B1G,cAAcpK,EAAAA,EAAAA,IAAeC,EAAoBC,EAAwBC,GACzEkK,gBAAiBxL,IAAgBD,EAAAA,EAAAA,IAAsBC,EAAc/N,GACrEqQ,SAAU5C,KACTiD,EAAAA,EAAAA,IAA6B,OAARjD,QAAQ,IAARA,EAAAA,EAAY,GAAIkD,EAAeC,EAAUC,EAAqBR,GACnF4P,EAAsB7Z,EAAAA,KAEvB+I,mBAAoBA,EACpBsS,kBAAmB5b,IAAgBzE,EAAAA,EAAAA,KAACsgB,EAAAA,EAAmB,CAAC7b,aAAcA,EAAc7F,WAAYA,IAChG0Z,gBAAiBA,GACbL,K","sources":["../webpack/universalModuleDefinition","../external umd \"@freightos/http-client\"","../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","helpers/styled.js","components/RecentSearches/apis.js","../node_modules/object-assign/index.js","components/RecentSearches/components/ShipmentAndCommodityDisplay.jsx","../node_modules/react/cjs/react-jsx-runtime.production.min.js","../external umd \"react\"","components/RecentSearches/components/TruncatedLabel.jsx","../external umd \"@freightos/design-system\"","../external umd \"@freightos/freightos-i18n\"","../node_modules/@babel/runtime/helpers/esm/typeof.js","components/MaxPortsPlaceholder.js","helpers/constant.js","../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../node_modules/@babel/runtime/helpers/esm/objectSpread2.js","components/SelectorContent.js","components/RecentSearches/styled.js","../node_modules/@babel/runtime/helpers/esm/defineProperty.js","components/RecentSearches/index.jsx","../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../node_modules/react/jsx-runtime.js","../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","common/helpers/constants.js","helpers/utils.js","components/RecentSearches/components/SearchCard.jsx","common/helpers/styled.js","components/RecentSearches/components/ItineraryDisplay.jsx","components/RecentSearches/utils.js","../external umd \"styled-components\"","common/httpClient/doRequest/index.js","components/RecentSearches/adapters.js","../external umd \"lodash\"","common/components/Flex.js","components/DebounceSelect.js","components/RecentSearches/constants.js","../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","common/helpers/Environment.js","helpers/apis.js","../webpack/bootstrap","../webpack/runtime/compat get default export","../webpack/runtime/define property getters","../webpack/runtime/hasOwnProperty shorthand","../webpack/runtime/make namespace object","index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@freightos/design-system\"), require(\"@freightos/freightos-i18n\"), require(\"@freightos/http-client\"), require(\"lodash\"), require(\"react\"), require(\"styled-components\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"FusionLocationInput\", [\"@freightos/design-system\", \"@freightos/freightos-i18n\", \"@freightos/http-client\", \"lodash\", \"react\", \"styled-components\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FusionLocationInput\"] = factory(require(\"@freightos/design-system\"), require(\"@freightos/freightos-i18n\"), require(\"@freightos/http-client\"), require(\"lodash\"), require(\"react\"), require(\"styled-components\"));\n\telse\n\t\troot[\"FusionLocationInput\"] = factory(root[\"@freightos/design-system\"], root[\"@freightos/freightos-i18n\"], root[\"@freightos/http-client\"], root[\"lodash\"], root[\"react\"], root[\"styled-components\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__186__, __WEBPACK_EXTERNAL_MODULE__198__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__773__, __WEBPACK_EXTERNAL_MODULE__155__, __WEBPACK_EXTERNAL_MODULE__694__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nfunction _objectWithoutProperties(e, t) {\n if (null == e) return {};\n var o,\n r,\n i = objectWithoutPropertiesLoose(e, t);\n if (Object.getOwnPropertySymbols) {\n var n = Object.getOwnPropertySymbols(e);\n for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);\n }\n return i;\n}\nexport { _objectWithoutProperties as default };","import { Icon, Menu, Select, tokens } from '@freightos/design-system';\r\nimport styled, { createGlobalStyle } from 'styled-components';\r\n\r\nexport const DropdownGlobalStyle = createGlobalStyle`\r\n .ant-select-dropdown {\r\n .ant-select-dropdown-menu {\r\n max-height: 400px;\r\n padding: 0 !important;\r\n margin-top: 0 !important;\r\n }\r\n }\r\n`;\r\n\r\nexport const DebounceSelector = styled(Select)`\r\n\t.ant-select-selection__rendered {\r\n\t\tmin-width: 100% !important;\r\n\t}\r\n\r\n\tli.ant-select-selection__choice {\r\n\t\tborder-radius: ${tokens.fdsBorderRadiusXl};\r\n\t\tborder: none;\r\n\t\tborder-color: ${tokens.fdsColorPrimaryBlue};\r\n\t\tcolor: ${tokens.fdsColorPrimaryBlue};\r\n\t\tbackground-color: ${tokens.fdsColorPrimaryBlue10};\r\n\t\tline-height: 10px !important;\r\n\t\tmargin-right: ${tokens.fdsComponentSpacingXxs};\r\n\t\twidth: fit-content;\r\n\t\tmax-width: 90px;\r\n\t\theight: ${tokens.fdsSizeMd} !important;\r\n\t\t${({size}) => size === 'large' ? `\r\n\t\t\tmargin-top: ${tokens.fdsComponentSpacingSm} !important;\r\n\t\t` : `\r\n\t\t\tmargin-top: 5px !important;\r\n\t\t`}\r\n\r\n\t\t.ant-select-selection__choice__remove {\r\n\t\t\tcolor: ${tokens.fdsColorPrimaryBlue};\r\n\t\t\tmargin-top: ${tokens.fdsComponentSpacingXs} !important;\r\n\t\t}\r\n\r\n\t\t.ant-select-selection__choice__content {\r\n\t\t\tline-height: ${tokens.fdsSizeMd} !important;\r\n\t\t\theight: ${tokens.fdsSizeMd} !important;\r\n\t\t}\r\n\t}\r\n\r\n\tli.ant-select-selection__choice__disabled {\r\n\t\tborder: none;\r\n\t\tbackground-color: transparent;\r\n\t\tpadding: 0;\r\n\t\tpadding-left: 0;\r\n\t\twidth: fit-content;\r\n\t}\r\n\r\n\t.ant-select-dropdown .ant-select-not-found {\r\n\t\tcursor: pointer !important;\r\n\t}\r\n\r\n\t.ant-select-selection-selected-value {\r\n\t\tmax-width: 280px !important;\r\n\t}\r\n\r\n\tli.ant-select-search.ant-select-search--inline {\r\n\t\tmargin-left: -1px !important;\r\n\t}\r\n\t.ant-select-search__field {\r\n\t\tcolor: ${tokens.fdsColorPrimaryGray80} !important;\r\n\t}\r\n\t${({ $hasError }) => $hasError && `\r\n\t\t.ant-select-selection {\r\n\t\t\tcolor: ${tokens.fdsColorSemanticRed};\r\n \t\tborder: 1px solid ${tokens.fdsColorSemanticRed};\r\n \t\tbackground-color: ${tokens.fdsColorSemanticRed10};\r\n\t\t}\r\n\r\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\r\n\t\t\tcolor: ${tokens.fdsColorSemanticRed};\r\n\t\t}\r\n\t`}\r\n`;\r\n\r\nexport const SelectedOptionLabel = styled.span`\r\n\tfont-size: ${tokens.fdsFontSizeSm} !important;\r\n`;\r\n\r\nexport const SelectOptionLabel = styled.div`\r\n\tfont-size: ${tokens.fdsFontSizeSm} !important;\r\n\toverflow: hidden;\r\n\ttext-overflow: ellipsis;\r\n\tdisplay: -webkit-box;\r\n\t-webkit-line-clamp: 2;\r\n\t-webkit-box-orient: vertical;\r\n`;\r\n\r\nexport const StyledMenu = styled(Menu)`\r\n\tcursor: pointer !important;\r\n\r\n\t.ant-menu-item-group-title {\r\n\t\tpadding: 0;\r\n\t\tcolor: ${tokens.fdsBodyTextColorDisabled};\r\n\t}\r\n\r\n\t.ant-menu-item {\r\n\t\tpadding: 0;\r\n\t\twhite-space: normal;\r\n\t\tline-height: normal;\r\n\r\n\t\t&:hover {\r\n\t\t\tbackground-color: #f5f5f5;\r\n\t\t}\r\n\t}\r\n`;\r\n\r\nexport const NoMatchingResults = styled.div`\r\n\tfont-size: ${tokens.fdsFontSizeSm};\r\n\tline-height: ${tokens.fdsSizeSm};\r\n\tfont-family: ${tokens.fdsHeadingsFontFamily};\r\n`;\r\n\r\nexport const UnitIcon = styled(Icon)`\r\n\tmargin-right: 0 !important;\r\n\tvertical-align: bottom;\r\n`;\r\n","import { doRequest } from \"../../common/httpClient/doRequest/index\";\r\nimport { WEBCARGO_ALPHA_URL } from './constants';\r\n\r\nexport const saveLastUsedSearch = async ( searchId ) => {\r\n\tawait doRequest({\r\n\t\tmethod: 'put',\r\n\t\turl: `${WEBCARGO_ALPHA_URL}/backend/api.php`,\r\n\t\toptions: {\r\n\t\t\theaders: {\r\n\t\t\t\t'namespace': 'airops/user_searches',\r\n\t\t\t\t'route': ' user_search_used',\r\n\t\t\t}\r\n\t\t},\r\n\t\tdata: {\r\n\t\t\tid: searchId,\r\n\t\t},\r\n\t});\r\n};\r\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","import React, { useMemo } from \"react\";\r\n\r\nimport { Icon } from \"@freightos/design-system\";\r\n\r\nimport Flex from \"../../../common/components/Flex\";\r\nimport { FlexSpacings } from \"../../../common/helpers/constants\";\r\nimport { SEARCH_PLATFORMS, TEMPERATURE_RANGES_DATA } from \"../constants\";\r\nimport { STinyWrapper, UnitIcon } from \"../styled\";\r\nimport { chooseIconsType, shipmentTotalsBasedOnPackages } from \"../utils\";\r\n\r\nimport TruncatedLabel from \"./TruncatedLabel.jsx\";\r\n\r\nconst ShipmentAndCommodityDisplay = ({search, index, dataTestId}) => {\r\n\tconst platformType = search.platform_type;\r\n\tconst icons = chooseIconsType(search);\r\n\tconst {units, volume, weight, weightUnit, volumeUnit} = useMemo(() => shipmentTotalsBasedOnPackages(search), [search]);\r\n\tconst isTemperature = search.commodity.length === 1 && search.commodity[0].is_temperature;\r\n\tconst temperatureRange = search.commodity_temperature?.tempRange && isTemperature \r\n\t\t? TEMPERATURE_RANGES_DATA[search.commodity_temperature?.tempRange][search.commodity_temperature?.temperatureSystem] \r\n\t\t: '';\r\n\r\n\treturn <Flex spacing={FlexSpacings.XSMALL} alignItems='center' fullWidth key={index}>\r\n\t\t{platformType === SEARCH_PLATFORMS.QUOTATION ? (\r\n\t\t\t<STinyWrapper alignItems='center' spacing={FlexSpacings.SMALL} style={{flex: 1}}>\r\n\t\t\t\t{icons.map((icon, iconIndex) => <UnitIcon type={icon} key={`${index}-${iconIndex}`} size='tiny' data-test-id={`${dataTestId}rs-package-icon-${index}-${iconIndex}`} />)}\r\n\t\t\t\t<TruncatedLabel\r\n\t\t\t\t\ttext={search.commodity.map(commodity => commodity.label).join(', ')}\r\n\t\t\t\t\ttestId={`${dataTestId}rs-commodity-${index}`}\r\n\t\t\t\t/>\r\n\t\t\t</STinyWrapper>\r\n\t\t) : (\r\n\t\t\t<STinyWrapper alignItems='center' spacing={FlexSpacings.SMALL}>\r\n\t\t\t\t<Flex\r\n\t\t\t\t\talignItems='center'\r\n\t\t\t\t\tspacing={FlexSpacings.XSMALL}\r\n\t\t\t\t\tdata-test-id={`rs-${index}-units`}\r\n\t\t\t\t\t\r\n\t\t\t\t>\r\n\t\t\t\t\t{units} {icons.map((icon, iconIndex) => <UnitIcon type={icon} key={`${index}-${iconIndex}`} size='tiny' data-test-id={`${dataTestId}rs-package-icon-${index}-${iconIndex}`}/>)}\r\n\t\t\t\t</Flex>\r\n\t\t\t\t<span data-test-id={`${dataTestId}rs-volume-${index}`}>\r\n\t\t\t\t\t{volume} {volumeUnit}\r\n\t\t\t\t</span>\r\n\t\t\t\t{weight && (\r\n\t\t\t\t\t<span data-test-id={`${dataTestId}rs-weight-${index}`}>\r\n\t\t\t\t\t\t{weight} {weightUnit}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t)}\r\n\t\t\t\t<TruncatedLabel\r\n\t\t\t\t\ttext={search.commodity.map(commodity => commodity.label).join(', ')}\r\n\t\t\t\t\ttestId={`${dataTestId}rs-commodity-${index}`}\r\n\t\t\t\t/>\r\n\t\t\t\t{isTemperature && (\r\n\t\t\t\t\t<Flex\r\n\t\t\t\t\t\talignItems='center'\r\n\t\t\t\t\t\tspacing={FlexSpacings.XSMALL}\r\n\t\t\t\t\t\tdata-test-id={`${dataTestId}rs-temperature-${index}`}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<Icon type='temperature-low' size=\"tiny\" data-test-id={`${dataTestId}rs-temperature-icon-${index}`} />\r\n\t\t\t\t\t\t<span style={{whiteSpace: 'nowrap'}}>\r\n\t\t\t\t\t\t\t{temperatureRange}\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t</Flex>\r\n\t\t\t\t)}\r\n\t\t\t</STinyWrapper>\r\n\t\t)}\r\n\t</Flex>;\r\n};\r\n\r\nexport default ShipmentAndCommodityDisplay;","/** @license React v17.0.2\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';require(\"object-assign\");var f=require(\"react\"),g=60103;exports.Fragment=60107;if(\"function\"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h(\"react.element\");exports.Fragment=h(\"react.fragment\")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=\"\"+k);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__155__;","import React, { useEffect, useRef, useState } from \"react\";\r\n\r\nimport { Tooltip } from \"@freightos/design-system\";\r\n\r\nimport { STruncatedLabel } from \"../styled\";\r\n\r\n/**\r\n * TruncatedLabel component that automatically detects text truncation\r\n * and shows a tooltip with full text when content is truncated with ellipsis\r\n */\r\nconst TruncatedLabel = ({ \r\n\ttext = '', \r\n\ttestId, \r\n\tisPort = undefined,\r\n\tisLocationLabel = false,\r\n\tchildren = null\r\n}) => {\r\n\tconst labelRef = useRef(null);\r\n\tconst [isTruncated, setIsTruncated] = useState(false);\r\n\r\n\t/**\r\n\t * Check if the label text is truncated by comparing scroll width vs client width\r\n\t */\r\n\tconst checkTruncation = () => {\r\n\t\tif (labelRef.current) {\r\n\t\t\tconst element = labelRef.current;\r\n\t\t\tconst truncated = element.scrollWidth > element.clientWidth;\r\n\t\t\tsetIsTruncated(truncated);\r\n\t\t}\r\n\t};\r\n\r\n\t// Check truncation on mount and when text changes\r\n\tuseEffect(() => {\r\n\t\tcheckTruncation();\r\n\t}, [text]);\r\n\r\n\tconst labelElement = (\r\n\t\t<STruncatedLabel \r\n\t\t\tref={labelRef}\r\n\t\t\tdata-test-id={testId}\r\n\t\t\t$isLocationLabel={isLocationLabel}\r\n\t\t\t$isPort={isPort}\r\n\t\t>\r\n\t\t\t{children || text}\r\n\t\t</STruncatedLabel>\r\n\t);\r\n\r\n\t// Only show tooltip if text is actually truncated\r\n\tif (isTruncated) {\r\n\t\treturn (\r\n\t\t\t<Tooltip title={text} data-test-id={`${testId}-tooltip`}>\r\n\t\t\t\t<STruncatedLabel \r\n\t\t\t\t\tref={labelRef}\r\n\t\t\t\t\tdata-test-id={testId}\r\n\t\t\t\t\t$isLocationLabel={isLocationLabel}\r\n\t\t\t\t\t$isPort={isPort}\r\n\t\t\t\t>\r\n\t\t\t\t\t{children || text}\r\n\t\t\t\t</STruncatedLabel>\r\n\t\t\t</Tooltip>\r\n\t\t);\r\n\t}\r\n\r\n\treturn labelElement;\r\n};\r\n\r\nexport default TruncatedLabel; ","module.exports = __WEBPACK_EXTERNAL_MODULE__186__;","module.exports = __WEBPACK_EXTERNAL_MODULE__198__;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import React from 'react';\r\n\r\nimport { Tooltip } from '@freightos/design-system';\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { SelectedOptionLabel } from '../helpers/styled';\r\n\r\nconst MaxPortsPlaceholder = ({ omittedPorts, dataTestId }) => {\r\n\tconst selectedItems = omittedPorts.map(omittedPort => JSON.parse(omittedPort.key)?.selectedValue);\r\n\r\n\treturn (\r\n\t\t<Tooltip title={selectedItems.join(',')}>\r\n\t\t\t<SelectedOptionLabel data-test-id={`${dataTestId}-extra-ports`}>{`+${omittedPorts.length}`}</SelectedOptionLabel>\r\n\t\t</Tooltip>\r\n\t);\r\n};\r\n\r\nMaxPortsPlaceholder.propTypes = {\r\n\tomittedPorts: PropTypes.array,\r\n\tdataTestId: PropTypes.string,\r\n};\r\n\r\nexport default MaxPortsPlaceholder;\r\n","/**\r\n * Default location mode used when no specific mode is selected.\r\n * @type {string}\r\n */\r\nexport const DEFAULT_LOCATION_MODE = '';\r\n\r\nexport const LOCATION_MODES = {\r\n\tAIRPORT: 'airport',\r\n\tSEAPORT: 'seaport',\r\n\tFULFILLMENT_CENTER: 'fulfillment_center',\r\n\tADDRESS_BOOK: 'address_book',\r\n\tLAST_MILE_ADDRESS: 'last_mile_address',\r\n\tADDRESS: 'address',\r\n};\r\n\r\nexport const LOCATION_MODES_MAP = {\r\n\t[LOCATION_MODES.AIRPORT]: { label: 'Airports', key: LOCATION_MODES.AIRPORT, icon: 'mode-air' },\r\n\t[LOCATION_MODES.SEAPORT]: { label: 'Ports', key: LOCATION_MODES.SEAPORT, icon: 'mode-ship' },\r\n\t[LOCATION_MODES.FULFILLMENT_CENTER]: {\r\n\t\tlabel: 'Fulfillment centers',\r\n\t\tkey: LOCATION_MODES.FULFILLMENT_CENTER,\r\n\t\ticon: 'fulfillment-center',\r\n\t},\r\n\t[LOCATION_MODES.ADDRESS_BOOK]: { key: LOCATION_MODES.ADDRESS_BOOK, groupedBy: 'address' },\r\n\t[LOCATION_MODES.LAST_MILE_ADDRESS]: { key: LOCATION_MODES.LAST_MILE_ADDRESS, groupedBy: 'address' },\r\n\t[LOCATION_MODES.ADDRESS]: { label: 'Address', key: LOCATION_MODES.ADDRESS, icon: 'location' },\r\n};\r\n\r\n/**\r\n * Enumeration of selection modes for location input.\r\n * @enum {string}\r\n */\r\nexport const SelectModes = {\r\n\tSINGLE: 'single',\r\n\tMULTIPLE: 'multiple',\r\n};\r\n\r\n/**\r\n * Enumeration of location types for origin and destination.\r\n * @enum {string}\r\n */\r\nexport const LocationTypes = {\r\n\tORIGIN: 'origin',\r\n\tDESTINATION: 'destination',\r\n};\r\n\r\nexport const MAX_TAG_COUNT = 3;\r\nexport const MAX_TAG_COUNT_MULTIPLE = 2;\r\n","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import defineProperty from \"./defineProperty.js\";\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nexport { _objectSpread2 as default };","import React from 'react';\r\n\r\nimport { Spin } from '@freightos/design-system';\r\nimport { TRANSLATION_MODULES, TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { NoMatchingResults } from '../helpers/styled';\r\n\r\nimport RecentSearches from './RecentSearches/index.jsx';\r\n\r\nconst SelectorContent = ({ \r\n\tisLoading, \r\n\trecentSearches, \r\n\tsearchKey, \r\n\tdataTestId, \r\n\tsetIsOpen, \r\n\tonRecentSearchSelect, \r\n\tinitialValues }) => {\r\n\t// Return null for initial state (no search, no recent searches)\r\n\tif (!searchKey && (!recentSearches || recentSearches.length === 0)) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tif (isLoading) {\r\n\t\treturn <Spin size='small' />;\r\n\t}\r\n\r\n\tif (recentSearches?.length > 0 && !searchKey.trim()) {\r\n\t\treturn (\r\n\t\t\t<RecentSearches\r\n\t\t\t\trecentSearches={recentSearches}\r\n\t\t\t\tdataTestId={dataTestId}\r\n\t\t\t\tsetIsOpen={setIsOpen}\r\n\t\t\t\tonRecentSearchSelect={onRecentSearchSelect}\r\n\t\t\t\tinitialValues={initialValues}\r\n\t\t\t/>\r\n\t\t);\r\n\t}\r\n\r\n\tif (searchKey.trim()) {\r\n\t\treturn (\r\n\t\t\t<NoMatchingResults>\r\n\t\t\t\t<TranslatableText stringId='No matching results' module={TRANSLATION_MODULES.SearchAndBook} />\r\n\t\t\t</NoMatchingResults>\r\n\t\t);\r\n\t}\r\n\r\n\treturn null;\r\n};\r\n\r\nSelectorContent.propTypes = {\r\n\tisLoading: PropTypes.bool,\r\n\trecentSearches: PropTypes.array,\r\n\tsearchKey: PropTypes.string,\r\n\tonSelect: PropTypes.func,\r\n\tdataTestId: PropTypes.string,\r\n\tsetIsOpen: PropTypes.func,\r\n};\r\n\r\nexport default SelectorContent;\r\n","import { Avatar, Icon, tokens } from '@freightos/design-system';\r\n\r\nimport styled from 'styled-components';\r\n\r\nimport Flex from '../../common/components/Flex';\r\n\r\nexport const STitle = styled.div`\r\n\tcolor: ${tokens.fdsColorPrimaryGray60};\r\n\tfont-size: ${tokens.fdsSizeXs};\r\n\tfont-weight: ${tokens.fdsFontWeightRegular};\r\n\tmargin-bottom: ${tokens.fdsComponentSpacingSm};\r\n\ti {\r\n\t\tmargin-right: ${tokens.fdsComponentSpacingSm};\r\n\t}\r\n\r\n`;\r\n\r\nexport const SCard = styled(Flex)`\r\n\tpadding-left: 0 !important;\r\n`;\r\n\r\nexport const UnitIcon = styled(Icon)`\r\n\tmargin-right: 0 !important;\r\n\tvertical-align: bottom;\r\n`;\r\n\r\nexport const STruncatedLabel = styled.span`\r\n\twhite-space: nowrap;\r\n\tmin-width: 0;\r\n\tcolor: ${tokens.fdsColorPrimaryGray80};\r\n\toverflow: hidden;\r\n\ttext-overflow: ellipsis;\r\n\t${({$isLocationLabel}) => !$isLocationLabel && `\r\n\t\tfont-size: 10px; //TODO: FSN-145\r\n\t\tline-height: 15px;\r\n\t`}\r\n\t${({$isPort}) => {\r\n\t\tif ($isPort === undefined)\r\n\t\t\treturn;\r\n\r\n\t\treturn `min-width: ${$isPort ? '65px' : '55px'};`\r\n\t}};\r\n`;\r\n\r\nexport const SLocationFlag = styled(Avatar)`\r\n\tborder: 1px solid ${tokens.fdsColorPrimaryGray20};\r\n\twidth: ${tokens.fdsSizeSm};\r\n\theight: ${tokens.fdsSizeSm};\r\n`;\r\n\r\nexport const STinyWrapper = styled(Flex)`\r\n\toverflow: hidden !important;\r\n\tfont-size: 10px; //TODO: FSN-145\r\n\tline-height: 15px;\r\n\tflex: 1;\r\n\tmin-width: 0;\r\n`;\r\n\r\nexport const SListWrapper = styled(Flex)`\r\n\t:last-child {\r\n\t\tpadding-bottom: 0 !important;\r\n\t}\r\n`;\r\n\r\n","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","import React from 'react';\r\n\r\nimport { Icon, tokens } from '@freightos/design-system';\r\nimport { TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport { FlexDirections } from '../../common/helpers/constants';\r\nimport { StyledMenu } from '../../helpers/styled';\r\n\r\nimport { orderRecentSearches } from './adapters';\r\nimport { SearchCard } from './components/SearchCard.jsx';\r\nimport { SListWrapper, STitle } from './styled';\r\n\r\nconst RecentSearches = ({ recentSearches, setIsOpen, dataTestId, onRecentSearchSelect, initialValues }) => {\r\n\tconst firstSixSearches = recentSearches ? orderRecentSearches(recentSearches) : [];\r\n\treturn (\r\n\t\t<StyledMenu>\r\n\t\t\t<STitle>\r\n\t\t\t\t<Icon data-test-id={`${dataTestId}rs-icon`} color={tokens.fdsColorPrimaryGray60} type='history' size='tiny' /><TranslatableText stringId='Recent searches' />\r\n\t\t\t</STitle>\r\n\t\t\t<SListWrapper direction={FlexDirections.VERTICAL} fullWidth>\r\n\t\t\t\t{firstSixSearches.map((search, index) => (\r\n\t\t\t\t\t<SearchCard \r\n\t\t\t\t\t\tonRecentSearchSelect={onRecentSearchSelect} \r\n\t\t\t\t\t\tinitialValues={initialValues} \r\n\t\t\t\t\t\tsearch={search} \r\n\t\t\t\t\t\tindex={index} \r\n\t\t\t\t\t\tkey={search.id}\r\n\t\t\t\t\t\tsetIsOpen={setIsOpen} dataTestId={dataTestId} />\r\n\t\t\t\t))}\r\n\t\t\t</SListWrapper>\r\n\t\t</StyledMenu>\r\n\t);\r\n};\r\n\r\nexport default RecentSearches;\r\n","function _taggedTemplateLiteral(e, t) {\n return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {\n raw: {\n value: Object.freeze(t)\n }\n }));\n}\nexport { _taggedTemplateLiteral as default };","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };","import { tokens } from '@freightos/design-system';\r\n\r\nexport const FlexSpacings = {\r\n\tXXLARGE: tokens.fdsComponentSpacingXxl,\r\n\tXLARGE: tokens.fdsComponentSpacingXl,\r\n\tLARGE: tokens.fdsComponentSpacingLg,\r\n\tMEDIUM: tokens.fdsComponentSpacingMd,\r\n\tSMALL: tokens.fdsComponentSpacingSm,\r\n\tXSMALL: tokens.fdsComponentSpacingXs,\r\n\tXXSMALL: tokens.fdsComponentSpacingXxs,\r\n\tNONE: 0,\r\n};\r\n\r\nexport const FlexDirections = {\r\n\tVERTICAL: 'vertical',\r\n\tHORIZONTAL: 'horizontal',\r\n};\r\n","import React from 'react';\r\n\r\nimport { Avatar, Chip, Icon, Message, Option, Select, tokens } from '@freightos/design-system';\r\nimport { TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport Flex from 'common/components/Flex';\r\nimport { FlexSpacings } from '../common/helpers/constants';\r\nimport { getLocations } from './apis';\r\nimport { DEFAULT_LOCATION_MODE, LOCATION_MODES, LOCATION_MODES_MAP, SelectModes } from './constant';\r\nimport { SelectOptionLabel, SelectedOptionLabel } from './styled';\r\n\r\nimport Environment from '../common/helpers/Environment';\r\n\r\n/**\r\n * Normalizes location/port codes for comparisons.\r\n */\r\nexport const normalizeLocationCode = (code) => (code || '').trim().toUpperCase();\r\n\r\n/**\r\n * Safely parses a serialized option key (JSON) into an object.\r\n */\r\nexport const safeParseOptionKey = (key) => {\r\n\ttry {\r\n\t\treturn typeof key === 'string' ? JSON.parse(key) : null;\r\n\t} catch {\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\n/**\r\n * Extracts a normalized code from an autofill match option.\r\n */\r\nexport const getNormalizedCodeFromMatchOption = (matchOption) => {\r\n\tconst matchObj = safeParseOptionKey(matchOption?.key);\r\n\treturn normalizeLocationCode(matchObj?.code || matchObj?.selectedValue);\r\n};\r\n\r\n/**\r\n * Returns a Set of normalized codes from the current selected locations array.\r\n */\r\nexport const getExistingNormalizedCodes = (locations) =>\r\n\tnew Set((locations || []).map((loc) => normalizeLocationCode(loc?.code || loc?.selectedValue)));\r\n\r\n/**\r\n * Get the gateway API prefix based on the environment.\r\n *\r\n * @returns {string} The gateway API prefix.\r\n */\r\nexport const getGatewayApiPrefix = (isTalaia) => {\r\n\tconst domain = Environment.isProduction()\r\n\t\t? 'freightos.com'\r\n\t\t: 'test-freightos.com';\r\n\treturn `https://platform.${domain}/gateway/${isTalaia ? 'webcargo-talaia' : 'webcargo-alpha'}`;\r\n};\r\n\r\n// Deterministic JSON stringify\r\nconst stableStringify = (obj) => {\r\n const allKeys = [];\r\n JSON.stringify(obj, (k, v) => {\r\n\tallKeys.push(k);\r\n\treturn v;\r\n });\r\n const uniqSortedKeys = Array.from(new Set(allKeys)).sort();\r\n return JSON.stringify(obj, uniqSortedKeys);\r\n};\r\n\r\nconst normalizeLocationForKey = (loc) => {\r\n const {\r\n displayLabel,\r\n selectedValue,\r\n formattedNameOrAddress,\r\n code,\r\n countryCode,\r\n stateOrProvince,\r\n city,\r\n latitude,\r\n longitude,\r\n postalOrZipCode,\r\n sourceType,\r\n locationType,\r\n type,\r\n\tcountryName,\r\n } = loc || {};\r\n\r\n return {\r\n displayLabel,\r\n selectedValue: selectedValue || code,\r\n formattedNameOrAddress,\r\n code: code || selectedValue,\r\n country: countryCode,\r\n\tcountryName,\r\n stateOrProvince: stateOrProvince ?? null,\r\n city: city ?? null,\r\n latitude: latitude ?? null,\r\n longitude: longitude ?? null,\r\n postalOrZipCode: postalOrZipCode ?? null,\r\n sourceType: sourceType ?? null,\r\n locationType: locationType ?? null,\r\n type: type ?? sourceType,\r\n };\r\n};\r\n\r\nexport const stableKeyFromLocation = (loc) => {\r\n try {\r\n const parsed = typeof loc?.key === 'string'\r\n ? JSON.parse(decodeHtmlEntities(loc.key))\r\n : loc;\r\n return stableStringify(normalizeLocationForKey(parsed));\r\n } catch {\r\n return stableStringify(normalizeLocationForKey(loc));\r\n }\r\n};\r\n\r\n/**\r\n * Get location input option.\r\n *\r\n * @param {Object} location - The location object to get the option for.\r\n * @returns {Object} The location input option.\r\n */\r\nexport const getLocationInputOption = (location) => {\r\n\tif(location) {\r\n \t\tconst displayLabel = location.label || location.selectedValue;\r\n \t\tconst key = stableKeyFromLocation(location);\r\n\r\n \t\tconst label = displayLabel\r\n \t\t ? (\r\n \t\t <>\r\n \t\t <Icon type={location.sourceType ? LOCATION_MODES_MAP[location.sourceType]?.icon : 'location'} size='tiny' />\r\n \t\t \r\n \t\t <SelectedOptionLabel>{displayLabel}</SelectedOptionLabel>\r\n \t\t </>\r\n \t\t )\r\n \t\t : undefined;\r\n\r\n \t\treturn { key, label };\r\n\t} \r\n\treturn undefined;\r\n};\r\n\r\n/**\r\n * Formats location(s) into option(s) with key and label for the location input.\r\n *\r\n * @param {Object|Array} locations - Single location object or array of location objects.\r\n * @returns {Object|Array} Formatted option(s) with key and label.\r\n * - For single location: Returns {key: string, label: ReactElement}.\r\n * - For multiple locations: Returns array of {key: string, label: ReactElement}.\r\n */\r\nexport const getLocationInputValue = locations => {\r\n\tconst formatLocation = loc => getLocationInputOption(loc);\r\n\treturn Array.isArray(locations) ? locations.map(formatLocation) : formatLocation(locations);\r\n};\r\n\r\n/**\r\n * Renders location options (ports and addresses) in a select dropdown with icons and grouping.\r\n *\r\n * @param {Array} locationOptions - Array of location option groups to render.\r\n * @param {string} dataTestId - Test ID prefix for components.\r\n * @returns {Array<ReactElement>} Array of Select.OptGroup components containing the location options.\r\n *\r\n * @example\r\n * Location options format:\r\n * [\r\n * {\r\n * label: \"seaport\",\r\n * options: [{\r\n * label: \"Port Name\",\r\n * key: \"{...port data...}\"\r\n * }]\r\n * }\r\n * ]\r\n */\r\nexport const renderLocationOptions = (optionGroups, dataTestId) => {\r\n\r\n\tif (!(optionGroups || []).some(group => group?.options?.length > 0) )\r\n\t\treturn;\r\n\r\n\treturn optionGroups.map(group => {\r\n\t\tconst location = Object.values(LOCATION_MODES_MAP).find(mode => mode.label === group.label);\r\n\t\tconst locationOptionIcon = location?.icon;\r\n\r\n\t\treturn (\r\n\t\t\t<Select.OptGroup\r\n\t\t\t\tlabel={\r\n\t\t\t\t\t<span style={{fontFamily: 'Open Sans'}}>\r\n\t\t\t\t\t\t<Icon size='tiny' type={locationOptionIcon} />\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t{group.label}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t}\r\n\t\t\t\tkey={group.label}\r\n\t\t\t\tdata-test-id={`${dataTestId}-group-${group.label}`}\r\n\t\t\t>\r\n\t\t\t\t{group.options?.map(option => {\r\n\t\t\t\t\tconst { countryCode, selectedValue, displayLabel, type } = option;\r\n\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t<Option\r\n\t\t\t\t\t\t\tvalue={stableKeyFromLocation(option)}\r\n\t\t\t\t\t\t\ttitle={selectedValue}\r\n\t\t\t\t\t\t\tdata-test-id={`${dataTestId}-${group.label}-${selectedValue}`}\r\n\t\t\t\t\t\t\tstyle={{ paddingLeft: '8px' }}\r\n\t\t\t\t\t\t\tlabel={<>\r\n\t\t\t\t\t\t\t\t\t<Icon type={locationOptionIcon} size='tiny' />\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t<SelectedOptionLabel>{selectedValue}</SelectedOptionLabel>\r\n\t\t\t\t\t\t\t\t</>\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tkey={option.code}\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t<Flex fullWidth justifyContent='space-between'>\r\n\t\t\t\t\t\t\t\t<Flex spacing={FlexSpacings.XSMALL}>\r\n\t\t\t\t\t\t\t\t\t<span>\r\n\t\t\t\t\t\t\t\t\t\t<Avatar\r\n\t\t\t\t\t\t\t\t\t\t\ttype='flag'\r\n\t\t\t\t\t\t\t\t\t\t\tcountry={countryCode}\r\n\t\t\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\t\t\t\t\t\t\twidth: tokens.fdsSizeSm,\r\n\t\t\t\t\t\t\t\t\t\t\t\theight: tokens.fdsSizeSm,\r\n\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t\t\t<SelectOptionLabel>{displayLabel}</SelectOptionLabel>\r\n\t\t\t\t\t\t\t\t</Flex>\r\n\t\t\t\t\t\t\t\t{type === LOCATION_MODES.FULFILLMENT_CENTER && <Icon type='amazon' size='small' />}\r\n\t\t\t\t\t\t\t\t{type === LOCATION_MODES.ADDRESS_BOOK && <Chip type='neutral' iconType='address-book' />}\r\n\t\t\t\t\t\t\t</Flex>\r\n\t\t\t\t\t\t</Option>\r\n\t\t\t\t\t);\r\n\t\t\t\t})}\r\n\t\t\t</Select.OptGroup>\r\n\t\t);\r\n\t});\r\n};\r\n\r\n/**\r\n * Extracts fulfillment centers from addresses and adds them as a separate key in results\r\n * @param {Object} locationsResults - The locations results object\r\n * @param {string} addressKey - The key for addresses (default: 'address')\r\n * @returns {Object} Updated locations results with fulfillment centers separated\r\n */\r\nconst extractFulfillmentCenters = locationsResults => {\r\n\tlet updatedLocationsResults = { ...locationsResults };\r\n\t// Extract fulfillment centers from addresses\r\n\tconst fulfillmentCenters = locationsResults[LOCATION_MODES.ADDRESS].filter(\r\n\t\toption => option.sourceType === LOCATION_MODES.FULFILLMENT_CENTER\r\n\t);\r\n\t// Add fulfillment centers as a separate key in results\r\n\tif (fulfillmentCenters.length > 0) {\r\n\t\t// Create new object with specific order\r\n\t\tconst { address, ...otherTypes } = updatedLocationsResults;\r\n\t\tupdatedLocationsResults = {\r\n\t\t\t...otherTypes,\r\n\t\t\t[LOCATION_MODES.FULFILLMENT_CENTER]: fulfillmentCenters,\r\n\t\t\taddress: address.filter(option => option.type !== LOCATION_MODES.FULFILLMENT_CENTER),\r\n\t\t};\r\n\t}\r\n\r\n\treturn updatedLocationsResults;\r\n};\r\n\r\n/**\r\n * Fetches location data for the active location mode or supported modes.\r\n *\r\n * @param {string} activeLocationMode - The active location mode.\r\n * @param {Array} supportedLocationModes - Array of supported location modes.\r\n * @returns {Function} A function that takes a query string and returns a promise resolving to an array of formatted location objects.\r\n */\r\nexport const fetchLocations = (activeLocationMode, supportedLocationModes, customer) => async query => {\r\n\tif (!query) {\r\n\t\treturn [];\r\n\t}\r\n\r\n\tconst modes = activeLocationMode !== DEFAULT_LOCATION_MODE ? [activeLocationMode] : supportedLocationModes;\r\n\tconst locations = await getLocations(modes, query, customer);\r\n\r\n\tlet locationsResults = locations.results;\r\n\r\n\tif (locationsResults[LOCATION_MODES.ADDRESS]) {\r\n\t\tlocationsResults = extractFulfillmentCenters(locationsResults);\r\n\t}\t\r\n\r\n\treturn Object.keys(locationsResults).map(key => {\r\n\t\treturn {\r\n\t\t\tlabel: LOCATION_MODES_MAP[key]?.label || key,\r\n\t\t\toptions: locationsResults[key].map(option => ({\r\n\t\t\t\t...option,\r\n\t\t\t\ttype: option.sourceType,\r\n\t\t\t})),\r\n\t\t};\r\n\t});\r\n};\r\n\r\n/**\r\n * Processes location input changes by retrieving geocoder details for addresses\r\n * or transforming port locations into a standardized format.\r\n *\r\n * For addresses (with placeId), fetches full geocoder details.\r\n * For ports, transforms them into geocoder address schema.\r\n * Filters out any failed location processing.\r\n *\r\n * @param {Object|Array} changedLocations - The new location value(s) to process.\r\n * @param {Function} onChange - Callback to handle the processed location(s).\r\n */\r\nexport const onChangeLocation = async (changedLocations, onChange) => {\r\n\tconst locations = Array.isArray(changedLocations) ? changedLocations : [changedLocations];\r\n\r\n\tconst locationsDetails = await Promise.all(\r\n\t\tlocations.map(async location => {\r\n\t\t\ttry {\r\n\t\t\t\tconst raw = location?.key;\r\n\t\t\t\tconst json = decodeHtmlEntities(raw);\r\n\t\t\t\tconst parsed = JSON.parse(json);\r\n\t\t\t\treturn { key: json, ...parsed };\r\n\t\t\t} catch (err) {\r\n\t\t\t\t// Useful in case one of the addresses has encountered a failure while retrieving its details\r\n\t\t\t\t// It won't cause all the addresses to stop working properly\r\n\t\t\t\treturn undefined;\r\n\t\t\t}\r\n\t\t})\r\n\t);\r\n\r\n\tonChange(locationsDetails.filter(Boolean));\r\n};\r\n\r\n/**\r\n * Handles changes to the location input value.\r\n *\r\n * @param {Object|Array} location - The new location value(s) selected.\r\n * @param {string} selectionMode - The current selection mode ('single' or 'multiple').\r\n * @param {number} maxPorts - Maximum number of ports that can be selected in multiple mode.\r\n * @param {Function} setSelectedLocation - State setter for the selected location.\r\n * @param {Function} onChange - Callback to handle processed location changes.\r\n *\r\n * For multiple selection mode:\r\n * - Validates that selected ports don't exceed maxPorts limit.\r\n * - Shows error message if limit is exceeded.\r\n * - Updates state and triggers onChange with valid selections.\r\n *\r\n * For single selection mode:\r\n * - Updates selected location state directly.\r\n * - Triggers onChange with the new location if one is selected.\r\n */\r\nexport const handleLocationChange = (location, selectionMode, maxPorts, setSelectedLocation, onChange) => {\r\n\tif (selectionMode === SelectModes.MULTIPLE) {\r\n\t\tconst selectedPorts = Array.isArray(location) ? location : [];\r\n\t\tif (selectedPorts.length <= maxPorts) {\r\n\t\t\tsetSelectedLocation(selectedPorts);\r\n\t\t\tonChangeLocation(selectedPorts, onChange);\r\n\t\t} else {\r\n\t\t\tconst typePort = JSON.parse(selectedPorts[0]?.key)?.sourceType === LOCATION_MODES.AIRPORT ? (maxPorts > 1 ? 'airports' : 'airport') : (maxPorts > 1 ? 'ports' : 'port');\r\n\t\t\tMessage.danger(\r\n\t\t\t\t<>\r\n\t\t\t\t\t<TranslatableText stringId={'You cannot enter more than'}/>\r\n\t\t\t\t\t{' '} {maxPorts} {' '}\r\n\t\t\t\t\t<TranslatableText stringId={typePort} />\r\n\t\t\t\t</>\r\n\t\t\t);\r\n\t\t}\r\n\t} else {\r\n\t\tsetSelectedLocation(location);\r\n\t\tonChangeLocation(location, onChange);\r\n\t}\r\n};\r\n\r\n/**\r\n * Check if the location is an address\r\n * @param location - The location to check\r\n * @returns Whether the location is an address\r\n */\r\nexport const isLocationAddress = locationType =>\r\n\tlocationType &&\r\n\t(locationType === LOCATION_MODES.ADDRESS ||\r\n\t\tlocationType === LOCATION_MODES.LAST_MILE_ADDRESS ||\r\n\t\tlocationType === LOCATION_MODES.ADDRESS_BOOK ||\r\n\t\tlocationType === LOCATION_MODES.FULFILLMENT_CENTER);\r\n\r\nconst decodeHtmlEntities = (s) =>\r\n typeof s === 'string'\r\n ? s.replace(/"/g, '\"').replace(/"/g, '\"').replace(/&/g, '&')\r\n : s;\r\n\r\n/**\r\n * Extracts street address from displayLabel.\r\n * Expected format: \"COUNTRY_CODE - Street Address, City, State\"\r\n * Example: \"US - 123 Main St, New York, NY\" → \"123 Main St\"\r\n */\r\nconst DISPLAY_LABEL_STREET_PATTERN = /^[^-]*-\\s*(.+?),/;\r\n\r\n/**\r\n * Escapes special regex characters in a string.\r\n */\r\nconst escapeRegex = (str) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n\r\n/**\r\n * Checks if address matches the search query.\r\n */\r\nconst isAddressMatch = (address, searchQuery) => {\r\n\tif (!address.displayLabel) return false;\r\n\r\n\tconst matchResult = address.displayLabel.match(DISPLAY_LABEL_STREET_PATTERN);\r\n\tif (!matchResult?.[1]) return false;\r\n\r\n\tconst streetAddress = matchResult[1].trim();\r\n\tconst searchTerms = searchQuery.trim().split(/\\s+/).map(escapeRegex);\r\n\tconst searchPattern = new RegExp(`\\\\b${searchTerms.join('\\\\s+')}\\\\b`, 'i');\r\n\r\n\treturn searchPattern.test(streetAddress);\r\n};\r\n\r\n/**\r\n * Finds matching addresses from location results.\r\n */\r\nconst findMatchingAddresses = (locationsResults, searchQuery) => {\r\n\tconst addressResults = locationsResults[LOCATION_MODES.ADDRESS] || [];\r\n\tconst fulfillmentResults = locationsResults[LOCATION_MODES.FULFILLMENT_CENTER] || [];\r\n\r\n\treturn [...addressResults, ...fulfillmentResults].filter(\r\n\t\t(address) => isAddressMatch(address, searchQuery)\r\n\t);\r\n};\r\n\r\n/**\r\n * Selects best match from addresses, preferring user's country.\r\n */\r\nconst selectBestAddressMatch = (addresses, userCountryCode) => {\r\n\tif (addresses.length === 0) return null;\r\n\tif (addresses.length === 1 || !userCountryCode) return addresses[0];\r\n\r\n\tconst countryMatch = addresses.find(\r\n\t\t(addr) => addr.countryCode?.toLowerCase() === userCountryCode.toLowerCase()\r\n\t);\r\n\r\n\treturn countryMatch || addresses[0];\r\n};\r\n\r\n/**\r\n * Finds a port match by exact code.\r\n */\r\nconst findPortMatch = (locationsResults, portCode) => {\r\n\tconst airportResults = locationsResults[LOCATION_MODES.AIRPORT] || [];\r\n\tconst seaportResults = locationsResults[LOCATION_MODES.SEAPORT] || [];\r\n\r\n\tconst normalizedPortCode = normalizeLocationCode(portCode);\r\n\r\n\treturn [...airportResults, ...seaportResults].find((port) => normalizeLocationCode(port?.code) === normalizedPortCode);\r\n};\r\n\r\n/**\r\n * Formats a location match for selection.\r\n */\r\nconst formatLocationForSelection = (location) => {\r\n\tconst selectedValue = location.selectedValue || location.displayLabel || location.code;\r\n\r\n\tconst formatted = {\r\n\t\t...location,\r\n\t\tselectedValue,\r\n\t\tdisplayLabel: location.displayLabel || selectedValue,\r\n\t\tcountry: location.countryCode || location.country,\r\n\t\ttype: location.type || location.sourceType,\r\n\t};\r\n\r\n\t// Remove redundant countryCode if country is set\r\n\tif (formatted.country) {\r\n\t\tdelete formatted.countryCode;\r\n\t}\r\n\r\n\treturn {\r\n\t\tkey: JSON.stringify(formatted),\r\n\t\tlabel: selectedValue,\r\n\t};\r\n};\r\n\r\n/**\r\n * Checks if the input already has a value.\r\n */\r\nexport const hasExistingValue = (value) => {\r\n\tif (!value) return false;\r\n\treturn Array.isArray(value) ? value.length > 0 : Object.keys(value).length > 0;\r\n};\r\n\r\n/**\r\n * Finds autofill match based on address or port code.\r\n * Tries address match first, falls back to port code match.\r\n *\r\n * @returns {Object|null} Formatted location match or null if no match found\r\n */\r\nexport const findAutofillMatch = async ({\r\n\tautofillLocationAddress,\r\n\tautofillLocationCode,\r\n\tsupportedLocationModes,\r\n\tcustomer,\r\n\tuserCountryCode,\r\n}) => {\r\n\tif (!autofillLocationAddress && !autofillLocationCode) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tlet match = null;\r\n\r\n\t// Try address match first\r\n\tif (autofillLocationAddress) {\r\n\t\tconst { results = {} } = await getLocations(supportedLocationModes, autofillLocationAddress, customer);\r\n\t\tconst matchingAddresses = findMatchingAddresses(results, autofillLocationAddress);\r\n\t\tmatch = selectBestAddressMatch(matchingAddresses, userCountryCode);\r\n\t}\r\n\r\n\t// Fall back to port code match\r\n\tif (!match && autofillLocationCode) {\r\n\t\tconst { results = {} } = await getLocations(supportedLocationModes, autofillLocationCode, customer);\r\n\t\tmatch = findPortMatch(results, autofillLocationCode);\r\n\t}\r\n\r\n\treturn match ? formatLocationForSelection(match) : null;\r\n};\r\n","import React from \"react\";\r\n\r\nimport { tokens } from \"@freightos/design-system\";\r\n\r\nimport { useFormikContext } from \"formik\";\r\n\r\nimport { FlexDirections, FlexSpacings } from \"../../../common/helpers/constants\";\r\nimport { saveLastUsedSearch } from \"../apis\";\r\nimport { SCard } from \"../styled\";\r\n\r\nimport ItineraryDisplay from \"./ItineraryDisplay.jsx\";\r\nimport ShipmentAndCommodityDisplay from \"./ShipmentAndCommodityDisplay.jsx\";\r\n\r\nexport const SearchCard = (\r\n\t{ search, index, setIsOpen, dataTestId, onRecentSearchSelect }) => {\r\n\r\n\tconst handleClick = async () => {\r\n\t\tonRecentSearchSelect(search);\r\n\t\ttry {\r\n\t\t\tawait saveLastUsedSearch(search.id);\r\n\t\t} catch (error) {\r\n\t\t\tconsole.error(error);\r\n\t\t}\t\r\n\t\tsetIsOpen(false);\r\n\t};\r\n\r\n\treturn <SCard \r\n\t\tdirection={FlexDirections.VERTICAL} \r\n\t\tfullWidth \r\n\t\tspacing={FlexSpacings.XSMALL}\r\n\t\tkey={search.id}\r\n\t\tstyle={{\r\n\t\t\tpadding: tokens.fdsComponentSpacingSm,\r\n\t\t}}\r\n\t\tdata-test-id={`${dataTestId}rs-card-${index}`}\r\n\t\tonClick={() => {\r\n\t\t\thandleClick();\r\n\t\t}}>\r\n\t\t<ItineraryDisplay search={search} index={index} dataTestId={dataTestId} />\r\n\t\t<ShipmentAndCommodityDisplay search={search} index={index} dataTestId={dataTestId} />\r\n\t</SCard>;\t\r\n};","import styled, { css } from 'styled-components';\r\n\r\nimport { FlexDirections } from './constants';\r\n\r\nexport const StyledFlex = styled.div`\r\n\tdisplay: flex;\r\n\tflex-direction: ${({ $direction }) => ($direction === FlexDirections.VERTICAL ? 'column' : 'row')};\r\n\tflex-wrap: ${({ $wrap }) => ($wrap ? 'wrap' : 'nowrap')};\r\n\talign-items: ${({ $alignItems }) => $alignItems};\r\n\tjustify-content: ${({ $justifyContent }) => $justifyContent};\r\n\tbox-sizing: border-box;\r\n\r\n\t${({ $fullWidth }) =>\r\n\t\t$fullWidth &&\r\n\t\tcss`\r\n\t\t\twidth: 100%;\r\n\t\t`}\r\n\t${({ $direction, $spacing }) =>\r\n\t\t$direction === FlexDirections.VERTICAL\r\n\t\t\t? css`\r\n\t\t\t\t\t> *:not(:first-child) {\r\n\t\t\t\t\t\tmargin-top: ${$spacing};\r\n\t\t\t\t\t}\r\n\t\t\t `\r\n\t\t\t: css`\r\n\t\t\t\t\t> *:not(:first-child) {\r\n\t\t\t\t\t\tmargin-left: ${$spacing};\r\n\t\t\t\t\t}\r\n\t\t\t `};\r\n`;","import React from \"react\";\r\n\r\nimport { Icon, tokens } from \"@freightos/design-system\";\r\n\r\nimport Flex from \"../../../common/components/Flex\";\r\nimport { FlexSpacings } from \"../../../common/helpers/constants\";\r\nimport { SLocationFlag } from \"../styled\";\r\nimport { groupAndOrderLocationsByCountries } from \"../utils\";\r\n\r\nimport TruncatedLabel from \"./TruncatedLabel.jsx\";\r\nimport { LOCATION_MODES } from \"../../../helpers/constant\";\r\n\r\nconst ItineraryDisplay = ({search, index, dataTestId}) => {\r\n\tconst isMultiOrigin = search.origin.length > 1;\t\r\n\tconst isMultiDestination = search.destination.length > 1;\r\n\tconst groupedOrigin = isMultiOrigin \r\n\t\t? groupAndOrderLocationsByCountries(search.origin) \r\n\t\t: { [search.origin[0].country]: search.origin };\r\n\tconst groupedDestination = isMultiDestination \r\n\t\t? groupAndOrderLocationsByCountries(search.destination) \r\n\t\t: { [search.destination[0].country]: search.destination };\r\n\treturn (\r\n\t\t<Flex alignItems='center' spacing={FlexSpacings.XSMALL} fullWidth>\r\n\t\t\t{Object.keys(groupedOrigin).map(countryCode =>{ \r\n\t\t\t\tconst labelOrigin = groupedOrigin[countryCode].map(origin => origin.selectedValue).join(', ');\r\n\t\t\t\treturn (\r\n\t\t\t\t\t<TruncatedLabel\r\n\t\t\t\t\t\tkey={countryCode}\r\n\t\t\t\t\t\ttext={labelOrigin}\r\n\t\t\t\t\t\tisLocationLabel\r\n\t\t\t\t\t\ttestId={`${dataTestId}-origin-${index}`}\r\n\t\t\t\t\t\tisPort={groupedOrigin[countryCode][0].type === LOCATION_MODES.SEAPORT}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<SLocationFlag\r\n\t\t\t\t\t\t\ttype='flag'\r\n\t\t\t\t\t\t\tcountry={countryCode}\r\n\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\tdata-test-id={`${dataTestId}-origin-flag-${index}`}\r\n\t\t\t\t\t\t\tstyle={{ marginRight: '4px' }}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{labelOrigin}\r\n\t\t\t\t\t</TruncatedLabel>\r\n\t\t\t\t);\r\n\t\t\t})}\r\n\t\t\t<Icon type='arrow-forward' style={{ marginRight: 0, color: tokens.fdsColorPrimaryGray90, flex: 'none' }} />\r\n\t\t\t{Object.keys(groupedDestination).map(countryCode => {\r\n\t\t\t\tconst labelDestination = groupedDestination[countryCode].map(destination => destination.selectedValue).join(', ');\r\n\t\t\t\treturn (\r\n\t\t\t\t\t<TruncatedLabel \r\n\t\t\t\t\t\tkey={countryCode} \r\n\t\t\t\t\t\ttext={labelDestination} \r\n\t\t\t\t\t\tisLocationLabel \r\n\t\t\t\t\t\ttestId={`${dataTestId}-destination-${index}`}\r\n\t\t\t\t\t\tisPort={groupedDestination[countryCode][0].type === LOCATION_MODES.SEAPORT}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<SLocationFlag\r\n\t\t\t\t\t\t\ttype='flag'\r\n\t\t\t\t\t\t\tcountry={countryCode}\r\n\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\tdata-test-id={`${dataTestId}-destination-flag-${index}`}\r\n\t\t\t\t\t\t\tstyle={{ marginRight: '4px' }}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{labelDestination}\r\n\t\t\t\t\t</TruncatedLabel>\r\n\t\t\t\t);\r\n\t\t\t})}\r\n\t\t</Flex>\r\n\t);\r\n};\r\n\r\nexport default ItineraryDisplay;","import { \r\n\tCONTAINER_TYPE_20_FOOT_FACTOR, \r\n\tCUBIC_FOOT_TO_CUBIC_INCH_CONVERSION_FACTOR, \r\n\tCUBIC_METER_TO_CUBIC_CM_CONVERSION_FACTOR, \r\n\tPACKAGE_TYPE, \r\n\tSEARCH_FIELDS,\r\n\tSEARCH_PLATFORMS,\r\n\tSHIPMENT_OPTIONS,\r\n\tVOLUME_OPTIONS, \r\n\tWEIGHT_OPTIONS\r\n} from \"./constants\";\r\n\r\n/**\r\n * Formats a number using thousand separators (e.g., 1000 becomes \"1,000\").\r\n * Limits fraction digits to 3.\r\n */\r\nexport const formatNumber = (value) => {\r\n\tif(!value) return '0';\r\n\r\n\treturn value.toLocaleString(\"en-US\", {\r\n\t\tmaximumFractionDigits: 3,\r\n\t\tuseGrouping: true\r\n\t});\r\n};\r\n\r\n/**\r\n * Orders locations by countries and also groups them by country\r\n * @param locations - Array of location objects\r\n * @param countryOrder - Array of country codes in desired order\r\n * @returns Object with countries as keys and their locations as values, ordered by countryOrder\r\n */\r\nexport const groupAndOrderLocationsByCountries = (\r\n\tlocations\r\n) => {\r\n\t// Group locations by country\r\n\tconst groupedByCountry = locations.reduce((acc, location) => {\r\n\t\tconst countryCode = location.country;\r\n\t\tif (!acc[countryCode]) {\r\n\t\t\tacc[countryCode] = [];\r\n\t\t}\r\n\t\tacc[countryCode].push(location);\r\n\t\treturn acc;\r\n\t}, {});\r\n\r\n\t// Sort locations within each country group\r\n\tObject.keys(groupedByCountry).forEach(countryCode => {\r\n\t\tgroupedByCountry[countryCode].sort((a, b) => (a.selectedValue).localeCompare(b.selectedValue));\r\n\t});\r\n\treturn groupedByCountry;\r\n};\r\n\r\n/**\r\n * Extracts unique icons from box packages array\r\n * @param boxPackages - Array of box package objects\r\n * @returns Array of unique icon names\r\n */\r\nexport const getUniqueBoxPackageIcons = (boxPackages) =>\r\n\tboxPackages.reduce((uniqueIcons, packageItem) => {\r\n\t\tconst icon = packageItem.type?.value?.icon;\r\n\t\t\r\n\t\t// Add icon to array only if it's not already present\r\n\t\tif (!uniqueIcons.includes(icon)) {\r\n\t\t\tuniqueIcons.push(icon);\r\n\t\t}\r\n\t\t\r\n\t\treturn uniqueIcons;\r\n\t}, []);\r\n\r\nexport const chooseIconsType = (search) => {\r\n\tconst shipmentType = search.shipment_details.type;\r\n\tif(shipmentType === SHIPMENT_OPTIONS.TOTALS) {\r\n\t\treturn ['box-total'];\r\n\t}\r\n\r\n\tif(shipmentType === SHIPMENT_OPTIONS.UNITS) {\r\n\t\tconst unitsPackages = search.shipment_details[SEARCH_FIELDS.UNITS_SHIPMENT];\r\n\t\tif(unitsPackages?.packageType === PACKAGE_TYPE.BOX) {\r\n\t\t\tconst uniqueIcons = getUniqueBoxPackageIcons(unitsPackages.boxPackages);\r\n\t\t\treturn uniqueIcons;\r\n\t\t}\r\n\t\tif(unitsPackages?.packageType === PACKAGE_TYPE.ULD) {\r\n\t\t\treturn ['uld'];\r\n\t\t}\r\n\t\treturn ['box'];\r\n\t}\r\n\r\n\tif(shipmentType === SHIPMENT_OPTIONS.CONTAINER) {\r\n\t\treturn ['container'];\r\n\t}\r\n\r\n\treturn ['box'];\r\n}\r\n\r\n/**\r\n * Calculates total units, volume and weight based on package type in IRecentSearch\r\n * @param search - Recent search object containing shipment details\r\n * @returns Object with calculated totals for units, volume, and weight\r\n */\r\nexport const shipmentTotalsBasedOnPackages = (search) => {\r\n\tconst shipmentType = search.shipment_details.type;\r\n\tconst platformType = search.platform_type;\r\n\r\n\tif(platformType === SEARCH_PLATFORMS.QUOTATION) {\r\n\t\treturn { units: 0, volume: 0, weight: 0, weightUnit: WEIGHT_OPTIONS.KG, volumeUnit: VOLUME_OPTIONS.CBM };\r\n\t}\r\n\tswitch (shipmentType) {\r\n\t\tcase SHIPMENT_OPTIONS.CONTAINER: {\r\n\t\t\tlet calculatedUnits = 0;\r\n\t\t\tlet calculatedTEU = 0;\r\n\t\t\t// eslint-disable-next-line no-unused-expressions\r\n\t\t\tsearch.shipment_details[SEARCH_FIELDS.CONTAINER_PACKAGES]?.forEach((pkg) => {\r\n\t\t\t\tconst units = Number(pkg.units) || 0;\r\n\t\t\t\tif (units > 0) {\r\n\t\t\t\t\tcalculatedUnits += units;\r\n\t\t\t\t\tconst dimensionSelected = parseInt(pkg.dimensions.value, 10);\r\n\t\t\t\t\tcalculatedTEU += units * (dimensionSelected / CONTAINER_TYPE_20_FOOT_FACTOR);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn {\r\n\t\t\t\tunits: calculatedUnits, \r\n\t\t\t\tvolume: calculatedTEU, \r\n\t\t\t\tweight: null,\r\n\t\t\t\tweightUnit: null,\r\n\t\t\t\tvolumeUnit: 'TEU',\r\n\t\t\t};\r\n\t\t}\r\n\t\tcase SHIPMENT_OPTIONS.UNITS: {\r\n\t\t\tconst unitsPackages = search.shipment_details[SEARCH_FIELDS.UNITS_SHIPMENT];\r\n\t\t\tconst volumeCalculationFactor = unitsPackages?.volumeUnit === VOLUME_OPTIONS.CFT \r\n\t\t\t\t? CUBIC_FOOT_TO_CUBIC_INCH_CONVERSION_FACTOR : CUBIC_METER_TO_CUBIC_CM_CONVERSION_FACTOR;\r\n\t\t\tif (unitsPackages?.packageType === PACKAGE_TYPE.BOX) {\r\n\t\t\t\tconst formattedVolume = formatNumber(unitsPackages?.boxPackages.reduce((acc, curr) => {\r\n\t\t\t\t\tconst volume = parseFloat(curr.width || '0') * parseFloat(curr.height || '0') * parseFloat(curr.length || '0') * parseFloat(curr.units || '0') / volumeCalculationFactor;\r\n\t\t\t\t\treturn acc + volume;\r\n\t\t\t\t}, 0));\r\n\t\t\t\tconst formattedWeight = formatNumber(unitsPackages.boxPackages.reduce((acc, curr) => acc + parseFloat(curr.weight || '0'), 0));\r\n\r\n\t\t\t\treturn {\r\n\t\t\t\t\tunits: unitsPackages.boxPackages.reduce((acc, curr) => acc + parseFloat(curr.units || '0'), 0),\r\n\t\t\t\t\tvolume: formattedVolume, \r\n\t\t\t\t\tweight: formattedWeight,\r\n\t\t\t\t\tweightUnit: unitsPackages.weightUnit,\r\n\t\t\t\t\tvolumeUnit: unitsPackages.volumeUnit,\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tif (unitsPackages?.packageType === PACKAGE_TYPE.ULD) {\r\n\t\t\t\tconst formattedVolume = formatNumber(unitsPackages.uldPackages.reduce((acc, curr) => acc + parseFloat(curr.volume || '0'), 0));\r\n\t\t\t\tconst formattedWeight = formatNumber(unitsPackages.uldPackages.reduce((acc, curr) => acc + parseFloat(curr.weight || '0'), 0));\r\n\t\t\t\treturn {\r\n\t\t\t\t\tunits: unitsPackages.uldPackages.length, \r\n\t\t\t\t\tvolume: formattedVolume, \r\n\t\t\t\t\tweight: formattedWeight,\r\n\t\t\t\t\tweightUnit: unitsPackages.weightUnit,\r\n\t\t\t\t\tvolumeUnit: unitsPackages.volumeUnit,\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\treturn { units: 0, volume: 0, weight: 0, weightUnit: WEIGHT_OPTIONS.KG, volumeUnit: VOLUME_OPTIONS.CBM };\r\n\t\t}\r\n\r\n\t\tcase SHIPMENT_OPTIONS.TOTALS: {\r\n\t\t\tconst formattedVolume = formatNumber(parseFloat(search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.volume || '0'));\r\n\t\t\tconst formattedWeight = formatNumber(parseFloat(search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.weight || '0'));\r\n\t\t\treturn {\r\n\t\t\t\tunits: search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.units || 0, \r\n\t\t\t\tvolume: formattedVolume, \r\n\t\t\t\tweight: formattedWeight,\r\n\t\t\t\tweightUnit: search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.weightUnit || WEIGHT_OPTIONS.KG,\r\n\t\t\t\tvolumeUnit: search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.volumeUnit || VOLUME_OPTIONS.CBM,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tdefault:\r\n\t\t\treturn { units: 0, volume: 0, weight: 0, weightUnit: WEIGHT_OPTIONS.KG, volumeUnit: VOLUME_OPTIONS.CBM };\r\n\t}\r\n};\r\n","module.exports = __WEBPACK_EXTERNAL_MODULE__694__;","import httpClient from '@freightos/http-client'\r\n\r\nexport const doRequest = async ({\r\n\tmethod,\r\n\turl = '',\r\n\tdata = {},\r\n\toptions = {},\r\n}) => {\r\n\r\n\tconst params = (() => {\r\n\t\tif (method === 'get') {\r\n\r\n\t\t\tconst newUrl = (() => {\r\n\t\t\t\tif (!Object.keys(data).length) {\r\n\t\t\t\t\treturn url\r\n\t\t\t\t}\r\n\t\t\t\treturn `${url}?${new URLSearchParams(data).toString()}`\r\n\t\t\t})();\r\n\r\n\t\t\treturn [newUrl, options]\r\n\t\t}\r\n\t\tif (method === 'post') {\r\n\t\t\tconst headers = {\r\n\t\t\t\t...options?.headers,\r\n\t\t\t\t'accept': 'application/json',\r\n\t\t\t\t'content-type': `multipart/form-data`\r\n\t\t\t}\r\n\t\t\treturn [url, data, { ...options, headers }]\r\n\t\t}\r\n\r\n\t\treturn [url, data, options]\r\n\t})()\r\n\r\n\treturn await httpClient[method](...params)\r\n}","import { RS_PLATFORM_TYPES, SEARCH_FIELDS, SEARCH_PLATFORMS, RECENT_SEARCHES_LIMIT } from \"./constants\";\r\n\r\nexport const formatPlatformType = (platformType) => {\r\n\tswitch (platformType) {\r\n\t\tcase SEARCH_PLATFORMS.BOOKING:\r\n\t\t\treturn RS_PLATFORM_TYPES.BOOK;\r\n\t\tcase SEARCH_PLATFORMS.QUOTATION:\r\n\t\t\treturn RS_PLATFORM_TYPES.QUOTE;\r\n\t\tcase SEARCH_PLATFORMS.BI:\r\n\t\t\treturn RS_PLATFORM_TYPES.BI;\r\n\t\tdefault:\r\n\t\t\treturn platformType;\r\n\t}\r\n};\r\n\r\nexport const formatPlatformTypeFromRecentSearch = (platformType) => {\r\n\tswitch (platformType) {\r\n\t\tcase RS_PLATFORM_TYPES.BOOK:\r\n\t\t\treturn SEARCH_PLATFORMS.BOOKING;\r\n\t\tcase RS_PLATFORM_TYPES.QUOTE:\r\n\t\t\treturn SEARCH_PLATFORMS.QUOTATION;\r\n\t\tcase RS_PLATFORM_TYPES.BI:\r\n\t\t\treturn SEARCH_PLATFORMS.BI;\r\n\t\tdefault:\r\n\t\t\treturn SEARCH_PLATFORMS.BOOKING;\r\n\t}\r\n};\r\n\r\nconst formatContainerShipment = (search) => ({\t\r\n\t[SEARCH_FIELDS.CONTAINER_PACKAGES]: search.shipment_details[SEARCH_FIELDS.CONTAINER_PACKAGES],\r\n});\r\n\r\nexport const orderRecentSearches = (recentSearches) => [...recentSearches].sort((a, b) => {\r\n\t// Sort by most recent date (comparing last_time_used_date vs saved_update_date) and return last 6 \r\n\tconst aMaxDate = new Date(Math.max(\r\n\t\tnew Date(a.last_time_used_date).getTime(),\r\n\t\tnew Date(a.saved_update_date).getTime()\r\n\t));\r\n\tconst bMaxDate = new Date(Math.max(\r\n\t\tnew Date(b.last_time_used_date).getTime(),\r\n\t\tnew Date(b.saved_update_date).getTime()\r\n\t));\r\n\t\r\n\treturn bMaxDate.getTime() - aMaxDate.getTime();\r\n}).slice(0, RECENT_SEARCHES_LIMIT);\r\n\r\n","module.exports = __WEBPACK_EXTERNAL_MODULE__773__;","import React from 'react';\r\n\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { FlexDirections, FlexSpacings } from '../helpers/constants';\r\nimport { StyledFlex } from '../helpers/styled';\r\n\r\nconst Flex = ({\r\n\tdirection = FlexDirections.HORIZONTAL,\r\n\talignItems = 'start',\r\n\tspacing = FlexSpacings.NONE,\r\n\twrap,\r\n\tjustifyContent,\r\n\tfullWidth,\r\n\t...rest\r\n}) => (\r\n\t<StyledFlex\r\n\t\t{...rest}\r\n\t\t$direction={direction}\r\n\t\t$alignItems={alignItems}\r\n\t\t$spacing={spacing}\r\n\t\t$wrap={wrap}\r\n\t\t$justifyContent={justifyContent}\r\n\t\t$fullWidth={fullWidth}\r\n\t>\r\n\t\t{rest.children}\r\n\t</StyledFlex>\r\n);\r\n\r\nFlex.propTypes = {\r\n\tdirection: PropTypes.oneOf([FlexDirections.HORIZONTAL, FlexDirections.VERTICAL]),\r\n\tspacing: PropTypes.oneOf(Object.keys(FlexSpacings)),\r\n\tchildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\r\n\talignItems: PropTypes.string,\r\n\tjustifyContent: PropTypes.string,\r\n\tfullWidth: PropTypes.bool,\r\n\twrap: PropTypes.bool,\r\n};\r\n\r\nexport default Flex;\r\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\r\n\r\nimport { Notification } from '@freightos/design-system';\r\nimport { debounce } from 'lodash';\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { DEFAULT_LOCATION_MODE, LOCATION_MODES_MAP, MAX_TAG_COUNT, MAX_TAG_COUNT_MULTIPLE, SelectModes } from '../helpers/constant';\r\nimport { DebounceSelector, DropdownGlobalStyle } from '../helpers/styled';\r\n\r\nimport SelectorContent from './SelectorContent';\r\nimport Environment from 'common/helpers/Environment';\r\n\r\nconst DebounceSelect = ({\r\n\tfetchOptions,\r\n\trenderedOptions,\r\n\trecentSearches = [],\r\n\thasError,\r\n\tmode,\r\n\tdataTestId,\r\n\tvalue,\r\n\tdebounceTimeout = 800,\r\n\tactiveLocationMode,\r\n\tdefaultLocation,\r\n\tonChange,\r\n\t...props\r\n}) => {\r\n\tconst [options, setOptions] = useState([]);\r\n\tconst [isLoading, setIsLoading] = useState(false);\r\n\tconst [searchKey, setSearchKey] = useState('');\r\n\tconst fetchRef = useRef(0);\r\n\tconst [isOpen, setIsOpen] = useState(false);\r\n\tconst [maxTagCount, setMaxTagCount] = useState(MAX_TAG_COUNT);\r\n\tconst timeoutRef = useRef();\r\n\r\n\tuseEffect(() => {\r\n\t\tif ((!value || value.length === 0) && !isOpen) {\r\n\t\t\tsetOptions([]);\r\n\t\t\tsetSearchKey('');\r\n\t\t}\r\n\t}, [value, isOpen]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (activeLocationMode !== DEFAULT_LOCATION_MODE) {\r\n\t\t\tsetOptions(prevOptions =>\r\n\t\t\t\tprevOptions.filter(option => option.label === LOCATION_MODES_MAP[activeLocationMode].label)\r\n\t\t\t);\r\n\t\t}\r\n\t\tsetIsOpen(false);\r\n\r\n\t\t// Clear any existing timeout\r\n\t\tif (timeoutRef.current) {\r\n\t\t\tclearTimeout(timeoutRef.current);\r\n\t\t}\r\n\r\n\t\ttimeoutRef.current = setTimeout(() => {\r\n\t\t\tdocument.activeElement.blur(); // remove focus from input\r\n\t\t\tdocument.body.click(); // simulate outside click\r\n\t\t\tconst active = document.querySelector('.ant-select-focused');\r\n\t\t\tif (active) {\r\n\t\t\t\tactive.classList.remove('ant-select-focused');\r\n\t\t\t}\r\n\t\t\tsetMaxTagCount(MAX_TAG_COUNT);\r\n\t\t}, 100);\r\n\r\n\t\t// Cleanup function\r\n\t\treturn () => {\r\n\t\t\tif (timeoutRef.current) {\r\n\t\t\t\tclearTimeout(timeoutRef.current);\r\n\t\t\t}\r\n\t\t};\r\n\t}, [activeLocationMode]);\r\n\r\n\tconst debounceFetcher = useMemo(() => {\r\n\t\tconst loadOptions = async optionValue => {\r\n\t\t\tsetSearchKey(optionValue);\r\n\t\t\tfetchRef.current += 1;\r\n\t\t\tconst fetchId = fetchRef.current;\r\n\r\n\t\t\tsetOptions([]);\r\n\t\t\tsetIsLoading(true);\r\n\r\n\t\t\tlet returnOptions = null;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tconst newOptions = await fetchOptions(optionValue);\r\n\t\t\t\tif (fetchId === fetchRef.current) {\r\n\t\t\t\t\tsetOptions(newOptions);\r\n\t\t\t\t\treturnOptions = newOptions;\r\n\t\t\t\t}\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('Error fetching options:', error);\r\n\t\t\t\tif (fetchId === fetchRef.current) {\r\n\t\t\t\t\tNotification.danger({\r\n\t\t\t\t\t\tmessage: 'Search failed',\r\n\t\t\t\t\t\tdescription: 'Unable to fetch location results. Please try again later.',\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t} finally {\r\n\t\t\t\tif (fetchId === fetchRef.current) {\r\n\t\t\t\t\tsetIsLoading(false);\r\n\t\t\t\t\treturn returnOptions;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\treturn debounce(loadOptions, debounceTimeout);\r\n\t}, [fetchOptions, debounceTimeout]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (!defaultLocation?.code) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst loadDefaultLocation = async () => {\r\n\t\t\ttry {\r\n\t\t\t\tsetOptions([]);\r\n\t\t\t\tsetIsLoading(true);\r\n\t\t\t\t\r\n\t\t\t\tconst options = await fetchOptions(defaultLocation.code);\r\n\t\t\t\tsetOptions(options);\r\n\t\t\t\t\r\n\t\t\t\tif (!options || options.length === 0) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tlet match = null;\r\n\t\t\t\t\r\n\t\t\t\tif (defaultLocation.type) {\r\n\t\t\t\t\tconst targetGroup = options.find(group => \r\n\t\t\t\t\t\tgroup.label.toLowerCase() === LOCATION_MODES_MAP[defaultLocation.type]?.label.toLowerCase()\r\n\t\t\t\t\t);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (targetGroup?.options) {\r\n\t\t\t\t\t\tmatch = targetGroup.options.find(option => \r\n\t\t\t\t\t\t\toption.code.toLowerCase() === defaultLocation.code.toLowerCase() || \r\n\t\t\t\t\t\t\toption.selectedValue.toLowerCase() === defaultLocation.code.toLowerCase()\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (!match) {\r\n\t\t\t\t\tmatch = options\r\n\t\t\t\t\t\t.map(group => group.options)\r\n\t\t\t\t\t\t.flat()\r\n\t\t\t\t\t\t.find(option => \r\n\t\t\t\t\t\t\toption.code.toLowerCase() === defaultLocation.code.toLowerCase() || \r\n\t\t\t\t\t\t\toption.selectedValue.toLowerCase() === defaultLocation.code.toLowerCase()\r\n\t\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (match && onChange) {\r\n\t\t\t\t\tconst formattedMatch = {\r\n\t\t\t\t\t\tkey: JSON.stringify(match),\r\n\t\t\t\t\t\tlabel: match.selectedValue || match.displayLabel || match.code\r\n\t\t\t\t\t};\r\n\t\t\t\t\tonChange([formattedMatch]);\r\n\t\t\t\t}\r\n\t\t\t} catch (error) {\r\n\t\t\t\tif (Environment.isLocal()) {\r\n\t\t\t\t\tconsole.error('Error loading default location:', error);\r\n\t\t\t\t}\r\n\t\t\t} finally {\r\n\t\t\t\tsetIsLoading(false);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tloadDefaultLocation();\r\n\t}, [defaultLocation?.code, defaultLocation?.type]);\r\n\r\n\tconst shouldShowDropdown = () => isLoading || searchKey.trim() || recentSearches?.length > 0;\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<DropdownGlobalStyle />\r\n\t\t\t<DebounceSelector\r\n\t\t\t\tmaxTagCount={maxTagCount}\r\n\t\t\t\tonSearch={debounceFetcher}\r\n\t\t\t\t$hasError={hasError}\r\n\t\t\t\tloading={isLoading}\r\n\t\t\t\toptions={options}\r\n\t\t\t\tfilterOption={false}\r\n\t\t\t\tnotFoundContent={\r\n\t\t\t\t\t<SelectorContent\r\n\t\t\t\t\t\tisLoading={isLoading}\r\n\t\t\t\t\t\trecentSearches={recentSearches}\r\n\t\t\t\t\t\tsearchKey={searchKey}\r\n\t\t\t\t\t\tdataTestId={dataTestId}\r\n\t\t\t\t\t\tsetIsOpen={setIsOpen}\r\n\t\t\t\t\t\tonRecentSearchSelect={props.onRecentSearchSelect}\r\n\t\t\t\t\t\tinitialValues={props.initialValues}\r\n\t\t\t\t\t/>\r\n\t\t\t\t}\r\n\t\t\t\tmode={mode}\r\n\t\t\t\tdata-test-id={`${dataTestId}-selector`}\r\n\t\t\t\tallowClear={mode === SelectModes.SINGLE}\r\n\t\t\t\tlabelInValue\r\n\t\t\t\toptionLabelProp='label'\r\n\t\t\t\tshowSearch\r\n\t\t\t\tonDropdownVisibleChange={open => {\r\n\t\t\t\t\tif (open) {\r\n\t\t\t\t\t\tsetMaxTagCount(MAX_TAG_COUNT_MULTIPLE);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsetMaxTagCount(MAX_TAG_COUNT);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetOptions([]);\r\n\t\t\t\t\tsetSearchKey('');\r\n\t\t\t\t\tsetIsOpen(open);\r\n\t\t\t\t}}\r\n\t\t\t\topen={isOpen && shouldShowDropdown()}\r\n\t\t\t\tvalue={value}\r\n\t\t\t\tonChange={onChange}\r\n\t\t\t\t{...props}\r\n\t\t\t>\r\n\t\t\t\t{renderedOptions(options)}\r\n\t\t\t</DebounceSelector>\r\n\t\t</>\r\n\t);\r\n};\r\n\r\nDebounceSelect.propTypes = {\r\n\tfetchOptions: PropTypes.func.isRequired,\r\n\trenderedOptions: PropTypes.func.isRequired,\r\n\thasError: PropTypes.bool,\r\n\tmode: PropTypes.string.isRequired,\r\n\tdataTestId: PropTypes.string,\r\n\tdebounceTimeout: PropTypes.number,\r\n\tvalue: PropTypes.array,\r\n\tactiveLocationMode: PropTypes.string,\r\n\trecentSearches: PropTypes.array,\r\n\tmaxTagCount: PropTypes.number,\r\n\tdefaultLocation: PropTypes.shape({\r\n\t\tcode: PropTypes.string.isRequired,\r\n\t\ttype: PropTypes.string.isRequired,\r\n\t}),\r\n\tonChange: PropTypes.func,\r\n};\r\n\r\nexport default DebounceSelect;\r\n","export const WEBCARGO_TALAIA_URL = '/webcargo-talaia';\r\n\r\nexport const WEBCARGO_ALPHA_URL = '/webcargo-alpha';\r\n\r\nexport const SEARCH_FIELDS = {\r\n\tORIGIN: 'origin',\r\n\tDESTINATION: 'destination',\r\n\tTOTALS_SHIPMENT: 'totalShipment',\r\n\tUNITS_SHIPMENT: 'unitsShipment',\r\n\tCONTAINER_SHIPMENT: 'containerShipment',\r\n\tCOMMODITY: 'commodity',\r\n\tSHIPMENT_TYPE: 'shipmentType',\r\n\tUNITS: 'units',\r\n\tVOLUME: 'volume',\r\n\tVOLUME_UNIT: 'volumeUnit',\r\n\tWEIGHT: 'weight',\r\n\tWEIGHT_UNIT: 'weightUnit',\r\n\tTURNABLE: 'turnable',\r\n\tSTACKABLE: 'stackable',\r\n\tDEFINE_EACH_UNIT_DIMENSIONS: 'defineEachUnitDimensions',\r\n\tDEFINE_EACH_UNIT_WEIGHT: 'defineEachUnitWeight',\r\n\tUNIT_DIMENSIONS: 'unitDimensions',\r\n\tUNIT_WEIGHTS: 'unitWeights',\r\n\tLENGTH: 'length',\r\n\tHEIGHT: 'height',\r\n\tWIDTH: 'width',\r\n\tTYPE: 'type',\r\n\tDIMENSION_UNIT: 'dimensionUnit',\r\n\tBOX_PACKAGES: 'boxPackages',\r\n\tULD_PACKAGES: 'uldPackages',\r\n\tPACKAGE_TYPE: 'packageType',\r\n\tTOTAL_WEIGHT: 'totalWeight',\r\n\tCONTAINER_PACKAGES: 'containerPackages',\r\n\tDIMENSIONS: 'dimensions',\r\n\tFULLFILLMENT_DETAILS: 'fullfillmentDetails',\r\n\tIS_FULLFILLMENT: 'isFullfillment',\r\n\tCOMMODITY_TEMPERATURE: 'commodityTemperature',\r\n\tBATTERY_HS_CODE: 'batteryHsCode',\r\n\tSUPPORTED_FREIGHT_TYPES: 'supportedFreightTypes',\r\n}\r\n\r\nexport const TEMPERATURE_SYSTEM = {\r\n\tCELSIUS: 'celsius',\r\n\tFAHRENHEIT: 'fahrenheit',\r\n}\r\n\r\nexport const TEMPERATURE_RANGE = {\r\n\tFRO: 'FRO',\r\n\tCOL: 'COL',\r\n\tERT: 'ERT',\r\n\tCRT: 'CRT',\r\n}\r\n\r\nexport const TEMPERATURE_RANGES_DATA = {\r\n\t[TEMPERATURE_RANGE.FRO]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: '-10ºC or below',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: '14ºF or below',\r\n\t},\r\n\t[TEMPERATURE_RANGE.COL]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: 'From +2ºC To +8ºC',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: 'From 35.6ºF To 46.4ºF',\r\n\t},\r\n\t[TEMPERATURE_RANGE.ERT]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: 'From +2ºC To +25ºC',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: 'From 35.6ºF To 77ºF',\r\n\t},\r\n\t[TEMPERATURE_RANGE.CRT]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: 'From +15ºC To +25ºC',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: 'From 59ºF To 77ºF',\r\n\t},\r\n\r\n};\r\n\r\nexport const SEARCH_PLATFORMS = {\r\n\tBOOKING: 'booking',\r\n\tQUOTATION: 'quotation',\r\n\tBI: 'bi',\r\n}\r\n\r\nexport const RS_PLATFORM_TYPES = {\t\r\n\tBOOK: 'BOOK',\r\n\tQUOTE: 'QUOTE',\r\n\tBI: 'BI',\r\n}\r\n\r\nexport const CONTAINER_TYPE_20_FOOT_FACTOR = 20;\r\n\r\nexport const SHIPMENT_OPTIONS = {\r\n\tUNITS: 'units',\r\n\tTOTALS: 'totals',\r\n\tCONTAINER: 'container'\r\n}\r\n\r\nexport const CUBIC_FOOT_TO_CUBIC_INCH_CONVERSION_FACTOR = 1728;\r\n\r\nexport const CUBIC_METER_TO_CUBIC_CM_CONVERSION_FACTOR = 1000000;\r\n\r\nexport const VOLUME_OPTIONS = {\r\n\tCBM: 'CBM',\r\n\tCFT: 'CFT',\t\r\n}\r\n\r\nexport const WEIGHT_OPTIONS = {\r\n\tKG: 'kg',\r\n\tLB: 'lb',\r\n}\r\n\r\nexport const DIMENSION_OPTIONS = {\r\n\tCM: 'cm',\r\n\tIN: 'in',\r\n}\r\n\r\nexport const PACKAGE_TYPE = {\r\n\tBOX: 'box',\r\n\tULD: 'uld',\r\n}\r\n\r\nexport const RECENT_SEARCHES_LIMIT = 6;\r\n","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","export default class Environment {\r\n\tstatic isProduction() {\r\n\t\treturn process.env.REACT_APP_CUSTOM_ENV === 'prod';\r\n\t}\r\n\r\n\tstatic isTest() {\r\n\t\treturn process.env.REACT_APP_CUSTOM_ENV === 'test';\r\n\t}\r\n\r\n\tstatic isLocal() {\r\n\t\treturn process.env.REACT_APP_CUSTOM_ENV === 'dev';\r\n\t}\r\n}\r\n","import httpClient from '@freightos/http-client';\r\n\r\nimport { LOCATION_MODES_MAP } from './constant';\r\n\r\n/**\r\n * Fetches locations based on the provided location modes and query.\r\n *\r\n * @param {Array<string>} locationModes - Array of location modes to search for.\r\n * @param {string} query - The search query.\r\n * @returns {Promise<Object>} A promise resolving to an object containing location results.\r\n */\r\nexport const getLocations = async (locationModes, query, customer) => {\r\n\ttry {\r\n\t\tconst sources = locationModes.reduce(\r\n\t\t\t(acc, mode) => ({\r\n\t\t\t\t...acc,\r\n\t\t\t\t[LOCATION_MODES_MAP[mode].key]: {\r\n\t\t\t\t\ttype: mode.toUpperCase(),\r\n\t\t\t\t\t...(customer?.code ? { searchTerm: customer.name } : {}),\r\n\t\t\t\t\t...(LOCATION_MODES_MAP[mode].groupedBy ? { groupedBy: LOCATION_MODES_MAP[mode].groupedBy } : {}),\r\n\t\t\t\t},\r\n\t\t\t}),\r\n\t\t\t{}\r\n\t\t);\r\n\t\tconst response = await httpClient.post('/geocoder/api/v3/geocoder/locations', {\r\n\t\t\tquery,\r\n\t\t\tlimit: 5,\r\n\t\t\tsources,\r\n\t\t});\r\n\t\treturn response.data;\r\n\t} catch (error) {\r\n\t\tconsole.error('Error fetching locations:', error);\r\n\t\treturn { results: {} };\r\n\t}\r\n};\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React, { useEffect, useRef, useState } from 'react';\r\n\r\nimport { tokens } from '@freightos/design-system';\r\nimport { TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport PropTypes from 'prop-types';\r\n\r\nimport DebounceSelect from './components/DebounceSelect';\r\nimport MaxPortsPlaceholder from './components/MaxPortsPlaceholder';\r\nimport {\r\n\tDEFAULT_LOCATION_MODE,\r\n\tLocationTypes,\r\n\tSelectModes,\r\n} from './helpers/constant';\r\nimport {\r\n\tfetchLocations,\r\n\tfindAutofillMatch,\r\n\tgetLocationInputValue,\r\n\thandleLocationChange,\r\n\thasExistingValue,\r\n\tisLocationAddress,\r\n\tgetExistingNormalizedCodes,\r\n\tgetNormalizedCodeFromMatchOption,\r\n\trenderLocationOptions,\r\n} from './helpers/utils';\r\n\r\n/**\r\n * LocationInput component for selecting locations (ports, airports, addresses, etc.)\r\n * \r\n * @param {Object|Array} value - Current selected location(s)\r\n * @param {Function} onChange - Callback fired when location changes\r\n * @param {boolean} hasError - Whether the input has validation errors\r\n * @param {string} dataTestId - Test ID for the component\r\n * @param {boolean} isOriginLocation - Whether this is an origin location input\r\n * @param {number} maxPorts - Maximum number of ports that can be selected\r\n * @param {Array<string>} supportedLocationModes - Array of supported location modes\r\n * @param {Object} customer - Customer object for API requests\r\n * @param {Object} defaultLocation - Default location to load\r\n * @param {string} defaultLocation.code - Location code (e.g., 'BCN')\r\n * @param {string} defaultLocation.type - Location type ('airport', 'seaport', 'address', etc.)\r\n * \r\n * @example\r\n * // Basic usage\r\n * <LocationInput \r\n * onChange={handleLocationChange}\r\n * supportedLocationModes={['airport', 'seaport']}\r\n * />\r\n * \r\n * @example\r\n * // With default value - will automatically load and select Barcelona airport\r\n * <LocationInput \r\n * onChange={handleLocationChange}\r\n * supportedLocationModes={['airport', 'seaport']}\r\n * defaultLocation={{ code: 'BCN', type: 'airport' }}\r\n * />\r\n */\r\nconst LocationInput = ({\r\n\tvalue,\r\n\tonChange,\r\n\thasError,\r\n\tdataTestId = 'location-input',\r\n\tisOriginLocation = true,\r\n\tmaxPorts = 1,\r\n\tsupportedLocationModes,\r\n\tcustomer,\r\n\tdefaultLocation,\r\n\tautofillLocationAddress,\r\n\tautofillLocationCode,\r\n\tuserCountryCode,\r\n\t...rest\r\n}) => {\r\n\tconst [selectedLocation, setSelectedLocation] = useState(value);\r\n\tconst [activeLocationMode, setActiveLocationMode] = useState(\r\n\t\tsupportedLocationModes.length === 1 ? supportedLocationModes[0] : DEFAULT_LOCATION_MODE\r\n\t);\r\n\r\n\tconst [selectionMode, setSelectionMode] = useState(\r\n\t\tisLocationAddress(activeLocationMode) || activeLocationMode === DEFAULT_LOCATION_MODE\r\n\t\t\t? SelectModes.SINGLE\r\n\t\t\t: SelectModes.MULTIPLE\r\n\t);\r\n\r\n\tconst latestValueRef = useRef(value);\r\n\tconst lastAppliedAutofillSignatureRef = useRef(null);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (isLocationAddress(activeLocationMode)) {\r\n\t\t\tsetSelectionMode(SelectModes.SINGLE);\r\n\t\t} else {\r\n\t\t\tsetSelectionMode(SelectModes.MULTIPLE);\r\n\t\t}\r\n\t}, [activeLocationMode]);\r\n\r\n\tuseEffect(() => {\r\n\t\tsetSelectedLocation(value);\r\n\t\tlatestValueRef.current = value;\r\n\t\tif (Array.isArray(value) && value.length > 0) {\r\n\t\t\tsetActiveLocationMode(value[0].type);\r\n\t\t} else if (defaultLocation?.type) {\r\n\t\t\tsetActiveLocationMode(defaultLocation.type);\r\n\t\t} else {\r\n\t\t\tsetActiveLocationMode(DEFAULT_LOCATION_MODE);\r\n\t\t}\r\n\t}, [value, defaultLocation?.type]);\r\n\r\n\t// Use ref to capture latest callback values without triggering re-runs\r\n\tconst callbacksRef = useRef({ onChange, selectionMode, maxPorts });\r\n\tuseEffect(() => {\r\n\t\tcallbacksRef.current = { onChange, selectionMode, maxPorts };\r\n\t}, [onChange, selectionMode, maxPorts]);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst signature = `${autofillLocationAddress || ''}::${autofillLocationCode || ''}`;\r\n\t\tif (!autofillLocationAddress && !autofillLocationCode) return;\r\n\r\n\t\tif (signature === lastAppliedAutofillSignatureRef.current) return;\r\n\r\n\t\tconst currentValue = latestValueRef.current;\r\n\t\tconst { selectionMode: currentSelectionMode, maxPorts: currentMaxPorts } = callbacksRef.current;\r\n\t\tconst canAppendInMultipleMode =\r\n\t\t\tcurrentSelectionMode === SelectModes.MULTIPLE &&\r\n\t\t\ttypeof currentMaxPorts === 'number' &&\r\n\t\t\tcurrentMaxPorts > 1 &&\r\n\t\t\tArray.isArray(currentValue) &&\r\n\t\t\tcurrentValue.length < currentMaxPorts;\r\n\r\n\t\t// Skip if already has a value (unless we can append more ports in MULTIPLE mode)\r\n\t\tif (hasExistingValue(currentValue) && !canAppendInMultipleMode) return;\r\n\r\n\t\tconst doAutofill = async () => {\r\n\t\t\ttry {\r\n\t\t\t\tconst match = await findAutofillMatch({\r\n\t\t\t\t\tautofillLocationAddress,\r\n\t\t\t\t\tautofillLocationCode,\r\n\t\t\t\t\tsupportedLocationModes,\r\n\t\t\t\t\tcustomer,\r\n\t\t\t\t\tuserCountryCode,\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (!match) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst { onChange: currentOnChange, selectionMode: latestSelectionMode, maxPorts: latestMaxPorts } = callbacksRef.current;\r\n\t\t\t\tconst latestValue = latestValueRef.current;\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tlatestSelectionMode === SelectModes.MULTIPLE &&\r\n\t\t\t\t\ttypeof latestMaxPorts === 'number' &&\r\n\t\t\t\t\tlatestMaxPorts > 1 &&\r\n\t\t\t\t\tArray.isArray(latestValue)\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst matchCode = getNormalizedCodeFromMatchOption(match);\r\n\t\t\t\t\tconst existingCodes = getExistingNormalizedCodes(latestValue);\r\n\t\t\t\t\tif (!matchCode || existingCodes.has(matchCode)) return;\r\n\r\n\t\t\t\t\tconst existingOptionsRaw = getLocationInputValue(latestValue) || [];\r\n\t\t\t\t\tconst existingOptions = Array.isArray(existingOptionsRaw) ? existingOptionsRaw.filter(Boolean) : [];\r\n\t\t\t\t\tconst nextOptions = [...existingOptions, match].slice(0, latestMaxPorts);\r\n\r\n\t\t\t\t\thandleLocationChange(nextOptions, latestSelectionMode, latestMaxPorts, setSelectedLocation, currentOnChange);\r\n\t\t\t\t} else if (latestSelectionMode === SelectModes.MULTIPLE) {\r\n\t\t\t\t\thandleLocationChange([match], latestSelectionMode, latestMaxPorts, setSelectedLocation, currentOnChange);\r\n\t\t\t\t} else {\r\n\t\t\t\t\thandleLocationChange(match, latestSelectionMode, latestMaxPorts, setSelectedLocation, currentOnChange);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlastAppliedAutofillSignatureRef.current = signature;\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('Error performing autofill:', error);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tdoAutofill();\r\n\t}, [autofillLocationAddress, autofillLocationCode, supportedLocationModes, customer, userCountryCode]);\r\n\r\n\treturn (\r\n\t\t<DebounceSelect\r\n\t\t\tmode={selectionMode}\r\n\t\t\tdataTestId={dataTestId}\r\n\t\t\thasError={hasError}\r\n\t\t\tplaceholder={\r\n\t\t\t\t<TranslatableText\r\n\t\t\t\t\tstyle={{ fontSize: tokens.fdsFontSizeBase }}\r\n\t\t\t\t\tstringId={`Select ${isOriginLocation ? LocationTypes.ORIGIN : LocationTypes.DESTINATION}`}\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\tvalue={getLocationInputValue(selectedLocation)}\r\n\t\t\tfetchOptions={fetchLocations(activeLocationMode, supportedLocationModes, customer)}\r\n\t\t\trenderedOptions={optionGroups => renderLocationOptions(optionGroups, dataTestId)}\r\n\t\t\tonChange={location => {\r\n\t\t\t\thandleLocationChange(location ?? [], selectionMode, maxPorts, setSelectedLocation, onChange);\r\n\t\t\t\tsetActiveLocationMode(DEFAULT_LOCATION_MODE);\r\n\t\t\t}}\r\n\t\t\tactiveLocationMode={activeLocationMode}\r\n\t\t\tmaxTagPlaceholder={omittedPorts => <MaxPortsPlaceholder omittedPorts={omittedPorts} dataTestId={dataTestId} />}\r\n\t\t\tdefaultLocation={defaultLocation}\r\n\t\t\t{...rest}\r\n\t\t/>\r\n\t);\r\n};\r\n\r\nLocationInput.propTypes = {\r\n\tvalue: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\r\n\tonChange: PropTypes.func.isRequired,\r\n\thasError: PropTypes.bool,\r\n\tdataTestId: PropTypes.string,\r\n\tisOriginLocation: PropTypes.bool,\r\n\tmaxPorts: PropTypes.number,\r\n\tsupportedLocationModes: PropTypes.arrayOf(PropTypes.string).isRequired,\r\n\tcustomer: PropTypes.object,\r\n\trecentSearches: PropTypes.array,\r\n\tonRecentSearchSelect: PropTypes.func,\r\n\tinitialValues: PropTypes.object,\r\n\tdefaultLocation: PropTypes.shape({\r\n\t\tcode: PropTypes.string.isRequired,\r\n\t\ttype: PropTypes.string.isRequired,\r\n\t}),\r\n\tautofillLocationAddress: PropTypes.string,\r\n\tautofillLocationCode: PropTypes.string,\r\n\tuserCountryCode: PropTypes.string,\r\n};\r\n\r\nexport default LocationInput;\r\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__186__","__WEBPACK_EXTERNAL_MODULE__198__","__WEBPACK_EXTERNAL_MODULE__2__","__WEBPACK_EXTERNAL_MODULE__773__","__WEBPACK_EXTERNAL_MODULE__155__","__WEBPACK_EXTERNAL_MODULE__694__","_objectWithoutProperties","e","t","o","r","i","Object","getOwnPropertySymbols","n","length","indexOf","propertyIsEnumerable","call","DropdownGlobalStyle","createGlobalStyle","_templateObject","_taggedTemplateLiteral","DebounceSelector","styled","Select","_templateObject2","tokens","fdsBorderRadiusXl","fdsColorPrimaryBlue","fdsColorPrimaryBlue10","fdsComponentSpacingXxs","fdsSizeMd","_ref","size","concat","fdsComponentSpacingSm","fdsComponentSpacingXs","fdsColorPrimaryGray80","_ref2","$hasError","fdsColorSemanticRed","fdsColorSemanticRed10","SelectedOptionLabel","_templateObject3","fdsFontSizeSm","SelectOptionLabel","_templateObject4","StyledMenu","Menu","_templateObject5","fdsBodyTextColorDisabled","NoMatchingResults","_templateObject6","fdsSizeSm","fdsHeadingsFontFamily","Icon","_templateObject7","saveLastUsedSearch","async","doRequest","method","url","WEBCARGO_ALPHA_URL","options","headers","data","id","searchId","hasOwnProperty","prototype","propIsEnumerable","assign","test1","String","getOwnPropertyNames","test2","fromCharCode","map","join","test3","split","forEach","letter","keys","err","shouldUseNative","target","source","from","symbols","to","val","undefined","TypeError","toObject","s","arguments","key","_search$commodity_tem","_search$commodity_tem2","_search$commodity_tem3","search","index","dataTestId","platformType","platform_type","icons","chooseIconsType","units","volume","weight","weightUnit","volumeUnit","useMemo","shipmentTotalsBasedOnPackages","isTemperature","commodity","is_temperature","temperatureRange","commodity_temperature","tempRange","TEMPERATURE_RANGES_DATA","temperatureSystem","_jsx","Flex","spacing","FlexSpacings","XSMALL","alignItems","fullWidth","children","SEARCH_PLATFORMS","QUOTATION","_jsxs","STinyWrapper","SMALL","style","flex","icon","iconIndex","UnitIcon","type","TruncatedLabel","text","label","testId","whiteSpace","f","g","Fragment","Symbol","for","h","m","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentOwner","p","ref","__self","__source","q","c","a","k","b","d","l","defaultProps","$$typeof","props","_owner","current","jsx","jsxs","isPort","isLocationLabel","labelRef","useRef","isTruncated","setIsTruncated","useState","useEffect","checkTruncation","element","truncated","scrollWidth","clientWidth","labelElement","STruncatedLabel","$isLocationLabel","$isPort","Tooltip","title","_typeof","iterator","constructor","omittedPorts","selectedItems","omittedPort","_JSON$parse","JSON","parse","selectedValue","DEFAULT_LOCATION_MODE","LOCATION_MODES","AIRPORT","SEAPORT","FULFILLMENT_CENTER","ADDRESS_BOOK","LAST_MILE_ADDRESS","ADDRESS","LOCATION_MODES_MAP","groupedBy","SelectModes","SINGLE","MULTIPLE","LocationTypes","ORIGIN","DESTINATION","MAX_TAG_COUNT","MAX_TAG_COUNT_MULTIPLE","toPrimitive","Number","ownKeys","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread2","getOwnPropertyDescriptors","defineProperties","defineProperty","isLoading","recentSearches","searchKey","setIsOpen","onRecentSearchSelect","initialValues","Spin","trim","RecentSearches","TranslatableText","stringId","TRANSLATION_MODULES","SearchAndBook","STitle","fdsColorPrimaryGray60","fdsSizeXs","fdsFontWeightRegular","SCard","SLocationFlag","Avatar","fdsColorPrimaryGray20","SListWrapper","_defineProperty","value","configurable","writable","firstSixSearches","orderRecentSearches","color","direction","FlexDirections","VERTICAL","SearchCard","slice","freeze","raw","_objectWithoutPropertiesLoose","XXLARGE","fdsComponentSpacingXxl","XLARGE","fdsComponentSpacingXl","LARGE","fdsComponentSpacingLg","MEDIUM","fdsComponentSpacingMd","XXSMALL","NONE","HORIZONTAL","normalizeLocationCode","code","toUpperCase","getNormalizedCodeFromMatchOption","matchOption","matchObj","_unused","safeParseOptionKey","getExistingNormalizedCodes","locations","Set","loc","stableStringify","obj","allKeys","stringify","v","uniqSortedKeys","Array","sort","normalizeLocationForKey","displayLabel","formattedNameOrAddress","countryCode","stateOrProvince","city","latitude","longitude","postalOrZipCode","sourceType","locationType","countryName","country","stableKeyFromLocation","parsed","decodeHtmlEntities","_unused2","getLocationInputValue","formatLocation","location","_LOCATION_MODES_MAP$l","_Fragment","getLocationInputOption","isArray","renderLocationOptions","optionGroups","some","group","_group$options","_group$options2","values","find","mode","locationOptionIcon","OptGroup","fontFamily","option","Option","paddingLeft","justifyContent","width","height","Chip","iconType","fetchLocations","activeLocationMode","supportedLocationModes","customer","query","modes","locationsResults","getLocations","results","updatedLocationsResults","_objectSpread","fulfillmentCenters","address","otherTypes","_excluded","extractFulfillmentCenters","_LOCATION_MODES_MAP$k","onChangeLocation","changedLocations","onChange","Promise","all","json","Boolean","handleLocationChange","selectionMode","maxPorts","setSelectedLocation","selectedPorts","_selectedPorts$","typePort","Message","danger","isLocationAddress","replace","DISPLAY_LABEL_STREET_PATTERN","escapeRegex","str","findMatchingAddresses","searchQuery","isAddressMatch","matchResult","match","streetAddress","searchTerms","RegExp","test","hasExistingValue","findAutofillMatch","autofillLocationAddress","autofillLocationCode","userCountryCode","selectBestAddressMatch","addresses","addr","_addr$countryCode","toLowerCase","findPortMatch","portCode","airportResults","seaportResults","normalizedPortCode","port","formatted","formatLocationForSelection","padding","onClick","error","console","handleClick","ItineraryDisplay","ShipmentAndCommodityDisplay","StyledFlex","$direction","$wrap","_ref3","$alignItems","_ref4","$justifyContent","_ref5","$fullWidth","css","_ref6","$spacing","isMultiOrigin","origin","isMultiDestination","destination","groupedOrigin","groupAndOrderLocationsByCountries","groupedDestination","labelOrigin","marginRight","fdsColorPrimaryGray90","labelDestination","formatNumber","toLocaleString","maximumFractionDigits","useGrouping","groupedByCountry","reduce","acc","localeCompare","shipmentType","shipment_details","SHIPMENT_OPTIONS","TOTALS","UNITS","unitsPackages","SEARCH_FIELDS","UNITS_SHIPMENT","packageType","PACKAGE_TYPE","BOX","boxPackages","uniqueIcons","packageItem","_packageItem$type","_packageItem$type$val","includes","ULD","CONTAINER","WEIGHT_OPTIONS","KG","VOLUME_OPTIONS","CBM","_search$shipment_deta","calculatedUnits","calculatedTEU","CONTAINER_PACKAGES","pkg","dimensionSelected","parseInt","dimensions","CONTAINER_TYPE_20_FOOT_FACTOR","volumeCalculationFactor","CFT","CUBIC_FOOT_TO_CUBIC_INCH_CONVERSION_FACTOR","CUBIC_METER_TO_CUBIC_CM_CONVERSION_FACTOR","formattedVolume","curr","parseFloat","formattedWeight","uldPackages","_search$shipment_deta2","_search$shipment_deta3","_search$shipment_deta4","_search$shipment_deta5","_search$shipment_deta6","TOTALS_SHIPMENT","params","URLSearchParams","toString","httpClient","aMaxDate","Date","Math","max","last_time_used_date","getTime","saved_update_date","RECENT_SEARCHES_LIMIT","wrap","rest","fetchOptions","renderedOptions","hasError","debounceTimeout","defaultLocation","setOptions","setIsLoading","setSearchKey","fetchRef","isOpen","maxTagCount","setMaxTagCount","timeoutRef","prevOptions","clearTimeout","setTimeout","document","activeElement","blur","body","click","active","querySelector","classList","remove","debounceFetcher","debounce","optionValue","fetchId","returnOptions","newOptions","Notification","message","description","targetGroup","_LOCATION_MODES_MAP$d","flat","formattedMatch","Environment","isLocal","loadDefaultLocation","onSearch","loading","filterOption","notFoundContent","SelectorContent","allowClear","labelInValue","optionLabelProp","showSearch","onDropdownVisibleChange","open","CONTAINER_SHIPMENT","COMMODITY","SHIPMENT_TYPE","VOLUME","VOLUME_UNIT","WEIGHT","WEIGHT_UNIT","TURNABLE","STACKABLE","DEFINE_EACH_UNIT_DIMENSIONS","DEFINE_EACH_UNIT_WEIGHT","UNIT_DIMENSIONS","UNIT_WEIGHTS","LENGTH","HEIGHT","WIDTH","TYPE","DIMENSION_UNIT","BOX_PACKAGES","ULD_PACKAGES","TOTAL_WEIGHT","DIMENSIONS","FULLFILLMENT_DETAILS","IS_FULLFILLMENT","COMMODITY_TEMPERATURE","BATTERY_HS_CODE","SUPPORTED_FREIGHT_TYPES","TEMPERATURE_SYSTEM","TEMPERATURE_RANGE","BOOKING","BI","LB","toPropertyKey","isProduction","process","REACT_APP_CUSTOM_ENV","isTest","locationModes","sources","searchTerm","name","limit","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","definition","get","prop","toStringTag","isOriginLocation","selectedLocation","setActiveLocationMode","setSelectionMode","latestValueRef","lastAppliedAutofillSignatureRef","callbacksRef","signature","currentValue","currentSelectionMode","currentMaxPorts","canAppendInMultipleMode","currentOnChange","latestSelectionMode","latestMaxPorts","latestValue","matchCode","existingCodes","has","existingOptionsRaw","nextOptions","doAutofill","DebounceSelect","placeholder","fontSize","fdsFontSizeBase","maxTagPlaceholder","MaxPortsPlaceholder"],"ignoreList":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["../webpack/universalModuleDefinition","../webpack/bootstrap","../external {\"commonjs\":\"react\",\"commonjs2\":\"react\",\"amd\":\"react\",\"root\":\"React\"}","../external \"@freightos/design-system\"","../external \"styled-components\"","../external \"@freightos/freightos-i18n\"","../external \"@freightos/http-client\"","../external \"lodash\"","helpers/constant.js","helpers/styled.js","common/helpers/constants.js","components/RecentSearches/constants.js","common/httpClient/doRequest/index.js","components/RecentSearches/apis.js","common/helpers/styled.js","common/components/Flex.js","components/RecentSearches/styled.js","components/RecentSearches/utils.js","components/RecentSearches/components/TruncatedLabel.jsx","components/RecentSearches/components/ItineraryDisplay.jsx","components/RecentSearches/components/ShipmentAndCommodityDisplay.jsx","components/RecentSearches/components/SearchCard.jsx","components/RecentSearches/index.jsx","components/RecentSearches/adapters.js","components/SelectorContent.js","common/helpers/Environment.js","components/DebounceSelect.js","components/MaxPortsPlaceholder.js","helpers/apis.js","helpers/utils.js","index.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","__WEBPACK_EXTERNAL_MODULE__2__","__WEBPACK_EXTERNAL_MODULE__3__","__WEBPACK_EXTERNAL_MODULE__4__","__WEBPACK_EXTERNAL_MODULE__5__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","LOCATION_MODES","LOCATION_MODES_MAP","label","icon","groupedBy","SelectModes","LocationTypes","DropdownGlobalStyle","createGlobalStyle","DebounceSelector","styled","Select","tokens","fdsBorderRadiusXl","fdsColorPrimaryBlue","fdsColorPrimaryBlue10","fdsComponentSpacingXxs","fdsSizeMd","_ref","size","fdsComponentSpacingSm","fdsComponentSpacingXs","fdsColorPrimaryGray80","_ref2","$hasError","fdsColorSemanticRed","fdsColorSemanticRed10","SelectedOptionLabel","span","fdsFontSizeSm","SelectOptionLabel","div","StyledMenu","Menu","fdsBodyTextColorDisabled","NoMatchingResults","fdsSizeSm","fdsHeadingsFontFamily","FlexSpacings","Icon","XXLARGE","fdsComponentSpacingXxl","XLARGE","fdsComponentSpacingXl","LARGE","fdsComponentSpacingLg","MEDIUM","fdsComponentSpacingMd","SMALL","XSMALL","XXSMALL","NONE","FlexDirections","VERTICAL","HORIZONTAL","SEARCH_FIELDS","TEMPERATURE_SYSTEM","TEMPERATURE_RANGES_DATA","SEARCH_PLATFORMS","SHIPMENT_OPTIONS","VOLUME_OPTIONS","WEIGHT_OPTIONS","PACKAGE_TYPE","saveLastUsedSearch","async","method","url","data","options","params","keys","length","URLSearchParams","toString","headers","httpClient","doRequest","id","searchId","StyledFlex","$direction","$wrap","_ref3","$alignItems","_ref4","$justifyContent","_ref5","$fullWidth","css","_ref6","$spacing","Flex","direction","alignItems","spacing","wrap","justifyContent","fullWidth","rest","React","createElement","assign","children","STitle","fdsColorPrimaryGray60","fdsSizeXs","fdsFontWeightRegular","SCard","UnitIcon","STruncatedLabel","$isLocationLabel","$isPort","undefined","SLocationFlag","Avatar","fdsColorPrimaryGray20","STinyWrapper","SListWrapper","formatNumber","toLocaleString","maximumFractionDigits","useGrouping","groupAndOrderLocationsByCountries","locations","groupedByCountry","reduce","acc","location","countryCode","country","push","forEach","sort","a","b","selectedValue","localeCompare","TruncatedLabel","text","testId","isPort","isLocationLabel","labelRef","useRef","isTruncated","setIsTruncated","useState","useEffect","checkTruncation","current","element","truncated","scrollWidth","clientWidth","labelElement","ref","data-test-id","Tooltip","title","ItineraryDisplay","search","index","dataTestId","isMultiOrigin","origin","isMultiDestination","destination","groupedOrigin","groupedDestination","map","labelOrigin","join","type","style","marginRight","color","fdsColorPrimaryGray90","flex","labelDestination","ShipmentAndCommodityDisplay","_search$commodity_tem","_search$commodity_tem2","_search$commodity_tem3","platformType","platform_type","icons","shipmentType","shipment_details","unitsPackages","packageType","boxPackages","uniqueIcons","packageItem","_packageItem$type","_packageItem$type$val","includes","chooseIconsType","units","volume","weight","weightUnit","volumeUnit","useMemo","_search$shipment_deta","calculatedUnits","calculatedTEU","pkg","Number","dimensionSelected","parseInt","dimensions","volumeCalculationFactor","formattedVolume","curr","parseFloat","width","height","formattedWeight","uldPackages","_search$shipment_deta2","_search$shipment_deta3","_search$shipment_deta4","_search$shipment_deta5","_search$shipment_deta6","shipmentTotalsBasedOnPackages","isTemperature","commodity","is_temperature","temperatureRange","commodity_temperature","tempRange","temperatureSystem","iconIndex","whiteSpace","SearchCard","setIsOpen","onRecentSearchSelect","padding","onClick","error","console","handleClick","RecentSearches","recentSearches","initialValues","firstSixSearches","is_saved","aDate","Date","saved_update_date","getTime","aMaxDate","Math","max","last_time_used_date","slice","orderRecentSearches","TranslatableText","stringId","SelectorContent","isLoading","searchKey","Spin","trim","TRANSLATION_MODULES","SearchAndBook","Environment","process","REACT_APP_CUSTOM_ENV","DebounceSelect","fetchOptions","renderedOptions","hasError","debounceTimeout","activeLocationMode","defaultLocation","onChange","props","setOptions","setIsLoading","setSearchKey","fetchRef","isOpen","maxTagCount","setMaxTagCount","timeoutRef","prevOptions","filter","option","clearTimeout","setTimeout","document","activeElement","blur","body","click","active","querySelector","classList","remove","debounceFetcher","debounce","optionValue","fetchId","returnOptions","newOptions","Notification","danger","message","description","code","match","targetGroup","find","group","_LOCATION_MODES_MAP$d","toLowerCase","flat","formattedMatch","JSON","stringify","displayLabel","isLocal","loadDefaultLocation","Fragment","onSearch","loading","filterOption","notFoundContent","allowClear","labelInValue","optionLabelProp","showSearch","onDropdownVisibleChange","open","MaxPortsPlaceholder","omittedPorts","selectedItems","omittedPort","_JSON$parse","parse","getLocations","locationModes","query","customer","sources","toUpperCase","searchTerm","post","limit","results","normalizeLocationCode","getNormalizedCodeFromMatchOption","matchOption","matchObj","safeParseOptionKey","stableStringify","obj","allKeys","k","v","uniqSortedKeys","Array","from","Set","normalizeLocationForKey","loc","formattedNameOrAddress","stateOrProvince","city","latitude","longitude","postalOrZipCode","sourceType","locationType","countryName","stableKeyFromLocation","parsed","decodeHtmlEntities","getLocationInputValue","formatLocation","_LOCATION_MODES_MAP$l","getLocationInputOption","isArray","fetchLocations","supportedLocationModes","modes","locationsResults","updatedLocationsResults","fulfillmentCenters","address","otherTypes","extractFulfillmentCenters","_LOCATION_MODES_MAP$k","onChangeLocation","changedLocations","Promise","all","raw","json","err","Boolean","handleLocationChange","selectionMode","maxPorts","setSelectedLocation","selectedPorts","_selectedPorts$","typePort","Message","isLocationAddress","replace","DISPLAY_LABEL_STREET_PATTERN","escapeRegex","str","findMatchingAddresses","searchQuery","isAddressMatch","matchResult","streetAddress","searchTerms","split","RegExp","test","findAutofillMatch","autofillLocationAddress","autofillLocationCode","userCountryCode","selectBestAddressMatch","addresses","addr","_addr$countryCode","findPortMatch","portCode","airportResults","seaportResults","normalizedPortCode","port","formatted","formatLocationForSelection","LocationInput","isOriginLocation","selectedLocation","setActiveLocationMode","setSelectionMode","latestValueRef","lastAppliedAutofillSignatureRef","callbacksRef","signature","currentValue","currentSelectionMode","currentMaxPorts","canAppendInMultipleMode","hasExistingValue","currentOnChange","latestSelectionMode","latestMaxPorts","latestValue","matchCode","existingCodes","has","existingOptionsRaw","nextOptions","doAutofill","placeholder","fontSize","fdsFontSizeBase","optionGroups","renderLocationOptions","some","_group$options","_group$options2","values","locationOptionIcon","OptGroup","fontFamily","Option","paddingLeft","Chip","iconType","maxTagPlaceholder"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,kBAAZC,SAA0C,kBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,SAAUA,QAAQ,4BAA6BA,QAAQ,qBAAsBA,QAAQ,6BAA8BA,QAAQ,0BAA2BA,QAAQ,WACtK,oBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,sBAAuB,CAAC,QAAS,2BAA4B,oBAAqB,4BAA6B,yBAA0B,UAAWJ,GACjI,kBAAZC,QACdA,QAA6B,oBAAID,EAAQG,QAAQ,SAAUA,QAAQ,4BAA6BA,QAAQ,qBAAsBA,QAAQ,6BAA8BA,QAAQ,0BAA2BA,QAAQ,WAE/MJ,EAA0B,oBAAIC,EAAQD,EAAY,MAAGA,EAAK,4BAA6BA,EAAK,qBAAsBA,EAAK,6BAA8BA,EAAK,0BAA2BA,EAAa,QARpM,CASGO,MAAM,SAASC,EAAgCC,EAAgCC,EAAgCC,EAAgCC,EAAgCC,GAClL,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUd,QAGnC,IAAIC,EAASW,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHhB,QAAS,IAUV,OANAiB,EAAQH,GAAUI,KAAKjB,EAAOD,QAASC,EAAQA,EAAOD,QAASa,GAG/DZ,EAAOe,GAAI,EAGJf,EAAOD,QA0Df,OArDAa,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASrB,EAASsB,EAAMC,GAC3CV,EAAoBW,EAAExB,EAASsB,IAClCG,OAAOC,eAA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AAcA,EAAc9K,WAAYA,IAChGiH,gBAAiBA,GACbjL","file":"main.bundle.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"@freightos/design-system\"), require(\"styled-components\"), require(\"@freightos/freightos-i18n\"), require(\"@freightos/http-client\"), require(\"lodash\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"FusionLocationInput\", [\"react\", \"@freightos/design-system\", \"styled-components\", \"@freightos/freightos-i18n\", \"@freightos/http-client\", \"lodash\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FusionLocationInput\"] = factory(require(\"react\"), require(\"@freightos/design-system\"), require(\"styled-components\"), require(\"@freightos/freightos-i18n\"), require(\"@freightos/http-client\"), require(\"lodash\"));\n\telse\n\t\troot[\"FusionLocationInput\"] = factory(root[\"React\"], root[\"@freightos/design-system\"], root[\"styled-components\"], root[\"@freightos/freightos-i18n\"], root[\"@freightos/http-client\"], root[\"lodash\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__5__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"http://ship.freightos.local:8800/FusionLocationInput/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","module.exports = __WEBPACK_EXTERNAL_MODULE__3__;","module.exports = __WEBPACK_EXTERNAL_MODULE__4__;","module.exports = __WEBPACK_EXTERNAL_MODULE__5__;","/**\r\n * Default location mode used when no specific mode is selected.\r\n * @type {string}\r\n */\r\nexport const DEFAULT_LOCATION_MODE = '';\r\n\r\nexport const LOCATION_MODES = {\r\n\tAIRPORT: 'airport',\r\n\tSEAPORT: 'seaport',\r\n\tFULFILLMENT_CENTER: 'fulfillment_center',\r\n\tADDRESS_BOOK: 'address_book',\r\n\tLAST_MILE_ADDRESS: 'last_mile_address',\r\n\tADDRESS: 'address',\r\n};\r\n\r\nexport const LOCATION_MODES_MAP = {\r\n\t[LOCATION_MODES.AIRPORT]: { label: 'Airports', key: LOCATION_MODES.AIRPORT, icon: 'mode-air' },\r\n\t[LOCATION_MODES.SEAPORT]: { label: 'Ports', key: LOCATION_MODES.SEAPORT, icon: 'mode-ship' },\r\n\t[LOCATION_MODES.FULFILLMENT_CENTER]: {\r\n\t\tlabel: 'Fulfillment centers',\r\n\t\tkey: LOCATION_MODES.FULFILLMENT_CENTER,\r\n\t\ticon: 'fulfillment-center',\r\n\t},\r\n\t[LOCATION_MODES.ADDRESS_BOOK]: { key: LOCATION_MODES.ADDRESS_BOOK, groupedBy: 'address' },\r\n\t[LOCATION_MODES.LAST_MILE_ADDRESS]: { key: LOCATION_MODES.LAST_MILE_ADDRESS, groupedBy: 'address' },\r\n\t[LOCATION_MODES.ADDRESS]: { label: 'Address', key: LOCATION_MODES.ADDRESS, icon: 'location' },\r\n};\r\n\r\n/**\r\n * Enumeration of selection modes for location input.\r\n * @enum {string}\r\n */\r\nexport const SelectModes = {\r\n\tSINGLE: 'single',\r\n\tMULTIPLE: 'multiple',\r\n};\r\n\r\n/**\r\n * Enumeration of location types for origin and destination.\r\n * @enum {string}\r\n */\r\nexport const LocationTypes = {\r\n\tORIGIN: 'origin',\r\n\tDESTINATION: 'destination',\r\n};\r\n\r\nexport const MAX_TAG_COUNT = 3;\r\nexport const MAX_TAG_COUNT_MULTIPLE = 2;\r\n","import { Icon, Menu, Select, tokens } from '@freightos/design-system';\r\nimport styled, { createGlobalStyle } from 'styled-components';\r\n\r\nexport const DropdownGlobalStyle = createGlobalStyle`\r\n .ant-select-dropdown {\r\n .ant-select-dropdown-menu {\r\n max-height: 400px;\r\n padding: 0 !important;\r\n margin-top: 0 !important;\r\n }\r\n }\r\n`;\r\n\r\nexport const DebounceSelector = styled(Select)`\r\n\t.ant-select-selection__rendered {\r\n\t\tmin-width: 100% !important;\r\n\t}\r\n\r\n\tli.ant-select-selection__choice {\r\n\t\tborder-radius: ${tokens.fdsBorderRadiusXl};\r\n\t\tborder: none;\r\n\t\tborder-color: ${tokens.fdsColorPrimaryBlue};\r\n\t\tcolor: ${tokens.fdsColorPrimaryBlue};\r\n\t\tbackground-color: ${tokens.fdsColorPrimaryBlue10};\r\n\t\tline-height: 10px !important;\r\n\t\tmargin-right: ${tokens.fdsComponentSpacingXxs};\r\n\t\twidth: fit-content;\r\n\t\tmax-width: 90px;\r\n\t\theight: ${tokens.fdsSizeMd} !important;\r\n\t\t${({size}) => size === 'large' ? `\r\n\t\t\tmargin-top: ${tokens.fdsComponentSpacingSm} !important;\r\n\t\t` : `\r\n\t\t\tmargin-top: 5px !important;\r\n\t\t`}\r\n\r\n\t\t.ant-select-selection__choice__remove {\r\n\t\t\tcolor: ${tokens.fdsColorPrimaryBlue};\r\n\t\t\tmargin-top: ${tokens.fdsComponentSpacingXs} !important;\r\n\t\t}\r\n\r\n\t\t.ant-select-selection__choice__content {\r\n\t\t\tline-height: ${tokens.fdsSizeMd} !important;\r\n\t\t\theight: ${tokens.fdsSizeMd} !important;\r\n\t\t}\r\n\t}\r\n\r\n\tli.ant-select-selection__choice__disabled {\r\n\t\tborder: none;\r\n\t\tbackground-color: transparent;\r\n\t\tpadding: 0;\r\n\t\tpadding-left: 0;\r\n\t\twidth: fit-content;\r\n\t}\r\n\r\n\t.ant-select-dropdown .ant-select-not-found {\r\n\t\tcursor: pointer !important;\r\n\t}\r\n\r\n\t.ant-select-selection-selected-value {\r\n\t\tmax-width: 280px !important;\r\n\t}\r\n\r\n\tli.ant-select-search.ant-select-search--inline {\r\n\t\tmargin-left: -1px !important;\r\n\t}\r\n\t.ant-select-search__field {\r\n\t\tcolor: ${tokens.fdsColorPrimaryGray80} !important;\r\n\t}\r\n\t${({ $hasError }) => $hasError && `\r\n\t\t.ant-select-selection {\r\n\t\t\tcolor: ${tokens.fdsColorSemanticRed};\r\n \t\tborder: 1px solid ${tokens.fdsColorSemanticRed};\r\n \t\tbackground-color: ${tokens.fdsColorSemanticRed10};\r\n\t\t}\r\n\r\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\r\n\t\t\tcolor: ${tokens.fdsColorSemanticRed};\r\n\t\t}\r\n\t`}\r\n`;\r\n\r\nexport const SelectedOptionLabel = styled.span`\r\n\tfont-size: ${tokens.fdsFontSizeSm} !important;\r\n`;\r\n\r\nexport const SelectOptionLabel = styled.div`\r\n\tfont-size: ${tokens.fdsFontSizeSm} !important;\r\n\toverflow: hidden;\r\n\ttext-overflow: ellipsis;\r\n\tdisplay: -webkit-box;\r\n\t-webkit-line-clamp: 2;\r\n\t-webkit-box-orient: vertical;\r\n`;\r\n\r\nexport const StyledMenu = styled(Menu)`\r\n\tcursor: pointer !important;\r\n\r\n\t.ant-menu-item-group-title {\r\n\t\tpadding: 0;\r\n\t\tcolor: ${tokens.fdsBodyTextColorDisabled};\r\n\t}\r\n\r\n\t.ant-menu-item {\r\n\t\tpadding: 0;\r\n\t\twhite-space: normal;\r\n\t\tline-height: normal;\r\n\r\n\t\t&:hover {\r\n\t\t\tbackground-color: #f5f5f5;\r\n\t\t}\r\n\t}\r\n`;\r\n\r\nexport const NoMatchingResults = styled.div`\r\n\tfont-size: ${tokens.fdsFontSizeSm};\r\n\tline-height: ${tokens.fdsSizeSm};\r\n\tfont-family: ${tokens.fdsHeadingsFontFamily};\r\n`;\r\n\r\nexport const UnitIcon = styled(Icon)`\r\n\tmargin-right: 0 !important;\r\n\tvertical-align: bottom;\r\n`;\r\n","import { tokens } from '@freightos/design-system';\r\n\r\nexport const FlexSpacings = {\r\n\tXXLARGE: tokens.fdsComponentSpacingXxl,\r\n\tXLARGE: tokens.fdsComponentSpacingXl,\r\n\tLARGE: tokens.fdsComponentSpacingLg,\r\n\tMEDIUM: tokens.fdsComponentSpacingMd,\r\n\tSMALL: tokens.fdsComponentSpacingSm,\r\n\tXSMALL: tokens.fdsComponentSpacingXs,\r\n\tXXSMALL: tokens.fdsComponentSpacingXxs,\r\n\tNONE: 0,\r\n};\r\n\r\nexport const FlexDirections = {\r\n\tVERTICAL: 'vertical',\r\n\tHORIZONTAL: 'horizontal',\r\n};\r\n","export const WEBCARGO_TALAIA_URL = '/webcargo-talaia';\r\n\r\nexport const WEBCARGO_ALPHA_URL = '/webcargo-alpha';\r\n\r\nexport const SEARCH_FIELDS = {\r\n\tORIGIN: 'origin',\r\n\tDESTINATION: 'destination',\r\n\tTOTALS_SHIPMENT: 'totalShipment',\r\n\tUNITS_SHIPMENT: 'unitsShipment',\r\n\tCONTAINER_SHIPMENT: 'containerShipment',\r\n\tCOMMODITY: 'commodity',\r\n\tSHIPMENT_TYPE: 'shipmentType',\r\n\tUNITS: 'units',\r\n\tVOLUME: 'volume',\r\n\tVOLUME_UNIT: 'volumeUnit',\r\n\tWEIGHT: 'weight',\r\n\tWEIGHT_UNIT: 'weightUnit',\r\n\tTURNABLE: 'turnable',\r\n\tSTACKABLE: 'stackable',\r\n\tDEFINE_EACH_UNIT_DIMENSIONS: 'defineEachUnitDimensions',\r\n\tDEFINE_EACH_UNIT_WEIGHT: 'defineEachUnitWeight',\r\n\tUNIT_DIMENSIONS: 'unitDimensions',\r\n\tUNIT_WEIGHTS: 'unitWeights',\r\n\tLENGTH: 'length',\r\n\tHEIGHT: 'height',\r\n\tWIDTH: 'width',\r\n\tTYPE: 'type',\r\n\tDIMENSION_UNIT: 'dimensionUnit',\r\n\tBOX_PACKAGES: 'boxPackages',\r\n\tULD_PACKAGES: 'uldPackages',\r\n\tPACKAGE_TYPE: 'packageType',\r\n\tTOTAL_WEIGHT: 'totalWeight',\r\n\tCONTAINER_PACKAGES: 'containerPackages',\r\n\tDIMENSIONS: 'dimensions',\r\n\tFULLFILLMENT_DETAILS: 'fullfillmentDetails',\r\n\tIS_FULLFILLMENT: 'isFullfillment',\r\n\tCOMMODITY_TEMPERATURE: 'commodityTemperature',\r\n\tBATTERY_HS_CODE: 'batteryHsCode',\r\n\tSUPPORTED_FREIGHT_TYPES: 'supportedFreightTypes',\r\n}\r\n\r\nexport const TEMPERATURE_SYSTEM = {\r\n\tCELSIUS: 'celsius',\r\n\tFAHRENHEIT: 'fahrenheit',\r\n}\r\n\r\nexport const TEMPERATURE_RANGE = {\r\n\tFRO: 'FRO',\r\n\tCOL: 'COL',\r\n\tERT: 'ERT',\r\n\tCRT: 'CRT',\r\n}\r\n\r\nexport const TEMPERATURE_RANGES_DATA = {\r\n\t[TEMPERATURE_RANGE.FRO]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: '-10ºC or below',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: '14ºF or below',\r\n\t},\r\n\t[TEMPERATURE_RANGE.COL]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: 'From +2ºC To +8ºC',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: 'From 35.6ºF To 46.4ºF',\r\n\t},\r\n\t[TEMPERATURE_RANGE.ERT]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: 'From +2ºC To +25ºC',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: 'From 35.6ºF To 77ºF',\r\n\t},\r\n\t[TEMPERATURE_RANGE.CRT]: {\r\n\t\t[TEMPERATURE_SYSTEM.CELSIUS]: 'From +15ºC To +25ºC',\r\n\t\t[TEMPERATURE_SYSTEM.FAHRENHEIT]: 'From 59ºF To 77ºF',\r\n\t},\r\n\r\n};\r\n\r\nexport const SEARCH_PLATFORMS = {\r\n\tBOOKING: 'booking',\r\n\tQUOTATION: 'quotation',\r\n\tBI: 'bi',\r\n}\r\n\r\nexport const RS_PLATFORM_TYPES = {\t\r\n\tBOOK: 'BOOK',\r\n\tQUOTE: 'QUOTE',\r\n\tBI: 'BI',\r\n}\r\n\r\nexport const CONTAINER_TYPE_20_FOOT_FACTOR = 20;\r\n\r\nexport const SHIPMENT_OPTIONS = {\r\n\tUNITS: 'units',\r\n\tTOTALS: 'totals',\r\n\tCONTAINER: 'container'\r\n}\r\n\r\nexport const CUBIC_FOOT_TO_CUBIC_INCH_CONVERSION_FACTOR = 1728;\r\n\r\nexport const CUBIC_METER_TO_CUBIC_CM_CONVERSION_FACTOR = 1000000;\r\n\r\nexport const VOLUME_OPTIONS = {\r\n\tCBM: 'CBM',\r\n\tCFT: 'CFT',\t\r\n}\r\n\r\nexport const WEIGHT_OPTIONS = {\r\n\tKG: 'kg',\r\n\tLB: 'lb',\r\n}\r\n\r\nexport const DIMENSION_OPTIONS = {\r\n\tCM: 'cm',\r\n\tIN: 'in',\r\n}\r\n\r\nexport const PACKAGE_TYPE = {\r\n\tBOX: 'box',\r\n\tULD: 'uld',\r\n}\r\n\r\nexport const RECENT_SEARCHES_LIMIT = 6;\r\n","import httpClient from '@freightos/http-client'\r\n\r\nexport const doRequest = async ({\r\n\tmethod,\r\n\turl = '',\r\n\tdata = {},\r\n\toptions = {},\r\n}) => {\r\n\r\n\tconst params = (() => {\r\n\t\tif (method === 'get') {\r\n\r\n\t\t\tconst newUrl = (() => {\r\n\t\t\t\tif (!Object.keys(data).length) {\r\n\t\t\t\t\treturn url\r\n\t\t\t\t}\r\n\t\t\t\treturn `${url}?${new URLSearchParams(data).toString()}`\r\n\t\t\t})();\r\n\r\n\t\t\treturn [newUrl, options]\r\n\t\t}\r\n\t\tif (method === 'post') {\r\n\t\t\tconst headers = {\r\n\t\t\t\t...options?.headers,\r\n\t\t\t\t'accept': 'application/json',\r\n\t\t\t\t'content-type': `multipart/form-data`\r\n\t\t\t}\r\n\t\t\treturn [url, data, { ...options, headers }]\r\n\t\t}\r\n\r\n\t\treturn [url, data, options]\r\n\t})()\r\n\r\n\treturn await httpClient[method](...params)\r\n}","import { doRequest } from \"../../common/httpClient/doRequest/index\";\r\nimport { WEBCARGO_ALPHA_URL } from './constants';\r\n\r\nexport const saveLastUsedSearch = async ( searchId ) => {\r\n\tawait doRequest({\r\n\t\tmethod: 'put',\r\n\t\turl: `${WEBCARGO_ALPHA_URL}/backend/api.php`,\r\n\t\toptions: {\r\n\t\t\theaders: {\r\n\t\t\t\t'namespace': 'airops/user_searches',\r\n\t\t\t\t'route': ' user_search_used',\r\n\t\t\t}\r\n\t\t},\r\n\t\tdata: {\r\n\t\t\tid: searchId,\r\n\t\t},\r\n\t});\r\n};\r\n","import styled, { css } from 'styled-components';\r\n\r\nimport { FlexDirections } from './constants';\r\n\r\nexport const StyledFlex = styled.div`\r\n\tdisplay: flex;\r\n\tflex-direction: ${({ $direction }) => ($direction === FlexDirections.VERTICAL ? 'column' : 'row')};\r\n\tflex-wrap: ${({ $wrap }) => ($wrap ? 'wrap' : 'nowrap')};\r\n\talign-items: ${({ $alignItems }) => $alignItems};\r\n\tjustify-content: ${({ $justifyContent }) => $justifyContent};\r\n\tbox-sizing: border-box;\r\n\r\n\t${({ $fullWidth }) =>\r\n\t\t$fullWidth &&\r\n\t\tcss`\r\n\t\t\twidth: 100%;\r\n\t\t`}\r\n\t${({ $direction, $spacing }) =>\r\n\t\t$direction === FlexDirections.VERTICAL\r\n\t\t\t? css`\r\n\t\t\t\t\t> *:not(:first-child) {\r\n\t\t\t\t\t\tmargin-top: ${$spacing};\r\n\t\t\t\t\t}\r\n\t\t\t `\r\n\t\t\t: css`\r\n\t\t\t\t\t> *:not(:first-child) {\r\n\t\t\t\t\t\tmargin-left: ${$spacing};\r\n\t\t\t\t\t}\r\n\t\t\t `};\r\n`;","import React from 'react';\r\n\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { FlexDirections, FlexSpacings } from '../helpers/constants';\r\nimport { StyledFlex } from '../helpers/styled';\r\n\r\nconst Flex = ({\r\n\tdirection = FlexDirections.HORIZONTAL,\r\n\talignItems = 'start',\r\n\tspacing = FlexSpacings.NONE,\r\n\twrap,\r\n\tjustifyContent,\r\n\tfullWidth,\r\n\t...rest\r\n}) => (\r\n\t<StyledFlex\r\n\t\t{...rest}\r\n\t\t$direction={direction}\r\n\t\t$alignItems={alignItems}\r\n\t\t$spacing={spacing}\r\n\t\t$wrap={wrap}\r\n\t\t$justifyContent={justifyContent}\r\n\t\t$fullWidth={fullWidth}\r\n\t>\r\n\t\t{rest.children}\r\n\t</StyledFlex>\r\n);\r\n\r\nFlex.propTypes = {\r\n\tdirection: PropTypes.oneOf([FlexDirections.HORIZONTAL, FlexDirections.VERTICAL]),\r\n\tspacing: PropTypes.oneOf(Object.keys(FlexSpacings)),\r\n\tchildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\r\n\talignItems: PropTypes.string,\r\n\tjustifyContent: PropTypes.string,\r\n\tfullWidth: PropTypes.bool,\r\n\twrap: PropTypes.bool,\r\n};\r\n\r\nexport default Flex;\r\n","import { Avatar, Icon, tokens } from '@freightos/design-system';\r\n\r\nimport styled from 'styled-components';\r\n\r\nimport Flex from '../../common/components/Flex';\r\n\r\nexport const STitle = styled.div`\r\n\tcolor: ${tokens.fdsColorPrimaryGray60};\r\n\tfont-size: ${tokens.fdsSizeXs};\r\n\tfont-weight: ${tokens.fdsFontWeightRegular};\r\n\tmargin-bottom: ${tokens.fdsComponentSpacingSm};\r\n\ti {\r\n\t\tmargin-right: ${tokens.fdsComponentSpacingSm};\r\n\t}\r\n\r\n`;\r\n\r\nexport const SCard = styled(Flex)`\r\n\tpadding-left: 0 !important;\r\n`;\r\n\r\nexport const UnitIcon = styled(Icon)`\r\n\tmargin-right: 0 !important;\r\n\tvertical-align: bottom;\r\n`;\r\n\r\nexport const STruncatedLabel = styled.span`\r\n\twhite-space: nowrap;\r\n\tmin-width: 0;\r\n\tcolor: ${tokens.fdsColorPrimaryGray80};\r\n\toverflow: hidden;\r\n\ttext-overflow: ellipsis;\r\n\t${({$isLocationLabel}) => !$isLocationLabel && `\r\n\t\tfont-size: 10px; //TODO: FSN-145\r\n\t\tline-height: 15px;\r\n\t`}\r\n\t${({$isPort}) => {\r\n\t\tif ($isPort === undefined)\r\n\t\t\treturn;\r\n\r\n\t\treturn `min-width: ${$isPort ? '65px' : '55px'};`\r\n\t}};\r\n`;\r\n\r\nexport const SLocationFlag = styled(Avatar)`\r\n\tborder: 1px solid ${tokens.fdsColorPrimaryGray20};\r\n\twidth: ${tokens.fdsSizeSm};\r\n\theight: ${tokens.fdsSizeSm};\r\n`;\r\n\r\nexport const STinyWrapper = styled(Flex)`\r\n\toverflow: hidden !important;\r\n\tfont-size: 10px; //TODO: FSN-145\r\n\tline-height: 15px;\r\n\tflex: 1;\r\n\tmin-width: 0;\r\n`;\r\n\r\nexport const SListWrapper = styled(Flex)`\r\n\t:last-child {\r\n\t\tpadding-bottom: 0 !important;\r\n\t}\r\n`;\r\n\r\n","import { \r\n\tCONTAINER_TYPE_20_FOOT_FACTOR, \r\n\tCUBIC_FOOT_TO_CUBIC_INCH_CONVERSION_FACTOR, \r\n\tCUBIC_METER_TO_CUBIC_CM_CONVERSION_FACTOR, \r\n\tPACKAGE_TYPE, \r\n\tSEARCH_FIELDS,\r\n\tSEARCH_PLATFORMS,\r\n\tSHIPMENT_OPTIONS,\r\n\tVOLUME_OPTIONS, \r\n\tWEIGHT_OPTIONS\r\n} from \"./constants\";\r\n\r\n/**\r\n * Formats a number using thousand separators (e.g., 1000 becomes \"1,000\").\r\n * Limits fraction digits to 3.\r\n */\r\nexport const formatNumber = (value) => {\r\n\tif(!value) return '0';\r\n\r\n\treturn value.toLocaleString(\"en-US\", {\r\n\t\tmaximumFractionDigits: 3,\r\n\t\tuseGrouping: true\r\n\t});\r\n};\r\n\r\n/**\r\n * Orders locations by countries and also groups them by country\r\n * @param locations - Array of location objects\r\n * @param countryOrder - Array of country codes in desired order\r\n * @returns Object with countries as keys and their locations as values, ordered by countryOrder\r\n */\r\nexport const groupAndOrderLocationsByCountries = (\r\n\tlocations\r\n) => {\r\n\t// Group locations by country\r\n\tconst groupedByCountry = locations.reduce((acc, location) => {\r\n\t\tconst countryCode = location.country;\r\n\t\tif (!acc[countryCode]) {\r\n\t\t\tacc[countryCode] = [];\r\n\t\t}\r\n\t\tacc[countryCode].push(location);\r\n\t\treturn acc;\r\n\t}, {});\r\n\r\n\t// Sort locations within each country group\r\n\tObject.keys(groupedByCountry).forEach(countryCode => {\r\n\t\tgroupedByCountry[countryCode].sort((a, b) => (a.selectedValue).localeCompare(b.selectedValue));\r\n\t});\r\n\treturn groupedByCountry;\r\n};\r\n\r\n/**\r\n * Extracts unique icons from box packages array\r\n * @param boxPackages - Array of box package objects\r\n * @returns Array of unique icon names\r\n */\r\nexport const getUniqueBoxPackageIcons = (boxPackages) =>\r\n\tboxPackages.reduce((uniqueIcons, packageItem) => {\r\n\t\tconst icon = packageItem.type?.value?.icon;\r\n\t\t\r\n\t\t// Add icon to array only if it's not already present\r\n\t\tif (!uniqueIcons.includes(icon)) {\r\n\t\t\tuniqueIcons.push(icon);\r\n\t\t}\r\n\t\t\r\n\t\treturn uniqueIcons;\r\n\t}, []);\r\n\r\nexport const chooseIconsType = (search) => {\r\n\tconst shipmentType = search.shipment_details.type;\r\n\tif(shipmentType === SHIPMENT_OPTIONS.TOTALS) {\r\n\t\treturn ['box-total'];\r\n\t}\r\n\r\n\tif(shipmentType === SHIPMENT_OPTIONS.UNITS) {\r\n\t\tconst unitsPackages = search.shipment_details[SEARCH_FIELDS.UNITS_SHIPMENT];\r\n\t\tif(unitsPackages?.packageType === PACKAGE_TYPE.BOX) {\r\n\t\t\tconst uniqueIcons = getUniqueBoxPackageIcons(unitsPackages.boxPackages);\r\n\t\t\treturn uniqueIcons;\r\n\t\t}\r\n\t\tif(unitsPackages?.packageType === PACKAGE_TYPE.ULD) {\r\n\t\t\treturn ['uld'];\r\n\t\t}\r\n\t\treturn ['box'];\r\n\t}\r\n\r\n\tif(shipmentType === SHIPMENT_OPTIONS.CONTAINER) {\r\n\t\treturn ['container'];\r\n\t}\r\n\r\n\treturn ['box'];\r\n}\r\n\r\n/**\r\n * Calculates total units, volume and weight based on package type in IRecentSearch\r\n * @param search - Recent search object containing shipment details\r\n * @returns Object with calculated totals for units, volume, and weight\r\n */\r\nexport const shipmentTotalsBasedOnPackages = (search) => {\r\n\tconst shipmentType = search.shipment_details.type;\r\n\tconst platformType = search.platform_type;\r\n\r\n\tif(platformType === SEARCH_PLATFORMS.QUOTATION) {\r\n\t\treturn { units: 0, volume: 0, weight: 0, weightUnit: WEIGHT_OPTIONS.KG, volumeUnit: VOLUME_OPTIONS.CBM };\r\n\t}\r\n\tswitch (shipmentType) {\r\n\t\tcase SHIPMENT_OPTIONS.CONTAINER: {\r\n\t\t\tlet calculatedUnits = 0;\r\n\t\t\tlet calculatedTEU = 0;\r\n\t\t\t// eslint-disable-next-line no-unused-expressions\r\n\t\t\tsearch.shipment_details[SEARCH_FIELDS.CONTAINER_PACKAGES]?.forEach((pkg) => {\r\n\t\t\t\tconst units = Number(pkg.units) || 0;\r\n\t\t\t\tif (units > 0) {\r\n\t\t\t\t\tcalculatedUnits += units;\r\n\t\t\t\t\tconst dimensionSelected = parseInt(pkg.dimensions.value, 10);\r\n\t\t\t\t\tcalculatedTEU += units * (dimensionSelected / CONTAINER_TYPE_20_FOOT_FACTOR);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn {\r\n\t\t\t\tunits: calculatedUnits, \r\n\t\t\t\tvolume: calculatedTEU, \r\n\t\t\t\tweight: null,\r\n\t\t\t\tweightUnit: null,\r\n\t\t\t\tvolumeUnit: 'TEU',\r\n\t\t\t};\r\n\t\t}\r\n\t\tcase SHIPMENT_OPTIONS.UNITS: {\r\n\t\t\tconst unitsPackages = search.shipment_details[SEARCH_FIELDS.UNITS_SHIPMENT];\r\n\t\t\tconst volumeCalculationFactor = unitsPackages?.volumeUnit === VOLUME_OPTIONS.CFT \r\n\t\t\t\t? CUBIC_FOOT_TO_CUBIC_INCH_CONVERSION_FACTOR : CUBIC_METER_TO_CUBIC_CM_CONVERSION_FACTOR;\r\n\t\t\tif (unitsPackages?.packageType === PACKAGE_TYPE.BOX) {\r\n\t\t\t\tconst formattedVolume = formatNumber(unitsPackages?.boxPackages.reduce((acc, curr) => {\r\n\t\t\t\t\tconst volume = parseFloat(curr.width || '0') * parseFloat(curr.height || '0') * parseFloat(curr.length || '0') * parseFloat(curr.units || '0') / volumeCalculationFactor;\r\n\t\t\t\t\treturn acc + volume;\r\n\t\t\t\t}, 0));\r\n\t\t\t\tconst formattedWeight = formatNumber(unitsPackages.boxPackages.reduce((acc, curr) => acc + parseFloat(curr.weight || '0'), 0));\r\n\r\n\t\t\t\treturn {\r\n\t\t\t\t\tunits: unitsPackages.boxPackages.reduce((acc, curr) => acc + parseFloat(curr.units || '0'), 0),\r\n\t\t\t\t\tvolume: formattedVolume, \r\n\t\t\t\t\tweight: formattedWeight,\r\n\t\t\t\t\tweightUnit: unitsPackages.weightUnit,\r\n\t\t\t\t\tvolumeUnit: unitsPackages.volumeUnit,\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tif (unitsPackages?.packageType === PACKAGE_TYPE.ULD) {\r\n\t\t\t\tconst formattedVolume = formatNumber(unitsPackages.uldPackages.reduce((acc, curr) => acc + parseFloat(curr.volume || '0'), 0));\r\n\t\t\t\tconst formattedWeight = formatNumber(unitsPackages.uldPackages.reduce((acc, curr) => acc + parseFloat(curr.weight || '0'), 0));\r\n\t\t\t\treturn {\r\n\t\t\t\t\tunits: unitsPackages.uldPackages.length, \r\n\t\t\t\t\tvolume: formattedVolume, \r\n\t\t\t\t\tweight: formattedWeight,\r\n\t\t\t\t\tweightUnit: unitsPackages.weightUnit,\r\n\t\t\t\t\tvolumeUnit: unitsPackages.volumeUnit,\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\treturn { units: 0, volume: 0, weight: 0, weightUnit: WEIGHT_OPTIONS.KG, volumeUnit: VOLUME_OPTIONS.CBM };\r\n\t\t}\r\n\r\n\t\tcase SHIPMENT_OPTIONS.TOTALS: {\r\n\t\t\tconst formattedVolume = formatNumber(parseFloat(search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.volume || '0'));\r\n\t\t\tconst formattedWeight = formatNumber(parseFloat(search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.weight || '0'));\r\n\t\t\treturn {\r\n\t\t\t\tunits: search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.units || 0, \r\n\t\t\t\tvolume: formattedVolume, \r\n\t\t\t\tweight: formattedWeight,\r\n\t\t\t\tweightUnit: search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.weightUnit || WEIGHT_OPTIONS.KG,\r\n\t\t\t\tvolumeUnit: search.shipment_details[SEARCH_FIELDS.TOTALS_SHIPMENT]?.volumeUnit || VOLUME_OPTIONS.CBM,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tdefault:\r\n\t\t\treturn { units: 0, volume: 0, weight: 0, weightUnit: WEIGHT_OPTIONS.KG, volumeUnit: VOLUME_OPTIONS.CBM };\r\n\t}\r\n};\r\n","import React, { useEffect, useRef, useState } from \"react\";\r\n\r\nimport { Tooltip } from \"@freightos/design-system\";\r\n\r\nimport { STruncatedLabel } from \"../styled\";\r\n\r\n/**\r\n * TruncatedLabel component that automatically detects text truncation\r\n * and shows a tooltip with full text when content is truncated with ellipsis\r\n */\r\nconst TruncatedLabel = ({ \r\n\ttext = '', \r\n\ttestId, \r\n\tisPort = undefined,\r\n\tisLocationLabel = false,\r\n\tchildren = null\r\n}) => {\r\n\tconst labelRef = useRef(null);\r\n\tconst [isTruncated, setIsTruncated] = useState(false);\r\n\r\n\t/**\r\n\t * Check if the label text is truncated by comparing scroll width vs client width\r\n\t */\r\n\tconst checkTruncation = () => {\r\n\t\tif (labelRef.current) {\r\n\t\t\tconst element = labelRef.current;\r\n\t\t\tconst truncated = element.scrollWidth > element.clientWidth;\r\n\t\t\tsetIsTruncated(truncated);\r\n\t\t}\r\n\t};\r\n\r\n\t// Check truncation on mount and when text changes\r\n\tuseEffect(() => {\r\n\t\tcheckTruncation();\r\n\t}, [text]);\r\n\r\n\tconst labelElement = (\r\n\t\t<STruncatedLabel \r\n\t\t\tref={labelRef}\r\n\t\t\tdata-test-id={testId}\r\n\t\t\t$isLocationLabel={isLocationLabel}\r\n\t\t\t$isPort={isPort}\r\n\t\t>\r\n\t\t\t{children || text}\r\n\t\t</STruncatedLabel>\r\n\t);\r\n\r\n\t// Only show tooltip if text is actually truncated\r\n\tif (isTruncated) {\r\n\t\treturn (\r\n\t\t\t<Tooltip title={text} data-test-id={`${testId}-tooltip`}>\r\n\t\t\t\t<STruncatedLabel \r\n\t\t\t\t\tref={labelRef}\r\n\t\t\t\t\tdata-test-id={testId}\r\n\t\t\t\t\t$isLocationLabel={isLocationLabel}\r\n\t\t\t\t\t$isPort={isPort}\r\n\t\t\t\t>\r\n\t\t\t\t\t{children || text}\r\n\t\t\t\t</STruncatedLabel>\r\n\t\t\t</Tooltip>\r\n\t\t);\r\n\t}\r\n\r\n\treturn labelElement;\r\n};\r\n\r\nexport default TruncatedLabel; ","import React from \"react\";\r\n\r\nimport { Icon, tokens } from \"@freightos/design-system\";\r\n\r\nimport Flex from \"../../../common/components/Flex\";\r\nimport { FlexSpacings } from \"../../../common/helpers/constants\";\r\nimport { SLocationFlag } from \"../styled\";\r\nimport { groupAndOrderLocationsByCountries } from \"../utils\";\r\n\r\nimport TruncatedLabel from \"./TruncatedLabel.jsx\";\r\nimport { LOCATION_MODES } from \"../../../helpers/constant\";\r\n\r\nconst ItineraryDisplay = ({search, index, dataTestId}) => {\r\n\tconst isMultiOrigin = search.origin.length > 1;\t\r\n\tconst isMultiDestination = search.destination.length > 1;\r\n\tconst groupedOrigin = isMultiOrigin \r\n\t\t? groupAndOrderLocationsByCountries(search.origin) \r\n\t\t: { [search.origin[0].country]: search.origin };\r\n\tconst groupedDestination = isMultiDestination \r\n\t\t? groupAndOrderLocationsByCountries(search.destination) \r\n\t\t: { [search.destination[0].country]: search.destination };\r\n\treturn (\r\n\t\t<Flex alignItems='center' spacing={FlexSpacings.XSMALL} fullWidth>\r\n\t\t\t{Object.keys(groupedOrigin).map(countryCode =>{ \r\n\t\t\t\tconst labelOrigin = groupedOrigin[countryCode].map(origin => origin.selectedValue).join(', ');\r\n\t\t\t\treturn (\r\n\t\t\t\t\t<TruncatedLabel\r\n\t\t\t\t\t\tkey={countryCode}\r\n\t\t\t\t\t\ttext={labelOrigin}\r\n\t\t\t\t\t\tisLocationLabel\r\n\t\t\t\t\t\ttestId={`${dataTestId}-origin-${index}`}\r\n\t\t\t\t\t\tisPort={groupedOrigin[countryCode][0].type === LOCATION_MODES.SEAPORT}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<SLocationFlag\r\n\t\t\t\t\t\t\ttype='flag'\r\n\t\t\t\t\t\t\tcountry={countryCode}\r\n\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\tdata-test-id={`${dataTestId}-origin-flag-${index}`}\r\n\t\t\t\t\t\t\tstyle={{ marginRight: '4px' }}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{labelOrigin}\r\n\t\t\t\t\t</TruncatedLabel>\r\n\t\t\t\t);\r\n\t\t\t})}\r\n\t\t\t<Icon type='arrow-forward' style={{ marginRight: 0, color: tokens.fdsColorPrimaryGray90, flex: 'none' }} />\r\n\t\t\t{Object.keys(groupedDestination).map(countryCode => {\r\n\t\t\t\tconst labelDestination = groupedDestination[countryCode].map(destination => destination.selectedValue).join(', ');\r\n\t\t\t\treturn (\r\n\t\t\t\t\t<TruncatedLabel \r\n\t\t\t\t\t\tkey={countryCode} \r\n\t\t\t\t\t\ttext={labelDestination} \r\n\t\t\t\t\t\tisLocationLabel \r\n\t\t\t\t\t\ttestId={`${dataTestId}-destination-${index}`}\r\n\t\t\t\t\t\tisPort={groupedDestination[countryCode][0].type === LOCATION_MODES.SEAPORT}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<SLocationFlag\r\n\t\t\t\t\t\t\ttype='flag'\r\n\t\t\t\t\t\t\tcountry={countryCode}\r\n\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\tdata-test-id={`${dataTestId}-destination-flag-${index}`}\r\n\t\t\t\t\t\t\tstyle={{ marginRight: '4px' }}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{labelDestination}\r\n\t\t\t\t\t</TruncatedLabel>\r\n\t\t\t\t);\r\n\t\t\t})}\r\n\t\t</Flex>\r\n\t);\r\n};\r\n\r\nexport default ItineraryDisplay;","import React, { useMemo } from \"react\";\r\n\r\nimport { Icon } from \"@freightos/design-system\";\r\n\r\nimport Flex from \"../../../common/components/Flex\";\r\nimport { FlexSpacings } from \"../../../common/helpers/constants\";\r\nimport { SEARCH_PLATFORMS, TEMPERATURE_RANGES_DATA } from \"../constants\";\r\nimport { STinyWrapper, UnitIcon } from \"../styled\";\r\nimport { chooseIconsType, shipmentTotalsBasedOnPackages } from \"../utils\";\r\n\r\nimport TruncatedLabel from \"./TruncatedLabel.jsx\";\r\n\r\nconst ShipmentAndCommodityDisplay = ({search, index, dataTestId}) => {\r\n\tconst platformType = search.platform_type;\r\n\tconst icons = chooseIconsType(search);\r\n\tconst {units, volume, weight, weightUnit, volumeUnit} = useMemo(() => shipmentTotalsBasedOnPackages(search), [search]);\r\n\tconst isTemperature = search.commodity.length === 1 && search.commodity[0].is_temperature;\r\n\tconst temperatureRange = search.commodity_temperature?.tempRange && isTemperature \r\n\t\t? TEMPERATURE_RANGES_DATA[search.commodity_temperature?.tempRange][search.commodity_temperature?.temperatureSystem] \r\n\t\t: '';\r\n\r\n\treturn <Flex spacing={FlexSpacings.XSMALL} alignItems='center' fullWidth key={index}>\r\n\t\t{platformType === SEARCH_PLATFORMS.QUOTATION ? (\r\n\t\t\t<STinyWrapper alignItems='center' spacing={FlexSpacings.SMALL} style={{flex: 1}}>\r\n\t\t\t\t{icons.map((icon, iconIndex) => <UnitIcon type={icon} key={`${index}-${iconIndex}`} size='tiny' data-test-id={`${dataTestId}rs-package-icon-${index}-${iconIndex}`} />)}\r\n\t\t\t\t<TruncatedLabel\r\n\t\t\t\t\ttext={search.commodity.map(commodity => commodity.label).join(', ')}\r\n\t\t\t\t\ttestId={`${dataTestId}rs-commodity-${index}`}\r\n\t\t\t\t/>\r\n\t\t\t</STinyWrapper>\r\n\t\t) : (\r\n\t\t\t<STinyWrapper alignItems='center' spacing={FlexSpacings.SMALL}>\r\n\t\t\t\t<Flex\r\n\t\t\t\t\talignItems='center'\r\n\t\t\t\t\tspacing={FlexSpacings.XSMALL}\r\n\t\t\t\t\tdata-test-id={`rs-${index}-units`}\r\n\t\t\t\t\t\r\n\t\t\t\t>\r\n\t\t\t\t\t{units} {icons.map((icon, iconIndex) => <UnitIcon type={icon} key={`${index}-${iconIndex}`} size='tiny' data-test-id={`${dataTestId}rs-package-icon-${index}-${iconIndex}`}/>)}\r\n\t\t\t\t</Flex>\r\n\t\t\t\t<span data-test-id={`${dataTestId}rs-volume-${index}`}>\r\n\t\t\t\t\t{volume} {volumeUnit}\r\n\t\t\t\t</span>\r\n\t\t\t\t{weight && (\r\n\t\t\t\t\t<span data-test-id={`${dataTestId}rs-weight-${index}`}>\r\n\t\t\t\t\t\t{weight} {weightUnit}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t)}\r\n\t\t\t\t<TruncatedLabel\r\n\t\t\t\t\ttext={search.commodity.map(commodity => commodity.label).join(', ')}\r\n\t\t\t\t\ttestId={`${dataTestId}rs-commodity-${index}`}\r\n\t\t\t\t/>\r\n\t\t\t\t{isTemperature && (\r\n\t\t\t\t\t<Flex\r\n\t\t\t\t\t\talignItems='center'\r\n\t\t\t\t\t\tspacing={FlexSpacings.XSMALL}\r\n\t\t\t\t\t\tdata-test-id={`${dataTestId}rs-temperature-${index}`}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<Icon type='temperature-low' size=\"tiny\" data-test-id={`${dataTestId}rs-temperature-icon-${index}`} />\r\n\t\t\t\t\t\t<span style={{whiteSpace: 'nowrap'}}>\r\n\t\t\t\t\t\t\t{temperatureRange}\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t</Flex>\r\n\t\t\t\t)}\r\n\t\t\t</STinyWrapper>\r\n\t\t)}\r\n\t</Flex>;\r\n};\r\n\r\nexport default ShipmentAndCommodityDisplay;","import React from \"react\";\r\n\r\nimport { tokens } from \"@freightos/design-system\";\r\n\r\nimport { useFormikContext } from \"formik\";\r\n\r\nimport { FlexDirections, FlexSpacings } from \"../../../common/helpers/constants\";\r\nimport { saveLastUsedSearch } from \"../apis\";\r\nimport { SCard } from \"../styled\";\r\n\r\nimport ItineraryDisplay from \"./ItineraryDisplay.jsx\";\r\nimport ShipmentAndCommodityDisplay from \"./ShipmentAndCommodityDisplay.jsx\";\r\n\r\nexport const SearchCard = (\r\n\t{ search, index, setIsOpen, dataTestId, onRecentSearchSelect }) => {\r\n\r\n\tconst handleClick = async () => {\r\n\t\tonRecentSearchSelect(search);\r\n\t\ttry {\r\n\t\t\tawait saveLastUsedSearch(search.id);\r\n\t\t} catch (error) {\r\n\t\t\tconsole.error(error);\r\n\t\t}\t\r\n\t\tsetIsOpen(false);\r\n\t};\r\n\r\n\treturn <SCard \r\n\t\tdirection={FlexDirections.VERTICAL} \r\n\t\tfullWidth \r\n\t\tspacing={FlexSpacings.XSMALL}\r\n\t\tkey={search.id}\r\n\t\tstyle={{\r\n\t\t\tpadding: tokens.fdsComponentSpacingSm,\r\n\t\t}}\r\n\t\tdata-test-id={`${dataTestId}rs-card-${index}`}\r\n\t\tonClick={() => {\r\n\t\t\thandleClick();\r\n\t\t}}>\r\n\t\t<ItineraryDisplay search={search} index={index} dataTestId={dataTestId} />\r\n\t\t<ShipmentAndCommodityDisplay search={search} index={index} dataTestId={dataTestId} />\r\n\t</SCard>;\t\r\n};","import React from 'react';\r\n\r\nimport { Icon, tokens } from '@freightos/design-system';\r\nimport { TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport { FlexDirections } from '../../common/helpers/constants';\r\nimport { StyledMenu } from '../../helpers/styled';\r\n\r\nimport { orderRecentSearches } from './adapters';\r\nimport { SearchCard } from './components/SearchCard.jsx';\r\nimport { SListWrapper, STitle } from './styled';\r\n\r\nconst RecentSearches = ({ recentSearches, setIsOpen, dataTestId, onRecentSearchSelect, initialValues }) => {\r\n\tconst firstSixSearches = recentSearches ? orderRecentSearches(recentSearches) : [];\r\n\treturn (\r\n\t\t<StyledMenu>\r\n\t\t\t<STitle>\r\n\t\t\t\t<Icon data-test-id={`${dataTestId}rs-icon`} color={tokens.fdsColorPrimaryGray60} type='history' size='tiny' /><TranslatableText stringId='Recent searches' />\r\n\t\t\t</STitle>\r\n\t\t\t<SListWrapper direction={FlexDirections.VERTICAL} fullWidth>\r\n\t\t\t\t{firstSixSearches.map((search, index) => (\r\n\t\t\t\t\t<SearchCard \r\n\t\t\t\t\t\tonRecentSearchSelect={onRecentSearchSelect} \r\n\t\t\t\t\t\tinitialValues={initialValues} \r\n\t\t\t\t\t\tsearch={search} \r\n\t\t\t\t\t\tindex={index} \r\n\t\t\t\t\t\tkey={search.id}\r\n\t\t\t\t\t\tsetIsOpen={setIsOpen} dataTestId={dataTestId} />\r\n\t\t\t\t))}\r\n\t\t\t</SListWrapper>\r\n\t\t</StyledMenu>\r\n\t);\r\n};\r\n\r\nexport default RecentSearches;\r\n","import { RECENT_SEARCHES_LIMIT, RS_PLATFORM_TYPES, SEARCH_FIELDS, SEARCH_PLATFORMS } from \"./constants\";\r\n\r\nexport const formatPlatformType = (platformType) => {\r\n\tswitch (platformType) {\r\n\t\tcase SEARCH_PLATFORMS.BOOKING:\r\n\t\t\treturn RS_PLATFORM_TYPES.BOOK;\r\n\t\tcase SEARCH_PLATFORMS.QUOTATION:\r\n\t\t\treturn RS_PLATFORM_TYPES.QUOTE;\r\n\t\tcase SEARCH_PLATFORMS.BI:\r\n\t\t\treturn RS_PLATFORM_TYPES.BI;\r\n\t\tdefault:\r\n\t\t\treturn platformType;\r\n\t}\r\n};\r\n\r\nexport const formatPlatformTypeFromRecentSearch = (platformType) => {\r\n\tswitch (platformType) {\r\n\t\tcase RS_PLATFORM_TYPES.BOOK:\r\n\t\t\treturn SEARCH_PLATFORMS.BOOKING;\r\n\t\tcase RS_PLATFORM_TYPES.QUOTE:\r\n\t\t\treturn SEARCH_PLATFORMS.QUOTATION;\r\n\t\tcase RS_PLATFORM_TYPES.BI:\r\n\t\t\treturn SEARCH_PLATFORMS.BI;\r\n\t\tdefault:\r\n\t\t\treturn SEARCH_PLATFORMS.BOOKING;\r\n\t}\r\n};\r\n\r\nconst formatContainerShipment = (search) => ({\t\r\n\t[SEARCH_FIELDS.CONTAINER_PACKAGES]: search.shipment_details[SEARCH_FIELDS.CONTAINER_PACKAGES],\r\n});\r\n\r\nexport const orderRecentSearches = (recentSearches) => {\r\n\tconst sorted = [...recentSearches].sort((a, b) => {\r\n\t\t// First: items with is_saved = true, then the rest\r\n\t\tif (a.is_saved !== b.is_saved) {\r\n\t\t\treturn a.is_saved ? -1 : 1;\r\n\t\t}\r\n\t\t// Among saved: sort by saved_update_date (most recent first)\r\n\t\tif (a.is_saved && b.is_saved) {\r\n\t\t\tconst aDate = new Date(a.saved_update_date).getTime();\r\n\t\t\tconst bDate = new Date(b.saved_update_date).getTime();\r\n\t\t\treturn bDate - aDate;\r\n\t\t}\r\n\t\t// Among non-saved: sort by most recent date (last_time_used_date vs saved_update_date)\r\n\t\tconst aMaxDate = new Date(Math.max(\r\n\t\t\tnew Date(a.last_time_used_date).getTime(),\r\n\t\t\tnew Date(a.saved_update_date || 0).getTime()\r\n\t\t)).getTime();\r\n\t\tconst bMaxDate = new Date(Math.max(\r\n\t\t\tnew Date(b.last_time_used_date).getTime(),\r\n\t\t\tnew Date(b.saved_update_date || 0).getTime()\r\n\t\t)).getTime();\r\n\t\treturn bMaxDate - aMaxDate;\r\n\t});\r\n\treturn sorted.slice(0, RECENT_SEARCHES_LIMIT);\r\n};\r\n\r\n","import React from 'react';\r\n\r\nimport { Spin } from '@freightos/design-system';\r\nimport { TRANSLATION_MODULES, TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { NoMatchingResults } from '../helpers/styled';\r\n\r\nimport RecentSearches from './RecentSearches/index.jsx';\r\n\r\nconst SelectorContent = ({ \r\n\tisLoading, \r\n\trecentSearches, \r\n\tsearchKey, \r\n\tdataTestId, \r\n\tsetIsOpen, \r\n\tonRecentSearchSelect, \r\n\tinitialValues }) => {\r\n\t// Return null for initial state (no search, no recent searches)\r\n\tif (!searchKey && (!recentSearches || recentSearches.length === 0)) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tif (isLoading) {\r\n\t\treturn <Spin size='small' />;\r\n\t}\r\n\r\n\tif (recentSearches?.length > 0 && !searchKey.trim()) {\r\n\t\treturn (\r\n\t\t\t<RecentSearches\r\n\t\t\t\trecentSearches={recentSearches}\r\n\t\t\t\tdataTestId={dataTestId}\r\n\t\t\t\tsetIsOpen={setIsOpen}\r\n\t\t\t\tonRecentSearchSelect={onRecentSearchSelect}\r\n\t\t\t\tinitialValues={initialValues}\r\n\t\t\t/>\r\n\t\t);\r\n\t}\r\n\r\n\tif (searchKey.trim()) {\r\n\t\treturn (\r\n\t\t\t<NoMatchingResults>\r\n\t\t\t\t<TranslatableText stringId='No matching results' module={TRANSLATION_MODULES.SearchAndBook} />\r\n\t\t\t</NoMatchingResults>\r\n\t\t);\r\n\t}\r\n\r\n\treturn null;\r\n};\r\n\r\nSelectorContent.propTypes = {\r\n\tisLoading: PropTypes.bool,\r\n\trecentSearches: PropTypes.array,\r\n\tsearchKey: PropTypes.string,\r\n\tonSelect: PropTypes.func,\r\n\tdataTestId: PropTypes.string,\r\n\tsetIsOpen: PropTypes.func,\r\n};\r\n\r\nexport default SelectorContent;\r\n","export default class Environment {\r\n\tstatic isProduction() {\r\n\t\treturn process.env.REACT_APP_CUSTOM_ENV === 'prod';\r\n\t}\r\n\r\n\tstatic isTest() {\r\n\t\treturn process.env.REACT_APP_CUSTOM_ENV === 'test';\r\n\t}\r\n\r\n\tstatic isLocal() {\r\n\t\treturn process.env.REACT_APP_CUSTOM_ENV === 'dev';\r\n\t}\r\n}\r\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\r\n\r\nimport { Notification } from '@freightos/design-system';\r\nimport { debounce } from 'lodash';\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { DEFAULT_LOCATION_MODE, LOCATION_MODES_MAP, MAX_TAG_COUNT, MAX_TAG_COUNT_MULTIPLE, SelectModes } from '../helpers/constant';\r\nimport { DebounceSelector, DropdownGlobalStyle } from '../helpers/styled';\r\n\r\nimport SelectorContent from './SelectorContent';\r\nimport Environment from 'common/helpers/Environment';\r\n\r\nconst DebounceSelect = ({\r\n\tfetchOptions,\r\n\trenderedOptions,\r\n\trecentSearches = [],\r\n\thasError,\r\n\tmode,\r\n\tdataTestId,\r\n\tvalue,\r\n\tdebounceTimeout = 800,\r\n\tactiveLocationMode,\r\n\tdefaultLocation,\r\n\tonChange,\r\n\t...props\r\n}) => {\r\n\tconst [options, setOptions] = useState([]);\r\n\tconst [isLoading, setIsLoading] = useState(false);\r\n\tconst [searchKey, setSearchKey] = useState('');\r\n\tconst fetchRef = useRef(0);\r\n\tconst [isOpen, setIsOpen] = useState(false);\r\n\tconst [maxTagCount, setMaxTagCount] = useState(MAX_TAG_COUNT);\r\n\tconst timeoutRef = useRef();\r\n\r\n\tuseEffect(() => {\r\n\t\tif ((!value || value.length === 0) && !isOpen) {\r\n\t\t\tsetOptions([]);\r\n\t\t\tsetSearchKey('');\r\n\t\t}\r\n\t}, [value, isOpen]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (activeLocationMode !== DEFAULT_LOCATION_MODE) {\r\n\t\t\tsetOptions(prevOptions =>\r\n\t\t\t\tprevOptions.filter(option => option.label === LOCATION_MODES_MAP[activeLocationMode].label)\r\n\t\t\t);\r\n\t\t}\r\n\t\tsetIsOpen(false);\r\n\r\n\t\t// Clear any existing timeout\r\n\t\tif (timeoutRef.current) {\r\n\t\t\tclearTimeout(timeoutRef.current);\r\n\t\t}\r\n\r\n\t\ttimeoutRef.current = setTimeout(() => {\r\n\t\t\tdocument.activeElement.blur(); // remove focus from input\r\n\t\t\tdocument.body.click(); // simulate outside click\r\n\t\t\tconst active = document.querySelector('.ant-select-focused');\r\n\t\t\tif (active) {\r\n\t\t\t\tactive.classList.remove('ant-select-focused');\r\n\t\t\t}\r\n\t\t\tsetMaxTagCount(MAX_TAG_COUNT);\r\n\t\t}, 100);\r\n\r\n\t\t// Cleanup function\r\n\t\treturn () => {\r\n\t\t\tif (timeoutRef.current) {\r\n\t\t\t\tclearTimeout(timeoutRef.current);\r\n\t\t\t}\r\n\t\t};\r\n\t}, [activeLocationMode]);\r\n\r\n\tconst debounceFetcher = useMemo(() => {\r\n\t\tconst loadOptions = async optionValue => {\r\n\t\t\tsetSearchKey(optionValue);\r\n\t\t\tfetchRef.current += 1;\r\n\t\t\tconst fetchId = fetchRef.current;\r\n\r\n\t\t\tsetOptions([]);\r\n\t\t\tsetIsLoading(true);\r\n\r\n\t\t\tlet returnOptions = null;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tconst newOptions = await fetchOptions(optionValue);\r\n\t\t\t\tif (fetchId === fetchRef.current) {\r\n\t\t\t\t\tsetOptions(newOptions);\r\n\t\t\t\t\treturnOptions = newOptions;\r\n\t\t\t\t}\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('Error fetching options:', error);\r\n\t\t\t\tif (fetchId === fetchRef.current) {\r\n\t\t\t\t\tNotification.danger({\r\n\t\t\t\t\t\tmessage: 'Search failed',\r\n\t\t\t\t\t\tdescription: 'Unable to fetch location results. Please try again later.',\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t} finally {\r\n\t\t\t\tif (fetchId === fetchRef.current) {\r\n\t\t\t\t\tsetIsLoading(false);\r\n\t\t\t\t\treturn returnOptions;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\treturn debounce(loadOptions, debounceTimeout);\r\n\t}, [fetchOptions, debounceTimeout]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (!defaultLocation?.code) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst loadDefaultLocation = async () => {\r\n\t\t\ttry {\r\n\t\t\t\tsetOptions([]);\r\n\t\t\t\tsetIsLoading(true);\r\n\t\t\t\t\r\n\t\t\t\tconst options = await fetchOptions(defaultLocation.code);\r\n\t\t\t\tsetOptions(options);\r\n\t\t\t\t\r\n\t\t\t\tif (!options || options.length === 0) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tlet match = null;\r\n\t\t\t\t\r\n\t\t\t\tif (defaultLocation.type) {\r\n\t\t\t\t\tconst targetGroup = options.find(group => \r\n\t\t\t\t\t\tgroup.label.toLowerCase() === LOCATION_MODES_MAP[defaultLocation.type]?.label.toLowerCase()\r\n\t\t\t\t\t);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (targetGroup?.options) {\r\n\t\t\t\t\t\tmatch = targetGroup.options.find(option => \r\n\t\t\t\t\t\t\toption.code.toLowerCase() === defaultLocation.code.toLowerCase() || \r\n\t\t\t\t\t\t\toption.selectedValue.toLowerCase() === defaultLocation.code.toLowerCase()\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (!match) {\r\n\t\t\t\t\tmatch = options\r\n\t\t\t\t\t\t.map(group => group.options)\r\n\t\t\t\t\t\t.flat()\r\n\t\t\t\t\t\t.find(option => \r\n\t\t\t\t\t\t\toption.code.toLowerCase() === defaultLocation.code.toLowerCase() || \r\n\t\t\t\t\t\t\toption.selectedValue.toLowerCase() === defaultLocation.code.toLowerCase()\r\n\t\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (match && onChange) {\r\n\t\t\t\t\tconst formattedMatch = {\r\n\t\t\t\t\t\tkey: JSON.stringify(match),\r\n\t\t\t\t\t\tlabel: match.selectedValue || match.displayLabel || match.code\r\n\t\t\t\t\t};\r\n\t\t\t\t\tonChange([formattedMatch]);\r\n\t\t\t\t}\r\n\t\t\t} catch (error) {\r\n\t\t\t\tif (Environment.isLocal()) {\r\n\t\t\t\t\tconsole.error('Error loading default location:', error);\r\n\t\t\t\t}\r\n\t\t\t} finally {\r\n\t\t\t\tsetIsLoading(false);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tloadDefaultLocation();\r\n\t}, [defaultLocation?.code, defaultLocation?.type]);\r\n\r\n\tconst shouldShowDropdown = () => isLoading || searchKey.trim() || recentSearches?.length > 0;\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<DropdownGlobalStyle />\r\n\t\t\t<DebounceSelector\r\n\t\t\t\tmaxTagCount={maxTagCount}\r\n\t\t\t\tonSearch={debounceFetcher}\r\n\t\t\t\t$hasError={hasError}\r\n\t\t\t\tloading={isLoading}\r\n\t\t\t\toptions={options}\r\n\t\t\t\tfilterOption={false}\r\n\t\t\t\tnotFoundContent={\r\n\t\t\t\t\t<SelectorContent\r\n\t\t\t\t\t\tisLoading={isLoading}\r\n\t\t\t\t\t\trecentSearches={recentSearches}\r\n\t\t\t\t\t\tsearchKey={searchKey}\r\n\t\t\t\t\t\tdataTestId={dataTestId}\r\n\t\t\t\t\t\tsetIsOpen={setIsOpen}\r\n\t\t\t\t\t\tonRecentSearchSelect={props.onRecentSearchSelect}\r\n\t\t\t\t\t\tinitialValues={props.initialValues}\r\n\t\t\t\t\t/>\r\n\t\t\t\t}\r\n\t\t\t\tmode={mode}\r\n\t\t\t\tdata-test-id={`${dataTestId}-selector`}\r\n\t\t\t\tallowClear={mode === SelectModes.SINGLE}\r\n\t\t\t\tlabelInValue\r\n\t\t\t\toptionLabelProp='label'\r\n\t\t\t\tshowSearch\r\n\t\t\t\tonDropdownVisibleChange={open => {\r\n\t\t\t\t\tif (open) {\r\n\t\t\t\t\t\tsetMaxTagCount(MAX_TAG_COUNT_MULTIPLE);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsetMaxTagCount(MAX_TAG_COUNT);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetOptions([]);\r\n\t\t\t\t\tsetSearchKey('');\r\n\t\t\t\t\tsetIsOpen(open);\r\n\t\t\t\t}}\r\n\t\t\t\topen={isOpen && shouldShowDropdown()}\r\n\t\t\t\tvalue={value}\r\n\t\t\t\tonChange={onChange}\r\n\t\t\t\t{...props}\r\n\t\t\t>\r\n\t\t\t\t{renderedOptions(options)}\r\n\t\t\t</DebounceSelector>\r\n\t\t</>\r\n\t);\r\n};\r\n\r\nDebounceSelect.propTypes = {\r\n\tfetchOptions: PropTypes.func.isRequired,\r\n\trenderedOptions: PropTypes.func.isRequired,\r\n\thasError: PropTypes.bool,\r\n\tmode: PropTypes.string.isRequired,\r\n\tdataTestId: PropTypes.string,\r\n\tdebounceTimeout: PropTypes.number,\r\n\tvalue: PropTypes.array,\r\n\tactiveLocationMode: PropTypes.string,\r\n\trecentSearches: PropTypes.array,\r\n\tmaxTagCount: PropTypes.number,\r\n\tdefaultLocation: PropTypes.shape({\r\n\t\tcode: PropTypes.string.isRequired,\r\n\t\ttype: PropTypes.string.isRequired,\r\n\t}),\r\n\tonChange: PropTypes.func,\r\n};\r\n\r\nexport default DebounceSelect;\r\n","import React from 'react';\r\n\r\nimport { Tooltip } from '@freightos/design-system';\r\nimport PropTypes from 'prop-types';\r\n\r\nimport { SelectedOptionLabel } from '../helpers/styled';\r\n\r\nconst MaxPortsPlaceholder = ({ omittedPorts, dataTestId }) => {\r\n\tconst selectedItems = omittedPorts.map(omittedPort => JSON.parse(omittedPort.key)?.selectedValue);\r\n\r\n\treturn (\r\n\t\t<Tooltip title={selectedItems.join(',')}>\r\n\t\t\t<SelectedOptionLabel data-test-id={`${dataTestId}-extra-ports`}>{`+${omittedPorts.length}`}</SelectedOptionLabel>\r\n\t\t</Tooltip>\r\n\t);\r\n};\r\n\r\nMaxPortsPlaceholder.propTypes = {\r\n\tomittedPorts: PropTypes.array,\r\n\tdataTestId: PropTypes.string,\r\n};\r\n\r\nexport default MaxPortsPlaceholder;\r\n","import httpClient from '@freightos/http-client';\r\n\r\nimport { LOCATION_MODES_MAP } from './constant';\r\n\r\n/**\r\n * Fetches locations based on the provided location modes and query.\r\n *\r\n * @param {Array<string>} locationModes - Array of location modes to search for.\r\n * @param {string} query - The search query.\r\n * @returns {Promise<Object>} A promise resolving to an object containing location results.\r\n */\r\nexport const getLocations = async (locationModes, query, customer) => {\r\n\ttry {\r\n\t\tconst sources = locationModes.reduce(\r\n\t\t\t(acc, mode) => ({\r\n\t\t\t\t...acc,\r\n\t\t\t\t[LOCATION_MODES_MAP[mode].key]: {\r\n\t\t\t\t\ttype: mode.toUpperCase(),\r\n\t\t\t\t\t...(customer?.code ? { searchTerm: customer.name } : {}),\r\n\t\t\t\t\t...(LOCATION_MODES_MAP[mode].groupedBy ? { groupedBy: LOCATION_MODES_MAP[mode].groupedBy } : {}),\r\n\t\t\t\t},\r\n\t\t\t}),\r\n\t\t\t{}\r\n\t\t);\r\n\t\tconst response = await httpClient.post('/geocoder/api/v3/geocoder/locations', {\r\n\t\t\tquery,\r\n\t\t\tlimit: 5,\r\n\t\t\tsources,\r\n\t\t});\r\n\t\treturn response.data;\r\n\t} catch (error) {\r\n\t\tconsole.error('Error fetching locations:', error);\r\n\t\treturn { results: {} };\r\n\t}\r\n};\r\n","import React from 'react';\r\n\r\nimport { Avatar, Chip, Icon, Message, Option, Select, tokens } from '@freightos/design-system';\r\nimport { TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport Flex from 'common/components/Flex';\r\nimport { FlexSpacings } from '../common/helpers/constants';\r\nimport { getLocations } from './apis';\r\nimport { DEFAULT_LOCATION_MODE, LOCATION_MODES, LOCATION_MODES_MAP, SelectModes } from './constant';\r\nimport { SelectOptionLabel, SelectedOptionLabel } from './styled';\r\n\r\nimport Environment from '../common/helpers/Environment';\r\n\r\n/**\r\n * Normalizes location/port codes for comparisons.\r\n */\r\nexport const normalizeLocationCode = (code) => (code || '').trim().toUpperCase();\r\n\r\n/**\r\n * Safely parses a serialized option key (JSON) into an object.\r\n */\r\nexport const safeParseOptionKey = (key) => {\r\n\ttry {\r\n\t\treturn typeof key === 'string' ? JSON.parse(key) : null;\r\n\t} catch {\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\n/**\r\n * Extracts a normalized code from an autofill match option.\r\n */\r\nexport const getNormalizedCodeFromMatchOption = (matchOption) => {\r\n\tconst matchObj = safeParseOptionKey(matchOption?.key);\r\n\treturn normalizeLocationCode(matchObj?.code || matchObj?.selectedValue);\r\n};\r\n\r\n/**\r\n * Returns a Set of normalized codes from the current selected locations array.\r\n */\r\nexport const getExistingNormalizedCodes = (locations) =>\r\n\tnew Set((locations || []).map((loc) => normalizeLocationCode(loc?.code || loc?.selectedValue)));\r\n\r\n/**\r\n * Get the gateway API prefix based on the environment.\r\n *\r\n * @returns {string} The gateway API prefix.\r\n */\r\nexport const getGatewayApiPrefix = (isTalaia) => {\r\n\tconst domain = Environment.isProduction()\r\n\t\t? 'freightos.com'\r\n\t\t: 'test-freightos.com';\r\n\treturn `https://platform.${domain}/gateway/${isTalaia ? 'webcargo-talaia' : 'webcargo-alpha'}`;\r\n};\r\n\r\n// Deterministic JSON stringify\r\nconst stableStringify = (obj) => {\r\n const allKeys = [];\r\n JSON.stringify(obj, (k, v) => {\r\n\tallKeys.push(k);\r\n\treturn v;\r\n });\r\n const uniqSortedKeys = Array.from(new Set(allKeys)).sort();\r\n return JSON.stringify(obj, uniqSortedKeys);\r\n};\r\n\r\nconst normalizeLocationForKey = (loc) => {\r\n const {\r\n displayLabel,\r\n selectedValue,\r\n formattedNameOrAddress,\r\n code,\r\n countryCode,\r\n stateOrProvince,\r\n city,\r\n latitude,\r\n longitude,\r\n postalOrZipCode,\r\n sourceType,\r\n locationType,\r\n type,\r\n\tcountryName,\r\n } = loc || {};\r\n\r\n return {\r\n displayLabel,\r\n selectedValue: selectedValue || code,\r\n formattedNameOrAddress,\r\n code: code || selectedValue,\r\n country: countryCode,\r\n\tcountryName,\r\n stateOrProvince: stateOrProvince ?? null,\r\n city: city ?? null,\r\n latitude: latitude ?? null,\r\n longitude: longitude ?? null,\r\n postalOrZipCode: postalOrZipCode ?? null,\r\n sourceType: sourceType ?? null,\r\n locationType: locationType ?? null,\r\n type: type ?? sourceType,\r\n };\r\n};\r\n\r\nexport const stableKeyFromLocation = (loc) => {\r\n try {\r\n const parsed = typeof loc?.key === 'string'\r\n ? JSON.parse(decodeHtmlEntities(loc.key))\r\n : loc;\r\n return stableStringify(normalizeLocationForKey(parsed));\r\n } catch {\r\n return stableStringify(normalizeLocationForKey(loc));\r\n }\r\n};\r\n\r\n/**\r\n * Get location input option.\r\n *\r\n * @param {Object} location - The location object to get the option for.\r\n * @returns {Object} The location input option.\r\n */\r\nexport const getLocationInputOption = (location) => {\r\n\tif(location) {\r\n \t\tconst displayLabel = location.label || location.selectedValue;\r\n \t\tconst key = stableKeyFromLocation(location);\r\n\r\n \t\tconst label = displayLabel\r\n \t\t ? (\r\n \t\t <>\r\n \t\t <Icon type={location.sourceType ? LOCATION_MODES_MAP[location.sourceType]?.icon : 'location'} size='tiny' />\r\n \t\t \r\n \t\t <SelectedOptionLabel>{displayLabel}</SelectedOptionLabel>\r\n \t\t </>\r\n \t\t )\r\n \t\t : undefined;\r\n\r\n \t\treturn { key, label };\r\n\t} \r\n\treturn undefined;\r\n};\r\n\r\n/**\r\n * Formats location(s) into option(s) with key and label for the location input.\r\n *\r\n * @param {Object|Array} locations - Single location object or array of location objects.\r\n * @returns {Object|Array} Formatted option(s) with key and label.\r\n * - For single location: Returns {key: string, label: ReactElement}.\r\n * - For multiple locations: Returns array of {key: string, label: ReactElement}.\r\n */\r\nexport const getLocationInputValue = locations => {\r\n\tconst formatLocation = loc => getLocationInputOption(loc);\r\n\treturn Array.isArray(locations) ? locations.map(formatLocation) : formatLocation(locations);\r\n};\r\n\r\n/**\r\n * Renders location options (ports and addresses) in a select dropdown with icons and grouping.\r\n *\r\n * @param {Array} locationOptions - Array of location option groups to render.\r\n * @param {string} dataTestId - Test ID prefix for components.\r\n * @returns {Array<ReactElement>} Array of Select.OptGroup components containing the location options.\r\n *\r\n * @example\r\n * Location options format:\r\n * [\r\n * {\r\n * label: \"seaport\",\r\n * options: [{\r\n * label: \"Port Name\",\r\n * key: \"{...port data...}\"\r\n * }]\r\n * }\r\n * ]\r\n */\r\nexport const renderLocationOptions = (optionGroups, dataTestId) => {\r\n\r\n\tif (!(optionGroups || []).some(group => group?.options?.length > 0) )\r\n\t\treturn;\r\n\r\n\treturn optionGroups.map(group => {\r\n\t\tconst location = Object.values(LOCATION_MODES_MAP).find(mode => mode.label === group.label);\r\n\t\tconst locationOptionIcon = location?.icon;\r\n\r\n\t\treturn (\r\n\t\t\t<Select.OptGroup\r\n\t\t\t\tlabel={\r\n\t\t\t\t\t<span style={{fontFamily: 'Open Sans'}}>\r\n\t\t\t\t\t\t<Icon size='tiny' type={locationOptionIcon} />\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t{group.label}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t}\r\n\t\t\t\tkey={group.label}\r\n\t\t\t\tdata-test-id={`${dataTestId}-group-${group.label}`}\r\n\t\t\t>\r\n\t\t\t\t{group.options?.map(option => {\r\n\t\t\t\t\tconst { countryCode, selectedValue, displayLabel, type } = option;\r\n\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t<Option\r\n\t\t\t\t\t\t\tvalue={stableKeyFromLocation(option)}\r\n\t\t\t\t\t\t\ttitle={selectedValue}\r\n\t\t\t\t\t\t\tdata-test-id={`${dataTestId}-${group.label}-${selectedValue}`}\r\n\t\t\t\t\t\t\tstyle={{ paddingLeft: '8px' }}\r\n\t\t\t\t\t\t\tlabel={<>\r\n\t\t\t\t\t\t\t\t\t<Icon type={locationOptionIcon} size='tiny' />\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t<SelectedOptionLabel>{selectedValue}</SelectedOptionLabel>\r\n\t\t\t\t\t\t\t\t</>\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tkey={option.code}\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t<Flex fullWidth justifyContent='space-between'>\r\n\t\t\t\t\t\t\t\t<Flex spacing={FlexSpacings.XSMALL}>\r\n\t\t\t\t\t\t\t\t\t<span>\r\n\t\t\t\t\t\t\t\t\t\t<Avatar\r\n\t\t\t\t\t\t\t\t\t\t\ttype='flag'\r\n\t\t\t\t\t\t\t\t\t\t\tcountry={countryCode}\r\n\t\t\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\t\t\t\t\t\t\twidth: tokens.fdsSizeSm,\r\n\t\t\t\t\t\t\t\t\t\t\t\theight: tokens.fdsSizeSm,\r\n\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t\t\t<SelectOptionLabel>{displayLabel}</SelectOptionLabel>\r\n\t\t\t\t\t\t\t\t</Flex>\r\n\t\t\t\t\t\t\t\t{type === LOCATION_MODES.FULFILLMENT_CENTER && <Icon type='amazon' size='small' />}\r\n\t\t\t\t\t\t\t\t{type === LOCATION_MODES.ADDRESS_BOOK && <Chip type='neutral' iconType='address-book' />}\r\n\t\t\t\t\t\t\t</Flex>\r\n\t\t\t\t\t\t</Option>\r\n\t\t\t\t\t);\r\n\t\t\t\t})}\r\n\t\t\t</Select.OptGroup>\r\n\t\t);\r\n\t});\r\n};\r\n\r\n/**\r\n * Extracts fulfillment centers from addresses and adds them as a separate key in results\r\n * @param {Object} locationsResults - The locations results object\r\n * @param {string} addressKey - The key for addresses (default: 'address')\r\n * @returns {Object} Updated locations results with fulfillment centers separated\r\n */\r\nconst extractFulfillmentCenters = locationsResults => {\r\n\tlet updatedLocationsResults = { ...locationsResults };\r\n\t// Extract fulfillment centers from addresses\r\n\tconst fulfillmentCenters = locationsResults[LOCATION_MODES.ADDRESS].filter(\r\n\t\toption => option.sourceType === LOCATION_MODES.FULFILLMENT_CENTER\r\n\t);\r\n\t// Add fulfillment centers as a separate key in results\r\n\tif (fulfillmentCenters.length > 0) {\r\n\t\t// Create new object with specific order\r\n\t\tconst { address, ...otherTypes } = updatedLocationsResults;\r\n\t\tupdatedLocationsResults = {\r\n\t\t\t...otherTypes,\r\n\t\t\t[LOCATION_MODES.FULFILLMENT_CENTER]: fulfillmentCenters,\r\n\t\t\taddress: address.filter(option => option.type !== LOCATION_MODES.FULFILLMENT_CENTER),\r\n\t\t};\r\n\t}\r\n\r\n\treturn updatedLocationsResults;\r\n};\r\n\r\n/**\r\n * Fetches location data for the active location mode or supported modes.\r\n *\r\n * @param {string} activeLocationMode - The active location mode.\r\n * @param {Array} supportedLocationModes - Array of supported location modes.\r\n * @returns {Function} A function that takes a query string and returns a promise resolving to an array of formatted location objects.\r\n */\r\nexport const fetchLocations = (activeLocationMode, supportedLocationModes, customer) => async query => {\r\n\tif (!query) {\r\n\t\treturn [];\r\n\t}\r\n\r\n\tconst modes = activeLocationMode !== DEFAULT_LOCATION_MODE ? [activeLocationMode] : supportedLocationModes;\r\n\tconst locations = await getLocations(modes, query, customer);\r\n\r\n\tlet locationsResults = locations.results;\r\n\r\n\tif (locationsResults[LOCATION_MODES.ADDRESS]) {\r\n\t\tlocationsResults = extractFulfillmentCenters(locationsResults);\r\n\t}\t\r\n\r\n\treturn Object.keys(locationsResults).map(key => {\r\n\t\treturn {\r\n\t\t\tlabel: LOCATION_MODES_MAP[key]?.label || key,\r\n\t\t\toptions: locationsResults[key].map(option => ({\r\n\t\t\t\t...option,\r\n\t\t\t\ttype: option.sourceType,\r\n\t\t\t})),\r\n\t\t};\r\n\t});\r\n};\r\n\r\n/**\r\n * Processes location input changes by retrieving geocoder details for addresses\r\n * or transforming port locations into a standardized format.\r\n *\r\n * For addresses (with placeId), fetches full geocoder details.\r\n * For ports, transforms them into geocoder address schema.\r\n * Filters out any failed location processing.\r\n *\r\n * @param {Object|Array} changedLocations - The new location value(s) to process.\r\n * @param {Function} onChange - Callback to handle the processed location(s).\r\n */\r\nexport const onChangeLocation = async (changedLocations, onChange) => {\r\n\tconst locations = Array.isArray(changedLocations) ? changedLocations : [changedLocations];\r\n\r\n\tconst locationsDetails = await Promise.all(\r\n\t\tlocations.map(async location => {\r\n\t\t\ttry {\r\n\t\t\t\tconst raw = location?.key;\r\n\t\t\t\tconst json = decodeHtmlEntities(raw);\r\n\t\t\t\tconst parsed = JSON.parse(json);\r\n\t\t\t\treturn { key: json, ...parsed };\r\n\t\t\t} catch (err) {\r\n\t\t\t\t// Useful in case one of the addresses has encountered a failure while retrieving its details\r\n\t\t\t\t// It won't cause all the addresses to stop working properly\r\n\t\t\t\treturn undefined;\r\n\t\t\t}\r\n\t\t})\r\n\t);\r\n\r\n\tonChange(locationsDetails.filter(Boolean));\r\n};\r\n\r\n/**\r\n * Handles changes to the location input value.\r\n *\r\n * @param {Object|Array} location - The new location value(s) selected.\r\n * @param {string} selectionMode - The current selection mode ('single' or 'multiple').\r\n * @param {number} maxPorts - Maximum number of ports that can be selected in multiple mode.\r\n * @param {Function} setSelectedLocation - State setter for the selected location.\r\n * @param {Function} onChange - Callback to handle processed location changes.\r\n *\r\n * For multiple selection mode:\r\n * - Validates that selected ports don't exceed maxPorts limit.\r\n * - Shows error message if limit is exceeded.\r\n * - Updates state and triggers onChange with valid selections.\r\n *\r\n * For single selection mode:\r\n * - Updates selected location state directly.\r\n * - Triggers onChange with the new location if one is selected.\r\n */\r\nexport const handleLocationChange = (location, selectionMode, maxPorts, setSelectedLocation, onChange) => {\r\n\tif (selectionMode === SelectModes.MULTIPLE) {\r\n\t\tconst selectedPorts = Array.isArray(location) ? location : [];\r\n\t\tif (selectedPorts.length <= maxPorts) {\r\n\t\t\tsetSelectedLocation(selectedPorts);\r\n\t\t\tonChangeLocation(selectedPorts, onChange);\r\n\t\t} else {\r\n\t\t\tconst typePort = JSON.parse(selectedPorts[0]?.key)?.sourceType === LOCATION_MODES.AIRPORT ? (maxPorts > 1 ? 'airports' : 'airport') : (maxPorts > 1 ? 'ports' : 'port');\r\n\t\t\tMessage.danger(\r\n\t\t\t\t<>\r\n\t\t\t\t\t<TranslatableText stringId={'You cannot enter more than'}/>\r\n\t\t\t\t\t{' '} {maxPorts} {' '}\r\n\t\t\t\t\t<TranslatableText stringId={typePort} />\r\n\t\t\t\t</>\r\n\t\t\t);\r\n\t\t}\r\n\t} else {\r\n\t\tsetSelectedLocation(location);\r\n\t\tonChangeLocation(location, onChange);\r\n\t}\r\n};\r\n\r\n/**\r\n * Check if the location is an address\r\n * @param location - The location to check\r\n * @returns Whether the location is an address\r\n */\r\nexport const isLocationAddress = locationType =>\r\n\tlocationType &&\r\n\t(locationType === LOCATION_MODES.ADDRESS ||\r\n\t\tlocationType === LOCATION_MODES.LAST_MILE_ADDRESS ||\r\n\t\tlocationType === LOCATION_MODES.ADDRESS_BOOK ||\r\n\t\tlocationType === LOCATION_MODES.FULFILLMENT_CENTER);\r\n\r\nconst decodeHtmlEntities = (s) =>\r\n typeof s === 'string'\r\n ? s.replace(/"/g, '\"').replace(/"/g, '\"').replace(/&/g, '&')\r\n : s;\r\n\r\n/**\r\n * Extracts street address from displayLabel.\r\n * Expected format: \"COUNTRY_CODE - Street Address, City, State\"\r\n * Example: \"US - 123 Main St, New York, NY\" → \"123 Main St\"\r\n */\r\nconst DISPLAY_LABEL_STREET_PATTERN = /^[^-]*-\\s*(.+?),/;\r\n\r\n/**\r\n * Escapes special regex characters in a string.\r\n */\r\nconst escapeRegex = (str) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n\r\n/**\r\n * Checks if address matches the search query.\r\n */\r\nconst isAddressMatch = (address, searchQuery) => {\r\n\tif (!address.displayLabel) return false;\r\n\r\n\tconst matchResult = address.displayLabel.match(DISPLAY_LABEL_STREET_PATTERN);\r\n\tif (!matchResult?.[1]) return false;\r\n\r\n\tconst streetAddress = matchResult[1].trim();\r\n\tconst searchTerms = searchQuery.trim().split(/\\s+/).map(escapeRegex);\r\n\tconst searchPattern = new RegExp(`\\\\b${searchTerms.join('\\\\s+')}\\\\b`, 'i');\r\n\r\n\treturn searchPattern.test(streetAddress);\r\n};\r\n\r\n/**\r\n * Finds matching addresses from location results.\r\n */\r\nconst findMatchingAddresses = (locationsResults, searchQuery) => {\r\n\tconst addressResults = locationsResults[LOCATION_MODES.ADDRESS] || [];\r\n\tconst fulfillmentResults = locationsResults[LOCATION_MODES.FULFILLMENT_CENTER] || [];\r\n\r\n\treturn [...addressResults, ...fulfillmentResults].filter(\r\n\t\t(address) => isAddressMatch(address, searchQuery)\r\n\t);\r\n};\r\n\r\n/**\r\n * Selects best match from addresses, preferring user's country.\r\n */\r\nconst selectBestAddressMatch = (addresses, userCountryCode) => {\r\n\tif (addresses.length === 0) return null;\r\n\tif (addresses.length === 1 || !userCountryCode) return addresses[0];\r\n\r\n\tconst countryMatch = addresses.find(\r\n\t\t(addr) => addr.countryCode?.toLowerCase() === userCountryCode.toLowerCase()\r\n\t);\r\n\r\n\treturn countryMatch || addresses[0];\r\n};\r\n\r\n/**\r\n * Finds a port match by exact code.\r\n */\r\nconst findPortMatch = (locationsResults, portCode) => {\r\n\tconst airportResults = locationsResults[LOCATION_MODES.AIRPORT] || [];\r\n\tconst seaportResults = locationsResults[LOCATION_MODES.SEAPORT] || [];\r\n\r\n\tconst normalizedPortCode = normalizeLocationCode(portCode);\r\n\r\n\treturn [...airportResults, ...seaportResults].find((port) => normalizeLocationCode(port?.code) === normalizedPortCode);\r\n};\r\n\r\n/**\r\n * Formats a location match for selection.\r\n */\r\nconst formatLocationForSelection = (location) => {\r\n\tconst selectedValue = location.selectedValue || location.displayLabel || location.code;\r\n\r\n\tconst formatted = {\r\n\t\t...location,\r\n\t\tselectedValue,\r\n\t\tdisplayLabel: location.displayLabel || selectedValue,\r\n\t\tcountry: location.countryCode || location.country,\r\n\t\ttype: location.type || location.sourceType,\r\n\t};\r\n\r\n\t// Remove redundant countryCode if country is set\r\n\tif (formatted.country) {\r\n\t\tdelete formatted.countryCode;\r\n\t}\r\n\r\n\treturn {\r\n\t\tkey: JSON.stringify(formatted),\r\n\t\tlabel: selectedValue,\r\n\t};\r\n};\r\n\r\n/**\r\n * Checks if the input already has a value.\r\n */\r\nexport const hasExistingValue = (value) => {\r\n\tif (!value) return false;\r\n\treturn Array.isArray(value) ? value.length > 0 : Object.keys(value).length > 0;\r\n};\r\n\r\n/**\r\n * Finds autofill match based on address or port code.\r\n * Tries address match first, falls back to port code match.\r\n *\r\n * @returns {Object|null} Formatted location match or null if no match found\r\n */\r\nexport const findAutofillMatch = async ({\r\n\tautofillLocationAddress,\r\n\tautofillLocationCode,\r\n\tsupportedLocationModes,\r\n\tcustomer,\r\n\tuserCountryCode,\r\n}) => {\r\n\tif (!autofillLocationAddress && !autofillLocationCode) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tlet match = null;\r\n\r\n\t// Try address match first\r\n\tif (autofillLocationAddress) {\r\n\t\tconst { results = {} } = await getLocations(supportedLocationModes, autofillLocationAddress, customer);\r\n\t\tconst matchingAddresses = findMatchingAddresses(results, autofillLocationAddress);\r\n\t\tmatch = selectBestAddressMatch(matchingAddresses, userCountryCode);\r\n\t}\r\n\r\n\t// Fall back to port code match\r\n\tif (!match && autofillLocationCode) {\r\n\t\tconst { results = {} } = await getLocations(supportedLocationModes, autofillLocationCode, customer);\r\n\t\tmatch = findPortMatch(results, autofillLocationCode);\r\n\t}\r\n\r\n\treturn match ? formatLocationForSelection(match) : null;\r\n};\r\n","import React, { useEffect, useRef, useState } from 'react';\r\n\r\nimport { tokens } from '@freightos/design-system';\r\nimport { TranslatableText } from '@freightos/freightos-i18n';\r\n\r\nimport PropTypes from 'prop-types';\r\n\r\nimport DebounceSelect from './components/DebounceSelect';\r\nimport MaxPortsPlaceholder from './components/MaxPortsPlaceholder';\r\nimport {\r\n\tDEFAULT_LOCATION_MODE,\r\n\tLocationTypes,\r\n\tSelectModes,\r\n} from './helpers/constant';\r\nimport {\r\n\tfetchLocations,\r\n\tfindAutofillMatch,\r\n\tgetLocationInputValue,\r\n\thandleLocationChange,\r\n\thasExistingValue,\r\n\tisLocationAddress,\r\n\tgetExistingNormalizedCodes,\r\n\tgetNormalizedCodeFromMatchOption,\r\n\trenderLocationOptions,\r\n} from './helpers/utils';\r\n\r\n/**\r\n * LocationInput component for selecting locations (ports, airports, addresses, etc.)\r\n * \r\n * @param {Object|Array} value - Current selected location(s)\r\n * @param {Function} onChange - Callback fired when location changes\r\n * @param {boolean} hasError - Whether the input has validation errors\r\n * @param {string} dataTestId - Test ID for the component\r\n * @param {boolean} isOriginLocation - Whether this is an origin location input\r\n * @param {number} maxPorts - Maximum number of ports that can be selected\r\n * @param {Array<string>} supportedLocationModes - Array of supported location modes\r\n * @param {Object} customer - Customer object for API requests\r\n * @param {Object} defaultLocation - Default location to load\r\n * @param {string} defaultLocation.code - Location code (e.g., 'BCN')\r\n * @param {string} defaultLocation.type - Location type ('airport', 'seaport', 'address', etc.)\r\n * \r\n * @example\r\n * // Basic usage\r\n * <LocationInput \r\n * onChange={handleLocationChange}\r\n * supportedLocationModes={['airport', 'seaport']}\r\n * />\r\n * \r\n * @example\r\n * // With default value - will automatically load and select Barcelona airport\r\n * <LocationInput \r\n * onChange={handleLocationChange}\r\n * supportedLocationModes={['airport', 'seaport']}\r\n * defaultLocation={{ code: 'BCN', type: 'airport' }}\r\n * />\r\n */\r\nconst LocationInput = ({\r\n\tvalue,\r\n\tonChange,\r\n\thasError,\r\n\tdataTestId = 'location-input',\r\n\tisOriginLocation = true,\r\n\tmaxPorts = 1,\r\n\tsupportedLocationModes,\r\n\tcustomer,\r\n\tdefaultLocation,\r\n\tautofillLocationAddress,\r\n\tautofillLocationCode,\r\n\tuserCountryCode,\r\n\t...rest\r\n}) => {\r\n\tconst [selectedLocation, setSelectedLocation] = useState(value);\r\n\tconst [activeLocationMode, setActiveLocationMode] = useState(\r\n\t\tsupportedLocationModes.length === 1 ? supportedLocationModes[0] : DEFAULT_LOCATION_MODE\r\n\t);\r\n\r\n\tconst [selectionMode, setSelectionMode] = useState(\r\n\t\tisLocationAddress(activeLocationMode) || activeLocationMode === DEFAULT_LOCATION_MODE\r\n\t\t\t? SelectModes.SINGLE\r\n\t\t\t: SelectModes.MULTIPLE\r\n\t);\r\n\r\n\tconst latestValueRef = useRef(value);\r\n\tconst lastAppliedAutofillSignatureRef = useRef(null);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (isLocationAddress(activeLocationMode)) {\r\n\t\t\tsetSelectionMode(SelectModes.SINGLE);\r\n\t\t} else {\r\n\t\t\tsetSelectionMode(SelectModes.MULTIPLE);\r\n\t\t}\r\n\t}, [activeLocationMode]);\r\n\r\n\tuseEffect(() => {\r\n\t\tsetSelectedLocation(value);\r\n\t\tlatestValueRef.current = value;\r\n\t\tif (Array.isArray(value) && value.length > 0) {\r\n\t\t\tsetActiveLocationMode(value[0].type);\r\n\t\t} else if (defaultLocation?.type) {\r\n\t\t\tsetActiveLocationMode(defaultLocation.type);\r\n\t\t} else {\r\n\t\t\tsetActiveLocationMode(DEFAULT_LOCATION_MODE);\r\n\t\t}\r\n\t}, [value, defaultLocation?.type]);\r\n\r\n\t// Use ref to capture latest callback values without triggering re-runs\r\n\tconst callbacksRef = useRef({ onChange, selectionMode, maxPorts });\r\n\tuseEffect(() => {\r\n\t\tcallbacksRef.current = { onChange, selectionMode, maxPorts };\r\n\t}, [onChange, selectionMode, maxPorts]);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst signature = `${autofillLocationAddress || ''}::${autofillLocationCode || ''}`;\r\n\t\tif (!autofillLocationAddress && !autofillLocationCode) return;\r\n\r\n\t\tif (signature === lastAppliedAutofillSignatureRef.current) return;\r\n\r\n\t\tconst currentValue = latestValueRef.current;\r\n\t\tconst { selectionMode: currentSelectionMode, maxPorts: currentMaxPorts } = callbacksRef.current;\r\n\t\tconst canAppendInMultipleMode =\r\n\t\t\tcurrentSelectionMode === SelectModes.MULTIPLE &&\r\n\t\t\ttypeof currentMaxPorts === 'number' &&\r\n\t\t\tcurrentMaxPorts > 1 &&\r\n\t\t\tArray.isArray(currentValue) &&\r\n\t\t\tcurrentValue.length < currentMaxPorts;\r\n\r\n\t\t// Skip if already has a value (unless we can append more ports in MULTIPLE mode)\r\n\t\tif (hasExistingValue(currentValue) && !canAppendInMultipleMode) return;\r\n\r\n\t\tconst doAutofill = async () => {\r\n\t\t\ttry {\r\n\t\t\t\tconst match = await findAutofillMatch({\r\n\t\t\t\t\tautofillLocationAddress,\r\n\t\t\t\t\tautofillLocationCode,\r\n\t\t\t\t\tsupportedLocationModes,\r\n\t\t\t\t\tcustomer,\r\n\t\t\t\t\tuserCountryCode,\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (!match) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst { onChange: currentOnChange, selectionMode: latestSelectionMode, maxPorts: latestMaxPorts } = callbacksRef.current;\r\n\t\t\t\tconst latestValue = latestValueRef.current;\r\n\r\n\t\t\t\tif (\r\n\t\t\t\t\tlatestSelectionMode === SelectModes.MULTIPLE &&\r\n\t\t\t\t\ttypeof latestMaxPorts === 'number' &&\r\n\t\t\t\t\tlatestMaxPorts > 1 &&\r\n\t\t\t\t\tArray.isArray(latestValue)\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst matchCode = getNormalizedCodeFromMatchOption(match);\r\n\t\t\t\t\tconst existingCodes = getExistingNormalizedCodes(latestValue);\r\n\t\t\t\t\tif (!matchCode || existingCodes.has(matchCode)) return;\r\n\r\n\t\t\t\t\tconst existingOptionsRaw = getLocationInputValue(latestValue) || [];\r\n\t\t\t\t\tconst existingOptions = Array.isArray(existingOptionsRaw) ? existingOptionsRaw.filter(Boolean) : [];\r\n\t\t\t\t\tconst nextOptions = [...existingOptions, match].slice(0, latestMaxPorts);\r\n\r\n\t\t\t\t\thandleLocationChange(nextOptions, latestSelectionMode, latestMaxPorts, setSelectedLocation, currentOnChange);\r\n\t\t\t\t} else if (latestSelectionMode === SelectModes.MULTIPLE) {\r\n\t\t\t\t\thandleLocationChange([match], latestSelectionMode, latestMaxPorts, setSelectedLocation, currentOnChange);\r\n\t\t\t\t} else {\r\n\t\t\t\t\thandleLocationChange(match, latestSelectionMode, latestMaxPorts, setSelectedLocation, currentOnChange);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlastAppliedAutofillSignatureRef.current = signature;\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('Error performing autofill:', error);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tdoAutofill();\r\n\t}, [autofillLocationAddress, autofillLocationCode, supportedLocationModes, customer, userCountryCode]);\r\n\r\n\treturn (\r\n\t\t<DebounceSelect\r\n\t\t\tmode={selectionMode}\r\n\t\t\tdataTestId={dataTestId}\r\n\t\t\thasError={hasError}\r\n\t\t\tplaceholder={\r\n\t\t\t\t<TranslatableText\r\n\t\t\t\t\tstyle={{ fontSize: tokens.fdsFontSizeBase }}\r\n\t\t\t\t\tstringId={`Select ${isOriginLocation ? LocationTypes.ORIGIN : LocationTypes.DESTINATION}`}\r\n\t\t\t\t/>\r\n\t\t\t}\r\n\t\t\tvalue={getLocationInputValue(selectedLocation)}\r\n\t\t\tfetchOptions={fetchLocations(activeLocationMode, supportedLocationModes, customer)}\r\n\t\t\trenderedOptions={optionGroups => renderLocationOptions(optionGroups, dataTestId)}\r\n\t\t\tonChange={location => {\r\n\t\t\t\thandleLocationChange(location ?? [], selectionMode, maxPorts, setSelectedLocation, onChange);\r\n\t\t\t\tsetActiveLocationMode(DEFAULT_LOCATION_MODE);\r\n\t\t\t}}\r\n\t\t\tactiveLocationMode={activeLocationMode}\r\n\t\t\tmaxTagPlaceholder={omittedPorts => <MaxPortsPlaceholder omittedPorts={omittedPorts} dataTestId={dataTestId} />}\r\n\t\t\tdefaultLocation={defaultLocation}\r\n\t\t\t{...rest}\r\n\t\t/>\r\n\t);\r\n};\r\n\r\nLocationInput.propTypes = {\r\n\tvalue: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\r\n\tonChange: PropTypes.func.isRequired,\r\n\thasError: PropTypes.bool,\r\n\tdataTestId: PropTypes.string,\r\n\tisOriginLocation: PropTypes.bool,\r\n\tmaxPorts: PropTypes.number,\r\n\tsupportedLocationModes: PropTypes.arrayOf(PropTypes.string).isRequired,\r\n\tcustomer: PropTypes.object,\r\n\trecentSearches: PropTypes.array,\r\n\tonRecentSearchSelect: PropTypes.func,\r\n\tinitialValues: PropTypes.object,\r\n\tdefaultLocation: PropTypes.shape({\r\n\t\tcode: PropTypes.string.isRequired,\r\n\t\ttype: PropTypes.string.isRequired,\r\n\t}),\r\n\tautofillLocationAddress: PropTypes.string,\r\n\tautofillLocationCode: PropTypes.string,\r\n\tuserCountryCode: PropTypes.string,\r\n};\r\n\r\nexport default LocationInput;\r\n"],"sourceRoot":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|
2
|
+
{
|
|
3
|
+
"revision": "80b3f30267985f700189cf0bddfc721c",
|
|
4
|
+
"url": "http://ship.freightos.local:8800/FusionLocationInput/index.html"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"revision": "7f63c2e22f094b5ead30",
|
|
8
|
+
"url": "http://ship.freightos.local:8800/FusionLocationInput/main.bundle.js"
|
|
9
|
+
}
|
|
10
|
+
]);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Welcome to your Workbox-powered service worker!
|
|
3
|
+
*
|
|
4
|
+
* You'll need to register this file in your web app and you should
|
|
5
|
+
* disable HTTP caching for this file too.
|
|
6
|
+
* See https://goo.gl/nhQhGp
|
|
7
|
+
*
|
|
8
|
+
* The rest of the code is auto-generated. Please don't update this file
|
|
9
|
+
* directly; instead, make changes to your Workbox build configuration
|
|
10
|
+
* and re-run your build process.
|
|
11
|
+
* See https://goo.gl/2aRDsh
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
|
15
|
+
|
|
16
|
+
importScripts(
|
|
17
|
+
"http://ship.freightos.local:8800/FusionLocationInput/precache-manifest.4034cb7dfab33db082e1ebb1efc8d639.js"
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
self.addEventListener('message', (event) => {
|
|
21
|
+
if (event.data && event.data.type === 'SKIP_WAITING') {
|
|
22
|
+
self.skipWaiting();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
workbox.core.clientsClaim();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
|
|
30
|
+
* requests for URLs in the manifest.
|
|
31
|
+
* See https://goo.gl/S9QRab
|
|
32
|
+
*/
|
|
33
|
+
self.__precacheManifest = [].concat(self.__precacheManifest || []);
|
|
34
|
+
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
|
|
35
|
+
|
|
36
|
+
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), {
|
|
37
|
+
|
|
38
|
+
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
|
|
39
|
+
});
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
object-assign
|
|
3
|
-
(c) Sindre Sorhus
|
|
4
|
-
@license MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/** @license React v17.0.2
|
|
8
|
-
* react-jsx-runtime.production.min.js
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the MIT license found in the
|
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/
|