import{aw as j,o as T,aR as w,R as m,j as e,ar as y,az as F,ax as P}from"./app-BgLa5dit.js";import{a as b}from"./Zwjmkasg.chunk.js";import{C as S}from"./BfMtaC_g.chunk.js";import{C as g}from"./itQZri94.chunk.js";import{u as z}from"./DBvERro4.chunk.js";import{C as N}from"./Gj7BdLIb.chunk.js";import{C as R}from"./CE2zsy03.chunk.js";import{C as L}from"./YSGwxiQJ.chunk.js";import{C as W}from"./Ceer3EzR.chunk.js";import{C as q}from"./MzD4y3tN.chunk.js";import{a as I}from"./CmeGmsFm.chunk.js";import{C as U}from"./BO07ARJN.chunk.js";import"./C9Rwpp7a.chunk.js";import"./NOUvVBMO.chunk.js";import"./CsH2Nu4a.chunk.js";import"./DJ0pq8J_.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";import"./Bs6fQ2wT.chunk.js";import"./BUT90D7O.chunk.js";import"./C1fMRwzQ.chunk.js";import"./uachN0F4.chunk.js";import"./u6fIQ8Ti.chunk.js";function V(r){const s=j(),o=T(w.currentUser()),n=S.isDev(o.data),{customerFormationTemplates:u,isLoading:c}=z(s.values.region,s.values.country,s.values.province),l=!c&&!!o.data,p=N.sortCFTs(u,s,n,r.isSalesforceCustomer),[d,a]=m.useState(!1),[f,i]=m.useState();function C(t){a(!0),i(t)}function x(){i(null),a(!1)}const h=b[s.values.type];function v(t){s.setValues({...s.values,cft:t,enabledCurriculums:[],enabledPresentations:[],enabledProducts:[],enabledLibraries:[],hasCustomisations:!1})}return e.jsxs("div",{className:"crm-studio-wizard-form",children:[e.jsx(L,{}),e.jsx("h1",{className:"h2 mb-3",children:"Customer Formation Templates (CFTs)"}),r.isSalesforceCustomer&&h&&e.jsxs("div",{className:"mb-4 d-flex",children:[e.jsx("label",{className:"me-3",children:"Type"}),e.jsx(g,{customerType:s.values.type})]}),l?e.jsxs(F,{children:[e.jsx(P,{type:"radio",name:"cft",id:"cft",children:()=>e.jsxs("div",{children:[e.jsx("h2",{className:"h5 mb-3",children:"Available customer formation templates"}),e.jsx(W,{customerFormationTemplates:p,showTemplatePreview:C,onChangeCft:v,selectedCft:s.values.cft})]})}),s.errors.cft&&s.touched.cft&&e.jsx(R,{errorMessage:s.errors.cft})]}):e.jsx("div",{className:"d-flex justify-content-center align-items-center mb-4",children:e.jsx(y,{as:"div",animation:"border",role:"status"})}),d&&e.jsx(q,{previewTemplate:f,closeTemplatePreview:x})]})}function ie(r){const s=!!r.queryParams.accountId;return e.jsx(U,{queryParams:r.queryParams,currentStepId:I.CUSTOMER_CFT,children:e.jsx(V,{isSalesforceCustomer:s})})}export{ie as CustomerWizardCftView};
//# sourceMappingURL=Dw2gGm7P.chunk.js.map
