@expedite-commerce/expedite-components 0.2.41 → 0.2.42
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.
|
@@ -36660,7 +36660,7 @@ const vC = ["innerHTML"], gC = {
|
|
|
36660
36660
|
], 8, ik)
|
|
36661
36661
|
], 8, ok));
|
|
36662
36662
|
}
|
|
36663
|
-
}, uk = /* @__PURE__ */ we(lk, [["__scopeId", "data-v-
|
|
36663
|
+
}, uk = /* @__PURE__ */ we(lk, [["__scopeId", "data-v-97dcc560"]]), sk = {
|
|
36664
36664
|
class: "ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center",
|
|
36665
36665
|
"data-test-id": "configurator-not-found"
|
|
36666
36666
|
}, ck = { class: "ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm" }, dk = { class: "ect-text-[40px] ect-leading-none ect-mb-3" }, fk = /* @__PURE__ */ C("div", {
|
|
@@ -37115,7 +37115,7 @@ const vC = ["innerHTML"], gC = {
|
|
|
37115
37115
|
]);
|
|
37116
37116
|
};
|
|
37117
37117
|
}
|
|
37118
|
-
}, M0 = /* @__PURE__ */ we(Sk, [["__scopeId", "data-v-
|
|
37118
|
+
}, M0 = /* @__PURE__ */ we(Sk, [["__scopeId", "data-v-37813fa7"]]), Ok = {
|
|
37119
37119
|
ExpediteConfigurator: Al,
|
|
37120
37120
|
ExpediteGPT: Vc,
|
|
37121
37121
|
ExpediteCatalog: Sl,
|
|
@@ -161,4 +161,4 @@
|
|
|
161
161
|
`+tt),j&&Fo([B,D,M],Tt=>{tt=Tr(tt,Tt," ")}),_&&ie?_.createHTML(tt):tt},r.setConfig=function(){let ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qt(ge),G=!0},r.clearConfig=function(){gt=null,G=!1},r.isValidAttribute=function(ge,ne,fe){gt||Qt({});const he=Re(ge),Ve=Re(ne);return sr(he,Ve,fe)},r.addHook=function(ge,ne){typeof ne=="function"&&Dr(v[ge],ne)},r.removeHook=function(ge,ne){if(ne!==void 0){const fe=Rx(v[ge],ne);return fe===-1?void 0:Lx(v[ge],fe,1)[0]}return Ru(v[ge])},r.removeHooks=function(ge){v[ge]=[]},r.removeAllHooks=function(){v=Xu()},r}var t_=Ku();const n_=["innerHTML"],Gu=pe({__name:"MarkdownRenderer",props:{source:{type:String,default:""},wrapperClass:{type:[String,Array,Object],default:""}},setup(t){const r=t,n=new Ft({html:!1,linkify:!0,breaks:!0}),o=e.computed(()=>{const a=n.render(r.source||"");return t_.sanitize(a)});return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["markdown-renderer",t.wrapperClass]),innerHTML:o.value},null,10,n_))}},[["__scopeId","data-v-428be62b"]]),r_={class:"message-content"},o_={key:0,class:"message-name"},a_={class:"ect-w-full"},i_=["onClick"],l_={class:"message-content"},s_={class:"message-text ect-relative"},c_={class:"ect-pr-1"},u_={class:"loading-message-skeleton"},d_={key:1,class:"buttons-wrapper ect-mt-[-8px]"},f_=pe({__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(t){const r=_l(),n=e.ref(null),o=e.ref(null);qn();const a=Pn(),i=er(),l=t,s=e.computed(()=>!(i!=null&&i.activeComponentKey)),c=()=>{n.value&&n.value.scrollTo({top:n.value.scrollHeight,behavior:"smooth"})};e.watchEffect(()=>{l.messages.length>0&&e.nextTick(()=>{c()})}),e.watchEffect(()=>{l.loadingMessage&&e.nextTick(()=>{c(),o.value&&(o.value.scrollTop=o.value.scrollHeight)})});const u=e.computed(()=>{var d;return(d=a.chatStyles)==null?void 0:d.bgColor}),f=e.computed(()=>`linear-gradient(180deg, ${u.value} 0%, transparent 100%)`),y=e.computed(()=>{var d;return(d=a.chatStyles)==null?void 0:d.textColor}),p=(d,g,h=!1)=>{if(typeof d=="string"&&d.startsWith("playbookNavigate:")){const x=d.slice(17);i.navigateToBean(x);return}d==="addProducts"?i.loadComponent("catalog"):d==="quoteDocument"?r.openQuoteDocument(g.requestId):d==="quoteItem"?i.loadComponent("cart"):d==="Undo"&&a.undoAction(g.requestId)},m=d=>{if(!d)return"";let g=d.replace(/\\r\\n/g,`
|
|
162
162
|
`).replace(/\\n/g,`
|
|
163
163
|
`).replace(/\\r/g,`
|
|
164
|
-
`);return g=g.replace(/^[ \t]*•[ \t]+/gm,"- "),g};return(d,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-messages",{"root-path":s.value}])},[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:f.value})},null,4),e.createElementVNode("div",{ref_key:"chatMessagesRef",ref:n,class:"messages-wrapper"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList([...t.messages],(h,x)=>{var b;return e.openBlock(),e.createElementBlock("div",{key:x,class:e.normalizeClass(["message",{"user-message":h.type==="user"}])},[e.createElementVNode("div",r_,[h.name?(e.openBlock(),e.createElementBlock("div",o_,e.toDisplayString(h.name),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-text ect-relative",{"error-message":h.error,strikethrough:h.undone}]),style:e.normalizeStyle(h.type==="user"?{color:y.value,backgroundColor:u.value}:{})},[e.createElementVNode("div",a_,[e.createVNode(Gu,{source:m(h.message)},null,8,["source"])]),h.isDML&&h.type=="agent"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"undo-button",onClick:C=>p("Undo",h)},[e.createVNode(Ee,{icon:"undo",size:"12"})],8,i_)):e.createCommentVNode("",!0),((b=h==null?void 0:h.filesData)==null?void 0:b.length)>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(h==null?void 0:h.filesData,C=>(e.openBlock(),e.createBlock(og,{key:C.name,info:{iconUrl:(C==null?void 0:C.type)==="csv"?e.unref(jc):e.unref(Uc),fileName:C==null?void 0:C.name,fileSize:C==null?void 0:C.size},background:h.type=="user"?"#fff":"#f8f8f8","encoded-string":C==null?void 0:C.encodedString},null,8,["info","background","encoded-string"]))),128)):e.createCommentVNode("",!0)],6)])],2)}),128)),t.loadingMessage?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-message",{"thinking-message":e.unref(a).isThinkingMessage}])},[e.createElementVNode("div",{class:e.normalizeClass(["ect-flex ect-gap-3",{"ect-w-full":e.unref(a).isThinkingMessage}])},[e.createElementVNode("div",l_,[e.createElementVNode("div",s_,[e.createElementVNode("div",{ref_key:"loadingWindowRef",ref:o,class:"loading-window"},[e.createElementVNode("div",c_,[e.createVNode(Gu,{source:m(t.loadingMessage)},null,8,["source"])])],512)]),e.createElementVNode("div",u_,[e.createVNode(U6,{style:{height:"100%",width:"100%"}})])])],2)],2)):t.buttonLinks.length>0?(e.openBlock(),e.createElementBlock("div",d_,[e.createVNode(Y7,{links:t.buttonLinks,onPerformAction:p},null,8,["links"])])):e.createCommentVNode("",!0)],512)],2))}},[["__scopeId","data-v-6ea9bef5"]]),h_={class:"ai-upload ect-flex-inline ect-items-center"},p_=pe({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(t,{emit:r}){const n=t,o=r,a=e.ref(null),i=e.ref(""),l=e.ref(""),s=e.ref(!1);e.watch(()=>n.resetFileInput,y=>{y&&a.value&&(a.value.value="",i.value="",l.value="")});const c=y=>{const m=a.value.accept.split(",").map(g=>g.trim().toLowerCase()),d="."+y.name.split(".").pop().toLowerCase();return m.includes(d)||m.includes(y.type.toLowerCase())?!0:m.some(g=>{if(g.includes("*")){const h=g.split("*")[0];return y.type.toLowerCase().startsWith(h)}return!1})},u=async y=>{const p=y.target.files[0];if(console.info("File = ",p),p){if(!c(p)){a.value&&(a.value.value="");const d={message:"Invalid file type. Please upload a valid file type.",fileName:p.name,fileType:p.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:d.message,life:5e3}),o("error",d);return}i.value=p.name,l.value=p.type.split("/").pop(),o("upload-status",{status:"uploading",fileName:i.value,fileType:l.value});const m=new FileReader;m.onload=async d=>{const g=new Blob([d.target.result],{type:p.type});console.info("Blob data:",g);try{const h=await T0(g),x={attachment:{name:p.name,data:h}};console.info("AIRequestPayload = ",x),o("upload-status",{status:"uploaded",fileName:i.value,fileType:l.value,size:bl(p.size),fileData:x}),a.value&&(a.value.value="")}catch(h){console.info("[ERROR]: File upload error:",h),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(h.message||"Unknown error"),life:5e3}),o("error",{message:"Error processing file",fileName:i.value,fileType:l.value,error:h.message}),o("upload-status",{status:"error",fileName:i.value,fileType:l.value})}},m.onerror=d=>{console.info("[ERROR]: FileReader error:",d),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Reading Error",detail:"Could not read the selected file",life:5e3}),o("error",{message:"Error reading file",fileName:p.name,fileType:p.type,error:d})},setTimeout(()=>{m.readAsText(p)},100)}},f=()=>{a.value.click()};return(y,p)=>(e.openBlock(),e.createElementBlock("div",h_,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,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),e.createElementVNode("button",{class:"attachment-button",onClick:f,onMouseenter:p[0]||(p[0]=m=>s.value=!0),onMouseleave:p[1]||(p[1]=m=>s.value=!1)},[e.createVNode(Ee,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-c0e7f2d6"]]),m_={key:0,class:"suggestions-container"},y_={key:0,class:"logo-section"},g_={class:"help-text-section"},b_={key:0,class:"help-text"},x_={key:1,class:"sub-help-text"},__=["onClick"],C_={key:2,class:"suggestions-list"},E_=["onClick"],k_=pe({__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(t,{emit:r}){const n=t,o=r,a=e.ref(0),i=e.ref(0),l=e.ref(null),s=e.ref(null),c=p=>{l.value=p,i.value=0},u=()=>{l.value=null,a.value=0},f=p=>{o("select",p)},y=p=>{if(n.showSuggestions)switch(p.key){case"ArrowDown":p.preventDefault(),l.value?(i.value=(i.value+1)%l.value.subOptions.length,o("preview",l.value.subOptions[i.value])):(a.value=(a.value+1)%n.options.length,o("preview",n.options[a.value].title));break;case"ArrowUp":p.preventDefault(),l.value?(i.value=i.value-1<0?l.value.subOptions.length-1:i.value-1,o("preview",l.value.subOptions[i.value])):(a.value=a.value-1<0?n.options.length-1:a.value-1,o("preview",n.options[a.value].title));break;case"Enter":p.preventDefault(),l.value?f(l.value.subOptions[i.value]):c(n.options[a.value]);break;case"Escape":case"ArrowLeft":case"Backspace":l.value&&(p.preventDefault(),u());break}};return e.watch(()=>n.showSuggestions,p=>{p?(window.addEventListener("keydown",y),l.value=null,a.value=0,i.value=0):window.removeEventListener("keydown",y)}),(p,m)=>t.showSuggestions?(e.openBlock(),e.createElementBlock("div",m_,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",y_,[e.createVNode(q6)])),e.createElementVNode("div",g_,[t.helpText&&!l.value?(e.openBlock(),e.createElementBlock("div",b_,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0),t.subHelpText?(e.openBlock(),e.createElementBlock("div",x_,e.toDisplayString(t.subHelpText),1)):e.createCommentVNode("",!0)]),l.value?(e.openBlock(),e.createElementBlock("div",C_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.subOptions,(d,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["sub-option",{"sub-active":i.value===g}]),onClick:h=>f(d)},e.toDisplayString(d),11,E_))),128))])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"suggestionsList",ref:s,class:"suggestions-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(d,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["suggestion-item",{active:a.value===g}]),onClick:h=>c(d)},e.toDisplayString(d.title),11,__))),128))],512))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-c6b24ba6"]]),v_={class:"chat-file-info"},w_={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},A_=["src"],B_={class:"ect-self-stretch ect-my-auto"},N_={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"},S_=pe({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(t,{emit:r}){const n=r,o=()=>{n("cancel")};return(a,i)=>(e.openBlock(),e.createElementBlock("div",v_,[e.createElementVNode("div",w_,[e.createElementVNode("img",{loading:"lazy",src:t.fileInfo.fileType==="csv"?e.unref(jc):e.unref(Uc),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,A_),e.createElementVNode("div",B_,e.toDisplayString(t.fileInfo.fileName),1)]),t.fileInfo.status==="uploading"?(e.openBlock(),e.createElementBlock("div",N_,[e.createVNode(ni,{size:18})])):e.createCommentVNode("",!0),t.fileInfo.status==="uploaded"?(e.openBlock(),e.createElementBlock("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:o},[e.createVNode(Ee,{icon:"close",size:"8"})])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-a3d6dc17"]]),I_={class:"chat-input-wrapper"},D_={class:"chat-input-inner"},T_={class:"input-row"},O_=["disabled","placeholder","onKeydown"],V_={key:1,class:"icon-wrapper"},F_={class:"icon-wrapper"},M_=pe({__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(t,{emit:r}){const n=t,o=r;Pn();const a=Bt(),i=er(),l=e.ref({}),s=e.ref(!1),c=e.ref(!1),u=e.ref(n.modelValue),f=e.ref(null),y=e.computed(()=>{const N=i.currentStep||null;return(Array.isArray(N==null?void 0:N.promptGuidance)?N.promptGuidance:[]).slice().sort((A,v)=>Number((A==null?void 0:A.sequenceNumber)??0)-Number((v==null?void 0:v.sequenceNumber)??0)).map(A=>{const B=(Array.isArray(A==null?void 0:A.relatedPG)?A.relatedPG:[]).slice().sort((D,M)=>Number((D==null?void 0:D.sequenceNumber)??0)-Number((M==null?void 0:M.sequenceNumber)??0)).map(D=>D.pgName);return{title:A.pgName,subOptions:B}})}),p=e.computed(()=>{var N;return(N=y.value)!=null&&N.length?y.value:[]}),m=e.computed(()=>{var N;return(N=y.value)!=null&&N.length?"Prompt Guidance":n.helpText});e.watch(()=>n.loading,async(N,S)=>{!N&&S&&(await e.nextTick(),f.value.focus())}),e.watch(u,N=>{o("update:modelValue",N),e.nextTick(()=>_())}),e.watch(()=>n.modelValue,N=>{u.value=N});const d=N=>{console.info("[ERROR]: File upload error:",N),a.handleError(N,"ChatInput")},g=()=>{u.value.trim()&&(c.value=!1,o("submit",u.value),f.value&&(f.value.style.height="32px"),l.value=null)},h=N=>{u.value=N,c.value=!1,e.nextTick(()=>{_(),f.value&&(f.value.focus(),f.value.selectionStart=f.value.selectionEnd=u.value.length)})},x=N=>{u.value=N,e.nextTick(()=>_())},b=()=>{c.value=!1},C=N=>{console.info("handleFileUploadStatus event = ",N),N!=null&&N.fileName?(l.value=N,o("file-upload-status",N)):(l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},_=()=>{const N=f.value;if(!N)return;N.style.height="auto";const A=Math.max(32,Math.min(N.scrollHeight,120));N.style.height=`${A}px`},E=()=>{console.info("removeFile"),l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},w=()=>{c.value=!1,_()};return(N,S)=>{var A,v,B,D,M;const T=e.resolveDirective("click-outside");return e.withDirectives((e.openBlock(),e.createElementBlock("div",I_,[e.createVNode(k_,{options:p.value,"help-text":m.value,"sub-help-text":t.subHelpText,"show-suggestions":c.value,onSelect:h,onPreview:x},null,8,["options","help-text","sub-help-text","show-suggestions"]),e.createElementVNode("div",D_,[e.createElementVNode("div",T_,[e.createElementVNode("div",{class:e.normalizeClass(["icon-wrapper",{"active-suggestions":c.value,disabled:((A=p.value)==null?void 0:A.length)<=0}])},[e.createVNode(Ee,{disabled:((v=p.value)==null?void 0:v.length)<=0||t.loading,color:((B=p.value)==null?void 0:B.length)<=0?"#DEDEDE":c.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:S[0]||(S[0]=$=>c.value=!c.value)},null,8,["disabled","color"])],2),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:f,"onUpdate:modelValue":S[1]||(S[1]=$=>u.value=$),disabled:t.loading,placeholder:t.placeholder,rows:"1",onKeydown:e.withKeys(e.withModifiers(g,["exact","prevent"]),["enter"]),onInput:w},null,40,O_),[[e.vModelText,u.value]]),t.showFile?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["icon-wrapper",{"file-upload-disabled":t.loading}])},[e.createVNode(p_,{"reset-file-input":s.value,onUploadStatus:C,onError:d},null,8,["reset-file-input"])],2)):e.createCommentVNode("",!0),t.showMic?(e.openBlock(),e.createElementBlock("div",V_,[e.createVNode(Ee,{color:"#828282",disabled:t.loading,icon:"mic",size:"13",height:15,onClick:S[2]||(S[2]=$=>N.$emit("speak"))},null,8,["disabled"])])):e.createCommentVNode("",!0),e.createElementVNode("div",F_,[(e.openBlock(),e.createBlock(Ee,{key:1,disabled:t.loading,icon:"send",size:"20",onClick:g},null,8,["disabled"]))])]),((D=l.value)==null?void 0:D.status)==="uploading"||((M=l.value)==null?void 0:M.status)==="uploaded"?(e.openBlock(),e.createBlock(S_,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":l.value,onCancel:E},null,8,["file-info"])):e.createCommentVNode("",!0)])])),[[T,b]])}}},[["__scopeId","data-v-2ddb0a7b"]]),R_=["data-test-id"],L_=["data-test-id"],P_=["data-test-id"],q_=pe({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1}},setup(t){const r=er(),n=Pn(),o=e.ref(null),a=e.computed(()=>{var c;return((c=r.getCurrentStepLinks)==null?void 0:c.call(r))||[]}),i=e.computed(()=>!0),l=c=>{console.info("[aiChat] handleSubmit",{hasFileData:!!o.value,messageLength:(c||"").length}),o.value?(console.info("[aiChat] sending with file attachment"),n.sendMessage(c,!0,o.value)):(console.info("[aiChat] sending without attachment"),n.sendMessage(c))},s=c=>{console.info("ChatScreen handleFileUploadStatus event = ",c),c!=null&&c.fileData?(o.value=c.fileData,n.attachmentData={size:c.size,type:c.fileType,name:c.fileName}):(o.value=null,n.attachmentData=null)};return(c,u)=>(e.openBlock(),e.createElementBlock("div",{class:"chat-screen","data-test-id":t.dataTestId},[e.createElementVNode("div",{class:e.normalizeClass(["messages-container",{"playbook-steps-mode-hybrid":e.unref(r).playbookStepsMode==="hybrid","playbook-steps-mode-full":e.unref(r).playbookStepsMode==="full","dxp-guiddance":t.isExternalGuidance}]),"data-test-id":`${t.dataTestId}-messages-container`},[e.createVNode(f_,{messages:e.unref(n).chatHistory,"loading-message":e.unref(n).loadingMessage,"undo-id":e.unref(n).latestDMLRequest,"button-links":a.value,"strikethrough-ids":e.unref(n).strikethroughHistory,"data-changed":e.unref(n).dataManuallyChanged,"data-test-id":`${t.dataTestId}-messages`},null,8,["messages","loading-message","undo-id","button-links","strikethrough-ids","data-changed","data-test-id"])],10,L_),e.createElementVNode("div",{class:"input-container","data-test-id":`${t.dataTestId}-input-container`},[e.createVNode(M_,{modelValue:e.unref(n).promptMessage,"onUpdate:modelValue":u[0]||(u[0]=f=>e.unref(n).promptMessage=f),disabled:!i.value,"file-info":o.value,loading:!!e.unref(n).loadingMessage,"data-test-id":`${t.dataTestId}-input`,onSubmit:l,onFileUploadStatus:s},null,8,["modelValue","disabled","file-info","loading","data-test-id"])],8,P_)],8,R_))}},[["__scopeId","data-v-1b825cde"]]),$_={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},z_={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},j_={class:"ect-text-[40px] ect-leading-none ect-mb-3"},U_=e.createElementVNode("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),H_=e.createElementVNode("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),X_={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},K_={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("div",$_,[e.createElementVNode("div",z_,[e.createElementVNode("div",j_,[e.createVNode(Ee,{icon:"error",size:48})]),U_,H_,e.createElementVNode("div",X_,[e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=o=>r.$emit("return")),"data-test-id":"configurator-not-found-return"}," RETURN TO PRODUCT RESULTS "),e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[1]||(n[1]=o=>r.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},G_=t=>(e.pushScopeId("data-v-1f3fe309"),t=t(),e.popScopeId(),t),Q_={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},W_={key:4,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},Z_={class:"ect-text-center"},J_=G_(()=>e.createElementVNode("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),Y_={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},eC=pe({__name:"aiComponentLoader",props:{stepComponent:{type:String,default:null},identity:{type:Object,default:()=>({})},session:{type:Object,default:()=>({})},security:{type:Object,default:()=>({})},eCatalogId:{type:String,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:""}},setup(t){const r=t,n=er(),o=ic(),a=e.computed(()=>r.security||{}),i=e.computed(()=>{const D=r.security||{},M=D.url||D.baseUrl||"",$=r.composablesApiKey||r.apiKey||"";return{url:M,apiKey:$}}),l=e.computed(()=>{var D,M,$;return{orgType:r.composablesOrgType,orgId:(D=r.identity)==null?void 0:D.organizationId,userId:(M=r.identity)==null?void 0:M.userId,accountId:($=r.identity)==null?void 0:$.accountId,opportunityId:r.opportunityId,userLocale:r.userLocale||"en_US",pricingSchema:"Single"}}),s=e.computed(()=>{const D=n==null?void 0:n.activeComponentKey,M=r.stepComponent;return(D||M||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),c=e.computed(()=>{var K,J;const D=!!r.templateId,M=!!((K=r.identity)!=null&&K.organizationId),$=!!((J=r.identity)!=null&&J.accountId),L=typeof r.cartSections=="string"&&r.cartSections.length>0;return D&&M&&$&&L}),u=e.computed(()=>{var M;if(Array.isArray(r.catalogInitialData)&&r.catalogInitialData.length>0)return r.catalogInitialData;const D=((M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)||{};if(D.catalog&&typeof D.catalog=="object")try{const L=Object.values(D.catalog).map(K=>{var J;return(J=K==null?void 0:K.catalogResponse)==null?void 0:J.productInfo}).filter(Boolean);if(L.length>0)return L}catch{}return Array.isArray(D.initialData)&&D.initialData.length>0?D.initialData:Array.isArray(D.catalogInitialData)&&D.catalogInitialData.length>0?D.catalogInitialData:Array.isArray(D.items)&&D.items.length>0?D.items:[]}),f=e.computed(()=>{var M;const D=((M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)||{};return r.catalogSearchTerm||D.searchTerm||""}),y=e.computed(()=>{var M,$,L,K,J,Q;const D=((K=(L=($=(M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)==null?void 0:$.savedProducts)==null?void 0:L[0])==null?void 0:K.itemId)||((J=n==null?void 0:n.activeComponentData)==null?void 0:J.payload)&&Object.keys(((Q=n.activeComponentData.payload)==null?void 0:Q.quoteConfiguration)||{})[0]||"";return r.configItemId||D||""}),p=e.computed(()=>{var M,$,L,K;return((K=(L=($=(M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)==null?void 0:$.savedProducts)==null?void 0:L[0])==null?void 0:K.qliId)||""}),m=e.computed(()=>!!y.value),d=e.computed(()=>s.value==="configurator"&&!m.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":s.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":s.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),g=e.computed(()=>{try{return JSON.stringify((n==null?void 0:n.activeComponentData)||{})}catch{return""}}),h=e.computed(()=>`catalog::${g.value}`),x=e.computed(()=>`cart::${g.value}`),b=e.computed(()=>`configurator::${y.value||""}::${p.value||""}::${g.value}`),C=D=>{console.log("onQuoteCreated",D)},_=D=>{console.log("onQuoteUpdated",D)},E=D=>{console.log("onItemAdded",D)},w=D=>{console.log("onItemQtyUpdated",D)},N=D=>{console.log("onLineDeleted",D)},S=D=>{console.log("onQuoteItemsFetched",D)},T=()=>{var L,K;const D=((L=n==null?void 0:n.currentPlaybook)==null?void 0:L.playBookSteps)||[],M=J=>String(J||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),$=D.findIndex(J=>M(J==null?void 0:J.stepComponent)==="catalog"||M(J==null?void 0:J.stepName).includes("catalog"));if($>=0){const J=(K=D[$])==null?void 0:K.stepName;n.navigateToStep({stepName:J})}else n.showEmbeddedComponent("catalog")},A=()=>{var L,K;const D=((L=n==null?void 0:n.currentPlaybook)==null?void 0:L.playBookSteps)||[],M=J=>String(J||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),$=D.findIndex(J=>M(J==null?void 0:J.stepComponent)==="cart"||M(J==null?void 0:J.stepName).includes("cart"));if($>=0){const J=(K=D[$])==null?void 0:K.stepName;n.navigateToStep({stepName:J})}else n.showEmbeddedComponent("cart")},v=D=>{var M,$;console.log("onItemConfigureClicked",D);try{const L=(D==null?void 0:D.itemId)||"",K=(D==null?void 0:D.qliId)||(D==null?void 0:D.QliId)||"",J=[];if(L){const I={itemId:L};K&&(I.qliId=K),J.push(I)}const Q={payload:{savedProducts:J}},F=((M=n==null?void 0:n.currentPlaybook)==null?void 0:M.playBookSteps)||[],k=I=>String(I||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),O=F.findIndex(I=>{const R=k(I==null?void 0:I.stepComponent),q=k(I==null?void 0:I.stepName);return R==="configurator"||q.includes("configure")});if(O>=0){const I=($=F[O])==null?void 0:$.stepName;n.navigateToStep({stepName:I,data:Q})}else n.showEmbeddedComponent("configurator",Q)}catch(L){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",L),n.showEmbeddedComponent("configurator",{payload:{}})}},B=D=>{var M,$;try{const L=(D==null?void 0:D.itemId)||"",K=(D==null?void 0:D.lineItemId)||(D==null?void 0:D.qliId)||"",J=[];if(L){const I={itemId:L};K&&(I.qliId=K),J.push(I)}const Q={payload:{savedProducts:J}},F=((M=n==null?void 0:n.currentPlaybook)==null?void 0:M.playBookSteps)||[],k=I=>String(I||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),O=F.findIndex(I=>{const R=k(I==null?void 0:I.stepComponent),q=k(I==null?void 0:I.stepName);return R==="configurator"||q.includes("configure")});if(O>=0){const I=($=F[O])==null?void 0:$.stepName;n.navigateToStep({stepName:I,data:Q})}else n.showEmbeddedComponent("configurator",Q)}catch(L){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",L),n.showEmbeddedComponent("configurator",{payload:{}})}};return(D,M)=>{var $,L,K,J,Q,F,k;return e.openBlock(),e.createElementBlock("div",Q_,[s.value==="catalog"?(e.openBlock(),e.createBlock(vo,{key:h.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":t.templateId,identity:t.identity,session:t.session,security:a.value,"search-term":f.value,"on-catalog-count-update":t.onCatalogCountUpdate,"preview-data":t.catalogPreviewData,"initial-data":u.value,sections:t.sections,theme:t.theme,"host-name":t.hostName,"graphql-endpoint":t.graphqlEndpoint,"api-key":t.apiKey,"composables-org-type":t.composablesOrgType,onCatalogQuoteCreated:C,onCatalogQuoteUpdated:_,onCatalogItemAdded:E,onCatalogItemQtyUpdated:w,onCatalogLineDeleted:N,onCatalogItemsFetched:S,onCatalogItemConfigure:v},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","host-name","graphql-endpoint","api-key","composables-org-type"])):s.value==="cart"&&c.value?(e.openBlock(),e.createBlock(wo,{key:x.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":t.templateId,"organization-id":($=t.identity)==null?void 0:$.organizationId,"account-id":(L=t.identity)==null?void 0:L.accountId,cid:(K=t.identity)==null?void 0:K.contactId,"user-id":(J=t.identity)==null?void 0:J.userId,"quote-id":(Q=t.session)==null?void 0:Q.quoteId,"host-name":t.hostName,"graphql-endpoint":t.graphqlEndpoint,"api-key":t.apiKey,"composables-api-url":(F=t.security)==null?void 0:F.baseUrl,"composables-api-key":t.composablesApiKey,"composables-org-type":t.composablesOrgType,onExpeditecartItemConfigure:B},null,8,["template-id","organization-id","account-id","cid","user-id","quote-id","host-name","graphql-endpoint","api-key","composables-api-url","composables-api-key","composables-org-type"])):s.value==="configurator"&&m.value?(e.openBlock(),e.createBlock(xo,{key:b.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full","item-id":y.value,"qli-id":p.value||t.configQliId||void 0,"quote-id":(k=t.session)==null?void 0:k.quoteId,"security-context":i.value,"setup-data":l.value,onReady:e.unref(o).setExpediteConfigComp},null,8,["item-id","qli-id","quote-id","security-context","setup-data","onReady"])):s.value==="configurator"&&!m.value?(e.openBlock(),e.createBlock(K_,{key:3,onReturn:T,onGoCart:A})):(e.openBlock(),e.createElementBlock("div",W_,[e.createElementVNode("div",Z_,[J_,e.createElementVNode("div",Y_,e.toDisplayString(d.value),1)])]))])}}},[["__scopeId","data-v-1f3fe309"]]),tC={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},nC={key:0,class:"ai-guidance-loader"},rC={class:"ai-app-chat-wrapper"},oC={key:0,class:"component-loader-wrapper"},Ui=pe({__name:"aiGuidance",props:{playbookId:{type:String,required:!0},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},composablesApiKey:{type:String,required:!0},eCatalogId:{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:()=>({})}},setup(t){const r=er(),n=ft(),o=Pn(),a=e.ref(!1),i=e.ref(!1),l=e.ref(!0),s=e.ref(!0),c=e.ref(!1),u=t,{composablesOrgType:f,websocketUrl:y,packageVersion:p,composablesApiKey:m,eCatalogId:d,identity:g,session:h,security:x,templateId:b,hostName:C,graphqlEndpoint:_,apiKey:E,isPreview:w,catalogSections:N,cartSections:S,theme:T}=u;e.onBeforeMount(async()=>{console.log("composablesApiKey",m),console.log("security",x),console.log("apiKey",E),n.updateConfig({userId:g==null?void 0:g.userId,organizationId:g==null?void 0:g.organizationId,composablesApiKey:m,composablesApiUrl:x==null?void 0:x.baseUrl,composablesOrgType:f,websocketUrl:y,quoteId:h==null?void 0:h.quoteId,packageVersion:p,eCatalogId:d,accountId:g==null?void 0:g.accountId,templateId:b,hostName:C,graphqlEndpoint:_,apiKey:(x==null?void 0:x.apiKey)||E,cid:g==null?void 0:g.contactId,isPreview:w}),u.playbookId&&(i.value=!0)}),e.onMounted(async()=>{var B,D;a.value=!0,r.setEmbeddedMode(!0),u.playbookData?r.currentPlaybook=u.playbookData:i.value&&(await r.getPlaybookByKey(u.playbookId),r.showPlaybookSteps=!0),r.playbookStepsMode="full",o.setInitialPayload(),await o.connectSocket(),(D=(B=r.currentPlaybook)==null?void 0:B.playBookSteps)!=null&&D.length&&r.setCurrentStepName(r.currentPlaybook.playBookSteps[0].stepName),a.value=!1});const A=e.computed(()=>{var M;const B=((M=r.currentPlaybook)==null?void 0:M.playBookSteps)||[],D=r.currentStepName;return B.find($=>$.stepName===D)||B[0]||null}),v=e.computed(()=>{var B;return((B=A.value)==null?void 0:B.stepComponent)||null});return e.watch(()=>r.activeComponentKey,B=>{B&&(l.value=!1)}),(B,D)=>{var M;return e.openBlock(),e.createElementBlock("div",tC,[e.createVNode(ti,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),a.value?(e.openBlock(),e.createElementBlock("div",nC," Loading the AI Guidance component... ")):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ai-app",{"root-path":l.value,"playbook-steps-mode-full":e.unref(r).playbookStepsMode==="full","dxp-guiddance":i.value}])},[e.createElementVNode("div",rC,[e.createVNode(q_,{"data-test-id":"chat-screen","is-external-guidance":i.value},null,8,["is-external-guidance"])]),!l.value&&s.value&&!c.value?(e.openBlock(),e.createElementBlock("div",oC,[e.unref(r).currentPlaybook?(e.openBlock(),e.createBlock(eC,{key:0,"template-id":((M=A.value)==null?void 0:M.templateId)||e.unref(b),"step-component":v.value,identity:e.unref(g),session:e.unref(h),security:e.unref(x),"composables-org-type":e.unref(f),"composables-api-key":e.unref(m),"e-catalog-id":e.unref(d),"package-version":e.unref(p),"host-name":e.unref(C),"graphql-endpoint":e.unref(_),"api-key":e.unref(E),"is-preview":e.unref(w),sections:e.unref(N),"cart-sections":e.unref(S),theme:e.unref(T),"data-test-id":"aiComponentLoader-mounted"},null,8,["template-id","step-component","identity","session","security","composables-org-type","composables-api-key","e-catalog-id","package-version","host-name","graphql-endpoint","api-key","is-preview","sections","cart-sections","theme"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))])}}},[["__scopeId","data-v-decd3ec7"]]),Qu={ExpediteConfigurator:xo,ExpediteGPT:fi,ExpediteCatalog:vo,ExpediteCart:wo,ExpediteAIGuidance:Ui},aC={install(t,r={}){t.component("ExpediteConfigurator",xo),t.component("ExpediteGPT",fi),t.component("ExpediteCatalog",vo),t.component("ExpediteCart",wo),t.component("ExpediteAIGuidance",Ui)},...Qu};dt.Components=Qu,dt.ExpediteAIGuidance=Ui,dt.ExpediteCart=wo,dt.ExpediteCatalog=vo,dt.ExpediteConfigurator=xo,dt.ExpediteGPT=fi,dt.default=aC,dt.useComRootStore=br,Object.defineProperties(dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
164
|
+
`);return g=g.replace(/^[ \t]*•[ \t]+/gm,"- "),g};return(d,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-messages",{"root-path":s.value}])},[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:f.value})},null,4),e.createElementVNode("div",{ref_key:"chatMessagesRef",ref:n,class:"messages-wrapper"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList([...t.messages],(h,x)=>{var b;return e.openBlock(),e.createElementBlock("div",{key:x,class:e.normalizeClass(["message",{"user-message":h.type==="user"}])},[e.createElementVNode("div",r_,[h.name?(e.openBlock(),e.createElementBlock("div",o_,e.toDisplayString(h.name),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-text ect-relative",{"error-message":h.error,strikethrough:h.undone}]),style:e.normalizeStyle(h.type==="user"?{color:y.value,backgroundColor:u.value}:{})},[e.createElementVNode("div",a_,[e.createVNode(Gu,{source:m(h.message)},null,8,["source"])]),h.isDML&&h.type=="agent"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"undo-button",onClick:C=>p("Undo",h)},[e.createVNode(Ee,{icon:"undo",size:"12"})],8,i_)):e.createCommentVNode("",!0),((b=h==null?void 0:h.filesData)==null?void 0:b.length)>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(h==null?void 0:h.filesData,C=>(e.openBlock(),e.createBlock(og,{key:C.name,info:{iconUrl:(C==null?void 0:C.type)==="csv"?e.unref(jc):e.unref(Uc),fileName:C==null?void 0:C.name,fileSize:C==null?void 0:C.size},background:h.type=="user"?"#fff":"#f8f8f8","encoded-string":C==null?void 0:C.encodedString},null,8,["info","background","encoded-string"]))),128)):e.createCommentVNode("",!0)],6)])],2)}),128)),t.loadingMessage?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-message",{"thinking-message":e.unref(a).isThinkingMessage}])},[e.createElementVNode("div",{class:e.normalizeClass(["ect-flex ect-gap-3",{"ect-w-full":e.unref(a).isThinkingMessage}])},[e.createElementVNode("div",l_,[e.createElementVNode("div",s_,[e.createElementVNode("div",{ref_key:"loadingWindowRef",ref:o,class:"loading-window"},[e.createElementVNode("div",c_,[e.createVNode(Gu,{source:m(t.loadingMessage)},null,8,["source"])])],512)]),e.createElementVNode("div",u_,[e.createVNode(U6,{style:{height:"100%",width:"100%"}})])])],2)],2)):t.buttonLinks.length>0?(e.openBlock(),e.createElementBlock("div",d_,[e.createVNode(Y7,{links:t.buttonLinks,onPerformAction:p},null,8,["links"])])):e.createCommentVNode("",!0)],512)],2))}},[["__scopeId","data-v-6ea9bef5"]]),h_={class:"ai-upload ect-flex-inline ect-items-center"},p_=pe({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(t,{emit:r}){const n=t,o=r,a=e.ref(null),i=e.ref(""),l=e.ref(""),s=e.ref(!1);e.watch(()=>n.resetFileInput,y=>{y&&a.value&&(a.value.value="",i.value="",l.value="")});const c=y=>{const m=a.value.accept.split(",").map(g=>g.trim().toLowerCase()),d="."+y.name.split(".").pop().toLowerCase();return m.includes(d)||m.includes(y.type.toLowerCase())?!0:m.some(g=>{if(g.includes("*")){const h=g.split("*")[0];return y.type.toLowerCase().startsWith(h)}return!1})},u=async y=>{const p=y.target.files[0];if(console.info("File = ",p),p){if(!c(p)){a.value&&(a.value.value="");const d={message:"Invalid file type. Please upload a valid file type.",fileName:p.name,fileType:p.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:d.message,life:5e3}),o("error",d);return}i.value=p.name,l.value=p.type.split("/").pop(),o("upload-status",{status:"uploading",fileName:i.value,fileType:l.value});const m=new FileReader;m.onload=async d=>{const g=new Blob([d.target.result],{type:p.type});console.info("Blob data:",g);try{const h=await T0(g),x={attachment:{name:p.name,data:h}};console.info("AIRequestPayload = ",x),o("upload-status",{status:"uploaded",fileName:i.value,fileType:l.value,size:bl(p.size),fileData:x}),a.value&&(a.value.value="")}catch(h){console.info("[ERROR]: File upload error:",h),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(h.message||"Unknown error"),life:5e3}),o("error",{message:"Error processing file",fileName:i.value,fileType:l.value,error:h.message}),o("upload-status",{status:"error",fileName:i.value,fileType:l.value})}},m.onerror=d=>{console.info("[ERROR]: FileReader error:",d),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Reading Error",detail:"Could not read the selected file",life:5e3}),o("error",{message:"Error reading file",fileName:p.name,fileType:p.type,error:d})},setTimeout(()=>{m.readAsText(p)},100)}},f=()=>{a.value.click()};return(y,p)=>(e.openBlock(),e.createElementBlock("div",h_,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,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),e.createElementVNode("button",{class:"attachment-button",onClick:f,onMouseenter:p[0]||(p[0]=m=>s.value=!0),onMouseleave:p[1]||(p[1]=m=>s.value=!1)},[e.createVNode(Ee,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-c0e7f2d6"]]),m_={key:0,class:"suggestions-container"},y_={key:0,class:"logo-section"},g_={class:"help-text-section"},b_={key:0,class:"help-text"},x_={key:1,class:"sub-help-text"},__=["onClick"],C_={key:2,class:"suggestions-list"},E_=["onClick"],k_=pe({__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(t,{emit:r}){const n=t,o=r,a=e.ref(0),i=e.ref(0),l=e.ref(null),s=e.ref(null),c=p=>{l.value=p,i.value=0},u=()=>{l.value=null,a.value=0},f=p=>{o("select",p)},y=p=>{if(n.showSuggestions)switch(p.key){case"ArrowDown":p.preventDefault(),l.value?(i.value=(i.value+1)%l.value.subOptions.length,o("preview",l.value.subOptions[i.value])):(a.value=(a.value+1)%n.options.length,o("preview",n.options[a.value].title));break;case"ArrowUp":p.preventDefault(),l.value?(i.value=i.value-1<0?l.value.subOptions.length-1:i.value-1,o("preview",l.value.subOptions[i.value])):(a.value=a.value-1<0?n.options.length-1:a.value-1,o("preview",n.options[a.value].title));break;case"Enter":p.preventDefault(),l.value?f(l.value.subOptions[i.value]):c(n.options[a.value]);break;case"Escape":case"ArrowLeft":case"Backspace":l.value&&(p.preventDefault(),u());break}};return e.watch(()=>n.showSuggestions,p=>{p?(window.addEventListener("keydown",y),l.value=null,a.value=0,i.value=0):window.removeEventListener("keydown",y)}),(p,m)=>t.showSuggestions?(e.openBlock(),e.createElementBlock("div",m_,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",y_,[e.createVNode(q6)])),e.createElementVNode("div",g_,[t.helpText&&!l.value?(e.openBlock(),e.createElementBlock("div",b_,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0),t.subHelpText?(e.openBlock(),e.createElementBlock("div",x_,e.toDisplayString(t.subHelpText),1)):e.createCommentVNode("",!0)]),l.value?(e.openBlock(),e.createElementBlock("div",C_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.subOptions,(d,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["sub-option",{"sub-active":i.value===g}]),onClick:h=>f(d)},e.toDisplayString(d),11,E_))),128))])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"suggestionsList",ref:s,class:"suggestions-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(d,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["suggestion-item",{active:a.value===g}]),onClick:h=>c(d)},e.toDisplayString(d.title),11,__))),128))],512))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-c6b24ba6"]]),v_={class:"chat-file-info"},w_={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},A_=["src"],B_={class:"ect-self-stretch ect-my-auto"},N_={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"},S_=pe({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(t,{emit:r}){const n=r,o=()=>{n("cancel")};return(a,i)=>(e.openBlock(),e.createElementBlock("div",v_,[e.createElementVNode("div",w_,[e.createElementVNode("img",{loading:"lazy",src:t.fileInfo.fileType==="csv"?e.unref(jc):e.unref(Uc),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,A_),e.createElementVNode("div",B_,e.toDisplayString(t.fileInfo.fileName),1)]),t.fileInfo.status==="uploading"?(e.openBlock(),e.createElementBlock("div",N_,[e.createVNode(ni,{size:18})])):e.createCommentVNode("",!0),t.fileInfo.status==="uploaded"?(e.openBlock(),e.createElementBlock("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:o},[e.createVNode(Ee,{icon:"close",size:"8"})])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-a3d6dc17"]]),I_={class:"chat-input-wrapper"},D_={class:"chat-input-inner"},T_={class:"input-row"},O_=["disabled","placeholder","onKeydown"],V_={key:1,class:"icon-wrapper"},F_={class:"icon-wrapper"},M_=pe({__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(t,{emit:r}){const n=t,o=r;Pn();const a=Bt(),i=er(),l=e.ref({}),s=e.ref(!1),c=e.ref(!1),u=e.ref(n.modelValue),f=e.ref(null),y=e.computed(()=>{const N=i.currentStep||null;return(Array.isArray(N==null?void 0:N.promptGuidance)?N.promptGuidance:[]).slice().sort((A,v)=>Number((A==null?void 0:A.sequenceNumber)??0)-Number((v==null?void 0:v.sequenceNumber)??0)).map(A=>{const B=(Array.isArray(A==null?void 0:A.relatedPG)?A.relatedPG:[]).slice().sort((D,M)=>Number((D==null?void 0:D.sequenceNumber)??0)-Number((M==null?void 0:M.sequenceNumber)??0)).map(D=>D.pgName);return{title:A.pgName,subOptions:B}})}),p=e.computed(()=>{var N;return(N=y.value)!=null&&N.length?y.value:[]}),m=e.computed(()=>{var N;return(N=y.value)!=null&&N.length?"Prompt Guidance":n.helpText});e.watch(()=>n.loading,async(N,S)=>{!N&&S&&(await e.nextTick(),f.value.focus())}),e.watch(u,N=>{o("update:modelValue",N),e.nextTick(()=>_())}),e.watch(()=>n.modelValue,N=>{u.value=N});const d=N=>{console.info("[ERROR]: File upload error:",N),a.handleError(N,"ChatInput")},g=()=>{u.value.trim()&&(c.value=!1,o("submit",u.value),f.value&&(f.value.style.height="32px"),l.value=null)},h=N=>{u.value=N,c.value=!1,e.nextTick(()=>{_(),f.value&&(f.value.focus(),f.value.selectionStart=f.value.selectionEnd=u.value.length)})},x=N=>{u.value=N,e.nextTick(()=>_())},b=()=>{c.value=!1},C=N=>{console.info("handleFileUploadStatus event = ",N),N!=null&&N.fileName?(l.value=N,o("file-upload-status",N)):(l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},_=()=>{const N=f.value;if(!N)return;N.style.height="auto";const A=Math.max(32,Math.min(N.scrollHeight,120));N.style.height=`${A}px`},E=()=>{console.info("removeFile"),l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},w=()=>{c.value=!1,_()};return(N,S)=>{var A,v,B,D,M;const T=e.resolveDirective("click-outside");return e.withDirectives((e.openBlock(),e.createElementBlock("div",I_,[e.createVNode(k_,{options:p.value,"help-text":m.value,"sub-help-text":t.subHelpText,"show-suggestions":c.value,onSelect:h,onPreview:x},null,8,["options","help-text","sub-help-text","show-suggestions"]),e.createElementVNode("div",D_,[e.createElementVNode("div",T_,[e.createElementVNode("div",{class:e.normalizeClass(["icon-wrapper",{"active-suggestions":c.value,disabled:((A=p.value)==null?void 0:A.length)<=0}])},[e.createVNode(Ee,{disabled:((v=p.value)==null?void 0:v.length)<=0||t.loading,color:((B=p.value)==null?void 0:B.length)<=0?"#DEDEDE":c.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:S[0]||(S[0]=$=>c.value=!c.value)},null,8,["disabled","color"])],2),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:f,"onUpdate:modelValue":S[1]||(S[1]=$=>u.value=$),disabled:t.loading,placeholder:t.placeholder,rows:"1",onKeydown:e.withKeys(e.withModifiers(g,["exact","prevent"]),["enter"]),onInput:w},null,40,O_),[[e.vModelText,u.value]]),t.showFile?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["icon-wrapper",{"file-upload-disabled":t.loading}])},[e.createVNode(p_,{"reset-file-input":s.value,onUploadStatus:C,onError:d},null,8,["reset-file-input"])],2)):e.createCommentVNode("",!0),t.showMic?(e.openBlock(),e.createElementBlock("div",V_,[e.createVNode(Ee,{color:"#828282",disabled:t.loading,icon:"mic",size:"13",height:15,onClick:S[2]||(S[2]=$=>N.$emit("speak"))},null,8,["disabled"])])):e.createCommentVNode("",!0),e.createElementVNode("div",F_,[(e.openBlock(),e.createBlock(Ee,{key:1,disabled:t.loading,icon:"send",size:"20",onClick:g},null,8,["disabled"]))])]),((D=l.value)==null?void 0:D.status)==="uploading"||((M=l.value)==null?void 0:M.status)==="uploaded"?(e.openBlock(),e.createBlock(S_,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":l.value,onCancel:E},null,8,["file-info"])):e.createCommentVNode("",!0)])])),[[T,b]])}}},[["__scopeId","data-v-2ddb0a7b"]]),R_=["data-test-id"],L_=["data-test-id"],P_=["data-test-id"],q_=pe({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1}},setup(t){const r=er(),n=Pn(),o=e.ref(null),a=e.computed(()=>{var c;return((c=r.getCurrentStepLinks)==null?void 0:c.call(r))||[]}),i=e.computed(()=>!0),l=c=>{console.info("[aiChat] handleSubmit",{hasFileData:!!o.value,messageLength:(c||"").length}),o.value?(console.info("[aiChat] sending with file attachment"),n.sendMessage(c,!0,o.value)):(console.info("[aiChat] sending without attachment"),n.sendMessage(c))},s=c=>{console.info("ChatScreen handleFileUploadStatus event = ",c),c!=null&&c.fileData?(o.value=c.fileData,n.attachmentData={size:c.size,type:c.fileType,name:c.fileName}):(o.value=null,n.attachmentData=null)};return(c,u)=>(e.openBlock(),e.createElementBlock("div",{class:"chat-screen","data-test-id":t.dataTestId},[e.createElementVNode("div",{class:e.normalizeClass(["messages-container",{"playbook-steps-mode-hybrid":e.unref(r).playbookStepsMode==="hybrid","playbook-steps-mode-full":e.unref(r).playbookStepsMode==="full","dxp-guiddance":t.isExternalGuidance}]),"data-test-id":`${t.dataTestId}-messages-container`},[e.createVNode(f_,{messages:e.unref(n).chatHistory,"loading-message":e.unref(n).loadingMessage,"undo-id":e.unref(n).latestDMLRequest,"button-links":a.value,"strikethrough-ids":e.unref(n).strikethroughHistory,"data-changed":e.unref(n).dataManuallyChanged,"data-test-id":`${t.dataTestId}-messages`},null,8,["messages","loading-message","undo-id","button-links","strikethrough-ids","data-changed","data-test-id"])],10,L_),e.createElementVNode("div",{class:"input-container","data-test-id":`${t.dataTestId}-input-container`},[e.createVNode(M_,{modelValue:e.unref(n).promptMessage,"onUpdate:modelValue":u[0]||(u[0]=f=>e.unref(n).promptMessage=f),disabled:!i.value,"file-info":o.value,loading:!!e.unref(n).loadingMessage,"data-test-id":`${t.dataTestId}-input`,onSubmit:l,onFileUploadStatus:s},null,8,["modelValue","disabled","file-info","loading","data-test-id"])],8,P_)],8,R_))}},[["__scopeId","data-v-97dcc560"]]),$_={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},z_={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},j_={class:"ect-text-[40px] ect-leading-none ect-mb-3"},U_=e.createElementVNode("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),H_=e.createElementVNode("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),X_={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},K_={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("div",$_,[e.createElementVNode("div",z_,[e.createElementVNode("div",j_,[e.createVNode(Ee,{icon:"error",size:48})]),U_,H_,e.createElementVNode("div",X_,[e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=o=>r.$emit("return")),"data-test-id":"configurator-not-found-return"}," RETURN TO PRODUCT RESULTS "),e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[1]||(n[1]=o=>r.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},G_=t=>(e.pushScopeId("data-v-1f3fe309"),t=t(),e.popScopeId(),t),Q_={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},W_={key:4,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},Z_={class:"ect-text-center"},J_=G_(()=>e.createElementVNode("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),Y_={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},eC=pe({__name:"aiComponentLoader",props:{stepComponent:{type:String,default:null},identity:{type:Object,default:()=>({})},session:{type:Object,default:()=>({})},security:{type:Object,default:()=>({})},eCatalogId:{type:String,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:""}},setup(t){const r=t,n=er(),o=ic(),a=e.computed(()=>r.security||{}),i=e.computed(()=>{const D=r.security||{},M=D.url||D.baseUrl||"",$=r.composablesApiKey||r.apiKey||"";return{url:M,apiKey:$}}),l=e.computed(()=>{var D,M,$;return{orgType:r.composablesOrgType,orgId:(D=r.identity)==null?void 0:D.organizationId,userId:(M=r.identity)==null?void 0:M.userId,accountId:($=r.identity)==null?void 0:$.accountId,opportunityId:r.opportunityId,userLocale:r.userLocale||"en_US",pricingSchema:"Single"}}),s=e.computed(()=>{const D=n==null?void 0:n.activeComponentKey,M=r.stepComponent;return(D||M||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),c=e.computed(()=>{var K,J;const D=!!r.templateId,M=!!((K=r.identity)!=null&&K.organizationId),$=!!((J=r.identity)!=null&&J.accountId),L=typeof r.cartSections=="string"&&r.cartSections.length>0;return D&&M&&$&&L}),u=e.computed(()=>{var M;if(Array.isArray(r.catalogInitialData)&&r.catalogInitialData.length>0)return r.catalogInitialData;const D=((M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)||{};if(D.catalog&&typeof D.catalog=="object")try{const L=Object.values(D.catalog).map(K=>{var J;return(J=K==null?void 0:K.catalogResponse)==null?void 0:J.productInfo}).filter(Boolean);if(L.length>0)return L}catch{}return Array.isArray(D.initialData)&&D.initialData.length>0?D.initialData:Array.isArray(D.catalogInitialData)&&D.catalogInitialData.length>0?D.catalogInitialData:Array.isArray(D.items)&&D.items.length>0?D.items:[]}),f=e.computed(()=>{var M;const D=((M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)||{};return r.catalogSearchTerm||D.searchTerm||""}),y=e.computed(()=>{var M,$,L,K,J,Q;const D=((K=(L=($=(M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)==null?void 0:$.savedProducts)==null?void 0:L[0])==null?void 0:K.itemId)||((J=n==null?void 0:n.activeComponentData)==null?void 0:J.payload)&&Object.keys(((Q=n.activeComponentData.payload)==null?void 0:Q.quoteConfiguration)||{})[0]||"";return r.configItemId||D||""}),p=e.computed(()=>{var M,$,L,K;return((K=(L=($=(M=n==null?void 0:n.activeComponentData)==null?void 0:M.payload)==null?void 0:$.savedProducts)==null?void 0:L[0])==null?void 0:K.qliId)||""}),m=e.computed(()=>!!y.value),d=e.computed(()=>s.value==="configurator"&&!m.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":s.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":s.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),g=e.computed(()=>{try{return JSON.stringify((n==null?void 0:n.activeComponentData)||{})}catch{return""}}),h=e.computed(()=>`catalog::${g.value}`),x=e.computed(()=>`cart::${g.value}`),b=e.computed(()=>`configurator::${y.value||""}::${p.value||""}::${g.value}`),C=D=>{console.log("onQuoteCreated",D)},_=D=>{console.log("onQuoteUpdated",D)},E=D=>{console.log("onItemAdded",D)},w=D=>{console.log("onItemQtyUpdated",D)},N=D=>{console.log("onLineDeleted",D)},S=D=>{console.log("onQuoteItemsFetched",D)},T=()=>{var L,K;const D=((L=n==null?void 0:n.currentPlaybook)==null?void 0:L.playBookSteps)||[],M=J=>String(J||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),$=D.findIndex(J=>M(J==null?void 0:J.stepComponent)==="catalog"||M(J==null?void 0:J.stepName).includes("catalog"));if($>=0){const J=(K=D[$])==null?void 0:K.stepName;n.navigateToStep({stepName:J})}else n.showEmbeddedComponent("catalog")},A=()=>{var L,K;const D=((L=n==null?void 0:n.currentPlaybook)==null?void 0:L.playBookSteps)||[],M=J=>String(J||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),$=D.findIndex(J=>M(J==null?void 0:J.stepComponent)==="cart"||M(J==null?void 0:J.stepName).includes("cart"));if($>=0){const J=(K=D[$])==null?void 0:K.stepName;n.navigateToStep({stepName:J})}else n.showEmbeddedComponent("cart")},v=D=>{var M,$;console.log("onItemConfigureClicked",D);try{const L=(D==null?void 0:D.itemId)||"",K=(D==null?void 0:D.qliId)||(D==null?void 0:D.QliId)||"",J=[];if(L){const I={itemId:L};K&&(I.qliId=K),J.push(I)}const Q={payload:{savedProducts:J}},F=((M=n==null?void 0:n.currentPlaybook)==null?void 0:M.playBookSteps)||[],k=I=>String(I||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),O=F.findIndex(I=>{const R=k(I==null?void 0:I.stepComponent),q=k(I==null?void 0:I.stepName);return R==="configurator"||q.includes("configure")});if(O>=0){const I=($=F[O])==null?void 0:$.stepName;n.navigateToStep({stepName:I,data:Q})}else n.showEmbeddedComponent("configurator",Q)}catch(L){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",L),n.showEmbeddedComponent("configurator",{payload:{}})}},B=D=>{var M,$;try{const L=(D==null?void 0:D.itemId)||"",K=(D==null?void 0:D.lineItemId)||(D==null?void 0:D.qliId)||"",J=[];if(L){const I={itemId:L};K&&(I.qliId=K),J.push(I)}const Q={payload:{savedProducts:J}},F=((M=n==null?void 0:n.currentPlaybook)==null?void 0:M.playBookSteps)||[],k=I=>String(I||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),O=F.findIndex(I=>{const R=k(I==null?void 0:I.stepComponent),q=k(I==null?void 0:I.stepName);return R==="configurator"||q.includes("configure")});if(O>=0){const I=($=F[O])==null?void 0:$.stepName;n.navigateToStep({stepName:I,data:Q})}else n.showEmbeddedComponent("configurator",Q)}catch(L){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",L),n.showEmbeddedComponent("configurator",{payload:{}})}};return(D,M)=>{var $,L,K,J,Q,F,k;return e.openBlock(),e.createElementBlock("div",Q_,[s.value==="catalog"?(e.openBlock(),e.createBlock(vo,{key:h.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":t.templateId,identity:t.identity,session:t.session,security:a.value,"search-term":f.value,"on-catalog-count-update":t.onCatalogCountUpdate,"preview-data":t.catalogPreviewData,"initial-data":u.value,sections:t.sections,theme:t.theme,"host-name":t.hostName,"graphql-endpoint":t.graphqlEndpoint,"api-key":t.apiKey,"composables-org-type":t.composablesOrgType,onCatalogQuoteCreated:C,onCatalogQuoteUpdated:_,onCatalogItemAdded:E,onCatalogItemQtyUpdated:w,onCatalogLineDeleted:N,onCatalogItemsFetched:S,onCatalogItemConfigure:v},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","host-name","graphql-endpoint","api-key","composables-org-type"])):s.value==="cart"&&c.value?(e.openBlock(),e.createBlock(wo,{key:x.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":t.templateId,"organization-id":($=t.identity)==null?void 0:$.organizationId,"account-id":(L=t.identity)==null?void 0:L.accountId,cid:(K=t.identity)==null?void 0:K.contactId,"user-id":(J=t.identity)==null?void 0:J.userId,"quote-id":(Q=t.session)==null?void 0:Q.quoteId,"host-name":t.hostName,"graphql-endpoint":t.graphqlEndpoint,"api-key":t.apiKey,"composables-api-url":(F=t.security)==null?void 0:F.baseUrl,"composables-api-key":t.composablesApiKey,"composables-org-type":t.composablesOrgType,onExpeditecartItemConfigure:B},null,8,["template-id","organization-id","account-id","cid","user-id","quote-id","host-name","graphql-endpoint","api-key","composables-api-url","composables-api-key","composables-org-type"])):s.value==="configurator"&&m.value?(e.openBlock(),e.createBlock(xo,{key:b.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full","item-id":y.value,"qli-id":p.value||t.configQliId||void 0,"quote-id":(k=t.session)==null?void 0:k.quoteId,"security-context":i.value,"setup-data":l.value,onReady:e.unref(o).setExpediteConfigComp},null,8,["item-id","qli-id","quote-id","security-context","setup-data","onReady"])):s.value==="configurator"&&!m.value?(e.openBlock(),e.createBlock(K_,{key:3,onReturn:T,onGoCart:A})):(e.openBlock(),e.createElementBlock("div",W_,[e.createElementVNode("div",Z_,[J_,e.createElementVNode("div",Y_,e.toDisplayString(d.value),1)])]))])}}},[["__scopeId","data-v-1f3fe309"]]),tC={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},nC={key:0,class:"ai-guidance-loader"},rC={class:"ai-app-chat-wrapper"},oC={key:0,class:"component-loader-wrapper"},Ui=pe({__name:"aiGuidance",props:{playbookId:{type:String,required:!0},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},composablesApiKey:{type:String,required:!0},eCatalogId:{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:()=>({})}},setup(t){const r=er(),n=ft(),o=Pn(),a=e.ref(!1),i=e.ref(!1),l=e.ref(!0),s=e.ref(!0),c=e.ref(!1),u=t,{composablesOrgType:f,websocketUrl:y,packageVersion:p,composablesApiKey:m,eCatalogId:d,identity:g,session:h,security:x,templateId:b,hostName:C,graphqlEndpoint:_,apiKey:E,isPreview:w,catalogSections:N,cartSections:S,theme:T}=u;e.onBeforeMount(async()=>{console.log("composablesApiKey",m),console.log("security",x),console.log("apiKey",E),n.updateConfig({userId:g==null?void 0:g.userId,organizationId:g==null?void 0:g.organizationId,composablesApiKey:m,composablesApiUrl:x==null?void 0:x.baseUrl,composablesOrgType:f,websocketUrl:y,quoteId:h==null?void 0:h.quoteId,packageVersion:p,eCatalogId:d,accountId:g==null?void 0:g.accountId,templateId:b,hostName:C,graphqlEndpoint:_,apiKey:(x==null?void 0:x.apiKey)||E,cid:g==null?void 0:g.contactId,isPreview:w}),u.playbookId&&(i.value=!0)}),e.onMounted(async()=>{var B,D;a.value=!0,r.setEmbeddedMode(!0),u.playbookData?r.currentPlaybook=u.playbookData:i.value&&(await r.getPlaybookByKey(u.playbookId),r.showPlaybookSteps=!0),r.playbookStepsMode="full",o.setInitialPayload(),await o.connectSocket(),(D=(B=r.currentPlaybook)==null?void 0:B.playBookSteps)!=null&&D.length&&r.setCurrentStepName(r.currentPlaybook.playBookSteps[0].stepName),a.value=!1});const A=e.computed(()=>{var M;const B=((M=r.currentPlaybook)==null?void 0:M.playBookSteps)||[],D=r.currentStepName;return B.find($=>$.stepName===D)||B[0]||null}),v=e.computed(()=>{var B;return((B=A.value)==null?void 0:B.stepComponent)||null});return e.watch(()=>r.activeComponentKey,B=>{B&&(l.value=!1)}),(B,D)=>{var M;return e.openBlock(),e.createElementBlock("div",tC,[e.createVNode(ti,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),a.value?(e.openBlock(),e.createElementBlock("div",nC," Loading the AI Guidance component... ")):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ai-app",{"root-path":l.value,"playbook-steps-mode-full":e.unref(r).playbookStepsMode==="full","dxp-guiddance":i.value}])},[e.createElementVNode("div",rC,[e.createVNode(q_,{"data-test-id":"chat-screen","is-external-guidance":i.value},null,8,["is-external-guidance"])]),!l.value&&s.value&&!c.value?(e.openBlock(),e.createElementBlock("div",oC,[e.unref(r).currentPlaybook?(e.openBlock(),e.createBlock(eC,{key:0,"template-id":((M=A.value)==null?void 0:M.templateId)||e.unref(b),"step-component":v.value,identity:e.unref(g),session:e.unref(h),security:e.unref(x),"composables-org-type":e.unref(f),"composables-api-key":e.unref(m),"e-catalog-id":e.unref(d),"package-version":e.unref(p),"host-name":e.unref(C),"graphql-endpoint":e.unref(_),"api-key":e.unref(E),"is-preview":e.unref(w),sections:e.unref(N),"cart-sections":e.unref(S),theme:e.unref(T),"data-test-id":"aiComponentLoader-mounted"},null,8,["template-id","step-component","identity","session","security","composables-org-type","composables-api-key","e-catalog-id","package-version","host-name","graphql-endpoint","api-key","is-preview","sections","cart-sections","theme"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))])}}},[["__scopeId","data-v-37813fa7"]]),Qu={ExpediteConfigurator:xo,ExpediteGPT:fi,ExpediteCatalog:vo,ExpediteCart:wo,ExpediteAIGuidance:Ui},aC={install(t,r={}){t.component("ExpediteConfigurator",xo),t.component("ExpediteGPT",fi),t.component("ExpediteCatalog",vo),t.component("ExpediteCart",wo),t.component("ExpediteAIGuidance",Ui)},...Qu};dt.Components=Qu,dt.ExpediteAIGuidance=Ui,dt.ExpediteCart=wo,dt.ExpediteCatalog=vo,dt.ExpediteConfigurator=xo,dt.ExpediteGPT=fi,dt.default=aC,dt.useComRootStore=br,Object.defineProperties(dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|