@gengage/assistant-fe 0.4.15 → 0.4.17
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/panel-manager.d.ts +29 -1
- package/dist/chat/runtime.d.ts +7 -0
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +36 -36
- package/dist/chat.js +1 -1
- package/dist/common/fastIntent.d.ts +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common.js +46 -45
- package/dist/{pill-launcher-D9ITHv5w.js → fastIntent-CINRmM8r.js} +190 -131
- package/dist/index.js +6 -6
- package/dist/native.iife.js +25 -25
- package/dist/{runtime-EUhElpCX.js → runtime-NJI0NPN6.js} +3310 -3234
- package/package.json +2 -2
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-
|
|
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-NJI0NPN6.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;
|
package/dist/common/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
3
|
-
import { N as L, a as M, c as z, i as B, k as
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import { i as
|
|
7
|
-
import { a as
|
|
8
|
-
import { _ as
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
+
Ie as DEFAULT_CUSTOMIZATION_LOCALE,
|
|
16
16
|
b as DEFAULT_WIDGET_THEME_TOKENS,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
fe as UnknownActionPolicySchema,
|
|
18
|
+
Y as VoiceInput,
|
|
19
19
|
g as adaptBackendEvent,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
ge as applyNativeSession,
|
|
21
|
+
ke as autoDetectPageContext,
|
|
22
22
|
C as basketAddEvent,
|
|
23
23
|
q as bootstrapSession,
|
|
24
24
|
d as buildChatEndpointUrl,
|
|
25
|
-
|
|
25
|
+
oe as buildOverlayIdempotencyKey,
|
|
26
26
|
P as chatHistorySnapshotEvent,
|
|
27
|
-
|
|
27
|
+
U as checkoutCompleteEvent,
|
|
28
28
|
T as checkoutStartEvent,
|
|
29
|
-
|
|
29
|
+
te as configureConnectionWarning,
|
|
30
30
|
p as consumeStream,
|
|
31
|
-
|
|
31
|
+
Pe as createAccountIdentity,
|
|
32
32
|
Ue as createAnalyticsClient,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
63
|
+
n as normalizeProductGroupingsResponse,
|
|
63
64
|
a as normalizeSimilarProductsResponse,
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
Re as parseAccountRuntimeConfig,
|
|
66
|
+
Ee as preflightDiagnostics,
|
|
66
67
|
m as productToNormalized,
|
|
67
|
-
|
|
68
|
+
W as registerGlobalErrorToastListener,
|
|
68
69
|
o as renderUISpecWithRegistry,
|
|
69
70
|
V as resolveSession,
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
81
|
+
ae as trackConnectionWarningRequest,
|
|
81
82
|
B as updatePageContext,
|
|
82
83
|
N as widgetHistorySnapshotEvent,
|
|
83
|
-
|
|
84
|
+
F as wireGADataLayer,
|
|
84
85
|
Q as wireQNAToChat,
|
|
85
86
|
z as wireSimilarToChat,
|
|
86
|
-
|
|
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(
|
|
4
|
-
if (typeof window > "u" || !S(
|
|
3
|
+
function E(t, n) {
|
|
4
|
+
if (typeof window > "u" || !S(t)) return !1;
|
|
5
5
|
const r = new CustomEvent("gengage:navigate", {
|
|
6
|
-
detail:
|
|
7
|
-
url:
|
|
8
|
-
newTab:
|
|
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) ? (
|
|
12
|
+
return window.dispatchEvent(r) ? (n ? window.open(t, "_blank", "noopener,noreferrer") : window.location.href = t, !0) : !1;
|
|
13
13
|
}
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
switch (I("action", `routing action: ${
|
|
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
|
-
|
|
19
|
+
n.openChat?.(e.payload);
|
|
20
20
|
return;
|
|
21
21
|
case "navigate": {
|
|
22
|
-
if (typeof
|
|
23
|
-
h(
|
|
22
|
+
if (typeof e.url != "string") {
|
|
23
|
+
h(e, n, r, a);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
if (!S(
|
|
27
|
-
a.warn("[gengage] Blocked navigation to unsafe 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
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
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 ??
|
|
38
|
+
(r.defaultNavigate ?? L)(e.url, i);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
case "save_session":
|
|
42
|
-
if (typeof
|
|
43
|
-
h(
|
|
42
|
+
if (typeof e.sessionId != "string" || typeof e.sku != "string") {
|
|
43
|
+
h(e, n, r, a);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
sessionId:
|
|
48
|
-
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
|
|
53
|
-
h(
|
|
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
|
-
|
|
57
|
-
sku:
|
|
58
|
-
quantity:
|
|
59
|
-
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(
|
|
64
|
+
h(e, n, r, a);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
if (typeof
|
|
68
|
-
h(
|
|
67
|
+
if (typeof e.name != "string") {
|
|
68
|
+
h(e, n, r, a);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const i =
|
|
72
|
-
|
|
73
|
-
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(
|
|
79
|
+
h(e, n, r, a);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
function h(
|
|
82
|
+
function h(t, n, r, e) {
|
|
83
83
|
const a = r.unknownActionPolicy ?? "log-and-ignore";
|
|
84
84
|
if (a === "delegate") {
|
|
85
|
-
|
|
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: ${
|
|
89
|
-
|
|
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
|
|
91
|
+
function L(t, n) {
|
|
92
92
|
if (!(typeof window > "u")) {
|
|
93
|
-
if (!S(
|
|
94
|
-
console.warn("[gengage] Blocked navigation to unsafe URL:",
|
|
93
|
+
if (!S(t)) {
|
|
94
|
+
console.warn("[gengage] Blocked navigation to unsafe URL:", t);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
E(
|
|
97
|
+
E(t, n);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return typeof
|
|
100
|
+
function U(t) {
|
|
101
|
+
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
if (typeof
|
|
106
|
-
const r = Array.from(
|
|
107
|
-
return r.map((
|
|
108
|
-
const i =
|
|
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 &&
|
|
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
|
|
113
|
-
return
|
|
112
|
+
function Y() {
|
|
113
|
+
return C() !== null;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
return
|
|
115
|
+
function C() {
|
|
116
|
+
const t = globalThis;
|
|
117
|
+
return t.SpeechRecognition ?? t.webkitSpeechRecognition ?? null;
|
|
118
118
|
}
|
|
119
|
-
var
|
|
120
|
-
constructor(
|
|
121
|
-
this.recognition = null, this._state = "idle", this.silenceTimer = null, this.accumulatedTranscript = "", this.intentionalStop = !1, this._lastRestartAt = 0, this.callbacks =
|
|
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
|
|
129
|
-
if (!
|
|
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
|
|
139
|
-
|
|
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
|
-
},
|
|
141
|
+
}, n.onresult = (r) => {
|
|
142
142
|
this.clearSilenceTimer();
|
|
143
|
-
let
|
|
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
|
|
148
|
-
|
|
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)),
|
|
151
|
-
},
|
|
152
|
-
const
|
|
153
|
-
this.intentionalStop && (r.error === "no-speech" || r.error === "aborted") || (this.setState("error"), this.callbacks.onError?.(
|
|
154
|
-
},
|
|
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
|
-
|
|
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 =
|
|
170
|
+
}, this.recognition = n;
|
|
171
171
|
try {
|
|
172
|
-
|
|
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(
|
|
201
|
-
this._state !==
|
|
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
|
|
206
|
-
|
|
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
|
|
214
|
-
switch (
|
|
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
|
|
230
|
-
const { label:
|
|
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: ${
|
|
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: ${
|
|
240
|
-
min-width: ${
|
|
241
|
-
max-width: ${
|
|
242
|
-
height: ${
|
|
243
|
-
min-height: ${
|
|
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: ${
|
|
278
|
-
height: ${
|
|
279
|
-
flex: 0 0 ${
|
|
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: ${
|
|
288
|
+
@media (max-width: ${_}px) {
|
|
289
289
|
button[data-gengage-part="chat-launcher-button"] {
|
|
290
|
-
width: ${
|
|
291
|
-
min-width: ${
|
|
292
|
-
max-width: ${
|
|
293
|
-
height: ${
|
|
294
|
-
min-height: ${
|
|
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(),
|
|
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
|
-
},
|
|
318
|
-
if (o.getElementById(
|
|
317
|
+
}, f = (o) => {
|
|
318
|
+
if (o.getElementById(g)) return;
|
|
319
319
|
const s = document.createElement("style");
|
|
320
|
-
s.id =
|
|
321
|
-
}, A =
|
|
322
|
-
|
|
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
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
328
|
-
(!
|
|
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",
|
|
332
|
-
const
|
|
333
|
-
return
|
|
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
|
-
|
|
340
|
-
for (let
|
|
341
|
-
if (
|
|
342
|
-
await new Promise((
|
|
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 =
|
|
347
|
-
s?.shadowRoot &&
|
|
348
|
-
for (let
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
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((
|
|
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
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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
|
};
|