@expedite-commerce/expedite-components 0.2.82 → 0.2.83
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.
|
@@ -37026,7 +37026,7 @@ const CC = ["innerHTML"], kC = {
|
|
|
37026
37026
|
])
|
|
37027
37027
|
]));
|
|
37028
37028
|
}
|
|
37029
|
-
}, xk = (e) => (Nt("data-v-
|
|
37029
|
+
}, xk = (e) => (Nt("data-v-2f2aa6e4"), e = e(), Pt(), e), _k = {
|
|
37030
37030
|
class: "ect-h-full ect-w-full ect-bg-white",
|
|
37031
37031
|
"data-test-id": "aiComponentLoader-wrapper"
|
|
37032
37032
|
}, Ck = {
|
|
@@ -37088,7 +37088,7 @@ const CC = ["innerHTML"], kC = {
|
|
|
37088
37088
|
setup(e, { emit: r }) {
|
|
37089
37089
|
const t = r, n = e, o = Lr(), a = kl(), i = Tt(), l = fe(() => ({
|
|
37090
37090
|
...n.session,
|
|
37091
|
-
qliId: y.value,
|
|
37091
|
+
qliId: y.value || n.configQliId || void 0,
|
|
37092
37092
|
itemId: f.value
|
|
37093
37093
|
})), u = fe(() => {
|
|
37094
37094
|
const I = o == null ? void 0 : o.activeComponentKey, B = n.stepComponent;
|
|
@@ -37299,73 +37299,67 @@ const CC = ["innerHTML"], kC = {
|
|
|
37299
37299
|
(I == null ? void 0 : I.actionFunction) === "Reload" && (console.log("Reloading configurator 1"), a.refresh());
|
|
37300
37300
|
},
|
|
37301
37301
|
{ deep: !0 }
|
|
37302
|
-
), (I, B) =>
|
|
37303
|
-
|
|
37304
|
-
|
|
37305
|
-
|
|
37306
|
-
|
|
37307
|
-
|
|
37308
|
-
|
|
37309
|
-
|
|
37310
|
-
|
|
37311
|
-
|
|
37312
|
-
|
|
37313
|
-
|
|
37314
|
-
|
|
37315
|
-
|
|
37316
|
-
|
|
37317
|
-
|
|
37318
|
-
|
|
37319
|
-
|
|
37320
|
-
|
|
37321
|
-
|
|
37322
|
-
|
|
37323
|
-
|
|
37324
|
-
|
|
37325
|
-
|
|
37326
|
-
|
|
37327
|
-
|
|
37328
|
-
|
|
37329
|
-
|
|
37330
|
-
|
|
37331
|
-
|
|
37332
|
-
|
|
37333
|
-
|
|
37334
|
-
|
|
37335
|
-
|
|
37336
|
-
|
|
37337
|
-
|
|
37338
|
-
|
|
37339
|
-
|
|
37340
|
-
|
|
37341
|
-
|
|
37342
|
-
|
|
37343
|
-
|
|
37344
|
-
|
|
37345
|
-
|
|
37346
|
-
|
|
37347
|
-
|
|
37348
|
-
|
|
37349
|
-
|
|
37350
|
-
|
|
37351
|
-
|
|
37352
|
-
|
|
37353
|
-
|
|
37354
|
-
|
|
37355
|
-
|
|
37356
|
-
|
|
37357
|
-
|
|
37358
|
-
|
|
37359
|
-
|
|
37360
|
-
|
|
37361
|
-
Ek,
|
|
37362
|
-
_("div", Ak, ye(b.value), 1)
|
|
37363
|
-
])
|
|
37364
|
-
]))
|
|
37365
|
-
]);
|
|
37366
|
-
};
|
|
37302
|
+
), (I, B) => (M(), $("div", _k, [
|
|
37303
|
+
u.value === "catalog" ? (M(), be(Ml, {
|
|
37304
|
+
key: x.value,
|
|
37305
|
+
"data-test-id": "aiComponentLoader-catalog",
|
|
37306
|
+
class: "ect-h-full ect-w-full",
|
|
37307
|
+
"template-id": e.templateId,
|
|
37308
|
+
identity: e.identity,
|
|
37309
|
+
session: e.session,
|
|
37310
|
+
security: e.security,
|
|
37311
|
+
"search-term": p.value,
|
|
37312
|
+
"on-catalog-count-update": e.onCatalogCountUpdate,
|
|
37313
|
+
"preview-data": e.catalogPreviewData,
|
|
37314
|
+
"initial-data": c.value,
|
|
37315
|
+
sections: e.sections,
|
|
37316
|
+
theme: e.theme,
|
|
37317
|
+
"composables-org-type": e.composablesOrgType,
|
|
37318
|
+
onCatalogQuoteCreated: T,
|
|
37319
|
+
onCatalogQuoteUpdated: F,
|
|
37320
|
+
onCatalogItemsLoaded: k,
|
|
37321
|
+
onCatalogItemAdded: O,
|
|
37322
|
+
onCatalogItemQtyUpdated: E,
|
|
37323
|
+
onCatalogLineDeleted: S,
|
|
37324
|
+
onCatalogItemsFetched: D,
|
|
37325
|
+
onCatalogItemConfigure: U,
|
|
37326
|
+
"onCatalog:id": G
|
|
37327
|
+
}, null, 8, ["template-id", "identity", "session", "security", "search-term", "on-catalog-count-update", "preview-data", "initial-data", "sections", "theme", "composables-org-type"])) : u.value === "cart" && s.value ? (M(), be(Fl, {
|
|
37328
|
+
key: m.value,
|
|
37329
|
+
"data-test-id": "aiComponentLoader-cart",
|
|
37330
|
+
class: "ect-h-full ect-w-full",
|
|
37331
|
+
"template-id": e.templateId,
|
|
37332
|
+
"host-name": e.hostName,
|
|
37333
|
+
"composables-org-type": e.composablesOrgType,
|
|
37334
|
+
security: e.security,
|
|
37335
|
+
identity: e.identity,
|
|
37336
|
+
session: e.session,
|
|
37337
|
+
onExpeditecartItemConfigure: ne,
|
|
37338
|
+
onExpeditecartClicked: Y
|
|
37339
|
+
}, null, 8, ["template-id", "host-name", "composables-org-type", "security", "identity", "session"])) : u.value === "configurator" && d.value ? (M(), be(Tl, {
|
|
37340
|
+
key: g.value,
|
|
37341
|
+
"data-test-id": "aiComponentLoader-configurator",
|
|
37342
|
+
class: "ect-h-full ect-w-full",
|
|
37343
|
+
security: e.security,
|
|
37344
|
+
identity: e.identity,
|
|
37345
|
+
"user-locale": I.userLocale,
|
|
37346
|
+
"composables-org-type": e.composablesOrgType,
|
|
37347
|
+
session: l.value,
|
|
37348
|
+
onReady: ke(a).setExpediteConfigComp,
|
|
37349
|
+
onAction: L
|
|
37350
|
+
}, null, 8, ["security", "identity", "user-locale", "composables-org-type", "session", "onReady"])) : u.value === "configurator" && !d.value ? (M(), be(bk, {
|
|
37351
|
+
key: 3,
|
|
37352
|
+
onReturn: q,
|
|
37353
|
+
onGoCart: V
|
|
37354
|
+
})) : (M(), $("div", Ck, [
|
|
37355
|
+
_("div", kk, [
|
|
37356
|
+
Ek,
|
|
37357
|
+
_("div", Ak, ye(b.value), 1)
|
|
37358
|
+
])
|
|
37359
|
+
]))
|
|
37360
|
+
]));
|
|
37367
37361
|
}
|
|
37368
|
-
}, Ik = /* @__PURE__ */ Se(wk, [["__scopeId", "data-v-
|
|
37362
|
+
}, Ik = /* @__PURE__ */ Se(wk, [["__scopeId", "data-v-2f2aa6e4"]]), Sk = {
|
|
37369
37363
|
class: "ai-guidance-loader",
|
|
37370
37364
|
"data-test-id": "aiGuidance-loader-container"
|
|
37371
37365
|
}, Ok = {
|
|
@@ -161,4 +161,4 @@
|
|
|
161
161
|
`+tt),ae&&Ro([N,D,L],Ot=>{tt=Mr(tt,Ot," ")}),x&&te?x.createHTML(tt):tt},o.setConfig=function(){let ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zt(ge),ne=!0},o.clearConfig=function(){gt=null,ne=!1},o.isValidAttribute=function(ge,ie,fe){gt||Zt({});const pe=Le(ge),Me=Le(ie);return ir(pe,Me,fe)},o.addHook=function(ge,ie){typeof ie=="function"&&Fr(v[ge],ie)},o.removeHook=function(ge,ie){if(ie!==void 0){const fe=$x(v[ge],ie);return fe===-1?void 0:zx(v[ge],fe,1)[0]}return $u(v[ge])},o.removeHooks=function(ge){v[ge]=[]},o.removeAllHooks=function(){v=Wu()},o}var a_=Zu();const i_=["innerHTML"],Ju=ye({__name:"MarkdownRenderer",props:{source:{type:String,default:""},wrapperClass:{type:[String,Array,Object],default:""}},setup(t){const o=t,n=new Mt({html:!1,linkify:!0,breaks:!0}),r=e.computed(()=>{const a=n.render(o.source||"");return a_.sanitize(a)});return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["markdown-renderer",t.wrapperClass]),innerHTML:r.value},null,10,i_))}},[["__scopeId","data-v-ecacea26"]]),l_={class:"message-content"},s_={key:0,class:"message-name"},c_={class:"ect-w-full"},u_={class:"message-content"},d_={class:"message-text ect-relative"},f_={class:"ect-pr-1"},h_={class:"loading-message-skeleton"},p_={key:1,class:"buttons-wrapper ect-mt-[-8px]"},m_=ye({__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 o=wl(),n=e.ref(null),r=e.ref(null);$n();const a=qn(),i=Jn(),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(),r.value&&(r.value.scrollTop=r.value.scrollHeight)})});const u=e.computed(()=>{var f;return(f=a.chatStyles)==null?void 0:f.bgColor}),d=e.computed(()=>`linear-gradient(180deg, ${u.value} 0%, transparent 100%)`),m=e.computed(()=>{var f;return(f=a.chatStyles)==null?void 0:f.textColor}),h=(f,_,p=!1)=>{if(typeof f=="string"&&f.startsWith("playbookNavigate:")){const C=f.slice(17);i.navigateToBean(C);return}f==="addProducts"?i.loadComponent("catalog"):f==="quoteDocument"?o.openQuoteDocument(_.requestId):f==="quoteItem"?i.loadComponent("cart"):f==="Undo"&&a.undoAction(_.requestId)},g=f=>{if(!f)return"";let _=f.replace(/\\r\\n/g,`
|
|
162
162
|
`).replace(/\\n/g,`
|
|
163
163
|
`).replace(/\\r/g,`
|
|
164
|
-
`);return _=_.replace(/^[ \t]*•[ \t]+/gm,"- "),_};return(f,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-messages",{"root-path":s.value}])},[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:d.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],(p,C)=>{var y;return e.openBlock(),e.createElementBlock("div",{key:C,class:e.normalizeClass(["message",{"user-message":p.type==="user"}])},[e.createElementVNode("div",l_,[p.name?(e.openBlock(),e.createElementBlock("div",s_,e.toDisplayString(p.name),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-text ect-relative",{"error-message":p.error,strikethrough:p.undone}]),style:e.normalizeStyle(p.type==="user"?{color:m.value,backgroundColor:u.value}:{})},[e.createElementVNode("div",c_,[e.createVNode(Ju,{source:g(p.message)},null,8,["source"])]),((y=p==null?void 0:p.filesData)==null?void 0:y.length)>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(p==null?void 0:p.filesData,b=>(e.openBlock(),e.createBlock(s7,{key:b.name,info:{iconUrl:(b==null?void 0:b.type)==="csv"?e.unref(Kc):e.unref(Gc),fileName:b==null?void 0:b.name,fileSize:b==null?void 0:b.size},background:p.type=="user"?"#fff":"#f8f8f8","encoded-string":b==null?void 0:b.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",u_,[e.createElementVNode("div",d_,[e.createElementVNode("div",{ref_key:"loadingWindowRef",ref:r,class:"loading-window"},[e.createElementVNode("div",f_,[e.createVNode(Ju,{source:g(t.loadingMessage)},null,8,["source"])])],512)]),e.createElementVNode("div",h_,[e.createVNode(wr,{style:{height:"100%",width:"100%"}})])])],2)],2)):t.buttonLinks.length>0?(e.openBlock(),e.createElementBlock("div",p_,[e.createVNode(r7,{links:t.buttonLinks,onPerformAction:h},null,8,["links"])])):e.createCommentVNode("",!0)],512)],2))}},[["__scopeId","data-v-47319f83"]]),y_={class:"ai-upload ect-flex-inline ect-items-center"},g_=ye({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(t,{emit:o}){const n=t,r=o,a=e.ref(null),i=e.ref(""),l=e.ref(""),s=e.ref(!1);e.watch(()=>n.resetFileInput,m=>{m&&a.value&&(a.value.value="",i.value="",l.value="")});const c=m=>{const g=a.value.accept.split(",").map(_=>_.trim().toLowerCase()),f="."+m.name.split(".").pop().toLowerCase();return g.includes(f)||g.includes(m.type.toLowerCase())?!0:g.some(_=>{if(_.includes("*")){const p=_.split("*")[0];return m.type.toLowerCase().startsWith(p)}return!1})},u=async m=>{const h=m.target.files[0];if(console.info("File = ",h),h){if(!c(h)){a.value&&(a.value.value="");const f={message:"Invalid file type. Please upload a valid file type.",fileName:h.name,fileType:h.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:f.message,life:5e3}),r("error",f);return}i.value=h.name,l.value=h.type.split("/").pop(),r("upload-status",{status:"uploading",fileName:i.value,fileType:l.value});const g=new FileReader;g.onload=async f=>{const _=new Blob([f.target.result],{type:h.type});console.info("Blob data:",_);try{const p=await M0(_),C={attachment:{name:h.name,data:p}};console.info("AIRequestPayload = ",C),r("upload-status",{status:"uploaded",fileName:i.value,fileType:l.value,size:kl(h.size),fileData:C}),a.value&&(a.value.value="")}catch(p){console.info("[ERROR]: File upload error:",p),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(p.message||"Unknown error"),life:5e3}),r("error",{message:"Error processing file",fileName:i.value,fileType:l.value,error:p.message}),r("upload-status",{status:"error",fileName:i.value,fileType:l.value})}},g.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:h.name,fileType:h.type,error:f})},setTimeout(()=>{g.readAsText(h)},100)}},d=()=>{a.value.click()};return(m,h)=>(e.openBlock(),e.createElementBlock("div",y_,[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:d,onMouseenter:h[0]||(h[0]=g=>s.value=!0),onMouseleave:h[1]||(h[1]=g=>s.value=!1)},[e.createVNode(Ee,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-7fbbb7c9"]]),b_={key:0,class:"suggestions-container"},x_={key:0,class:"logo-section"},__={class:"help-text-section"},C_={key:0,class:"help-text"},E_={key:1,class:"sub-help-text"},k_=["onClick"],v_={key:2,class:"suggestions-list"},w_=["onClick"],A_=ye({__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:o}){const n=t,r=o,a=e.ref(0),i=e.ref(0),l=e.ref(null),s=e.ref(null),c=h=>{l.value=h,i.value=0},u=()=>{l.value=null,a.value=0},d=h=>{r("select",h)},m=h=>{if(n.showSuggestions)switch(h.key){case"ArrowDown":h.preventDefault(),l.value?(i.value=(i.value+1)%l.value.subOptions.length,r("preview",l.value.subOptions[i.value])):(a.value=(a.value+1)%n.options.length,r("preview",n.options[a.value].title));break;case"ArrowUp":h.preventDefault(),l.value?(i.value=i.value-1<0?l.value.subOptions.length-1:i.value-1,r("preview",l.value.subOptions[i.value])):(a.value=a.value-1<0?n.options.length-1:a.value-1,r("preview",n.options[a.value].title));break;case"Enter":h.preventDefault(),l.value?d(l.value.subOptions[i.value]):c(n.options[a.value]);break;case"Escape":case"ArrowLeft":case"Backspace":l.value&&(h.preventDefault(),u());break}};return e.watch(()=>n.showSuggestions,h=>{h?(window.addEventListener("keydown",m),l.value=null,a.value=0,i.value=0):window.removeEventListener("keydown",m)}),(h,g)=>t.showSuggestions?(e.openBlock(),e.createElementBlock("div",b_,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",x_,[e.createVNode(H6)])),e.createElementVNode("div",__,[t.helpText&&!l.value?(e.openBlock(),e.createElementBlock("div",C_,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0),t.subHelpText?(e.openBlock(),e.createElementBlock("div",E_,e.toDisplayString(t.subHelpText),1)):e.createCommentVNode("",!0)]),l.value?(e.openBlock(),e.createElementBlock("div",v_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.subOptions,(f,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:e.normalizeClass(["sub-option",{"sub-active":i.value===_}]),onClick:p=>d(f)},e.toDisplayString(f),11,w_))),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,(f,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:e.normalizeClass(["suggestion-item",{active:a.value===_}]),onClick:p=>c(f)},e.toDisplayString(f.title),11,k_))),128))],512))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-bbb514b3"]]),B_={class:"chat-file-info"},N_={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},S_=["src"],I_={class:"ect-self-stretch ect-my-auto"},D_={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"},T_=ye({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(t,{emit:o}){const n=o,r=()=>{n("cancel")};return(a,i)=>(e.openBlock(),e.createElementBlock("div",B_,[e.createElementVNode("div",N_,[e.createElementVNode("img",{loading:"lazy",src:t.fileInfo.fileType==="csv"?e.unref(Kc):e.unref(Gc),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,S_),e.createElementVNode("div",I_,e.toDisplayString(t.fileInfo.fileName),1)]),t.fileInfo.status==="uploading"?(e.openBlock(),e.createElementBlock("div",D_,[e.createVNode(li,{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:r},[e.createVNode(Ee,{icon:"close",size:"8"})])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-24d881bd"]]),O_={class:"chat-input-wrapper"},V_={class:"chat-input-inner"},F_={class:"input-row"},M_=["disabled","placeholder","onKeydown"],R_={key:1,class:"icon-wrapper"},L_={class:"icon-wrapper"},P_=ye({__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:o}){const n=t,r=o;qn();const a=St(),i=Jn(),l=e.ref({}),s=e.ref(!1),c=e.ref(!1),u=e.ref(n.modelValue),d=e.ref(null),m=e.computed(()=>{const k=i.currentStep||null;return(Array.isArray(k==null?void 0:k.promptGuidance)?k.promptGuidance:[]).slice().sort((S,v)=>Number((S==null?void 0:S.sequenceNumber)??0)-Number((v==null?void 0:v.sequenceNumber)??0)).map(S=>{const N=(Array.isArray(S==null?void 0:S.relatedPG)?S.relatedPG:[]).slice().sort((D,L)=>Number((D==null?void 0:D.sequenceNumber)??0)-Number((L==null?void 0:L.sequenceNumber)??0)).map(D=>D.pgName);return{title:S.pgName,subOptions:N}})}),h=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?m.value:[]}),g=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?"Prompt Guidance":n.helpText});e.watch(()=>n.loading,async(k,I)=>{!k&&I&&(await e.nextTick(),d.value.focus())}),e.watch(u,k=>{r("update:modelValue",k),e.nextTick(()=>x())}),e.watch(()=>n.modelValue,k=>{u.value=k});const f=k=>{console.info("[ERROR]: File upload error:",k),a.handleError(k,"ChatInput")},_=()=>{u.value.trim()&&(c.value=!1,r("submit",u.value),u.value="",d.value&&(d.value.style.height="32px"),l.value=null)},p=k=>{u.value=k,c.value=!1,e.nextTick(()=>{x(),d.value&&(d.value.focus(),d.value.selectionStart=d.value.selectionEnd=u.value.length)})},C=k=>{u.value=k,e.nextTick(()=>x())},y=()=>{c.value=!1},b=k=>{console.info("handleFileUploadStatus event = ",k),k!=null&&k.fileName?(l.value=k,r("file-upload-status",k)):(l.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},x=()=>{const k=d.value;if(!k)return;k.style.height="auto";const S=Math.max(32,Math.min(k.scrollHeight,120));k.style.height=`${S}px`},E=()=>{console.info("removeFile"),l.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},w=()=>{c.value=!1,x()};return(k,I)=>{var S,v,N,D,L;const O=e.resolveDirective("click-outside");return e.withDirectives((e.openBlock(),e.createElementBlock("div",O_,[e.createVNode(A_,{options:h.value,"help-text":g.value,"sub-help-text":t.subHelpText,"show-suggestions":c.value,onSelect:p,onPreview:C},null,8,["options","help-text","sub-help-text","show-suggestions"]),e.createElementVNode("div",V_,[e.createElementVNode("div",F_,[e.createElementVNode("div",{class:e.normalizeClass(["icon-wrapper",{"active-suggestions":c.value,disabled:((S=h.value)==null?void 0:S.length)<=0}])},[e.createVNode(Ee,{disabled:((v=h.value)==null?void 0:v.length)<=0||t.loading,color:((N=h.value)==null?void 0:N.length)<=0?"#DEDEDE":c.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:I[0]||(I[0]=z=>c.value=!c.value)},null,8,["disabled","color"])],2),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":I[1]||(I[1]=z=>u.value=z),disabled:t.loading,placeholder:t.placeholder,rows:"1",onKeydown:e.withKeys(e.withModifiers(_,["exact","prevent"]),["enter"]),onInput:w},null,40,M_),[[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(g_,{"reset-file-input":s.value,onUploadStatus:b,onError:f},null,8,["reset-file-input"])],2)):e.createCommentVNode("",!0),t.showMic?(e.openBlock(),e.createElementBlock("div",R_,[e.createVNode(Ee,{color:"#828282",disabled:t.loading,icon:"mic",size:"13",height:15,onClick:I[2]||(I[2]=z=>k.$emit("speak"))},null,8,["disabled"])])):e.createCommentVNode("",!0),e.createElementVNode("div",L_,[(e.openBlock(),e.createBlock(Ee,{key:1,disabled:t.loading,icon:"send",size:"20",onClick:_},null,8,["disabled"]))])]),((D=l.value)==null?void 0:D.status)==="uploading"||((L=l.value)==null?void 0:L.status)==="uploaded"?(e.openBlock(),e.createBlock(T_,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":l.value,onCancel:E},null,8,["file-info"])):e.createCommentVNode("",!0)])])),[[O,y]])}}},[["__scopeId","data-v-e205d71c"]]),q_=["data-test-id"],$_=["data-test-id"],z_=["data-test-id"],j_=ye({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1},styles:{type:Object,required:!1,default:()=>({}),validator:t=>typeof(t==null?void 0:t.height)=="string"}},setup(t){const o=Jn(),n=qn(),r=e.ref(null),a=e.computed(()=>{var c;return((c=o.getCurrentStepLinks)==null?void 0:c.call(o))||[]}),i=e.computed(()=>!0),l=c=>{console.info("[aiChat] handleSubmit",{hasFileData:!!r.value,messageLength:(c||"").length}),r.value?(console.info("[aiChat] sending with file attachment"),n.sendMessage(c,!0,r.value)):(console.info("[aiChat] sending without attachment"),n.sendMessage(c))},s=c=>{console.info("ChatScreen handleFileUploadStatus event = ",c),c!=null&&c.fileData?(r.value=c.fileData,n.attachmentData={size:c.size,type:c.fileType,name:c.fileName}):(r.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(o).playbookStepsMode==="hybrid","playbook-steps-mode-full":e.unref(o).playbookStepsMode==="full","dxp-guiddance":t.isExternalGuidance}]),style:e.normalizeStyle({maxHeight:`calc(${t.styles.height} - 72px)`,height:`calc(${t.styles.height} - 72px)`}),"data-test-id":`${t.dataTestId}-messages-container`},[e.createVNode(m_,{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"])],14,$_),e.createElementVNode("div",{class:"input-container","data-test-id":`${t.dataTestId}-input-container`},[e.createVNode(P_,{modelValue:e.unref(n).promptMessage,"onUpdate:modelValue":u[0]||(u[0]=d=>e.unref(n).promptMessage=d),disabled:!i.value,"file-info":r.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,z_)],8,q_))}},[["__scopeId","data-v-99005673"]]),U_={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},H_={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},X_={class:"ect-text-[40px] ect-leading-none ect-mb-3"},K_=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),G_=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),Q_={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},W_={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("div",U_,[e.createElementVNode("div",H_,[e.createElementVNode("div",X_,[e.createVNode(Ee,{icon:"error",size:48})]),K_,G_,e.createElementVNode("div",Q_,[e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=r=>o.$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]=r=>o.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},Z_=t=>(e.pushScopeId("data-v-1dca0cd9"),t=t(),e.popScopeId(),t),J_={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},Y_={key:4,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},eC={class:"ect-text-center"},tC=Z_(()=>e.createElementVNode("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),nC={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},rC=ye({__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","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(t,{emit:o}){const n=o,r=t,a=Jn(),i=ri(),l=it(),s=e.computed(()=>({...r.session,qliId:g.value,itemId:h.value})),c=e.computed(()=>{const B=a==null?void 0:a.activeComponentKey,T=r.stepComponent;return(B||T||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),u=e.computed(()=>{var M,q;const B=!!r.templateId,T=!!((M=r.identity)!=null&&M.organizationId),R=!!((q=r.identity)!=null&&q.accountId),P=typeof r.cartSections=="string"&&r.cartSections.length>0;return B&&T&&R&&P}),d=e.computed(()=>{var T;if(Array.isArray(r.catalogInitialData)&&r.catalogInitialData.length>0)return r.catalogInitialData;const B=((T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)||{};if(B.catalog&&typeof B.catalog=="object")try{const P=Object.values(B.catalog).map(M=>{var q;return(q=M==null?void 0:M.catalogResponse)==null?void 0:q.productInfo}).filter(Boolean);if(P.length>0)return P}catch{}return Array.isArray(B.initialData)&&B.initialData.length>0?B.initialData:Array.isArray(B.catalogInitialData)&&B.catalogInitialData.length>0?B.catalogInitialData:Array.isArray(B.items)&&B.items.length>0?B.items:[]}),m=e.computed(()=>{var T;const B=((T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)||{};return r.catalogSearchTerm||B.searchTerm||""}),h=e.computed(()=>{var T,R,P,M,q,U;const B=((M=(P=(R=(T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)==null?void 0:R.savedProducts)==null?void 0:P[0])==null?void 0:M.itemId)||((q=a==null?void 0:a.activeComponentData)==null?void 0:q.payload)&&Object.keys(((U=a.activeComponentData.payload)==null?void 0:U.quoteConfiguration)||{})[0]||"";return r.configItemId||B||""}),g=e.computed(()=>{var T,R,P,M,q,U,Q,G;const B=(M=(P=(R=(T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)==null?void 0:R.savedProducts)==null?void 0:P[0])==null?void 0:M.qliId;if(!B){console.log("[aiComponentLoader] configQliIdComputed: No qliId from savedProducts");const re=(U=(q=a==null?void 0:a.activeComponentData)==null?void 0:q.payload)==null?void 0:U.quoteConfiguration;if(console.log("[aiComponentLoader] configQliIdComputed: quoteConfiguration:",re),re&&typeof re=="object"){const ae=Object.keys(re)[0];if(console.log("[aiComponentLoader] configQliIdComputed: firstItemId:",ae),ae){const Z=(Q=re[ae])==null?void 0:Q.product;if(console.log("[aiComponentLoader] configQliIdComputed: productObj:",Z),Z&&Z.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId in productObj:",Z.qliId),Z.qliId;if((G=re[ae])!=null&&G.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId directly under itemId:",re[ae].qliId),re[ae].qliId}}}return B||""}),f=e.computed(()=>!!h.value),_=e.computed(()=>c.value==="configurator"&&!f.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":c.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":c.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),p=e.computed(()=>{try{return JSON.stringify((a==null?void 0:a.activeComponentData)||{})}catch{return""}}),C=e.computed(()=>`catalog::${p.value}`),y=e.computed(()=>`cart::${p.value}`),b=e.computed(()=>{var B;try{return(((B=a==null?void 0:a.activeComponentData)==null?void 0:B.actionFunction)||"")==="Reload"}catch{return!1}}),x=e.computed(()=>{var T;const B=`configurator::${h.value||""}::${g.value||""}`;if(b.value){const R=((T=a==null?void 0:a.activeComponentData)==null?void 0:T.requestId)||"";return`${B}::${R}`}return B}),E=e.ref([]),w=e.ref(null),k=B=>{const T=Array.isArray(B)?B:Array.isArray(B==null?void 0:B.items)?B.items:[];if(!Array.isArray(T))return;const R={"Needs Configuration":1,"Suggests Configuration":2,"Fully Configured":3},P=U=>(U==null?void 0:U.requiresConfiguration)||"",M=U=>!!U&&U in R,q=T.filter(U=>M(P(U)));q.sort((U,Q)=>{const G=P(U),re=P(Q);return(R[G]||99)-(R[re]||99)}),E.value=q,w.value=q.length?q[0]:null},I=B=>{console.log("onQuoteCreated",B),n("catalog-quote-created",B)},O=B=>{console.log("onQuoteUpdated",B),n("catalog-quote-updated",B)},S=B=>{console.log("onItemAdded",B),n("catalog-item-added",B)},v=B=>{console.log("onItemQtyUpdated",B),n("catalog-item-qty-updated",B)},N=B=>{console.log("onLineDeleted",B),n("catalog-line-deleted",B)},D=B=>{console.log("onQuoteItemsFetched",B),n("catalog-items-fetched",B)};e.watch(()=>c.value,(B,T)=>{var R,P,M,q,U,Q,G,re,ae,Z,K;if(B==="configurator"){const ne=!!((M=(P=(R=a==null?void 0:a.activeComponentData)==null?void 0:R.payload)==null?void 0:P.savedProducts)!=null&&M.length),J=!!((U=(q=a==null?void 0:a.activeComponentData)==null?void 0:q.payload)!=null&&U.quoteConfiguration&&Object.keys(((G=(Q=a==null?void 0:a.activeComponentData)==null?void 0:Q.payload)==null?void 0:G.quoteConfiguration)||{}).length>0);if(!ne&&!J&&w.value&&!h.value){const ee=((re=w.value)==null?void 0:re.itemId)||"";if(ee){const j=((ae=a==null?void 0:a.currentPlaybook)==null?void 0:ae.playBookSteps)||[],te=he=>String(he||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");let se=null;const le=j.findIndex(he=>he.stepName===(a==null?void 0:a.currentStepName));if(le>=0&&j[le+1]&&te((Z=j[le+1])==null?void 0:Z.stepComponent)==="configurator")se=j[le+1].stepName;else{const he=j.findIndex(me=>te(me==null?void 0:me.stepComponent)==="configurator");se=he>=0?(K=j[he])==null?void 0:K.stepName:null}const ce={payload:{savedProducts:[{itemId:ee}]}};se?a.navigateToStep({stepName:se,data:ce}):a.loadComponent("configurator",ce)}}}});const L=()=>{var P,M;const B=((P=a==null?void 0:a.currentPlaybook)==null?void 0:P.playBookSteps)||[],T=q=>String(q||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),R=B.findIndex(q=>T(q==null?void 0:q.stepComponent)==="catalog"||T(q==null?void 0:q.stepName).includes("catalog"));if(R>=0){const q=(M=B[R])==null?void 0:M.stepName;a.navigateToStep({stepName:q})}else a.loadComponent("catalog")},z=()=>{var P,M;const B=((P=a==null?void 0:a.currentPlaybook)==null?void 0:P.playBookSteps)||[],T=q=>String(q||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),R=B.findIndex(q=>T(q==null?void 0:q.stepComponent)==="cart"||T(q==null?void 0:q.stepName).includes("cart"));if(R>=0){const q=(M=B[R])==null?void 0:M.stepName;a.navigateToStep({stepName:q})}else a.loadComponent("cart")},$=B=>{var T,R;console.log("onItemConfigureClicked",B),n("catalog-item-configure",B);try{const P=(B==null?void 0:B.itemId)||"",M=(B==null?void 0:B.qliId)||(B==null?void 0:B.QliId)||"",q=[];if(P){const ae={itemId:P};M&&(ae.qliId=M),q.push(ae)}const U={payload:{savedProducts:q}},Q=((T=a==null?void 0:a.currentPlaybook)==null?void 0:T.playBookSteps)||[],G=ae=>String(ae||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),re=Q.findIndex(ae=>{const Z=G(ae==null?void 0:ae.stepComponent),K=G(ae==null?void 0:ae.stepName);return Z==="configurator"||K.includes("configure")});if(re>=0){const ae=(R=Q[re])==null?void 0:R.stepName;a.navigateToStep({stepName:ae,data:U})}else a.loadComponent("configurator",U)}catch(P){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",P),a.loadComponent("configurator",{payload:{}})}},W=B=>{console.log("onCartClicked",B),n("expeditecart-clicked",B)},Y=B=>{var T,R;try{const P=(B==null?void 0:B.itemId)||"",M=(B==null?void 0:B.lineItemId)||(B==null?void 0:B.qliId)||"",q=[];if(P){const ae={itemId:P};M&&(ae.qliId=M),q.push(ae)}const U={payload:{savedProducts:q}},Q=((T=a==null?void 0:a.currentPlaybook)==null?void 0:T.playBookSteps)||[],G=ae=>String(ae||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),re=Q.findIndex(ae=>{const Z=G(ae==null?void 0:ae.stepComponent),K=G(ae==null?void 0:ae.stepName);return Z==="configurator"||K.includes("configure")});if(re>=0){const ae=(R=Q[re])==null?void 0:R.stepName;a.navigateToStep({stepName:ae,data:U})}else a.loadComponent("configurator",U)}catch(P){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",P),a.loadComponent("configurator",{payload:{}})}},H=B=>{console.log("onCatalogIdReceived",B),l.updateConfig({eCatalogId:B})},F=B=>{console.log("Action",B),B.event==="add-to-quote"?n("configurator:add-to-quote",B.data):B.event==="save"&&n("configurator:save",B.data)},A=e.ref("");return e.watch(()=>a==null?void 0:a.activeComponentData,async B=>{var R,P,M;if(!B)return;console.log("activeComponentData Changed",B);const T=(B==null?void 0:B.requestId)||"";if(console.log("requestId",T),console.log("lastReloadRequestId",A.value),T&&T!==A.value)if(A.value=T,await e.nextTick(),(R=B==null?void 0:B.payload)!=null&&R.quoteConfiguration&&Object.keys(((P=B==null?void 0:B.payload)==null?void 0:P.quoteConfiguration)??{}).length>0){const q=Object.keys(((M=B==null?void 0:B.payload)==null?void 0:M.quoteConfiguration)??{})[0];i.setPreConfigData(B==null?void 0:B.payload,q)}else(B==null?void 0:B.actionFunction)==="Reload"&&(console.log("Reloading configurator 1"),i.refresh())},{deep:!0}),(B,T)=>{var R;return e.openBlock(),e.createElementBlock("div",J_,[c.value==="catalog"?(e.openBlock(),e.createBlock(Ao,{key:C.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":t.templateId,identity:t.identity,session:t.session,security:t.security,"search-term":m.value,"on-catalog-count-update":t.onCatalogCountUpdate,"preview-data":t.catalogPreviewData,"initial-data":d.value,sections:t.sections,theme:t.theme,"composables-org-type":t.composablesOrgType,onCatalogQuoteCreated:I,onCatalogQuoteUpdated:O,onCatalogItemsLoaded:k,onCatalogItemAdded:S,onCatalogItemQtyUpdated:v,onCatalogLineDeleted:N,onCatalogItemsFetched:D,onCatalogItemConfigure:$,"onCatalog:id":H},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","composables-org-type"])):c.value==="cart"&&u.value?(e.openBlock(),e.createBlock(Bo,{key:y.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":t.templateId,"host-name":t.hostName,"composables-org-type":t.composablesOrgType,security:t.security,identity:t.identity,session:t.session,onExpeditecartItemConfigure:Y,onExpeditecartClicked:W},null,8,["template-id","host-name","composables-org-type","security","identity","session"])):c.value==="configurator"&&f.value?(e.openBlock(),e.createBlock(Co,{key:x.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full","item-id":h.value,"qli-id":g.value||t.configQliId||void 0,"quote-id":(R=t.session)==null?void 0:R.quoteId,security:t.security,identity:t.identity,"user-locale":B.userLocale,"composables-org-type":t.composablesOrgType,session:s.value,onReady:e.unref(i).setExpediteConfigComp,onAction:F},null,8,["item-id","qli-id","quote-id","security","identity","user-locale","composables-org-type","session","onReady"])):c.value==="configurator"&&!f.value?(e.openBlock(),e.createBlock(W_,{key:3,onReturn:L,onGoCart:z})):(e.openBlock(),e.createElementBlock("div",Y_,[e.createElementVNode("div",eC,[tC,e.createElementVNode("div",nC,e.toDisplayString(_.value),1)])]))])}}},[["__scopeId","data-v-1dca0cd9"]]),oC={class:"ai-guidance-loader","data-test-id":"aiGuidance-loader-container"},aC={class:"aig-message-text","data-test-id":"aiGuidance-loader-message"},iC={class:"aig-button","data-test-id":"aiGuidance-loader-button"},lC={class:"aig-input-box","data-test-id":"aiGuidance-loader-input"},sC=ye({__name:"AiGuidanceLoader",props:{errors:{type:Array,required:!1,default:()=>[]}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("div",oC,[e.createElementVNode("div",aC,[e.createVNode(wr,{style:{height:"16px",width:"90%","margin-bottom":"8px"}}),e.createVNode(wr,{style:{height:"16px",width:"65%","margin-bottom":"20px"}})]),e.createElementVNode("div",iC,[e.createVNode(wr,{style:{height:"40px",width:"100%"}})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.errors,r=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"aig-message-error","data-test-id":"aiGuidance-loader-error"},e.toDisplayString(r),1))),128)),e.createElementVNode("div",lC,[e.createVNode(wr,{style:{height:"40px",width:"100%"}})])]))}},[["__scopeId","data-v-aae34926"]]),cC={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},Qi=ye({__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:t=>typeof(t==null?void 0:t.height)=="string"}},emits:["expeditecart-item-configure","expeditecart-clicked","component-action","ai-response:success"],setup(t,{emit:o}){const n=Jn(),r=it(),a=qn(),i=yr(),l=o,s=e.ref(!0),c=e.ref(!1),u=e.ref(!0),d=e.ref(!0),m=e.ref(!1),h=e.ref([]),g=t,{composablesOrgType:f,websocketUrl:_,packageVersion:p,identity:C,session:y,security:b,templateId:x,hostName:E,graphqlEndpoint:w,apiKey:k,isPreview:I,catalogSections:O,cartSections:S,theme:v}=g;e.onBeforeMount(async()=>{console.log("security",b),console.log("apiKey",k),r.updateConfig({userId:C==null?void 0:C.userId,organizationId:C==null?void 0:C.organizationId,accessToken:b==null?void 0:b.accessToken,composablesApiUrl:b==null?void 0:b.baseUrl,composablesOrgType:f,websocketUrl:_,quoteId:y==null?void 0:y.quoteId,packageVersion:p,accountId:C==null?void 0:C.accountId,templateId:x,hostName:E,graphqlEndpoint:w,apiKey:(b==null?void 0:b.apiKey)||k,cid:C==null?void 0:C.contactId,isPreview:I})}),e.onMounted(async()=>{var A,B,T,R;n.setSecretKey(b==null?void 0:b.accessToken);const Y=await n.getPlaybookInfoFromQuote();let H=(Y==null?void 0:Y.XX_ORD1__Completed_PB_Step_Number_EX__c)??void 0,F=(Y==null?void 0:Y.XX_ORD1__Playbook_Current_Step_Meta_EX__c)??void 0;if(F&&(F=JSON.parse(F)),console.info("sequenceNumberServer = ",H),g.templateId){s.value=!0;const P=await n.getCatalogInContext();console.log("catalogInContext = ",P),P&&r.updateConfig({eCatalogId:P}),await i.fetchBlockInformationREST({templateId:g.templateId});const M=i.pageBlocks[0].blocks[0].playbookId;if(console.log("playbookID",M),M?c.value=!0:h.value.push("No playbook ID found in template"),n.setEmbeddedMode(!0),M&&(n.currentPlaybook=M,await n.getPlaybookByKey(M),n.showPlaybookSteps=!0),n.playbookStepsMode="full",a.setInitialPayload(),await a.connectSocket(),H!==void 0){n.navigateToStep({stepName:(B=(A=n.currentPlaybook)==null?void 0:A.playBookSteps[Number(H)])==null?void 0:B.stepName,data:F}),s.value=!1;return}(R=(T=n.currentPlaybook)==null?void 0:T.playBookSteps)!=null&&R.length&&n.setCurrentStepName(n.currentPlaybook.playBookSteps[0].stepName),s.value=!1}else h.value.push("templateId is required")});const N=e.computed(()=>{var F;const Y=((F=n.currentPlaybook)==null?void 0:F.playBookSteps)||[],H=n.currentStepName;return Y.find(A=>A.stepName===H)||Y[0]||null}),D=e.computed(()=>{var Y;return((Y=N.value)==null?void 0:Y.stepComponent)||null});e.watch(()=>n.activeComponentKey,Y=>{Y&&(u.value=!1)});const L=[];e.onMounted(()=>{L.push(jt("expeditecart:configure-clicked",Y=>{l("expeditecart-item-configure",Y)})),L.push(jt("expeditecart:clicked",Y=>{l("expeditecart-clicked",Y)})),L.push(jt("ai-response:success",Y=>{try{l("ai-response:success",Y)}catch{}}))});const z=Y=>{console.log("onExpediteCartClicked",Y),l("component-action",{component:"cart",details:Y})},$=(Y,H)=>{l("component-action",{component:"catalog",action:Y,details:H})},W=(Y,H)=>{l("component-action",{component:"configurator",action:Y,details:H})};return e.onBeforeUnmount(()=>{try{a.cancelRequest()}catch{}try{a.disconnectSocket()}catch{}try{a.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,c.value=!1,u.value=!0,d.value=!0,m.value=!1,h.value=[],L.forEach(Y=>{try{Y()}catch{}})}),(Y,H)=>{var F;return e.openBlock(),e.createElementBlock("div",cC,[e.createVNode(ii,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),s.value?(e.openBlock(),e.createBlock(sC,{key:0,errors:h.value,"data-test-id":"aiGuidance-loader"},null,8,["errors"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ai-app",{"root-path":u.value,"playbook-steps-mode-full":e.unref(n).playbookStepsMode==="full","dxp-guiddance":c.value}]),style:e.normalizeStyle(t.styles)},[e.createElementVNode("div",{class:"ai-app-chat-wrapper",style:e.normalizeStyle({height:t.styles.height})},[e.createVNode(j_,{"data-test-id":"chat-screen","is-external-guidance":c.value,styles:t.styles},null,8,["is-external-guidance","styles"])],4),!u.value&&d.value&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"component-loader-wrapper",style:e.normalizeStyle({height:t.styles.height,maxHeight:t.styles.height})},[e.unref(n).currentPlaybook?(e.openBlock(),e.createBlock(rC,{key:0,"template-id":((F=N.value)==null?void 0:F.templateId)||e.unref(x),"step-component":D.value,identity:e.unref(C),session:e.unref(y),security:e.unref(b),"composables-org-type":e.unref(f),"package-version":e.unref(p),"host-name":e.unref(E),"graphql-endpoint":e.unref(w),"api-key":e.unref(k),"is-preview":e.unref(I),sections:e.unref(O),"cart-sections":e.unref(S),theme:e.unref(v),"data-test-id":"aiComponentLoader-mounted",onExpeditecartClicked:z,onCatalogQuoteCreated:H[0]||(H[0]=A=>$("quote-created",A)),onCatalogQuoteUpdated:H[1]||(H[1]=A=>$("quote-updated",A)),onCatalogItemsLoaded:H[2]||(H[2]=A=>$("items-loaded",A)),onCatalogItemAdded:H[3]||(H[3]=A=>$("item-added",A)),onCatalogItemQtyUpdated:H[4]||(H[4]=A=>$("item-qty-updated",A)),onCatalogLineDeleted:H[5]||(H[5]=A=>$("line-deleted",A)),onCatalogItemsFetched:H[6]||(H[6]=A=>$("items-fetched",A)),onCatalogItemConfigure:H[7]||(H[7]=A=>$("item-configure",A)),"onConfigurator:addToQuote":H[8]||(H[8]=A=>W("add-to-quote",A)),"onConfigurator:save":H[9]||(H[9]=A=>W("save",A))},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"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)],6))])}}},[["__scopeId","data-v-ee278ef7"]]),Yu={ExpediteConfigurator:Co,ExpediteGPT:gi,ExpediteCatalog:Ao,ExpediteCart:Bo,ExpediteAIGuidance:Qi},uC={install(t,o={}){t.component("ExpediteConfigurator",Co),t.component("ExpediteGPT",gi),t.component("ExpediteCatalog",Ao),t.component("ExpediteCart",Bo),t.component("ExpediteAIGuidance",Qi)},...Yu};ft.Components=Yu,ft.ExpediteAIGuidance=Qi,ft.ExpediteCart=Bo,ft.ExpediteCatalog=Ao,ft.ExpediteConfigurator=Co,ft.ExpediteGPT=gi,ft.default=uC,ft.useComRootStore=Cr,Object.defineProperties(ft,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
164
|
+
`);return _=_.replace(/^[ \t]*•[ \t]+/gm,"- "),_};return(f,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-messages",{"root-path":s.value}])},[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:d.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],(p,C)=>{var y;return e.openBlock(),e.createElementBlock("div",{key:C,class:e.normalizeClass(["message",{"user-message":p.type==="user"}])},[e.createElementVNode("div",l_,[p.name?(e.openBlock(),e.createElementBlock("div",s_,e.toDisplayString(p.name),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-text ect-relative",{"error-message":p.error,strikethrough:p.undone}]),style:e.normalizeStyle(p.type==="user"?{color:m.value,backgroundColor:u.value}:{})},[e.createElementVNode("div",c_,[e.createVNode(Ju,{source:g(p.message)},null,8,["source"])]),((y=p==null?void 0:p.filesData)==null?void 0:y.length)>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(p==null?void 0:p.filesData,b=>(e.openBlock(),e.createBlock(s7,{key:b.name,info:{iconUrl:(b==null?void 0:b.type)==="csv"?e.unref(Kc):e.unref(Gc),fileName:b==null?void 0:b.name,fileSize:b==null?void 0:b.size},background:p.type=="user"?"#fff":"#f8f8f8","encoded-string":b==null?void 0:b.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",u_,[e.createElementVNode("div",d_,[e.createElementVNode("div",{ref_key:"loadingWindowRef",ref:r,class:"loading-window"},[e.createElementVNode("div",f_,[e.createVNode(Ju,{source:g(t.loadingMessage)},null,8,["source"])])],512)]),e.createElementVNode("div",h_,[e.createVNode(wr,{style:{height:"100%",width:"100%"}})])])],2)],2)):t.buttonLinks.length>0?(e.openBlock(),e.createElementBlock("div",p_,[e.createVNode(r7,{links:t.buttonLinks,onPerformAction:h},null,8,["links"])])):e.createCommentVNode("",!0)],512)],2))}},[["__scopeId","data-v-47319f83"]]),y_={class:"ai-upload ect-flex-inline ect-items-center"},g_=ye({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(t,{emit:o}){const n=t,r=o,a=e.ref(null),i=e.ref(""),l=e.ref(""),s=e.ref(!1);e.watch(()=>n.resetFileInput,m=>{m&&a.value&&(a.value.value="",i.value="",l.value="")});const c=m=>{const g=a.value.accept.split(",").map(_=>_.trim().toLowerCase()),f="."+m.name.split(".").pop().toLowerCase();return g.includes(f)||g.includes(m.type.toLowerCase())?!0:g.some(_=>{if(_.includes("*")){const p=_.split("*")[0];return m.type.toLowerCase().startsWith(p)}return!1})},u=async m=>{const h=m.target.files[0];if(console.info("File = ",h),h){if(!c(h)){a.value&&(a.value.value="");const f={message:"Invalid file type. Please upload a valid file type.",fileName:h.name,fileType:h.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:f.message,life:5e3}),r("error",f);return}i.value=h.name,l.value=h.type.split("/").pop(),r("upload-status",{status:"uploading",fileName:i.value,fileType:l.value});const g=new FileReader;g.onload=async f=>{const _=new Blob([f.target.result],{type:h.type});console.info("Blob data:",_);try{const p=await M0(_),C={attachment:{name:h.name,data:p}};console.info("AIRequestPayload = ",C),r("upload-status",{status:"uploaded",fileName:i.value,fileType:l.value,size:kl(h.size),fileData:C}),a.value&&(a.value.value="")}catch(p){console.info("[ERROR]: File upload error:",p),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(p.message||"Unknown error"),life:5e3}),r("error",{message:"Error processing file",fileName:i.value,fileType:l.value,error:p.message}),r("upload-status",{status:"error",fileName:i.value,fileType:l.value})}},g.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:h.name,fileType:h.type,error:f})},setTimeout(()=>{g.readAsText(h)},100)}},d=()=>{a.value.click()};return(m,h)=>(e.openBlock(),e.createElementBlock("div",y_,[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:d,onMouseenter:h[0]||(h[0]=g=>s.value=!0),onMouseleave:h[1]||(h[1]=g=>s.value=!1)},[e.createVNode(Ee,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-7fbbb7c9"]]),b_={key:0,class:"suggestions-container"},x_={key:0,class:"logo-section"},__={class:"help-text-section"},C_={key:0,class:"help-text"},E_={key:1,class:"sub-help-text"},k_=["onClick"],v_={key:2,class:"suggestions-list"},w_=["onClick"],A_=ye({__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:o}){const n=t,r=o,a=e.ref(0),i=e.ref(0),l=e.ref(null),s=e.ref(null),c=h=>{l.value=h,i.value=0},u=()=>{l.value=null,a.value=0},d=h=>{r("select",h)},m=h=>{if(n.showSuggestions)switch(h.key){case"ArrowDown":h.preventDefault(),l.value?(i.value=(i.value+1)%l.value.subOptions.length,r("preview",l.value.subOptions[i.value])):(a.value=(a.value+1)%n.options.length,r("preview",n.options[a.value].title));break;case"ArrowUp":h.preventDefault(),l.value?(i.value=i.value-1<0?l.value.subOptions.length-1:i.value-1,r("preview",l.value.subOptions[i.value])):(a.value=a.value-1<0?n.options.length-1:a.value-1,r("preview",n.options[a.value].title));break;case"Enter":h.preventDefault(),l.value?d(l.value.subOptions[i.value]):c(n.options[a.value]);break;case"Escape":case"ArrowLeft":case"Backspace":l.value&&(h.preventDefault(),u());break}};return e.watch(()=>n.showSuggestions,h=>{h?(window.addEventListener("keydown",m),l.value=null,a.value=0,i.value=0):window.removeEventListener("keydown",m)}),(h,g)=>t.showSuggestions?(e.openBlock(),e.createElementBlock("div",b_,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",x_,[e.createVNode(H6)])),e.createElementVNode("div",__,[t.helpText&&!l.value?(e.openBlock(),e.createElementBlock("div",C_,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0),t.subHelpText?(e.openBlock(),e.createElementBlock("div",E_,e.toDisplayString(t.subHelpText),1)):e.createCommentVNode("",!0)]),l.value?(e.openBlock(),e.createElementBlock("div",v_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.subOptions,(f,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:e.normalizeClass(["sub-option",{"sub-active":i.value===_}]),onClick:p=>d(f)},e.toDisplayString(f),11,w_))),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,(f,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:e.normalizeClass(["suggestion-item",{active:a.value===_}]),onClick:p=>c(f)},e.toDisplayString(f.title),11,k_))),128))],512))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-bbb514b3"]]),B_={class:"chat-file-info"},N_={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},S_=["src"],I_={class:"ect-self-stretch ect-my-auto"},D_={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"},T_=ye({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(t,{emit:o}){const n=o,r=()=>{n("cancel")};return(a,i)=>(e.openBlock(),e.createElementBlock("div",B_,[e.createElementVNode("div",N_,[e.createElementVNode("img",{loading:"lazy",src:t.fileInfo.fileType==="csv"?e.unref(Kc):e.unref(Gc),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,S_),e.createElementVNode("div",I_,e.toDisplayString(t.fileInfo.fileName),1)]),t.fileInfo.status==="uploading"?(e.openBlock(),e.createElementBlock("div",D_,[e.createVNode(li,{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:r},[e.createVNode(Ee,{icon:"close",size:"8"})])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-24d881bd"]]),O_={class:"chat-input-wrapper"},V_={class:"chat-input-inner"},F_={class:"input-row"},M_=["disabled","placeholder","onKeydown"],R_={key:1,class:"icon-wrapper"},L_={class:"icon-wrapper"},P_=ye({__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:o}){const n=t,r=o;qn();const a=St(),i=Jn(),l=e.ref({}),s=e.ref(!1),c=e.ref(!1),u=e.ref(n.modelValue),d=e.ref(null),m=e.computed(()=>{const k=i.currentStep||null;return(Array.isArray(k==null?void 0:k.promptGuidance)?k.promptGuidance:[]).slice().sort((S,v)=>Number((S==null?void 0:S.sequenceNumber)??0)-Number((v==null?void 0:v.sequenceNumber)??0)).map(S=>{const N=(Array.isArray(S==null?void 0:S.relatedPG)?S.relatedPG:[]).slice().sort((D,L)=>Number((D==null?void 0:D.sequenceNumber)??0)-Number((L==null?void 0:L.sequenceNumber)??0)).map(D=>D.pgName);return{title:S.pgName,subOptions:N}})}),h=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?m.value:[]}),g=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?"Prompt Guidance":n.helpText});e.watch(()=>n.loading,async(k,I)=>{!k&&I&&(await e.nextTick(),d.value.focus())}),e.watch(u,k=>{r("update:modelValue",k),e.nextTick(()=>x())}),e.watch(()=>n.modelValue,k=>{u.value=k});const f=k=>{console.info("[ERROR]: File upload error:",k),a.handleError(k,"ChatInput")},_=()=>{u.value.trim()&&(c.value=!1,r("submit",u.value),u.value="",d.value&&(d.value.style.height="32px"),l.value=null)},p=k=>{u.value=k,c.value=!1,e.nextTick(()=>{x(),d.value&&(d.value.focus(),d.value.selectionStart=d.value.selectionEnd=u.value.length)})},C=k=>{u.value=k,e.nextTick(()=>x())},y=()=>{c.value=!1},b=k=>{console.info("handleFileUploadStatus event = ",k),k!=null&&k.fileName?(l.value=k,r("file-upload-status",k)):(l.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},x=()=>{const k=d.value;if(!k)return;k.style.height="auto";const S=Math.max(32,Math.min(k.scrollHeight,120));k.style.height=`${S}px`},E=()=>{console.info("removeFile"),l.value=null,s.value=!0,r("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},w=()=>{c.value=!1,x()};return(k,I)=>{var S,v,N,D,L;const O=e.resolveDirective("click-outside");return e.withDirectives((e.openBlock(),e.createElementBlock("div",O_,[e.createVNode(A_,{options:h.value,"help-text":g.value,"sub-help-text":t.subHelpText,"show-suggestions":c.value,onSelect:p,onPreview:C},null,8,["options","help-text","sub-help-text","show-suggestions"]),e.createElementVNode("div",V_,[e.createElementVNode("div",F_,[e.createElementVNode("div",{class:e.normalizeClass(["icon-wrapper",{"active-suggestions":c.value,disabled:((S=h.value)==null?void 0:S.length)<=0}])},[e.createVNode(Ee,{disabled:((v=h.value)==null?void 0:v.length)<=0||t.loading,color:((N=h.value)==null?void 0:N.length)<=0?"#DEDEDE":c.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:I[0]||(I[0]=z=>c.value=!c.value)},null,8,["disabled","color"])],2),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":I[1]||(I[1]=z=>u.value=z),disabled:t.loading,placeholder:t.placeholder,rows:"1",onKeydown:e.withKeys(e.withModifiers(_,["exact","prevent"]),["enter"]),onInput:w},null,40,M_),[[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(g_,{"reset-file-input":s.value,onUploadStatus:b,onError:f},null,8,["reset-file-input"])],2)):e.createCommentVNode("",!0),t.showMic?(e.openBlock(),e.createElementBlock("div",R_,[e.createVNode(Ee,{color:"#828282",disabled:t.loading,icon:"mic",size:"13",height:15,onClick:I[2]||(I[2]=z=>k.$emit("speak"))},null,8,["disabled"])])):e.createCommentVNode("",!0),e.createElementVNode("div",L_,[(e.openBlock(),e.createBlock(Ee,{key:1,disabled:t.loading,icon:"send",size:"20",onClick:_},null,8,["disabled"]))])]),((D=l.value)==null?void 0:D.status)==="uploading"||((L=l.value)==null?void 0:L.status)==="uploaded"?(e.openBlock(),e.createBlock(T_,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":l.value,onCancel:E},null,8,["file-info"])):e.createCommentVNode("",!0)])])),[[O,y]])}}},[["__scopeId","data-v-e205d71c"]]),q_=["data-test-id"],$_=["data-test-id"],z_=["data-test-id"],j_=ye({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1},styles:{type:Object,required:!1,default:()=>({}),validator:t=>typeof(t==null?void 0:t.height)=="string"}},setup(t){const o=Jn(),n=qn(),r=e.ref(null),a=e.computed(()=>{var c;return((c=o.getCurrentStepLinks)==null?void 0:c.call(o))||[]}),i=e.computed(()=>!0),l=c=>{console.info("[aiChat] handleSubmit",{hasFileData:!!r.value,messageLength:(c||"").length}),r.value?(console.info("[aiChat] sending with file attachment"),n.sendMessage(c,!0,r.value)):(console.info("[aiChat] sending without attachment"),n.sendMessage(c))},s=c=>{console.info("ChatScreen handleFileUploadStatus event = ",c),c!=null&&c.fileData?(r.value=c.fileData,n.attachmentData={size:c.size,type:c.fileType,name:c.fileName}):(r.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(o).playbookStepsMode==="hybrid","playbook-steps-mode-full":e.unref(o).playbookStepsMode==="full","dxp-guiddance":t.isExternalGuidance}]),style:e.normalizeStyle({maxHeight:`calc(${t.styles.height} - 72px)`,height:`calc(${t.styles.height} - 72px)`}),"data-test-id":`${t.dataTestId}-messages-container`},[e.createVNode(m_,{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"])],14,$_),e.createElementVNode("div",{class:"input-container","data-test-id":`${t.dataTestId}-input-container`},[e.createVNode(P_,{modelValue:e.unref(n).promptMessage,"onUpdate:modelValue":u[0]||(u[0]=d=>e.unref(n).promptMessage=d),disabled:!i.value,"file-info":r.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,z_)],8,q_))}},[["__scopeId","data-v-99005673"]]),U_={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},H_={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},X_={class:"ect-text-[40px] ect-leading-none ect-mb-3"},K_=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),G_=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),Q_={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},W_={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("div",U_,[e.createElementVNode("div",H_,[e.createElementVNode("div",X_,[e.createVNode(Ee,{icon:"error",size:48})]),K_,G_,e.createElementVNode("div",Q_,[e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=r=>o.$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]=r=>o.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},Z_=t=>(e.pushScopeId("data-v-2f2aa6e4"),t=t(),e.popScopeId(),t),J_={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},Y_={key:4,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},eC={class:"ect-text-center"},tC=Z_(()=>e.createElementVNode("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),nC={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},rC=ye({__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","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(t,{emit:o}){const n=o,r=t,a=Jn(),i=ri(),l=it(),s=e.computed(()=>({...r.session,qliId:g.value||r.configQliId||void 0,itemId:h.value})),c=e.computed(()=>{const B=a==null?void 0:a.activeComponentKey,T=r.stepComponent;return(B||T||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),u=e.computed(()=>{var M,q;const B=!!r.templateId,T=!!((M=r.identity)!=null&&M.organizationId),R=!!((q=r.identity)!=null&&q.accountId),P=typeof r.cartSections=="string"&&r.cartSections.length>0;return B&&T&&R&&P}),d=e.computed(()=>{var T;if(Array.isArray(r.catalogInitialData)&&r.catalogInitialData.length>0)return r.catalogInitialData;const B=((T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)||{};if(B.catalog&&typeof B.catalog=="object")try{const P=Object.values(B.catalog).map(M=>{var q;return(q=M==null?void 0:M.catalogResponse)==null?void 0:q.productInfo}).filter(Boolean);if(P.length>0)return P}catch{}return Array.isArray(B.initialData)&&B.initialData.length>0?B.initialData:Array.isArray(B.catalogInitialData)&&B.catalogInitialData.length>0?B.catalogInitialData:Array.isArray(B.items)&&B.items.length>0?B.items:[]}),m=e.computed(()=>{var T;const B=((T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)||{};return r.catalogSearchTerm||B.searchTerm||""}),h=e.computed(()=>{var T,R,P,M,q,U;const B=((M=(P=(R=(T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)==null?void 0:R.savedProducts)==null?void 0:P[0])==null?void 0:M.itemId)||((q=a==null?void 0:a.activeComponentData)==null?void 0:q.payload)&&Object.keys(((U=a.activeComponentData.payload)==null?void 0:U.quoteConfiguration)||{})[0]||"";return r.configItemId||B||""}),g=e.computed(()=>{var T,R,P,M,q,U,Q,G;const B=(M=(P=(R=(T=a==null?void 0:a.activeComponentData)==null?void 0:T.payload)==null?void 0:R.savedProducts)==null?void 0:P[0])==null?void 0:M.qliId;if(!B){console.log("[aiComponentLoader] configQliIdComputed: No qliId from savedProducts");const re=(U=(q=a==null?void 0:a.activeComponentData)==null?void 0:q.payload)==null?void 0:U.quoteConfiguration;if(console.log("[aiComponentLoader] configQliIdComputed: quoteConfiguration:",re),re&&typeof re=="object"){const ae=Object.keys(re)[0];if(console.log("[aiComponentLoader] configQliIdComputed: firstItemId:",ae),ae){const Z=(Q=re[ae])==null?void 0:Q.product;if(console.log("[aiComponentLoader] configQliIdComputed: productObj:",Z),Z&&Z.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId in productObj:",Z.qliId),Z.qliId;if((G=re[ae])!=null&&G.qliId)return console.log("[aiComponentLoader] configQliIdComputed: found qliId directly under itemId:",re[ae].qliId),re[ae].qliId}}}return B||""}),f=e.computed(()=>!!h.value),_=e.computed(()=>c.value==="configurator"&&!f.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":c.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":c.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),p=e.computed(()=>{try{return JSON.stringify((a==null?void 0:a.activeComponentData)||{})}catch{return""}}),C=e.computed(()=>`catalog::${p.value}`),y=e.computed(()=>`cart::${p.value}`),b=e.computed(()=>{var B;try{return(((B=a==null?void 0:a.activeComponentData)==null?void 0:B.actionFunction)||"")==="Reload"}catch{return!1}}),x=e.computed(()=>{var T;const B=`configurator::${h.value||""}::${g.value||""}`;if(b.value){const R=((T=a==null?void 0:a.activeComponentData)==null?void 0:T.requestId)||"";return`${B}::${R}`}return B}),E=e.ref([]),w=e.ref(null),k=B=>{const T=Array.isArray(B)?B:Array.isArray(B==null?void 0:B.items)?B.items:[];if(!Array.isArray(T))return;const R={"Needs Configuration":1,"Suggests Configuration":2,"Fully Configured":3},P=U=>(U==null?void 0:U.requiresConfiguration)||"",M=U=>!!U&&U in R,q=T.filter(U=>M(P(U)));q.sort((U,Q)=>{const G=P(U),re=P(Q);return(R[G]||99)-(R[re]||99)}),E.value=q,w.value=q.length?q[0]:null},I=B=>{console.log("onQuoteCreated",B),n("catalog-quote-created",B)},O=B=>{console.log("onQuoteUpdated",B),n("catalog-quote-updated",B)},S=B=>{console.log("onItemAdded",B),n("catalog-item-added",B)},v=B=>{console.log("onItemQtyUpdated",B),n("catalog-item-qty-updated",B)},N=B=>{console.log("onLineDeleted",B),n("catalog-line-deleted",B)},D=B=>{console.log("onQuoteItemsFetched",B),n("catalog-items-fetched",B)};e.watch(()=>c.value,(B,T)=>{var R,P,M,q,U,Q,G,re,ae,Z,K;if(B==="configurator"){const ne=!!((M=(P=(R=a==null?void 0:a.activeComponentData)==null?void 0:R.payload)==null?void 0:P.savedProducts)!=null&&M.length),J=!!((U=(q=a==null?void 0:a.activeComponentData)==null?void 0:q.payload)!=null&&U.quoteConfiguration&&Object.keys(((G=(Q=a==null?void 0:a.activeComponentData)==null?void 0:Q.payload)==null?void 0:G.quoteConfiguration)||{}).length>0);if(!ne&&!J&&w.value&&!h.value){const ee=((re=w.value)==null?void 0:re.itemId)||"";if(ee){const j=((ae=a==null?void 0:a.currentPlaybook)==null?void 0:ae.playBookSteps)||[],te=he=>String(he||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");let se=null;const le=j.findIndex(he=>he.stepName===(a==null?void 0:a.currentStepName));if(le>=0&&j[le+1]&&te((Z=j[le+1])==null?void 0:Z.stepComponent)==="configurator")se=j[le+1].stepName;else{const he=j.findIndex(me=>te(me==null?void 0:me.stepComponent)==="configurator");se=he>=0?(K=j[he])==null?void 0:K.stepName:null}const ce={payload:{savedProducts:[{itemId:ee}]}};se?a.navigateToStep({stepName:se,data:ce}):a.loadComponent("configurator",ce)}}}});const L=()=>{var P,M;const B=((P=a==null?void 0:a.currentPlaybook)==null?void 0:P.playBookSteps)||[],T=q=>String(q||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),R=B.findIndex(q=>T(q==null?void 0:q.stepComponent)==="catalog"||T(q==null?void 0:q.stepName).includes("catalog"));if(R>=0){const q=(M=B[R])==null?void 0:M.stepName;a.navigateToStep({stepName:q})}else a.loadComponent("catalog")},z=()=>{var P,M;const B=((P=a==null?void 0:a.currentPlaybook)==null?void 0:P.playBookSteps)||[],T=q=>String(q||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),R=B.findIndex(q=>T(q==null?void 0:q.stepComponent)==="cart"||T(q==null?void 0:q.stepName).includes("cart"));if(R>=0){const q=(M=B[R])==null?void 0:M.stepName;a.navigateToStep({stepName:q})}else a.loadComponent("cart")},$=B=>{var T,R;console.log("onItemConfigureClicked",B),n("catalog-item-configure",B);try{const P=(B==null?void 0:B.itemId)||"",M=(B==null?void 0:B.qliId)||(B==null?void 0:B.QliId)||"",q=[];if(P){const ae={itemId:P};M&&(ae.qliId=M),q.push(ae)}const U={payload:{savedProducts:q}},Q=((T=a==null?void 0:a.currentPlaybook)==null?void 0:T.playBookSteps)||[],G=ae=>String(ae||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),re=Q.findIndex(ae=>{const Z=G(ae==null?void 0:ae.stepComponent),K=G(ae==null?void 0:ae.stepName);return Z==="configurator"||K.includes("configure")});if(re>=0){const ae=(R=Q[re])==null?void 0:R.stepName;a.navigateToStep({stepName:ae,data:U})}else a.loadComponent("configurator",U)}catch(P){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",P),a.loadComponent("configurator",{payload:{}})}},W=B=>{console.log("onCartClicked",B),n("expeditecart-clicked",B)},Y=B=>{var T,R;try{const P=(B==null?void 0:B.itemId)||"",M=(B==null?void 0:B.lineItemId)||(B==null?void 0:B.qliId)||"",q=[];if(P){const ae={itemId:P};M&&(ae.qliId=M),q.push(ae)}const U={payload:{savedProducts:q}},Q=((T=a==null?void 0:a.currentPlaybook)==null?void 0:T.playBookSteps)||[],G=ae=>String(ae||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),re=Q.findIndex(ae=>{const Z=G(ae==null?void 0:ae.stepComponent),K=G(ae==null?void 0:ae.stepName);return Z==="configurator"||K.includes("configure")});if(re>=0){const ae=(R=Q[re])==null?void 0:R.stepName;a.navigateToStep({stepName:ae,data:U})}else a.loadComponent("configurator",U)}catch(P){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",P),a.loadComponent("configurator",{payload:{}})}},H=B=>{console.log("onCatalogIdReceived",B),l.updateConfig({eCatalogId:B})},F=B=>{console.log("Action",B),B.event==="add-to-quote"?n("configurator:add-to-quote",B.data):B.event==="save"&&n("configurator:save",B.data)},A=e.ref("");return e.watch(()=>a==null?void 0:a.activeComponentData,async B=>{var R,P,M;if(!B)return;console.log("activeComponentData Changed",B);const T=(B==null?void 0:B.requestId)||"";if(console.log("requestId",T),console.log("lastReloadRequestId",A.value),T&&T!==A.value)if(A.value=T,await e.nextTick(),(R=B==null?void 0:B.payload)!=null&&R.quoteConfiguration&&Object.keys(((P=B==null?void 0:B.payload)==null?void 0:P.quoteConfiguration)??{}).length>0){const q=Object.keys(((M=B==null?void 0:B.payload)==null?void 0:M.quoteConfiguration)??{})[0];i.setPreConfigData(B==null?void 0:B.payload,q)}else(B==null?void 0:B.actionFunction)==="Reload"&&(console.log("Reloading configurator 1"),i.refresh())},{deep:!0}),(B,T)=>(e.openBlock(),e.createElementBlock("div",J_,[c.value==="catalog"?(e.openBlock(),e.createBlock(Ao,{key:C.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":t.templateId,identity:t.identity,session:t.session,security:t.security,"search-term":m.value,"on-catalog-count-update":t.onCatalogCountUpdate,"preview-data":t.catalogPreviewData,"initial-data":d.value,sections:t.sections,theme:t.theme,"composables-org-type":t.composablesOrgType,onCatalogQuoteCreated:I,onCatalogQuoteUpdated:O,onCatalogItemsLoaded:k,onCatalogItemAdded:S,onCatalogItemQtyUpdated:v,onCatalogLineDeleted:N,onCatalogItemsFetched:D,onCatalogItemConfigure:$,"onCatalog:id":H},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","composables-org-type"])):c.value==="cart"&&u.value?(e.openBlock(),e.createBlock(Bo,{key:y.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":t.templateId,"host-name":t.hostName,"composables-org-type":t.composablesOrgType,security:t.security,identity:t.identity,session:t.session,onExpeditecartItemConfigure:Y,onExpeditecartClicked:W},null,8,["template-id","host-name","composables-org-type","security","identity","session"])):c.value==="configurator"&&f.value?(e.openBlock(),e.createBlock(Co,{key:x.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full",security:t.security,identity:t.identity,"user-locale":B.userLocale,"composables-org-type":t.composablesOrgType,session:s.value,onReady:e.unref(i).setExpediteConfigComp,onAction:F},null,8,["security","identity","user-locale","composables-org-type","session","onReady"])):c.value==="configurator"&&!f.value?(e.openBlock(),e.createBlock(W_,{key:3,onReturn:L,onGoCart:z})):(e.openBlock(),e.createElementBlock("div",Y_,[e.createElementVNode("div",eC,[tC,e.createElementVNode("div",nC,e.toDisplayString(_.value),1)])]))]))}},[["__scopeId","data-v-2f2aa6e4"]]),oC={class:"ai-guidance-loader","data-test-id":"aiGuidance-loader-container"},aC={class:"aig-message-text","data-test-id":"aiGuidance-loader-message"},iC={class:"aig-button","data-test-id":"aiGuidance-loader-button"},lC={class:"aig-input-box","data-test-id":"aiGuidance-loader-input"},sC=ye({__name:"AiGuidanceLoader",props:{errors:{type:Array,required:!1,default:()=>[]}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("div",oC,[e.createElementVNode("div",aC,[e.createVNode(wr,{style:{height:"16px",width:"90%","margin-bottom":"8px"}}),e.createVNode(wr,{style:{height:"16px",width:"65%","margin-bottom":"20px"}})]),e.createElementVNode("div",iC,[e.createVNode(wr,{style:{height:"40px",width:"100%"}})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.errors,r=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"aig-message-error","data-test-id":"aiGuidance-loader-error"},e.toDisplayString(r),1))),128)),e.createElementVNode("div",lC,[e.createVNode(wr,{style:{height:"40px",width:"100%"}})])]))}},[["__scopeId","data-v-aae34926"]]),cC={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},Qi=ye({__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:t=>typeof(t==null?void 0:t.height)=="string"}},emits:["expeditecart-item-configure","expeditecart-clicked","component-action","ai-response:success"],setup(t,{emit:o}){const n=Jn(),r=it(),a=qn(),i=yr(),l=o,s=e.ref(!0),c=e.ref(!1),u=e.ref(!0),d=e.ref(!0),m=e.ref(!1),h=e.ref([]),g=t,{composablesOrgType:f,websocketUrl:_,packageVersion:p,identity:C,session:y,security:b,templateId:x,hostName:E,graphqlEndpoint:w,apiKey:k,isPreview:I,catalogSections:O,cartSections:S,theme:v}=g;e.onBeforeMount(async()=>{console.log("security",b),console.log("apiKey",k),r.updateConfig({userId:C==null?void 0:C.userId,organizationId:C==null?void 0:C.organizationId,accessToken:b==null?void 0:b.accessToken,composablesApiUrl:b==null?void 0:b.baseUrl,composablesOrgType:f,websocketUrl:_,quoteId:y==null?void 0:y.quoteId,packageVersion:p,accountId:C==null?void 0:C.accountId,templateId:x,hostName:E,graphqlEndpoint:w,apiKey:(b==null?void 0:b.apiKey)||k,cid:C==null?void 0:C.contactId,isPreview:I})}),e.onMounted(async()=>{var A,B,T,R;n.setSecretKey(b==null?void 0:b.accessToken);const Y=await n.getPlaybookInfoFromQuote();let H=(Y==null?void 0:Y.XX_ORD1__Completed_PB_Step_Number_EX__c)??void 0,F=(Y==null?void 0:Y.XX_ORD1__Playbook_Current_Step_Meta_EX__c)??void 0;if(F&&(F=JSON.parse(F)),console.info("sequenceNumberServer = ",H),g.templateId){s.value=!0;const P=await n.getCatalogInContext();console.log("catalogInContext = ",P),P&&r.updateConfig({eCatalogId:P}),await i.fetchBlockInformationREST({templateId:g.templateId});const M=i.pageBlocks[0].blocks[0].playbookId;if(console.log("playbookID",M),M?c.value=!0:h.value.push("No playbook ID found in template"),n.setEmbeddedMode(!0),M&&(n.currentPlaybook=M,await n.getPlaybookByKey(M),n.showPlaybookSteps=!0),n.playbookStepsMode="full",a.setInitialPayload(),await a.connectSocket(),H!==void 0){n.navigateToStep({stepName:(B=(A=n.currentPlaybook)==null?void 0:A.playBookSteps[Number(H)])==null?void 0:B.stepName,data:F}),s.value=!1;return}(R=(T=n.currentPlaybook)==null?void 0:T.playBookSteps)!=null&&R.length&&n.setCurrentStepName(n.currentPlaybook.playBookSteps[0].stepName),s.value=!1}else h.value.push("templateId is required")});const N=e.computed(()=>{var F;const Y=((F=n.currentPlaybook)==null?void 0:F.playBookSteps)||[],H=n.currentStepName;return Y.find(A=>A.stepName===H)||Y[0]||null}),D=e.computed(()=>{var Y;return((Y=N.value)==null?void 0:Y.stepComponent)||null});e.watch(()=>n.activeComponentKey,Y=>{Y&&(u.value=!1)});const L=[];e.onMounted(()=>{L.push(jt("expeditecart:configure-clicked",Y=>{l("expeditecart-item-configure",Y)})),L.push(jt("expeditecart:clicked",Y=>{l("expeditecart-clicked",Y)})),L.push(jt("ai-response:success",Y=>{try{l("ai-response:success",Y)}catch{}}))});const z=Y=>{console.log("onExpediteCartClicked",Y),l("component-action",{component:"cart",details:Y})},$=(Y,H)=>{l("component-action",{component:"catalog",action:Y,details:H})},W=(Y,H)=>{l("component-action",{component:"configurator",action:Y,details:H})};return e.onBeforeUnmount(()=>{try{a.cancelRequest()}catch{}try{a.disconnectSocket()}catch{}try{a.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,c.value=!1,u.value=!0,d.value=!0,m.value=!1,h.value=[],L.forEach(Y=>{try{Y()}catch{}})}),(Y,H)=>{var F;return e.openBlock(),e.createElementBlock("div",cC,[e.createVNode(ii,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),s.value?(e.openBlock(),e.createBlock(sC,{key:0,errors:h.value,"data-test-id":"aiGuidance-loader"},null,8,["errors"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ai-app",{"root-path":u.value,"playbook-steps-mode-full":e.unref(n).playbookStepsMode==="full","dxp-guiddance":c.value}]),style:e.normalizeStyle(t.styles)},[e.createElementVNode("div",{class:"ai-app-chat-wrapper",style:e.normalizeStyle({height:t.styles.height})},[e.createVNode(j_,{"data-test-id":"chat-screen","is-external-guidance":c.value,styles:t.styles},null,8,["is-external-guidance","styles"])],4),!u.value&&d.value&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"component-loader-wrapper",style:e.normalizeStyle({height:t.styles.height,maxHeight:t.styles.height})},[e.unref(n).currentPlaybook?(e.openBlock(),e.createBlock(rC,{key:0,"template-id":((F=N.value)==null?void 0:F.templateId)||e.unref(x),"step-component":D.value,identity:e.unref(C),session:e.unref(y),security:e.unref(b),"composables-org-type":e.unref(f),"package-version":e.unref(p),"host-name":e.unref(E),"graphql-endpoint":e.unref(w),"api-key":e.unref(k),"is-preview":e.unref(I),sections:e.unref(O),"cart-sections":e.unref(S),theme:e.unref(v),"data-test-id":"aiComponentLoader-mounted",onExpeditecartClicked:z,onCatalogQuoteCreated:H[0]||(H[0]=A=>$("quote-created",A)),onCatalogQuoteUpdated:H[1]||(H[1]=A=>$("quote-updated",A)),onCatalogItemsLoaded:H[2]||(H[2]=A=>$("items-loaded",A)),onCatalogItemAdded:H[3]||(H[3]=A=>$("item-added",A)),onCatalogItemQtyUpdated:H[4]||(H[4]=A=>$("item-qty-updated",A)),onCatalogLineDeleted:H[5]||(H[5]=A=>$("line-deleted",A)),onCatalogItemsFetched:H[6]||(H[6]=A=>$("items-fetched",A)),onCatalogItemConfigure:H[7]||(H[7]=A=>$("item-configure",A)),"onConfigurator:addToQuote":H[8]||(H[8]=A=>W("add-to-quote",A)),"onConfigurator:save":H[9]||(H[9]=A=>W("save",A))},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"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)],6))])}}},[["__scopeId","data-v-ee278ef7"]]),Yu={ExpediteConfigurator:Co,ExpediteGPT:gi,ExpediteCatalog:Ao,ExpediteCart:Bo,ExpediteAIGuidance:Qi},uC={install(t,o={}){t.component("ExpediteConfigurator",Co),t.component("ExpediteGPT",gi),t.component("ExpediteCatalog",Ao),t.component("ExpediteCart",Bo),t.component("ExpediteAIGuidance",Qi)},...Yu};ft.Components=Yu,ft.ExpediteAIGuidance=Qi,ft.ExpediteCart=Bo,ft.ExpediteCatalog=Ao,ft.ExpediteConfigurator=Co,ft.ExpediteGPT=gi,ft.default=uC,ft.useComRootStore=Cr,Object.defineProperties(ft,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|