wineater-bot 3.4.0 → 3.4.2
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/wineater-chatbot.mjs +58 -61
- package/dist/wineater-chatbot.umd.js +3 -3
- package/package.json +1 -1
- package/src/js/widget.js +3 -6
|
@@ -2760,7 +2760,7 @@ function bt(t) {
|
|
|
2760
2760
|
function Et(t) {
|
|
2761
2761
|
return t.nodeType === Node.DOCUMENT_NODE || t.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
2762
2762
|
}
|
|
2763
|
-
function
|
|
2763
|
+
function Q(t, e) {
|
|
2764
2764
|
return t.localName === e;
|
|
2765
2765
|
}
|
|
2766
2766
|
class Kr {
|
|
@@ -2769,7 +2769,7 @@ class Kr {
|
|
|
2769
2769
|
this.clear(), this.app.nodes.scanTree(this.captureCanvas);
|
|
2770
2770
|
}, this.captureCanvas = (s) => {
|
|
2771
2771
|
const i = this.app.nodes.getID(s);
|
|
2772
|
-
if (!i || !
|
|
2772
|
+
if (!i || !Q(s, "canvas") || this.app.sanitizer.isObscured(i) || this.app.sanitizer.isHidden(i) || !Q(s, "canvas") || this.snapshots[i])
|
|
2773
2773
|
return;
|
|
2774
2774
|
new IntersectionObserver((l) => {
|
|
2775
2775
|
l.forEach((o) => {
|
|
@@ -2792,7 +2792,7 @@ class Kr {
|
|
|
2792
2792
|
});
|
|
2793
2793
|
}, o = setInterval(() => {
|
|
2794
2794
|
const u = this.app.nodes.getID(s), c = u ? this.app.nodes.getNode(u) : void 0;
|
|
2795
|
-
!c || !
|
|
2795
|
+
!c || !Q(c, "canvas") || c !== s ? (this.app.debug.log("Canvas element not in sync"), clearInterval(o)) : this.snapshots[i].paused || (this.options.useAnimationFrame ? requestAnimationFrame(() => {
|
|
2796
2796
|
l(c);
|
|
2797
2797
|
}) : l(c));
|
|
2798
2798
|
}, this.interval);
|
|
@@ -2993,12 +2993,12 @@ class Rn {
|
|
|
2993
2993
|
s.substr(0, 6) === "xlink:" && (s = s.substr(6)), i === null ? this.app.send(Yn(e, s)) : s === "href" ? (i.length > 1e5 && (i = ""), this.app.send(hn(e, s, i, this.app.getBaseHref()))) : this.app.attributeSender.sendSetAttribute(e, s, i);
|
|
2994
2994
|
return;
|
|
2995
2995
|
}
|
|
2996
|
-
if (!(s === "src" || s === "srcset" || s === "integrity" || s === "crossorigin" || s === "autocomplete" || s.substr(0, 2) === "on") && !(s === "value" &&
|
|
2996
|
+
if (!(s === "src" || s === "srcset" || s === "integrity" || s === "crossorigin" || s === "autocomplete" || s.substr(0, 2) === "on") && !(s === "value" && Q(n, "input") && n.type !== "button" && n.type !== "reset" && n.type !== "submit")) {
|
|
2997
2997
|
if (i === null) {
|
|
2998
2998
|
this.app.send(Yn(e, s));
|
|
2999
2999
|
return;
|
|
3000
3000
|
}
|
|
3001
|
-
if (s === "style" || s === "href" &&
|
|
3001
|
+
if (s === "style" || s === "href" && Q(n, "link")) {
|
|
3002
3002
|
this.app.send(hn(e, s, i, this.app.getBaseHref()));
|
|
3003
3003
|
return;
|
|
3004
3004
|
}
|
|
@@ -3006,7 +3006,7 @@ class Rn {
|
|
|
3006
3006
|
}
|
|
3007
3007
|
}
|
|
3008
3008
|
sendNodeData(e, n, s) {
|
|
3009
|
-
if (
|
|
3009
|
+
if (Q(n, "style")) {
|
|
3010
3010
|
this.app.send(hr(e, s, this.app.getBaseHref()));
|
|
3011
3011
|
return;
|
|
3012
3012
|
}
|
|
@@ -3059,7 +3059,7 @@ class Rn {
|
|
|
3059
3059
|
return !0;
|
|
3060
3060
|
const s = n.parentNode;
|
|
3061
3061
|
let i;
|
|
3062
|
-
if (!
|
|
3062
|
+
if (!Q(n, "html") || !this.isTopContext) {
|
|
3063
3063
|
if (s === null)
|
|
3064
3064
|
return this.unbindTree(n), !1;
|
|
3065
3065
|
if (i = this.app.nodes.getID(s), i === void 0)
|
|
@@ -3222,7 +3222,7 @@ class to extends Rn {
|
|
|
3222
3222
|
super(e, !0), this.iframeOffsets = new eo(), this.contextCallbacks = [], this.contextsSet = /* @__PURE__ */ new Set(), this.iframeObservers = [], this.shadowRootObservers = [], this.options = Object.assign({
|
|
3223
3223
|
captureIFrames: !0
|
|
3224
3224
|
}, n), this.app.nodes.attachNodeCallback((s) => {
|
|
3225
|
-
|
|
3225
|
+
Q(s, "iframe") && (this.options.captureIFrames && !Ae(s, "obscured") || Ae(s, "capture")) && this.handleIframe(s);
|
|
3226
3226
|
}), this.app.nodes.attachNodeCallback((s) => {
|
|
3227
3227
|
ke(s) && s.shadowRoot !== null && this.handleShadowRoot(s.shadowRoot);
|
|
3228
3228
|
});
|
|
@@ -3412,10 +3412,10 @@ class oo {
|
|
|
3412
3412
|
}
|
|
3413
3413
|
}
|
|
3414
3414
|
const Qe = "canceled", gs = "or_uxt_active", en = "or_buffer_1", Ce = (t) => ({ reason: t, success: !1 }), ao = (t) => ({ ...t, success: !0 });
|
|
3415
|
-
var
|
|
3415
|
+
var Y;
|
|
3416
3416
|
(function(t) {
|
|
3417
3417
|
t[t.NotActive = 0] = "NotActive", t[t.Starting = 1] = "Starting", t[t.Active = 2] = "Active", t[t.ColdStart = 3] = "ColdStart";
|
|
3418
|
-
})(
|
|
3418
|
+
})(Y || (Y = {}));
|
|
3419
3419
|
const ti = "https://api.openreplay.com/ingest";
|
|
3420
3420
|
function tn() {
|
|
3421
3421
|
const t = (/* @__PURE__ */ new Date()).getTimezoneOffset() * -1, e = t >= 0 ? "+" : "-", n = Math.floor(Math.abs(t) / 60), s = Math.abs(t) % 60;
|
|
@@ -3437,7 +3437,7 @@ const co = (t) => new Promise((e) => setTimeout(e, t)), ue = {
|
|
|
3437
3437
|
};
|
|
3438
3438
|
let lo = class {
|
|
3439
3439
|
constructor(e, n, s, i, r) {
|
|
3440
|
-
this.signalError = i, this.insideIframe = r, this.messages = [], this.bufferedMessages1 = [], this.bufferedMessages2 = [], this.startCallbacks = [], this.stopCallbacks = [], this.commitCallbacks = [], this.activityState =
|
|
3440
|
+
this.signalError = i, this.insideIframe = r, this.messages = [], this.bufferedMessages1 = [], this.bufferedMessages2 = [], this.startCallbacks = [], this.stopCallbacks = [], this.commitCallbacks = [], this.activityState = Y.NotActive, this.version = "14.0.4", this.socketMode = !1, this.compressionThreshold = 24 * 1e3, this.bc = null, this.canvasRecorder = null, this.conditionsManager = null, this.canStart = !1, this.rootId = null, this.pageFrames = [], this.frameOderNumber = 0, this.initialHostName = location.hostname, this.startTimeout = null, this.coldStartCommitN = 0, this.delay = 0, this.coldInterval = null, this.orderNumber = 0, this.coldStartTs = 0, this.singleBuffer = !1, this.onSessionSent = () => {
|
|
3441
3441
|
}, this.restartCanvasTracking = () => {
|
|
3442
3442
|
var o;
|
|
3443
3443
|
(o = this.canvasRecorder) == null || o.restartTracking();
|
|
@@ -3667,7 +3667,7 @@ let lo = class {
|
|
|
3667
3667
|
}
|
|
3668
3668
|
send(e, n = !1) {
|
|
3669
3669
|
var s;
|
|
3670
|
-
this.activityState !==
|
|
3670
|
+
this.activityState !== Y.NotActive && (this.activityState === Y.ColdStart ? (this.bufferedMessages1.push(e), this.singleBuffer || this.bufferedMessages2.push(e), (s = this.conditionsManager) == null || s.processMessage(e)) : this.messages.push(e), this.activityState === Y.Active && n && this.commit());
|
|
3671
3671
|
}
|
|
3672
3672
|
/**
|
|
3673
3673
|
* Normal workflow: add timestamp and tab data to batch, then commit it
|
|
@@ -3709,7 +3709,7 @@ let lo = class {
|
|
|
3709
3709
|
this.coldStartCommitN += 1, this.coldStartCommitN === 2 && (this.bufferedMessages1.push(Re(this.timestamp())), this.bufferedMessages1.push(De(this.session.getTabId())), this.bufferedMessages2.push(Re(this.timestamp())), this.bufferedMessages2.push(De(this.session.getTabId())), this.coldStartCommitN = 0);
|
|
3710
3710
|
}
|
|
3711
3711
|
commit() {
|
|
3712
|
-
this.activityState ===
|
|
3712
|
+
this.activityState === Y.ColdStart ? this._cStartCommit() : this._nCommit();
|
|
3713
3713
|
}
|
|
3714
3714
|
postToWorker(e) {
|
|
3715
3715
|
var n;
|
|
@@ -3808,7 +3808,7 @@ let lo = class {
|
|
|
3808
3808
|
return e.startsWith(this.options.ingestPoint);
|
|
3809
3809
|
}
|
|
3810
3810
|
active() {
|
|
3811
|
-
return this.activityState ===
|
|
3811
|
+
return this.activityState === Y.Active;
|
|
3812
3812
|
}
|
|
3813
3813
|
resetNextPageSession(e) {
|
|
3814
3814
|
e ? this.sessionStorage.setItem(this.options.session_reset_key, "t") : this.sessionStorage.removeItem(this.options.session_reset_key);
|
|
@@ -3827,7 +3827,7 @@ let lo = class {
|
|
|
3827
3827
|
const s = 1e3, i = this.checkSessionToken(e.forceNew);
|
|
3828
3828
|
n && await this.setupConditionalStart(e);
|
|
3829
3829
|
const r = () => {
|
|
3830
|
-
this.orderNumber += 1, Kt(), this.coldStartTs = pe(), this.orderNumber % 2 === 0 ? (this.bufferedMessages1.length = 0, this.bufferedMessages1.push(Re(this.timestamp())), this.bufferedMessages1.push(De(this.session.getTabId()))) : (this.bufferedMessages2.length = 0, this.bufferedMessages2.push(Re(this.timestamp())), this.bufferedMessages2.push(De(this.session.getTabId()))), this.stop(!1), this.activityState =
|
|
3830
|
+
this.orderNumber += 1, Kt(), this.coldStartTs = pe(), this.orderNumber % 2 === 0 ? (this.bufferedMessages1.length = 0, this.bufferedMessages1.push(Re(this.timestamp())), this.bufferedMessages1.push(De(this.session.getTabId()))) : (this.bufferedMessages2.length = 0, this.bufferedMessages2.push(Re(this.timestamp())), this.bufferedMessages2.push(De(this.session.getTabId()))), this.stop(!1), this.activityState = Y.ColdStart, e.sessionHash && this.session.applySessionHash(e.sessionHash), e.forceNew && this.session.reset(), this.session.assign({
|
|
3831
3831
|
userID: e.userID,
|
|
3832
3832
|
metadata: e.metadata
|
|
3833
3833
|
}), i || (this.debug.log("continuing session on new tab", this.session.getTabId()), this.send(lt(this.session.getTabId()))), this.observer.observe(), this.ticker.start();
|
|
@@ -3894,7 +3894,7 @@ let lo = class {
|
|
|
3894
3894
|
const a = JSON.parse(i);
|
|
3895
3895
|
this.bufferedMessages1 = Array.isArray(a) ? a : this.bufferedMessages1, this.localStorage.removeItem(en);
|
|
3896
3896
|
}
|
|
3897
|
-
this.bufferedMessages1.push(Re(this.timestamp())), this.bufferedMessages1.push(De(this.session.getTabId())), this.activityState =
|
|
3897
|
+
this.bufferedMessages1.push(Re(this.timestamp())), this.bufferedMessages1.push(De(this.session.getTabId())), this.activityState = Y.ColdStart, e.sessionHash && this.session.applySessionHash(e.sessionHash), e.forceNew && this.session.reset(), this.session.assign({
|
|
3898
3898
|
userID: e.userID,
|
|
3899
3899
|
metadata: e.metadata
|
|
3900
3900
|
});
|
|
@@ -3981,14 +3981,14 @@ let lo = class {
|
|
|
3981
3981
|
this.postToWorker([["q_end"]]), this.clearBuffers();
|
|
3982
3982
|
}
|
|
3983
3983
|
async _start(e = {}, n = !1, s) {
|
|
3984
|
-
const i = this.activityState ===
|
|
3984
|
+
const i = this.activityState === Y.ColdStart;
|
|
3985
3985
|
if (i && this.coldInterval && clearInterval(this.coldInterval), !this.worker) {
|
|
3986
3986
|
const o = "No worker found: perhaps, CSP is not set.";
|
|
3987
3987
|
return this.signalError(o, []), Promise.resolve(Ce(o));
|
|
3988
3988
|
}
|
|
3989
|
-
if (this.activityState ===
|
|
3989
|
+
if (this.activityState === Y.Active || this.activityState === Y.Starting)
|
|
3990
3990
|
return Promise.resolve(Ce("OpenReplay: trying to call `start()` on the instance that has been started already."));
|
|
3991
|
-
this.activityState =
|
|
3991
|
+
this.activityState = Y.Starting, i || Kt(), e.sessionHash && this.session.applySessionHash(e.sessionHash), e.forceNew && this.session.reset(), this.session.assign({
|
|
3992
3992
|
// MBTODO: maybe it would make sense to `forceNew` if the `userID` was changed
|
|
3993
3993
|
userID: e.userID,
|
|
3994
3994
|
metadata: e.metadata
|
|
@@ -4081,7 +4081,7 @@ let lo = class {
|
|
|
4081
4081
|
beaconSizeLimit: p
|
|
4082
4082
|
}), !l && u === a && (this.debug.log("continuing session on new tab", this.session.getTabId()), this.send(lt(this.session.getTabId()))), Object.entries(this.session.getInfo().metadata).forEach(([N, P]) => this.send(Qn(N, P))), this.localStorage.setItem(this.options.local_uuid_key, c), this.compressionThreshold = b;
|
|
4083
4083
|
const $ = { sessionToken: u, userUUID: c, sessionID: y };
|
|
4084
|
-
if (this.startCallbacks.forEach((N) => N($)), this.featureFlags.reloadFlags(), await this.tagWatcher.fetchTags(this.options.ingestPoint, u), this.activityState =
|
|
4084
|
+
if (this.startCallbacks.forEach((N) => N($)), this.featureFlags.reloadFlags(), await this.tagWatcher.fetchTags(this.options.ingestPoint, u), this.activityState = Y.Active, M && !this.options.canvas.disableCanvas && (this.canvasRecorder = this.canvasRecorder ?? new Kr(this, {
|
|
4085
4085
|
fps: T,
|
|
4086
4086
|
quality: I,
|
|
4087
4087
|
isDebug: this.options.canvas.__save_canvas_locally,
|
|
@@ -4133,7 +4133,7 @@ let lo = class {
|
|
|
4133
4133
|
async waitStarted() {
|
|
4134
4134
|
return new Promise((e) => {
|
|
4135
4135
|
const n = () => {
|
|
4136
|
-
this.activityState ===
|
|
4136
|
+
this.activityState === Y.Active ? e(!0) : setTimeout(n, 25);
|
|
4137
4137
|
};
|
|
4138
4138
|
n();
|
|
4139
4139
|
});
|
|
@@ -4143,7 +4143,7 @@ let lo = class {
|
|
|
4143
4143
|
* and here we just apply 10ms delay just in case
|
|
4144
4144
|
* */
|
|
4145
4145
|
async start(...e) {
|
|
4146
|
-
return this.activityState ===
|
|
4146
|
+
return this.activityState === Y.Active || this.activityState === Y.Starting ? Promise.resolve(Ce("OpenReplay: trying to call `start()` on the instance that has been started already.")) : document.hidden ? new Promise((n) => {
|
|
4147
4147
|
const s = async () => {
|
|
4148
4148
|
document.hidden || (await this.waitStart(), document.removeEventListener("visibilitychange", s), n(this._start(...e)));
|
|
4149
4149
|
};
|
|
@@ -4173,11 +4173,11 @@ let lo = class {
|
|
|
4173
4173
|
}
|
|
4174
4174
|
stop(e = !0) {
|
|
4175
4175
|
var n;
|
|
4176
|
-
if (this.activityState !==
|
|
4176
|
+
if (this.activityState !== Y.NotActive)
|
|
4177
4177
|
try {
|
|
4178
4178
|
this.attributeSender.clear(), this.sanitizer.clear(), this.observer.disconnect(), this.nodes.clear(), this.ticker.stop(), this.stopCallbacks.forEach((s) => s()), this.debug.log("OpenReplay tracking stopped."), this.tagWatcher.clear(), this.worker && e && this.worker.postMessage("stop"), (n = this.canvasRecorder) == null || n.clear();
|
|
4179
4179
|
} finally {
|
|
4180
|
-
this.activityState =
|
|
4180
|
+
this.activityState = Y.NotActive;
|
|
4181
4181
|
}
|
|
4182
4182
|
}
|
|
4183
4183
|
};
|
|
@@ -4576,7 +4576,7 @@ function xo(t) {
|
|
|
4576
4576
|
t.attachStopCallback(() => {
|
|
4577
4577
|
a.disconnect();
|
|
4578
4578
|
}), t.nodes.attachNodeCallback((l) => {
|
|
4579
|
-
|
|
4579
|
+
Q(l, "img") && (t.nodes.attachNodeListener(l, "error", () => i(l)), t.nodes.attachNodeListener(l, "load", () => r(l)), r(l), a.observe(l, { attributes: !0, attributeFilter: ["src", "srcset"] }));
|
|
4580
4580
|
});
|
|
4581
4581
|
}
|
|
4582
4582
|
const ko = [
|
|
@@ -4591,10 +4591,10 @@ const ko = [
|
|
|
4591
4591
|
"time"
|
|
4592
4592
|
];
|
|
4593
4593
|
function To(t) {
|
|
4594
|
-
return
|
|
4594
|
+
return Q(t, "textarea") ? !0 : Q(t, "input") ? ko.includes(t.type) : !1;
|
|
4595
4595
|
}
|
|
4596
4596
|
function Eo(t) {
|
|
4597
|
-
if (!
|
|
4597
|
+
if (!Q(t, "input"))
|
|
4598
4598
|
return !1;
|
|
4599
4599
|
const e = t.type;
|
|
4600
4600
|
return e === "checkbox" || e === "radio";
|
|
@@ -4602,7 +4602,7 @@ function Eo(t) {
|
|
|
4602
4602
|
const Io = Se && "labels" in HTMLInputElement.prototype ? (t) => {
|
|
4603
4603
|
let e = t;
|
|
4604
4604
|
for (; (e = e.parentNode) !== null; )
|
|
4605
|
-
if (
|
|
4605
|
+
if (Q(e, "label"))
|
|
4606
4606
|
return e;
|
|
4607
4607
|
const n = t.labels;
|
|
4608
4608
|
if (n !== null && n.length === 1)
|
|
@@ -4610,7 +4610,7 @@ const Io = Se && "labels" in HTMLInputElement.prototype ? (t) => {
|
|
|
4610
4610
|
} : (t) => {
|
|
4611
4611
|
let e = t;
|
|
4612
4612
|
for (; (e = e.parentNode) !== null; )
|
|
4613
|
-
if (
|
|
4613
|
+
if (Q(e, "label"))
|
|
4614
4614
|
return e;
|
|
4615
4615
|
const n = t.id;
|
|
4616
4616
|
if (n) {
|
|
@@ -4687,7 +4687,7 @@ function Co(t, e) {
|
|
|
4687
4687
|
t.nodes.attachNodeCallback(t.safe((c) => {
|
|
4688
4688
|
const d = t.nodes.getID(c);
|
|
4689
4689
|
if (d !== void 0) {
|
|
4690
|
-
if (
|
|
4690
|
+
if (Q(c, "select") && (i(d, c), t.nodes.attachNodeListener(c, "change", () => i(d, c))), To(c)) {
|
|
4691
4691
|
l(d, c);
|
|
4692
4692
|
let p = 0, b = 0, w = 0;
|
|
4693
4693
|
const y = () => {
|
|
@@ -4926,7 +4926,7 @@ function jo(t, e) {
|
|
|
4926
4926
|
const C = Nn(k);
|
|
4927
4927
|
if (C !== null)
|
|
4928
4928
|
return C;
|
|
4929
|
-
if (
|
|
4929
|
+
if (Q(k, "input"))
|
|
4930
4930
|
return ri(k);
|
|
4931
4931
|
if (xn(k)) {
|
|
4932
4932
|
let _ = "";
|
|
@@ -4989,7 +4989,7 @@ function zo(t) {
|
|
|
4989
4989
|
for (let i = 0; i < n.length; i++) {
|
|
4990
4990
|
const r = n[i];
|
|
4991
4991
|
let a = "";
|
|
4992
|
-
if (
|
|
4992
|
+
if (Q(r, "img") && (a = r.currentSrc || r.src), !a) {
|
|
4993
4993
|
const w = getComputedStyle(r).getPropertyValue("background-image");
|
|
4994
4994
|
if (w) {
|
|
4995
4995
|
const y = s.exec(w);
|
|
@@ -5264,7 +5264,7 @@ function Go(t) {
|
|
|
5264
5264
|
};
|
|
5265
5265
|
});
|
|
5266
5266
|
s(window), t.observer.attachContextCallback(s), t.nodes.attachNodeCallback((i) => {
|
|
5267
|
-
if (!
|
|
5267
|
+
if (!Q(i, "style") || !i.sheet || i.textContent !== null && i.textContent.trim().length > 0)
|
|
5268
5268
|
return;
|
|
5269
5269
|
const r = t.nodes.getID(i);
|
|
5270
5270
|
if (!r)
|
|
@@ -5283,7 +5283,7 @@ function Ko(t) {
|
|
|
5283
5283
|
}
|
|
5284
5284
|
let n = !1;
|
|
5285
5285
|
t.nodes.attachNodeCallback((s) => {
|
|
5286
|
-
|
|
5286
|
+
Q(s, "body") && (t.nodes.attachNodeListener(s, "focus", (i) => {
|
|
5287
5287
|
ei(i.target) && (e(i.target), n = !1);
|
|
5288
5288
|
}), t.nodes.attachNodeListener(s, "blur", (i) => {
|
|
5289
5289
|
i.relatedTarget === null && (n = !0, setTimeout(() => {
|
|
@@ -5292,7 +5292,7 @@ function Ko(t) {
|
|
|
5292
5292
|
}));
|
|
5293
5293
|
}), t.attachStartCallback(() => {
|
|
5294
5294
|
let s = document.activeElement;
|
|
5295
|
-
for (; s &&
|
|
5295
|
+
for (; s && Q(s, "iframe") && s.contentDocument; )
|
|
5296
5296
|
s = s.contentDocument.activeElement;
|
|
5297
5297
|
s && s !== s.ownerDocument.body && e(s);
|
|
5298
5298
|
}, !0);
|
|
@@ -7513,11 +7513,11 @@ class va {
|
|
|
7513
7513
|
return s;
|
|
7514
7514
|
}
|
|
7515
7515
|
}
|
|
7516
|
-
const
|
|
7516
|
+
const Z = new va();
|
|
7517
7517
|
class ba {
|
|
7518
7518
|
constructor() {
|
|
7519
|
-
var e, n, s, i;
|
|
7520
|
-
this.widgetType = ((e = window == null ? void 0 : window.wineaterData) == null ? void 0 : e.WIDGET_TYPE) || "store", this.
|
|
7519
|
+
var e, n, s, i, r;
|
|
7520
|
+
this.widgetType = ((e = window == null ? void 0 : window.wineaterData) == null ? void 0 : e.WIDGET_TYPE) || "store", this.countryCode = ((n = window == null ? void 0 : window.wineaterData) == null ? void 0 : n.COUNTRY_CODE) || null, this.widgetWrapper = ((s = window == null ? void 0 : window.wineaterData) == null ? void 0 : s.WIDGET_WRAPPER) || "wineater-widget-conteiner", this.titleText = (i = window == null ? void 0 : window.wineaterData) == null ? void 0 : i.TITLE_TEXT, this.subtitleText = (r = window == null ? void 0 : window.wineaterData) == null ? void 0 : r.SUBTITLE_TEXT, this.api = new fi(), console.log(this.titleText), this.selectedFilters = {
|
|
7521
7521
|
price: null,
|
|
7522
7522
|
color: null,
|
|
7523
7523
|
intensity: null
|
|
@@ -7528,18 +7528,18 @@ class ba {
|
|
|
7528
7528
|
}
|
|
7529
7529
|
getTitle(e) {
|
|
7530
7530
|
return e ? `<h1 class="wine-widget-big-title">${e}</h1>` : `<h1 class="wine-widget-big-title">
|
|
7531
|
-
${
|
|
7531
|
+
${Z.translate("headerLine1")}
|
|
7532
7532
|
<span class="icon icon-meal"></span>
|
|
7533
|
-
<span class="icon-label">${
|
|
7533
|
+
<span class="icon-label">${Z.translate("headerMeal")}</span>,
|
|
7534
7534
|
<span class="icon icon-mood"></span>
|
|
7535
|
-
<span class="icon-label">${
|
|
7535
|
+
<span class="icon-label">${Z.translate("headerMood")}</span>
|
|
7536
7536
|
</br>
|
|
7537
7537
|
<!-- <span class="icon icon-budget"></span> -->
|
|
7538
|
-
<!-- <span class="icon-label">${
|
|
7539
|
-
${
|
|
7538
|
+
<!-- <span class="icon-label">${Z.translate("headerBudget")}</span>, -->
|
|
7539
|
+
${Z.translate("headerOr")}
|
|
7540
7540
|
<span class="icon icon-occasion"></span>
|
|
7541
|
-
<span class="icon-label">${
|
|
7542
|
-
${
|
|
7541
|
+
<span class="icon-label">${Z.translate("headerOccasion")}</span>
|
|
7542
|
+
${Z.translate("headerLine2")}
|
|
7543
7543
|
</h1>`;
|
|
7544
7544
|
}
|
|
7545
7545
|
initializeWidget() {
|
|
@@ -7558,11 +7558,11 @@ class ba {
|
|
|
7558
7558
|
<input
|
|
7559
7559
|
type="text"
|
|
7560
7560
|
id="wine-search-input"
|
|
7561
|
-
placeholder="${
|
|
7561
|
+
placeholder="${Z.translate("searchPlaceholder")}">
|
|
7562
7562
|
|
|
7563
7563
|
<!-- Кнопка -->
|
|
7564
7564
|
<button id="wine-search-button">
|
|
7565
|
-
${
|
|
7565
|
+
${Z.translate("searchButton")}
|
|
7566
7566
|
</button>
|
|
7567
7567
|
</div>
|
|
7568
7568
|
<div id="wine-widget-right">
|
|
@@ -7575,9 +7575,9 @@ class ba {
|
|
|
7575
7575
|
</div>
|
|
7576
7576
|
<div id="powered-by-widget">
|
|
7577
7577
|
<a href="https://wineater.com" target="_blank">
|
|
7578
|
-
<span>${
|
|
7579
|
-
<img src="${
|
|
7580
|
-
<span>${
|
|
7578
|
+
<span>${Z.translate("poweredBy")}</span>
|
|
7579
|
+
<img src="${this.countryCode === "ru" ? "https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/divino_logo.svg?x=5" : "https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/logo_medium_gray.svg"}" alt="Wineater Logo">
|
|
7580
|
+
<span>${Z.translate("AI sommelier")}</span>
|
|
7581
7581
|
</a>
|
|
7582
7582
|
</div>
|
|
7583
7583
|
</div>
|
|
@@ -7636,18 +7636,18 @@ class ba {
|
|
|
7636
7636
|
e.forEach((o, u) => {
|
|
7637
7637
|
const c = i(o, "title"), d = i(o, "image"), p = i(o, "total"), b = i(o, "url"), w = o.tags || o.Tags, y = r(o, ["type", "country", "region", "grape"]), E = w ? a(w) : "", R = l(o), j = o["Short Description"], A = o.pairing_recommendation, k = o.isSommSelection, C = `
|
|
7638
7638
|
<div class="wine-recommendation-tile ${k ? "somm-selection" : ""}">
|
|
7639
|
-
${k ? `<div class="somm-selection-badge">${
|
|
7639
|
+
${k ? `<div class="somm-selection-badge">${Z.translate("wineDetails.sommSelection")}</div>` : ""}
|
|
7640
7640
|
|
|
7641
7641
|
<div class="tile-top">
|
|
7642
7642
|
${d ? `<img src="${d}" alt="${c}" class="wine-image" />` : ""}
|
|
7643
|
-
<div class="wine-price">${p} ${
|
|
7643
|
+
<div class="wine-price">${p} ${Z.getCurrency("label")}</div>
|
|
7644
7644
|
<h3 class="wine-title">${c}</h3>
|
|
7645
7645
|
</div>
|
|
7646
7646
|
|
|
7647
7647
|
${y ? `<div class="wine-params">${y}</div>` : ""}
|
|
7648
7648
|
|
|
7649
7649
|
<div class="bottom-row">
|
|
7650
|
-
${b ? `<a class="buy-btn" href="${b}" target="_blank">${
|
|
7650
|
+
${b ? `<a class="buy-btn" href="${b}" target="_blank">${Z.translate("wineDetails.buy")}</a>` : `<button class="buy-btn" data-toggle-info>${Z.translate("moreInfo")}</button>`}
|
|
7651
7651
|
</div>
|
|
7652
7652
|
|
|
7653
7653
|
<div class="card-popup hidden">
|
|
@@ -7670,10 +7670,7 @@ class ba {
|
|
|
7670
7670
|
T == null || T.addEventListener("click", (F) => {
|
|
7671
7671
|
F.stopPropagation(), I.classList.add("hidden");
|
|
7672
7672
|
}), document.addEventListener("click", (F) => {
|
|
7673
|
-
F.target.closest(".card-popup") || F.target.closest(".mobile-fullscreen-popup") || F.target.closest("[data-toggle-info]") || (document.querySelectorAll(".card-popup").forEach((L) => L.classList.add("hidden")), document.querySelectorAll(".mobile-fullscreen-
|
|
7674
|
-
const z = L.closest(".wine-widget-context");
|
|
7675
|
-
z ? z.remove() : L.remove();
|
|
7676
|
-
}));
|
|
7673
|
+
F.target.closest(".card-popup") || F.target.closest(".mobile-fullscreen-popup") || F.target.closest("[data-toggle-info]") || (document.querySelectorAll(".card-popup").forEach((L) => L.classList.add("hidden")), document.querySelectorAll(".mobile-fullscreen-wrapper").forEach((L) => L.remove()));
|
|
7677
7674
|
}), M == null || M.addEventListener("click", (F) => {
|
|
7678
7675
|
var $;
|
|
7679
7676
|
if (F.stopPropagation(), document.querySelectorAll(".card-popup").forEach((L) => L.classList.add("hidden")), document.querySelectorAll(".mobile-fullscreen-wrapper").forEach((L) => L.remove()), window.innerWidth <= 768) {
|
|
@@ -7711,7 +7708,7 @@ class ba {
|
|
|
7711
7708
|
const e = document.getElementById("wine-placeholder");
|
|
7712
7709
|
e.innerHTML = `
|
|
7713
7710
|
<div class="no-results">
|
|
7714
|
-
<p>${
|
|
7711
|
+
<p>${Z.translate("noResultsMessage") || "No recommendations found for your query."}</p>
|
|
7715
7712
|
</div>
|
|
7716
7713
|
`;
|
|
7717
7714
|
}
|
|
@@ -7719,7 +7716,7 @@ class ba {
|
|
|
7719
7716
|
const e = document.getElementById("wine-placeholder");
|
|
7720
7717
|
e.innerHTML = `
|
|
7721
7718
|
<div class="error-message">
|
|
7722
|
-
<p>${
|
|
7719
|
+
<p>${Z.translate("errorMessage") || "Something went wrong. Please try again later."}</p>
|
|
7723
7720
|
</div>
|
|
7724
7721
|
`;
|
|
7725
7722
|
}
|
|
@@ -7733,7 +7730,7 @@ class ba {
|
|
|
7733
7730
|
}
|
|
7734
7731
|
}
|
|
7735
7732
|
initializeSearchAnimation() {
|
|
7736
|
-
const e = document.getElementById("wine-search-input"), n =
|
|
7733
|
+
const e = document.getElementById("wine-search-input"), n = Z.translate("placeholderSuggestions");
|
|
7737
7734
|
let s = 0, i = 0, r = !0, a = !1;
|
|
7738
7735
|
const l = () => {
|
|
7739
7736
|
a || (r ? (e.placeholder = n[s].substring(0, i++), i > n[s].length ? (r = !1, setTimeout(l, 2e3)) : setTimeout(l, 100)) : (e.placeholder = n[s].substring(0, i--), i < 0 ? (r = !0, s = (s + 1) % n.length, setTimeout(l, 500)) : setTimeout(l, 50)));
|
|
@@ -7752,7 +7749,7 @@ class wa {
|
|
|
7752
7749
|
}
|
|
7753
7750
|
async initTranslator() {
|
|
7754
7751
|
const e = this.store ? this.store.charAt(0).toUpperCase() + this.store.slice(1) : "Test";
|
|
7755
|
-
await
|
|
7752
|
+
await Z.fetchConfig(e || "Test");
|
|
7756
7753
|
}
|
|
7757
7754
|
initCookies() {
|
|
7758
7755
|
var e;
|
|
@@ -830,7 +830,7 @@ margin: 5px 0;
|
|
|
830
830
|
|
|
831
831
|
|
|
832
832
|
/* Пример более узких экранов (i.e. <480px) можно добавить при необходимости */
|
|
833
|
-
`,mn=document.createElement("link");mn.rel="stylesheet",mn.href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap",document.head.appendChild(mn);const ri=document.createElement("style");document.documentElement.style.setProperty("--wineater-color",((ci=window==null?void 0:window.wineaterData)==null?void 0:ci.COLOR)||"#7B2BEB"),ri.textContent=pa,document.head.appendChild(ri);const ga=["climats","telckel","biobio","weinpoint","vinigrandi","ampely","test"],ma="HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG";class oi{constructor(e){var n;this.baseURL="https://wineater-backend.vercel.app/",this.store=ga.find(s=>window.location.href.includes(s)),this.token=((n=window==null?void 0:window.wineaterData)==null?void 0:n.CLIENT_TOKEN)||ma}async getStoreConfig(e){console.log(e);try{const n=await fetch(`${this.baseURL}stores/store`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({store:e})});if(console.log(n),!n.ok)throw new Error(`HTTP error! Status: ${n.status}`);return await n.json()}catch(n){throw console.error("Error fetching store configuration:",n),n}}async getWineRecommendations(e){console.log(window.location.href);try{const n=await fetch(`${this.baseURL}dish/recommendations`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({text:e,store:this.store?this.store.toString().charAt(0).toUpperCase()+this.store.slice(1):void 0})}),s=await n.json();if(!n.ok)throw new Error(`API call failed with status ${n.status}: ${s.message||"No additional error information"}`);return s}catch(n){throw console.error("Fetching wine recommendations failed:",n.message),new Error(`Error in getWineRecommendations: ${n.message}`)}}async getWineRecommendationsSearch(e){console.log(window.location.href);try{const n=await fetch(`${this.baseURL}dish/recommendations/search`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({text:e,store:this.store?this.store.toString().charAt(0).toUpperCase()+this.store.slice(1):void 0})}),s=await n.json();if(!n.ok)throw new Error(`API call failed with status ${n.status}: ${s.message||"No additional error information"}`);return s}catch(n){throw console.error("Fetching wine recommendations failed:",n.message),new Error(`Error in getWineRecommendations: ${n.message}`)}}async getPossibleDishesWithMeta(e,n){try{const s=await fetch(`${this.baseURL}dish/possible_dishes`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},body:JSON.stringify({title:e,description:n})}),i=await s.json();if(console.log(i),!s.ok)throw new Error(`API call failed with status ${s.status}: ${i.message||"No additional error information"}`);return i}catch(s){throw console.error("Error fetching possible dishes:",s),s}}async getInstantRecommendations(){console.log("Fetching instant recommendations...");try{const e=await fetch(`${this.baseURL}dish/recommendations/instant`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({store:this.store})}),n=await e.json();if(!e.ok)throw new Error(`API call failed with status ${e.status}: ${n.message||"No additional error information"}`);return console.log("Instant recommendations:",n),n}catch(e){throw console.error("Fetching instant recommendations failed:",e.message),new Error(`Error in getInstantRecommendations: ${e.message}`)}}}class va{constructor(){this.api=new oi,this.language="en",this.currency="USD",this.currencies={USD:{label:"$"},EUR:{label:"€"},MXN:{label:"$"}},this.translations={fr:{lang:"fr",welcomeMessage:"Quel plat allez-vous déguster ? Décrivez-le-moi et je vous proposerai le vin qui l'accompagnera parfaitement.",noResultsFound:"Aucun résultat trouvé.",somethingWentWrong:"Désolé, quelque chose a mal tourné.",chatButton1:"Trouvez l'accord parfait",chatButton2:"Associez le vin",chatButton3:"Obtenez des conseils",chatTitle:"Accord Mets & Vins 🍷",chatSubtitle:"Décrivez votre plat et obtenez une recommandation en 30 secondes",inputPlaceholder:"ex., Salade de thon",sendButton:"Accorder",poweredBy:"Propulsé par",price:"Prix",region:"Région",type:"Type",reason:"Suggestion",moreInfo:"Plus d'infos",winePairingIntro:"Pour ce vin, voici quelques suggestions de plats :",askForDinner:"Que voulez-vous manger ce soir?",clearChatButton:"Effacer le chat",widgetTitle:"TROUVEZ VOTRE VIN PARFAIT",widgetSubtitle:"Partagez tout ce que vous avez en tête—votre repas, humeur, budget ou occasion—et notre sommelier IA vous recommandera le vin parfait en quelques secondes",searchPlaceholder:"Entrez un mot-clé ou une description",wineDetails:{reason:"Raison",price:"Prix",region:"Région",type:"Type",moreInfo:"Plus d'infos",sommSelection:"Sélection Somm",code:"Code",buy:"Acheter"},searchButton:"Rechercher",priceRange:"Gamme de prix",wineColor:"Couleur du vin",intensity:"Intensité",red:"Rouge",white:"Blanc",rose:"Rosé",light:"Léger",medium:"Moyen",full:"Puissant",barTitle:"Sélection du bar",barSubtitle:"Choisissez vos plats ci-dessous et cliquez sur «Envoyer»",barSendButton:"Envoyer",barResetButton:"Réinitialiser",barName:"Nom du bar",barNotesPlaceholder:"Entrez vos souhaits ici...",placeholderSuggestions:["Vin pour les pâtes","Parfait avec du poisson","Recommandé pour une soirée"],headerLine1:"Partagez tout ce qui vous passe par la tête —",headerLine2:"— et obtenez des recommandations de vin parfait en quelques secondes",headerMeal:"repas",headerMood:"humeur",headerBudget:"budget",headerOccasion:"occasion",headerOr:"ou"},es:{lang:"es",welcomeMessage:"¿Qué vas a comer? Cuéntame tu plato y te recomendaré el maridaje perfecto.",noResultsFound:"No se encontraron resultados.",somethingWentWrong:"Lo sentimos, algo salió mal.",chatButton1:"Encuentra tu maridaje",chatButton2:"Combina vino ya",chatButton3:"Recibe asesoría ahora",chatTitle:"Maridaje de Vinos 🍷",chatSubtitle:"Describe tu comida y obtén una recomendación en 30 segundos",inputPlaceholder:"ej., Ensalada de atún",sendButton:"Combinar",poweredBy:"Desarrollado por",price:"Precio",region:"Región",type:"Tipo",reason:"Sugerencia",moreInfo:"Más info",winePairingIntro:"Para este vino, aquí tienes algunas sugerencias de platos:",askForDinner:"¿Qué te gustaría cenar?",clearChatButton:"Limpiar el chat",widgetTitle:"ENCUENTRA TU VINO PERFECTO",widgetSubtitle:"Comparte cualquier cosa que tengas en mente—tu comida, estado de ánimo, presupuesto o evento—y nuestro sommelier de IA te recomendará el vino perfecto en segundos",searchPlaceholder:"Escribe una palabra clave o descripción",wineDetails:{reason:"Razón",price:"Precio",region:"Región",type:"Tipo",code:"Código",moreInfo:"Más información",sommSelection:"Selección Somm",buy:"Comprar"},searchButton:"Buscar",priceRange:"Rango de precios",wineColor:"Color del vino",intensity:"Intensidad",red:"Tinto",white:"Blanco",rose:"Rosado",light:"Ligero",medium:"Medio",full:"Intenso",barTitle:"Platos de Bar",barSubtitle:"Selecciona de la lista y presiona «Enviar»",barSendButton:"Enviar",barResetButton:"Reiniciar",barName:"Nombre del bar",barNotesPlaceholder:"Agrega tus comentarios aquí...",placeholderSuggestions:["Vino para pasta","Perfecto con pescado","Recomendado para una fiesta"],headerLine1:"Comparte cualquier cosa que tengas en mente —",headerLine2:"— y obtén recomendaciones del vino perfecto en cuestión de segundos",headerMeal:"comida",headerMood:"estado de ánimo",headerBudget:"presupuesto",headerOccasion:"ocasión",headerOr:"o"},en:{lang:"en",welcomeMessage:"What are you planning to eat? Share your dish and I'll recommend the perfect wine pairing for your meal.",noResultsFound:"No results found.",somethingWentWrong:"Sorry, something went wrong.",chatButton1:"Find Your Pairing",chatButton2:"Pair Wine Now",chatButton3:"Get Wine Advice",chatTitle:"Wine Pairing Assistant 🍷",chatSubtitle:"Describe your meal and get a recommendation in 30 seconds",inputPlaceholder:"e.g., Tuna salad",sendButton:"Match",poweredBy:"Powered by",price:"Price",region:"Region",type:"Type",reason:"Suggestion",moreInfo:"More info",winePairingIntro:"For this wine, here are some suggested dishes:",askForDinner:"What would you like to have for dinner?",clearChatButton:"Clear Chat",widgetTitle:"FIND YOUR PERFECT WINE",widgetSubtitle:"Share anything on your mind—your meal, mood, budget, or occasion—and our AI sommelier will recommend the perfect wine in seconds",searchPlaceholder:"Enter a keyword or description",wineDetails:{price:"Price",region:"Region",type:"Type",moreInfo:"More info",reason:"Reason",sommSelection:"Somm Selection",code:"Code",buy:"Buy"},searchButton:"Search",priceRange:"Price Range",wineColor:"Wine Color",intensity:"Intensity",red:"Red",white:"White",rose:"Rosé",light:"Light",medium:"Medium",full:"Full",barTitle:"Bar Dishes",barSubtitle:"Select dishes below and click ‘Send’",barSendButton:"Send",barResetButton:"Reset",barName:"Bar Name",barNotesPlaceholder:"Add your wishes here...",placeholderSuggestions:["Wine for pasta","Perfect with fish","Recommended for a party"],headerLine1:"Share anything on your mind —",headerLine2:"— and get recommendations of the perfect wine in seconds",headerMeal:"meal",headerMood:"mood",headerBudget:"budget",headerOccasion:"occasion",headerOr:"or"},de:{lang:"de",welcomeMessage:"Was möchten Sie essen? Beschreiben Sie Ihr Gericht und ich empfehle Ihnen den perfekten Wein dazu.",noResultsFound:"Keine Ergebnisse gefunden.",somethingWentWrong:"Entschuldigung, etwas ist schief gelaufen.",chatButton1:"Finde Dein Pairing",chatButton2:"Wein jetzt wählen",chatButton3:"Erhalte Weinberatung",chatTitle:"Wein & Speisen 🍷",chatSubtitle:"Beschreiben Sie Ihr Gericht und erhalten Sie in 30 Sekunden eine Empfehlung",inputPlaceholder:"z.B., Thunfischsalat",sendButton:"Kombinieren",poweredBy:"Unterstützt von",price:"Preis",region:"Region",type:"Typ",reason:"Anregung",moreInfo:"Mehr Info",winePairingIntro:"Für diesen Wein gibt es folgende Essensvorschläge:",askForDinner:"Was möchten Sie zum Abendessen essen?",clearChatButton:"Chat löschen",widgetTitle:"FINDEN SIE IHREN PERFEKTEN WEIN",widgetSubtitle:"Teilen Sie alles, was Ihnen in den Sinn kommt—Ihre Mahlzeit, Stimmung, Ihr Budget oder Anlass—und unser KI-Sommelier empfiehlt Ihnen in Sekunden den perfekten Wein",placeholderSuggestions:["Wein für Pasta","Perfekt zu Fisch","Empfohlen für eine Party"],searchPlaceholder:"Geben Sie ein Stichwort oder eine Beschreibung ein",wineDetails:{price:"Preis",region:"Region",type:"Typ",moreInfo:"Mehr Infos",sommSelection:"Somm-Auswahl",reason:"Grund",code:"Code",buy:"Kaufen"},searchButton:"Suche",priceRange:"Preisspanne",wineColor:"Weinfarbe",intensity:"Intensität",red:"Rot",white:"Weiß",rose:"Rosé",light:"Leicht",medium:"Mittel",full:"Voll",barTitle:"Bar-Auswahl",barSubtitle:"Wählen Sie Ihre Gerichte und klicken Sie auf „Senden“",barSendButton:"Senden",barResetButton:"Zurücksetzen",barName:"Name der Bar",headerLine1:"Teilen Sie alles, was Ihnen durch den Kopf geht —",headerLine2:"— und erhalten Sie in Sekundenschnelle Empfehlungen für den perfekten Wein",headerMeal:"Mahlzeit",headerMood:"Stimmung",headerBudget:"Budget",headerOccasion:"Anlass",headerOr:"oder"},ukr:{lang:"ukr",welcomeMessage:"Що ви збираєтесь їсти? Опишіть свою страву, і я порекомендую вам ідеальне вино.",noResultsFound:"Результатів не знайдено.",somethingWentWrong:"Вибачте, щось пішло не так.",chatButton1:"Знайти ідеальне поєднання",chatButton2:"Підібрати вино",chatButton3:"Отримати пораду",chatTitle:"Сомельє-помічник 🍷",chatSubtitle:"Опишіть свою страву і отримайте рекомендацію за 30 секунд",inputPlaceholder:"наприклад, Тунець із салатом",sendButton:"Підібрати",poweredBy:"Розроблено на основі",price:"Ціна",region:"Регіон",type:"Тип",reason:"Рекомендація",moreInfo:"Докладніше",winePairingIntro:"До цього вина підходять такі страви:",askForDinner:"Що ви хочете на вечерю?",clearChatButton:"Очистити чат",widgetTitle:"ЗНАЙДІТЬ ІДЕАЛЬНЕ ВИНО",widgetSubtitle:"Поділіться тим, що у вас на думці—їжа, настрій, бюджет чи подія—і наш AI-сомельє порекомендує вам ідеальне вино за секунди",searchPlaceholder:"Введіть ключове слово або опис",wineDetails:{reason:"Причина",price:"Ціна",region:"Регіон",type:"Тип",moreInfo:"Докладніше",sommSelection:"Вибір сомельє",code:"Код",buy:"Купити"},searchButton:"Пошук",priceRange:"Діапазон цін",wineColor:"Колір вина",intensity:"Інтенсивність",red:"Червоне",white:"Біле",rose:"Рожеве",light:"Легке",medium:"Середнє",full:"Повне",barTitle:"Закуски до вина",barSubtitle:"Виберіть страви нижче та натисніть «Надіслати»",barSendButton:"Надіслати",barResetButton:"Скинути",barName:"Назва бару",barNotesPlaceholder:"Додайте ваші побажання тут...",placeholderSuggestions:["Вино до пасти","Ідеально до риби","Рекомендуємо для вечірки"],headerLine1:"Поділіться будь-якими вашими думками —",headerLine2:"— і отримайте рекомендації щодо ідеального вина за секунди",headerMeal:"страва",headerMood:"настрій",headerBudget:"бюджет",headerOccasion:"подія",headerOr:"або"},ru:{lang:"ru",welcomeMessage:"Что вы планируете поесть? Напишите ваше блюдо, и я подберу идеальное вино к нему.",noResultsFound:"Результаты не найдены.",somethingWentWrong:"Извините, что-то пошло не так.",chatButton1:"Найти сочетание",chatButton2:"Подобрать вино",chatButton3:"Получить совет",chatTitle:"Ассистент по подбору вина 🍷",chatSubtitle:"Опишите ваше блюдо и получите рекомендацию за 30 секунд",inputPlaceholder:"например, Тунец с салатом",sendButton:"Подобрать",poweredBy:"Powered by",price:"Цена",region:"Регион",type:"Тип",reason:"Рекомендация",moreInfo:"Подробнее",winePairingIntro:"К этому вину подходят следующие блюда:",askForDinner:"Что бы вы хотели на ужин?",clearChatButton:"Очистить чат",widgetTitle:"НАЙДИТЕ ИДЕАЛЬНОЕ ВИНО",widgetSubtitle:"Поделитесь вашими предпочтениями — блюдом, настроением, бюджетом или случаем — и наш AI-сомелье подберёт идеальное вино за секунды",searchPlaceholder:"Введите ключевое слово или описание",wineDetails:{price:"Цена",region:"Регион",type:"Тип",moreInfo:"Подробнее",reason:"Причина",sommSelection:"Выбор сомелье",code:"Код",buy:"Купить"},searchButton:"Поиск",priceRange:"Диапазон цен",wineColor:"Цвет вина",intensity:"Интенсивность",red:"Красное",white:"Белое",rose:"Розовое",light:"Лёгкое",medium:"Среднее",full:"Полное",barTitle:"Закуски к вину",barSubtitle:"Выберите блюда ниже и нажмите ‘Отправить’",barSendButton:"Отправить",barResetButton:"Сбросить",barName:"Название бара",barNotesPlaceholder:"Добавьте ваши пожелания здесь...",placeholderSuggestions:["Вино для пасты","Идеально к рыбе","Рекомендуем для вечеринки"],headerLine1:"Поделитесь любыми вашими мыслями —",headerLine2:"— и получите рекомендации по идеальному вину за считанные секунды",headerMeal:"блюдо",headerMood:"настроение",headerBudget:"бюджет",headerOccasion:"случай",headerOr:"или"}}}async fetchConfig(e){try{const n=await this.api.getStoreConfig(e);this.language=n.lang,this.currency=n.currency}catch{this.language="en",this.currency="USD"}}getCurrency(e){const n=e.split(".");let s=this.currencies[this.currency];for(const i of n)if(s&&typeof s=="object"&&i in s)s=s[i];else return this.currency;return s}translate(e){const n=e.split(".");let s=this.translations[this.language];for(const i of n)if(s&&typeof s=="object"&&i in s)s=s[i];else return e;return s}}const Z=new va;class ba{constructor(){var e,n,s,i;this.widgetType=((e=window==null?void 0:window.wineaterData)==null?void 0:e.WIDGET_TYPE)||"store",this.widgetWrapper=((n=window==null?void 0:window.wineaterData)==null?void 0:n.WIDGET_WRAPPER)||"wineater-widget-conteiner",this.titleText=(s=window==null?void 0:window.wineaterData)==null?void 0:s.TITLE_TEXT,this.subtitleText=(i=window==null?void 0:window.wineaterData)==null?void 0:i.SUBTITLE_TEXT,this.api=new oi,console.log(this.titleText),this.selectedFilters={price:null,color:null,intensity:null},this.initializeWidget(),this.initializeSearchAnimation(),this.sendEvent("widgetInitialized",{widgetType:this.widgetType}),this.loadInstantRecommendations()}sendEvent(e,n){console.log("Event sent:",e,n)}getTitle(e){return e?`<h1 class="wine-widget-big-title">${e}</h1>`:`<h1 class="wine-widget-big-title">
|
|
833
|
+
`,mn=document.createElement("link");mn.rel="stylesheet",mn.href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap",document.head.appendChild(mn);const ri=document.createElement("style");document.documentElement.style.setProperty("--wineater-color",((ci=window==null?void 0:window.wineaterData)==null?void 0:ci.COLOR)||"#7B2BEB"),ri.textContent=pa,document.head.appendChild(ri);const ga=["climats","telckel","biobio","weinpoint","vinigrandi","ampely","test"],ma="HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG";class oi{constructor(e){var n;this.baseURL="https://wineater-backend.vercel.app/",this.store=ga.find(s=>window.location.href.includes(s)),this.token=((n=window==null?void 0:window.wineaterData)==null?void 0:n.CLIENT_TOKEN)||ma}async getStoreConfig(e){console.log(e);try{const n=await fetch(`${this.baseURL}stores/store`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({store:e})});if(console.log(n),!n.ok)throw new Error(`HTTP error! Status: ${n.status}`);return await n.json()}catch(n){throw console.error("Error fetching store configuration:",n),n}}async getWineRecommendations(e){console.log(window.location.href);try{const n=await fetch(`${this.baseURL}dish/recommendations`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({text:e,store:this.store?this.store.toString().charAt(0).toUpperCase()+this.store.slice(1):void 0})}),s=await n.json();if(!n.ok)throw new Error(`API call failed with status ${n.status}: ${s.message||"No additional error information"}`);return s}catch(n){throw console.error("Fetching wine recommendations failed:",n.message),new Error(`Error in getWineRecommendations: ${n.message}`)}}async getWineRecommendationsSearch(e){console.log(window.location.href);try{const n=await fetch(`${this.baseURL}dish/recommendations/search`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({text:e,store:this.store?this.store.toString().charAt(0).toUpperCase()+this.store.slice(1):void 0})}),s=await n.json();if(!n.ok)throw new Error(`API call failed with status ${n.status}: ${s.message||"No additional error information"}`);return s}catch(n){throw console.error("Fetching wine recommendations failed:",n.message),new Error(`Error in getWineRecommendations: ${n.message}`)}}async getPossibleDishesWithMeta(e,n){try{const s=await fetch(`${this.baseURL}dish/possible_dishes`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},body:JSON.stringify({title:e,description:n})}),i=await s.json();if(console.log(i),!s.ok)throw new Error(`API call failed with status ${s.status}: ${i.message||"No additional error information"}`);return i}catch(s){throw console.error("Error fetching possible dishes:",s),s}}async getInstantRecommendations(){console.log("Fetching instant recommendations...");try{const e=await fetch(`${this.baseURL}dish/recommendations/instant`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({store:this.store})}),n=await e.json();if(!e.ok)throw new Error(`API call failed with status ${e.status}: ${n.message||"No additional error information"}`);return console.log("Instant recommendations:",n),n}catch(e){throw console.error("Fetching instant recommendations failed:",e.message),new Error(`Error in getInstantRecommendations: ${e.message}`)}}}class va{constructor(){this.api=new oi,this.language="en",this.currency="USD",this.currencies={USD:{label:"$"},EUR:{label:"€"},MXN:{label:"$"}},this.translations={fr:{lang:"fr",welcomeMessage:"Quel plat allez-vous déguster ? Décrivez-le-moi et je vous proposerai le vin qui l'accompagnera parfaitement.",noResultsFound:"Aucun résultat trouvé.",somethingWentWrong:"Désolé, quelque chose a mal tourné.",chatButton1:"Trouvez l'accord parfait",chatButton2:"Associez le vin",chatButton3:"Obtenez des conseils",chatTitle:"Accord Mets & Vins 🍷",chatSubtitle:"Décrivez votre plat et obtenez une recommandation en 30 secondes",inputPlaceholder:"ex., Salade de thon",sendButton:"Accorder",poweredBy:"Propulsé par",price:"Prix",region:"Région",type:"Type",reason:"Suggestion",moreInfo:"Plus d'infos",winePairingIntro:"Pour ce vin, voici quelques suggestions de plats :",askForDinner:"Que voulez-vous manger ce soir?",clearChatButton:"Effacer le chat",widgetTitle:"TROUVEZ VOTRE VIN PARFAIT",widgetSubtitle:"Partagez tout ce que vous avez en tête—votre repas, humeur, budget ou occasion—et notre sommelier IA vous recommandera le vin parfait en quelques secondes",searchPlaceholder:"Entrez un mot-clé ou une description",wineDetails:{reason:"Raison",price:"Prix",region:"Région",type:"Type",moreInfo:"Plus d'infos",sommSelection:"Sélection Somm",code:"Code",buy:"Acheter"},searchButton:"Rechercher",priceRange:"Gamme de prix",wineColor:"Couleur du vin",intensity:"Intensité",red:"Rouge",white:"Blanc",rose:"Rosé",light:"Léger",medium:"Moyen",full:"Puissant",barTitle:"Sélection du bar",barSubtitle:"Choisissez vos plats ci-dessous et cliquez sur «Envoyer»",barSendButton:"Envoyer",barResetButton:"Réinitialiser",barName:"Nom du bar",barNotesPlaceholder:"Entrez vos souhaits ici...",placeholderSuggestions:["Vin pour les pâtes","Parfait avec du poisson","Recommandé pour une soirée"],headerLine1:"Partagez tout ce qui vous passe par la tête —",headerLine2:"— et obtenez des recommandations de vin parfait en quelques secondes",headerMeal:"repas",headerMood:"humeur",headerBudget:"budget",headerOccasion:"occasion",headerOr:"ou"},es:{lang:"es",welcomeMessage:"¿Qué vas a comer? Cuéntame tu plato y te recomendaré el maridaje perfecto.",noResultsFound:"No se encontraron resultados.",somethingWentWrong:"Lo sentimos, algo salió mal.",chatButton1:"Encuentra tu maridaje",chatButton2:"Combina vino ya",chatButton3:"Recibe asesoría ahora",chatTitle:"Maridaje de Vinos 🍷",chatSubtitle:"Describe tu comida y obtén una recomendación en 30 segundos",inputPlaceholder:"ej., Ensalada de atún",sendButton:"Combinar",poweredBy:"Desarrollado por",price:"Precio",region:"Región",type:"Tipo",reason:"Sugerencia",moreInfo:"Más info",winePairingIntro:"Para este vino, aquí tienes algunas sugerencias de platos:",askForDinner:"¿Qué te gustaría cenar?",clearChatButton:"Limpiar el chat",widgetTitle:"ENCUENTRA TU VINO PERFECTO",widgetSubtitle:"Comparte cualquier cosa que tengas en mente—tu comida, estado de ánimo, presupuesto o evento—y nuestro sommelier de IA te recomendará el vino perfecto en segundos",searchPlaceholder:"Escribe una palabra clave o descripción",wineDetails:{reason:"Razón",price:"Precio",region:"Región",type:"Tipo",code:"Código",moreInfo:"Más información",sommSelection:"Selección Somm",buy:"Comprar"},searchButton:"Buscar",priceRange:"Rango de precios",wineColor:"Color del vino",intensity:"Intensidad",red:"Tinto",white:"Blanco",rose:"Rosado",light:"Ligero",medium:"Medio",full:"Intenso",barTitle:"Platos de Bar",barSubtitle:"Selecciona de la lista y presiona «Enviar»",barSendButton:"Enviar",barResetButton:"Reiniciar",barName:"Nombre del bar",barNotesPlaceholder:"Agrega tus comentarios aquí...",placeholderSuggestions:["Vino para pasta","Perfecto con pescado","Recomendado para una fiesta"],headerLine1:"Comparte cualquier cosa que tengas en mente —",headerLine2:"— y obtén recomendaciones del vino perfecto en cuestión de segundos",headerMeal:"comida",headerMood:"estado de ánimo",headerBudget:"presupuesto",headerOccasion:"ocasión",headerOr:"o"},en:{lang:"en",welcomeMessage:"What are you planning to eat? Share your dish and I'll recommend the perfect wine pairing for your meal.",noResultsFound:"No results found.",somethingWentWrong:"Sorry, something went wrong.",chatButton1:"Find Your Pairing",chatButton2:"Pair Wine Now",chatButton3:"Get Wine Advice",chatTitle:"Wine Pairing Assistant 🍷",chatSubtitle:"Describe your meal and get a recommendation in 30 seconds",inputPlaceholder:"e.g., Tuna salad",sendButton:"Match",poweredBy:"Powered by",price:"Price",region:"Region",type:"Type",reason:"Suggestion",moreInfo:"More info",winePairingIntro:"For this wine, here are some suggested dishes:",askForDinner:"What would you like to have for dinner?",clearChatButton:"Clear Chat",widgetTitle:"FIND YOUR PERFECT WINE",widgetSubtitle:"Share anything on your mind—your meal, mood, budget, or occasion—and our AI sommelier will recommend the perfect wine in seconds",searchPlaceholder:"Enter a keyword or description",wineDetails:{price:"Price",region:"Region",type:"Type",moreInfo:"More info",reason:"Reason",sommSelection:"Somm Selection",code:"Code",buy:"Buy"},searchButton:"Search",priceRange:"Price Range",wineColor:"Wine Color",intensity:"Intensity",red:"Red",white:"White",rose:"Rosé",light:"Light",medium:"Medium",full:"Full",barTitle:"Bar Dishes",barSubtitle:"Select dishes below and click ‘Send’",barSendButton:"Send",barResetButton:"Reset",barName:"Bar Name",barNotesPlaceholder:"Add your wishes here...",placeholderSuggestions:["Wine for pasta","Perfect with fish","Recommended for a party"],headerLine1:"Share anything on your mind —",headerLine2:"— and get recommendations of the perfect wine in seconds",headerMeal:"meal",headerMood:"mood",headerBudget:"budget",headerOccasion:"occasion",headerOr:"or"},de:{lang:"de",welcomeMessage:"Was möchten Sie essen? Beschreiben Sie Ihr Gericht und ich empfehle Ihnen den perfekten Wein dazu.",noResultsFound:"Keine Ergebnisse gefunden.",somethingWentWrong:"Entschuldigung, etwas ist schief gelaufen.",chatButton1:"Finde Dein Pairing",chatButton2:"Wein jetzt wählen",chatButton3:"Erhalte Weinberatung",chatTitle:"Wein & Speisen 🍷",chatSubtitle:"Beschreiben Sie Ihr Gericht und erhalten Sie in 30 Sekunden eine Empfehlung",inputPlaceholder:"z.B., Thunfischsalat",sendButton:"Kombinieren",poweredBy:"Unterstützt von",price:"Preis",region:"Region",type:"Typ",reason:"Anregung",moreInfo:"Mehr Info",winePairingIntro:"Für diesen Wein gibt es folgende Essensvorschläge:",askForDinner:"Was möchten Sie zum Abendessen essen?",clearChatButton:"Chat löschen",widgetTitle:"FINDEN SIE IHREN PERFEKTEN WEIN",widgetSubtitle:"Teilen Sie alles, was Ihnen in den Sinn kommt—Ihre Mahlzeit, Stimmung, Ihr Budget oder Anlass—und unser KI-Sommelier empfiehlt Ihnen in Sekunden den perfekten Wein",placeholderSuggestions:["Wein für Pasta","Perfekt zu Fisch","Empfohlen für eine Party"],searchPlaceholder:"Geben Sie ein Stichwort oder eine Beschreibung ein",wineDetails:{price:"Preis",region:"Region",type:"Typ",moreInfo:"Mehr Infos",sommSelection:"Somm-Auswahl",reason:"Grund",code:"Code",buy:"Kaufen"},searchButton:"Suche",priceRange:"Preisspanne",wineColor:"Weinfarbe",intensity:"Intensität",red:"Rot",white:"Weiß",rose:"Rosé",light:"Leicht",medium:"Mittel",full:"Voll",barTitle:"Bar-Auswahl",barSubtitle:"Wählen Sie Ihre Gerichte und klicken Sie auf „Senden“",barSendButton:"Senden",barResetButton:"Zurücksetzen",barName:"Name der Bar",headerLine1:"Teilen Sie alles, was Ihnen durch den Kopf geht —",headerLine2:"— und erhalten Sie in Sekundenschnelle Empfehlungen für den perfekten Wein",headerMeal:"Mahlzeit",headerMood:"Stimmung",headerBudget:"Budget",headerOccasion:"Anlass",headerOr:"oder"},ukr:{lang:"ukr",welcomeMessage:"Що ви збираєтесь їсти? Опишіть свою страву, і я порекомендую вам ідеальне вино.",noResultsFound:"Результатів не знайдено.",somethingWentWrong:"Вибачте, щось пішло не так.",chatButton1:"Знайти ідеальне поєднання",chatButton2:"Підібрати вино",chatButton3:"Отримати пораду",chatTitle:"Сомельє-помічник 🍷",chatSubtitle:"Опишіть свою страву і отримайте рекомендацію за 30 секунд",inputPlaceholder:"наприклад, Тунець із салатом",sendButton:"Підібрати",poweredBy:"Розроблено на основі",price:"Ціна",region:"Регіон",type:"Тип",reason:"Рекомендація",moreInfo:"Докладніше",winePairingIntro:"До цього вина підходять такі страви:",askForDinner:"Що ви хочете на вечерю?",clearChatButton:"Очистити чат",widgetTitle:"ЗНАЙДІТЬ ІДЕАЛЬНЕ ВИНО",widgetSubtitle:"Поділіться тим, що у вас на думці—їжа, настрій, бюджет чи подія—і наш AI-сомельє порекомендує вам ідеальне вино за секунди",searchPlaceholder:"Введіть ключове слово або опис",wineDetails:{reason:"Причина",price:"Ціна",region:"Регіон",type:"Тип",moreInfo:"Докладніше",sommSelection:"Вибір сомельє",code:"Код",buy:"Купити"},searchButton:"Пошук",priceRange:"Діапазон цін",wineColor:"Колір вина",intensity:"Інтенсивність",red:"Червоне",white:"Біле",rose:"Рожеве",light:"Легке",medium:"Середнє",full:"Повне",barTitle:"Закуски до вина",barSubtitle:"Виберіть страви нижче та натисніть «Надіслати»",barSendButton:"Надіслати",barResetButton:"Скинути",barName:"Назва бару",barNotesPlaceholder:"Додайте ваші побажання тут...",placeholderSuggestions:["Вино до пасти","Ідеально до риби","Рекомендуємо для вечірки"],headerLine1:"Поділіться будь-якими вашими думками —",headerLine2:"— і отримайте рекомендації щодо ідеального вина за секунди",headerMeal:"страва",headerMood:"настрій",headerBudget:"бюджет",headerOccasion:"подія",headerOr:"або"},ru:{lang:"ru",welcomeMessage:"Что вы планируете поесть? Напишите ваше блюдо, и я подберу идеальное вино к нему.",noResultsFound:"Результаты не найдены.",somethingWentWrong:"Извините, что-то пошло не так.",chatButton1:"Найти сочетание",chatButton2:"Подобрать вино",chatButton3:"Получить совет",chatTitle:"Ассистент по подбору вина 🍷",chatSubtitle:"Опишите ваше блюдо и получите рекомендацию за 30 секунд",inputPlaceholder:"например, Тунец с салатом",sendButton:"Подобрать",poweredBy:"Powered by",price:"Цена",region:"Регион",type:"Тип",reason:"Рекомендация",moreInfo:"Подробнее",winePairingIntro:"К этому вину подходят следующие блюда:",askForDinner:"Что бы вы хотели на ужин?",clearChatButton:"Очистить чат",widgetTitle:"НАЙДИТЕ ИДЕАЛЬНОЕ ВИНО",widgetSubtitle:"Поделитесь вашими предпочтениями — блюдом, настроением, бюджетом или случаем — и наш AI-сомелье подберёт идеальное вино за секунды",searchPlaceholder:"Введите ключевое слово или описание",wineDetails:{price:"Цена",region:"Регион",type:"Тип",moreInfo:"Подробнее",reason:"Причина",sommSelection:"Выбор сомелье",code:"Код",buy:"Купить"},searchButton:"Поиск",priceRange:"Диапазон цен",wineColor:"Цвет вина",intensity:"Интенсивность",red:"Красное",white:"Белое",rose:"Розовое",light:"Лёгкое",medium:"Среднее",full:"Полное",barTitle:"Закуски к вину",barSubtitle:"Выберите блюда ниже и нажмите ‘Отправить’",barSendButton:"Отправить",barResetButton:"Сбросить",barName:"Название бара",barNotesPlaceholder:"Добавьте ваши пожелания здесь...",placeholderSuggestions:["Вино для пасты","Идеально к рыбе","Рекомендуем для вечеринки"],headerLine1:"Поделитесь любыми вашими мыслями —",headerLine2:"— и получите рекомендации по идеальному вину за считанные секунды",headerMeal:"блюдо",headerMood:"настроение",headerBudget:"бюджет",headerOccasion:"случай",headerOr:"или"}}}async fetchConfig(e){try{const n=await this.api.getStoreConfig(e);this.language=n.lang,this.currency=n.currency}catch{this.language="en",this.currency="USD"}}getCurrency(e){const n=e.split(".");let s=this.currencies[this.currency];for(const i of n)if(s&&typeof s=="object"&&i in s)s=s[i];else return this.currency;return s}translate(e){const n=e.split(".");let s=this.translations[this.language];for(const i of n)if(s&&typeof s=="object"&&i in s)s=s[i];else return e;return s}}const Z=new va;class ba{constructor(){var e,n,s,i,r;this.widgetType=((e=window==null?void 0:window.wineaterData)==null?void 0:e.WIDGET_TYPE)||"store",this.countryCode=((n=window==null?void 0:window.wineaterData)==null?void 0:n.COUNTRY_CODE)||null,this.widgetWrapper=((s=window==null?void 0:window.wineaterData)==null?void 0:s.WIDGET_WRAPPER)||"wineater-widget-conteiner",this.titleText=(i=window==null?void 0:window.wineaterData)==null?void 0:i.TITLE_TEXT,this.subtitleText=(r=window==null?void 0:window.wineaterData)==null?void 0:r.SUBTITLE_TEXT,this.api=new oi,console.log(this.titleText),this.selectedFilters={price:null,color:null,intensity:null},this.initializeWidget(),this.initializeSearchAnimation(),this.sendEvent("widgetInitialized",{widgetType:this.widgetType}),this.loadInstantRecommendations()}sendEvent(e,n){console.log("Event sent:",e,n)}getTitle(e){return e?`<h1 class="wine-widget-big-title">${e}</h1>`:`<h1 class="wine-widget-big-title">
|
|
834
834
|
${Z.translate("headerLine1")}
|
|
835
835
|
<span class="icon icon-meal"></span>
|
|
836
836
|
<span class="icon-label">${Z.translate("headerMeal")}</span>,
|
|
@@ -876,7 +876,7 @@ margin: 5px 0;
|
|
|
876
876
|
<div id="powered-by-widget">
|
|
877
877
|
<a href="https://wineater.com" target="_blank">
|
|
878
878
|
<span>${Z.translate("poweredBy")}</span>
|
|
879
|
-
<img src="${
|
|
879
|
+
<img src="${this.countryCode==="ru"?"https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/divino_logo.svg?x=5":"https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/logo_medium_gray.svg"}" alt="Wineater Logo">
|
|
880
880
|
<span>${Z.translate("AI sommelier")}</span>
|
|
881
881
|
</a>
|
|
882
882
|
</div>
|
|
@@ -914,7 +914,7 @@ margin: 5px 0;
|
|
|
914
914
|
|
|
915
915
|
${R}
|
|
916
916
|
</div>
|
|
917
|
-
`;s.insertAdjacentHTML("beforeend",C);const _=s.children[u];if(!b){const M=_.querySelector("[data-toggle-info]"),I=_.querySelector(".card-popup"),T=_.querySelector(".card-popup-close");T==null||T.addEventListener("click",F=>{F.stopPropagation(),I.classList.add("hidden")}),document.addEventListener("click",F=>{F.target.closest(".card-popup")||F.target.closest(".mobile-fullscreen-popup")||F.target.closest("[data-toggle-info]")||(document.querySelectorAll(".card-popup").forEach(L=>L.classList.add("hidden")),document.querySelectorAll(".mobile-fullscreen-
|
|
917
|
+
`;s.insertAdjacentHTML("beforeend",C);const _=s.children[u];if(!b){const M=_.querySelector("[data-toggle-info]"),I=_.querySelector(".card-popup"),T=_.querySelector(".card-popup-close");T==null||T.addEventListener("click",F=>{F.stopPropagation(),I.classList.add("hidden")}),document.addEventListener("click",F=>{F.target.closest(".card-popup")||F.target.closest(".mobile-fullscreen-popup")||F.target.closest("[data-toggle-info]")||(document.querySelectorAll(".card-popup").forEach(L=>L.classList.add("hidden")),document.querySelectorAll(".mobile-fullscreen-wrapper").forEach(L=>L.remove()))}),M==null||M.addEventListener("click",F=>{var $;if(F.stopPropagation(),document.querySelectorAll(".card-popup").forEach(L=>L.classList.add("hidden")),document.querySelectorAll(".mobile-fullscreen-wrapper").forEach(L=>L.remove()),window.innerWidth<=768){const L=I.innerHTML,z=document.createElement("div");z.className="mobile-fullscreen-wrapper",z.innerHTML=`
|
|
918
918
|
<div class="mobile-fullscreen-overlay"></div>
|
|
919
919
|
<div class="card-popup mobile-fullscreen-popup">${L}</div>
|
|
920
920
|
`,($=z.querySelector(".card-popup-close"))==null||$.addEventListener("click",()=>z.remove()),document.body.appendChild(z)}else I.classList.remove("hidden")})}setTimeout(()=>{_.style.opacity="1",_.style.transform="translateY(0)"},n?u*200:0)}),this.widgetType==="store"&&this.enableHoverPopups()}animateCardDisappearance(){const e=document.querySelectorAll(".wine-recommendation-tile");e.forEach((n,s)=>{setTimeout(()=>{n.style.opacity="0",n.style.transform="translateY(-20px)"},s*100)}),setTimeout(()=>{document.getElementById("wine-placeholder").innerHTML="",this.showLoadingIndicator()},e.length*100+300)}showLoadingIndicator(){document.getElementById("loading-indicator").classList.remove("hidden")}hideLoadingIndicator(){document.getElementById("loading-indicator").classList.add("hidden")}displayNoResultsMessage(){const e=document.getElementById("wine-placeholder");e.innerHTML=`
|
package/package.json
CHANGED
package/src/js/widget.js
CHANGED
|
@@ -7,6 +7,7 @@ export class WineWidget {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
// Определяем тип виджета: 'store' (старый) или 'bar' (новый)
|
|
9
9
|
this.widgetType = window?.wineaterData?.WIDGET_TYPE || 'store';
|
|
10
|
+
this.countryCode = window?.wineaterData?.COUNTRY_CODE || null;
|
|
10
11
|
this.widgetWrapper = window?.wineaterData?.WIDGET_WRAPPER || 'wineater-widget-conteiner';
|
|
11
12
|
this.titleText = window?.wineaterData?.TITLE_TEXT;
|
|
12
13
|
this.subtitleText = window?.wineaterData?.SUBTITLE_TEXT;
|
|
@@ -85,7 +86,7 @@ export class WineWidget {
|
|
|
85
86
|
<div id="powered-by-widget">
|
|
86
87
|
<a href="https://wineater.com" target="_blank">
|
|
87
88
|
<span>${translator.translate('poweredBy')}</span>
|
|
88
|
-
<img src="${
|
|
89
|
+
<img src="${this.countryCode === 'ru' ? 'https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/divino_logo.svg?x=5' : 'https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/logo_medium_gray.svg'}" alt="Wineater Logo">
|
|
89
90
|
<span>${translator.translate('AI sommelier')}</span>
|
|
90
91
|
</a>
|
|
91
92
|
</div>
|
|
@@ -295,11 +296,7 @@ export class WineWidget {
|
|
|
295
296
|
|
|
296
297
|
if (!isInsideAnyPopup) {
|
|
297
298
|
document.querySelectorAll('.card-popup').forEach(p => p.classList.add('hidden'));
|
|
298
|
-
document.querySelectorAll('.mobile-fullscreen-
|
|
299
|
-
const wrapper = p.closest('.wine-widget-context');
|
|
300
|
-
if (wrapper) wrapper.remove();
|
|
301
|
-
else p.remove();
|
|
302
|
-
});
|
|
299
|
+
document.querySelectorAll('.mobile-fullscreen-wrapper').forEach(wrapper => wrapper.remove());
|
|
303
300
|
}
|
|
304
301
|
});
|
|
305
302
|
|