@expedite-commerce/expedite-components 0.2.85 → 0.2.86
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/dist/expedite-components.css +1 -1
- package/dist/expedite-components.es.js +2510 -2502
- package/dist/expedite-components.umd.js +42 -42
- package/dist/style.css +1 -1
- package/dist/vue-expedite-components.js +867 -859
- package/dist/vue-expedite-components.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -184,4 +184,4 @@
|
|
|
184
184
|
`+Lt),ue&&Cs([S,T,j],Sn=>{Lt=Ui(Lt,Sn," ")}),b&&le?b.createHTML(Lt):Lt},t.setConfig=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xn(Be),Z=!0},t.clearConfig=function(){nn=null,Z=!1},t.isValidAttribute=function(Be,pe,Oe){nn||Xn({});const De=ct(Be),rt=ct(pe);return Ho(De,rt,Oe)},t.addHook=function(Be,pe){typeof pe=="function"&&$i(k[Be],pe)},t.removeHook=function(Be,pe){if(pe!==void 0){const Oe=bS(k[Be],pe);return Oe===-1?void 0:_S(k[Be],Oe,1)[0]}return Eh(k[Be])},t.removeHooks=function(Be){k[Be]=[]},t.removeAllHooks=function(){k=Rh()},t}var LS=Mh();const PS=["innerHTML"],Fh=Re({__name:"MarkdownRenderer",props:{source:{type:String,default:""},wrapperClass:{type:[String,Array,Object],default:""}},setup(e){const t=e,n=new Fn({html:!1,linkify:!0,breaks:!0}),r=ge(()=>{const o=n.render(t.source||"");return LS.sanitize(o)});return(o,i)=>(F(),V("div",{class:Ae(["markdown-renderer",e.wrapperClass]),innerHTML:r.value},null,10,PS))}},[["__scopeId","data-v-428be62b"]]),qS={class:"message-content"},$S={key:0,class:"message-name"},US={class:"ect-w-full"},jS={class:"message-content"},HS={class:"message-text ect-relative"},VS={class:"ect-pr-1"},zS={class:"loading-message-skeleton"},GS={key:1,class:"buttons-wrapper ect-mt-[-8px]"},KS=Re({__name:"chatMessages",props:{undoId:{type:String,default:""},strikethroughIds:{type:Array,default:()=>[]},messages:{type:Array,required:!0,default:()=>[]},chatIndex:{type:Number,default:0},dataChanged:{type:Boolean,default:!1},loadingMessage:{type:String,default:""},buttonLinks:{type:Array,default:()=>[]}},setup(e){const t=tf(),n=X(null),r=X(null);ho();const o=fo(),i=Bo(),a=e,s=ge(()=>!(i!=null&&i.activeComponentKey)),l=()=>{n.value&&n.value.scrollTo({top:n.value.scrollHeight,behavior:"smooth"})};H0(()=>{a.messages.length>0&&Tt(()=>{l()})}),H0(()=>{a.loadingMessage&&Tt(()=>{l(),r.value&&(r.value.scrollTop=r.value.scrollHeight)})});const u=ge(()=>{var f;return(f=o.chatStyles)==null?void 0:f.bgColor}),c=ge(()=>`linear-gradient(180deg, ${u.value} 0%, transparent 100%)`),h=ge(()=>{var f;return(f=o.chatStyles)==null?void 0:f.textColor}),d=(f,v,m=!1)=>{if(typeof f=="string"&&f.startsWith("playbookNavigate:")){const _=f.slice(17);i.navigateToBean(_);return}f==="addProducts"?i.loadComponent("catalog"):f==="quoteDocument"?t.openQuoteDocument(v.requestId):f==="quoteItem"?i.loadComponent("cart"):f==="Undo"&&o.undoAction(v.requestId)},p=f=>{if(!f)return"";let v=f.replace(/\\r\\n/g,`
|
|
185
185
|
`).replace(/\\n/g,`
|
|
186
186
|
`).replace(/\\r/g,`
|
|
187
|
-
`);return v=v.replace(/^[ \t]*•[ \t]+/gm,"- "),v};return(f,v)=>(F(),V("div",{class:Ae(["chat-messages",{"root-path":s.value}])},[C("div",{class:"chat-gradient",style:we({background:c.value})},null,4),C("div",{ref_key:"chatMessagesRef",ref:n,class:"messages-wrapper"},[(F(!0),V(Ee,null,Me([...e.messages],(m,_)=>{var g;return F(),V("div",{key:_,class:Ae(["message",{"user-message":m.type==="user"}])},[C("div",qS,[m.name?(F(),V("div",$S,be(m.name),1)):he("",!0),C("div",{class:Ae(["message-text ect-relative",{"error-message":m.error,strikethrough:m.undone}]),style:we(m.type==="user"?{color:h.value,backgroundColor:u.value}:{})},[C("div",US,[de(Fh,{source:p(m.message)},null,8,["source"])]),((g=m==null?void 0:m.filesData)==null?void 0:g.length)>0?(F(!0),V(Ee,{key:0},Me(m==null?void 0:m.filesData,y=>(F(),Ce($A,{key:y.name,info:{iconUrl:(y==null?void 0:y.type)==="csv"?Ie(O2):Ie(T2),fileName:y==null?void 0:y.name,fileSize:y==null?void 0:y.size},background:m.type=="user"?"#fff":"#f8f8f8","encoded-string":y==null?void 0:y.encodedString},null,8,["info","background","encoded-string"]))),128)):he("",!0)],6)])],2)}),128)),e.loadingMessage?(F(),V("div",{key:0,class:Ae(["loading-message",{"thinking-message":Ie(o).isThinkingMessage}])},[C("div",{class:Ae(["ect-flex ect-gap-3",{"ect-w-full":Ie(o).isThinkingMessage}])},[C("div",jS,[C("div",HS,[C("div",{ref_key:"loadingWindowRef",ref:r,class:"loading-window"},[C("div",VS,[de(Fh,{source:p(e.loadingMessage)},null,8,["source"])])],512)]),C("div",zS,[de(Ti,{style:{height:"100%",width:"100%"}})])])],2)],2)):e.buttonLinks.length>0?(F(),V("div",GS,[de(BA,{links:e.buttonLinks,onPerformAction:d},null,8,["links"])])):he("",!0)],512)],2))}},[["__scopeId","data-v-53b8cdb7"]]),XS={class:"ai-upload ect-flex-inline ect-items-center"},WS=Re({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(e,{emit:t}){const n=e,r=t,o=X(null),i=X(""),a=X(""),s=X(!1);Ge(()=>n.resetFileInput,h=>{h&&o.value&&(o.value.value="",i.value="",a.value="")});const l=h=>{const p=o.value.accept.split(",").map(v=>v.trim().toLowerCase()),f="."+h.name.split(".").pop().toLowerCase();return p.includes(f)||p.includes(h.type.toLowerCase())?!0:p.some(v=>{if(v.includes("*")){const m=v.split("*")[0];return h.type.toLowerCase().startsWith(m)}return!1})},u=async h=>{const d=h.target.files[0];if(console.info("File = ",d),d){if(!l(d)){o.value&&(o.value.value="");const f={message:"Invalid file type. Please upload a valid file type.",fileName:d.name,fileType:d.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:f.message,life:5e3}),r("error",f);return}i.value=d.name,a.value=d.type.split("/").pop(),r("upload-status",{status:"uploading",fileName:i.value,fileType:a.value});const p=new FileReader;p.onload=async f=>{const v=new Blob([f.target.result],{type:d.type});console.info("Blob data:",v);try{const m=await u3(v),_={attachment:{name:d.name,data:m}};console.info("AIRequestPayload = ",_),r("upload-status",{status:"uploaded",fileName:i.value,fileType:a.value,size:Yd(d.size),fileData:_}),o.value&&(o.value.value="")}catch(m){console.info("[ERROR]: File upload error:",m),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(m.message||"Unknown error"),life:5e3}),r("error",{message:"Error processing file",fileName:i.value,fileType:a.value,error:m.message}),r("upload-status",{status:"error",fileName:i.value,fileType:a.value})}},p.onerror=f=>{console.info("[ERROR]: FileReader error:",f),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Reading Error",detail:"Could not read the selected file",life:5e3}),r("error",{message:"Error reading file",fileName:d.name,fileType:d.type,error:f})},setTimeout(()=>{p.readAsText(d)},100)}},c=()=>{o.value.click()};return(h,d)=>(F(),V("div",XS,[C("input",{ref_key:"fileInput",ref:o,type:"file",accept:".csv, .xls, .xlsx, text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",class:"ect-opacity-0 ect-h-0 ect-w-0 ect-absolute",onChange:u},null,544),C("button",{class:"attachment-button",onClick:c,onMouseenter:d[0]||(d[0]=p=>s.value=!0),onMouseleave:d[1]||(d[1]=p=>s.value=!1)},[de(Ve,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-c0e7f2d6"]]),QS={key:0,class:"suggestions-container"},ZS={key:0,class:"logo-section"},JS={class:"help-text-section"},YS={key:0,class:"help-text"},eO={key:1,class:"sub-help-text"},tO=["onClick"],nO={key:2,class:"suggestions-list"},rO=["onClick"],oO=Re({__name:"AISuggestionsDropdown",props:{options:{type:Array,required:!0},helpText:{type:String,default:""},subHelpText:{type:String,default:""},showSuggestions:{type:Boolean,default:!1}},emits:["select","preview"],setup(e,{emit:t}){const n=e,r=t,o=X(0),i=X(0),a=X(null),s=X(null),l=d=>{a.value=d,i.value=0},u=()=>{a.value=null,o.value=0},c=d=>{r("select",d)},h=d=>{if(n.showSuggestions)switch(d.key){case"ArrowDown":d.preventDefault(),a.value?(i.value=(i.value+1)%a.value.subOptions.length,r("preview",a.value.subOptions[i.value])):(o.value=(o.value+1)%n.options.length,r("preview",n.options[o.value].title));break;case"ArrowUp":d.preventDefault(),a.value?(i.value=i.value-1<0?a.value.subOptions.length-1:i.value-1,r("preview",a.value.subOptions[i.value])):(o.value=o.value-1<0?n.options.length-1:o.value-1,r("preview",n.options[o.value].title));break;case"Enter":d.preventDefault(),a.value?c(a.value.subOptions[i.value]):l(n.options[o.value]);break;case"Escape":case"ArrowLeft":case"Backspace":a.value&&(d.preventDefault(),u());break}};return Ge(()=>n.showSuggestions,d=>{d?(window.addEventListener("keydown",h),a.value=null,o.value=0,i.value=0):window.removeEventListener("keydown",h)}),(d,p)=>e.showSuggestions?(F(),V("div",QS,[a.value?he("",!0):(F(),V("div",ZS,[de(_b)])),C("div",JS,[e.helpText&&!a.value?(F(),V("div",YS,be(e.helpText),1)):he("",!0),e.subHelpText?(F(),V("div",eO,be(e.subHelpText),1)):he("",!0)]),a.value?(F(),V("div",nO,[(F(!0),V(Ee,null,Me(a.value.subOptions,(f,v)=>(F(),V("div",{key:v,class:Ae(["sub-option",{"sub-active":i.value===v}]),onClick:m=>c(f)},be(f),11,rO))),128))])):(F(),V("div",{key:1,ref_key:"suggestionsList",ref:s,class:"suggestions-list"},[(F(!0),V(Ee,null,Me(e.options,(f,v)=>(F(),V("div",{key:v,class:Ae(["suggestion-item",{active:o.value===v}]),onClick:m=>l(f)},be(f.title),11,tO))),128))],512))])):he("",!0)}},[["__scopeId","data-v-c6b24ba6"]]),iO={class:"chat-file-info"},aO={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},sO=["src"],lO={class:"ect-self-stretch ect-my-auto"},uO={key:0,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4"},cO=Re({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(e,{emit:t}){const n=t,r=()=>{n("cancel")};return(o,i)=>(F(),V("div",iO,[C("div",aO,[C("img",{loading:"lazy",src:e.fileInfo.fileType==="csv"?Ie(O2):Ie(T2),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,sO),C("div",lO,be(e.fileInfo.fileName),1)]),e.fileInfo.status==="uploading"?(F(),V("div",uO,[de(Uu,{size:18})])):he("",!0),e.fileInfo.status==="uploaded"?(F(),V("button",{key:1,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4",onClick:r},[de(Ve,{icon:"close",size:"8"})])):he("",!0)]))}},[["__scopeId","data-v-a3d6dc17"]]),dO={class:"chat-input-wrapper"},fO={class:"chat-input-inner"},hO={class:"input-row"},pO=["disabled","placeholder","onKeydown"],mO={key:1,class:"icon-wrapper"},gO={class:"icon-wrapper"},yO=Re({__name:"chatInput",props:{modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},placeholder:{type:String,default:"Ask Genesis AI"},helpText:{type:String,default:"Here are few areas where I can help"},subHelpText:{type:String,default:"Suggestions by Genesis (Click to Apply)"},showFile:{type:Boolean,default:!1},showMic:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","submit","speak","file-upload-status"],setup(e,{emit:t}){const n=e,r=t;fo();const o=En(),i=Bo(),a=X({}),s=X(!1),l=X(!1),u=X(n.modelValue),c=X(null),h=ge(()=>{const E=i.currentStep||null;return(Array.isArray(E==null?void 0:E.promptGuidance)?E.promptGuidance:[]).slice().sort((I,k)=>Number((I==null?void 0:I.sequenceNumber)??0)-Number((k==null?void 0:k.sequenceNumber)??0)).map(I=>{const S=(Array.isArray(I==null?void 0:I.relatedPG)?I.relatedPG:[]).slice().sort((T,j)=>Number((T==null?void 0:T.sequenceNumber)??0)-Number((j==null?void 0:j.sequenceNumber)??0)).map(T=>T.pgName);return{title:I.pgName,subOptions:S}})}),d=ge(()=>{var E;return(E=h.value)!=null&&E.length?h.value:[]}),p=ge(()=>{var E;return(E=h.value)!=null&&E.length?"Prompt Guidance":n.helpText});Ge(()=>n.loading,async(E,O)=>{!E&&O&&(await Tt(),c.value.focus())}),Ge(u,E=>{r("update:modelValue",E),Tt(()=>b())}),Ge(()=>n.modelValue,E=>{u.value=E});const f=E=>{console.info("[ERROR]: File upload error:",E),o.handleError(E,"ChatInput")},v=()=>{u.value.trim()&&(l.value=!1,r("submit",u.value),u.value="",c.value&&(c.value.style.height="32px"),a.value=null)},m=E=>{u.value=E,l.value=!1,Tt(()=>{b(),c.value&&(c.value.focus(),c.value.selectionStart=c.value.selectionEnd=u.value.length)})},_=E=>{u.value=E,Tt(()=>b())},g=()=>{l.value=!1},y=E=>{console.info("handleFileUploadStatus event = ",E),E!=null&&E.fileName?(a.value=E,r("file-upload-status",E)):(a.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},b=()=>{const E=c.value;if(!E)return;E.style.height="auto";const I=Math.max(32,Math.min(E.scrollHeight,120));E.style.height=`${I}px`},x=()=>{console.info("removeFile"),a.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},A=()=>{l.value=!1,b()};return(E,O)=>{var I,k,S,T,j;const M=U0("click-outside");return Cn((F(),V("div",dO,[de(oO,{options:d.value,"help-text":p.value,"sub-help-text":e.subHelpText,"show-suggestions":l.value,onSelect:m,onPreview:_},null,8,["options","help-text","sub-help-text","show-suggestions"]),C("div",fO,[C("div",hO,[C("div",{class:Ae(["icon-wrapper",{"active-suggestions":l.value,disabled:((I=d.value)==null?void 0:I.length)<=0}])},[de(Ve,{disabled:((k=d.value)==null?void 0:k.length)<=0||e.loading,color:((S=d.value)==null?void 0:S.length)<=0?"#DEDEDE":l.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:O[0]||(O[0]=G=>l.value=!l.value)},null,8,["disabled","color"])],2),Cn(C("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":O[1]||(O[1]=G=>u.value=G),disabled:e.loading,placeholder:e.placeholder,rows:"1",onKeydown:qn(_t(v,["exact","prevent"]),["enter"]),onInput:A},null,40,pO),[[io,u.value]]),e.showFile?(F(),V("div",{key:0,class:Ae(["icon-wrapper",{"file-upload-disabled":e.loading}])},[de(WS,{"reset-file-input":s.value,onUploadStatus:y,onError:f},null,8,["reset-file-input"])],2)):he("",!0),e.showMic?(F(),V("div",mO,[de(Ve,{color:"#828282",disabled:e.loading,icon:"mic",size:"13",height:15,onClick:O[2]||(O[2]=G=>E.$emit("speak"))},null,8,["disabled"])])):he("",!0),C("div",gO,[(F(),Ce(Ve,{key:1,disabled:e.loading,icon:"send",size:"20",onClick:v},null,8,["disabled"]))])]),((T=a.value)==null?void 0:T.status)==="uploading"||((j=a.value)==null?void 0:j.status)==="uploaded"?(F(),Ce(cO,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":a.value,onCancel:x},null,8,["file-info"])):he("",!0)])])),[[M,g]])}}},[["__scopeId","data-v-8ca31b68"]]),vO=["data-test-id"],bO=["data-test-id"],_O=["data-test-id"],xO=Re({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1},styles:{type:Object,required:!1,default:()=>({}),validator:e=>typeof(e==null?void 0:e.height)=="string"}},setup(e){const t=Bo(),n=fo(),r=X(null),o=ge(()=>{var l;return((l=t.getCurrentStepLinks)==null?void 0:l.call(t))||[]}),i=ge(()=>!0),a=l=>{console.info("[aiChat] handleSubmit",{hasFileData:!!r.value,messageLength:(l||"").length}),r.value?(console.info("[aiChat] sending with file attachment"),n.sendMessage(l,!0,r.value)):(console.info("[aiChat] sending without attachment"),n.sendMessage(l))},s=l=>{console.info("ChatScreen handleFileUploadStatus event = ",l),l!=null&&l.fileData?(r.value=l.fileData,n.attachmentData={size:l.size,type:l.fileType,name:l.fileName}):(r.value=null,n.attachmentData=null)};return(l,u)=>(F(),V("div",{class:"chat-screen","data-test-id":e.dataTestId},[C("div",{class:Ae(["messages-container",{"playbook-steps-mode-hybrid":Ie(t).playbookStepsMode==="hybrid","playbook-steps-mode-full":Ie(t).playbookStepsMode==="full","dxp-guiddance":e.isExternalGuidance}]),style:we({maxHeight:`calc(${e.styles.height} - 72px)`,height:`calc(${e.styles.height} - 72px)`}),"data-test-id":`${e.dataTestId}-messages-container`},[de(KS,{messages:Ie(n).chatHistory,"loading-message":Ie(n).loadingMessage,"undo-id":Ie(n).latestDMLRequest,"button-links":o.value,"strikethrough-ids":Ie(n).strikethroughHistory,"data-changed":Ie(n).dataManuallyChanged,"data-test-id":`${e.dataTestId}-messages`},null,8,["messages","loading-message","undo-id","button-links","strikethrough-ids","data-changed","data-test-id"])],14,bO),C("div",{class:"input-container","data-test-id":`${e.dataTestId}-input-container`},[de(yO,{modelValue:Ie(n).promptMessage,"onUpdate:modelValue":u[0]||(u[0]=c=>Ie(n).promptMessage=c),disabled:!i.value,"file-info":r.value,loading:!!Ie(n).loadingMessage,"data-test-id":`${e.dataTestId}-input`,onSubmit:a,onFileUploadStatus:s},null,8,["modelValue","disabled","file-info","loading","data-test-id"])],8,_O)],8,vO))}},[["__scopeId","data-v-065ca870"]]),CO={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},EO={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},kO={class:"ect-text-[40px] ect-leading-none ect-mb-3"},AO=C("div",{class:"ect-text-[22px] ect-font-normal ect-leading-normal ect-mb-[12px] ect-capitalize ect-text-[#5F5F5F]","data-test-id":"configurator-not-found-title"}," Product Configurator Not Found ",-1),wO=C("div",{class:"ect-text-sm ect-text-gray-500","data-test-id":"configurator-not-found-subtitle"}," Linked composable product configurator UI component for this screen is not found OR the composable product configurator UI component does not exist. Please create / connect one and try again. ",-1),IO={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},SO={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(e){return(t,n)=>(F(),V("div",CO,[C("div",EO,[C("div",kO,[de(Ve,{icon:"error",size:48})]),AO,wO,C("div",IO,[C("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=r=>t.$emit("return")),"data-test-id":"configurator-not-found-return"}," RETURN TO PRODUCT RESULTS "),C("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[1]||(n[1]=r=>t.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},Bh=e=>(Xt("data-v-1919f8eb"),e=e(),Wt(),e),OO={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},TO={key:2,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"aiComponentLoader-cart-error"},DO=[Bh(()=>C("div",{class:"ect-text-center"},[C("div",{class:"ect-text-base ect-font-medium ect-text-red-600","data-test-id":"aiComponentLoader-cart-error-title"}," Quote Required "),C("div",{class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-cart-error-message"}," A quote is required for the cart component to work. Please ensure a quoteId is provided in the session prop. ")],-1))],RO={key:5,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},MO={class:"ect-text-center"},FO=Bh(()=>C("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),BO={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},NO=Re({__name:"aiComponentLoader",props:{stepComponent:{type:String,default:null},identity:{type:Object,default:()=>({})},session:{type:Object,default:()=>({})},security:{type:Object,default:()=>({})},packageVersion:{type:String,default:""},composablesOrgType:{type:String,default:""},composablesApiKey:{type:String,default:""},templateId:{type:String,default:""},hostName:{type:String,default:""},graphqlEndpoint:{type:String,default:""},apiKey:{type:String,default:""},isPreview:{type:Boolean,default:!1},sections:{type:Array,default:()=>[]},theme:{type:Object,default:()=>({})},catalogPreviewData:{type:Object,default:()=>({})},catalogInitialData:{type:Array,default:()=>[]},catalogSearchTerm:{type:String,default:""},onCatalogCountUpdate:{type:Function,default:null},cartSections:{type:String,default:""},configItemId:{type:String,default:""},configQliId:{type:String,default:""},configApiKey:{type:String,default:""}},emits:["expeditecart-clicked","ai-guidance:error","catalog-quote-created","catalog-quote-updated","catalog-items-loaded","catalog-item-added","catalog-item-qty-updated","catalog-line-deleted","catalog-items-fetched","catalog-item-configure"],setup(e,{emit:t}){const n=t,r=e,o=Bo(),i=Lu(),a=Ht(),s=ge(()=>({...r.session,qliId:v.value||r.configQliId||void 0,itemId:f.value})),l=ge(()=>{const N=o==null?void 0:o.activeComponentKey,Q=r.stepComponent;return(N||Q||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),u=ge(()=>{var ae,ue;const N=!!r.templateId,Q=!!((ae=r.identity)!=null&&ae.organizationId),ne=!!((ue=r.identity)!=null&&ue.accountId),Y=typeof r.cartSections=="string"&&r.cartSections.length>0;return N&&Q&&ne&&Y}),c=ge(()=>{var Y,ae;const N=(Y=r.session)==null?void 0:Y.quoteId,Q=a.quoteId.value,ne=(ae=o==null?void 0:o.activeComponentData)==null?void 0:ae.contextObjectId;return!!(N||Q||ne)}),h=ge(()=>{var Q,ne;const N=((Q=r.session)==null?void 0:Q.quoteId)||a.quoteId.value||((ne=o==null?void 0:o.activeComponentData)==null?void 0:ne.contextObjectId);return{...r.session,...N&&{quoteId:N}}}),d=ge(()=>{var Q;if(Array.isArray(r.catalogInitialData)&&r.catalogInitialData.length>0)return r.catalogInitialData;const N=((Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)||{};if(N.catalog&&typeof N.catalog=="object")try{const Y=Object.values(N.catalog).map(ae=>{var ue;return(ue=ae==null?void 0:ae.catalogResponse)==null?void 0:ue.productInfo}).filter(Boolean);if(Y.length>0)return Y}catch{}return Array.isArray(N.initialData)&&N.initialData.length>0?N.initialData:Array.isArray(N.catalogInitialData)&&N.catalogInitialData.length>0?N.catalogInitialData:Array.isArray(N.items)&&N.items.length>0?N.items:[]}),p=ge(()=>{var Q;const N=((Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)||{};return r.catalogSearchTerm||N.searchTerm||""}),f=ge(()=>{var Q,ne,Y,ae,ue,L;const N=((ae=(Y=(ne=(Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)==null?void 0:ne.savedProducts)==null?void 0:Y[0])==null?void 0:ae.itemId)||((ue=o==null?void 0:o.activeComponentData)==null?void 0:ue.payload)&&Object.keys(((L=o.activeComponentData.payload)==null?void 0:L.quoteConfiguration)||{})[0]||"";return r.configItemId||N||""}),v=ge(()=>{var Q,ne,Y,ae,ue,L,q,Z;const N=(ae=(Y=(ne=(Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)==null?void 0:ne.savedProducts)==null?void 0:Y[0])==null?void 0:ae.qliId;if(!N){console.log("[aiComponentLoader] configQliIdComputed: No qliId from savedProducts");const K=(L=(ue=o==null?void 0:o.activeComponentData)==null?void 0:ue.payload)==null?void 0:L.quoteConfiguration;if(console.log("[aiComponentLoader] configQliIdComputed: quoteConfiguration:",K),K&&typeof K=="object"){const W=Object.keys(K)[0];if(console.log("[aiComponentLoader] configQliIdComputed: firstItemId:",W),W){const ee=(q=K[W])==null?void 0:q.product;if(console.log("[aiComponentLoader] configQliIdComputed: productObj:",ee),ee&&ee.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId in productObj:",ee.qliId),ee.qliId;if((Z=K[W])!=null&&Z.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId directly under itemId:",K[W].qliId),K[W].qliId}}}return N||""}),m=ge(()=>!!f.value),_=ge(()=>l.value==="configurator"&&!m.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":l.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":l.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),g=ge(()=>{try{return JSON.stringify((o==null?void 0:o.activeComponentData)||{})}catch{return""}}),y=ge(()=>`catalog::${g.value}`),b=ge(()=>`cart::${g.value}`),x=ge(()=>{var N;try{return(((N=o==null?void 0:o.activeComponentData)==null?void 0:N.actionFunction)||"")==="Reload"}catch{return!1}}),A=ge(()=>{var Q;const N=`configurator::${f.value||""}::${v.value||""}`;if(x.value){const ne=((Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.requestId)||"";return`${N}::${ne}`}return N}),{emitError:E,emitErrors:O}=S2(n,"aiComponentLoader"),M=()=>{const N=D9(o,l.value);O(N)},I=X([]),k=X(null),S=N=>{const Q=Array.isArray(N)?N:Array.isArray(N==null?void 0:N.items)?N.items:[];if(!Array.isArray(Q))return;const ne={"Needs Configuration":1,"Suggests Configuration":2,"Fully Configured":3},Y=L=>(L==null?void 0:L.requiresConfiguration)||"",ae=L=>!!L&&L in ne,ue=Q.filter(L=>ae(Y(L)));ue.sort((L,q)=>{const Z=Y(L),K=Y(q);return(ne[Z]||99)-(ne[K]||99)}),I.value=ue,k.value=ue.length?ue[0]:null},T=N=>{console.log("onQuoteCreated",N),n("catalog-quote-created",N)},j=N=>{console.log("onQuoteUpdated",N),n("catalog-quote-updated",N)},G=N=>{console.log("onItemAdded",N),n("catalog-item-added",N)},H=N=>{console.log("onItemQtyUpdated",N),n("catalog-item-qty-updated",N)},oe=N=>{console.log("onLineDeleted",N),n("catalog-line-deleted",N)},ie=N=>{console.log("onQuoteItemsFetched",N),n("catalog-items-fetched",N)};Ge(()=>l.value,(N,Q)=>{var ne,Y,ae,ue,L,q,Z,K,W,ee,le;if(N==="configurator"){const fe=!!((ae=(Y=(ne=o==null?void 0:o.activeComponentData)==null?void 0:ne.payload)==null?void 0:Y.savedProducts)!=null&&ae.length),me=!!((L=(ue=o==null?void 0:o.activeComponentData)==null?void 0:ue.payload)!=null&&L.quoteConfiguration&&Object.keys(((Z=(q=o==null?void 0:o.activeComponentData)==null?void 0:q.payload)==null?void 0:Z.quoteConfiguration)||{}).length>0);if(!fe&&!me&&k.value&&!f.value){const J=((K=k.value)==null?void 0:K.itemId)||"";if(J){const se=((W=o==null?void 0:o.currentPlaybook)==null?void 0:W.playBookSteps)||[],ve=Se=>String(Se||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");let ye=null;const ke=se.findIndex(Se=>Se.stepName===(o==null?void 0:o.currentStepName));if(ke>=0&&se[ke+1]&&ve((ee=se[ke+1])==null?void 0:ee.stepComponent)==="configurator")ye=se[ke+1].stepName;else{const Se=se.findIndex(qe=>ve(qe==null?void 0:qe.stepComponent)==="configurator");ye=Se>=0?(le=se[Se])==null?void 0:le.stepName:null}const Te={payload:{savedProducts:[{itemId:J}]}};ye?o.navigateToStep({stepName:ye,data:Te}):o.loadComponent("configurator",Te)}}}});const re=()=>{var Y,ae;const N=((Y=o==null?void 0:o.currentPlaybook)==null?void 0:Y.playBookSteps)||[],Q=ue=>String(ue||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),ne=N.findIndex(ue=>Q(ue==null?void 0:ue.stepComponent)==="catalog"||Q(ue==null?void 0:ue.stepName).includes("catalog"));if(ne>=0){const ue=(ae=N[ne])==null?void 0:ae.stepName;o.navigateToStep({stepName:ue})}else o.loadComponent("catalog")},P=()=>{var Y,ae;const N=((Y=o==null?void 0:o.currentPlaybook)==null?void 0:Y.playBookSteps)||[],Q=ue=>String(ue||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),ne=N.findIndex(ue=>Q(ue==null?void 0:ue.stepComponent)==="cart"||Q(ue==null?void 0:ue.stepName).includes("cart"));if(ne>=0){const ue=(ae=N[ne])==null?void 0:ae.stepName;o.navigateToStep({stepName:ue})}else o.loadComponent("cart")},w=N=>{var Q,ne;console.log("onItemConfigureClicked",N),n("catalog-item-configure",N);try{const Y=(N==null?void 0:N.itemId)||"",ae=(N==null?void 0:N.qliId)||(N==null?void 0:N.QliId)||"",ue=[];if(Y){const W={itemId:Y};ae&&(W.qliId=ae),ue.push(W)}const L={payload:{savedProducts:ue}},q=((Q=o==null?void 0:o.currentPlaybook)==null?void 0:Q.playBookSteps)||[],Z=W=>String(W||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),K=q.findIndex(W=>{const ee=Z(W==null?void 0:W.stepComponent),le=Z(W==null?void 0:W.stepName);return ee==="configurator"||le.includes("configure")});if(K>=0){const W=(ne=q[K])==null?void 0:ne.stepName;o.navigateToStep({stepName:W,data:L})}else o.loadComponent("configurator",L)}catch(Y){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",Y),o.loadComponent("configurator",{payload:{}})}},D=N=>{console.log("onCartClicked",N),n("expeditecart-clicked",N)},R=N=>{var Q,ne;try{const Y=(N==null?void 0:N.itemId)||"",ae=(N==null?void 0:N.lineItemId)||(N==null?void 0:N.qliId)||"",ue=[];if(Y){const W={itemId:Y};ae&&(W.qliId=ae),ue.push(W)}const L={payload:{savedProducts:ue}},q=((Q=o==null?void 0:o.currentPlaybook)==null?void 0:Q.playBookSteps)||[],Z=W=>String(W||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),K=q.findIndex(W=>{const ee=Z(W==null?void 0:W.stepComponent),le=Z(W==null?void 0:W.stepName);return ee==="configurator"||le.includes("configure")});if(K>=0){const W=(ne=q[K])==null?void 0:ne.stepName;o.navigateToStep({stepName:W,data:L})}else o.loadComponent("configurator",L)}catch(Y){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",Y),o.loadComponent("configurator",{payload:{}})}},U=N=>{console.log("onCatalogIdReceived",N),a.updateConfig({eCatalogId:N})},z=N=>{console.log("Action",N),N.event==="add-to-quote"?n("configurator:add-to-quote",N.data):N.event==="save"&&n("configurator:save",N.data)},$=X("");return Ge(()=>o==null?void 0:o.activeComponentData,async N=>{var ne,Y,ae;if(!N)return;console.log("activeComponentData Changed",N);const Q=(N==null?void 0:N.requestId)||"";if(console.log("requestId",Q),console.log("lastReloadRequestId",$.value),Q&&Q!==$.value)if($.value=Q,await Tt(),(ne=N==null?void 0:N.payload)!=null&&ne.quoteConfiguration&&Object.keys(((Y=N==null?void 0:N.payload)==null?void 0:Y.quoteConfiguration)??{}).length>0){const ue=Object.keys(((ae=N==null?void 0:N.payload)==null?void 0:ae.quoteConfiguration)??{})[0];i.setPreConfigData(N==null?void 0:N.payload,ue)}else(N==null?void 0:N.actionFunction)==="Reload"&&(console.log("Reloading configurator 1"),i.refresh())},{deep:!0}),bt(()=>{Tt(()=>{M()})}),(N,Q)=>(F(),V("div",OO,[l.value==="catalog"?(F(),Ce(w2,{key:y.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":e.templateId,identity:e.identity,session:e.session,security:e.security,"search-term":p.value,"on-catalog-count-update":e.onCatalogCountUpdate,"preview-data":e.catalogPreviewData,"initial-data":d.value,sections:e.sections,theme:e.theme,"composables-org-type":e.composablesOrgType,onCatalogQuoteCreated:T,onCatalogQuoteUpdated:j,onCatalogItemsLoaded:S,onCatalogItemAdded:G,onCatalogItemQtyUpdated:H,onCatalogLineDeleted:oe,onCatalogItemsFetched:ie,onCatalogItemConfigure:w,"onCatalog:id":U},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","composables-org-type"])):l.value==="cart"&&u.value&&c.value?(F(),Ce(I2,{key:b.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":e.templateId,"host-name":e.hostName,"composables-org-type":e.composablesOrgType,security:e.security,identity:e.identity,session:h.value,onExpeditecartItemConfigure:R,onExpeditecartClicked:D},null,8,["template-id","host-name","composables-org-type","security","identity","session"])):l.value==="cart"&&u.value&&!c.value?(F(),V("div",TO,DO)):l.value==="configurator"&&m.value?(F(),Ce(c2,{key:A.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full",security:e.security,identity:e.identity,"user-locale":N.userLocale,"composables-org-type":e.composablesOrgType,session:s.value,onReady:Ie(i).setExpediteConfigComp,onAction:z},null,8,["security","identity","user-locale","composables-org-type","session","onReady"])):l.value==="configurator"&&!m.value?(F(),Ce(SO,{key:4,onReturn:re,onGoCart:P})):(F(),V("div",RO,[C("div",MO,[FO,C("div",BO,be(_.value),1)])]))]))}},[["__scopeId","data-v-1919f8eb"]]),LO={class:"ai-guidance-loader","data-test-id":"aiGuidance-loader-container"},PO={class:"aig-message-text","data-test-id":"aiGuidance-loader-message"},qO={class:"aig-button","data-test-id":"aiGuidance-loader-button"},$O={class:"aig-input-box","data-test-id":"aiGuidance-loader-input"},UO=Re({__name:"AiGuidanceLoader",props:{errors:{type:Array,required:!1,default:()=>[]}},setup(e){return(t,n)=>(F(),V("div",LO,[C("div",PO,[de(Ti,{style:{height:"16px",width:"90%","margin-bottom":"8px"}}),de(Ti,{style:{height:"16px",width:"65%","margin-bottom":"20px"}})]),C("div",qO,[de(Ti,{style:{height:"40px",width:"100%"}})]),(F(!0),V(Ee,null,Me(e.errors,r=>(F(),V("div",{key:r,class:"aig-message-error","data-test-id":"aiGuidance-loader-error"},be(r),1))),128)),C("div",$O,[de(Ti,{style:{height:"40px",width:"100%"}})])]))}},[["__scopeId","data-v-7d2f873f"]]),jO={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},HO=Re({__name:"aiGuidance",props:{templateId:{type:String,required:!1},playbookData:{type:Object,required:!1},composablesOrgType:{type:String,required:!0},identity:{type:Object,required:!1,default:()=>({})},session:{type:Object,required:!1,default:()=>({})},security:{type:Object,required:!1,default:()=>({})},websocketUrl:{type:String,required:!0},packageVersion:{type:String,required:!0},hostName:{type:String,required:!1},graphqlEndpoint:{type:String,required:!1},apiKey:{type:String,required:!1},isPreview:{type:Boolean,required:!1,default:!1},catalogSections:{type:Array,required:!1,default:()=>[]},cartSections:{type:String,required:!1,default:""},theme:{type:Object,required:!1,default:()=>({})},styles:{type:Object,required:!1,default:()=>({height:"100vh"}),validator:e=>typeof(e==null?void 0:e.height)=="string"}},emits:["expeditecart-item-configure","expeditecart-clicked","component-action","ai-response:success","quote-id:updated","ai-guidance:error"],setup(e,{emit:t}){const n=Bo(),r=Ht(),o=fo(),i=Ci(),a=t,s=X(!0),l=X(!1),u=X(!0),c=X(!0),h=X(!1),d=X([]),{emitError:p,emitErrors:f}=S2(a,"aiGuidance"),v=e,{composablesOrgType:m,websocketUrl:_,packageVersion:g,identity:y,session:b,security:x,templateId:A,hostName:E,graphqlEndpoint:O,apiKey:M,isPreview:I,catalogSections:k,cartSections:S,theme:T}=v;Qt(async()=>{console.log("security",x),console.log("apiKey",M),r.updateConfig({userId:y==null?void 0:y.userId,organizationId:y==null?void 0:y.organizationId,accessToken:x==null?void 0:x.accessToken,composablesApiUrl:x==null?void 0:x.baseUrl,composablesOrgType:m,websocketUrl:_,quoteId:b==null?void 0:b.quoteId,packageVersion:g,accountId:y==null?void 0:y.accountId,templateId:A,hostName:E,graphqlEndpoint:O,apiKey:(x==null?void 0:x.apiKey)||M,cid:y==null?void 0:y.contactId,isPreview:I})}),bt(async()=>{var $,N,Q,ne;const w=O9(v,y,x);f(w);const D=j1(_);if(D&&p(D),w.length>0||D){s.value=!1;return}n.setSecretKey(x==null?void 0:x.accessToken);let R=null,U,z;try{R=await n.getPlaybookInfoFromQuote(),U=(R==null?void 0:R.XX_ORD1__Completed_PB_Step_Number_EX__c)??void 0,z=(R==null?void 0:R.XX_ORD1__Playbook_Current_Step_Meta_EX__c)??void 0}catch(Y){console.error("[aiGuidance] Failed to get playbook info from quote:",Y),p("AI_GUIDANCE_PLAYBOOK_INFO_FETCH_FAILED",{error:Y.message})}if(z)try{z=JSON.parse(z)}catch(Y){console.error("[aiGuidance] Failed to parse currentStepMetaServer:",Y),p("AI_GUIDANCE_JSON_PARSE_ERROR",{error:Y.message,data:"currentStepMetaServer"}),z=void 0}if(console.info("sequenceNumberServer = ",U),v.templateId){s.value=!0;try{const ae=await n.getCatalogInContext();console.log("catalogInContext = ",ae),ae&&r.updateConfig({eCatalogId:ae})}catch(ae){console.error("[aiGuidance] Failed to get catalog in context:",ae),p("AI_GUIDANCE_CATALOG_FETCH_FAILED",{error:ae.message})}let Y=null;try{await i.fetchBlockInformationREST({templateId:v.templateId});const ae=T9(i.pageBlocks);Y=ae.playbookId,ae.error&&p(ae.error,{error:"Block structure validation failed"}),Y||p("AI_GUIDANCE_BLOCK_PLAYBOOK_ID_MISSING",{pageBlocks:i.pageBlocks})}catch(ae){console.error("[aiGuidance] Failed to fetch block information:",ae),p("AI_GUIDANCE_BLOCK_FETCH_FAILED",{error:ae.message})}if(console.log("playbookID",Y),Y?l.value=!0:d.value.push("No playbook ID found in template"),n.setEmbeddedMode(!0),Y)try{n.currentPlaybook=Y,await n.getPlaybookByKey(Y),n.showPlaybookSteps=!0}catch(ae){console.error("[aiGuidance] Failed to get playbook by key:",ae),p("AI_GUIDANCE_PLAYBOOK_FETCH_FAILED",{error:ae.message,playbookID:Y})}n.playbookStepsMode="full",o.setInitialPayload();try{await o.connectSocket()}catch(ae){console.error("[aiGuidance] Failed to connect socket:",ae),p("WEBSOCKET_CONNECTION_FAILED",{error:ae.message})}if(U!==void 0){n.navigateToStep({stepName:(N=($=n.currentPlaybook)==null?void 0:$.playBookSteps[Number(U)])==null?void 0:N.stepName,data:z}),s.value=!1;return}(ne=(Q=n.currentPlaybook)==null?void 0:Q.playBookSteps)!=null&&ne.length&&n.setCurrentStepName(n.currentPlaybook.playBookSteps[0].stepName),s.value=!1}else d.value.push("templateId is required")});const j=ge(()=>{var R;const w=((R=n.currentPlaybook)==null?void 0:R.playBookSteps)||[],D=n.currentStepName;return w.find(U=>U.stepName===D)||w[0]||null}),G=ge(()=>{var w;return((w=j.value)==null?void 0:w.stepComponent)||null});Ge(()=>n.activeComponentKey,w=>{w&&(u.value=!1)});const H=[];bt(()=>{H.push(kn("expeditecart:configure-clicked",w=>{a("expeditecart-item-configure",w)})),H.push(kn("expeditecart:clicked",w=>{a("expeditecart-clicked",w)})),H.push(kn("ai-response:success",w=>{try{a("ai-response:success",w)}catch{}})),H.push(kn("quote-id:updated",w=>{try{a("quote-id:updated",w)}catch(D){console.info("[aiGuidance] Error emitting quote-id:updated event:",D)}})),H.push(kn("websocket:error",w=>{try{w!=null&&w.isInitialization&&p(w.errorCode||"WEBSOCKET_CONNECTION_FAILED",w)}catch(D){console.info("[aiGuidance] Error handling websocket error event:",D)}}))});const oe=w=>{console.log("[aiGuidance] Received error from aiComponentLoader:",w),a("ai-guidance:error",w)},ie=w=>{console.log("onExpediteCartClicked",w),a("component-action",{component:"cart",details:w})},re=(w,D)=>{a("component-action",{component:"catalog",action:w,details:D})},P=(w,D)=>{a("component-action",{component:"configurator",action:w,details:D})};return gr(()=>{try{o.cancelRequest()}catch{}try{o.disconnectSocket()}catch{}try{o.resetState()}catch{}try{n.setEmbeddedMode(!1),n.currentPlaybook=null,n.currentStepName=null,n.activeComponentKey=null,n.activeComponentData=null,n.showPlaybookSteps=!1,n.playbookStepsMode="full"}catch{}s.value=!1,l.value=!1,u.value=!0,c.value=!0,h.value=!1,d.value=[],H.forEach(w=>{try{w()}catch{}})}),(w,D)=>{var R;return F(),V("div",jO,[de($u,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),s.value?(F(),Ce(UO,{key:0,errors:d.value,"data-test-id":"aiGuidance-loader"},null,8,["errors"])):(F(),V("div",{key:1,class:Ae(["ai-app",{"root-path":u.value,"playbook-steps-mode-full":Ie(n).playbookStepsMode==="full","dxp-guiddance":l.value}]),style:we(e.styles)},[C("div",{class:"ai-app-chat-wrapper",style:we({height:e.styles.height})},[de(xO,{"data-test-id":"chat-screen","is-external-guidance":l.value,styles:e.styles},null,8,["is-external-guidance","styles"])],4),!u.value&&c.value&&!h.value?(F(),V("div",{key:0,class:"component-loader-wrapper",style:we({height:e.styles.height,maxHeight:e.styles.height})},[Ie(n).currentPlaybook?(F(),Ce(NO,{key:0,"template-id":((R=j.value)==null?void 0:R.templateId)||Ie(A),"step-component":G.value,identity:Ie(y),session:Ie(b),security:Ie(x),"composables-org-type":Ie(m),"package-version":Ie(g),"host-name":Ie(E),"graphql-endpoint":Ie(O),"api-key":Ie(M),"is-preview":Ie(I),sections:Ie(k),"cart-sections":Ie(S),theme:Ie(T),"data-test-id":"aiComponentLoader-mounted",onExpeditecartClicked:ie,onCatalogQuoteCreated:D[0]||(D[0]=U=>re("quote-created",U)),onCatalogQuoteUpdated:D[1]||(D[1]=U=>re("quote-updated",U)),onCatalogItemsLoaded:D[2]||(D[2]=U=>re("items-loaded",U)),onCatalogItemAdded:D[3]||(D[3]=U=>re("item-added",U)),onCatalogItemQtyUpdated:D[4]||(D[4]=U=>re("item-qty-updated",U)),onCatalogLineDeleted:D[5]||(D[5]=U=>re("line-deleted",U)),onCatalogItemsFetched:D[6]||(D[6]=U=>re("items-fetched",U)),onCatalogItemConfigure:D[7]||(D[7]=U=>re("item-configure",U)),"onConfigurator:addToQuote":D[8]||(D[8]=U=>P("add-to-quote",U)),"onConfigurator:save":D[9]||(D[9]=U=>P("save",U)),"onAiGuidance:error":oe},null,8,["template-id","step-component","identity","session","security","composables-org-type","package-version","host-name","graphql-endpoint","api-key","is-preview","sections","cart-sections","theme"])):he("",!0)],4)):he("",!0)],6))])}}},[["__scopeId","data-v-e9569a1c"]]);let As=null;if(typeof window<"u"){try{As=x6()}catch{}As||(As=C6(),mi(As))}let ws=null,Is=null;const Sc=new Set;let mo=null;const Oc=new Map;async function VO(e){if(!e)return"";if(Oc.has(e))return Oc.get(e);try{const t=await fetch(e,{credentials:"omit",cache:"no-cache"});if(t.ok){const n=await t.text();return Oc.set(e,n),n}}catch(t){console.warn("[ExpediteComponents] Failed to fetch theme CSS:",t)}return""}async function Tc(e,t){if(!e||!t)return;const n=e.querySelector("style[data-vue-expedite-theme]");n&&n.remove();try{const r=await VO(t);if(r){const o=document.createElement("style");o.setAttribute("data-vue-expedite-theme","true"),o.textContent=r,e.prepend(o)}}catch(r){console.warn("[ExpediteComponents] Failed to inject theme CSS:",r)}}function Dc(e){mo=e||null,mo&&Sc.forEach(t=>{t&&t.shadowRoot&&Tc(t.shadowRoot,mo)})}async function zO(){return ws||Is||(Is=(async()=>{try{const e=new URL("./style.css",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ir&&Ir.src||new URL("vue-expedite-components.umd.cjs",document.baseURI).href).href,t=await fetch(e);if(t.ok)return ws=await t.text(),ws}catch(e){console.warn("[ExpediteComponents] Failed to load CSS:",e)}return null})(),Is)}const zi=e=>class extends e{async connectedCallback(){if(super.connectedCallback&&super.connectedCallback(),Sc.add(this),!!this.shadowRoot){if(this.shadowRoot.querySelector("style[data-vue-expedite-style]")){mo&&Tc(this.shadowRoot,mo);return}try{const t=await zO();if(t){const n=document.createElement("style");n.setAttribute("data-vue-expedite-style","true"),n.textContent=t,this.shadowRoot.prepend(n)}else{const n=new URL("./style.css",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ir&&Ir.src||new URL("vue-expedite-components.umd.cjs",document.baseURI).href).href,r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("data-vue-expedite-style","true"),r.href=n,this.shadowRoot.prepend(r)}mo&&Tc(this.shadowRoot,mo)}catch(t){console.warn("[ExpediteComponents] Failed to inject CSS:",t)}}}disconnectedCallback(){Sc.delete(this),super.disconnectedCallback&&super.disconnectedCallback()}},Nh=zi(pi(c2)),Lh=zi(pi(H_)),Ph=zi(pi(w2)),qh=zi(pi(I2)),$h=zi(pi(HO));function Rc(){typeof window<"u"&&(customElements.get("vue-expedite-configurator")||customElements.define("vue-expedite-configurator",Nh),customElements.get("vue-expedite-gpt")||customElements.define("vue-expedite-gpt",Lh),customElements.get("vue-expedite-catalog")||customElements.define("vue-expedite-catalog",Ph),customElements.get("vue-expedite-cart")||customElements.define("vue-expedite-cart",qh),customElements.get("vue-expedite-ai-guidance")||customElements.define("vue-expedite-ai-guidance",$h))}typeof window<"u"&&Rc();const GO={register:Rc,applyThemeToShadows:Dc};typeof window<"u"&&(window.VueExpediteComponents=Object.assign(window.VueExpediteComponents||{},{applyThemeToShadows:Dc})),bn.ExpediteAIGuidanceElement=$h,bn.ExpediteCartElement=qh,bn.ExpediteCatalogElement=Ph,bn.ExpediteConfiguratorElement=Nh,bn.ExpediteGPTElement=Lh,bn.applyThemeToShadows=Dc,bn.default=GO,bn.registerWebComponents=Rc,Object.defineProperties(bn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
187
|
+
`);return v=v.replace(/^[ \t]*•[ \t]+/gm,"- "),v};return(f,v)=>(F(),V("div",{class:Ae(["chat-messages",{"root-path":s.value}])},[C("div",{class:"chat-gradient",style:we({background:c.value})},null,4),C("div",{ref_key:"chatMessagesRef",ref:n,class:"messages-wrapper"},[(F(!0),V(Ee,null,Me([...e.messages],(m,_)=>{var g;return F(),V("div",{key:_,class:Ae(["message",{"user-message":m.type==="user"}])},[C("div",qS,[m.name?(F(),V("div",$S,be(m.name),1)):he("",!0),C("div",{class:Ae(["message-text ect-relative",{"error-message":m.error,strikethrough:m.undone}]),style:we(m.type==="user"?{color:h.value,backgroundColor:u.value}:{})},[C("div",US,[de(Fh,{source:p(m.message)},null,8,["source"])]),((g=m==null?void 0:m.filesData)==null?void 0:g.length)>0?(F(!0),V(Ee,{key:0},Me(m==null?void 0:m.filesData,y=>(F(),Ce($A,{key:y.name,info:{iconUrl:(y==null?void 0:y.type)==="csv"?Ie(O2):Ie(T2),fileName:y==null?void 0:y.name,fileSize:y==null?void 0:y.size},background:m.type=="user"?"#fff":"#f8f8f8","encoded-string":y==null?void 0:y.encodedString},null,8,["info","background","encoded-string"]))),128)):he("",!0)],6)])],2)}),128)),e.loadingMessage?(F(),V("div",{key:0,class:Ae(["loading-message",{"thinking-message":Ie(o).isThinkingMessage}])},[C("div",{class:Ae(["ect-flex ect-gap-3",{"ect-w-full":Ie(o).isThinkingMessage}])},[C("div",jS,[C("div",HS,[C("div",{ref_key:"loadingWindowRef",ref:r,class:"loading-window"},[C("div",VS,[de(Fh,{source:p(e.loadingMessage)},null,8,["source"])])],512)]),C("div",zS,[de(Ti,{style:{height:"100%",width:"100%"}})])])],2)],2)):e.buttonLinks.length>0?(F(),V("div",GS,[de(BA,{links:e.buttonLinks,onPerformAction:d},null,8,["links"])])):he("",!0)],512)],2))}},[["__scopeId","data-v-53b8cdb7"]]),XS={class:"ai-upload ect-flex-inline ect-items-center"},WS=Re({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(e,{emit:t}){const n=e,r=t,o=X(null),i=X(""),a=X(""),s=X(!1);Ge(()=>n.resetFileInput,h=>{h&&o.value&&(o.value.value="",i.value="",a.value="")});const l=h=>{const p=o.value.accept.split(",").map(v=>v.trim().toLowerCase()),f="."+h.name.split(".").pop().toLowerCase();return p.includes(f)||p.includes(h.type.toLowerCase())?!0:p.some(v=>{if(v.includes("*")){const m=v.split("*")[0];return h.type.toLowerCase().startsWith(m)}return!1})},u=async h=>{const d=h.target.files[0];if(console.info("File = ",d),d){if(!l(d)){o.value&&(o.value.value="");const f={message:"Invalid file type. Please upload a valid file type.",fileName:d.name,fileType:d.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:f.message,life:5e3}),r("error",f);return}i.value=d.name,a.value=d.type.split("/").pop(),r("upload-status",{status:"uploading",fileName:i.value,fileType:a.value});const p=new FileReader;p.onload=async f=>{const v=new Blob([f.target.result],{type:d.type});console.info("Blob data:",v);try{const m=await u3(v),_={attachment:{name:d.name,data:m}};console.info("AIRequestPayload = ",_),r("upload-status",{status:"uploaded",fileName:i.value,fileType:a.value,size:Yd(d.size),fileData:_}),o.value&&(o.value.value="")}catch(m){console.info("[ERROR]: File upload error:",m),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(m.message||"Unknown error"),life:5e3}),r("error",{message:"Error processing file",fileName:i.value,fileType:a.value,error:m.message}),r("upload-status",{status:"error",fileName:i.value,fileType:a.value})}},p.onerror=f=>{console.info("[ERROR]: FileReader error:",f),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Reading Error",detail:"Could not read the selected file",life:5e3}),r("error",{message:"Error reading file",fileName:d.name,fileType:d.type,error:f})},setTimeout(()=>{p.readAsText(d)},100)}},c=()=>{o.value.click()};return(h,d)=>(F(),V("div",XS,[C("input",{ref_key:"fileInput",ref:o,type:"file",accept:".csv, .xls, .xlsx, text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",class:"ect-opacity-0 ect-h-0 ect-w-0 ect-absolute",onChange:u},null,544),C("button",{class:"attachment-button",onClick:c,onMouseenter:d[0]||(d[0]=p=>s.value=!0),onMouseleave:d[1]||(d[1]=p=>s.value=!1)},[de(Ve,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-c0e7f2d6"]]),QS={key:0,class:"suggestions-container"},ZS={key:0,class:"logo-section"},JS={class:"help-text-section"},YS={key:0,class:"help-text"},eO={key:1,class:"sub-help-text"},tO=["onClick"],nO={key:2,class:"suggestions-list"},rO=["onClick"],oO=Re({__name:"AISuggestionsDropdown",props:{options:{type:Array,required:!0},helpText:{type:String,default:""},subHelpText:{type:String,default:""},showSuggestions:{type:Boolean,default:!1}},emits:["select","preview"],setup(e,{emit:t}){const n=e,r=t,o=X(0),i=X(0),a=X(null),s=X(null),l=d=>{a.value=d,i.value=0},u=()=>{a.value=null,o.value=0},c=d=>{r("select",d)},h=d=>{if(n.showSuggestions)switch(d.key){case"ArrowDown":d.preventDefault(),a.value?(i.value=(i.value+1)%a.value.subOptions.length,r("preview",a.value.subOptions[i.value])):(o.value=(o.value+1)%n.options.length,r("preview",n.options[o.value].title));break;case"ArrowUp":d.preventDefault(),a.value?(i.value=i.value-1<0?a.value.subOptions.length-1:i.value-1,r("preview",a.value.subOptions[i.value])):(o.value=o.value-1<0?n.options.length-1:o.value-1,r("preview",n.options[o.value].title));break;case"Enter":d.preventDefault(),a.value?c(a.value.subOptions[i.value]):l(n.options[o.value]);break;case"Escape":case"ArrowLeft":case"Backspace":a.value&&(d.preventDefault(),u());break}};return Ge(()=>n.showSuggestions,d=>{d?(window.addEventListener("keydown",h),a.value=null,o.value=0,i.value=0):window.removeEventListener("keydown",h)}),(d,p)=>e.showSuggestions?(F(),V("div",QS,[a.value?he("",!0):(F(),V("div",ZS,[de(_b)])),C("div",JS,[e.helpText&&!a.value?(F(),V("div",YS,be(e.helpText),1)):he("",!0),e.subHelpText?(F(),V("div",eO,be(e.subHelpText),1)):he("",!0)]),a.value?(F(),V("div",nO,[(F(!0),V(Ee,null,Me(a.value.subOptions,(f,v)=>(F(),V("div",{key:v,class:Ae(["sub-option",{"sub-active":i.value===v}]),onClick:m=>c(f)},be(f),11,rO))),128))])):(F(),V("div",{key:1,ref_key:"suggestionsList",ref:s,class:"suggestions-list"},[(F(!0),V(Ee,null,Me(e.options,(f,v)=>(F(),V("div",{key:v,class:Ae(["suggestion-item",{active:o.value===v}]),onClick:m=>l(f)},be(f.title),11,tO))),128))],512))])):he("",!0)}},[["__scopeId","data-v-c6b24ba6"]]),iO={class:"chat-file-info"},aO={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},sO=["src"],lO={class:"ect-self-stretch ect-my-auto"},uO={key:0,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4"},cO=Re({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(e,{emit:t}){const n=t,r=()=>{n("cancel")};return(o,i)=>(F(),V("div",iO,[C("div",aO,[C("img",{loading:"lazy",src:e.fileInfo.fileType==="csv"?Ie(O2):Ie(T2),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,sO),C("div",lO,be(e.fileInfo.fileName),1)]),e.fileInfo.status==="uploading"?(F(),V("div",uO,[de(Uu,{size:18})])):he("",!0),e.fileInfo.status==="uploaded"?(F(),V("button",{key:1,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4",onClick:r},[de(Ve,{icon:"close",size:"8"})])):he("",!0)]))}},[["__scopeId","data-v-a3d6dc17"]]),dO={class:"chat-input-wrapper"},fO={class:"chat-input-inner"},hO={class:"input-row"},pO=["disabled","placeholder","onKeydown"],mO={key:1,class:"icon-wrapper"},gO={class:"icon-wrapper"},yO=Re({__name:"chatInput",props:{modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},placeholder:{type:String,default:"Ask Genesis AI"},helpText:{type:String,default:"Here are few areas where I can help"},subHelpText:{type:String,default:"Suggestions by Genesis (Click to Apply)"},showFile:{type:Boolean,default:!1},showMic:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","submit","speak","file-upload-status"],setup(e,{emit:t}){const n=e,r=t;fo();const o=En(),i=Bo(),a=X({}),s=X(!1),l=X(!1),u=X(n.modelValue),c=X(null),h=ge(()=>{const E=i.currentStep||null;return(Array.isArray(E==null?void 0:E.promptGuidance)?E.promptGuidance:[]).slice().sort((I,k)=>Number((I==null?void 0:I.sequenceNumber)??0)-Number((k==null?void 0:k.sequenceNumber)??0)).map(I=>{const S=(Array.isArray(I==null?void 0:I.relatedPG)?I.relatedPG:[]).slice().sort((T,j)=>Number((T==null?void 0:T.sequenceNumber)??0)-Number((j==null?void 0:j.sequenceNumber)??0)).map(T=>T.pgName);return{title:I.pgName,subOptions:S}})}),d=ge(()=>{var E;return(E=h.value)!=null&&E.length?h.value:[]}),p=ge(()=>{var E;return(E=h.value)!=null&&E.length?"Prompt Guidance":n.helpText});Ge(()=>n.loading,async(E,O)=>{!E&&O&&(await Tt(),c.value.focus())}),Ge(u,E=>{r("update:modelValue",E),Tt(()=>b())}),Ge(()=>n.modelValue,E=>{u.value=E});const f=E=>{console.info("[ERROR]: File upload error:",E),o.handleError(E,"ChatInput")},v=()=>{u.value.trim()&&(l.value=!1,r("submit",u.value),u.value="",c.value&&(c.value.style.height="32px"),a.value=null)},m=E=>{u.value=E,l.value=!1,Tt(()=>{b(),c.value&&(c.value.focus(),c.value.selectionStart=c.value.selectionEnd=u.value.length)})},_=E=>{u.value=E,Tt(()=>b())},g=()=>{l.value=!1},y=E=>{console.info("handleFileUploadStatus event = ",E),E!=null&&E.fileName?(a.value=E,r("file-upload-status",E)):(a.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},b=()=>{const E=c.value;if(!E)return;E.style.height="auto";const I=Math.max(32,Math.min(E.scrollHeight,120));E.style.height=`${I}px`},x=()=>{console.info("removeFile"),a.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},A=()=>{l.value=!1,b()};return(E,O)=>{var I,k,S,T,j;const M=U0("click-outside");return Cn((F(),V("div",dO,[de(oO,{options:d.value,"help-text":p.value,"sub-help-text":e.subHelpText,"show-suggestions":l.value,onSelect:m,onPreview:_},null,8,["options","help-text","sub-help-text","show-suggestions"]),C("div",fO,[C("div",hO,[C("div",{class:Ae(["icon-wrapper",{"active-suggestions":l.value,disabled:((I=d.value)==null?void 0:I.length)<=0}])},[de(Ve,{disabled:((k=d.value)==null?void 0:k.length)<=0||e.loading,color:((S=d.value)==null?void 0:S.length)<=0?"#DEDEDE":l.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:O[0]||(O[0]=G=>l.value=!l.value)},null,8,["disabled","color"])],2),Cn(C("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":O[1]||(O[1]=G=>u.value=G),disabled:e.loading,placeholder:e.placeholder,rows:"1",onKeydown:qn(_t(v,["exact","prevent"]),["enter"]),onInput:A},null,40,pO),[[io,u.value]]),e.showFile?(F(),V("div",{key:0,class:Ae(["icon-wrapper",{"file-upload-disabled":e.loading}])},[de(WS,{"reset-file-input":s.value,onUploadStatus:y,onError:f},null,8,["reset-file-input"])],2)):he("",!0),e.showMic?(F(),V("div",mO,[de(Ve,{color:"#828282",disabled:e.loading,icon:"mic",size:"13",height:15,onClick:O[2]||(O[2]=G=>E.$emit("speak"))},null,8,["disabled"])])):he("",!0),C("div",gO,[(F(),Ce(Ve,{key:1,disabled:e.loading,icon:"send",size:"20",onClick:v},null,8,["disabled"]))])]),((T=a.value)==null?void 0:T.status)==="uploading"||((j=a.value)==null?void 0:j.status)==="uploaded"?(F(),Ce(cO,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":a.value,onCancel:x},null,8,["file-info"])):he("",!0)])])),[[M,g]])}}},[["__scopeId","data-v-8ca31b68"]]),vO=["data-test-id"],bO=["data-test-id"],_O=["data-test-id"],xO=Re({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1},styles:{type:Object,required:!1,default:()=>({}),validator:e=>typeof(e==null?void 0:e.height)=="string"}},setup(e){const t=Bo(),n=fo(),r=X(null),o=ge(()=>{var l;return((l=t.getCurrentStepLinks)==null?void 0:l.call(t))||[]}),i=ge(()=>!0),a=l=>{console.info("[aiChat] handleSubmit",{hasFileData:!!r.value,messageLength:(l||"").length}),r.value?(console.info("[aiChat] sending with file attachment"),n.sendMessage(l,!0,r.value)):(console.info("[aiChat] sending without attachment"),n.sendMessage(l))},s=l=>{console.info("ChatScreen handleFileUploadStatus event = ",l),l!=null&&l.fileData?(r.value=l.fileData,n.attachmentData={size:l.size,type:l.fileType,name:l.fileName}):(r.value=null,n.attachmentData=null)};return(l,u)=>(F(),V("div",{class:"chat-screen","data-test-id":e.dataTestId},[C("div",{class:Ae(["messages-container",{"playbook-steps-mode-hybrid":Ie(t).playbookStepsMode==="hybrid","playbook-steps-mode-full":Ie(t).playbookStepsMode==="full","dxp-guiddance":e.isExternalGuidance}]),style:we({maxHeight:`calc(${e.styles.height} - 72px)`,height:`calc(${e.styles.height} - 72px)`}),"data-test-id":`${e.dataTestId}-messages-container`},[de(KS,{messages:Ie(n).chatHistory,"loading-message":Ie(n).loadingMessage,"undo-id":Ie(n).latestDMLRequest,"button-links":o.value,"strikethrough-ids":Ie(n).strikethroughHistory,"data-changed":Ie(n).dataManuallyChanged,"data-test-id":`${e.dataTestId}-messages`},null,8,["messages","loading-message","undo-id","button-links","strikethrough-ids","data-changed","data-test-id"])],14,bO),C("div",{class:"input-container","data-test-id":`${e.dataTestId}-input-container`},[de(yO,{modelValue:Ie(n).promptMessage,"onUpdate:modelValue":u[0]||(u[0]=c=>Ie(n).promptMessage=c),disabled:!i.value,"file-info":r.value,loading:!!Ie(n).loadingMessage,"data-test-id":`${e.dataTestId}-input`,onSubmit:a,onFileUploadStatus:s},null,8,["modelValue","disabled","file-info","loading","data-test-id"])],8,_O)],8,vO))}},[["__scopeId","data-v-065ca870"]]),CO={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},EO={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},kO={class:"ect-text-[40px] ect-leading-none ect-mb-3"},AO=C("div",{class:"ect-text-[22px] ect-font-normal ect-leading-normal ect-mb-[12px] ect-capitalize ect-text-[#5F5F5F]","data-test-id":"configurator-not-found-title"}," Product Configurator Not Found ",-1),wO=C("div",{class:"ect-text-sm ect-text-gray-500","data-test-id":"configurator-not-found-subtitle"}," Linked composable product configurator UI component for this screen is not found OR the composable product configurator UI component does not exist. Please create / connect one and try again. ",-1),IO={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},SO={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(e){return(t,n)=>(F(),V("div",CO,[C("div",EO,[C("div",kO,[de(Ve,{icon:"error",size:48})]),AO,wO,C("div",IO,[C("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=r=>t.$emit("return")),"data-test-id":"configurator-not-found-return"}," RETURN TO PRODUCT RESULTS "),C("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[1]||(n[1]=r=>t.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},Bh=e=>(Xt("data-v-1919f8eb"),e=e(),Wt(),e),OO={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},TO={key:2,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"aiComponentLoader-cart-error"},DO=[Bh(()=>C("div",{class:"ect-text-center"},[C("div",{class:"ect-text-base ect-font-medium ect-text-red-600","data-test-id":"aiComponentLoader-cart-error-title"}," Quote Required "),C("div",{class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-cart-error-message"}," A quote is required for the cart component to work. Please ensure a quoteId is provided in the session prop. ")],-1))],RO={key:5,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},MO={class:"ect-text-center"},FO=Bh(()=>C("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),BO={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},NO=Re({__name:"aiComponentLoader",props:{stepComponent:{type:String,default:null},identity:{type:Object,default:()=>({})},session:{type:Object,default:()=>({})},security:{type:Object,default:()=>({})},packageVersion:{type:String,default:""},composablesOrgType:{type:String,default:""},composablesApiKey:{type:String,default:""},templateId:{type:String,default:""},hostName:{type:String,default:""},graphqlEndpoint:{type:String,default:""},apiKey:{type:String,default:""},isPreview:{type:Boolean,default:!1},sections:{type:Array,default:()=>[]},theme:{type:Object,default:()=>({})},catalogPreviewData:{type:Object,default:()=>({})},catalogInitialData:{type:Array,default:()=>[]},catalogSearchTerm:{type:String,default:""},onCatalogCountUpdate:{type:Function,default:null},cartSections:{type:String,default:""},configItemId:{type:String,default:""},configQliId:{type:String,default:""},configApiKey:{type:String,default:""}},emits:["expeditecart-clicked","ai-guidance:error","catalog-quote-created","catalog-quote-updated","catalog-items-loaded","catalog-item-added","catalog-item-qty-updated","catalog-line-deleted","catalog-items-fetched","catalog-item-configure"],setup(e,{emit:t}){const n=t,r=e,o=Bo(),i=Lu(),a=Ht(),s=ge(()=>({...r.session,qliId:v.value||r.configQliId||void 0,itemId:f.value})),l=ge(()=>{const N=o==null?void 0:o.activeComponentKey,Q=r.stepComponent;return(N||Q||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),u=ge(()=>{var ae,ue;const N=!!r.templateId,Q=!!((ae=r.identity)!=null&&ae.organizationId),ne=!!((ue=r.identity)!=null&&ue.accountId),Y=typeof r.cartSections=="string"&&r.cartSections.length>0;return N&&Q&&ne&&Y}),c=ge(()=>{var Y,ae;const N=(Y=r.session)==null?void 0:Y.quoteId,Q=a.quoteId.value,ne=(ae=o==null?void 0:o.activeComponentData)==null?void 0:ae.contextObjectId;return!!(N||Q||ne)}),h=ge(()=>{var Q,ne;const N=((Q=r.session)==null?void 0:Q.quoteId)||a.quoteId.value||((ne=o==null?void 0:o.activeComponentData)==null?void 0:ne.contextObjectId);return{...r.session,...N&&{quoteId:N}}}),d=ge(()=>{var Q;if(Array.isArray(r.catalogInitialData)&&r.catalogInitialData.length>0)return r.catalogInitialData;const N=((Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)||{};if(N.catalog&&typeof N.catalog=="object")try{const Y=Object.values(N.catalog).map(ae=>{var ue;return(ue=ae==null?void 0:ae.catalogResponse)==null?void 0:ue.productInfo}).filter(Boolean);if(Y.length>0)return Y}catch{}return Array.isArray(N.initialData)&&N.initialData.length>0?N.initialData:Array.isArray(N.catalogInitialData)&&N.catalogInitialData.length>0?N.catalogInitialData:Array.isArray(N.items)&&N.items.length>0?N.items:[]}),p=ge(()=>{var Q;const N=((Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)||{};return r.catalogSearchTerm||N.searchTerm||""}),f=ge(()=>{var Q,ne,Y,ae,ue,L;const N=((ae=(Y=(ne=(Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)==null?void 0:ne.savedProducts)==null?void 0:Y[0])==null?void 0:ae.itemId)||((ue=o==null?void 0:o.activeComponentData)==null?void 0:ue.payload)&&Object.keys(((L=o.activeComponentData.payload)==null?void 0:L.quoteConfiguration)||{})[0]||"";return r.configItemId||N||""}),v=ge(()=>{var Q,ne,Y,ae,ue,L,q,Z;const N=(ae=(Y=(ne=(Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.payload)==null?void 0:ne.savedProducts)==null?void 0:Y[0])==null?void 0:ae.qliId;if(!N){console.log("[aiComponentLoader] configQliIdComputed: No qliId from savedProducts");const K=(L=(ue=o==null?void 0:o.activeComponentData)==null?void 0:ue.payload)==null?void 0:L.quoteConfiguration;if(console.log("[aiComponentLoader] configQliIdComputed: quoteConfiguration:",K),K&&typeof K=="object"){const W=Object.keys(K)[0];if(console.log("[aiComponentLoader] configQliIdComputed: firstItemId:",W),W){const ee=(q=K[W])==null?void 0:q.product;if(console.log("[aiComponentLoader] configQliIdComputed: productObj:",ee),ee&&ee.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId in productObj:",ee.qliId),ee.qliId;if((Z=K[W])!=null&&Z.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId directly under itemId:",K[W].qliId),K[W].qliId}}}return N||""}),m=ge(()=>!!f.value),_=ge(()=>l.value==="configurator"&&!m.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":l.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":l.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),g=ge(()=>{try{return JSON.stringify((o==null?void 0:o.activeComponentData)||{})}catch{return""}}),y=ge(()=>`catalog::${g.value}`),b=ge(()=>`cart::${g.value}`),x=ge(()=>{var N;try{return(((N=o==null?void 0:o.activeComponentData)==null?void 0:N.actionFunction)||"")==="Reload"}catch{return!1}}),A=ge(()=>{var Q;const N=`configurator::${f.value||""}::${v.value||""}`;if(x.value){const ne=((Q=o==null?void 0:o.activeComponentData)==null?void 0:Q.requestId)||"";return`${N}::${ne}`}return N}),{emitError:E,emitErrors:O}=S2(n,"aiComponentLoader"),M=()=>{const N=D9(o,l.value);O(N)},I=X([]),k=X(null),S=N=>{const Q=Array.isArray(N)?N:Array.isArray(N==null?void 0:N.items)?N.items:[];if(!Array.isArray(Q))return;const ne={"Needs Configuration":1,"Suggests Configuration":2,"Fully Configured":3},Y=L=>(L==null?void 0:L.requiresConfiguration)||"",ae=L=>!!L&&L in ne,ue=Q.filter(L=>ae(Y(L)));ue.sort((L,q)=>{const Z=Y(L),K=Y(q);return(ne[Z]||99)-(ne[K]||99)}),I.value=ue,k.value=ue.length?ue[0]:null},T=N=>{console.log("onQuoteCreated",N),n("catalog-quote-created",N)},j=N=>{console.log("onQuoteUpdated",N),n("catalog-quote-updated",N)},G=N=>{console.log("onItemAdded",N),n("catalog-item-added",N)},H=N=>{console.log("onItemQtyUpdated",N),n("catalog-item-qty-updated",N)},oe=N=>{console.log("onLineDeleted",N),n("catalog-line-deleted",N)},ie=N=>{console.log("onQuoteItemsFetched",N),n("catalog-items-fetched",N)};Ge(()=>l.value,(N,Q)=>{var ne,Y,ae,ue,L,q,Z,K,W,ee,le;if(N==="configurator"){const fe=!!((ae=(Y=(ne=o==null?void 0:o.activeComponentData)==null?void 0:ne.payload)==null?void 0:Y.savedProducts)!=null&&ae.length),me=!!((L=(ue=o==null?void 0:o.activeComponentData)==null?void 0:ue.payload)!=null&&L.quoteConfiguration&&Object.keys(((Z=(q=o==null?void 0:o.activeComponentData)==null?void 0:q.payload)==null?void 0:Z.quoteConfiguration)||{}).length>0);if(!fe&&!me&&k.value&&!f.value){const J=((K=k.value)==null?void 0:K.itemId)||"";if(J){const se=((W=o==null?void 0:o.currentPlaybook)==null?void 0:W.playBookSteps)||[],ve=Se=>String(Se||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");let ye=null;const ke=se.findIndex(Se=>Se.stepName===(o==null?void 0:o.currentStepName));if(ke>=0&&se[ke+1]&&ve((ee=se[ke+1])==null?void 0:ee.stepComponent)==="configurator")ye=se[ke+1].stepName;else{const Se=se.findIndex(qe=>ve(qe==null?void 0:qe.stepComponent)==="configurator");ye=Se>=0?(le=se[Se])==null?void 0:le.stepName:null}const Te={payload:{savedProducts:[{itemId:J}]}};ye?o.navigateToStep({stepName:ye,data:Te}):o.loadComponent("configurator",Te)}}}});const re=()=>{var Y,ae;const N=((Y=o==null?void 0:o.currentPlaybook)==null?void 0:Y.playBookSteps)||[],Q=ue=>String(ue||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),ne=N.findIndex(ue=>Q(ue==null?void 0:ue.stepComponent)==="catalog"||Q(ue==null?void 0:ue.stepName).includes("catalog"));if(ne>=0){const ue=(ae=N[ne])==null?void 0:ae.stepName;o.navigateToStep({stepName:ue})}else o.loadComponent("catalog")},P=()=>{var Y,ae;const N=((Y=o==null?void 0:o.currentPlaybook)==null?void 0:Y.playBookSteps)||[],Q=ue=>String(ue||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),ne=N.findIndex(ue=>Q(ue==null?void 0:ue.stepComponent)==="cart"||Q(ue==null?void 0:ue.stepName).includes("cart"));if(ne>=0){const ue=(ae=N[ne])==null?void 0:ae.stepName;o.navigateToStep({stepName:ue})}else o.loadComponent("cart")},w=N=>{var Q,ne;console.log("onItemConfigureClicked",N),n("catalog-item-configure",N);try{const Y=(N==null?void 0:N.itemId)||"",ae=(N==null?void 0:N.qliId)||(N==null?void 0:N.QliId)||"",ue=[];if(Y){const W={itemId:Y};ae&&(W.qliId=ae),ue.push(W)}const L={payload:{savedProducts:ue}},q=((Q=o==null?void 0:o.currentPlaybook)==null?void 0:Q.playBookSteps)||[],Z=W=>String(W||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),K=q.findIndex(W=>{const ee=Z(W==null?void 0:W.stepComponent),le=Z(W==null?void 0:W.stepName);return ee==="configurator"||le.includes("configure")});if(K>=0){const W=(ne=q[K])==null?void 0:ne.stepName;o.navigateToStep({stepName:W,data:L})}else o.loadComponent("configurator",L)}catch(Y){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",Y),o.loadComponent("configurator",{payload:{}})}},D=N=>{console.log("onCartClicked",N),n("expeditecart-clicked",N)},R=N=>{var Q,ne;try{const Y=(N==null?void 0:N.itemId)||"",ae=(N==null?void 0:N.lineItemId)||(N==null?void 0:N.qliId)||"",ue=[];if(Y){const W={itemId:Y};ae&&(W.qliId=ae),ue.push(W)}const L={payload:{savedProducts:ue}},q=((Q=o==null?void 0:o.currentPlaybook)==null?void 0:Q.playBookSteps)||[],Z=W=>String(W||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),K=q.findIndex(W=>{const ee=Z(W==null?void 0:W.stepComponent),le=Z(W==null?void 0:W.stepName);return ee==="configurator"||le.includes("configure")});if(K>=0){const W=(ne=q[K])==null?void 0:ne.stepName;o.navigateToStep({stepName:W,data:L})}else o.loadComponent("configurator",L)}catch(Y){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",Y),o.loadComponent("configurator",{payload:{}})}},U=N=>{console.log("onCatalogIdReceived",N),a.updateConfig({eCatalogId:N})},z=N=>{console.log("Action",N),N.event==="add-to-quote"?n("configurator:add-to-quote",N.data):N.event==="save"&&n("configurator:save",N.data)},$=X("");return Ge(()=>o==null?void 0:o.activeComponentData,async N=>{var ne,Y,ae;if(!N)return;console.log("activeComponentData Changed",N);const Q=(N==null?void 0:N.requestId)||"";if(console.log("requestId",Q),console.log("lastReloadRequestId",$.value),Q&&Q!==$.value)if($.value=Q,await Tt(),(ne=N==null?void 0:N.payload)!=null&&ne.quoteConfiguration&&Object.keys(((Y=N==null?void 0:N.payload)==null?void 0:Y.quoteConfiguration)??{}).length>0){const ue=Object.keys(((ae=N==null?void 0:N.payload)==null?void 0:ae.quoteConfiguration)??{})[0];i.setPreConfigData(N==null?void 0:N.payload,ue)}else(N==null?void 0:N.actionFunction)==="Reload"&&(console.log("Reloading configurator 1"),i.refresh())},{deep:!0}),bt(()=>{Tt(()=>{M()})}),(N,Q)=>(F(),V("div",OO,[l.value==="catalog"?(F(),Ce(w2,{key:y.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":e.templateId,identity:e.identity,session:e.session,security:e.security,"search-term":p.value,"on-catalog-count-update":e.onCatalogCountUpdate,"preview-data":e.catalogPreviewData,"initial-data":d.value,sections:e.sections,theme:e.theme,"composables-org-type":e.composablesOrgType,onCatalogQuoteCreated:T,onCatalogQuoteUpdated:j,onCatalogItemsLoaded:S,onCatalogItemAdded:G,onCatalogItemQtyUpdated:H,onCatalogLineDeleted:oe,onCatalogItemsFetched:ie,onCatalogItemConfigure:w,"onCatalog:id":U},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","composables-org-type"])):l.value==="cart"&&u.value&&c.value?(F(),Ce(I2,{key:b.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":e.templateId,"host-name":e.hostName,"composables-org-type":e.composablesOrgType,security:e.security,identity:e.identity,session:h.value,onExpeditecartItemConfigure:R,onExpeditecartClicked:D},null,8,["template-id","host-name","composables-org-type","security","identity","session"])):l.value==="cart"&&u.value&&!c.value?(F(),V("div",TO,DO)):l.value==="configurator"&&m.value?(F(),Ce(c2,{key:A.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full",security:e.security,identity:e.identity,"user-locale":N.userLocale,"composables-org-type":e.composablesOrgType,session:s.value,onReady:Ie(i).setExpediteConfigComp,onAction:z},null,8,["security","identity","user-locale","composables-org-type","session","onReady"])):l.value==="configurator"&&!m.value?(F(),Ce(SO,{key:4,onReturn:re,onGoCart:P})):(F(),V("div",RO,[C("div",MO,[FO,C("div",BO,be(_.value),1)])]))]))}},[["__scopeId","data-v-1919f8eb"]]),LO={class:"ai-guidance-loader","data-test-id":"aiGuidance-loader-container"},PO={class:"aig-message-text","data-test-id":"aiGuidance-loader-message"},qO={class:"aig-button","data-test-id":"aiGuidance-loader-button"},$O={class:"aig-input-box","data-test-id":"aiGuidance-loader-input"},UO=Re({__name:"AiGuidanceLoader",props:{errors:{type:Array,required:!1,default:()=>[]}},setup(e){return(t,n)=>(F(),V("div",LO,[C("div",PO,[de(Ti,{style:{height:"16px",width:"90%","margin-bottom":"8px"}}),de(Ti,{style:{height:"16px",width:"65%","margin-bottom":"20px"}})]),C("div",qO,[de(Ti,{style:{height:"40px",width:"100%"}})]),(F(!0),V(Ee,null,Me(e.errors,r=>(F(),V("div",{key:r,class:"aig-message-error","data-test-id":"aiGuidance-loader-error"},be(r),1))),128)),C("div",$O,[de(Ti,{style:{height:"40px",width:"100%"}})])]))}},[["__scopeId","data-v-7d2f873f"]]),jO={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},HO=Re({__name:"aiGuidance",props:{templateId:{type:String,required:!1},playbookData:{type:Object,required:!1},composablesOrgType:{type:String,required:!0},identity:{type:Object,required:!1,default:()=>({})},session:{type:Object,required:!1,default:()=>({})},security:{type:Object,required:!1,default:()=>({})},websocketUrl:{type:String,required:!0},packageVersion:{type:String,required:!0},hostName:{type:String,required:!1},graphqlEndpoint:{type:String,required:!1},apiKey:{type:String,required:!1},isPreview:{type:Boolean,required:!1,default:!1},catalogSections:{type:Array,required:!1,default:()=>[]},cartSections:{type:String,required:!1,default:""},theme:{type:Object,required:!1,default:()=>({})},styles:{type:Object,required:!1,default:()=>({height:"100vh"}),validator:e=>typeof(e==null?void 0:e.height)=="string"}},emits:["expeditecart-item-configure","expeditecart-clicked","component-action","ai-response:success","quote-id:updated","ai-guidance:error"],setup(e,{emit:t}){const n=Bo(),r=Ht(),o=fo(),i=Ci(),a=t,s=X(!0),l=X(!1),u=X(!0),c=X(!0),h=X(!1),d=X([]),{emitError:p,emitErrors:f}=S2(a,"aiGuidance"),v=e,{composablesOrgType:m,websocketUrl:_,packageVersion:g,identity:y,session:b,security:x,templateId:A,hostName:E,graphqlEndpoint:O,apiKey:M,isPreview:I,catalogSections:k,cartSections:S,theme:T}=v;Qt(async()=>{console.log("security",x),console.log("apiKey",M),r.updateConfig({userId:y==null?void 0:y.userId,organizationId:y==null?void 0:y.organizationId,accessToken:x==null?void 0:x.accessToken,composablesApiUrl:x==null?void 0:x.baseUrl,composablesOrgType:m,websocketUrl:_,quoteId:b==null?void 0:b.quoteId,packageVersion:g,accountId:y==null?void 0:y.accountId,templateId:A,hostName:E,graphqlEndpoint:O,apiKey:(x==null?void 0:x.apiKey)||M,cid:y==null?void 0:y.contactId,isPreview:I})}),bt(async()=>{var $,N,Q,ne;const w=O9(v,y,x);f(w);const D=j1(_);if(D&&p(D),w.length>0||D){s.value=!1;return}n.setSecretKey(x==null?void 0:x.accessToken);let R=null,U,z;try{R=await n.getPlaybookInfoFromQuote(),U=(R==null?void 0:R.XX_ORD1__Completed_PB_Step_Number_EX__c)??void 0,z=(R==null?void 0:R.XX_ORD1__Playbook_Current_Step_Meta_EX__c)??void 0}catch(Y){console.error("[aiGuidance] Failed to get playbook info from quote:",Y),p("AI_GUIDANCE_PLAYBOOK_INFO_FETCH_FAILED",{error:Y.message})}if(z)try{z=JSON.parse(z)}catch(Y){console.error("[aiGuidance] Failed to parse currentStepMetaServer:",Y),p("AI_GUIDANCE_JSON_PARSE_ERROR",{error:Y.message,data:"currentStepMetaServer"}),z=void 0}if(console.info("sequenceNumberServer = ",U),v.templateId){s.value=!0;try{const ae=await n.getCatalogInContext();console.log("catalogInContext = ",ae),ae&&r.updateConfig({eCatalogId:ae})}catch(ae){console.error("[aiGuidance] Failed to get catalog in context:",ae),p("AI_GUIDANCE_CATALOG_FETCH_FAILED",{error:ae.message})}let Y=null;try{await i.fetchBlockInformationREST({templateId:v.templateId});const ae=T9(i.pageBlocks);Y=ae.playbookId,ae.error&&p(ae.error,{error:"Block structure validation failed"}),Y||p("AI_GUIDANCE_BLOCK_PLAYBOOK_ID_MISSING",{pageBlocks:i.pageBlocks})}catch(ae){console.error("[aiGuidance] Failed to fetch block information:",ae),p("AI_GUIDANCE_BLOCK_FETCH_FAILED",{error:ae.message})}if(console.log("playbookID",Y),Y?l.value=!0:d.value.push("No playbook ID found in template"),n.setEmbeddedMode(!0),Y)try{n.currentPlaybook=Y,await n.getPlaybookByKey(Y),n.showPlaybookSteps=!0}catch(ae){console.error("[aiGuidance] Failed to get playbook by key:",ae),p("AI_GUIDANCE_PLAYBOOK_FETCH_FAILED",{error:ae.message,playbookID:Y})}n.playbookStepsMode="full",o.setInitialPayload();try{await o.connectSocket()}catch(ae){console.error("[aiGuidance] Failed to connect socket:",ae),p("WEBSOCKET_CONNECTION_FAILED",{error:ae.message})}if(U!==void 0){n.navigateToStep({stepName:(N=($=n.currentPlaybook)==null?void 0:$.playBookSteps[Number(U)])==null?void 0:N.stepName,data:z}),s.value=!1;return}(ne=(Q=n.currentPlaybook)==null?void 0:Q.playBookSteps)!=null&&ne.length&&n.setCurrentStepName(n.currentPlaybook.playBookSteps[0].stepName),s.value=!1}else d.value.push("templateId is required")});const j=ge(()=>{var R;const w=((R=n.currentPlaybook)==null?void 0:R.playBookSteps)||[],D=n.currentStepName;return w.find(U=>U.stepName===D)||w[0]||null}),G=ge(()=>{var w;return((w=j.value)==null?void 0:w.stepComponent)||null});Ge(()=>n.activeComponentKey,w=>{w&&(u.value=!1)});const H=[];bt(()=>{H.push(kn("expeditecart:configure-clicked",w=>{a("expeditecart-item-configure",w)})),H.push(kn("expeditecart:clicked",w=>{a("expeditecart-clicked",w)})),H.push(kn("ai-response:success",w=>{try{a("ai-response:success",w)}catch{}})),H.push(kn("quote-id:updated",w=>{try{a("quote-id:updated",w)}catch(D){console.info("[aiGuidance] Error emitting quote-id:updated event:",D)}})),H.push(kn("websocket:error",w=>{try{w!=null&&w.isInitialization&&p(w.errorCode||"WEBSOCKET_CONNECTION_FAILED",w)}catch(D){console.info("[aiGuidance] Error handling websocket error event:",D)}}))});const oe=w=>{console.log("[aiGuidance] Received error from aiComponentLoader:",w),a("ai-guidance:error",w)},ie=w=>{console.log("onExpediteCartClicked",w),a("component-action",{component:"cart",details:w})},re=(w,D)=>{var U;a("component-action",{component:"catalog",action:w,details:D});const R=(D==null?void 0:D.quoteId)??((U=D==null?void 0:D.response)==null?void 0:U.quoteId);if(R&&(w==="item-added"||w==="items-fetched"))try{a("quote-id:updated",{quoteId:R})}catch(z){console.info("[aiGuidance] Error emitting quote-id:updated from catalog event:",z)}},P=(w,D)=>{a("component-action",{component:"configurator",action:w,details:D})};return gr(()=>{try{o.cancelRequest()}catch{}try{o.disconnectSocket()}catch{}try{o.resetState()}catch{}try{n.setEmbeddedMode(!1),n.currentPlaybook=null,n.currentStepName=null,n.activeComponentKey=null,n.activeComponentData=null,n.showPlaybookSteps=!1,n.playbookStepsMode="full"}catch{}s.value=!1,l.value=!1,u.value=!0,c.value=!0,h.value=!1,d.value=[],H.forEach(w=>{try{w()}catch{}})}),(w,D)=>{var R;return F(),V("div",jO,[de($u,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),s.value?(F(),Ce(UO,{key:0,errors:d.value,"data-test-id":"aiGuidance-loader"},null,8,["errors"])):(F(),V("div",{key:1,class:Ae(["ai-app",{"root-path":u.value,"playbook-steps-mode-full":Ie(n).playbookStepsMode==="full","dxp-guiddance":l.value}]),style:we(e.styles)},[C("div",{class:"ai-app-chat-wrapper",style:we({height:e.styles.height})},[de(xO,{"data-test-id":"chat-screen","is-external-guidance":l.value,styles:e.styles},null,8,["is-external-guidance","styles"])],4),!u.value&&c.value&&!h.value?(F(),V("div",{key:0,class:"component-loader-wrapper",style:we({height:e.styles.height,maxHeight:e.styles.height})},[Ie(n).currentPlaybook?(F(),Ce(NO,{key:0,"template-id":((R=j.value)==null?void 0:R.templateId)||Ie(A),"step-component":G.value,identity:Ie(y),session:Ie(b),security:Ie(x),"composables-org-type":Ie(m),"package-version":Ie(g),"host-name":Ie(E),"graphql-endpoint":Ie(O),"api-key":Ie(M),"is-preview":Ie(I),sections:Ie(k),"cart-sections":Ie(S),theme:Ie(T),"data-test-id":"aiComponentLoader-mounted",onExpeditecartClicked:ie,onCatalogQuoteCreated:D[0]||(D[0]=U=>re("quote-created",U)),onCatalogQuoteUpdated:D[1]||(D[1]=U=>re("quote-updated",U)),onCatalogItemsLoaded:D[2]||(D[2]=U=>re("items-loaded",U)),onCatalogItemAdded:D[3]||(D[3]=U=>re("item-added",U)),onCatalogItemQtyUpdated:D[4]||(D[4]=U=>re("item-qty-updated",U)),onCatalogLineDeleted:D[5]||(D[5]=U=>re("line-deleted",U)),onCatalogItemsFetched:D[6]||(D[6]=U=>re("items-fetched",U)),onCatalogItemConfigure:D[7]||(D[7]=U=>re("item-configure",U)),"onConfigurator:addToQuote":D[8]||(D[8]=U=>P("add-to-quote",U)),"onConfigurator:save":D[9]||(D[9]=U=>P("save",U)),"onAiGuidance:error":oe},null,8,["template-id","step-component","identity","session","security","composables-org-type","package-version","host-name","graphql-endpoint","api-key","is-preview","sections","cart-sections","theme"])):he("",!0)],4)):he("",!0)],6))])}}},[["__scopeId","data-v-a334783f"]]);let As=null;if(typeof window<"u"){try{As=x6()}catch{}As||(As=C6(),mi(As))}let ws=null,Is=null;const Sc=new Set;let mo=null;const Oc=new Map;async function VO(e){if(!e)return"";if(Oc.has(e))return Oc.get(e);try{const t=await fetch(e,{credentials:"omit",cache:"no-cache"});if(t.ok){const n=await t.text();return Oc.set(e,n),n}}catch(t){console.warn("[ExpediteComponents] Failed to fetch theme CSS:",t)}return""}async function Tc(e,t){if(!e||!t)return;const n=e.querySelector("style[data-vue-expedite-theme]");n&&n.remove();try{const r=await VO(t);if(r){const o=document.createElement("style");o.setAttribute("data-vue-expedite-theme","true"),o.textContent=r,e.prepend(o)}}catch(r){console.warn("[ExpediteComponents] Failed to inject theme CSS:",r)}}function Dc(e){mo=e||null,mo&&Sc.forEach(t=>{t&&t.shadowRoot&&Tc(t.shadowRoot,mo)})}async function zO(){return ws||Is||(Is=(async()=>{try{const e=new URL("./style.css",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ir&&Ir.src||new URL("vue-expedite-components.umd.cjs",document.baseURI).href).href,t=await fetch(e);if(t.ok)return ws=await t.text(),ws}catch(e){console.warn("[ExpediteComponents] Failed to load CSS:",e)}return null})(),Is)}const zi=e=>class extends e{async connectedCallback(){if(super.connectedCallback&&super.connectedCallback(),Sc.add(this),!!this.shadowRoot){if(this.shadowRoot.querySelector("style[data-vue-expedite-style]")){mo&&Tc(this.shadowRoot,mo);return}try{const t=await zO();if(t){const n=document.createElement("style");n.setAttribute("data-vue-expedite-style","true"),n.textContent=t,this.shadowRoot.prepend(n)}else{const n=new URL("./style.css",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ir&&Ir.src||new URL("vue-expedite-components.umd.cjs",document.baseURI).href).href,r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("data-vue-expedite-style","true"),r.href=n,this.shadowRoot.prepend(r)}mo&&Tc(this.shadowRoot,mo)}catch(t){console.warn("[ExpediteComponents] Failed to inject CSS:",t)}}}disconnectedCallback(){Sc.delete(this),super.disconnectedCallback&&super.disconnectedCallback()}},Nh=zi(pi(c2)),Lh=zi(pi(H_)),Ph=zi(pi(w2)),qh=zi(pi(I2)),$h=zi(pi(HO));function Rc(){typeof window<"u"&&(customElements.get("vue-expedite-configurator")||customElements.define("vue-expedite-configurator",Nh),customElements.get("vue-expedite-gpt")||customElements.define("vue-expedite-gpt",Lh),customElements.get("vue-expedite-catalog")||customElements.define("vue-expedite-catalog",Ph),customElements.get("vue-expedite-cart")||customElements.define("vue-expedite-cart",qh),customElements.get("vue-expedite-ai-guidance")||customElements.define("vue-expedite-ai-guidance",$h))}typeof window<"u"&&Rc();const GO={register:Rc,applyThemeToShadows:Dc};typeof window<"u"&&(window.VueExpediteComponents=Object.assign(window.VueExpediteComponents||{},{applyThemeToShadows:Dc})),bn.ExpediteAIGuidanceElement=$h,bn.ExpediteCartElement=qh,bn.ExpediteCatalogElement=Ph,bn.ExpediteConfiguratorElement=Nh,bn.ExpediteGPTElement=Lh,bn.applyThemeToShadows=Dc,bn.default=GO,bn.registerWebComponents=Rc,Object.defineProperties(bn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED