@gengage/assistant-fe 0.6.49 → 0.7.0
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/api.d.ts +1 -1
- package/dist/chat/components/ChatDrawer.d.ts +3 -1
- package/dist/chat/features/beauty-consulting/mode-controller.d.ts +1 -1
- package/dist/chat/features/beauty-consulting/stream-handler.d.ts +7 -1
- package/dist/chat/history-storage.d.ts +36 -4
- package/dist/chat/runtime.d.ts +73 -3
- package/dist/chat/utils/chat-presentation-debug.d.ts +0 -14
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +72 -72
- package/dist/chat.js +1 -1
- package/dist/common/connection-warning.d.ts +10 -0
- package/dist/common/indexed-db.d.ts +35 -2
- package/dist/common/native-webview.d.ts +1 -1
- package/dist/common/streaming.d.ts +6 -1
- package/dist/common/transport.d.ts +2 -1
- package/dist/common/types.d.ts +16 -0
- package/dist/{common-nAeMxZrn.js → common-CeuGSwJL.js} +61 -65
- package/dist/common.js +30 -30
- package/dist/{connection-warning-CDtUX-ol.js → connection-warning-C0e2byq5.js} +31 -25
- package/dist/{fastIntent-D45C2rEO.js → fastIntent-BI7l1oDv.js} +2 -2
- package/dist/global-error-toast-DvaKvPNA.js +798 -0
- package/dist/index.js +29 -29
- package/dist/native-webview-CHKpwixw.js +303 -0
- package/dist/native.iife.js +30 -30
- package/dist/native.js +1 -1
- package/dist/{overlay-BPZEIyo_.js → overlay-C3XzoSKd.js} +51 -32
- package/dist/overlay.js +6 -6
- package/dist/{price-formatter-CHUmYq8I.js → price-formatter-Q3wUKrl1.js} +2 -1
- package/dist/qna/runtime.d.ts +1 -0
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +32 -32
- package/dist/qna.js +1 -1
- package/dist/{request-response-cache-CGxwN0CV.js → request-response-cache-BLQy7llq.js} +478 -454
- package/dist/{runtime-CNlICVeC.js → runtime-BC8-a6Ql.js} +231 -219
- package/dist/runtime-BSIrZhF2.js +8889 -0
- package/dist/{runtime-Cg-6aUps.js → runtime-DiONTdBz.js} +230 -212
- package/dist/{simbut-BtaGMLLn.js → simbut-BDbb3nMH.js} +5 -5
- package/dist/simbut.iife.js +2 -2
- package/dist/simbut.js +1 -1
- package/dist/simrel/components/GroupTabs.d.ts +6 -0
- package/dist/simrel/runtime.d.ts +8 -0
- package/dist/{simrel-iGl2aXiY.js → simrel-CdxDIKu3.js} +15 -15
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +22 -22
- package/dist/simrel.js +2 -2
- package/dist/widget-base-Cvxdrqqt.js +141 -0
- package/package.json +1 -1
- package/dist/context-UTzCGyR9.js +0 -543
- package/dist/native-webview-CYX30O3Q.js +0 -273
- package/dist/runtime-COLQGOkl.js +0 -8708
- package/dist/widget-base-AuwRxs2X.js +0 -365
package/dist/native.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { E as g, R as f, m, u as _ } from "./global-error-toast-DvaKvPNA.js";
|
|
2
|
+
import { n as v } from "./connection-warning-C0e2byq5.js";
|
|
3
|
+
var y = "__gengageWidgetsInit", l = `${y}_overlay_`, w = "#gengage-qna", C = "#gengage-simrel", T = "#gengage-simbut";
|
|
3
4
|
function d() {
|
|
4
5
|
const i = window;
|
|
5
6
|
return i.__gengageOverlayRegistry || (i.__gengageOverlayRegistry = {
|
|
@@ -7,11 +8,11 @@ function d() {
|
|
|
7
8
|
pending: {}
|
|
8
9
|
}), i.__gengageOverlayRegistry;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function b(i) {
|
|
11
12
|
const e = { pageType: i.pageContext?.pageType ?? (typeof i.sku == "string" ? "pdp" : "other") }, s = i.pageContext;
|
|
12
13
|
return typeof s?.sku == "string" && (e.sku = s.sku), s?.skuList !== void 0 && (e.skuList = s.skuList), s?.price !== void 0 && (e.price = s.price), s?.categoryTree !== void 0 && (e.categoryTree = s.categoryTree), s?.url !== void 0 && (e.url = s.url), s?.extra !== void 0 && (e.extra = s.extra), typeof i.sku == "string" && (e.sku = i.sku), e;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function q(i, e) {
|
|
15
16
|
const s = {
|
|
16
17
|
...i,
|
|
17
18
|
...e,
|
|
@@ -25,9 +26,9 @@ function r(i) {
|
|
|
25
26
|
function p(i) {
|
|
26
27
|
return i.idempotencyKey ?? `${l}${i.accountId}`;
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
+
var S = class {
|
|
29
30
|
constructor(i, e) {
|
|
30
|
-
this.options = i, this.onDestroy = e, this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, this._offQnaWire = null, this._destroyed = !1, this._queue = Promise.resolve(), this._warnedQnaMountMissing = !1, this._warnedSimRelMountMissing = !1, this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this.idempotencyKey = p(i), this.session =
|
|
31
|
+
this.options = i, this.onDestroy = e, this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, this._offQnaWire = null, this._destroyed = !1, this._queue = Promise.resolve(), this._warnedQnaMountMissing = !1, this._warnedSimRelMountMissing = !1, this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this.idempotencyKey = p(i), this.session = _(i.session), this._pageContext = b(i);
|
|
31
32
|
}
|
|
32
33
|
get chat() {
|
|
33
34
|
return this._chat;
|
|
@@ -42,7 +43,7 @@ var q = class {
|
|
|
42
43
|
return this._simbut;
|
|
43
44
|
}
|
|
44
45
|
async init() {
|
|
45
|
-
window.gengage || (window.gengage = {}), window.gengage.sessionId = this.session.sessionId, window.gengage.pageContext = this._pageContext, await this._initChat(), this.options.wireQnaToChat !== !1 && (this._offQnaWire =
|
|
46
|
+
window.gengage || (window.gengage = {}), window.gengage.sessionId = this.session.sessionId, window.gengage.pageContext = this._pageContext, await this._initChat(), this.options.wireQnaToChat !== !1 && (this._offQnaWire = m()), await this._syncPdpWidgets(), window.gengage.overlay = this;
|
|
46
47
|
}
|
|
47
48
|
openChat(i) {
|
|
48
49
|
this._chat?.open(i);
|
|
@@ -52,7 +53,7 @@ var q = class {
|
|
|
52
53
|
}
|
|
53
54
|
async updateContext(i) {
|
|
54
55
|
this._destroyed || await this._enqueue(async () => {
|
|
55
|
-
this._pageContext =
|
|
56
|
+
this._pageContext = q(this._pageContext, i), window.gengage || (window.gengage = {}), window.gengage.pageContext = this._pageContext, this._chat?.update(this._pageContext), this._qna?.update(this._pageContext), this._simrel?.update(this._pageContext), this._simbut?.update(this._pageContext), await this._syncPdpWidgets();
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
async updateSku(i, e = "pdp") {
|
|
@@ -68,7 +69,7 @@ var q = class {
|
|
|
68
69
|
await this.updateContext(i);
|
|
69
70
|
}
|
|
70
71
|
destroy() {
|
|
71
|
-
this._destroyed || (this._destroyed = !0, this._offQnaWire?.(), this._offQnaWire = null, this._chat?.destroy(), this._qna?.destroy(), this._simrel?.destroy(), this._simbut?.destroy(), this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, window.gengage?.overlay === this && delete window.gengage.overlay, this.onDestroy());
|
|
72
|
+
this._destroyed || (this._destroyed = !0, this._offQnaWire?.(), this._offQnaWire = null, this._chat?.destroy(), this._qna?.destroy(), this._simrel?.destroy(), this._simbut?.destroy(), this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, window.gengage?.overlay === this && delete window.gengage.overlay, v(), this.onDestroy());
|
|
72
73
|
}
|
|
73
74
|
async _initChat() {
|
|
74
75
|
if (this.options.chat?.enabled === !1) return;
|
|
@@ -92,7 +93,7 @@ var q = class {
|
|
|
92
93
|
}
|
|
93
94
|
const e = this.options.middlewareUrl;
|
|
94
95
|
if (this.options.qna?.enabled !== !1) {
|
|
95
|
-
const s = this.options.qna?.mountTarget ??
|
|
96
|
+
const s = this.options.qna?.mountTarget ?? w, a = r(s);
|
|
96
97
|
if (a)
|
|
97
98
|
if (this._warnedQnaMountMissing = !1, this._qna)
|
|
98
99
|
this._qna.show(), this._qna.update({
|
|
@@ -100,7 +101,9 @@ var q = class {
|
|
|
100
101
|
sku: i
|
|
101
102
|
});
|
|
102
103
|
else {
|
|
103
|
-
const { GengageQNA: t } = await import("./qna-runtime.js")
|
|
104
|
+
const { GengageQNA: t } = await import("./qna-runtime.js");
|
|
105
|
+
if (this._destroyed) return;
|
|
106
|
+
const h = new t(), o = {
|
|
104
107
|
accountId: this.options.accountId,
|
|
105
108
|
middlewareUrl: e,
|
|
106
109
|
session: this.session,
|
|
@@ -112,14 +115,18 @@ var q = class {
|
|
|
112
115
|
};
|
|
113
116
|
this.options.theme !== void 0 && (o.theme = this.options.theme), this.options.qna?.chrome !== void 0 && (o.chrome = this.options.qna.chrome), this.options.qna?.ctaText !== void 0 && (o.ctaText = this.options.qna.ctaText), this.options.qna?.hideButtonRowCta !== void 0 && (o.hideButtonRowCta = this.options.qna.hideButtonRowCta), this.options.qna?.inputPlaceholder !== void 0 && (o.inputPlaceholder = this.options.qna.inputPlaceholder), this.options.qna?.inputAfterPills !== void 0 && (o.inputAfterPills = this.options.qna.inputAfterPills), this.options.qna?.i18n !== void 0 && (o.i18n = this.options.qna.i18n), this.options.qna?.renderer !== void 0 && (o.renderer = this.options.qna.renderer);
|
|
114
117
|
const n = this.options.qna?.headerTitle ?? this.options.qna?.headingTitle;
|
|
115
|
-
n !== void 0 && (o.headerTitle = n), await h.init(o), this.
|
|
118
|
+
if (n !== void 0 && (o.headerTitle = n), await h.init(o), this._destroyed) {
|
|
119
|
+
h.destroy();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this._qna = h;
|
|
116
123
|
}
|
|
117
124
|
else
|
|
118
125
|
this._qna?.destroy(), this._qna = null, this._warnedQnaMountMissing || (console.warn(`[gengage] QNA mount target not found: ${s}`), this._warnedQnaMountMissing = !0);
|
|
119
126
|
} else
|
|
120
127
|
this._qna?.destroy(), this._qna = null;
|
|
121
128
|
if (this.options.simrel !== void 0 && this.options.simrel.enabled !== !1) {
|
|
122
|
-
const s = this.options.simrel?.mountTarget ??
|
|
129
|
+
const s = this.options.simrel?.mountTarget ?? C, a = r(s);
|
|
123
130
|
if (a)
|
|
124
131
|
if (this._warnedSimRelMountMissing = !1, this._simrel)
|
|
125
132
|
this._simrel.show(), this._simrel.update({
|
|
@@ -127,23 +134,29 @@ var q = class {
|
|
|
127
134
|
sku: i
|
|
128
135
|
});
|
|
129
136
|
else {
|
|
130
|
-
const { GengageSimRel: t } = await import("./simrel-runtime.js")
|
|
137
|
+
const { GengageSimRel: t } = await import("./simrel-runtime.js");
|
|
138
|
+
if (this._destroyed) return;
|
|
139
|
+
const h = new t(), o = {
|
|
131
140
|
accountId: this.options.accountId,
|
|
132
141
|
middlewareUrl: e,
|
|
133
142
|
session: this.session,
|
|
134
143
|
sku: i,
|
|
135
144
|
mountTarget: a
|
|
136
145
|
};
|
|
137
|
-
this.options.locale !== void 0 && (o.locale = this.options.locale), this.options.theme !== void 0 && (o.theme = this.options.theme), this.options.pricing !== void 0 && (o.pricing = this.options.pricing), this.options.simrel?.discountType !== void 0 && (o.discountType = this.options.simrel.discountType), this.options.simrel?.gridColumns !== void 0 && (o.gridColumns = this.options.simrel.gridColumns), this.options.simrel?.enableProductGroupings !== void 0 && (o.enableProductGroupings = this.options.simrel.enableProductGroupings), this.options.simrel?.renderCardElement !== void 0 && (o.renderCardElement = this.options.simrel.renderCardElement), this.options.simrel?.renderer !== void 0 && (o.renderer = this.options.simrel.renderer), this.options.onAddToCart !== void 0 && (o.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 ? o.onProductNavigate = this.options.onProductNavigate : o.onProductNavigate = (n,
|
|
138
|
-
|
|
139
|
-
}, await h.init(o), this.
|
|
146
|
+
if (this.options.locale !== void 0 && (o.locale = this.options.locale), this.options.theme !== void 0 && (o.theme = this.options.theme), this.options.pricing !== void 0 && (o.pricing = this.options.pricing), this.options.simrel?.discountType !== void 0 && (o.discountType = this.options.simrel.discountType), this.options.simrel?.gridColumns !== void 0 && (o.gridColumns = this.options.simrel.gridColumns), this.options.simrel?.enableProductGroupings !== void 0 && (o.enableProductGroupings = this.options.simrel.enableProductGroupings), this.options.simrel?.renderCardElement !== void 0 && (o.renderCardElement = this.options.simrel.renderCardElement), this.options.simrel?.renderer !== void 0 && (o.renderer = this.options.simrel.renderer), this.options.onAddToCart !== void 0 && (o.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 ? o.onProductNavigate = this.options.onProductNavigate : o.onProductNavigate = (n, u, c) => {
|
|
147
|
+
f(n) && (this._chat?.saveSession(c ?? this.session.sessionId, u), window.location.href = n);
|
|
148
|
+
}, await h.init(o), this._destroyed) {
|
|
149
|
+
h.destroy();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this._simrel = h;
|
|
140
153
|
}
|
|
141
154
|
else
|
|
142
155
|
this._simrel?.destroy(), this._simrel = null, this._warnedSimRelMountMissing || (console.warn(`[gengage] SimRel mount target not found: ${s}`), this._warnedSimRelMountMissing = !0);
|
|
143
156
|
} else
|
|
144
157
|
this._simrel?.destroy(), this._simrel = null;
|
|
145
158
|
if (this.options.simbut && this.options.simbut.enabled !== !1) {
|
|
146
|
-
const s = this.options.simbut.mountTarget ??
|
|
159
|
+
const s = this.options.simbut.mountTarget ?? T, a = r(s), t = this._chat ?? this.options.simbut.onFindSimilar;
|
|
147
160
|
if (a && t)
|
|
148
161
|
if (this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this._simbut)
|
|
149
162
|
this._simbut.show(), this._simbut.setChat(this._chat), this._simbut.update({
|
|
@@ -151,7 +164,9 @@ var q = class {
|
|
|
151
164
|
sku: i
|
|
152
165
|
});
|
|
153
166
|
else {
|
|
154
|
-
const { GengageSimBut: h } = await import("./simbut.js")
|
|
167
|
+
const { GengageSimBut: h } = await import("./simbut.js");
|
|
168
|
+
if (this._destroyed) return;
|
|
169
|
+
const o = new h(), n = {
|
|
155
170
|
accountId: this.options.accountId,
|
|
156
171
|
middlewareUrl: e,
|
|
157
172
|
session: this.session,
|
|
@@ -162,7 +177,11 @@ var q = class {
|
|
|
162
177
|
mountTarget: a,
|
|
163
178
|
chat: this._chat
|
|
164
179
|
};
|
|
165
|
-
this.options.theme !== void 0 && (n.theme = this.options.theme), this.options.locale !== void 0 && (n.locale = this.options.locale), this.options.simbut.layout !== void 0 && (n.layout = this.options.simbut.layout), this.options.simbut.inlineCard !== void 0 && (n.inlineCard = this.options.simbut.inlineCard), this.options.simbut.imageUrl !== void 0 && (n.imageUrl = this.options.simbut.imageUrl), this.options.simbut.i18n !== void 0 && (n.i18n = this.options.simbut.i18n), this.options.simbut.onFindSimilar !== void 0 && (n.onFindSimilar = this.options.simbut.onFindSimilar), await o.init(n), this.
|
|
180
|
+
if (this.options.theme !== void 0 && (n.theme = this.options.theme), this.options.locale !== void 0 && (n.locale = this.options.locale), this.options.simbut.layout !== void 0 && (n.layout = this.options.simbut.layout), this.options.simbut.inlineCard !== void 0 && (n.inlineCard = this.options.simbut.inlineCard), this.options.simbut.imageUrl !== void 0 && (n.imageUrl = this.options.simbut.imageUrl), this.options.simbut.i18n !== void 0 && (n.i18n = this.options.simbut.i18n), this.options.simbut.onFindSimilar !== void 0 && (n.onFindSimilar = this.options.simbut.onFindSimilar), await o.init(n), this._destroyed) {
|
|
181
|
+
o.destroy();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this._simbut = o;
|
|
166
185
|
}
|
|
167
186
|
else
|
|
168
187
|
this._simbut?.destroy(), this._simbut = null, !a && !this._warnedSimButMountMissing ? (console.warn(`[gengage] SimBut mount target not found: ${s}`), this._warnedSimButMountMissing = !0) : !t && !this._warnedSimButNoChat && (console.warn("[gengage] SimBut requires chat to be enabled or simbut.onFindSimilar"), this._warnedSimButNoChat = !0);
|
|
@@ -175,35 +194,35 @@ var q = class {
|
|
|
175
194
|
}), e;
|
|
176
195
|
}
|
|
177
196
|
};
|
|
178
|
-
async function
|
|
197
|
+
async function M(i) {
|
|
179
198
|
const e = p(i), s = d(), a = s.instances[e];
|
|
180
199
|
if (a) return a;
|
|
181
200
|
const t = s.pending[e];
|
|
182
201
|
if (t) return t;
|
|
183
|
-
const h = new
|
|
202
|
+
const h = new S(i, () => {
|
|
184
203
|
const n = d();
|
|
185
204
|
delete n.instances[e], delete n.pending[e];
|
|
186
205
|
}), o = h.init().then(() => (s.instances[e] = h, delete s.pending[e], h)).catch((n) => {
|
|
187
|
-
throw delete s.pending[e],
|
|
206
|
+
throw delete s.pending[e], g({
|
|
188
207
|
reason: "overlay_init_failed",
|
|
189
208
|
message: n instanceof Error ? n.message : String(n)
|
|
190
209
|
}), n;
|
|
191
210
|
});
|
|
192
211
|
return s.pending[e] = o, o;
|
|
193
212
|
}
|
|
194
|
-
function
|
|
213
|
+
function x(i) {
|
|
195
214
|
return d().instances[i] ?? null;
|
|
196
215
|
}
|
|
197
|
-
function
|
|
198
|
-
|
|
216
|
+
function P(i) {
|
|
217
|
+
x(i)?.destroy();
|
|
199
218
|
}
|
|
200
|
-
function
|
|
219
|
+
function U(i) {
|
|
201
220
|
return `${l}${i}`;
|
|
202
221
|
}
|
|
203
222
|
export {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
223
|
+
y as a,
|
|
224
|
+
M as i,
|
|
225
|
+
P as n,
|
|
226
|
+
x as r,
|
|
227
|
+
U as t
|
|
209
228
|
};
|
package/dist/overlay.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as r, n as
|
|
1
|
+
import { c as t, d as a } from "./global-error-toast-DvaKvPNA.js";
|
|
2
|
+
import { i as r, n as o, r as i, t as d } from "./overlay-C3XzoSKd.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
t as bootstrapSession,
|
|
5
5
|
d as buildOverlayIdempotencyKey,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
o as destroyOverlayWidgets,
|
|
7
|
+
i as getOverlayWidgets,
|
|
8
8
|
r as initOverlayWidgets,
|
|
9
|
-
|
|
9
|
+
a as updatePageContext
|
|
10
10
|
};
|
|
@@ -28,8 +28,9 @@ var m = {
|
|
|
28
28
|
alwaysShowDecimals: !1
|
|
29
29
|
};
|
|
30
30
|
function y(e, o) {
|
|
31
|
+
if (typeof e != "string" || e.trim() === "") return e;
|
|
31
32
|
const n = Number(e);
|
|
32
|
-
if (!Number.isFinite(n) || n < 0) return e;
|
|
33
|
+
if (!Number.isFinite(n) || n < 0 || n >= 1e15) return e;
|
|
33
34
|
const r = {
|
|
34
35
|
...m,
|
|
35
36
|
...o
|
package/dist/qna/runtime.d.ts
CHANGED
package/dist/qna-runtime.js
CHANGED