1!function(){try{("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).__faroGitHash_myeroad="5ce3e63ee526711d9fdee9e150f093852f3a7cc4"}catch(e){}}(),function(){try{("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).__faroBundleId_myeroad="10.1.5092-apac"}catch(e){}}();try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="61662775-8bca-4c6c-8411-3e21663a8618",e._sentryDebugIdIdentifier="sentry-dbid-61662775-8bca-4c6c-8411-3e21663a8618")}catch(e){}("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"10.1.5092-apac"},(self.webpackChunk_eroad_myeroad=self.webpackChunk_eroad_myeroad||[]).push([[3193],{38485:(e,t,a)=>{a.r(t),a.d(t,{ApiKeyForm:()=>Ze,default:()=>Ge});var r=a(14041),n=a(70541),o=a(52879),i=a(24134),l=a(43420),s=a(62664),c=a(62397),d=a(63244),m=a(40026),p=a(37506),u=a(39626),g=a(42453),y=a(87908),f=a(94416),E=a(31820),b=a(9898),v=a(51962),h=a(80601),w=a(14773),O=a(4078),x=a(67252),P=a(76866),k=a(1454);const I=(0,k.wY)(e=>({root:{display:"flex","@media (max-width: 767px)":{paddingBottom:"0!important",paddingLeft:10},"& > .ant-row":{width:"100%","@media (min-width: 768px)":{paddingTop:e.spacing(3),paddingLeft:10}}},text:{color:e.colors.onsurfaceTechnicalFont}}),{name:"FullAccessMessage"});var S=a(14041);const T=()=>{const e=I();return S.createElement(m.f,{xs:24,md:16,xl:7,className:e.root},S.createElement(m.y,null,S.createElement(m.f,{xs:24,sm:8,md:12},S.createElement("span",{className:e.text},S.createElement(l.s,{id:"integrations-full-access-title"}))),S.createElement(m.f,{xs:24,sm:16,md:12},S.createElement(l.s,{id:"integrations-full-access-body",tagName:"span"}))))};var N=a(61418),C=a(64145);const j=(0,k.wY)(()=>({col:{display:"flex"},row:{width:"100%"}}),{name:"EntitySelector"});var A=a(14041);const D=({entities:e=[],value:t,onChange:a,type:n})=>{const o=j(),{t:i}=(0,h.t)(),s=JSON.stringify(t)===JSON.stringify(["*"]),c=(0,r.useMemo)(()=>[...null!=e?e:[]].sort((e,t)=>(e.name||"").localeCompare(t.name||"")),[e]);return A.createElement(m.f,{className:o.col,xs:24,md:16,xl:7},A.createElement(m.y,{className:o.row},A.createElement(m.f,{xs:24,sm:8,md:12},A.createElement(C.d,{checked:s,"data-testid":"integrations-entity-selector-switch",onChange:e=>{a(e?["*"]:[])}})," ",A.createElement(l.s,{id:"integrations-entity-selector-title",values:{type:n}}),A.createElement("br",null),A.createElement(l.s,{id:"integrations-entity-selector-subtitle",tagName:"small"})),A.createElement(m.f,{xs:24,sm:16,md:12},A.createElement(N.l,{"data-testid":"integrations-entity-selector-select",disabled:s,maxTagCount:0,maxTagPlaceholder:i({id:"integrations-entity-selector-max-tag-placeholder",values:{count:(null==t?void 0:t.length)||0,type:n}}),mode:"multiple",onChange:a,placeholder:i({id:s?"integrations-entity-selector-placeholder-all":"integrations-entity-selector-placeholder",values:{type:n}}),value:s?[]:t,optionFilterProp:"children",options:c.map(({id:e,name:t})=>({key:e,value:e,label:t}))}))))},B=(0,k.wY)(e=>({rootError:{display:"flex","@media (max-width: 767px)":{paddingBottom:"0!important",paddingLeft:10},"& > .ant-row":{width:"100%","@media (min-width: 768px)":{paddingTop:e.spacing(3),paddingLeft:10}}}}),{name:"EntitySelectorSet"});var _=a(54012),F=a(95737),R=a(14041),L=Object.defineProperty,K=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,H=(e,t,a)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const J=({entityRestriction:e,entityTypesSupported:t,onChange:a,productId:n})=>{const[o,l]=((e,t)=>{const[a,n]=(0,r.useState)(),[o,i]=(0,r.useState)(),l=(0,_.V)();return(0,r.useEffect)(()=>{e&&e.length>0?(0,F.ed)(t,l).then(n).catch(()=>{i("integrations-entity-selector-set-error")}):n(void 0)},[l,e,t]),[a,o]})(t,n),{t:s}=(0,h.t)(),c=B();return l?R.createElement(m.f,{xs:24,md:16,xl:7,className:c.rootError},R.createElement(P.F,{message:s(l),type:"error"})):!(0,v.O)(t)||t.length>0&&!o?R.createElement(E.t,null):(0,i.I)(t)?R.createElement(T,null):R.createElement(R.Fragment,null,t.map(t=>R.createElement(D,{entities:null==o?void 0:o[t],key:t,onChange:r=>{return a((n=((e,t)=>{for(var a in t||(t={}))$.call(t,a)&&H(e,a,t[a]);if(V)for(var a of V(t))z.call(t,a)&&H(e,a,t[a]);return e})({},e),K(n,Y({[t]:r}))));var n},type:t,value:e[t]})))},q=(0,k.wY)(e=>({root:{"& > .ant-col":{"@media (max-width: 1199px)":{paddingBottom:e.spacing(4)}},"& .ant-col":{"@media (max-width: 767px)":{paddingBottom:e.spacing(4)}}},titleCol:{"@media (min-width: 1200px)":{paddingTop:e.spacing(2)}},deleteButton:{marginLeft:"auto"}}),{name:"ProductRow"});var M=a(14041),Q=Object.defineProperty,U=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,ee=(e,t,a)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,te=(e,t)=>
1{for(var a in t||(t={}))W.call(t,a)&&ee(e,a,t[a]);if(G)for(var a of G(t))X.call(t,a)&&ee(e,a,t[a]);return e},ae=(e,t)=>U(e,Z(t));const re=({onChange:e,onDelete:t,product:a,value:r})=>{const n=q(),{t:o}=(0,h.t)();if(!(0,v.O)(a))return null;const{actions:i,entityTypesSupported:s,name:d}=a,{action:p,entityRestriction:u,productId:g}=r;return M.createElement(m.y,{gutter:20,className:n.root},M.createElement(m.f,{xs:24,xl:3,className:n.titleCol},d),M.createElement(J,{entityRestriction:u,entityTypesSupported:s,onChange:t=>{e(ae(te({},r),{entityRestriction:t}))},productId:g}),Array.isArray(i)&&i.length>1&&M.createElement(m.f,{xs:24,md:6,xl:3},M.createElement(x.z6,{onChange:t=>e(ae(te({},r),{action:JSON.parse(t.target.value)})),value:JSON.stringify(p),"data-testid":"integrations-product-row-radio-group"},M.createElement(x.sx,{value:JSON.stringify(["read"])},M.createElement(l.s,{id:"integrations-product-row-readonly"})),M.createElement("br",null),M.createElement(x.sx,{value:JSON.stringify(["read","write"])},M.createElement(l.s,{id:"integrations-product-row-read-write"})))),M.createElement(c.$,{className:n.deleteButton,onClick:()=>{O.a.confirm({title:o("integrations-product-row-remove-title"),content:o("integrations-product-row-remove-content"),onOk:t})},type:"link"},M.createElement(w.A,null)))};var ne=a(99728),oe=a(13587),ie=Object.defineProperty,le=Object.defineProperties,se=Object.getOwnPropertyDescriptors,ce=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,pe=(e,t,a)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var ue=a(14041);const ge=({onAddProducts:e,onCancel:t,productIdsAvailableToAdd:a})=>{const[o,i]=(0,r.useState)([]),s=(0,n.d4)(oe.T.getProductsById),{t:c}=(0,h.t)(),d=[{title:c("integrations-add-product-modal-all-products"),value:"all-products",children:a.map(e=>({title:s[e].name,value:e}))}];return ue.createElement(O.a,{onCancel:t,onOk:()=>{e(((e,t)=>t.map(t=>{const{actions:a,entityTypesSupported:r}=e[t];return{action:[a[0]],productId:t,entityRestriction:r.reduce((e,t)=>{return a=((e,t)=>{for(var a in t||(t={}))de.call(t,a)&&pe(e,a,t[a]);if(ce)for(var a of ce(t))me.call(t,a)&&pe(e,a,t[a]);return e})({},e),le(a,se({[t]:["*"]}));var a},{})}}))(s,o))},title:ue.createElement(l.s,{id:"integrations-add-product-modal-title"}),open:!0},ue.createElement(ne.f,{treeCheckable:!0,treeDefaultExpandAll:!0,maxTagCount:"responsive",placeholder:c("integrations-add-product-modal-select-product"),treeData:d,onChange:e=>i(Array.isArray(e)?e:[e])}))},ye=(0,k.wY)(e=>({sectionHeader:{color:e.colors.onsurfaceFont,marginBottom:e.spacing(3)},sectionDivider:{borderColor:e.colors.onsurfaceTechnicalFont},addProductButton:{alignSelf:"flex-end"},noProductError:{color:e.colors.onsurfaceCriticalRed}}),{name:"ProductDetails"});var fe=a(14041);const Ee=({noProductsError:e,onChange:t=y.l,setNoProductsError:a,value:n=[]})=>{const o=ye(),[{productsById:i,productsIdList:s},d]=(0,b.Q)(),[m,p]=(0,r.useState)(!1),u=()=>p(!1),v=function({productsIdList:e,value:t}){return e.filter(e=>!e.includes("implicit")).filter(e=>!t.some(({productId:t})=>t===e))}({productsIdList:s,value:n}),h=n.length>0;return fe.createElement("section",null,fe.createElement("h2",{className:o.sectionHeader},fe.createElement(l.s,{id:"integrations-product-details-header"})),h&&fe.createElement(f.c,{className:o.sectionDivider}),d?n.map((e,a)=>{const{productId:o}=e,l=i[o];return fe.createElement(r.Fragment,{key:o},fe.createElement(re,{onChange:e=>t(n.map(t=>t.productId===o?e:t)),onDelete:()=>t(n.filter(e=>e.productId!==o)),product:l,value:e}),a!==n.length-1&&fe.createElement(f.c,null))}):fe.createElement("div",null,fe.createElement(E.t,null)),h&&fe.createElement(f.c,{className:o.sectionDivider}),v.length>0&&fe.createElement(c.$,{className:o.addProductButton,"data-testid":"integrations-product-details-add-button",onClick:()=>p(!0)},fe.createElement(l.s,{id:"integrations-product-details-add"})),e&&fe.createElement("div",{className:(0,g.$)("ant-form-explain",o.noProductError),"data-testid":"integrations-product-details-error"},fe.createElement(l.s,{id:"integrations-product-details-error"})),m&&fe.createElement(ge,{onAddProducts:e=>{u(),a(!1),t([...n,...e])},onCancel:()=>u(),productIdsAvailableToAdd:v}))};var be=a(30975),ve=a(6288);const he=(0,k.wY)(e=>({sectionHeader:{color:e.colors.onsurfaceFont,marginBottom:e.spacing(3)},formRow:{margin:`${e.spacing(4)}px !important`,backgroundColor:e.colors.surfaceOverlay,padding:e.spacing(5),border:`1px solid ${e.colors.surfaceLevel3}`,"& .ant-form-item":{marginTop:e.spacing(4),marginBottom:e.spacing(4)}},buttonBox:{marginLeft:e.spacing(5),"& > button":{marginRight:e.spacing(4)}}}),{name:"ApiKeyForm"});var we=a(31912),Oe=a(49301),xe=a(3575),Pe=a(62457),ke=a(82479),Ie=a(82162),Se=a(72627),Te=a(4036),Ne=Object.defineProperty,Ce=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,De=(e,t,a)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Be=(e,t)=>{for(var a in t||(t={}))je.call(t,a)&&De(e,a,t[a]);if(Ce)for(var a of Ce(t))Ae.call(t,a)&&De(e,a,t[a]);return e};const _e=(0,k.wY)(e=>({sectionHeader:{color:e.colors.onsurfaceFont,marginBottom:e.spacing(3)},creatorSection:{display:"flex",marginTop:e.spacing(7),"& > .anticon":{fontSize:40},"& > div":{display:"flex",flexDirection:"column",marginLeft:e.spacing(2),"& > span:first-child":Be({},e.typography.sizes.xs),"& > span":Be({},e.typography.sizes.sm)}}}),{name:"KeyDetails"});var Fe=a(94752),Re=a(65802);const Le=(e,t)=>(a,r)=>{let n;return(0,Fe.g)(r)||(0,Re.K)(r)&&""===r.trim()?n="integrations-name-validation-empty":t.includes(r)?n="integrations-name-validation-unique":!0!==/^[a-zA-Z0-9 ]*$/.test(r)&&(n="integrations-name-validation-special-characters"),n?Promise.reject(new Error(e(n))):Promise.resolve()};var Ke=a(14041);const Ye=({initialValues:e})=>{const t=(0,n.d4)(oe.T.getApiKeysIdList),a=(0,n.d4)(Ie.T.getCurrentUsername),r=(null==e?void 0:e.creatorUserName)||a||"",o=_e(),{t:i}=(0,h.t)(),s=(0,ke.N)();return Ke.createElement("section",null,Ke.createElement("h2",{className:o.sectionHeader},Ke.createElement(l.s,{id:"integrations-key-details-header"})),Ke.createElement("div",{className:o.creatorSection},Ke.createElement(Oe.A,null),Ke.createElement("div",null,Ke.createElement("span",null,Ke.createElement(l.s,{id:"integrations-key-details-creator"})),Ke.createElement("span",{"data-testid":"api-key-form-creator"},r))),Ke.createElement(d.eI,{name:"status",label:Ke.createElement(l.s,{id:"integrations-key-details-status"}),rules:[{required:!0}]},Ke.createElement(N.l,{"data-testid":"api-key-form-status-select",options:Te.V.filter(({value:e})=>"EXPIRED"!==e).map(({value:e})=>({key:e,value:e,label:Ke.createElement(Se.h,{status:e,statusOptions:Te.V})}))})),Ke.createElement(d.eI,{name:"technicalEmail",label:Ke.createElement(l.s,{id:"integrations-key-details-contact"}),rules:[{required:!0,type:"email",message:i("integrations-key-details-contact-error")}]},Ke.createElement(Pe.pd,{"data-testid":"api-key-form-technical-email",placeholder:i("integrations-key-details-contact-placeholder")})),Ke.createElement(d.eI,{"data-testid":"api-key-form-name-decorator",name:"name",label:Ke.createElement(l.s,{id:"integrations-key-details-name"}),rules:[{required:!0,validator:Le(i,t)}]},Ke.createElement(Pe.pd,{"data-testid":"api-key-form-name",disabled:(0,v.O)(e),placeholder:i("integrations-key-details-name-placeholder")})),Ke.createElement(d.eI,{name:"expiresAt",label:Ke.createElement(l.s,{id:"integrations-key-details-expiry"}),rules:[{required:!0,message:i("integrations-key-details-expiry-error")}]},Ke.createElement(xe.lr,{"data-testid":"api-key-form-expires-at",disabled:(0,v.O)(e),disabledDate:we.R,showToday:!1,useSelectedTimeZone:s})))};var Ve=a(14041),$e=Object.defineProperty,ze=Object.defineProperties,He=Object.getOwnPropertyDescriptors,Je=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,Qe=(e,t,a)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Ue=(e,t)=>{for(var a in t||(t={}))qe.call(t,a)&&Qe(e,a,t[a]);if(Je)for(var a of Je(t))Me.call(t,a)&&Qe(e,a,t[a]);return e};const Ze=()=>{var e;const[t]=(0,r.useState)(()=>Date.now()),[{apiKeysById:a},g]=(0,ve.Q)(),y=(0,n.d4)(oe.T.getIsApiKeyFormSubmitting),f=(0,n.wA)(),{id:E}=(0,s.g)(),b=E?a[E]:void 0,[v,h]=(0,r.useState)(!1),w=he(),O=(0,_.V)();return g?E&&!b?Ve.createElement(s.C5,{to:"/admin/integrations/keys"}):Ve.createElement(p.YW,null,Ve.createElement(p.zY,null,Ve.createElement(p.sT,{title:E?Ve.createElement(l.s,{id:"integrations-page-title-edit"}):Ve.createElement(l.s,{id:"integrations-page-title-create"}),overrideCase:!0})),Ve.createElement(d.lV,{onFinish:e=>{if((0,i.I)(e.productPermissions))return void h(!0);const t={apiKeyId:E,keyData:e,version:O};f(u.o.submitApiKeyForm(t))},layout:"vertical",initialValues:(x=Ue({},b),P={status:(null==b?void 0:b.status)||"ACTIVE",expiresAt:null!=(e=null==b?void 0:b.expiresAt)?e:(0,o.e)(t,1).toISOString(),productPermissions:(null==b?void 0:b.productPermissions)||[]},ze(x,He(P)))},Ve.createElement(m.y,{className:w.formRow,gutter:16},Ve.createElement(m.f,{xs:24,md:12},Ve.createElement(Ye,{initialValues:b}))),Ve.createElement(m.y,{className:w.formRow,gutter:16},Ve.createElement(m.f,{span:24},Ve.createElement(d.eI,{name:"productPermissions"}
1,Ve.createElement(Ee,{noProductsError:v,setNoProductsError:h})))),Ve.createElement("div",{className:w.buttonBox},Ve.createElement(c.$,{"data-testid":"api-key-form-submit",htmlType:"submit",loading:y,type:"primary"},Ve.createElement(l.s,{id:b?"integrations-api-key-form-save":"integrations-api-key-form-create"})),Ve.createElement(s.N_,{className:"ant-btn ant-btn-secondary",to:"/admin/integrations/keys"},Ve.createElement(l.s,{id:"integrations-api-key-form-cancel"}))))):Ve.createElement(p.LK,null);var x,P},Ge=(0,be.A)(Ze)}}]); 2//# sourceMappingURL=adminIntegrationsCreateEditKeys.myeroad.be2750b4713d18051e60.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.