@freightos/fusion-location-input 2.0.0-fds → 2.1.0-fds
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 +1 -1
- package/build/main.bundle.js +150 -1
- package/build/main.bundle.js.map +1 -1
- package/build/{precache-manifest.3cdffacc43e10ab90f2f47da323fe4ac.js → precache-manifest.8f1a2f3c6a5c8a1dcac52dc8238ef050.js} +1 -1
- package/build/service-worker.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"main.js": "/main.bundle.js",
|
|
4
4
|
"main.js.map": "/main.bundle.js.map",
|
|
5
5
|
"index.html": "/index.html",
|
|
6
|
-
"precache-manifest.
|
|
6
|
+
"precache-manifest.8f1a2f3c6a5c8a1dcac52dc8238ef050.js": "/precache-manifest.8f1a2f3c6a5c8a1dcac52dc8238ef050.js",
|
|
7
7
|
"service-worker.js": "/service-worker.js"
|
|
8
8
|
},
|
|
9
9
|
"entrypoints": [
|
package/build/main.bundle.js
CHANGED
|
@@ -1,2 +1,151 @@
|
|
|
1
|
-
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(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"],e):"object"===typeof exports?exports.FusionLocationInput=e(require("react"),require("@freightos/design-system"),require("styled-components"),require("@freightos/freightos-i18n"),require("@freightos/http-client"),require("lodash")):t.FusionLocationInput=e(t.React,t["@freightos/design-system"],t["styled-components"],t["@freightos/freightos-i18n"],t["@freightos/http-client"],t.lodash)}(this,(function(t,e,n,o,a,r){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var a=e[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(o,a,function(e){return t[e]}.bind(null,a));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="http://ship.freightos.local:8800/FusionLocationInput/",n(n.s=6)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=o},function(t,e){t.exports=a},function(t,e){t.exports=r},function(t,e,n){t.exports=n(7)},function(t,e,n){"use strict";function o(t,e){if(null==t)return{};var n,o,a=function(t,e){if(null==t)return{};var n,o,a={},r=Object.keys(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}n.r(e);var a=n(0),r=n.n(a),i=n(1),l=n(3),s=n(5);const c="airport",d="seaport",u="fulfillment_center",p="address_book",m="last_mile_address",f="address",g={[c]:{label:"Airports",key:c,icon:"mode-air"},[d]:{label:"Ports",key:d,icon:"mode-ship"},[u]:{label:"Fulfillment centers",key:u,icon:"fulfillment-center"},[p]:{key:p,groupedBy:"address"},[m]:{key:m,groupedBy:"address"},[f]:{label:"Address",key:f,icon:"location"}},h="single",y="multiple",v="origin",b="destination";function S(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var O,E,w,T,k,C,L,_=n(2),x=n.n(_);const j=Object(_.createGlobalStyle)(O||(O=S(["\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"]))),I=x()(i.Select)(E||(E=S(["\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"])),i.tokens.fdsBorderRadiusXl,i.tokens.fdsColorPrimaryBlue,i.tokens.fdsColorPrimaryBlue,i.tokens.fdsColorPrimaryBlue10,i.tokens.fdsComponentSpacingXxs,i.tokens.fdsSizeMd,t=>{let{size:e}=t;return"large"===e?"\n\t\t\tmargin-top: ".concat(i.tokens.fdsComponentSpacingSm," !important;\n\t\t"):"\n\t\t\tmargin-top: 5px !important;\n\t\t"},i.tokens.fdsColorPrimaryBlue,i.tokens.fdsComponentSpacingXs,i.tokens.fdsSizeMd,i.tokens.fdsSizeMd,i.tokens.fdsColorPrimaryGray80,t=>{let{$hasError:e}=t;return e&&"\n\t\t.ant-select-selection {\n\t\t\tcolor: ".concat(i.tokens.fdsColorSemanticRed,";\n \t\tborder: 1px solid ").concat(i.tokens.fdsColorSemanticRed,";\n \t\tbackground-color: ").concat(i.tokens.fdsColorSemanticRed10,";\n\t\t}\n\n\t\t.ant-select-selection__placeholder, .ant-select-arrow {\n\t\t\tcolor: ").concat(i.tokens.fdsColorSemanticRed,";\n\t\t}\n\t")}),P=x.a.span(w||(w=S(["\n\tfont-size: "," !important;\n"])),i.tokens.fdsFontSizeSm),A=x.a.div(T||(T=S(["\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"])),i.tokens.fdsFontSizeSm),R=x()(i.Menu)(k||(k=S(["\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"])),i.tokens.fdsBodyTextColorDisabled),F=x.a.div(C||(C=S(["\n\tfont-size: ",";\n\tline-height: ",";\n\tfont-family: ",";\n"])),i.tokens.fdsFontSizeSm,i.tokens.fdsSizeSm,i.tokens.fdsHeadingsFontFamily),U=(x()(i.Icon)(L||(L=S(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),{XXLARGE:i.tokens.fdsComponentSpacingXxl,XLARGE:i.tokens.fdsComponentSpacingXl,LARGE:i.tokens.fdsComponentSpacingLg,MEDIUM:i.tokens.fdsComponentSpacingMd,SMALL:i.tokens.fdsComponentSpacingSm,XSMALL:i.tokens.fdsComponentSpacingXs,XXSMALL:i.tokens.fdsComponentSpacingXxs,NONE:0}),z={VERTICAL:"vertical",HORIZONTAL:"horizontal"},M="totalShipment",N="unitsShipment",D="containerPackages",V="celsius",W="fahrenheit",$={["FRO"]:{[V]:"-10\xbaC or below",[W]:"14\xbaF or below"},["COL"]:{[V]:"From +2\xbaC To +8\xbaC",[W]:"From 35.6\xbaF To 46.4\xbaF"},["ERT"]:{[V]:"From +2\xbaC To +25\xbaC",[W]:"From 35.6\xbaF To 77\xbaF"},["CRT"]:{[V]:"From +15\xbaC To +25\xbaC",[W]:"From 59\xbaF To 77\xbaF"}},X="quotation",B="units",q="totals",G="container",K="CBM",H="CFT",J="kg",Z="box",Y="uld";function Q(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tt(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 et(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tt(Object(n),!0).forEach((function(e){Q(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var nt,ot,at,rt;const it=x.a.div(nt||(nt=S(["\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===z.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&&Object(_.css)(ot||(ot=S(["\n\t\t\twidth: 100%;\n\t\t"])))},t=>{let{$direction:e,$spacing:n}=t;return e===z.VERTICAL?Object(_.css)(at||(at=S(["\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):Object(_.css)(rt||(rt=S(["\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)}),lt=["direction","alignItems","spacing","wrap","justifyContent","fullWidth"];var st=t=>{let{direction:e=z.HORIZONTAL,alignItems:n="start",spacing:a=U.NONE,wrap:i,justifyContent:l,fullWidth:s}=t,c=o(t,lt);return r.a.createElement(it,Object.assign({},c,{$direction:e,$alignItems:n,$spacing:a,$wrap:i,$justifyContent:l,$fullWidth:s}),c.children)},ct=n(4),dt=n.n(ct);class ut{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}}const pt=["address"],mt=t=>{const e=ut.isProduction()?"freightos.com":"test-freightos.com";return"https://platform.".concat(e,"/gateway/").concat(t?"webcargo-talaia":"webcargo-alpha")},ft=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)},gt=t=>{const{displayLabel:e,selectedValue:n,formattedNameOrAddress:o,code:a,countryCode:r,stateOrProvince:i,city:l,latitude:s,longitude:c,postalOrZipCode:d,sourceType:u,locationType:p,type:m,countryName:f}=t||{};return{displayLabel:e,selectedValue:n||a,formattedNameOrAddress:o,code:a||n,country:r,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}},ht=t=>{try{const e="string"===typeof(null===t||void 0===t?void 0:t.key)?JSON.parse(Ot(t.key)):t;return ft(gt(e))}catch(e){return ft(gt(t))}},yt=t=>{const e=t=>(t=>{if(t){var e;const n=t.label||t.selectedValue;return{key:ht(t),label:n?r.a.createElement(r.a.Fragment,null,r.a.createElement(i.Icon,{type:t.sourceType?null===(e=g[t.sourceType])||void 0===e?void 0:e.icon:"location",size:"tiny"}),"\xa0",r.a.createElement(P,null,n)):void 0}}})(t);return Array.isArray(t)?t.map(e):e(t)},vt=(t,e,n)=>async a=>{if(!a)return[];const r=""!==t?[t]:e;let i=(await(async(t,e,n)=>{try{const o=t.reduce((t,e)=>et(et({},t),{},{[g[e].key]:et(et({type:e.toUpperCase()},(null===n||void 0===n?void 0:n.code)?{searchTerm:n.name}:{}),g[e].groupedBy?{groupedBy:g[e].groupedBy}:{})}),{});return(await dt.a.post("/geocoder/api/v3/geocoder/locations",{query:e,limit:5,sources:o})).data}catch(o){return console.error("Error fetching locations:",o),{results:{}}}})(r,a,n)).results;return i[f]&&(i=(t=>{let e=et({},t);const n=t[f].filter(t=>t.sourceType===u);if(n.length>0){const{address:t}=e;e=et(et({},o(e,pt)),{},{[u]:n,address:t.filter(t=>t.type!==u)})}return e})(i)),Object.keys(i).map(t=>{var e;return{label:(null===(e=g[t])||void 0===e?void 0:e.label)||t,options:i[t].map(t=>et(et({},t),{},{type:t.sourceType}))}})},bt=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=Ot(e);return et({key:n},JSON.parse(n))}catch(e){return}}))).filter(Boolean))},St=t=>t&&(t===f||t===m||t===p||t===u),Ot=t=>"string"===typeof t?t.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):t,Et=async t=>{await(async t=>{let{method:e,url:n="",data:o={},options:a={}}=t;const r=(()=>{if("get"===e){return[Object.keys(o).length?"".concat(n,"?").concat(new URLSearchParams(o).toString()):n,a]}if("post"===e){const t=et(et({},null===a||void 0===a?void 0:a.headers),{},{accept:"application/json","content-type":"multipart/form-data"});return[n,o,et(et({},a),{},{headers:t})]}return[n,o,a]})();return await dt.a[e](...r)})({method:"put",url:"".concat(mt(!1),"/backend/api.php"),options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:t}})};var wt,Tt,kt,Ct,Lt,_t,xt;const jt=x.a.div(wt||(wt=S(["\n\tcolor: ",";\n\tfont-size: ",";\n\tfont-weight: ",";\n\tmargin-bottom: ",";\n\ti {\n\t\tmargin-right: ",";\n\t}\n\n"])),i.tokens.fdsColorPrimaryGray60,i.tokens.fdsSizeXs,i.tokens.fdsFontWeightRegular,i.tokens.fdsComponentSpacingSm,i.tokens.fdsComponentSpacingSm),It=x()(st)(Tt||(Tt=S(["\n\tpadding-left: 0 !important;\n"]))),Pt=x()(i.Icon)(kt||(kt=S(["\n\tmargin-right: 0 !important;\n\tvertical-align: bottom;\n"]))),At=x.a.span(Ct||(Ct=S(["\n\twhite-space: nowrap;\n\tmin-width: 0;\n\tcolor: ",";\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\t","\n\t",";\n"])),i.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",";")}),Rt=x()(i.Avatar)(Lt||(Lt=S(["\n\tborder: 1px solid ",";\n\twidth: ",";\n\theight: ",";\n"])),i.tokens.fdsColorPrimaryGray20,i.tokens.fdsSizeSm,i.tokens.fdsSizeSm),Ft=x()(st)(_t||(_t=S(["\n\toverflow: hidden !important;\n\tfont-size: 10px; //TODO: FSN-145\n\tline-height: 15px;\n\tflex: 1;\n\tmin-width: 0;\n"]))),Ut=x()(st)(xt||(xt=S(["\n\t:last-child {\n\t\tpadding-bottom: 0 !important;\n\t}\n"]))),zt=t=>t?t.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0",Mt=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.value.localeCompare(e.value))}),e};var Nt=t=>{let{text:e="",testId:n,isPort:o,isLocationLabel:l=!1,children:s=null}=t;const c=Object(a.useRef)(null),[d,u]=Object(a.useState)(!1);Object(a.useEffect)(()=>{(()=>{if(c.current){const t=c.current,e=t.scrollWidth>t.clientWidth;u(e)}})()},[e]);const p=r.a.createElement(At,{ref:c,"data-test-id":n,$isLocationLabel:l,$isPort:o},s||e);return d?r.a.createElement(i.Tooltip,{title:e,"data-test-id":"".concat(n,"-tooltip")},r.a.createElement(At,{ref:c,"data-test-id":n,$isLocationLabel:l,$isPort:o},s||e)):p};var Dt=t=>{let{search:e,index:n,dataTestId:o}=t;const a=e.origin.length>1,l=e.destination.length>1,s=a?Mt(e.origin):{[e.origin[0].country]:e.origin},c=l?Mt(e.destination):{[e.destination[0].country]:e.destination};return r.a.createElement(st,{alignItems:"center",spacing:U.XSMALL,fullWidth:!0},Object.keys(s).map(t=>{const e=s[t].map(t=>t.selectedValue).join(", ");return r.a.createElement(Nt,{key:t,text:e,isLocationLabel:!0,testId:"".concat(o,"-origin-").concat(n),isPort:s[t][0].type===d},r.a.createElement(Rt,{type:"flag",country:t,size:"small","data-test-id":"".concat(o,"-origin-flag-").concat(n),style:{marginRight:"4px"}}),e)}),r.a.createElement(i.Icon,{type:"arrow-forward",style:{marginRight:0,color:i.tokens.fdsColorPrimaryGray90,flex:"none"}}),Object.keys(c).map(t=>{const e=c[t].map(t=>t.selectedValue).join(", ");return r.a.createElement(Nt,{key:t,text:e,isLocationLabel:!0,testId:"".concat(o,"-destination-").concat(n),isPort:c[t][0].type===d},r.a.createElement(Rt,{type:"flag",country:t,size:"small","data-test-id":"".concat(o,"-destination-flag-").concat(n),style:{marginRight:"4px"}}),e)}))};var Vt=t=>{var e,n,o;let{search:l,index:s,dataTestId:c}=t;const d=l.platform_type,u=(t=>{const e=t.shipment_details.type;if(e===q)return["box-total"];if(e===B){const e=t.shipment_details[N];if((null===e||void 0===e?void 0:e.packageType)===Z){return e.boxPackages.reduce((t,e)=>{var n,o;const a=null===(n=e.type)||void 0===n||null===(o=n.value)||void 0===o?void 0:o.icon;return t.includes(a)||t.push(a),t},[])}return(null===e||void 0===e?void 0:e.packageType)===Y?["uld"]:["box"]}return e===G?["container"]:["box"]})(l),{units:p,volume:m,weight:f,weightUnit:g,volumeUnit:h}=Object(a.useMemo)(()=>(t=>{const e=t.shipment_details.type;if(t.platform_type===X)return{units:0,volume:0,weight:0,weightUnit:J,volumeUnit:K};switch(e){case G:{var n;let e=0,o=0;return null===(n=t.shipment_details[D])||void 0===n||n.forEach(t=>{const n=Number(t.units)||0;if(n>0){e+=n;const a=parseInt(t.dimensions.value,10);o+=n*(a/20)}}),{units:e,volume:o,weight:null,weightUnit:null,volumeUnit:"TEU"}}case B:{const e=t.shipment_details[N],n=(null===e||void 0===e?void 0:e.volumeUnit)===H?1728:1e6;if((null===e||void 0===e?void 0:e.packageType)===Z){const t=zt(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=zt(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)===Y){const t=zt(e.uldPackages.reduce((t,e)=>t+parseFloat(e.volume||"0"),0)),n=zt(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:J,volumeUnit:K}}case q:{var o,a,r,i,l;const e=zt(parseFloat((null===(o=t.shipment_details[M])||void 0===o?void 0:o.volume)||"0")),n=zt(parseFloat((null===(a=t.shipment_details[M])||void 0===a?void 0:a.weight)||"0"));return{units:(null===(r=t.shipment_details[M])||void 0===r?void 0:r.units)||0,volume:e,weight:n,weightUnit:(null===(i=t.shipment_details[M])||void 0===i?void 0:i.weightUnit)||J,volumeUnit:(null===(l=t.shipment_details[M])||void 0===l?void 0:l.volumeUnit)||K}}default:return{units:0,volume:0,weight:0,weightUnit:J,volumeUnit:K}}})(l),[l]),y=1===l.commodity.length&&l.commodity[0].is_temperature,v=(null===(e=l.commodity_temperature)||void 0===e?void 0:e.tempRange)&&y?$[null===(n=l.commodity_temperature)||void 0===n?void 0:n.tempRange][null===(o=l.commodity_temperature)||void 0===o?void 0:o.temperatureSystem]:"";return r.a.createElement(st,{spacing:U.XSMALL,alignItems:"center",fullWidth:!0,key:s},d===X?r.a.createElement(Ft,{alignItems:"center",spacing:U.SMALL,style:{flex:1}},u.map((t,e)=>r.a.createElement(Pt,{type:t,key:"".concat(s,"-").concat(e),size:"tiny","data-test-id":"".concat(c,"rs-package-icon-").concat(s,"-").concat(e)})),r.a.createElement(Nt,{text:l.commodity.map(t=>t.label).join(", "),testId:"".concat(c,"rs-commodity-").concat(s)})):r.a.createElement(Ft,{alignItems:"center",spacing:U.SMALL},r.a.createElement(st,{alignItems:"center",spacing:U.XSMALL,"data-test-id":"rs-".concat(s,"-units")},p,"\xa0",u.map((t,e)=>r.a.createElement(Pt,{type:t,key:"".concat(s,"-").concat(e),size:"tiny","data-test-id":"".concat(c,"rs-package-icon-").concat(s,"-").concat(e)}))),r.a.createElement("span",{"data-test-id":"".concat(c,"rs-volume-").concat(s)},m,"\xa0",h),f&&r.a.createElement("span",{"data-test-id":"".concat(c,"rs-weight-").concat(s)},f,"\xa0",g),r.a.createElement(Nt,{text:l.commodity.map(t=>t.label).join(", "),testId:"".concat(c,"rs-commodity-").concat(s)}),y&&r.a.createElement(st,{alignItems:"center",spacing:U.XSMALL,"data-test-id":"".concat(c,"rs-temperature-").concat(s)},r.a.createElement(i.Icon,{type:"temperature-low",size:"tiny","data-test-id":"".concat(c,"rs-temperature-icon-").concat(s)}),r.a.createElement("span",{style:{whiteSpace:"nowrap"}},v))))};const Wt=t=>{let{search:e,index:n,setIsOpen:o,dataTestId:a,onRecentSearchSelect:l}=t;return r.a.createElement(It,{direction:z.VERTICAL,fullWidth:!0,spacing:U.XSMALL,key:e.id,style:{padding:i.tokens.fdsComponentSpacingSm},"data-test-id":"".concat(a,"rs-card-").concat(n),onClick:()=>{(async()=>{l(e);try{await Et(e.id)}catch(t){console.error(t)}o(!1)})()}},r.a.createElement(Dt,{search:e,index:n,dataTestId:a}),r.a.createElement(Vt,{search:e,index:n,dataTestId:a}))};var $t=t=>{let{recentSearches:e,setIsOpen:n,dataTestId:o,onRecentSearchSelect:a,initialValues:s}=t;const c=e?(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,6))(e):[];return r.a.createElement(R,null,r.a.createElement(jt,null,r.a.createElement(i.Icon,{"data-test-id":"".concat(o,"rs-icon"),color:i.tokens.fdsColorPrimaryGray60,type:"history",size:"tiny"}),r.a.createElement(l.TranslatableText,{stringId:"Recent searches"})),r.a.createElement(Ut,{direction:z.VERTICAL,fullWidth:!0},c.map((t,e)=>r.a.createElement(Wt,{onRecentSearchSelect:a,initialValues:s,search:t,index:e,key:t.id,setIsOpen:n,dataTestId:o}))))};var Xt=t=>{let{isLoading:e,recentSearches:n,searchKey:o,dataTestId:a,setIsOpen:s,onRecentSearchSelect:c,initialValues:d}=t;return o||n&&0!==n.length?e?r.a.createElement(i.Spin,{size:"small"}):(null===n||void 0===n?void 0:n.length)>0&&!o.trim()?r.a.createElement($t,{recentSearches:n,dataTestId:a,setIsOpen:s,onRecentSearchSelect:c,initialValues:d}):o.trim()?r.a.createElement(F,null,r.a.createElement(l.TranslatableText,{stringId:"No matching results",module:l.TRANSLATION_MODULES.SearchAndBook})):null:null};const Bt=["fetchOptions","renderedOptions","recentSearches","hasError","mode","dataTestId","value","debounceTimeout","activeLocationMode","defaultLocation","onChange"];var qt=t=>{let{fetchOptions:e,renderedOptions:n,recentSearches:l=[],hasError:c,mode:d,dataTestId:u,value:p,debounceTimeout:m=800,activeLocationMode:f,defaultLocation:y,onChange:v}=t,b=o(t,Bt);const[S,O]=Object(a.useState)([]),[E,w]=Object(a.useState)(!1),[T,k]=Object(a.useState)(""),C=Object(a.useRef)(0),[L,_]=Object(a.useState)(!1),[x,P]=Object(a.useState)(3),A=Object(a.useRef)();Object(a.useEffect)(()=>{p&&0!==p.length||L||(O([]),k(""))},[p,L]),Object(a.useEffect)(()=>(""!==f&&O(t=>t.filter(t=>t.label===g[f].label)),_(!1),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{document.activeElement.blur(),document.body.click();const t=document.querySelector(".ant-select-focused");t&&t.classList.remove("ant-select-focused"),P(3)},100),()=>{A.current&&clearTimeout(A.current)}),[f]);const R=Object(a.useMemo)(()=>Object(s.debounce)(async t=>{k(t),C.current+=1;const n=C.current;O([]),w(!0);let o=null;try{const a=await e(t);n===C.current&&(O(a),o=a)}catch(a){console.error("Error fetching options:",a),n===C.current&&i.Notification.danger({message:"Search failed",description:"Unable to fetch location results. Please try again later."})}finally{if(n===C.current)return w(!1),o}},m),[e,m]);Object(a.useEffect)(()=>{if(!(null===y||void 0===y?void 0:y.code))return;(async()=>{try{O([]),w(!0);const t=await e(y.code);if(O(t),!t||0===t.length)return;let n=null;if(y.type){const e=t.find(t=>{var e;return t.label.toLowerCase()===(null===(e=g[y.type])||void 0===e?void 0:e.label.toLowerCase())});(null===e||void 0===e?void 0:e.options)&&(n=e.options.find(t=>t.code.toLowerCase()===y.code.toLowerCase()||t.selectedValue.toLowerCase()===y.code.toLowerCase()))}if(n||(n=t.map(t=>t.options).flat().find(t=>t.code.toLowerCase()===y.code.toLowerCase()||t.selectedValue.toLowerCase()===y.code.toLowerCase())),n&&v){const t={key:JSON.stringify(n),label:n.selectedValue||n.displayLabel||n.code};v([t])}}catch(t){ut.isLocal()&&console.error("Error loading default location:",t)}finally{w(!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(j,null),r.a.createElement(I,Object.assign({maxTagCount:x,onSearch:R,$hasError:c,loading:E,options:S,filterOption:!1,notFoundContent:r.a.createElement(Xt,{isLoading:E,recentSearches:l,searchKey:T,dataTestId:u,setIsOpen:_,onRecentSearchSelect:b.onRecentSearchSelect,initialValues:b.initialValues}),mode:d,"data-test-id":"".concat(u,"-selector"),allowClear:d===h,labelInValue:!0,optionLabelProp:"label",showSearch:!0,onDropdownVisibleChange:t=>{P(t?2:3),O([]),k(""),_(t)},open:L&&(E||T.trim()||(null===l||void 0===l?void 0:l.length)>0),value:p,onChange:v},b),n(S)))};var Gt=t=>{let{omittedPorts:e,dataTestId:n}=t;const o=e.map(t=>{var e;return null===(e=JSON.parse(t.key))||void 0===e?void 0:e.selectedValue});return r.a.createElement(i.Tooltip,{title:o.join(",")},r.a.createElement(P,{"data-test-id":"".concat(n,"-extra-ports")},"+".concat(e.length)))};const Kt=["value","onChange","hasError","dataTestId","isOriginLocation","maxPorts","supportedLocationModes","customer","defaultLocation"];e.default=t=>{let{value:e,onChange:n,hasError:s,dataTestId:d="location-input",isOriginLocation:m=!0,maxPorts:f=1,supportedLocationModes:S,customer:O,defaultLocation:E}=t,w=o(t,Kt);const[T,k]=Object(a.useState)(e),[C,L]=Object(a.useState)(1===S.length?S[0]:""),[_,x]=Object(a.useState)(St(C)||""===C?h:y);return Object(a.useEffect)(()=>{St(C)?x(h):x(y)},[C]),Object(a.useEffect)(()=>{k(e),Array.isArray(e)&&e.length>0?L(e[0].type):(null===E||void 0===E?void 0:E.type)?L(E.type):L("")},[e,null===E||void 0===E?void 0:E.type]),r.a.createElement(qt,Object.assign({mode:_,dataTestId:d,hasError:s,placeholder:r.a.createElement(l.TranslatableText,{style:{fontSize:i.tokens.fdsFontSizeBase},stringId:"Select ".concat(m?v:b)}),value:yt(T),fetchOptions:vt(C,S,O),renderedOptions:t=>((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(g).find(e=>e.label===t.label),a=null===o||void 0===o?void 0:o.icon;return r.a.createElement(i.Select.OptGroup,{label:r.a.createElement("span",{style:{fontFamily:"Open Sans"}},r.a.createElement(i.Icon,{size:"tiny",type:a}),"\xa0 \xa0",t.label),key:t.label,"data-test-id":"".concat(e,"-group-").concat(t.label)},null===(n=t.options)||void 0===n?void 0:n.map(n=>{const{countryCode:o,selectedValue:l,displayLabel:s,type:c}=n;return r.a.createElement(i.Option,{value:ht(n),title:l,"data-test-id":"".concat(e,"-").concat(t.label,"-").concat(l),style:{paddingLeft:"8px"},label:r.a.createElement(r.a.Fragment,null,r.a.createElement(i.Icon,{type:a,size:"tiny"}),"\xa0",r.a.createElement(P,null,l)),key:n.code},r.a.createElement(st,{fullWidth:!0,justifyContent:"space-between"},r.a.createElement(st,{spacing:U.XSMALL},r.a.createElement("span",null,r.a.createElement(i.Avatar,{type:"flag",country:o,size:"small",style:{width:i.tokens.fdsSizeSm,height:i.tokens.fdsSizeSm}})),r.a.createElement(A,null,s)),c===u&&r.a.createElement(i.Icon,{type:"amazon",size:"small"}),c===p&&r.a.createElement(i.Chip,{type:"neutral",iconType:"address-book"})))}))})})(t,d),onChange:t=>{((t,e,n,o,a)=>{if(e===y){const e=Array.isArray(t)?t:[];if(e.length<=n)o(e),bt(e,a);else{var s,d;const t=(null===(s=JSON.parse(null===(d=e[0])||void 0===d?void 0:d.key))||void 0===s?void 0:s.sourceType)===c?n>1?"airports":"airport":n>1?"ports":"port";i.Message.danger(r.a.createElement(r.a.Fragment,null,r.a.createElement(l.TranslatableText,{stringId:"You cannot enter more than"})," "," ",n," "," ",r.a.createElement(l.TranslatableText,{stringId:t})))}}else o(t),bt(t,a)})(null!==t&&void 0!==t?t:[],_,f,k,n),L("")},activeLocationMode:C,maxTagPlaceholder:t=>r.a.createElement(Gt,{omittedPorts:t,dataTestId:d}),defaultLocation:E},w))}}])}));
|
|
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",h="multiple",y="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
|
+
`,C=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
|
+
`,w=S.a.span`
|
|
62
|
+
font-size: ${a.tokens.fdsFontSizeSm} !important;
|
|
63
|
+
`,O=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
|
+
`,T=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
|
+
`,$=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",P="celsius",j="fahrenheit",A={["FRO"]:{[P]:"-10\xbaC or below",[j]:"14\xbaF or below"},["COL"]:{[P]:"From +2\xbaC To +8\xbaC",[j]:"From 35.6\xbaF To 46.4\xbaF"},["ERT"]:{[P]:"From +2\xbaC To +25\xbaC",[j]:"From 35.6\xbaF To 77\xbaF"},["CRT"]:{[P]:"From +15\xbaC To +25\xbaC",[j]:"From 59\xbaF To 77\xbaF"}},R="quotation",F="units",z="totals",M="container",U="CBM",N="CFT",V="kg",D="box",W="uld",X=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 B=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(X,Object.assign({},s,{$direction:t,$alignItems:n,$spacing:o,$wrap:a,$justifyContent:i,$fullWidth:l}),s.children)},q=n(4),G=n.n(q);const K=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 G.a.post("/geocoder/api/v3/geocoder/locations",{query:t,limit:5,sources:o})).data}catch(o){return console.error("Error fetching locations:",o),{results:{}}}};class H{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}}const J=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)},Z=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}},Y=e=>{try{const t="string"===typeof(null===e||void 0===e?void 0:e.key)?JSON.parse(re(e.key)):e;return J(Z(t))}catch{return J(Z(e))}},Q=e=>{const t=e=>(e=>{if(e){var t;const n=e.label||e.selectedValue;return{key:Y(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(w,null,n)):void 0}}})(e);return Array.isArray(e)?e.map(t):t(e)},ee=(e,t,n)=>async o=>{if(!o)return[];const r=""!==e?[e]:t;let a=(await K(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}))}})},te=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=re(t);return{key:n,...JSON.parse(n)}}catch(t){return}}))).filter(Boolean))},ne=(e,t,n,o,l)=>{if(t===h){const t=Array.isArray(e)?e:[];if(t.length<=n)o(t),te(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),te(e,l)},oe=e=>e&&(e===m||e===p||e===u||e===d),re=e=>"string"===typeof e?e.replace(/"/g,'"').replace(/"/g,'"').replace(/&/g,"&"):e,ae=/^[^-]*-\s*(.+?),/,ie=e=>e?e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim():"",le=e=>{const t=e.match(/\b(\d+)\b/);return t?t[1]:null},se=(e,t)=>{if(!e||!t)return 0;const n=e.split(/\s+/),o=t.split(/\s+/);let r=0,a=Math.max(n.length,o.length);return n.forEach(e=>{o.some(t=>t.includes(e)||e.includes(t))&&r++}),a>0?r/a:0},ce=(e,t,n)=>{let o=0;const r=e.displayLabel||"",a=e.formattedNameOrAddress||"",i=(e=>{if(!e)return"";const t=e.match(ae);return t?t[1].trim():e})(r),l=ie(i),s=ie(a),c=ie(r),d=le(r)||le(a),u=se(t.fullText,l),p=se(t.fullText,s),m=se(t.fullText,c);if(o+=50*Math.max(u,p,m),t.number&&d?t.number===d?o+=30:o-=10:t.number&&!d?o-=15:!t.number&&d&&(o+=5),t.city){const n=ie(e.city||"");(n.includes(t.city)||t.city.includes(n))&&(o+=15)}return n&&e.countryCode&&e.countryCode.toLowerCase()===n.toLowerCase()&&(o+=5),t.words.forEach(e=>{(l.includes(e)||s.includes(e))&&(o+=2)}),o},de=(e,t,n)=>{if(0===e.length)return null;if(1===e.length)return e[0];const o=(e=>{const t=ie(e);return{words:t.split(/\s+/).filter(e=>e.length>2),number:le(e),city:null,fullText:t}})(t),r=e.map(e=>({normalized:ie(e.city||""),original:e.city||""})).filter(e=>e.normalized.length>0),a=ie(t),i=a.split(/\s+/).filter(e=>e.length>3);let l=null;for(const c of r){const e=c.normalized.split(/\s+/);for(const t of i)if(e.some(e=>e.includes(t)||t.includes(e))){l=c.normalized;break}if(a.includes(c.normalized)||c.normalized.includes(a)){l=c.normalized;break}if(l)break}l&&(o.city=l);const s=e.map(e=>({address:e,score:ce(e,o,n)}));return s.sort((e,t)=>t.score-e.score),s[0].score>0?s[0].address:e[0]},ue=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 K(o,t,r),n=[...(l=e)[m]||[],...l[d]||[]];i=de(n,t,a)}var l;if(!i&&n){const{results:e={}}=await K(o,n,r);i=((e,t)=>[...e[s]||[],...e[c]||[]].find(e=>e.code===t))(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},pe=async e=>{var t;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 G.a[t](...a)})({method:"put",url:(t=!1,`https://platform.${H.isProduction()?"freightos.com":"test-freightos.com"}/gateway/${t?"webcargo-talaia":"webcargo-alpha"}`)+"/backend/api.php",options:{headers:{namespace:"airops/user_searches",route:" user_search_used"}},data:{id:e}})},me=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
|
+
`,fe=S()(B)`
|
|
124
|
+
padding-left: 0 !important;
|
|
125
|
+
`,ge=S()(a.Icon)`
|
|
126
|
+
margin-right: 0 !important;
|
|
127
|
+
vertical-align: bottom;
|
|
128
|
+
`,he=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
|
+
`,ye=S()(a.Avatar)`
|
|
137
|
+
border: 1px solid ${a.tokens.fdsColorPrimaryGray20};
|
|
138
|
+
width: ${a.tokens.fdsSizeSm};
|
|
139
|
+
height: ${a.tokens.fdsSizeSm};
|
|
140
|
+
`,ve=S()(B)`
|
|
141
|
+
overflow: hidden !important;
|
|
142
|
+
font-size: 10px; //TODO: FSN-145
|
|
143
|
+
line-height: 15px;
|
|
144
|
+
flex: 1;
|
|
145
|
+
min-width: 0;
|
|
146
|
+
`,be=S()(B)`
|
|
147
|
+
:last-child {
|
|
148
|
+
padding-bottom: 0 !important;
|
|
149
|
+
}
|
|
150
|
+
`,Se=e=>e?e.toLocaleString("en-US",{maximumFractionDigits:3,useGrouping:!0}):"0",Ee=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.value.localeCompare(t.value))}),t};var Ce=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(he,{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(he,{ref:c,"data-test-id":n,$isLocationLabel:l,$isPort:i},s||t)):p};var we=e=>{let{search:t,index:n,dataTestId:o}=e;const i=t.origin.length>1,l=t.destination.length>1,s=i?Ee(t.origin):{[t.origin[0].country]:t.origin},d=l?Ee(t.destination):{[t.destination[0].country]:t.destination};return r.a.createElement(B,{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(Ce,{key:e,text:t,isLocationLabel:!0,testId:`${o}-origin-${n}`,isPort:s[e][0].type===c},r.a.createElement(ye,{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(Ce,{key:e,text:t,isLocationLabel:!0,testId:`${o}-destination-${n}`,isPort:d[e][0].type===c},r.a.createElement(ye,{type:"flag",country:e,size:"small","data-test-id":`${o}-destination-flag-${n}`,style:{marginRight:"4px"}}),t)}))};var Oe=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===z)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===M?["container"]:["box"]})(l),{units:p,volume:m,weight:f,weightUnit:g,volumeUnit:h}=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:U};switch(t){case M:{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=Se(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=Se(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=Se(t.uldPackages.reduce((e,t)=>e+parseFloat(t.volume||"0"),0)),n=Se(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:U}}case z:{var o,r,a,i,l;const t=Se(parseFloat((null===(o=e.shipment_details[_])||void 0===o?void 0:o.volume)||"0")),n=Se(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)||U}}default:return{units:0,volume:0,weight:0,weightUnit:V,volumeUnit:U}}})(l),[l]),y=1===l.commodity.length&&l.commodity[0].is_temperature,v=(null===(t=l.commodity_temperature)||void 0===t?void 0:t.tempRange)&&y?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(B,{spacing:k.XSMALL,alignItems:"center",fullWidth:!0,key:s},d===R?r.a.createElement(ve,{alignItems:"center",spacing:k.SMALL,style:{flex:1}},u.map((e,t)=>r.a.createElement(ge,{type:e,key:`${s}-${t}`,size:"tiny","data-test-id":`${c}rs-package-icon-${s}-${t}`})),r.a.createElement(Ce,{text:l.commodity.map(e=>e.label).join(", "),testId:`${c}rs-commodity-${s}`})):r.a.createElement(ve,{alignItems:"center",spacing:k.SMALL},r.a.createElement(B,{alignItems:"center",spacing:k.XSMALL,"data-test-id":`rs-${s}-units`},p,"\xa0",u.map((e,t)=>r.a.createElement(ge,{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",h),f&&r.a.createElement("span",{"data-test-id":`${c}rs-weight-${s}`},f,"\xa0",g),r.a.createElement(Ce,{text:l.commodity.map(e=>e.label).join(", "),testId:`${c}rs-commodity-${s}`}),y&&r.a.createElement(B,{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 Te=e=>{let{search:t,index:n,setIsOpen:o,dataTestId:i,onRecentSearchSelect:l}=e;return r.a.createElement(fe,{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 pe(t.id)}catch(e){console.error(e)}o(!1)})()}},r.a.createElement(we,{search:t,index:n,dataTestId:i}),r.a.createElement(Oe,{search:t,index:n,dataTestId:i}))};var $e=e=>{let{recentSearches:t,setIsOpen:n,dataTestId:o,onRecentSearchSelect:l,initialValues:s}=e;const c=t?(e=>[...e].sort((e,t)=>{const n=new Date(Math.max(new Date(e.last_time_used_date).getTime(),new Date(e.saved_update_date).getTime()));return new Date(Math.max(new Date(t.last_time_used_date).getTime(),new Date(t.saved_update_date).getTime())).getTime()-n.getTime()}).slice(0,6))(t):[];return r.a.createElement(T,null,r.a.createElement(me,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(be,{direction:L.VERTICAL,fullWidth:!0},c.map((e,t)=>r.a.createElement(Te,{onRecentSearchSelect:l,initialValues:s,search:e,index:t,key:e.id,setIsOpen:n,dataTestId:o}))))};var ke=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($e,{recentSearches:n,dataTestId:l,setIsOpen:s,onRecentSearchSelect:c,initialValues:d}):o.trim()?r.a.createElement($,null,r.a.createElement(i.TranslatableText,{stringId:"No matching results",module:i.TRANSLATION_MODULES.SearchAndBook})):null:null};var Le=e=>{let{fetchOptions:t,renderedOptions:n,recentSearches:i=[],hasError:s,mode:c,dataTestId:d,value:u,debounceTimeout:p=800,activeLocationMode:m,defaultLocation:h,onChange:y,...v}=e;const[b,S]=Object(o.useState)([]),[w,O]=Object(o.useState)(!1),[T,$]=Object(o.useState)(""),k=Object(o.useRef)(0),[L,_]=Object(o.useState)(!1),[x,I]=Object(o.useState)(3),P=Object(o.useRef)();Object(o.useEffect)(()=>{u&&0!==u.length||L||(S([]),$(""))},[u,L]),Object(o.useEffect)(()=>(""!==m&&S(e=>e.filter(e=>e.label===f[m].label)),_(!1),P.current&&clearTimeout(P.current),P.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),()=>{P.current&&clearTimeout(P.current)}),[m]);const j=Object(o.useMemo)(()=>Object(l.debounce)(async e=>{$(e),k.current+=1;const n=k.current;S([]),O(!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 O(!1),o}},p),[t,p]);Object(o.useEffect)(()=>{if(!(null===h||void 0===h?void 0:h.code))return;(async()=>{try{S([]),O(!0);const e=await t(h.code);if(S(e),!e||0===e.length)return;let n=null;if(h.type){const t=e.find(e=>{var t;return e.label.toLowerCase()===(null===(t=f[h.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()===h.code.toLowerCase()||e.selectedValue.toLowerCase()===h.code.toLowerCase()))}if(n||(n=e.map(e=>e.options).flat().find(e=>e.code.toLowerCase()===h.code.toLowerCase()||e.selectedValue.toLowerCase()===h.code.toLowerCase())),n&&y){const e={key:JSON.stringify(n),label:n.selectedValue||n.displayLabel||n.code};y([e])}}catch(e){H.isLocal()&&console.error("Error loading default location:",e)}finally{O(!1)}})()},[null===h||void 0===h?void 0:h.code,null===h||void 0===h?void 0:h.type]);return r.a.createElement(r.a.Fragment,null,r.a.createElement(E,null),r.a.createElement(C,Object.assign({maxTagCount:x,onSearch:j,$hasError:s,loading:w,options:b,filterOption:!1,notFoundContent:r.a.createElement(ke,{isLoading:w,recentSearches:i,searchKey:T,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([]),$(""),_(e)},open:L&&(w||T.trim()||(null===i||void 0===i?void 0:i.length)>0),value:u,onChange:y},v),n(b)))};var _e=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(w,{"data-test-id":n+"-extra-ports"},"+"+t.length))};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:C,userCountryCode:T,...$}=e;const[L,_]=Object(o.useState)(t),[x,I]=Object(o.useState)(1===m.length?m[0]:""),[P,j]=Object(o.useState)(oe(x)||""===x?g:h);Object(o.useEffect)(()=>{oe(x)?j(g):j(h)},[x]),Object(o.useEffect)(()=>{_(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 A=Object(o.useRef)({onChange:n,selectionMode:P,maxPorts:p});return Object(o.useEffect)(()=>{A.current={onChange:n,selectionMode:P,maxPorts:p}},[n,P,p]),Object(o.useEffect)(()=>{if((e=>!!e&&(Array.isArray(e)?e.length>0:Object.keys(e).length>0))(t))return;(async()=>{try{const e=await ue({autofillLocationAddress:E,autofillLocationCode:C,supportedLocationModes:m,customer:b,userCountryCode:T});if(!e)return;const{onChange:t,selectionMode:n,maxPorts:o}=A.current;ne([e],n,o,_,t)}catch(e){console.error("Error performing autofill:",e)}})()},[E,C,m,b,T,t]),r.a.createElement(Le,Object.assign({mode:P,dataTestId:s,hasError:l,placeholder:r.a.createElement(i.TranslatableText,{style:{fontSize:a.tokens.fdsFontSizeBase},stringId:"Select "+(c?y:v)}),value:Q(L),fetchOptions:ee(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:Y(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(w,null,l)),key:n.code},r.a.createElement(B,{fullWidth:!0,justifyContent:"space-between"},r.a.createElement(B,{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(O,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=>{ne(null!==e&&void 0!==e?e:[],P,p,_,n),I("")},activeLocationMode:x,maxTagPlaceholder:e=>r.a.createElement(_e,{omittedPorts:e,dataTestId:s}),defaultLocation:S},$))}}])}));
|
|
2
151
|
//# sourceMappingURL=main.bundle.js.map
|
package/build/main.bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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\"","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","helpers/constant.js","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","helpers/styled.js","common/helpers/constants.js","components/RecentSearches/constants.js","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2.js","common/helpers/styled.js","common/components/Flex.js","common/helpers/Environment.js","helpers/utils.js","helpers/apis.js","components/RecentSearches/apis.js","common/httpClient/doRequest/index.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","components/DebounceSelect.js","components/MaxPortsPlaceholder.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","_objectWithoutProperties","source","excluded","target","sourceKeys","keys","length","indexOf","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","LOCATION_MODES","LOCATION_MODES_MAP","label","icon","groupedBy","SelectModes","LocationTypes","_taggedTemplateLiteral","strings","raw","slice","freeze","defineProperties","DropdownGlobalStyle","createGlobalStyle","_templateObject","DebounceSelector","styled","Select","_templateObject2","tokens","fdsBorderRadiusXl","fdsColorPrimaryBlue","fdsColorPrimaryBlue10","fdsComponentSpacingXxs","fdsSizeMd","_ref","size","concat","fdsComponentSpacingSm","fdsComponentSpacingXs","fdsColorPrimaryGray80","_ref2","$hasError","fdsColorSemanticRed","fdsColorSemanticRed10","SelectedOptionLabel","span","_templateObject3","fdsFontSizeSm","SelectOptionLabel","div","_templateObject4","StyledMenu","Menu","_templateObject5","fdsBodyTextColorDisabled","NoMatchingResults","_templateObject6","fdsSizeSm","fdsHeadingsFontFamily","FlexSpacings","Icon","_templateObject7","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","_defineProperty","obj","configurable","writable","ownKeys","enumerableOnly","symbols","filter","sym","getOwnPropertyDescriptor","push","apply","_objectSpread2","arguments","forEach","getOwnPropertyDescriptors","StyledFlex","$direction","$wrap","_ref3","$alignItems","_ref4","$justifyContent","_ref5","$fullWidth","css","_ref6","$spacing","Flex","direction","alignItems","spacing","wrap","justifyContent","fullWidth","rest","_excluded","React","createElement","assign","children","Environment","process","REACT_APP_CUSTOM_ENV","getGatewayApiPrefix","isTalaia","domain","isProduction","stableStringify","allKeys","JSON","stringify","k","v","uniqSortedKeys","Array","from","Set","sort","normalizeLocationForKey","loc","displayLabel","selectedValue","formattedNameOrAddress","code","countryCode","stateOrProvince","city","latitude","longitude","postalOrZipCode","sourceType","locationType","type","countryName","country","stableKeyFromLocation","parsed","parse","decodeHtmlEntities","_unused","getLocationInputValue","locations","formatLocation","location","_LOCATION_MODES_MAP$l","Fragment","undefined","getLocationInputOption","isArray","map","fetchLocations","activeLocationMode","supportedLocationModes","customer","async","query","modes","locationsResults","locationModes","sources","reduce","acc","_objectSpread","toUpperCase","searchTerm","httpClient","post","limit","data","error","console","results","getLocations","updatedLocationsResults","fulfillmentCenters","option","address","extractFulfillmentCenters","_LOCATION_MODES_MAP$k","options","onChangeLocation","changedLocations","onChange","Promise","all","json","err","Boolean","isLocationAddress","replace","saveLastUsedSearch","method","url","params","URLSearchParams","toString","headers","doRequest","id","searchId","STitle","fdsColorPrimaryGray60","fdsSizeXs","fdsFontWeightRegular","SCard","UnitIcon","STruncatedLabel","$isLocationLabel","$isPort","SLocationFlag","Avatar","fdsColorPrimaryGray20","STinyWrapper","SListWrapper","formatNumber","toLocaleString","maximumFractionDigits","useGrouping","groupAndOrderLocationsByCountries","groupedByCountry","a","b","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","labelOrigin","join","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","handleClick","RecentSearches","recentSearches","initialValues","firstSixSearches","aMaxDate","Date","Math","max","last_time_used_date","getTime","saved_update_date","orderRecentSearches","TranslatableText","stringId","SelectorContent","isLoading","searchKey","Spin","trim","TRANSLATION_MODULES","SearchAndBook","DebounceSelect","fetchOptions","renderedOptions","hasError","debounceTimeout","defaultLocation","props","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","danger","message","description","match","targetGroup","find","group","_LOCATION_MODES_MAP$d","toLowerCase","flat","formattedMatch","isLocal","loadDefaultLocation","onSearch","loading","filterOption","notFoundContent","allowClear","labelInValue","optionLabelProp","showSearch","onDropdownVisibleChange","open","MaxPortsPlaceholder","omittedPorts","selectedItems","omittedPort","_JSON$parse","LocationInput","isOriginLocation","maxPorts","selectedLocation","setSelectedLocation","setActiveLocationMode","selectionMode","setSelectionMode","placeholder","fontSize","fdsFontSizeBase","optionGroups","renderLocationOptions","some","_group$options","_group$options2","values","locationOptionIcon","OptGroup","fontFamily","Option","paddingLeft","Chip","iconType","handleLocationChange","selectedPorts","_selectedPorts$","typePort","Message","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,QA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A,EAAmCpR,cAAepJ,EAA0B2a,EAAW,EAAI,WAAa,UAAcA,EAAW,EAAI,QAAU,OAChK0B,UAAQxD,OACP3R,IAAAC,cAAAD,IAAAiD,SAAA,KACCjD,IAAAC,cAAC+O,mBAAgB,CAACC,SAAU,+BAC3B,IAAI,IAAEwE,EAAS,IAAE,IAClBzT,IAAAC,cAAC+O,mBAAgB,CAACC,SAAUiG,YAK/BvB,EAAoB5Q,GACpBqC,GAAiBrC,EAAUuC,Ie5NzByP,CAA6B,OAARhS,QAAQ,IAARA,IAAY,GAAI8Q,EAAeJ,EAAUE,EAAqBrO,GACnFsO,EzB1GiC,KyB4GlCrQ,mBAAoBA,EACpB6R,kBAAmBjC,GAAgBnT,IAAAC,cAACiT,GAAmB,CAACC,aAAcA,EAAc3J,WAAYA,IAChGsG,gBAAiBA,GACbhQ","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__;","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\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","export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\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 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","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\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","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 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 * 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) => (allKeys.push(k), v));\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\nconst 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","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 { getGatewayApiPrefix } from \"../../helpers/utils\";\r\nimport { doRequest } from \"../../common/httpClient/doRequest/index\";\r\n\r\nexport const saveLastUsedSearch = async ( searchId ) => {\r\n\tawait doRequest({\r\n\t\tmethod: 'put',\r\n\t\turl: `${getGatewayApiPrefix(false)}/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 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 { 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.value.localeCompare(b.value));\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 { 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","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 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 React, { useEffect, 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\tgetLocationInputValue,\r\n\thandleLocationChange,\r\n\tisLocationAddress,\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\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\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\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\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};\r\n\r\nexport default LocationInput;\r\n"],"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/helpers/styled.js","common/components/Flex.js","helpers/apis.js","common/helpers/Environment.js","helpers/utils.js","components/RecentSearches/apis.js","common/httpClient/doRequest/index.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","components/DebounceSelect.js","components/MaxPortsPlaceholder.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","StyledFlex","$direction","$wrap","_ref3","$alignItems","_ref4","$justifyContent","_ref5","$fullWidth","css","_ref6","$spacing","Flex","direction","alignItems","spacing","wrap","justifyContent","fullWidth","rest","React","createElement","assign","children","getLocations","async","locationModes","query","customer","sources","reduce","acc","type","toUpperCase","code","searchTerm","httpClient","post","limit","data","error","console","results","Environment","process","REACT_APP_CUSTOM_ENV","stableStringify","obj","allKeys","JSON","stringify","k","v","push","uniqSortedKeys","Array","from","Set","sort","normalizeLocationForKey","loc","displayLabel","selectedValue","formattedNameOrAddress","countryCode","stateOrProvince","city","latitude","longitude","postalOrZipCode","sourceType","locationType","countryName","country","stableKeyFromLocation","parsed","parse","decodeHtmlEntities","getLocationInputValue","locations","formatLocation","location","_LOCATION_MODES_MAP$l","Fragment","undefined","getLocationInputOption","isArray","map","fetchLocations","activeLocationMode","supportedLocationModes","modes","locationsResults","updatedLocationsResults","fulfillmentCenters","filter","option","length","address","otherTypes","extractFulfillmentCenters","keys","_LOCATION_MODES_MAP$k","options","onChangeLocation","changedLocations","onChange","Promise","all","raw","json","err","Boolean","handleLocationChange","selectionMode","maxPorts","setSelectedLocation","selectedPorts","_JSON$parse","_selectedPorts$","typePort","Message","danger","TranslatableText","stringId","isLocationAddress","replace","DISPLAY_LABEL_STREET_PATTERN","normalizeText","text","toLowerCase","normalize","trim","extractStreetNumber","numberMatch","match","calculateSimilarity","str1","str2","words1","split","words2","matches","totalWords","Math","max","forEach","word1","some","word2","includes","calculateAddressScore","inputKeywords","userCountryCode","score","formattedAddress","streetAddress","extractStreetFromDisplayLabel","normalizedStreet","normalizedFormatted","normalizedDisplay","streetNumber","streetSimilarity","fullText","formattedSimilarity","displaySimilarity","number","normalizedCity","words","keyword","selectBestAddressMatch","addresses","searchQuery","normalized","word","extractKeywords","availableCities","addr","original","normalizedQuery","queryWords","w","detectedCity","cityData","cityWords","queryWord","cityWord","scoredAddresses","a","b","findAutofillMatch","autofillLocationAddress","autofillLocationCode","matchingAddresses","findPortMatch","portCode","find","port","formatted","formatLocationForSelection","saveLastUsedSearch","isTalaia","method","url","params","URLSearchParams","toString","headers","doRequest","isProduction","id","searchId","STitle","fdsColorPrimaryGray60","fdsSizeXs","fdsFontWeightRegular","SCard","UnitIcon","STruncatedLabel","$isLocationLabel","$isPort","SLocationFlag","Avatar","fdsColorPrimaryGray20","STinyWrapper","SListWrapper","formatNumber","toLocaleString","maximumFractionDigits","useGrouping","groupAndOrderLocationsByCountries","groupedByCountry","localeCompare","TruncatedLabel","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","labelOrigin","join","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","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","handleClick","RecentSearches","recentSearches","initialValues","firstSixSearches","aMaxDate","Date","last_time_used_date","getTime","saved_update_date","slice","orderRecentSearches","SelectorContent","isLoading","searchKey","Spin","TRANSLATION_MODULES","SearchAndBook","DebounceSelect","fetchOptions","renderedOptions","hasError","debounceTimeout","defaultLocation","props","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","group","_LOCATION_MODES_MAP$d","flat","formattedMatch","isLocal","loadDefaultLocation","onSearch","loading","filterOption","notFoundContent","allowClear","labelInValue","optionLabelProp","showSearch","onDropdownVisibleChange","open","MaxPortsPlaceholder","omittedPorts","selectedItems","omittedPort","LocationInput","isOriginLocation","selectedLocation","setActiveLocationMode","setSelectionMode","callbacksRef","hasExistingValue","currentOnChange","currentSelectionMode","currentMaxPorts","doAutofill","placeholder","fontSize","fdsFontSizeBase","optionGroups","renderLocationOptions","_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,eAAe1B,EAASsB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAAS7B,GACX,qBAAX8B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IlB+C,IAAAC,cAACtD,EAAiB,KAAE8F,IAEpB7B,IAAS/F,GAAqCmF,IAAAC,cAAC7C,OAAI,CAACwD,KAAK,SAAS5E,KAAK,UACvE4E,IAAS/F,GAA+BmF,IAAAC,cAACyZ,OAAI,CAAC9Y,KAAK,UAAU+Y,SAAS,yBc3C3CV,CAAsBD,EAAcnK,GACrEvJ,SAAUzB,IACTgC,GAA6B,OAARhC,QAAQ,IAARA,IAAY,GAAIiC,EAAeC,EAAUC,EAAqBV,GACnF+S,EtBrJiC,KsBuJlChU,mBAAoBA,EACpBuV,kBAAmB7B,GAAgB/X,IAAAC,cAAC6X,GAAmB,CAACC,aAAcA,EAAclJ,WAAYA,IAChGiG,gBAAiBA,GACb/U","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 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 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 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","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 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 * 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) => (allKeys.push(k), v));\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\nconst 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}\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\nconst DISPLAY_LABEL_STREET_PATTERN = /^[^-]*-\\s*(.+?),/;\r\n\r\n/**\r\n * Normalizes text by converting to lowercase, removing accents, and cleaning special characters.\r\n * Used for fuzzy matching comparison.\r\n *\r\n * @param {string} text - The text to normalize.\r\n * @returns {string} Normalized text.\r\n */\r\nconst normalizeText = (text) => {\r\n\tif (!text) return '';\r\n\treturn text\r\n\t\t.toLowerCase()\r\n\t\t.normalize('NFD')\r\n\t\t.replace(/[\\u0300-\\u036f]/g, '')\r\n\t\t.replace(/[^\\w\\s]/g, ' ')\r\n\t\t.replace(/\\s+/g, ' ')\r\n\t\t.trim();\r\n};\r\n\r\n/**\r\n * Extracts street number from text.\r\n *\r\n * @param {string} text - The text to extract number from.\r\n * @returns {string|null} The extracted street number or null if not found.\r\n */\r\nconst extractStreetNumber = (text) => {\r\n\tconst numberMatch = text.match(/\\b(\\d+)\\b/);\r\n\treturn numberMatch ? numberMatch[1] : null;\r\n};\r\n\r\n/**\r\n * Extracts keywords, street number, and normalized text from search query.\r\n *\r\n * @param {string} text - The search query text.\r\n * @returns {Object} Object containing words array, street number, city (null initially), and normalized full text.\r\n */\r\nconst extractKeywords = (text) => {\r\n\tconst normalized = normalizeText(text);\r\n\tconst words = normalized.split(/\\s+/).filter(word => word.length > 2);\r\n\tconst number = extractStreetNumber(text);\r\n\t\r\n\treturn {\r\n\t\twords,\r\n\t\tnumber,\r\n\t\tcity: null,\r\n\t\tfullText: normalized\r\n\t};\r\n};\r\n\r\n/**\r\n * Calculates similarity score between two strings based on word matching.\r\n * Returns a value between 0 and 1 representing how similar the strings are.\r\n *\r\n * @param {string} str1 - First string to compare.\r\n * @param {string} str2 - Second string to compare.\r\n * @returns {number} Similarity score between 0 and 1.\r\n */\r\nconst calculateSimilarity = (str1, str2) => {\r\n\tif (!str1 || !str2) return 0;\r\n\t\r\n\tconst words1 = str1.split(/\\s+/);\r\n\tconst words2 = str2.split(/\\s+/);\r\n\t\r\n\tlet matches = 0;\r\n\tlet totalWords = Math.max(words1.length, words2.length);\r\n\t\r\n\twords1.forEach(word1 => {\r\n\t\tif (words2.some(word2 => word2.includes(word1) || word1.includes(word2))) {\r\n\t\t\tmatches++;\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn totalWords > 0 ? matches / totalWords : 0;\r\n};\r\n\r\n/**\r\n * Extracts street address from display label.\r\n * Expected format: \"COUNTRY_CODE - Street Address, City, State\"\r\n *\r\n * @param {string} displayLabel - The display label to extract street from.\r\n * @returns {string} The extracted street address.\r\n */\r\nconst extractStreetFromDisplayLabel = (displayLabel) => {\r\n\tif (!displayLabel) return '';\r\n\tconst match = displayLabel.match(DISPLAY_LABEL_STREET_PATTERN);\r\n\treturn match ? match[1].trim() : displayLabel;\r\n};\r\n\r\n/**\r\n * Calculates a relevance score for an address based on fuzzy matching with search query.\r\n * Higher scores indicate better matches. Considers street name similarity, street number match,\r\n * city match, user country preference, and keyword presence.\r\n *\r\n * @param {Object} address - The address object to score.\r\n * @param {Object} inputKeywords - Extracted keywords from search query.\r\n * @param {string} userCountryCode - User's country code for preference scoring.\r\n * @returns {number} The calculated relevance score.\r\n */\r\nconst calculateAddressScore = (address, inputKeywords, userCountryCode) => {\r\n\tlet score = 0;\r\n\t\r\n\tconst displayLabel = address.displayLabel || '';\r\n\tconst formattedAddress = address.formattedNameOrAddress || '';\r\n\tconst streetAddress = extractStreetFromDisplayLabel(displayLabel);\r\n\tconst normalizedStreet = normalizeText(streetAddress);\r\n\tconst normalizedFormatted = normalizeText(formattedAddress);\r\n\tconst normalizedDisplay = normalizeText(displayLabel);\r\n\t\r\n\tconst streetNumber = extractStreetNumber(displayLabel) || extractStreetNumber(formattedAddress);\r\n\t\r\n\tconst streetSimilarity = calculateSimilarity(inputKeywords.fullText, normalizedStreet);\r\n\tconst formattedSimilarity = calculateSimilarity(inputKeywords.fullText, normalizedFormatted);\r\n\tconst displaySimilarity = calculateSimilarity(inputKeywords.fullText, normalizedDisplay);\r\n\t\r\n\tscore += Math.max(streetSimilarity, formattedSimilarity, displaySimilarity) * 50;\r\n\t\r\n\tif (inputKeywords.number && streetNumber) {\r\n\t\tif (inputKeywords.number === streetNumber) {\r\n\t\t\tscore += 30;\r\n\t\t} else {\r\n\t\t\tscore -= 10;\r\n\t\t}\r\n\t} else if (inputKeywords.number && !streetNumber) {\r\n\t\tscore -= 15;\r\n\t} else if (!inputKeywords.number && streetNumber) {\r\n\t\tscore += 5;\r\n\t}\r\n\t\r\n\tif (inputKeywords.city) {\r\n\t\tconst normalizedCity = normalizeText(address.city || '');\r\n\t\tif (normalizedCity.includes(inputKeywords.city) || inputKeywords.city.includes(normalizedCity)) {\r\n\t\t\tscore += 15;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif (userCountryCode && address.countryCode) {\r\n\t\tif (address.countryCode.toLowerCase() === userCountryCode.toLowerCase()) {\r\n\t\t\tscore += 5;\r\n\t\t}\r\n\t}\r\n\t\r\n\tinputKeywords.words.forEach(keyword => {\r\n\t\tif (normalizedStreet.includes(keyword) || normalizedFormatted.includes(keyword)) {\r\n\t\t\tscore += 2;\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn score;\r\n};\r\n\r\n/**\r\n * Finds all matching addresses from location results.\r\n * Combines address and fulfillment center results.\r\n *\r\n * @param {Object} locationsResults - The location results object.\r\n * @returns {Array} Array of address objects.\r\n */\r\nconst findMatchingAddresses = (locationsResults) => {\r\n\tconst addressResults = locationsResults[LOCATION_MODES.ADDRESS] || [];\r\n\tconst fulfillmentResults = locationsResults[LOCATION_MODES.FULFILLMENT_CENTER] || [];\r\n\treturn [...addressResults, ...fulfillmentResults];\r\n};\r\n\r\n/**\r\n * Selects the best matching address from available addresses using fuzzy matching.\r\n * Detects city from search query by comparing with available cities in results.\r\n * Scores all addresses and returns the one with highest score.\r\n *\r\n * @param {Array} addresses - Array of address objects to choose from.\r\n * @param {string} searchQuery - The original search query.\r\n * @param {string} userCountryCode - User's country code for preference scoring.\r\n * @returns {Object|null} The best matching address or null if no addresses provided.\r\n */\r\nconst selectBestAddressMatch = (addresses, searchQuery, userCountryCode) => {\r\n\tif (addresses.length === 0) return null;\r\n\tif (addresses.length === 1) return addresses[0];\r\n\t\r\n\tconst inputKeywords = extractKeywords(searchQuery);\r\n\t\r\n\tconst availableCities = addresses.map(addr => ({\r\n\t\tnormalized: normalizeText(addr.city || ''),\r\n\t\toriginal: addr.city || ''\r\n\t})).filter(city => city.normalized.length > 0);\r\n\t\r\n\tconst normalizedQuery = normalizeText(searchQuery);\r\n\tconst queryWords = normalizedQuery.split(/\\s+/).filter(w => w.length > 3);\r\n\t\r\n\tlet detectedCity = null;\r\n\tfor (const cityData of availableCities) {\r\n\t\tconst cityWords = cityData.normalized.split(/\\s+/);\r\n\t\t\r\n\t\tfor (const queryWord of queryWords) {\r\n\t\t\tif (cityWords.some(cityWord => \r\n\t\t\t\tcityWord.includes(queryWord) || queryWord.includes(cityWord)\r\n\t\t\t)) {\r\n\t\t\t\tdetectedCity = cityData.normalized;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (normalizedQuery.includes(cityData.normalized) || cityData.normalized.includes(normalizedQuery)) {\r\n\t\t\tdetectedCity = cityData.normalized;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tif (detectedCity) break;\r\n\t}\r\n\t\r\n\tif (detectedCity) {\r\n\t\tinputKeywords.city = detectedCity;\r\n\t}\r\n\t\r\n\tconst scoredAddresses = addresses.map(address => ({\r\n\t\taddress,\r\n\t\tscore: calculateAddressScore(address, inputKeywords, userCountryCode)\r\n\t}));\r\n\t\r\n\tscoredAddresses.sort((a, b) => b.score - a.score);\r\n\t\r\n\treturn scoredAddresses[0].score > 0 ? scoredAddresses[0].address : 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\treturn [...airportResults, ...seaportResults].find(\r\n\t\t(port) => port.code === portCode\r\n\t);\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\tif (autofillLocationAddress) {\r\n\t\tconst { results = {} } = await getLocations(supportedLocationModes, autofillLocationAddress, customer);\r\n\t\tconst matchingAddresses = findMatchingAddresses(results);\r\n\t\tmatch = selectBestAddressMatch(matchingAddresses, autofillLocationAddress, 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 { getGatewayApiPrefix } from \"../../helpers/utils\";\r\nimport { doRequest } from \"../../common/httpClient/doRequest/index\";\r\n\r\nexport const saveLastUsedSearch = async ( searchId ) => {\r\n\tawait doRequest({\r\n\t\tmethod: 'put',\r\n\t\turl: `${getGatewayApiPrefix(false)}/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 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 { 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.value.localeCompare(b.value));\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 { 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","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 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 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\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\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\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\t// Autofill effect with proper cancellation\r\n\tuseEffect(() => {\r\n\t\t// Skip if already has a value\r\n\t\tif (hasExistingValue(value)) {\r\n\t\t\treturn;\r\n\t\t}\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\t// Check if still mounted and not cancelled\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: currentSelectionMode, maxPorts: currentMaxPorts } = callbacksRef.current;\r\n\t\t\t\thandleLocationChange([match], currentSelectionMode, currentMaxPorts, setSelectedLocation, currentOnChange);\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, value]);\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":""}
|
|
@@ -4,7 +4,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|
|
4
4
|
"url": "http://ship.freightos.local:8800/FusionLocationInput/index.html"
|
|
5
5
|
},
|
|
6
6
|
{
|
|
7
|
-
"revision": "
|
|
7
|
+
"revision": "70af870efb62e66aed73",
|
|
8
8
|
"url": "http://ship.freightos.local:8800/FusionLocationInput/main.bundle.js"
|
|
9
9
|
}
|
|
10
10
|
]);
|
package/build/service-worker.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
|
15
15
|
|
|
16
16
|
importScripts(
|
|
17
|
-
"http://ship.freightos.local:8800/FusionLocationInput/precache-manifest.
|
|
17
|
+
"http://ship.freightos.local:8800/FusionLocationInput/precache-manifest.8f1a2f3c6a5c8a1dcac52dc8238ef050.js"
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
self.addEventListener('message', (event) => {
|