PageSourceSearch

https://app.labra.io/assets/MicrosoftCloudSettings-DmO-4ByW.js

js labra.io collected 2026-09-25 18:22:41 UTC 48,438 bytes, 2 lines download raw bytes

1import{b1 as ue,aW as Re,as as fe,bh as Ae,r,bj as x,eS as t,f1 as G,eV as f,aJ as de,bi as te,T as H,b3 as pe,bm as X,bB as ge,bo as qe,bn as j,bs as gt,aI as Ct,bW as Y,bS as yt,bO as St,bN as At}from"./vendor-N5Qncfdp.js";import{aC as ee,k as xe,L as Ee,bB as It,b0 as je,a$ as ye,cT as ke,aF as ve,aH as Me,bz as ie,cI as Tt,dB as bt,aD as _e,dC as Dt,bA as Pt,a7 as Ke,bD as xt,cX as Ie}from"./vendor-labrav-BMMHJdGM.js";import{f as Ge,g as me,p as Qe,r as Ye,h as K,i as Je,j as Xe,A as et,k as tt,l as nt,m as Pe,n as ot,o as st,q as at,u as rt,v as it,w as ct,x as Te,y as lt,M as g,z as Et,B as Ve,C as Be,D as vt,E as Mt,F as Nt,G as wt,H as kt,I as Ft}from"./action-3SREEa_E.js";import{N as Oe,a as Rt,g as _t}from"./StepStatusIcon-DcgOS77Z.js";import{u as he,ae as Ne,p as W,k2 as ut,aY as De,k3 as ae,V as le,k4 as Se,P as Ot,J as Ce,k5 as Lt,S as Ut,k6 as Fe,k7 as zt,H as dt,jL as qt,k8 as $e}from"./index-DQMOrwB1.js";import{p as Vt,F as ce,U as Bt,cZ as $t,J as He,P as Ht,o as Wt}from"./vendor-fontawesome-Dc2H7Qhh.js";import{C as Zt}from"./CloudSettingsHelpSections-D6c8AYD4.js";import{H as jt,o as Kt,J as Gt}from"./SidePanelWrapperV3-DNYX1-aG.js";import{F as We}from"./FooterV2-kr61WOkX.js";import{u as Qt,a as Yt}from"./useAccountId-DY_Z8d8u.js";import{D as Jt}from"./Dialog-B9nZ7hmg.js";const Xt=ue()(e=>({formControl:{minWidth:"12em",width:"100%",fontSize:"12px"},chips:{display:"flex",flexWrap:"wrap"},chip:{margin:2},inputField:{minHeight:"2.7em",height:"fit-content",width:"100%",color:e.palette.text.primary,"& .MuiInputBase-input":{paddingTop:e.spacing(2)}},errorText:{minHeight:"2em"},disabled:{opacity:"0.4"},fieldAndInfoWrapper:{display:"flex",flexDirection:"row",gap:e.spacing(.5),alignItems:"end",color:e.palette.text.primary},fieldTextSize:{fontSize:"12px"},infoIcon:{width:"16px !important",color:e.palette.text.secondary},calendarIcon:{"&.MuiSvgIcon-root":{height:"17px",width:"16px"}},inputTextField:{width:"50%","@media (max-width:960px)":{width:"90%"}},content:{padding:e.spacing(2,0,0,1.6)},linkText:{color:e.palette.opaque.dark,textTransform:"none",marginLeft:e.spacing(.4),"&:hover":{backgroundColor:"inherit",textDecoration:"none"}},azureButton:{paddingTop:e.spacing(2)},grid:{marginBottom:e.spacing(0)}})),Ze={multiselect:{title:"Microsoft partner type",placeHolder:"Enter one or more Partner Type",humanReadableKey:"microsoftPartnerType",id:"microsoftPartnerType",isReadOnly:!1,isRequired:!0,defaultValue:void 0,dataType:"multi_enum",validationType:void 0,isCustom:!1,options:["Managed Service Provider","Cloud Solution Provider","Reseller or Distributor","Systems Integrator, Sl or Consultant","Original Equipment","Manufacturer, OEM","Consumer Developer"]},select:{title:"Industries",placeHolder:"Enter type of Industry",humanReadableKey:"industries",id:"industries",isReadOnly:!1,isRequired:!0,defaultValue:void 0,dataType:"enum",validationType:void 0,isCustom:!1,options:["Digital Media","Education","Financial Services","Government","Healthcare","Industrial Software","Life Sciences","Nonprofit","Public Safety and Disaster Response","Retail","Travel And Hospitality"],info:"How does the customer sells or have their products handed to their customers."}},en=({productType:e,enabled:o})=>{const n=Re(),a=he(),{pathname:c,search:v}=fe(),{accountId:S}=Ae(),R=Ne(),i=S||R,l=new URLSearchParams(v),p=l.get("code")||"",u=l.get("state")||"",s=l.get("session_state")||"",E=l.get("admin_consent")||"",b=l.get("error")||"",F=l.get("error_description")||"",_=!!S,D=W(h=>{var C,M,d,T;return _?((M=(C=h.accountForm[e].selectedAccountDetails)==null?void 0:C.AZURE)==null?void 0:M.authUri)||"":((T=(d=h.accountForm[e].accountDetails)==null?void 0:d.AZURE)==null?void 0:T.authUri)||""}),P=r.useCallback(async(h,C,M)=>{if(!i)return{error:!0};const d=await a(Ge(e,h,C,M,i));return d!=null&&d.error?{error:!0}:(await a(me(i,e,!!S)),n(window.location.pathname,{replace:!0}),{error:!1})},[a,n,i,e,S]),I=r.useCallback(h=>{if(h.origin!==ut){console.error("Event is coming from unauthorized source."),De({name:"Unauthorized origin",message:"Event is coming from unauthorized source."},{message:"Event is coming from unauthorized source."});return}const{data:C}=h;if(C.source==="callback"&&C.params!==void 0&&!x.isEmpty(C.params)){const M=Qe(C.params),d=Ye(M,D);if(d.status!=="not_admin_consent"){if(d.status==="continue"){ae("AZURE",d.authUri,I);return}K(),a(le({message:d.message,messageType:"ERROR",autoClose:!0})),Se();return}const T=Je()||i||void 0;n(Xe({productType:e,accountId:T,queryString:M.toString()}),{replace:!0})}},[n,e,i,D,a]);return r.useEffect(()=>(window.addEventListener("message",I),()=>{window.removeEventListener("message",I)}),[I]),r.useEffect(()=>{if(!o||!i)return;const h=()=>n(c,{replace:!0});if(!x.isEmpty(b)){K(),a(le({message:F||et,messageType:"ERROR",autoClose:!0})),h();return}if(E.toLowerCase()==="true"){h();const C=tt()||D;x.isEmpty(C)?K():ae("AZURE",C,I);return}if(!x.isEmpty(p)&&!x.isEmpty(u)&&!x.isEmpty(s)){const C=`${p}:${u}`;if(!nt(C))return;(async()=>
1{try{if((await P(p,u,s)).error){Pe(C);return}ot(C),K()}catch{Pe(C)}})()}},[p,u,s,E,b,F,o,i,P,n,c,D,I,a]),t(ee,{onClick:async()=>{if(!i)return;st(i),at();const h=ae("AZURE","about:blank",I),C=await a(rt(e,i,!!S)),M=it(C);if(C!=null&&C.authUri&&ct(C.authUri),!M||x.isEmpty(M)||!h||h.closed){K(),Se();return}ae("AZURE",M,I)},disabled:!o,children:"Connect Microsoft Partner Center"})},tn=({productType:e,partnerType:o=Ot.User,isAzureFlagEnabled:n=!1})=>{const{classes:a}=Xt(),c=he(),[v,S]=r.useState(!1),[R,i]=r.useState(!1),l=()=>{i(!0)},p=()=>{i(!1)},{id:u,status:s,ISV:E,grantConsent:b,terms:F,MPNID:_,name:D,industries:P,microsoftPartnerType:I,fetchedForPartner:N}=W(y=>y.accountForm[e].accountDetails.AZURE),[h,C]=r.useState(""),[M,d]=r.useState(!1),T=W(y=>{var w;return(w=y.AccountData[o].partnerData)==null?void 0:w.partnerId}),O=W(y=>xe(y.loading)(Ee.AZURE_FETCHING_ACCOUNT_DETAILS)),A=![_,D,P,I,N,u].some(x.isEmpty)&&T===N&&s==="active";r.useEffect(()=>{!A&&!O&&T&&T!==N&&n&&c(me(T,e))},[T,e]);const L=r.useCallback(y=>{const{name:w,checked:q}=y.target;c(Ce(e,Te(w,q)))},[]),m=r.useCallback(y=>{const{name:w,value:q}=y.target;U(w,q),c(Ce(e,Te(w,q)))},[]),U=(y,w)=>{if(y==="MPNID"&&(x.isEmpty(w)?d(!0):d(!1)),y==="name"){const q=Lt(w,"Microsoft Partner Name");C(q)}},V=r.useCallback(y=>{const{name:w,value:q}=y.target;c(Ce(e,Te(w,q)))},[]),$=r.useCallback((y,w)=>{c(Ce(e,Te("microsoftPartnerType",w)))},[]),B=()=>{c(lt(T||"",e,u||"")),S(!1)},ne=b&&F&&!x.isEmpty(_)&&!x.isEmpty(D)&&!x.isEmpty(P)&&!x.isEmpty(I)&&x.isEmpty(h)&&!M;if(!T||O)return t(G,{});const oe={...Ze.select,defaultValue:P,isReadOnly:A,isRequired:!1},z={...Ze.multiselect};return f("div",{className:a.content,"data-testid":"azure-cloud-registration",children:[f(de,{container:!0,spacing:4,children:[" ",t(de,{size:{xs:12,sm:12,md:9,lg:9,xl:9},children:t(It,{id:z.id,label:z.title,options:z.options,onChange:$,value:I||[]})})]}),f(de,{container:!0,spacing:4,className:a.grid,children:[t(de,{size:{xs:12,sm:6,md:4,lg:3,xl:3},children:t(je,{field:oe,onChange:V})}),t(de,{size:{xs:12,sm:6,md:4,lg:3,xl:3},children:t(ye,{type:"number",keyName:"MPNID",isReadOnly:A,title:"MPN ID",isRequired:!1,value:_||"",placeHolder:"Enter MPN ID",onChange:m,isError:M,errorText:M?"MPN ID is required":""})}),t(de,{size:{xs:12,sm:6,md:4,lg:3,xl:3},children:t(ye,{keyName:"name",isReadOnly:A,title:"Microsoft partner name",isRequired:!1,value:D||"",placeHolder:"Enter Microsoft Partner Name",onChange:m,isError:!x.isEmpty(h),errorText:x.isEmpty(h)?"":h})})]}),t("div",{children:t(ke,{keyName:"ISV",title:"I am an Independent Software Vendor",value:E,onChangeBox:L,disabled:A})}),f("div",{children:[" ",t(ke,{keyName:"grantConsent",title:"Grant consent to Labra to access Microsoft Partner Center",value:b,isRequired:!0,onChangeBox:L,disabled:A})]}),f("div",{children:[t(Jt,{open:R,handleClose:p})," ",t(ke,{keyName:"terms",title:f(G,{children:["I accept",t("a",{onClick:l,className:a.linkText,children:"terms & conditions"})]}),value:F,isRequired:!0,onChangeBox:L,disabled:A})]}),t("div",{className:a.azureButton,children:A?t(ee,{onClick:()=>S(!0),children:"Disconnect Microsoft Partner Center"}):t(en,{productType:e,enabled:ne,partnerType:o})}),t(Me,{title:"Disconnect Microsoft Partner Center",description:"Please confirm to disconnect your Microsoft Partner Center account",open:v,titleAcceptButton:"Disconnect",titleCancelButton:"Cancel",onAccept:B,onDecline:()=>S(!1),variant:ve.large})]})},nn=()=>{const e=Ut(),o="oppsync",n=Qt({product:"oppsync"}),a=W(c=>xe(c.loading)(Ee.CMCM_FETCHING_ACCOUNTS));return n?a?t(G,{}):t(tn,{productType:o,partnerType:e}):t(G,{})},Le=ue()(e=>({mainContainer:{display:"flex",flexDirection:"column",gap:e.spacing(3),margin:e.spacing(4,5,16,5)},loadingText:{fontSize:"14px",fontStyle:"normal",fontWeight:500,lineHeight:"20px",letterSpacing:"0.1px",marginLeft:e.spacing(1)},headingIcon:{width:e.spacing(1.75),height:e.spacing(2)},loadingContainer:{height:"100vh"}})),on=ue()(e=>({checkBoxText:{fontStyle:e.typography.fontFamily,fontSize:"14px",color:e.palette.labraText.tertiary,fontWeight:400,lineHeight:"20px",letterSpacing:"0.25px"},prerequisitesContainer:{display:"flex",flexDirection:"column",width:"fit-content",gap:e.spacing(3)},choiceContainer:{display:"flex",flexDirection:"column",gap:e.spacing(1)},inLineInfo:{display:"flex",marginTop:e.spacing(.25),flexDirection:"row",alignItems:"center"},readOnly:{opacity:.5},primaryContainer:{display:"flex",flexDirection:"column",gap:e.spacing(2.625)}})),sn=({expandFunction:e,isReadOnly:o=!1})=>{const{classes:n}=on(),a=te();return f("div",{className:n.primaryContainer,children:[t("div",{className:pe(n.prerequisitesContainer,{[n.readOnly]:o}),children:f("div",{className:n.choiceContainer,"data-testid":"microsoft-prerequisites",children:[t(ie,{field:{title:t("div",{className:n.inLineInfo,children:t(H,{className:n.checkBoxText,children:"I have access to Microsoft Partner Center account as Admin user."})}),placeHolder:"",id:"hasMPCAccessAsAdmin",isRequired:!1,humanReadableKey:"hasMPCAccessAsAdmin",isReadOnly:o,isCustom:!1,defaultValue:void 0,dataType:"bool"},formik:a,prefix:g.PREREQUISITES}),t(ie,{field:{title:t("div",{className:n.inLineInfo,children:f(H,{className:n.checkBoxText,children:["Create a separate user for Labra integration in Microsoft Partner Center. This user must be assigned the Referral Admin role. See how to create a user with Referral admin access"," ",f(Tt,{href:"https://docs.google.com/document/d/1R7Q-HdpvU17H574ZN_ro3SkvBOvZgYSuk8I5sYdQmQE/edit?tab=t.0#heading=h.yesqpls5da08",children:[" ","here"," "]})," "]})}),placeHolder:"",id:"hasSeparateUserForLabraIntegration",isRequired:!1,humanReadableKey:"hasSeparateUserForLabraIntegration",isReadOnly:o,isCustom:!1,defaultValue:void 0,dataType:"bool"},formik:a,prefix:g.PREREQUISITES}),t(ie,{field:{title:t("div",{className:n.inLineInfo,children:t(H,{className:n.checkBoxText,children:"Solution must be configured with the Microsoft Partner Center."})}),placeHolder:"",id:"hasConfiguredSolutionWithMPC",isRequired:!1,humanReadableKey:"hasConfiguredSolutionWithMPC",isReadOnly:o,isCustom:!1,defaultValue:void 0,dataType:"bool"},formik:a,prefix:g.PREREQUISITES})]})}),t(Oe,{sectionName:g.PREREQUISITES,expandNext:e,disabled:o})]})},an=X().shape({[g.PREREQUISITES]:X().shape({hasMPCAccessAsAdmin:ge().oneOf([!0],"Please confirm the above checkbox").required("This field is required."),hasSeparateUserForLabraIntegration:ge().oneOf([!0],"Please confirm the above checkbox").required("This field is required.")}
1),[g.MPC_ACCOUNT_DETAILS]:X().shape({mpnID:j().matches(/^\d{7}$/,"Enter 7 digit MPN ID number").required("E.g. 8792301"),accountName:j().required("E.g. co-sell_account or seller_environment"),isISV:ge(),isConsultingPartner:ge(),_partnerTypeValidation:j().nullable().test("at-least-one-path","At least one partnership type must be selected",(e,o)=>{const{parent:n}=o;return!!(n!=null&&n.isISV||n!=null&&n.isConsultingPartner)})}),[g.MICROSOFT_PRODUCT_DETAILS]:X().when(`${g.MPC_ACCOUNT_DETAILS}.isISV`,{is:!1,then:X().shape({productDetails:qe().of(X().shape({solutionName:j().test("conditional-required","E.g. Test solution name",function(e){const{solutionId:o,publisherName:n,solutionType:a}=this.parent;return!!!(o||n||a)||!!e}),solutionId:j().test("conditional-required","E.g. 45abgu-iu34j-4312jklnn-7667803yuyi",function(e){const{solutionName:o,publisherName:n,solutionType:a}=this.parent;return!!!(o||n||a)||!!e}),publisherName:j().test("conditional-required","Enter publisher name.",function(e){const{solutionName:o,solutionId:n,solutionType:a}=this.parent;return!!!(o||n||a)||!!e}),solutionType:j().test("conditional-required","Select solution type.",function(e){const{solutionName:o,solutionId:n,publisherName:a}=this.parent;return!!!(o||n||a)||!!e})}))}),otherwise:X().shape({productDetails:qe().of(X().shape({solutionName:j().required("E.g. Test solution name"),solutionId:j().required("E.g. 45abgu-iu34j-4312jklnn-7667803yuyi"),publisherName:j().required("Enter publisher name."),solutionType:j().required("Select solution type.")})).min(1,"At least one product must be provided")})}),[g.LINK_MPC_ACCOUNT]:X().shape({isMPCConnected:ge().required("This field is required.")})}),rn=ue()(e=>({checkBoxText:{fontStyle:e.typography.fontFamily,fontSize:"14px",color:e.palette.labraText.tertiary,fontWeight:400,lineHeight:"20px",letterSpacing:"0.25px"},accountDetailsContainer:{display:"flex",flexDirection:"column",width:"fit-content",gap:e.spacing(1.5),marginTop:e.spacing(1)},readOnly:{opacity:.5},choiceContainer:{display:"flex",flexDirection:"column"},inLineInfo:{display:"flex",marginTop:e.spacing(.25),flexDirection:"row",alignItems:"center"},exampleText:{marginLeft:e.spacing(2),color:e.palette.labraText.description,fontStyle:e.typography.fontFamily,fontSize:"12px",fontWeight:400,lineHeight:"16px",letterSpacing:"0%"},errorText:{color:e.palette.error.dark},nameAndIdFieldsContainer:{display:"flex",flexDirection:"row",gap:e.spacing(3)},nameAndIdFields:{display:"flex",flexDirection:"column",width:e.spacing(44.375)},partnerTypeSelector:{width:e.spacing(91.75),marginBottom:e.spacing(3)},partnerTypeContainer:{display:"flex",flexDirection:"column"},partnerTypeHeading:{fontStyle:e.typography.fontFamily,fontSize:"16px",fontWeight:500,lineHeight:"24px",letterSpacing:"0.15px",marginBottom:e.spacing(2)},partnerTypeError:{fontStyle:e.typography.fontFamily,color:e.palette.error.dark,fontSize:"14px",fontWeight:400,lineHeight:"20px",letterSpacing:"0.25px"},checkboxInput:{width:"fit-content"},primaryContainer:{display:"flex",flexDirection:"column",gap:e.spacing(2.625)}})),cn=({expandFunction:e,isReadOnly:o=!1})=>{var E;const{classes:n}=rn(),a=te(),c={title:"Microsoft partner type (Optional)",placeHolder:"Enter one or more Partner Type",humanReadableKey:"partnerType",id:"partnerType",isReadOnly:o,isRequired:!0,defaultValue:void 0,dataType:"multi_enum",validationType:void 0,isCustom:!1,options:["Managed Service Provider","Cloud Solution Provider","Reseller or Distributor","Systems Integrator, Sl or Consultant","Original Equipment","Manufacturer, OEM","Consumer Developer"]},v=a.values[g.MPC_ACCOUNT_DETAILS].partnerType||[],S=b=>{const F=b.target.value;a.setFieldValue(`${g.MPC_ACCOUNT_DETAILS}.partnerType`,[...F])},R=b=>{const F=v.filter(_=>_!==b);a.setFieldValue(`${g.MPC_ACCOUNT_DETAILS}.partnerType`,F)},i=(E=a.errors[g.MPC_ACCOUNT_DETAILS])==null?void 0:E._partnerTypeValidation,{isISV:l,isConsultingPartner:p}=a.touched[g.MPC_ACCOUNT_DETAILS]||{},u=i&&l&&p,s=b=>{const F=x.get(a.touched,`${g.MPC_ACCOUNT_DETAILS}.${b}`),_=x.get(a.errors,`${g.MPC_ACCOUNT_DETAILS}.${b}`);return!!F&&!!_};return f("div",{className:n.primaryContainer,children:[t(_e,{tooltipPlacement:"top",description:o?"Complete all required fields above to enable this section.":"",disableHoverListener:!o,followCursor:!0,children:f("div",{className:pe(n.accountDetailsContainer,{[n.readOnly]:o}),children:[f("div",{className:n.choiceContainer,"data-testId":"microsoft-partner-center-account-details",children:[t("div",{className:n.partnerTypeSelector,children:t(bt,{field:c,onChangeSelect:S,selectedValues:v,handleDelete:R,chipDisplayLimit:2})}),f("div",{className:n.nameAndIdFieldsContainer,children:[f("div",{className:n.nameAndIdFields,children:[t(ie,{field:{title:"MPN ID",placeHolder:"MPN ID",id:"mpnID",isRequired:!0,humanReadableKey:"mpnID",isReadOnly:o,isCustom:!1,defaultValue:void 0,dataType:"string"},formik:a,prefix:g.MPC_ACCOUNT_DETAILS}),s("mpnID")===!1&&t(H,{className:n.exampleText,children:"E.g. 8792301"})]}),f("div",{className:n.nameAndIdFields,children:[t(ie,{field:{title:"Microsoft account name",placeHolder:"Microsoft account name",id:"accountName",isRequired:!0,humanReadableKey:"accountName",isReadOnly:o,isCustom:!1,defaultValue:void 0,dataType:"string"},formik:a,prefix:g.MPC_ACCOUNT_DETAILS}),s("accountName")===!1&&t(H,{className:n.exampleText,children:"E.g. co-sell_account or seller_environment"})]})]})]}),f("div",{className:n.partnerTypeContainer,children:[t(H,{className:n.partnerTypeHeading,children:"Select partnership type"}),t("div",{className:n.checkboxInput,children:t(ie,{field:{title:t("div",{className:n.inLineInfo,children:t(H,{className:n.checkBoxText,children:"I am an Independent Software Vendor"})}),placeHolder:"isISV",id:"isISV",isRequired:!1,humanReadableKey:"isISV",isReadOnly:o,isCustom:!1,defaultValue:void 0,dataType:"bool"},formik:a,prefix:g.MPC_ACCOUNT_DETAILS})}),t("div",{className:n.checkboxInput,children:t(ie,{field:{title:t("div",{className:n.inLineInfo,children:t(H,{className:n.checkBoxText,children:"I am consulting partner / Reseller /Channel partner"})}),placeHolder:"isConsultingPartner",id:"isConsultingPartner",isRequired:!1,humanReadableKey:"isConsultingPartner",isReadOnly:o,isCustom:!1,defaultValue:void 0,dataType:"bool"},formik:a,prefix:g.MPC_ACCOUNT_DETAILS})}),u&&t(H,{className:n.partnerTypeError,children:i})]})]})}),t(Oe,{sectionName:g.MPC_ACCOUNT_DETAILS,expandNext:e,disabled:o})]})},pt=ue()(e=>({linkMPCAccountContainer:{marginTop:e.spacing(1)},statusText:{fontStyle:e.typography.fontFamily,fontSize:"12px",color:e.palette.labraText.description,fontWeight:400,lineHeight:"16px"},statusContainer:{display:"flex",flexDirection:"row",gap:e.spacing(1),marginTop:e.spacing(1)}
1,check:{color:e.palette.textBackground.dark},modalIcon:{height:e.spacing(2),width:e.spacing(2.5)},loader:{width:e.spacing(2),height:e.spacing(2),flexShrink:0,color:e.palette.labraText.tertiary},readOnly:{opacity:.5},subheading:{fontStyle:e.typography.fontFamily,fontSize:"14px",color:e.palette.labraText.description,fontWeight:400,lineHeight:"20px",letterSpacing:"0.25px",marginBottom:e.spacing(4)}})),ln=({disabled:e=!1})=>{const o=Re(),{classes:n}=pt(),a=he(),c="oppsync",v=fe().search,{accountId:S}=Ae(),R=Ne(),i=S||R,{pathname:l}=fe(),p=new URLSearchParams(v),u=p.get("code")||"",s=p.get("state")||"",E=p.get("session_state")||"",b=p.get("admin_consent")||"",F=p.get("error")||"",_=p.get("error_description")||"",{setFieldValue:D}=te(),[P,I]=r.useState(!1),[N,h]=r.useState(!1),C=l.split("/").includes("onboarding"),M=!!S,d=W(z=>M?z.accountForm[c].selectedAccountDetails.AZURE:z.accountForm[c].accountDetails.AZURE),T=d.id,O=d.status,A=d.MPNID,L=d.microsoftPartnerType,m=d.fetchedForPartner,U=d.authUri||"",V=r.useMemo(()=>![A,L,m,T].some(x.isEmpty)&&i===m&&O==="active",[A,L,m,T,i,O]),$=r.useCallback(async(z,y,w)=>{if(!i)return{error:!0};const q=await a(Ge(c,z,y,w,i));return q!=null&&q.error?{error:!0}:(await a(me(i,c,!!S)),{error:!1})},[a,i,c,S]),B=r.useCallback(z=>{if(z.origin!==ut){console.error("Event is coming from unauthorized source."),De({name:"Unauthorized origin",message:"Event is coming from unauthorized source."},{message:"Event is coming from unauthorized source."});return}const{data:y}=z;if(y.source==="callback"&&y.params!==void 0&&!x.isEmpty(y.params)){const w=Qe(y.params),q=Ye(w,U);if(q.status!=="not_admin_consent"){if(q.status==="continue"){h(!0),ae("AZURE",q.authUri,B);return}h(!1),K(),a(le({message:q.message,messageType:"ERROR",autoClose:!0})),Se();return}h(!1);const J=Je()||i||void 0;o(Xe({productType:c,accountId:J,queryString:w.toString(),isOnboardingRoute:C}),{replace:!0})}},[o,c,C,i,U,a]);r.useEffect(()=>(window.addEventListener("message",B),()=>{window.removeEventListener("message",B)}),[B]),r.useEffect(()=>{if(e||!i)return;const z=()=>o(l,{replace:!0});if(!x.isEmpty(F)){h(!1),K(),a(le({message:_||et,messageType:"ERROR",autoClose:!0})),z();return}if(b.toLowerCase()==="true"){z();const y=tt()||U;x.isEmpty(y)?(h(!1),K()):(h(!0),ae("AZURE",y,B));return}if(!x.isEmpty(u)&&!x.isEmpty(s)&&!x.isEmpty(E)){const y=`${u}:${s}`;if(!nt(y))return;(async()=>{try{if((await $(u,s,E)).error){Pe(y),h(!1);return}ot(y),K(),o(l,{replace:!0}),h(!1),setTimeout(()=>{window.location.reload()},500)}catch{Pe(y),h(!1)}})()}},[u,s,E,b,F,_,e,i,$,o,l,U,B,a]);const ne=r.useCallback(async()=>{if(!(!T||!i))try{await a(lt(i,c,T,M)),D(`${g.STEPS}.linkMpcAccount`,!1),D(`${g.LINK_MPC_ACCOUNT}.isMPCConnected`,!1),I(!1)}catch(z){De(z,{message:"Failed to disconnect Azure account"})}},[a,i,c,T,D,M]),oe=r.useCallback(async()=>{if(!i)return;h(!0),st(i),at();const z=ae("AZURE","about:blank",B);try{const y=await a(rt(c,i,M)),w=it(y);if(y!=null&&y.authUri&&ct(y.authUri),!w||x.isEmpty(w)||!z||z.closed){K(),Se(),h(!1);return}ae("AZURE",w,B)}catch(y){K(),Se(),h(!1),De(y,{message:"Failed to initiate Azure OAuth flow"})}},[a,c,i,M,B]);return r.useEffect(()=>{D(`${g.LINK_MPC_ACCOUNT}.isMPCConnected`,V),D(`${g.STEPS}.linkMpcAccount`,V)},[V,D,T,O,A,L,m,i]),f(G,{children:[V?f(G,{children:[t(ee,{onClick:()=>I(!0),styleType:"outlined",disabled:e,children:"Disconnect Microsoft Partner Center"}),f("div",{className:n.statusContainer,children:[t(ce,{"data-testid":"step-icon",icon:Vt,className:n.check}),f(H,{className:n.statusText,children:["Connected to Microsoft Partner Center with MPN ID: ",A]})]})]}):f(G,{children:[t("div",{className:n.subheading,children:"Connect with a Microsoft admin account to approve Labra for your organization, then sign in with the Labra integration user."}),t(ee,{onClick:oe,disabled:e||N,children:"Connect Microsoft Partner Center"}),N&&f("div",{className:n.statusContainer,"data-testid":"loading-test-connection",children:[t(ce,{icon:Bt,spin:!0,className:n.loader}),t(H,{className:n.statusText,children:"Testing connection, please wait..."})]})]}),t(Me,{title:"Disconnect from Microsoft Partner Center?",description:"Are you sure you want to disconnect Labra integration from your Microsoft Partner Center account?",icon:t(ce,{icon:$t,className:n.modalIcon}),open:P,titleAcceptButton:"Disconnect",titleCancelButton:"Cancel",onAccept:ne,onDecline:()=>I(!1),variant:ve.small})]})},un=({isReadOnly:e=!1})=>{const{classes:o}=pt();return t(_e,{tooltipPlacement:"top",description:e?"Complete all required fields above to enable this section.":"",disableHoverListener:!e,followCursor:!0,children:t("div",{className:pe(o.linkMPCAccountContainer,{[o.readOnly]:e}
1),"data-testid":"link-microsoft-partner-center-to-labra",children:t(ln,{disabled:e})})})},dn=ue()(e=>({productDetailsContainer:{display:"flex",flexDirection:"column",gap:e.spacing(3)},productRow:{display:"flex",justifyContent:"flex-start",gap:e.spacing(2),width:"100%"},productField:{width:e.spacing(52.5)},detailsContainer:{display:"flex",flexDirection:"column",justifyContent:"flex-start",alignItems:"flex-start",gap:e.spacing(2),width:"100%",marginTop:e.spacing(1)},nameAndIdFieldsContainer:{display:"flex",flexDirection:"row",gap:e.spacing(3)},nameAndIdFields:{display:"flex",flexDirection:"column"},typeAndPublisherField:{display:"flex",flexDirection:"row",gap:e.spacing(3)},trashIcon:{height:e.spacing(2),width:e.spacing(1.75),color:e.palette.labraIcon.main,cursor:"pointer",paddingTop:e.spacing(2)},modalTrashIcon:{height:e.spacing(2),width:e.spacing(1.75),color:e.palette.button.primary,cursor:"pointer"},addButton:{display:"flex",justifyContent:"flex-start",width:"max-content"},exampleText:{marginLeft:e.spacing(2),color:e.palette.labraText.description,fontStyle:e.typography.fontFamily,fontSize:"12px",fontWeight:400,lineHeight:"16px",letterSpacing:"0%"},errorText:{color:e.palette.error.dark},horizontalDevider:{backgroundColor:e.palette.dividerV2.main,width:"100%",height:e.spacing(.125),borderRadius:e.spacing(.5)},nextButton:{width:"fit-content"},readOnly:{opacity:.5},primaryContainer:{display:"flex",flexDirection:"column",gap:e.spacing(4)}})),ft=()=>({id:`${Math.floor(Math.random()*1e4)}`,solutionName:"",solutionId:"",publisherName:"",solutionType:""}),pn=({expandFunction:e,isReadOnly:o=!1})=>{const{classes:n}=dn(),a=he(),[c,v]=r.useState({open:!1,index:null}),S=d=>{v({open:!0,index:d})},R=()=>{v({open:!1,index:null})},i=te(),{values:l,errors:p,touched:u,setFieldValue:s,handleBlur:E}=te(),F=(l.microsoftProductDetails||{}).productDetails||[],_=p.microsoftProductDetails,D=u.microsoftProductDetails,P=d=>!!x.get(D,d)&&!!x.get(_,d),I=d=>P(d)?x.get(_,d,""):"",N=d=>async(T,O)=>{await s(`microsoftProductDetails.productDetails.${O}.${d}`,T.target.value)},h=async(d,T)=>{await s(`microsoftProductDetails.productDetails.${T}.solutionType`,d.target.value)},C=["My company’s solution","Microsoft’s solution"],M=async()=>{var T;const d=((T=i.values.microsoftProductDetails)==null?void 0:T.productDetails)||[];d.forEach((O,A)=>{["solutionName","solutionId","publisherName","solutionType"].forEach(L=>{i.setFieldTouched(`microsoftProductDetails.productDetails.${A}.${L}`,!0)})});try{const O=d.flatMap((A,L)=>["solutionName","solutionId","publisherName","solutionType"].map(m=>i.validateField(`microsoftProductDetails.productDetails.${L}.${m}`)));return await Promise.all(O),!0}catch{return!1}};return f("div",{className:n.primaryContainer,children:[t(_e,{tooltipPlacement:"top",description:o?"Complete all required fields above to enable this section.":"",disableHoverListener:!o,followCursor:!0,children:t("div",{className:pe(n.productDetailsContainer,{[n.readOnly]:o}),"data-testId":"microsoft-product-details",children:t(gt,{name:"microsoftProductDetails.productDetails",children:({push:d,remove:T})=>f(G,{children:[F.map((O,A)=>f(G,{children:[F.length>1&&A>0&&t("div",{className:n.horizontalDevider}),f("div",{className:n.productRow,"data-testid":"product-detail-row",children:[f("div",{className:n.detailsContainer,style:F.length<=1?{marginRight:"30px"}:{},children:[f("div",{className:n.nameAndIdFieldsContainer,children:[f("div",{className:n.nameAndIdFields,children:[t("div",{className:n.productField,children:t(ye,{keyName:`microsoftProductDetails.productDetails.${A}.solutionName`,type:"text",title:"Solution Name",placeHolder:"Solution Name",value:O.solutionName,onChange:L=>N("solutionName")(L,A),isReadOnly:o,isRequired:!1,showSpinner:!1,onBlur:E,isError:P(`productDetails.${A}.solutionName`),errorText:"",keyToPrevent:Fe})}),t(H,{className:pe(n.exampleText,{[n.errorText]:P(`productDetails.${A}.solutionName`)})})]}),f("div",{className:n.nameAndIdFields,children:[t("div",{className:n.productField,children:t(ye,{keyName:`microsoftProductDetails.productDetails.${A}.solutionId`,title:"Solution ID",placeHolder:"Solution ID",value:O.solutionId,onChange:L=>N("solutionId")(L,A),isReadOnly:o,isRequired:!1,showSpinner:!1,onBlur:E,isError:P(`productDetails.${A}.solutionId`),errorText:"",keyToPrevent:Fe})}),t(H,{className:pe(n.exampleText,{[n.errorText]:I(`productDetails.${A}.solutionId`)}),children:"E.g. 45abgu-iu34j-4312jklnn-7667803yuyi"})]})]}),f("div",{className:n.typeAndPublisherField,children:[t("div",{className:n.productField,children:t(je,{field:{title:"Solution type",placeHolder:"Solution type",id:`microsoftProductDetails.productDetails.${A}.solutionType`,isRequired:!1,humanReadableKey:"solutionType",isReadOnly:o,isCustom:!1,defaultValue:!1,dataType:"enum",options:C},value:O.solutionType||"",onChange:L=>h(L,A),onBlur:E,isError:P(`productDetails.${A}.solutionType`),errorText:I(`productDetails.${A}.solutionType`)})}),t("div",{className:n.productField,children:t(ye,{keyName:`microsoftProductDetails.productDetails.${A}.publisherName`,title:"Publisher name",placeHolder:"Publisher name",value:O.publisherName,onChange:L=>N("publisherName")(L,A),isReadOnly:o,isRequired:!1,showSpinner:!1,onBlur:E,isError:P(`productDetails.${A}.publisherName`),errorText:I(`productDetails.${A}.publisherName`),keyToPrevent:Fe})})]})]}),F.length>1&&t("div",{className:n.trashIcon,children:t(ce,{icon:He,onClick:()=>S(A)})})]},O.id||A)]})),t(Me,{"data-testid":"delete-solution-modal",titleAcceptButton:"Delete",title:"Delete this solution?",icon:t(ce,{icon:He,className:n.modalTrashIcon}),onCloseModal:R,onAccept:async()=>{c.index!==null&&(await T(c.index),R(),a(le({message:zt,messageType:"SUCCESS",autoClose:!0})))},scrollContent:!0,description:"Are you sure you want to delete this solution from here?",acceptDisabled:!1,hideAcceptButton:!1,onlyCloseModal:!0,open:c.open,hideCancelButton:!1,variant:ve.small,onDecline:R}),t(ee,{className:n.addButton,styleType:"link",onClick:()=>d(ft()),icon:t(Ct,{}),"data-testid":"add-a-solution-button",disabled:o,children:"Add solution"})]})})})}),t("div",{onClick:async()=>{await M()&&i.setFieldValue(`steps.${g.MICROSOFT_PRODUCT_DETAILS}`,!0)},children:t(Oe,{sectionName:g.MICROSOFT_PRODUCT_DETAILS,expandNext:e,disabled:o})})]})},fn={prerequisites:{content:[{question:"What is Microsoft Partner Center?",answer:"Microsoft Partner Center is the official portal where Microsoft partners manage their solutions, assign roles, manage incentives, and collaborate with Microsoft teams on sales opportunities. It serves as the hub for all partnership-related activities with Microsoft. Having access to Partner Center is essential for participating in co-sell programs and leveraging Microsoft’s partner benefits."},{question:"What is the importance of the second prerequisite?",answer:f("div",{children:["The second prerequisite requires you to create a dedicated user for Labra integration. Check the"," ",f("a",{style:{display:"inline-flex",alignItems:"center",fontSize:"14px",fontStyle:"normal",fontWeight:500,lineHeight:"20px",fontFamily:"Poppins",color:"#1942C5",textDecoration:"none"},href:"https://docs.google.com/document/d/1R7Q-HdpvU17H574ZN_ro3SkvBOvZgYSuk8I5sYdQmQE/edit?tab=t.0#heading=h.yesqpls5da08",target:"_blank",rel:"noopener noreferrer",children:["Link",t("span",{style:{marginLeft:"4px"},children:t(ce,{icon:Ht})})]})," ","of how to assign role to the new user. This ensures that any referral created, updated, or action taken through the Labra integration is recorded under that specific user in Microsoft Partner Center."]})},{question:"What are “Referrals from Microsoft”?",answer:"These are sales opportunities shared directly by Microsoft teams with partners."}]},mpcAccountDetails:{content:[{question:"What does Microsoft partner type mean here?",answer:"The partner type refers to the business classification or role of the organization within the Microsoft partner ecosystem. It helps Microsoft understand how the partner operates and what kinds of services or products they provide."},{question:"What is MPN ID?",answer:"MPN ID(Microsoft Partner Network ID) is a unique identifier assigned to each organization. It is also known as Partner ID. You can find your Partner ID inMicrosoft Partner Center  by going to Settings > Account settings > Identifiers."},{question:"What is Microsoft account name field here?",answer:"Enter a name to assign to this Microsoft Partner Center account. This will help you identify the account within Labra."},{question:"What is Partnership type?",answer:"Partnership type refers to the role your organization plays in the Microsoft ecosystem. You can select one or both of the following based on how you engage with customers."}]},microsoftProductDetails:{content:[{question:"What is a solution?",answer:f("div",{children:["A solution is the name of the product you are offering to sell to solve your buyer's problem. Your solution must already be"," ",t("a",{style:{display:"inline-flex",alignItems:"center",fontSize:"14px",fontStyle:"normal",fontWeight:500,lineHeight:"20px",fontFamily:"Poppins",color:"#1942C5",textDecoration:"none"}
1,href:"https://learn.microsoft.com/en-us/partner-center/referrals/co-sell-configure",target:"_blank",rel:"noopener noreferrer",children:"configured with the Microsoft Partner Center."})," ","Entering solution details is mandatory for ISV."]})},{question:"How can I check if my solution is Co-Sell Ready?",answer:f("div",{children:["To confirm co-sell eligibility, navigate to"," ",f("span",{style:{fontWeight:500},children:["Referrals ",">"," Co-sell ",">"," Solutions"]})," ","and check whether your solution is marked as 'Co-Sell Ready' and/or 'IP Co-Sell Eligible'."]})},{question:"How do I add my Solution details for Microsoft Co-sell in Labra?",answer:f("ul",{style:{marginLeft:"-24px",marginTop:"4px"},children:[t("li",{children:"Go to Partner Center under Referrals."}),t("li",{children:"Click on Opportunities."}),t("li",{children:"Click on a previously submitted co-sell opportunity (if you have created) that includes the Solution you want to use."}),t("li",{children:"Scroll down to Solutions and copy Solution name and Solution id (usually in the format of a long string of numbers and letters.)"}),t("li",{children:"Paste these details here under Solution Details."}),t("li",{children:"Select the solution type and enter the publisher name based on the selected solution type. You can also copy and paste the publisher name from Partner Center."})]})}]},linkMpcAccount:{content:[{question:"Link your Microsoft Partner Center account to Labra",answer:f("ol",{style:{marginLeft:"-24px",marginTop:"4px"},children:[t("li",{children:"Ensure prerequisites are met."}),f("li",{children:["Initiate the connection from Labra:",f("ul",{style:{listStyleType:"disc",marginLeft:"-24px"},children:[t("li",{children:"Log in with the created Labra integration user in Microsoft Partner Center."}),t("li",{children:'Click on the "Connect to Microsoft Partner Center" button within the Labra UI.'}),t("li",{children:"A Microsoft login window will appear. Sign in using the user credentials."}),t("li",{children:"Grant necessary permissions."})]})]}),t("li",{children:"Once linked, you'll see your Microsoft Partner Center account is connected with Labra integration user."})]})}]}},mn=({sectionName:e})=>{const o=te(),n=o?Y(o.errors,e):{},a=o?Y(o.touched,e):{},c=Y(o.values.steps,`${e}`),v=Y(o.values.mpcAccountDetails,"isISV")||Y(o.values.mpcAccountDetails,"isConsultingPartner");r.useEffect(()=>{if(e==="microsoftProductDetails"){const u=!!v&&!n;Y(o.values.steps,"microsoftProductDetails")!==u&&o.setFieldValue("steps.microsoftProductDetails",u);return}const p=!!Y(o.values.steps,`${e}`);!n&&!p&&e!=="linkMpcAccount"?o.setFieldValue(`steps.${e}`,!0):n&&p&&o.setFieldValue(`steps.${e}`,!1)},[e,n,v]);const S=(p,u)=>typeof u=="boolean"?u&&typeof p=="string":Array.isArray(u)?u.some((s,E)=>S(p==null?void 0:p[E],u[E])):typeof u=="object"&&u!==null?Object.keys(u).some(s=>S(p==null?void 0:p[s],u[s])):!1,R=S(n,a),i=r.useMemo(()=>{var u;if(e!=="cloudCredentials")return!1;const p=Y(o.values,"cloudCredentials.clientSecretExpirationDate");return((u=Dt(p,!1))==null?void 0:u.type)==="expired"},[o.values,e]),l=_t(c,R||i);return t(Rt,{status:l})},hn=e=>{switch(e){case"prerequisites":return"01";case"mpcAccountDetails":return"02";case"microsoftProductDetails":return"03";case"linkMpcAccount":return"04"}},be=({heading:e,children:o,subheading:n,sectionName:a,expandBox:c,isMicrosoftCosellOnboarded:v,isOptional:S})=>{var p;const{pathname:R}=fe(),i=R.split("/").includes("onboarding"),{classes:l}=Le();return t(Pt,{"data-testid":"microsoft-section-box",isOptional:S,heading:e,subHeading:n||"",headingIcon:f(G,{children:[t(mn,{sectionName:a}),(!v||i)&&f(H,{className:l.loadingText,children:["STEP ",hn(a)]})]}),variant:"small",headingVariant:"small",collapsible:!0,display:{open:!!c},closedSecondaryActions:!0,secondaryActions:t(Zt,{content:(p=fn[a])==null?void 0:p.content}),children:o})},mt=r.createContext({expandFunction:()=>()=>{},isSectionExpanded:()=>!1,getIsReadOnly:()=>!1,completedSections:{prerequisites:!1,mpcAccountDetails:!1,microsoftProductDetails:!1,linkMpcAccount:!1},sectionsWithErrors:[]}),gn=()=>r.useContext(mt),Cn=({isMicrosoftCosellOnboarded:e,children:o})=>{const{values:n,errors:a,touched:c}=te(),[v,S]=r.useState(e?"mpcAccountDetails":"prerequisites"),[R,i]=r.useState(!1),[l,p]=r.useState({prerequisites:!1,mpcAccountDetails:!1,microsoftProductDetails:!1,linkMpcAccount:!1}),[u,s]=r.useState([]);r.useEffect(()=>{R&&setTimeout(()=>i(!1),10)},[R]),r.useEffect(()=>{n.steps&&p({prerequisites:n.steps.prerequisites,mpcAccountDetails:n.steps.mpcAccountDetails,microsoftProductDetails:n.steps.microsoftProductDetails,linkMpcAccount:n.steps.linkMpcAccount})},[n.steps]),r.useEffect(()=>{const P=["prerequisites","mpcAccountDetails","microsoftProductDetails","linkMpcAccount"].filter(I=>{const N=Y(a,I),h=Y(c,I);return jt(N,h)});s(P),P.length>0&&!P.includes(v)&&S(P[0])},[a,c,v]);const _={expandFunction:D=>()=>{S(D),i(!0)},isSectionExpanded:D=>
1{if(!R)return u.includes(D),v===D},getIsReadOnly:D=>{const P=["prerequisites","mpcAccountDetails","microsoftProductDetails","linkMpcAccount"],I=P.indexOf(D);if(!e&&I===0||e&&I===1)return!1;for(let N=0;N<I;N++)if(!l[P[N]])return!0;return!1},completedSections:l,sectionsWithErrors:u};return t(mt.Provider,{value:_,children:o})},yn=ue()(e=>({root:{height:e.spacing(8),marginLeft:e.spacing(-5)},onboardingActions:{display:"flex",width:"100%",justifyContent:"space-between"},onboardingCompletedActions:{display:"flex",width:"100%",justifyContent:"flex-end"},btnWrapper:{display:"flex",gap:e.spacing(3)},autosave:{display:"flex",alignItems:"center"},footerWrapper:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"},bookmarkIcon:{height:e.spacing(2),width:e.spacing(1.75)}})),Sn=()=>{const{classes:e}=yn(),{accountId:o}=Ae(),n=Ne({product:"oppsync",cloud:dt.AZURE}),a=r.useMemo(()=>o||n||"",[o,n]),c=he(),{pathname:v}=fe(),S=Re(),{_isMicrosoftCloudSettingsComplete:R,hasConnectedCrmAtLeastOnce:i,hasCompanyInfo:l}=Kt(),p=Yt("oppsync"),{value:u}=Ke("omniDashboardIntegration"),s=r.useCallback(k=>{const Z=p.find(Q=>Q.provider==="AWS");return Z?`/oppsync/aws/${Z.originalId}/cosell/${k}`:`/oppsync/cosell/${k}`},[p]),{values:E,initialValues:b,isValid:F,dirty:_,resetForm:D}=te(),P=r.useRef(E);P.current=E;const I=r.useRef(b);I.current=b;const N=r.useRef(!1),h=r.useRef(!1),C=W(k=>k.autoSave.microsoftCloudSettings),M=W(k=>xe(k.loading)(Ee.SEND_MICROSOFT_CLOUDSETTINGS_DATA)),d="oppsync",T=r.useRef(!1),O=v.split("/").includes("onboarding"),[A,L]=r.useState(!1),m=()=>{L(!0)},U=()=>{L(!1)},V=r.useCallback(()=>{const k=E[g.STEPS],Z={prerequisites:k.prerequisites,mpcAccountDetails:k.mpcAccountDetails,microsoftProductDetails:k.microsoftProductDetails,linkMpcAccount:k.linkMpcAccount};return Gt(Z)},[E]),$=async()=>{if(L(!1),a)try{const k=P.current;await c(Ve(a,k));const Z=k[g.MICROSOFT_PRODUCT_DETAILS].productDetails.map(Q=>({solution_name:Q.solutionName??"",solution_id:Q.solutionId??"",publisher_name:Q.publisherName??"",solution_type:$e(Q.solutionType)}));await c(Be(a,Z)),await c(le({message:"Successfully submitted.",messageType:"SUCCESS",autoClose:!0}))}catch(k){console.error("Failed to save changes:",k),await c(le({message:"An error occurred while saving. Please try again.",messageType:"ERROR",autoClose:!0}))}},B=O?"ONBOARDING":"COMPLETED",ne=(C==null?void 0:C.status)==="loading",oe=r.useRef(!0),z=!!o,y=()=>{D()},w=async()=>{if(R)try{await $(),S(i&&l?u?"/overview":s("outgoing-referrals"):"/oppsync/onboarding/crm-settings")}catch(k){console.error("Failed to save changes:",k)}else if(V()&&a)try{await $(),c(me(a,"oppsync",z)),i||S("/oppsync/onboarding/crm-settings")}catch(k){console.error("Failed to save changes:",k)}},q=r.useRef(()=>{}),J=r.useCallback(k=>{const Z=k||a||"";if(Z){if(N.current){h.current=!0;return}N.current=!0,h.current=!1,c(qt("microsoftCloudSettings",async()=>{try{const Q=P.current,we=I.current,ht=!x.isEqual(Q.microsoftProductDetails.productDetails,we==null?void 0:we.microsoftProductDetails.productDetails),Ue=[c(Ve(Z,Q))];if(ht){const ze=Q.microsoftProductDetails.productDetails.map(se=>({solution_name:se.solutionName??"",solution_id:se.solutionId??"",publisher_name:se.publisherName??"",solution_type:$e(se.solutionType)})).filter(se=>se.solution_name&&se.publisher_name&&se.solution_type);ze.length>0&&Ue.push(c(Be(Z,ze)))}await Promise.all(Ue)}finally{N.current=!1,h.current&&(h.current=!1,q.current(Z))}}))}},[c,a]);q.current=J;const re=r.useMemo(()=>yt(k=>J(k),5e3),[J]);return r.useEffect(()=>()=>{re.cancel()},[re]),r.useEffect(()=>{if(oe.current||!O||x.isEqual(E,b)){oe.current=!1;return}a&&re(a)},[E,b,a,re,O]),r.useEffect(()=>{const k=V();!T.current&&k&&c(Ce(d,Et(!0))),T.current=k},[V,c,d]),f(G,{children:[B==="ONBOARDING"?t(We,{actions:f("div",{className:e.onboardingActions,"data-testid":"co-sell-cloud-settings-onboarding-footer",children:[t("div",{className:e.autosave,children:(C==null?void 0:C.status)!=="standBy"&&t(xt,{status:(C==null?void 0:C.status)||"standBy"})}),O&&f("div",{className:e.btnWrapper,children:[t(ee,{styleType:"outlined","data-testid":"back-button-microsoft-cloud-settings",onClick:()=>S(-1),children:"Back"}),t(ee,{"data-testid":"continue-button-co-sell-cloud-settings",styleType:"primary",type:"submit",loading:ne,onClick:w,disabled:!1,children:"Continue"})]})]}),customClass:e.root,width:O?"calc(100% - 280px)":"calc(100vw - 74px)"}):t(We,{actions:t("div",{className:e.onboardingCompletedActions,"data-testid":"co-sell-cloud-settings-footer",children:f("div",{className:e.btnWrapper,children:[t(ee,{styleType:"outlined","data-testid":"discard-button-co-sell-cloud-settings",onClick:y,disabled:!_,children:"Discard"}),t(ee,{"data-testid":"save-changes-button-co-sell-cloud-settings",styleType:"primary",onClick:m,loading:M,disabled:!F||!_,children:"Save changes"})]})}),customClass:e.root,width:"calc(100vw - 352px)"}),t(Me,{"data-testid":"save-changes-modal",titleAcceptButton:"Save",titleCancelButton:"Discard",title:"Save changes",icon:t(ce,{icon:Wt,className:e.bookmarkIcon}
1),onCloseModal:U,onAccept:$,scrollContent:!0,description:"Are you sure you want to save these changes?",acceptDisabled:!1,hideAcceptButton:!1,onlyCloseModal:!0,open:A,hideCancelButton:!1,variant:ve.small,onDecline:U})]})},An=()=>{const{classes:e}=Le(),o="oppsync",n=he(),{accountId:a}=Ae(),c=r.useRef(null),v=r.useRef(!1),S=r.useRef(null),R=Ne({product:"oppsync",cloud:dt.AZURE}),i=!!a,l=r.useMemo(()=>a||R||"",[a,R]),p=W(m=>m.accountForm[o].accountDetails.AZURE),u=W(m=>m.accountForm[o].selectedAccountDetails.AZURE),s=i?u:p,E=W(m=>{var U,V;return i?((U=m.accountForm[o].selectedAccountDetails.AZURE.azureConfigMetadata)==null?void 0:U.is_azure_onboarding_completed)??!1:((V=m.accountForm[o].accountDetails.AZURE.azureConfigMetadata)==null?void 0:V.is_azure_onboarding_completed)??!1}),b=W(m=>xe(m.loading)(Ee.AZURE_FETCHING_ACCOUNT_DETAILS));r.useEffect(()=>{v.current=b},[b]);const F=r.useRef(null),_=r.useRef(null),D=r.useRef(0),P=r.useRef(null),I=r.useRef(null),N=r.useRef(null),[h,C]=r.useState(0);r.useEffect(()=>{const m=s==null?void 0:s.status,U=s==null?void 0:s.id,V=I.current!=="active",$=m==="active",B=U!==N.current;V&&$&&U||B&&$&&U?(C(ne=>ne+1),I.current=m||null,N.current=U||null):(I.current=m||null,N.current=U||null)},[s==null?void 0:s.status,s==null?void 0:s.id]);const M=r.useMemo(()=>{const m={...vt};if(!l)return F.current=null,_.current=null,D.current=0,P.current=null,I.current=null,N.current=null,m;const U=F.current!==l,V=D.current!==h,$=!s||!s.fetchedForPartner,B=!!(s!=null&&s.fetchedForPartner)&&s.fetchedForPartner!==l,oe=((s==null?void 0:s.fetchedForPartner)||null)!==null&&_.current===null;if(!U&&!V&&!oe&&P.current&&!$&&!B)return P.current;if(s&&!B){const z=Mt(s),y=Nt(s),w=wt(s),q=s!=null&&s.azureSolutionsData&&(s==null?void 0:s.azureSolutionsData.length)>0?kt(s.azureSolutionsData):{productDetails:[ft()]};let J=m[g.STEPS];if(s!=null&&s.azureConfigMetadata){const k=Ft(s.azureConfigMetadata);J={...J,...k}}const re={...m,[g.PREREQUISITES]:{...m[g.PREREQUISITES],...z},[g.MPC_ACCOUNT_DETAILS]:{...m[g.MPC_ACCOUNT_DETAILS],...y},[g.LINK_MPC_ACCOUNT]:{...m[g.LINK_MPC_ACCOUNT],...w},[g.MICROSOFT_PRODUCT_DETAILS]:{...m[g.MICROSOFT_PRODUCT_DETAILS],...q},[g.STEPS]:J};return F.current=l,_.current=s.fetchedForPartner||null,D.current=h,I.current=s.status||null,N.current=s.id||null,P.current=re,re}return F.current=null,_.current=null,D.current=0,P.current=null,I.current=null,N.current=null,m},[s,l,h]),d=r.useMemo(()=>!l||!s?!1:s.fetchedForPartner===l,[l,s]);r.useEffect(()=>{if(!l||x.isEmpty(l))return;const m=c.current!==l;m&&(S.current=null,F.current=null,_.current=null,D.current=0,P.current=null,I.current=null,N.current=null);const U=i?(u==null?void 0:u.fetchedForPartner)===l:!0,V=i?!0:(p==null?void 0:p.fetchedForPartner)===l,$=i?U:V;if(m){if(b||v.current)return;c.current=l,v.current=!0,n(me(l,o,i));return}if(!$){if((b||v.current)&&c.current===l)return;c.current=l,v.current=!0,n(me(l,o,i));return}S.current!==l&&(S.current=l)},[l,o,b,i,u==null?void 0:u.fetchedForPartner,p==null?void 0:p.fetchedForPartner]),s&&(s.id||s.MPNID||s.fetchedForPartner||s.azureConfigMetadata||s.azureSolutionsData&&s.azureSolutionsData.length>0);const T=l&&!x.isEmpty(l),O=r.useMemo(()=>{if(!l)return!1;const m=M[g.MPC_ACCOUNT_DETAILS];return!((m==null?void 0:m.mpnID)||(m==null?void 0:m.partnerType)&&m.partnerType.length>0)&&!d&&T},[M,l,d,T]);if(r.useMemo(()=>{if(!T)return!1;const m=S.current===l;return d||m?!1:s&&s.fetchedForPartner&&s.fetchedForPartner!==l?b:b&&!s},[T,l,d,b,s]))return t("div",{className:e.loadingContainer,children:t(Ie,{heading:"Loading your Microsoft settings",description:"It may take a few moments, please wait..."})});if(T&&!d&&!b&&!s)return t("div",{className:e.loadingContainer,children:t(Ie,{heading:"Loading your Microsoft settings",description:"It may take a few moments, please wait..."})});if(!s&&!d)return t("div",{className:e.loadingContainer,children:t(Ie,{heading:"Loading your Microsoft settings",description:"It may take a few moments, please wait..."})});if(O&&(b||!S.current))return t("div",{className:e.loadingContainer,children:t(Ie,{heading:"Loading your Microsoft settings",description:"It may take a few moments, please wait..."})});const L=`${l}-${h}`;return t(At,{initialValues:M,validationSchema:an,onSubmit:()=>{},enableReinitialize:!1,children:t(St,{children:t(Cn,{isMicrosoftCosellOnboarded:E,children:t(In,{})})})},L)},In=()=>{const{classes:e}=Le(),{isSectionExpanded:o,getIsReadOnly:n,expandFunction:a}=gn(),{pathname:c}=fe(),{accountId:v}=Ae(),S=c.split("/").includes("onboarding"),R=!!v,{values:i}
1=te(),l=i[g.MPC_ACCOUNT_DETAILS].isISV||!1,p="oppsync",u=W(s=>{var E,b;return R?((E=s.accountForm[p].selectedAccountDetails.AZURE.azureConfigMetadata)==null?void 0:E.is_azure_onboarding_completed)??!1:((b=s.accountForm[p].accountDetails.AZURE.azureConfigMetadata)==null?void 0:b.is_azure_onboarding_completed)??!1});return f("div",{className:e.mainContainer,children:[(!u||S)&&t(be,{heading:"Prerequisites",children:t(sn,{expandFunction:a("mpcAccountDetails"),isReadOnly:n("prerequisites")}),sectionName:g.PREREQUISITES,expandBox:o("prerequisites"),isMicrosoftCosellOnboarded:u}),t(be,{heading:"Microsoft Partner Center account details",children:t(cn,{expandFunction:a("microsoftProductDetails"),isReadOnly:n("mpcAccountDetails")}),sectionName:g.MPC_ACCOUNT_DETAILS,expandBox:o("mpcAccountDetails"),isMicrosoftCosellOnboarded:u}),t(be,{heading:"Solution details",children:t(pn,{expandFunction:a("linkMpcAccount"),isReadOnly:n("microsoftProductDetails")}),isOptional:!l,sectionName:g.MICROSOFT_PRODUCT_DETAILS,expandBox:o("microsoftProductDetails"),isMicrosoftCosellOnboarded:u}),t(be,{heading:"Link your Microsoft Partner Center account to Labra",children:t(un,{isReadOnly:n("linkMpcAccount")}),sectionName:g.LINK_MPC_ACCOUNT,expandBox:o("linkMpcAccount"),isMicrosoftCosellOnboarded:u}),t(Sn,{})]})},Tn=()=>{const{value:e}=Ke("microsoftOnboarding");return t("div",{"data-testid":"microsoft-settings-page",children:e?t(An,{}):t(nn,{})})},_n=Object.freeze(Object.defineProperty({__proto__:null,MicrosoftCloudSettings:Tn},Symbol.toStringTag,{value:"Module"}));export{nn as A,Tn as M,_n as a};
2//# sourceMappingURL=MicrosoftCloudSettings-DmO-4ByW.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.