@gengage/assistant-fe 0.6.39 → 0.6.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/catalog.d.ts +1 -1
- package/dist/chat/components/ChatDrawer.d.ts +9 -2
- package/dist/chat/history-storage.d.ts +3 -0
- package/dist/chat/panel-manager.d.ts +7 -0
- package/dist/chat/runtime.d.ts +3 -0
- package/dist/chat/session-persistence.d.ts +2 -0
- package/dist/chat/types.d.ts +1 -0
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +36 -36
- package/dist/chat.js +1 -1
- package/dist/common/indexed-db.d.ts +3 -0
- package/dist/{common-DtgbqWSc.js → common-RLXFcoOo.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-CW7FlJH7.js → connection-warning-C1LnYGUH.js} +1 -1
- package/dist/{fastIntent-BwG6t8RV.js → fastIntent-BivJoy3l.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +14 -14
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +7 -7
- package/dist/qna.js +1 -1
- package/dist/{request-response-cache-DKf9Fcr5.js → request-response-cache-CVgP72eC.js} +459 -436
- package/dist/{runtime-CFzh6Ulc.js → runtime-B0aSQBLM.js} +1557 -1497
- package/dist/{runtime-ai391bmA.js → runtime-BemZwmk_.js} +3 -3
- package/dist/{runtime-CqgTa5_3.js → runtime-xuhF4izk.js} +3 -3
- package/dist/{simbut-BXTh-CaK.js → simbut-CJmAHE6w.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-Cv-eTKho.js → simrel-CwuklQwH.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +32 -32
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-DOth8kwX.js → widget-base-C3v87X91.js} +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as j, f as L, g as F, i as I, m as q, n as N, o as z, t as R } from "./request-response-cache-
|
|
1
|
+
import { a as j, f as L, g as F, i as I, m as q, n as N, o as z, t as R } from "./request-response-cache-CVgP72eC.js";
|
|
2
2
|
import { A as D, E as S, N as H, a as k, l as $, v as W } from "./context-UTzCGyR9.js";
|
|
3
|
-
import { o as J, t as K } from "./widget-base-
|
|
3
|
+
import { o as J, t as K } from "./widget-base-C3v87X91.js";
|
|
4
4
|
import { t as Q } from "./locale-uQ5XZ2yS.js";
|
|
5
5
|
import { a as V, n as Y, r as X, t as A } from "./price-formatter-CHUmYq8I.js";
|
|
6
|
-
import { n as Z } from "./connection-warning-
|
|
6
|
+
import { n as Z } from "./connection-warning-C1LnYGUH.js";
|
|
7
7
|
function M(e) {
|
|
8
8
|
const t = [];
|
|
9
9
|
for (const n of Object.values(e)) if (n.type === "ProductCard" && n.props) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as x, g as Q, i as R, m as N, n as H, t as O } from "./request-response-cache-
|
|
1
|
+
import { f as x, g as Q, i as R, m as N, n as H, t as O } from "./request-response-cache-CVgP72eC.js";
|
|
2
2
|
import { A as U, D as j, E as M, a as q, v as F } from "./context-UTzCGyR9.js";
|
|
3
|
-
import { o as W, t as D } from "./widget-base-
|
|
3
|
+
import { o as W, t as D } from "./widget-base-C3v87X91.js";
|
|
4
4
|
import { t as A } from "./locale-uQ5XZ2yS.js";
|
|
5
|
-
import { n as z } from "./connection-warning-
|
|
5
|
+
import { n as z } from "./connection-warning-C1LnYGUH.js";
|
|
6
6
|
async function $(t, e, n) {
|
|
7
7
|
const o = H("launcher_action", e), i = {
|
|
8
8
|
uiSpecs: [],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as m, D as h, _ as u, j as f, v as p } from "./context-UTzCGyR9.js";
|
|
2
|
-
import { t as b } from "./widget-base-
|
|
2
|
+
import { t as b } from "./widget-base-C3v87X91.js";
|
|
3
3
|
import { t as y } from "./locale-uQ5XZ2yS.js";
|
|
4
4
|
var g = { findSimilarLabel: "Benzerlerini Bul" }, _ = { findSimilarLabel: "Find Similar" };
|
|
5
5
|
function S(t, n) {
|
package/dist/simbut.iife.js
CHANGED
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
transform: translateY(0);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`,document.head.appendChild(e)}var f=null;function Y(){if(f!==null)return f;try{f=localStorage.getItem("gengage:debug")==="1"}catch{f=!1}return f}function S(e,t,i){if(!Y())return;const n=[`[gengage:${e}]`,t];i!==void 0&&n.push(i),console.debug(...n)}var j=("0.6.
|
|
47
|
+
`,document.head.appendChild(e)}var f=null;function Y(){if(f!==null)return f;try{f=localStorage.getItem("gengage:debug")==="1"}catch{f=!1}return f}function S(e,t,i){if(!Y())return;const n=[`[gengage:${e}]`,t];i!==void 0&&n.push(i),console.debug(...n)}var j=("0.6.41".trim(),"0.6.41".trim()),J=("iife-build".trim(),"iife-build".trim());function K(){if(typeof window>"u")return;const e=window;e.__gengageSdkRuntimeInfoLogged||(e.__gengageSdkRuntimeInfoLogged=!0,console.info(`[gengage] @gengage/assistant-fe v${j} (${J})`))}var Q=class{constructor(){this.isVisible=!1,this.isInitialised=!1,this._handlers=new Map,this._cleanups=[],this._ownsRoot=!1,this._destroying=!1}async init(e){if(this.isInitialised){console.warn("[gengage] Widget already initialised. Call update() instead.");return}const t=U(e.theme);K(),this.config={...e,theme:t,session:N(e.session)},this.root=this._resolveMount(e.mountTarget),this._applyTheme(t),O();const i=x("gengage:context:update",n=>this.update(n));this._cleanups.push(i),S("lifecycle",`${this.constructor.name}.init`,{accountId:e.accountId,sku:e.pageContext?.sku});try{await this.onInit(this.config)}catch(n){throw this.destroy(),n}this._destroying||(this.isInitialised=!0,S("lifecycle",`${this.constructor.name} ready`),this.emit("ready"))}update(e){this.isInitialised&&(this.config.pageContext?this.config={...this.config,pageContext:{...this.config.pageContext,...e}}:e.pageType!==void 0&&(this.config={...this.config,pageContext:e}),this.onUpdate(e),this.emit("context-update",this.config.pageContext))}show(){this.isVisible||(this.isVisible=!0,this.root.style.display="",this.onShow(),this.emit("show"))}hide(){this.isVisible&&(this.isVisible=!1,this.root.style.display="none",this.onHide(),this.emit("hide"))}destroy(){this._destroying||(this._destroying=!0,this.emit("destroy"),this._cleanups.forEach(e=>e()),this._cleanups.length=0,this._handlers.clear(),this.onDestroy(),this._cleanupRoot(),this.isInitialised=!1)}_cleanupRoot(){this._ownsRoot?this.root.remove():this.root.innerHTML=""}on(e,t){return this._handlers.has(e)||this._handlers.set(e,new Set),this._handlers.get(e).add(t),()=>this._handlers.get(e)?.delete(t)}emit(e,...t){this._handlers.get(e)?.forEach(i=>i(...t))}addCleanup(e){this._cleanups.push(e)}_resolveMount(e){if(e instanceof HTMLElement)return e;if(typeof e=="string"){const i=document.querySelector(e);if(!i)throw new Error(`[gengage] Mount target not found: "${e}"`);return i}const t=document.createElement("div");return t.dataset.gengageWidget=this.constructor.name.toLowerCase(),document.body.insertBefore(t,document.body.firstChild),this._ownsRoot=!0,t}_applyTheme(e){if(e){for(const[t,i]of Object.entries(e))if(i!==void 0){const n=t.startsWith("--")?t:`--gengage-${X(t)}`;this.root.style.setProperty(n,i)}}}};function X(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function Z(e){const t=e?.trim();return t||"tr"}var C={findSimilarLabel:"Benzerlerini Bul"},ee={findSimilarLabel:"Find Similar"};function te(e,t){return t?.findSimilarLabel?t.findSimilarLabel:(e??"tr").toLowerCase().startsWith("en")?ee.findSimilarLabel:C.findSimilarLabel}function h(e){const t=typeof e.sku=="string"&&e.sku.length>0?e.sku:void 0,i=typeof e.pageContext?.sku=="string"&&e.pageContext.sku.length>0?e.pageContext.sku:void 0;return t??i}var E=class extends Q{constructor(...e){super(...e),this._button=null,this._inlineFrame=null,this._label=C.findSimilarLabel}async onInit(e){this._label=te(e.locale,e.i18n);const t=e.layout??"overlay";this.root.classList.add("gengage-simbut-root"),this.root.classList.toggle("gengage-simbut-root--overlay",t==="overlay"),this.root.classList.toggle("gengage-simbut-root--inline-card",t==="inline-card"),t==="overlay"&&window.getComputedStyle(this.root).position==="static"&&(this.root.style.position="relative");const i=document.createElement("button");i.type="button",i.className="gengage-chat-find-similar-pill",i.lang=Z(e.locale),i.textContent=this._label,this._button=i;const n=()=>{i.disabled=!(h(this.config)&&(this.config.onFindSimilar||this.config.chat))};if(i.addEventListener("click",r=>{r.stopPropagation();const s=h(this.config);if(!s)return;const o=this.config.imageUrl,g=typeof o=="string"&&L(o)?o:void 0;if(F(this._label,"findSimilar"),R(s),this.config.onFindSimilar){this.config.onFindSimilar(g?{sku:s,imageUrl:g}:{sku:s});return}const u=this.config.chat;if(!u)return;const a={title:this._label,type:"findSimilar",payload:{sku:s}};u.openWithAction(a,{sku:s})}),t==="inline-card"){const r=this._createInlineCard(e,i);this._inlineFrame=r,this.root.appendChild(r)}else this.root.appendChild(i);n(),k("simbut")}_createInlineCard(e,t){const i=e.inlineCard,n=typeof i?.title=="string"?i.title.trim():"",r=typeof i?.description=="string"?i.description.trim():"",s=typeof i?.imageUrl=="string"?i.imageUrl.trim():"",o=document.createElement("section");o.className="gengage-simbut-inline-card",o.dataset.gengagePart="simbut-inline-card";const g=document.createElement("div");if(g.className="gengage-simbut-inline-copy",g.dataset.gengagePart="simbut-inline-copy",n){const a=document.createElement("h4");a.className="gengage-simbut-inline-title",a.dataset.gengagePart="simbut-inline-title",a.textContent=n,g.appendChild(a)}if(r){const a=document.createElement("p");a.className="gengage-simbut-inline-description",a.dataset.gengagePart="simbut-inline-description",a.textContent=r,g.appendChild(a)}g.children.length>0&&o.appendChild(g);const u=document.createElement("div");if(u.className="gengage-simbut-inline-action",u.dataset.gengagePart="simbut-inline-action",u.appendChild(t),o.appendChild(u),s&&I(s)){const a=document.createElement("img");a.className="gengage-simbut-inline-image",a.dataset.gengagePart="simbut-inline-image",a.src=s,a.alt=typeof i?.imageAlt=="string"?i.imageAlt:"",a.loading="lazy",a.addEventListener("error",()=>{a.style.display="none"},{once:!0}),o.appendChild(a)}return o}onUpdate(e){if(!this._button)return;const t=!!h(this.config)&&(!!this.config.onFindSimilar||!!this.config.chat);this._button.disabled=!t}hide(){this.isVisible&&(this.isVisible=!1,this._inlineFrame&&(this._inlineFrame.style.display="none"),this._button&&(this._button.style.display="none"),this.onHide(),this.emit("hide"))}show(){this.isVisible||(this.isVisible=!0,this._inlineFrame&&(this._inlineFrame.style.display=""),this._button&&(this._button.style.display=""),this.onShow(),this.emit("show"))}_cleanupRoot(){}onShow(){}onHide(){}onDestroy(){this._inlineFrame?.remove(),this._inlineFrame=null,this._button?.remove(),this._button=null}setChat(e){if(this.config.chat=e,this._button){const t=!!h(this.config)&&(!!this.config.onFindSimilar||!!this.config.chat);this._button.disabled=!t}}};function ie(){return new E}m.GengageSimBut=E,m.createSimButWidget=ie})(this.Gengage=this.Gengage||{});
|
package/dist/simbut.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A, j as S } from "./context-UTzCGyR9.js";
|
|
2
2
|
import { n as $, t as L } from "./price-formatter-CHUmYq8I.js";
|
|
3
3
|
import { a as C, c as f, n as q, o as h, t as k, u as H } from "./schemas-BnYUhYSy.js";
|
|
4
|
-
import { o as j } from "./runtime-
|
|
4
|
+
import { o as j } from "./runtime-BemZwmk_.js";
|
|
5
5
|
var V = {
|
|
6
6
|
images: [
|
|
7
7
|
"images",
|
package/dist/simrel-runtime.js
CHANGED