@gengage/assistant-fe 0.4.15 → 0.4.16

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, d as r, i as s, l as n, n as i, o as c, r as l, s as o, t as C, u as h } from "./runtime-EUhElpCX.js";
1
+ import { a as e, c as t, d as r, i as s, l as n, n as i, o as c, r as l, s as o, t as C, u as h } from "./runtime-DP_D5fV6.js";
2
2
  import { t as p } from "./chat-BRKK63lt.js";
3
3
  export {
4
4
  n as CHAT_SCROLL_ELEMENT_ID,
@@ -0,0 +1 @@
1
+ export declare function detectFastIntent(text: string): string | null;
@@ -44,5 +44,6 @@ export type { DetectablePageType, PageDetectionRule } from './page-detect.js';
44
44
  export type { NormalizedProduct, SimilarProductsJsonResponse, ProductGroupingsJsonResponse, } from './protocol-adapter.js';
45
45
  export { getSuggestedSearchKeywords, getSuggestedSearchKeywordsText } from './suggested-search-keywords.js';
46
46
  export type { SuggestedSearchKeywordSource } from './suggested-search-keywords.js';
47
+ export { detectFastIntent } from './fastIntent.js';
47
48
  export { makePillLauncher } from './pill-launcher.js';
48
49
  export type { PillLauncherOptions, PillLauncherKit } from './pill-launcher.js';
package/dist/common.js CHANGED
@@ -1,74 +1,75 @@
1
- import { a, c as t, d as s, f as r, i, l as n, m as o, n as c, o as m, p as l, r as g, t as d, u as p } from "./api-paths-BX3Lea3A.js";
2
- import { C as E, S, _ as h, b as v, c as f, d as y, f as C, g as A, h as T, i as w, l as U, m as W, o as I, p as P, r as k, s as D, t as R, u as b, v as G, w as N, x as O, y as _ } from "./widget-base-bdJaGJYi.js";
3
- import { N as L, a as M, c as z, i as B, k as H, n as F, o as K, r as V, s as Q, t as q } from "./context-DGz5F81j.js";
4
- import { a as j, n as J, r as X, t as Y } from "./pill-launcher-D9ITHv5w.js";
5
- import { n as ee, t as ae } from "./connection-warning-C7ehvQxx.js";
6
- import { i as se, n as re, r as ie, t as ne } from "./overlay-CfnBuj7M.js";
7
- import { a as ce, i as me, n as le, r as ge } from "./native-webview-BsRcv49q.js";
8
- import { _ as pe, a as ue, c as Ee, d as Se, f as he, g as ve, h as fe, i as ye, l as Ce, m as Ae, n as Te, o as we, p as Ue, r as We, s as Ie, t as Pe, u as ke, v as De, y as Re } from "./common-Bxy1FrAk.js";
1
+ import { a, c as t, d as s, f as r, i as n, l as i, m as o, n as c, o as m, p as l, r as g, t as d, u as p } from "./api-paths-BX3Lea3A.js";
2
+ import { C as E, S, _ as h, b as v, c as f, d as y, f as C, g as A, h as T, i as w, l as I, m as U, o as W, p as P, r as k, s as D, t as R, u as b, v as G, w as N, x as O, y as _ } from "./widget-base-bdJaGJYi.js";
3
+ import { N as L, a as M, c as z, i as B, k as F, n as H, o as K, r as V, s as Q, t as q } from "./context-DGz5F81j.js";
4
+ import { i as j, n as J, o as X, r as Y, t as $ } from "./fastIntent-CINRmM8r.js";
5
+ import { n as ae, t as te } from "./connection-warning-C7ehvQxx.js";
6
+ import { i as re, n as ne, r as ie, t as oe } from "./overlay-CfnBuj7M.js";
7
+ import { a as me, i as le, n as ge, r as de } from "./native-webview-BsRcv49q.js";
8
+ import { _ as ue, a as Ee, c as Se, d as he, f as ve, g as fe, h as ye, i as Ce, l as Ae, m as Te, n as we, o as Ie, p as Ue, r as We, s as Pe, t as ke, u as De, v as Re, y as be } from "./common-Bxy1FrAk.js";
9
9
  export {
10
- Ae as AccountRuntimeConfigSchema,
11
- fe as AnalyticsAuthModeSchema,
12
- he as AnalyticsClient,
10
+ Te as AccountRuntimeConfigSchema,
11
+ ye as AnalyticsAuthModeSchema,
12
+ ve as AnalyticsClient,
13
13
  f as BASE_WIDGET_THEME,
14
14
  R as BaseWidget,
15
- we as DEFAULT_CUSTOMIZATION_LOCALE,
15
+ Ie as DEFAULT_CUSTOMIZATION_LOCALE,
16
16
  b as DEFAULT_WIDGET_THEME_TOKENS,
17
- ve as UnknownActionPolicySchema,
18
- J as VoiceInput,
17
+ fe as UnknownActionPolicySchema,
18
+ Y as VoiceInput,
19
19
  g as adaptBackendEvent,
20
- le as applyNativeSession,
21
- Pe as autoDetectPageContext,
20
+ ge as applyNativeSession,
21
+ ke as autoDetectPageContext,
22
22
  C as basketAddEvent,
23
23
  q as bootstrapSession,
24
24
  d as buildChatEndpointUrl,
25
- ne as buildOverlayIdempotencyKey,
25
+ oe as buildOverlayIdempotencyKey,
26
26
  P as chatHistorySnapshotEvent,
27
- W as checkoutCompleteEvent,
27
+ U as checkoutCompleteEvent,
28
28
  T as checkoutStartEvent,
29
- ae as configureConnectionWarning,
29
+ te as configureConnectionWarning,
30
30
  p as consumeStream,
31
- Ie as createAccountIdentity,
31
+ Pe as createAccountIdentity,
32
32
  Ue as createAnalyticsClient,
33
- pe as createDefaultAccountRuntimeConfig,
34
- Ee as createDefaultAnalyticsConfig,
35
- Ce as createFloatingChatConfig,
36
- ge as createNativeWebViewBridge,
37
- ke as createPdpQnaConfig,
38
- Se as createPdpSimRelConfig,
33
+ ue as createDefaultAccountRuntimeConfig,
34
+ Se as createDefaultAnalyticsConfig,
35
+ Ae as createFloatingChatConfig,
36
+ de as createNativeWebViewBridge,
37
+ De as createPdpQnaConfig,
38
+ he as createPdpSimRelConfig,
39
39
  l as defaultUnknownUISpecRenderer,
40
- re as destroyOverlayWidgets,
41
- me as detectNativeEnvironment,
42
- Te as detectPageType,
40
+ ne as destroyOverlayWidgets,
41
+ $ as detectFastIntent,
42
+ le as detectNativeEnvironment,
43
+ we as detectPageType,
43
44
  k as dismissGlobalErrorToast,
44
45
  M as dispatch,
45
46
  We as extractSkuFromUrl,
46
47
  w as getGlobalErrorMessage,
47
48
  ie as getOverlayWidgets,
48
49
  t as getSuggestedSearchKeywords,
49
- n as getSuggestedSearchKeywordsText,
50
- F as getWindowPageContext,
51
- ye as initGengageClient,
52
- ce as initNativeOverlayWidgets,
53
- se as initOverlayWidgets,
54
- X as isVoiceInputSupported,
50
+ i as getSuggestedSearchKeywordsText,
51
+ H as getWindowPageContext,
52
+ Ce as initGengageClient,
53
+ me as initNativeOverlayWidgets,
54
+ re as initOverlayWidgets,
55
+ j as isVoiceInputSupported,
55
56
  K as listen,
56
57
  A as llmUsageEvent,
57
- Y as makePillLauncher,
58
+ J as makePillLauncher,
58
59
  r as mergeUISpecRegistry,
59
60
  h as meteringIncrementEvent,
60
61
  G as meteringSummaryEvent,
61
62
  c as normalizeMiddlewareUrl,
62
- i as normalizeProductGroupingsResponse,
63
+ n as normalizeProductGroupingsResponse,
63
64
  a as normalizeSimilarProductsResponse,
64
- De as parseAccountRuntimeConfig,
65
- ue as preflightDiagnostics,
65
+ Re as parseAccountRuntimeConfig,
66
+ Ee as preflightDiagnostics,
66
67
  m as productToNormalized,
67
- I as registerGlobalErrorToastListener,
68
+ W as registerGlobalErrorToastListener,
68
69
  o as renderUISpecWithRegistry,
69
70
  V as resolveSession,
70
- j as routeStreamAction,
71
- Re as safeParseAccountRuntimeConfig,
71
+ X as routeStreamAction,
72
+ be as safeParseAccountRuntimeConfig,
72
73
  L as sanitizeHtml,
73
74
  D as showGlobalErrorToast,
74
75
  _ as streamChunkEvent,
@@ -77,12 +78,12 @@ export {
77
78
  s as streamPost,
78
79
  S as streamStartEvent,
79
80
  E as streamUiSpecEvent,
80
- ee as trackConnectionWarningRequest,
81
+ ae as trackConnectionWarningRequest,
81
82
  B as updatePageContext,
82
83
  N as widgetHistorySnapshotEvent,
83
- H as wireGADataLayer,
84
+ F as wireGADataLayer,
84
85
  Q as wireQNAToChat,
85
86
  z as wireSimilarToChat,
86
- U as withBaseTheme,
87
+ I as withBaseTheme,
87
88
  y as withDefaultWidgetTheme
88
89
  };
@@ -1,132 +1,132 @@
1
1
  import { n as I } from "./widget-base-bdJaGJYi.js";
2
2
  import { j as S } from "./context-DGz5F81j.js";
3
- function E(n, e) {
4
- if (typeof window > "u" || !S(n)) return !1;
3
+ function E(t, n) {
4
+ if (typeof window > "u" || !S(t)) return !1;
5
5
  const r = new CustomEvent("gengage:navigate", {
6
- detail: e === void 0 ? { url: n } : {
7
- url: n,
8
- newTab: e
6
+ detail: n === void 0 ? { url: t } : {
7
+ url: t,
8
+ newTab: n
9
9
  },
10
10
  cancelable: !0
11
11
  });
12
- return window.dispatchEvent(r) ? (e ? window.open(n, "_blank", "noopener,noreferrer") : window.location.href = n, !0) : !1;
12
+ return window.dispatchEvent(r) ? (n ? window.open(t, "_blank", "noopener,noreferrer") : window.location.href = t, !0) : !1;
13
13
  }
14
- var _ = console;
15
- function F(n, e, r = {}) {
16
- const t = n.action, a = r.logger ?? _;
17
- switch (I("action", `routing action: ${t.kind}`, t), t.kind) {
14
+ var $ = console;
15
+ function W(t, n, r = {}) {
16
+ const e = t.action, a = r.logger ?? $;
17
+ switch (I("action", `routing action: ${e.kind}`, e), e.kind) {
18
18
  case "open_chat":
19
- e.openChat?.(t.payload);
19
+ n.openChat?.(e.payload);
20
20
  return;
21
21
  case "navigate": {
22
- if (typeof t.url != "string") {
23
- h(t, e, r, a);
22
+ if (typeof e.url != "string") {
23
+ h(e, n, r, a);
24
24
  return;
25
25
  }
26
- if (!S(t.url)) {
27
- a.warn("[gengage] Blocked navigation to unsafe URL:", t.url);
26
+ if (!S(e.url)) {
27
+ a.warn("[gengage] Blocked navigation to unsafe URL:", e.url);
28
28
  return;
29
29
  }
30
- const i = typeof t.newTab == "boolean" ? t.newTab : void 0;
31
- if (e.navigate) {
32
- e.navigate({
33
- url: t.url,
30
+ const i = typeof e.newTab == "boolean" ? e.newTab : void 0;
31
+ if (n.navigate) {
32
+ n.navigate({
33
+ url: e.url,
34
34
  ...i !== void 0 && { newTab: i }
35
35
  });
36
36
  return;
37
37
  }
38
- (r.defaultNavigate ?? R)(t.url, i);
38
+ (r.defaultNavigate ?? L)(e.url, i);
39
39
  return;
40
40
  }
41
41
  case "save_session":
42
- if (typeof t.sessionId != "string" || typeof t.sku != "string") {
43
- h(t, e, r, a);
42
+ if (typeof e.sessionId != "string" || typeof e.sku != "string") {
43
+ h(e, n, r, a);
44
44
  return;
45
45
  }
46
- e.saveSession?.({
47
- sessionId: t.sessionId,
48
- sku: t.sku
46
+ n.saveSession?.({
47
+ sessionId: e.sessionId,
48
+ sku: e.sku
49
49
  });
50
50
  return;
51
51
  case "add_to_cart":
52
- if (typeof t.sku != "string" || typeof t.quantity != "number" || typeof t.cartCode != "string") {
53
- h(t, e, r, a);
52
+ if (typeof e.sku != "string" || typeof e.quantity != "number" || typeof e.cartCode != "string") {
53
+ h(e, n, r, a);
54
54
  return;
55
55
  }
56
- e.addToCart?.({
57
- sku: t.sku,
58
- quantity: t.quantity,
59
- cartCode: t.cartCode
56
+ n.addToCart?.({
57
+ sku: e.sku,
58
+ quantity: e.quantity,
59
+ cartCode: e.cartCode
60
60
  });
61
61
  return;
62
62
  case "script_call": {
63
63
  if (r.allowScriptCall === !1) {
64
- h(t, e, r, a);
64
+ h(e, n, r, a);
65
65
  return;
66
66
  }
67
- if (typeof t.name != "string") {
68
- h(t, e, r, a);
67
+ if (typeof e.name != "string") {
68
+ h(e, n, r, a);
69
69
  return;
70
70
  }
71
- const i = q(t.payload) ? t.payload : void 0;
72
- e.scriptCall?.({
73
- name: t.name,
71
+ const i = U(e.payload) ? e.payload : void 0;
72
+ n.scriptCall?.({
73
+ name: e.name,
74
74
  ...i !== void 0 && { payload: i }
75
75
  });
76
76
  return;
77
77
  }
78
78
  default:
79
- h(t, e, r, a);
79
+ h(e, n, r, a);
80
80
  }
81
81
  }
82
- function h(n, e, r, t) {
82
+ function h(t, n, r, e) {
83
83
  const a = r.unknownActionPolicy ?? "log-and-ignore";
84
84
  if (a === "delegate") {
85
- e.unknown?.(n), e.unknown || t.warn("[gengage] Unknown action received without delegate handler", n);
85
+ n.unknown?.(t), n.unknown || e.warn("[gengage] Unknown action received without delegate handler", t);
86
86
  return;
87
87
  }
88
- if (a === "throw") throw new Error(`[gengage] Unknown action kind: ${n.kind}`);
89
- t.warn("[gengage] Unknown action ignored", n);
88
+ if (a === "throw") throw new Error(`[gengage] Unknown action kind: ${t.kind}`);
89
+ e.warn("[gengage] Unknown action ignored", t);
90
90
  }
91
- function R(n, e) {
91
+ function L(t, n) {
92
92
  if (!(typeof window > "u")) {
93
- if (!S(n)) {
94
- console.warn("[gengage] Blocked navigation to unsafe URL:", n);
93
+ if (!S(t)) {
94
+ console.warn("[gengage] Blocked navigation to unsafe URL:", t);
95
95
  return;
96
96
  }
97
- E(n, e);
97
+ E(t, n);
98
98
  }
99
99
  }
100
- function q(n) {
101
- return typeof n == "object" && n !== null && !Array.isArray(n);
100
+ function U(t) {
101
+ return typeof t == "object" && t !== null && !Array.isArray(t);
102
102
  }
103
- function P(n) {
104
- const e = globalThis.CSS?.escape;
105
- if (typeof e == "function") return e(n);
106
- const r = Array.from(n);
107
- return r.map((t, a) => {
108
- const i = t.codePointAt(0);
109
- return i === void 0 ? "" : i === 0 ? "�" : i >= 1 && i <= 31 || i === 127 || a === 0 && i >= 48 && i <= 57 || a === 1 && r[0] === "-" && i >= 48 && i <= 57 ? `\\${i.toString(16)} ` : a === 0 && t === "-" && r.length === 1 ? "\\-" : i >= 128 || /[A-Za-z0-9_-]/.test(t) ? t : `\\${t}`;
103
+ function q(t) {
104
+ const n = globalThis.CSS?.escape;
105
+ if (typeof n == "function") return n(t);
106
+ const r = Array.from(t);
107
+ return r.map((e, a) => {
108
+ const i = e.codePointAt(0);
109
+ return i === void 0 ? "" : i === 0 ? "�" : i >= 1 && i <= 31 || i === 127 || a === 0 && i >= 48 && i <= 57 || a === 1 && r[0] === "-" && i >= 48 && i <= 57 ? `\\${i.toString(16)} ` : a === 0 && e === "-" && r.length === 1 ? "\\-" : i >= 128 || /[A-Za-z0-9_-]/.test(e) ? e : `\\${e}`;
110
110
  }).join("");
111
111
  }
112
- function M() {
113
- return v() !== null;
112
+ function Y() {
113
+ return C() !== null;
114
114
  }
115
- function v() {
116
- const n = globalThis;
117
- return n.SpeechRecognition ?? n.webkitSpeechRecognition ?? null;
115
+ function C() {
116
+ const t = globalThis;
117
+ return t.SpeechRecognition ?? t.webkitSpeechRecognition ?? null;
118
118
  }
119
- var z = class {
120
- constructor(n, e) {
121
- this.recognition = null, this._state = "idle", this.silenceTimer = null, this.accumulatedTranscript = "", this.intentionalStop = !1, this._lastRestartAt = 0, this.callbacks = n, this.lang = e?.lang ?? "tr-TR", this.silenceTimeoutMs = e?.silenceTimeoutMs ?? 1500, this.autoSubmit = e?.autoSubmit ?? !0;
119
+ var X = class {
120
+ constructor(t, n) {
121
+ this.recognition = null, this._state = "idle", this.silenceTimer = null, this.accumulatedTranscript = "", this.intentionalStop = !1, this._lastRestartAt = 0, this.callbacks = t, this.lang = n?.lang ?? "tr-TR", this.silenceTimeoutMs = n?.silenceTimeoutMs ?? 1500, this.autoSubmit = n?.autoSubmit ?? !0;
122
122
  }
123
123
  get state() {
124
124
  return this._state;
125
125
  }
126
126
  start() {
127
127
  if (this._state === "listening") return;
128
- const n = v();
129
- if (!n) {
128
+ const t = C();
129
+ if (!t) {
130
130
  this.setState("error"), this.callbacks.onError?.("not-supported", "Web Speech API is not supported in this browser.");
131
131
  return;
132
132
  }
@@ -135,23 +135,23 @@ var z = class {
135
135
  return;
136
136
  }
137
137
  this.accumulatedTranscript = "", this.intentionalStop = !1;
138
- const e = new n();
139
- e.continuous = !0, e.interimResults = !0, e.lang = this.lang, e.maxAlternatives = 1, e.onstart = () => {
138
+ const n = new t();
139
+ n.continuous = !0, n.interimResults = !0, n.lang = this.lang, n.maxAlternatives = 1, n.onstart = () => {
140
140
  this.setState("listening");
141
- }, e.onresult = (r) => {
141
+ }, n.onresult = (r) => {
142
142
  this.clearSilenceTimer();
143
- let t = "", a = "";
143
+ let e = "", a = "";
144
144
  for (let i = r.resultIndex; i < r.results.length; i++) {
145
145
  const u = r.results[i];
146
146
  if (!u) continue;
147
- const p = u[0];
148
- p && (u.isFinal ? a += p.transcript : t += p.transcript);
147
+ const g = u[0];
148
+ g && (u.isFinal ? a += g.transcript : e += g.transcript);
149
149
  }
150
- a && (this.accumulatedTranscript += a, this.callbacks.onFinal?.(this.accumulatedTranscript)), t && this.callbacks.onInterim?.(this.accumulatedTranscript + t), this.autoSubmit && this.accumulatedTranscript && this.startSilenceTimer();
151
- }, e.onerror = (r) => {
152
- const t = U(r.error);
153
- this.intentionalStop && (r.error === "no-speech" || r.error === "aborted") || (this.setState("error"), this.callbacks.onError?.(t, r.message || r.error));
154
- }, e.onend = () => {
150
+ a && (this.accumulatedTranscript += a, this.callbacks.onFinal?.(this.accumulatedTranscript)), e && this.callbacks.onInterim?.(this.accumulatedTranscript + e), this.autoSubmit && this.accumulatedTranscript && this.startSilenceTimer();
151
+ }, n.onerror = (r) => {
152
+ const e = P(r.error);
153
+ this.intentionalStop && (r.error === "no-speech" || r.error === "aborted") || (this.setState("error"), this.callbacks.onError?.(e, r.message || r.error));
154
+ }, n.onend = () => {
155
155
  if (this.clearSilenceTimer(), this._state === "listening" && !this.intentionalStop) {
156
156
  const r = Date.now();
157
157
  if (r - this._lastRestartAt < 500) {
@@ -160,16 +160,16 @@ var z = class {
160
160
  }
161
161
  this._lastRestartAt = r;
162
162
  try {
163
- e.start();
163
+ n.start();
164
164
  } catch {
165
165
  this.setState("idle");
166
166
  }
167
167
  return;
168
168
  }
169
169
  this.setState("idle");
170
- }, this.recognition = e;
170
+ }, this.recognition = n;
171
171
  try {
172
- e.start();
172
+ n.start();
173
173
  } catch {
174
174
  this.setState("error"), this.callbacks.onError?.("unknown", "Failed to start speech recognition.");
175
175
  }
@@ -197,21 +197,21 @@ var z = class {
197
197
  destroy() {
198
198
  this.abort();
199
199
  }
200
- setState(n) {
201
- this._state !== n && (this._state = n, this.callbacks.onStateChange?.(n));
200
+ setState(t) {
201
+ this._state !== t && (this._state = t, this.callbacks.onStateChange?.(t));
202
202
  }
203
203
  startSilenceTimer() {
204
204
  this.clearSilenceTimer(), this.silenceTimer = setTimeout(() => {
205
- const n = this.stop();
206
- n.trim() && this.callbacks.onAutoSubmit?.(n.trim());
205
+ const t = this.stop();
206
+ t.trim() && this.callbacks.onAutoSubmit?.(t.trim());
207
207
  }, this.silenceTimeoutMs);
208
208
  }
209
209
  clearSilenceTimer() {
210
210
  this.silenceTimer !== null && (clearTimeout(this.silenceTimer), this.silenceTimer = null);
211
211
  }
212
212
  };
213
- function U(n) {
214
- switch (n) {
213
+ function P(t) {
214
+ switch (t) {
215
215
  case "not-allowed":
216
216
  return "not-allowed";
217
217
  case "no-speech":
@@ -226,21 +226,21 @@ function U(n) {
226
226
  return "unknown";
227
227
  }
228
228
  }
229
- function B(n) {
230
- const { label: e, avatarUrl: r, primaryColor: t, secondaryColor: a = "#111827", fontFamily: i = "inherit", labelClassName: u = "gengage-pill-launcher-label", styleId: p = "gengage-pill-launcher-style", mobileBreakpoint: $ = 768, desktopWidth: g = "188px", desktopHeight: b = "60px", iconSize: d = "46px" } = n, w = `${parseInt(g, 10) - 14}px`, x = `${parseInt(b, 10) - 4}px`, y = `${parseInt(d, 10) - 4}px`, C = `
229
+ function Z(t) {
230
+ const { label: n, avatarUrl: r, primaryColor: e, secondaryColor: a = "#111827", fontFamily: i = "inherit", labelClassName: u = "gengage-pill-launcher-label", styleId: g = "gengage-pill-launcher-style", mobileBreakpoint: _ = 768, desktopWidth: d = "188px", desktopHeight: w = "60px", iconSize: m = "46px" } = t, T = `${parseInt(d, 10) - 14}px`, k = `${parseInt(w, 10) - 4}px`, y = `${parseInt(m, 10) - 4}px`, R = `
231
231
  :host {
232
- --pill-primary: ${t};
232
+ --pill-primary: ${e};
233
233
  --pill-secondary: ${a};
234
234
  --pill-font: ${i};
235
235
  }
236
236
 
237
237
  button[data-gengage-part="chat-launcher-button"] {
238
238
  box-sizing: border-box;
239
- width: ${g} !important;
240
- min-width: ${g} !important;
241
- max-width: ${g} !important;
242
- height: ${b} !important;
243
- min-height: ${b} !important;
239
+ width: ${d} !important;
240
+ min-width: ${d} !important;
241
+ max-width: ${d} !important;
242
+ height: ${w} !important;
243
+ min-height: ${w} !important;
244
244
  padding: 6px 7px 6px 22px !important;
245
245
  display: inline-flex !important;
246
246
  flex-direction: row-reverse !important;
@@ -274,9 +274,9 @@ button[data-gengage-part="chat-launcher-button"]:hover {
274
274
  }
275
275
 
276
276
  button[data-gengage-part="chat-launcher-button"] img {
277
- width: ${d} !important;
278
- height: ${d} !important;
279
- flex: 0 0 ${d} !important;
277
+ width: ${m} !important;
278
+ height: ${m} !important;
279
+ flex: 0 0 ${m} !important;
280
280
  border-radius: 999px;
281
281
  object-fit: cover;
282
282
  object-position: center;
@@ -285,13 +285,13 @@ button[data-gengage-part="chat-launcher-button"] img {
285
285
  box-shadow: none !important;
286
286
  }
287
287
 
288
- @media (max-width: ${$}px) {
288
+ @media (max-width: ${_}px) {
289
289
  button[data-gengage-part="chat-launcher-button"] {
290
- width: ${w} !important;
291
- min-width: ${w} !important;
292
- max-width: ${w} !important;
293
- height: ${x} !important;
294
- min-height: ${x} !important;
290
+ width: ${T} !important;
291
+ min-width: ${T} !important;
292
+ max-width: ${T} !important;
293
+ height: ${k} !important;
294
+ min-height: ${k} !important;
295
295
  padding-left: 20px !important;
296
296
  padding-right: 7px !important;
297
297
  }
@@ -306,7 +306,7 @@ button[data-gengage-part="chat-launcher-button"] img {
306
306
  flex-basis: ${y} !important;
307
307
  }
308
308
  }
309
- `.trim(), k = () => {
309
+ `.trim(), x = () => {
310
310
  for (const o of document.querySelectorAll("[data-gengage-widget]")) {
311
311
  if (!(o instanceof HTMLElement)) continue;
312
312
  const s = o.shadowRoot;
@@ -314,51 +314,110 @@ button[data-gengage-part="chat-launcher-button"] img {
314
314
  return o;
315
315
  }
316
316
  return null;
317
- }, m = (o) => {
318
- if (o.getElementById(p)) return;
317
+ }, f = (o) => {
318
+ if (o.getElementById(g)) return;
319
319
  const s = document.createElement("style");
320
- s.id = p, s.textContent = C, o.appendChild(s);
321
- }, A = P(u), T = (o) => {
322
- m(o);
320
+ s.id = g, s.textContent = R, o.appendChild(s);
321
+ }, A = q(u), v = (o) => {
322
+ f(o);
323
323
  const s = o.querySelector('[data-gengage-part="chat-launcher-button"]');
324
324
  if (!(s instanceof HTMLButtonElement)) return !1;
325
- const c = o.querySelector('[data-gengage-part="chat-header-avatar"]');
326
- if (c instanceof HTMLImageElement) {
327
- const f = o.querySelector('[data-gengage-part="chat-launcher-button"] img');
328
- (!f || c.src === f.src) && c.classList.remove("gengage-chat-header-avatar--logo");
325
+ const l = o.querySelector('[data-gengage-part="chat-header-avatar"]');
326
+ if (l instanceof HTMLImageElement) {
327
+ const b = o.querySelector('[data-gengage-part="chat-launcher-button"] img');
328
+ (!b || l.src === b.src) && l.classList.remove("gengage-chat-header-avatar--logo");
329
329
  }
330
330
  if (s.querySelector(`.${A}`)) return !0;
331
- s.setAttribute("aria-label", e);
332
- const l = document.createElement("span");
333
- return l.className = u, l.textContent = e, s.appendChild(l), !0;
331
+ s.setAttribute("aria-label", n);
332
+ const c = document.createElement("span");
333
+ return c.className = u, c.textContent = n, s.appendChild(c), !0;
334
334
  };
335
335
  return {
336
336
  launcherImageUrl: r,
337
337
  apply: async (o) => {
338
338
  if (o) {
339
- m(o), await Promise.resolve();
340
- for (let c = 0; c < 90; c++) {
341
- if (T(o)) return;
342
- await new Promise((l) => requestAnimationFrame(() => l()));
339
+ f(o), await Promise.resolve();
340
+ for (let l = 0; l < 90; l++) {
341
+ if (v(o)) return;
342
+ await new Promise((c) => requestAnimationFrame(() => c()));
343
343
  }
344
344
  return;
345
345
  }
346
- const s = k();
347
- s?.shadowRoot && m(s.shadowRoot), await Promise.resolve();
348
- for (let c = 0; c < 90; c++) {
349
- const l = k()?.shadowRoot ?? null;
350
- if (l && (m(l), T(l)))
346
+ const s = x();
347
+ s?.shadowRoot && f(s.shadowRoot), await Promise.resolve();
348
+ for (let l = 0; l < 90; l++) {
349
+ const c = x()?.shadowRoot ?? null;
350
+ if (c && (f(c), v(c)))
351
351
  return;
352
- await new Promise((f) => requestAnimationFrame(() => f()));
352
+ await new Promise((b) => requestAnimationFrame(() => b()));
353
353
  }
354
354
  }
355
355
  };
356
356
  }
357
+ var D = 96, p = {
358
+ leadingTokens: [
359
+ "bana",
360
+ "beni",
361
+ "bi",
362
+ "bir",
363
+ "bu",
364
+ "bunu",
365
+ "da",
366
+ "de",
367
+ "hemen",
368
+ "lutfen",
369
+ "su",
370
+ "sunu",
371
+ "urun",
372
+ "urunu"
373
+ ],
374
+ trailingTokens: [
375
+ "artik",
376
+ "da",
377
+ "de",
378
+ "lutfen",
379
+ "misin",
380
+ "misiniz",
381
+ "ya"
382
+ ],
383
+ negativePattern: /\b(?:ekleyem|ekleyemed|eklenem|eklenm|satin aldiktan|satin aldim|iade|iptal|olmuyor|olmadi|olmedi|sorun|problem)\b/,
384
+ cartTargets: ["sepete", "sepetime"],
385
+ cartVerbs: [
386
+ "at",
387
+ "atar",
388
+ "atsana",
389
+ "ekle",
390
+ "ekler",
391
+ "eklesene"
392
+ ],
393
+ buyVerbs: [
394
+ "al",
395
+ "alir",
396
+ "alsana"
397
+ ],
398
+ compactBuyVerbs: ["satinal", "satinalsana"]
399
+ }, B = new Set(p.leadingTokens), N = new Set(p.trailingTokens), V = new Set(p.cartTargets), F = new Set(p.cartVerbs), H = new Set(p.buyVerbs), z = new Set(p.compactBuyVerbs);
400
+ function M(t) {
401
+ return t.toLocaleLowerCase("tr-TR").replace(/ç/g, "c").replace(/ğ/g, "g").replace(/ı/g, "i").replace(/ö/g, "o").replace(/ş/g, "s").replace(/ü/g, "u").replace(/[^a-z0-9]+/g, " ").trim().replace(/\s+/g, " ");
402
+ }
403
+ function j(t) {
404
+ if (!t.trim() || t.length > D || /[??]/.test(t)) return !1;
405
+ const n = M(t);
406
+ if (!n || p.negativePattern.test(n)) return !1;
407
+ const r = n.split(" ");
408
+ for (; r.length > 0 && B.has(r[0]); ) r.shift();
409
+ for (; r.length > 0 && N.has(r[r.length - 1]); ) r.pop();
410
+ return r.length === 1 ? z.has(r[0]) : r.length !== 2 ? !1 : V.has(r[0]) && F.has(r[1]) ? !0 : r[0] === "satin" && H.has(r[1]);
411
+ }
412
+ function J(t) {
413
+ return j(t) ? "directAddToCart" : null;
414
+ }
357
415
  export {
358
- F as a,
359
- P as i,
360
- z as n,
361
- E as o,
362
- M as r,
363
- B as t
416
+ q as a,
417
+ Y as i,
418
+ Z as n,
419
+ W as o,
420
+ X as r,
421
+ E as s,
422
+ J as t
364
423
  };