admesh-ui-sdk 1.0.46 → 1.0.48
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/README.md +6 -4
- package/USAGE.md +1 -1
- package/dist/components/AdMeshIntentAssistant.d.ts +2 -2
- package/dist/components/AdMeshIntentAssistant.d.ts.map +1 -1
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +850 -843
- package/dist/index.mjs.map +1 -1
- package/dist/publisher-assistant.js +46 -46
- package/dist/publisher-assistant.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -133,7 +133,7 @@ const So = Wr(
|
|
|
133
133
|
* This source code is licensed under the ISC license.
|
|
134
134
|
* See the LICENSE file in the root directory of this source tree.
|
|
135
135
|
*/
|
|
136
|
-
const
|
|
136
|
+
const vt = (t, e) => {
|
|
137
137
|
const r = Wr(
|
|
138
138
|
({ className: o, ...a }, l) => On(So, {
|
|
139
139
|
ref: l,
|
|
@@ -157,7 +157,7 @@ const _t = (t, e) => {
|
|
|
157
157
|
const Ao = [
|
|
158
158
|
["path", { d: "M7 7h10v10", key: "1tivn9" }],
|
|
159
159
|
["path", { d: "M7 17 17 7", key: "1vkiza" }]
|
|
160
|
-
], Co =
|
|
160
|
+
], Co = vt("arrow-up-right", Ao);
|
|
161
161
|
/**
|
|
162
162
|
* @license lucide-react v0.563.0 - ISC
|
|
163
163
|
*
|
|
@@ -167,7 +167,7 @@ const Ao = [
|
|
|
167
167
|
const Mo = [
|
|
168
168
|
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
169
169
|
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
170
|
-
], Eo =
|
|
170
|
+
], Eo = vt("arrow-up", Mo);
|
|
171
171
|
/**
|
|
172
172
|
* @license lucide-react v0.563.0 - ISC
|
|
173
173
|
*
|
|
@@ -182,7 +182,7 @@ const Io = [
|
|
|
182
182
|
key: "1jaruq"
|
|
183
183
|
}
|
|
184
184
|
]
|
|
185
|
-
], To =
|
|
185
|
+
], To = vt("flag", Io);
|
|
186
186
|
/**
|
|
187
187
|
* @license lucide-react v0.563.0 - ISC
|
|
188
188
|
*
|
|
@@ -194,7 +194,7 @@ const Ro = [
|
|
|
194
194
|
["path", { d: "m21 3-7 7", key: "1l2asr" }],
|
|
195
195
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
196
196
|
["path", { d: "M9 21H3v-6", key: "wtvkvv" }]
|
|
197
|
-
], Do =
|
|
197
|
+
], Do = vt("maximize-2", Ro);
|
|
198
198
|
/**
|
|
199
199
|
* @license lucide-react v0.563.0 - ISC
|
|
200
200
|
*
|
|
@@ -209,7 +209,7 @@ const Po = [
|
|
|
209
209
|
key: "18887p"
|
|
210
210
|
}
|
|
211
211
|
]
|
|
212
|
-
], Kn =
|
|
212
|
+
], Kn = vt("message-square", Po);
|
|
213
213
|
/**
|
|
214
214
|
* @license lucide-react v0.563.0 - ISC
|
|
215
215
|
*
|
|
@@ -221,7 +221,7 @@ const zo = [
|
|
|
221
221
|
["path", { d: "M20 10h-6V4", key: "mjg0md" }],
|
|
222
222
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
223
223
|
["path", { d: "M4 14h6v6", key: "rmj7iw" }]
|
|
224
|
-
], wr =
|
|
224
|
+
], wr = vt("minimize-2", zo);
|
|
225
225
|
/**
|
|
226
226
|
* @license lucide-react v0.563.0 - ISC
|
|
227
227
|
*
|
|
@@ -237,7 +237,7 @@ const $o = [
|
|
|
237
237
|
}
|
|
238
238
|
],
|
|
239
239
|
["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
|
|
240
|
-
], _r =
|
|
240
|
+
], _r = vt("send", $o);
|
|
241
241
|
/**
|
|
242
242
|
* @license lucide-react v0.563.0 - ISC
|
|
243
243
|
*
|
|
@@ -246,7 +246,7 @@ const $o = [
|
|
|
246
246
|
*/
|
|
247
247
|
const No = [
|
|
248
248
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
|
|
249
|
-
], Lo =
|
|
249
|
+
], Lo = vt("square", No);
|
|
250
250
|
/**
|
|
251
251
|
* @license lucide-react v0.563.0 - ISC
|
|
252
252
|
*
|
|
@@ -262,7 +262,7 @@ const Fo = [
|
|
|
262
262
|
}
|
|
263
263
|
],
|
|
264
264
|
["path", { d: "M17 14V2", key: "8ymqnk" }]
|
|
265
|
-
], vr =
|
|
265
|
+
], vr = vt("thumbs-down", Fo);
|
|
266
266
|
/**
|
|
267
267
|
* @license lucide-react v0.563.0 - ISC
|
|
268
268
|
*
|
|
@@ -278,7 +278,7 @@ const Wo = [
|
|
|
278
278
|
}
|
|
279
279
|
],
|
|
280
280
|
["path", { d: "M7 10v12", key: "1qc93n" }]
|
|
281
|
-
], kr =
|
|
281
|
+
], kr = vt("thumbs-up", Wo);
|
|
282
282
|
/**
|
|
283
283
|
* @license lucide-react v0.563.0 - ISC
|
|
284
284
|
*
|
|
@@ -288,7 +288,7 @@ const Wo = [
|
|
|
288
288
|
const Bo = [
|
|
289
289
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
290
290
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
291
|
-
], Fn =
|
|
291
|
+
], Fn = vt("x", Bo);
|
|
292
292
|
function Uo(t, e, r) {
|
|
293
293
|
const a = t * e > 242500;
|
|
294
294
|
return { ...{
|
|
@@ -443,14 +443,14 @@ function Jo({
|
|
|
443
443
|
z.timeMetrics.totalVisibleDuration += U, m.current = W;
|
|
444
444
|
}
|
|
445
445
|
if (z.isVisible = C, z.visibilityPercentage = A, A > z.engagementMetrics.maxVisibilityPercentage && (z.engagementMetrics.maxVisibilityPercentage = A), g.current.length > 0 && (z.engagementMetrics.averageVisibilityPercentage = Go(g.current)), d.current) {
|
|
446
|
-
const U = B.isViewable,
|
|
446
|
+
const U = B.isViewable, V = Ko(
|
|
447
447
|
A,
|
|
448
448
|
z.timeMetrics.totalVisibleDuration,
|
|
449
449
|
d.current
|
|
450
450
|
);
|
|
451
|
-
if (
|
|
451
|
+
if (V && !U)
|
|
452
452
|
z.isViewable = !0, z.timeMetrics.timeToViewable = W - F, v.current = W, R("ad_viewable");
|
|
453
|
-
else if (
|
|
453
|
+
else if (V && U && v.current) {
|
|
454
454
|
const Q = W - v.current;
|
|
455
455
|
z.timeMetrics.totalViewableDuration += Q, v.current = W;
|
|
456
456
|
}
|
|
@@ -622,7 +622,7 @@ const Mr = (t) => {
|
|
|
622
622
|
} catch {
|
|
623
623
|
return !1;
|
|
624
624
|
}
|
|
625
|
-
}, ln = (t) => typeof t == "string" ? t.trim() : typeof t == "number" ? String(t) : "",
|
|
625
|
+
}, ln = (t) => typeof t == "string" ? t.trim() : typeof t == "number" ? String(t) : "", wt = (t) => ln(t) || void 0, Zo = (t) => t && t.trim() ? t.trim() : "", ei = (t, e) => {
|
|
626
626
|
if (t == null || t === "")
|
|
627
627
|
return "";
|
|
628
628
|
if (typeof t == "number")
|
|
@@ -648,31 +648,31 @@ const Mr = (t) => {
|
|
|
648
648
|
onStartDelegation: f,
|
|
649
649
|
onRecommendationReport: w
|
|
650
650
|
}) => {
|
|
651
|
-
var
|
|
651
|
+
var ye, mt, zt, $t, q, ut, At, jt, Kt;
|
|
652
652
|
if (!t || t.length === 0)
|
|
653
653
|
return s.log("[AdMesh Compact Tail Ad] No recommendations provided - not rendering"), null;
|
|
654
|
-
const d = t[0], m = d == null ? void 0 : d.recommendation, v = m == null ? void 0 : m.creative, M = d == null ? void 0 : d.tracking, u = d == null ? void 0 : d.delegation, g = (d == null ? void 0 : d.recommendation_id) || "", h = (m == null ? void 0 : m.offerId) || "", p = (v == null ? void 0 : v.brand_name) || "", k = (v == null ? void 0 : v.headline) || "", R = (v == null ? void 0 : v.description) || "", Y = (v == null ? void 0 : v.logo_url) || "", S = (M == null ? void 0 : M.click_url) || (v == null ? void 0 : v.landing_page_url) || "", A = (M == null ? void 0 : M.exposure_url) || "", W = (m == null ? void 0 : m.disclosure) || "Sponsored", F = (v == null ? void 0 : v.products) || [], B = F.slice(0, 4), z = F.length > 1, C = ((m == null ? void 0 : m.format) || "tail") === "bridge", U = (u == null ? void 0 : u.available) === !0,
|
|
654
|
+
const d = t[0], m = d == null ? void 0 : d.recommendation, v = m == null ? void 0 : m.creative, M = d == null ? void 0 : d.tracking, u = d == null ? void 0 : d.delegation, g = (d == null ? void 0 : d.recommendation_id) || "", h = (m == null ? void 0 : m.offerId) || "", p = (v == null ? void 0 : v.brand_name) || "", k = (v == null ? void 0 : v.headline) || "", R = (v == null ? void 0 : v.description) || "", Y = (v == null ? void 0 : v.logo_url) || "", S = (M == null ? void 0 : M.click_url) || (v == null ? void 0 : v.landing_page_url) || "", A = (M == null ? void 0 : M.exposure_url) || "", W = (m == null ? void 0 : m.disclosure) || "Sponsored", F = (v == null ? void 0 : v.products) || [], B = F.slice(0, 4), z = F.length > 1, C = ((m == null ? void 0 : m.format) || "tail") === "bridge", U = (u == null ? void 0 : u.available) === !0, V = C && U, Q = (u == null ? void 0 : u.brand_name) || p, H = "Talk to Agent", G = Zo(v == null ? void 0 : v.cta_text), re = !z && !!G && !!S;
|
|
655
655
|
if (!p && !k && !R)
|
|
656
656
|
return s.log("[AdMesh Compact Tail Ad] No valid recommendation data provided - not rendering", {
|
|
657
657
|
recommendationId: g
|
|
658
658
|
}), null;
|
|
659
|
-
const
|
|
659
|
+
const _e = k && k !== p ? k : p, te = R, oe = p.trim().toLowerCase(), Ae = _e.trim().toLowerCase(), Je = !!p && oe !== Ae, [De, Ce] = ae(!1), [pe, be] = ae(!1), [Pe, ke] = ae(!1), [le, kt] = ae(null), N = L(null);
|
|
660
660
|
Z(() => () => {
|
|
661
661
|
N.current && (N.current(!1), N.current = null);
|
|
662
662
|
}, []);
|
|
663
|
-
const X = (
|
|
663
|
+
const X = (O) => {
|
|
664
664
|
var Te;
|
|
665
|
-
|
|
666
|
-
}, J = async () => c ? await c(d) : await new Promise((
|
|
667
|
-
N.current =
|
|
668
|
-
}), ne = (
|
|
665
|
+
O && be(!0), (Te = N.current) == null || Te.call(N, O), N.current = null, O || (be(!1), Ce(!1));
|
|
666
|
+
}, J = async () => c ? await c(d) : await new Promise((O) => {
|
|
667
|
+
N.current = O, Ce(!0);
|
|
668
|
+
}), ne = (O, Te) => {
|
|
669
669
|
Te && Te.stopPropagation(), typeof window < "u" && window.admeshTracker && window.admeshTracker.trackClick({
|
|
670
670
|
recommendationId: g,
|
|
671
671
|
productId: h,
|
|
672
672
|
clickUrl: S,
|
|
673
|
-
source:
|
|
673
|
+
source: O
|
|
674
674
|
}).catch(() => {
|
|
675
|
-
s.error(`[AdMesh] Failed to track ${
|
|
675
|
+
s.error(`[AdMesh] Failed to track ${O} click`);
|
|
676
676
|
});
|
|
677
677
|
}, ie = [
|
|
678
678
|
{ value: "irrelevant", label: "Not relevant" },
|
|
@@ -680,10 +680,10 @@ const Mr = (t) => {
|
|
|
680
680
|
{ value: "inappropriate", label: "Inappropriate" },
|
|
681
681
|
{ value: "broken_link", label: "Broken link" },
|
|
682
682
|
{ value: "other", label: "Other" }
|
|
683
|
-
],
|
|
684
|
-
|
|
685
|
-
}, D = async (
|
|
686
|
-
if (
|
|
683
|
+
], ze = (O) => {
|
|
684
|
+
O.preventDefault(), O.stopPropagation(), !le && ke((Te) => !Te);
|
|
685
|
+
}, D = async (O, Te) => {
|
|
686
|
+
if (O.preventDefault(), O.stopPropagation(), ke(!1), kt(Te), !!w)
|
|
687
687
|
try {
|
|
688
688
|
await w({
|
|
689
689
|
recommendation: d,
|
|
@@ -696,12 +696,12 @@ const Mr = (t) => {
|
|
|
696
696
|
}
|
|
697
697
|
}, ce = () => {
|
|
698
698
|
z || !S || (ne("compact_tail_ad_card"), typeof window < "u" && window.open(S, "_blank", "noopener,noreferrer"));
|
|
699
|
-
}, P = (
|
|
700
|
-
z || !S || (
|
|
701
|
-
},
|
|
699
|
+
}, P = (O) => {
|
|
700
|
+
z || !S || (O.key === "Enter" || O.key === " ") && (O.preventDefault(), ce());
|
|
701
|
+
}, we = async () => {
|
|
702
702
|
if (g && a)
|
|
703
703
|
try {
|
|
704
|
-
const
|
|
704
|
+
const O = typeof window < "u" && window.__ADMESH_API_BASE_URL__ || "https://api.useadmesh.com", Te = await fetch(`${O}/click/bridge-engagement`, {
|
|
705
705
|
method: "POST",
|
|
706
706
|
headers: {
|
|
707
707
|
"Content-Type": "application/json"
|
|
@@ -713,32 +713,32 @@ const Mr = (t) => {
|
|
|
713
713
|
})
|
|
714
714
|
});
|
|
715
715
|
Te.ok || s.warn("[AdMesh Compact Tail Ad] Delegation engagement tracking failed:", Te.statusText);
|
|
716
|
-
} catch (
|
|
717
|
-
s.error("[AdMesh Compact Tail Ad] Error tracking delegation engagement:",
|
|
716
|
+
} catch (O) {
|
|
717
|
+
s.error("[AdMesh Compact Tail Ad] Error tracking delegation engagement:", O);
|
|
718
718
|
}
|
|
719
|
-
}, I = async (
|
|
720
|
-
if (
|
|
719
|
+
}, I = async (O) => {
|
|
720
|
+
if (O.preventDefault(), O.stopPropagation(), !d || !V || (ne("compact_tail_ad_delegation_cta"), !await J()))
|
|
721
721
|
return;
|
|
722
|
-
|
|
722
|
+
we();
|
|
723
723
|
const et = u != null && u.available ? {
|
|
724
724
|
recommendation_id: d.recommendation_id,
|
|
725
|
-
brand_id:
|
|
726
|
-
brand_name:
|
|
727
|
-
mcp_endpoint:
|
|
728
|
-
eligibility_reason:
|
|
729
|
-
delegate_reason:
|
|
730
|
-
session_goal:
|
|
725
|
+
brand_id: wt(u.brand_id),
|
|
726
|
+
brand_name: wt(u.brand_name || (v == null ? void 0 : v.brand_name)),
|
|
727
|
+
mcp_endpoint: wt(u.mcp_endpoint),
|
|
728
|
+
eligibility_reason: wt(u.eligibility_reason),
|
|
729
|
+
delegate_reason: wt(u.delegate_reason),
|
|
730
|
+
session_goal: wt(u.session_goal),
|
|
731
731
|
desired_outcome_type: u.desired_outcome_type,
|
|
732
732
|
required_user_inputs: Array.isArray(u.required_user_inputs) ? u.required_user_inputs.filter((gt) => typeof gt == "string") : [],
|
|
733
733
|
required_consent_types: Array.isArray(u.required_consent_types) ? u.required_consent_types.filter((gt) => typeof gt == "string") : [],
|
|
734
|
-
success_outcome:
|
|
735
|
-
fallback_message:
|
|
736
|
-
session_mode:
|
|
737
|
-
status:
|
|
734
|
+
success_outcome: wt(u.success_outcome),
|
|
735
|
+
fallback_message: wt(u.fallback_message),
|
|
736
|
+
session_mode: wt(u.session_mode),
|
|
737
|
+
status: wt(u.status),
|
|
738
738
|
capabilities: u.capabilities || [],
|
|
739
739
|
allowed_data_types: u.allowed_data_types || [],
|
|
740
740
|
consent_requirements: u.consent_requirements || [],
|
|
741
|
-
auth_model:
|
|
741
|
+
auth_model: wt(u.auth_model),
|
|
742
742
|
handoff_protocol: u.handoff_protocol && typeof u.handoff_protocol == "object" ? u.handoff_protocol : void 0,
|
|
743
743
|
supported_actions: u.supported_actions || [],
|
|
744
744
|
metadata: u.metadata && typeof u.metadata == "object" ? u.metadata : void 0,
|
|
@@ -748,7 +748,7 @@ const Mr = (t) => {
|
|
|
748
748
|
try {
|
|
749
749
|
await y(et);
|
|
750
750
|
} finally {
|
|
751
|
-
|
|
751
|
+
be(!1), Ce(!1);
|
|
752
752
|
}
|
|
753
753
|
return;
|
|
754
754
|
}
|
|
@@ -756,13 +756,13 @@ const Mr = (t) => {
|
|
|
756
756
|
try {
|
|
757
757
|
await f(d);
|
|
758
758
|
} finally {
|
|
759
|
-
|
|
759
|
+
be(!1), Ce(!1);
|
|
760
760
|
}
|
|
761
761
|
return;
|
|
762
762
|
}
|
|
763
|
-
|
|
764
|
-
}, [
|
|
765
|
-
|
|
763
|
+
be(!1), Ce(!1);
|
|
764
|
+
}, [he, Me] = ae(!1), xe = (e == null ? void 0 : e.mode) === "dark" || typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches, qe = (e == null ? void 0 : e.surfaceColor) || ((mt = (ye = e == null ? void 0 : e.components) == null ? void 0 : ye.card) == null ? void 0 : mt.backgroundColor) || (xe ? "#111827" : "#ffffff"), We = (e == null ? void 0 : e.borderColor) || (($t = (zt = e == null ? void 0 : e.components) == null ? void 0 : zt.card) == null ? void 0 : $t.borderColor) || (xe ? "rgba(255, 255, 255, 0.10)" : "rgba(15, 23, 42, 0.08)"), Ee = ((q = e == null ? void 0 : e.shadows) == null ? void 0 : q.medium) || ((At = (ut = e == null ? void 0 : e.components) == null ? void 0 : ut.card) == null ? void 0 : At.boxShadow) || (xe ? "0 8px 18px rgba(0, 0, 0, 0.28)" : "0 8px 18px rgba(15, 23, 42, 0.08)"), Le = "#2563eb", Ie = xe ? "#9ca3af" : "#6b7280", St = xe ? "#e5e7eb" : "#374151", ct = xe ? "#f9fafb" : "#0f172a", Pt = xe ? "rgba(255, 255, 255, 0.04)" : "#f8fafc", Fe = "50px", Ye = V || re ? /* @__PURE__ */ E("div", { style: { display: "flex", alignItems: "center", gap: "10px", flexWrap: "wrap" }, children: [
|
|
765
|
+
V ? /* @__PURE__ */ i(
|
|
766
766
|
"button",
|
|
767
767
|
{
|
|
768
768
|
type: "button",
|
|
@@ -777,7 +777,7 @@ const Mr = (t) => {
|
|
|
777
777
|
cursor: "pointer",
|
|
778
778
|
textDecoration: "none"
|
|
779
779
|
},
|
|
780
|
-
children:
|
|
780
|
+
children: H
|
|
781
781
|
}
|
|
782
782
|
) : null,
|
|
783
783
|
re ? /* @__PURE__ */ i(
|
|
@@ -786,14 +786,14 @@ const Mr = (t) => {
|
|
|
786
786
|
href: S,
|
|
787
787
|
target: "_blank",
|
|
788
788
|
rel: "noopener noreferrer",
|
|
789
|
-
onClick: (
|
|
789
|
+
onClick: (O) => ne("compact_tail_ad_cta", O),
|
|
790
790
|
style: {
|
|
791
791
|
color: Le,
|
|
792
792
|
fontSize: "12px",
|
|
793
793
|
fontWeight: 600,
|
|
794
794
|
textDecoration: "none"
|
|
795
795
|
},
|
|
796
|
-
children:
|
|
796
|
+
children: G
|
|
797
797
|
}
|
|
798
798
|
) : null
|
|
799
799
|
] }) : null;
|
|
@@ -881,8 +881,8 @@ const Mr = (t) => {
|
|
|
881
881
|
gap: "10px",
|
|
882
882
|
padding: "12px",
|
|
883
883
|
borderRadius: (e == null ? void 0 : e.borderRadius) || ((Kt = (jt = e == null ? void 0 : e.components) == null ? void 0 : jt.card) == null ? void 0 : Kt.borderRadius) || "14px",
|
|
884
|
-
border: `1px solid ${
|
|
885
|
-
background:
|
|
884
|
+
border: `1px solid ${We}`,
|
|
885
|
+
background: qe,
|
|
886
886
|
boxShadow: Ee,
|
|
887
887
|
minWidth: 0,
|
|
888
888
|
cursor: !z && S ? "pointer" : void 0
|
|
@@ -900,12 +900,12 @@ const Mr = (t) => {
|
|
|
900
900
|
borderRadius: "10px",
|
|
901
901
|
flexShrink: 0,
|
|
902
902
|
overflow: "hidden",
|
|
903
|
-
background:
|
|
903
|
+
background: xe ? "#1f2937" : "#eff6ff",
|
|
904
904
|
display: "flex",
|
|
905
905
|
alignItems: "center",
|
|
906
906
|
justifyContent: "center"
|
|
907
907
|
},
|
|
908
|
-
children: !
|
|
908
|
+
children: !he && Y && Mr(Y) ? /* @__PURE__ */ i(
|
|
909
909
|
"img",
|
|
910
910
|
{
|
|
911
911
|
src: Y,
|
|
@@ -963,8 +963,8 @@ const Mr = (t) => {
|
|
|
963
963
|
color: ct,
|
|
964
964
|
marginBottom: "4px"
|
|
965
965
|
},
|
|
966
|
-
title:
|
|
967
|
-
children:
|
|
966
|
+
title: _e,
|
|
967
|
+
children: _e
|
|
968
968
|
}
|
|
969
969
|
),
|
|
970
970
|
te && /* @__PURE__ */ i(
|
|
@@ -975,7 +975,7 @@ const Mr = (t) => {
|
|
|
975
975
|
margin: 0,
|
|
976
976
|
fontSize: "12px",
|
|
977
977
|
lineHeight: 1.35,
|
|
978
|
-
color:
|
|
978
|
+
color: St
|
|
979
979
|
},
|
|
980
980
|
title: te,
|
|
981
981
|
children: te
|
|
@@ -993,24 +993,24 @@ const Mr = (t) => {
|
|
|
993
993
|
overflowX: "auto",
|
|
994
994
|
paddingBottom: "2px"
|
|
995
995
|
},
|
|
996
|
-
children: B.map((
|
|
997
|
-
const Te = ln(
|
|
996
|
+
children: B.map((O) => {
|
|
997
|
+
const Te = ln(O.product_name) || "Product", et = ln(O.product_link) || ln(O.product_url) || S || "#", gt = ei(O.product_price, O.product_currency), Nt = ln(O.product_image_url), Lt = Nt && Mr(Nt) ? Nt : "", Gt = et !== "#";
|
|
998
998
|
return /* @__PURE__ */ i(
|
|
999
999
|
"a",
|
|
1000
1000
|
{
|
|
1001
1001
|
href: et,
|
|
1002
1002
|
target: Gt ? "_blank" : void 0,
|
|
1003
1003
|
rel: Gt ? "noopener noreferrer" : void 0,
|
|
1004
|
-
onClick: (
|
|
1004
|
+
onClick: (Ft) => ne(`compact_tail_ad_product_${O.product_id || "item"}`, Ft),
|
|
1005
1005
|
style: {
|
|
1006
1006
|
minWidth: "220px",
|
|
1007
1007
|
maxWidth: "220px",
|
|
1008
1008
|
display: "block",
|
|
1009
1009
|
textDecoration: "none",
|
|
1010
1010
|
color: "inherit",
|
|
1011
|
-
border: `1px solid ${
|
|
1011
|
+
border: `1px solid ${We}`,
|
|
1012
1012
|
borderRadius: "12px",
|
|
1013
|
-
background:
|
|
1013
|
+
background: Pt,
|
|
1014
1014
|
padding: "8px",
|
|
1015
1015
|
flexShrink: 0
|
|
1016
1016
|
},
|
|
@@ -1024,7 +1024,7 @@ const Mr = (t) => {
|
|
|
1024
1024
|
borderRadius: "8px",
|
|
1025
1025
|
overflow: "hidden",
|
|
1026
1026
|
flexShrink: 0,
|
|
1027
|
-
background:
|
|
1027
|
+
background: xe ? "#374151" : "#e5e7eb",
|
|
1028
1028
|
display: "flex",
|
|
1029
1029
|
alignItems: "center",
|
|
1030
1030
|
justifyContent: "center",
|
|
@@ -1032,7 +1032,7 @@ const Mr = (t) => {
|
|
|
1032
1032
|
fontSize: "12px",
|
|
1033
1033
|
fontWeight: 700
|
|
1034
1034
|
},
|
|
1035
|
-
children:
|
|
1035
|
+
children: Lt ? /* @__PURE__ */ i("img", { src: Lt, alt: Te, style: { width: "100%", height: "100%", objectFit: "cover" } }) : Te.charAt(0).toUpperCase()
|
|
1036
1036
|
}
|
|
1037
1037
|
),
|
|
1038
1038
|
/* @__PURE__ */ E("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
@@ -1056,7 +1056,7 @@ const Mr = (t) => {
|
|
|
1056
1056
|
] })
|
|
1057
1057
|
] })
|
|
1058
1058
|
},
|
|
1059
|
-
|
|
1059
|
+
O.product_id || `${g}-${Te}`
|
|
1060
1060
|
);
|
|
1061
1061
|
})
|
|
1062
1062
|
}
|
|
@@ -1099,13 +1099,13 @@ const Mr = (t) => {
|
|
|
1099
1099
|
"aria-label": le ? "Recommendation reported" : "Report recommendation",
|
|
1100
1100
|
title: le ? "Reported" : "Report recommendation",
|
|
1101
1101
|
disabled: !!le,
|
|
1102
|
-
onClick:
|
|
1102
|
+
onClick: ze,
|
|
1103
1103
|
style: {
|
|
1104
1104
|
width: "28px",
|
|
1105
1105
|
height: "28px",
|
|
1106
1106
|
borderRadius: "999px",
|
|
1107
|
-
border: `1px solid ${
|
|
1108
|
-
background: le ?
|
|
1107
|
+
border: `1px solid ${We}`,
|
|
1108
|
+
background: le ? Pt : qe,
|
|
1109
1109
|
color: le ? Le : Ie,
|
|
1110
1110
|
display: "inline-flex",
|
|
1111
1111
|
alignItems: "center",
|
|
@@ -1123,40 +1123,40 @@ const Mr = (t) => {
|
|
|
1123
1123
|
]
|
|
1124
1124
|
}
|
|
1125
1125
|
),
|
|
1126
|
-
|
|
1126
|
+
Pe ? /* @__PURE__ */ i(
|
|
1127
1127
|
"div",
|
|
1128
1128
|
{
|
|
1129
1129
|
className: "admesh-compact-report-panel",
|
|
1130
|
-
onClick: (
|
|
1130
|
+
onClick: (O) => O.stopPropagation(),
|
|
1131
1131
|
style: {
|
|
1132
1132
|
marginLeft: z ? 0 : Fe,
|
|
1133
|
-
border: `1px solid ${
|
|
1133
|
+
border: `1px solid ${We}`,
|
|
1134
1134
|
borderRadius: "12px",
|
|
1135
|
-
background:
|
|
1135
|
+
background: Pt,
|
|
1136
1136
|
padding: "8px",
|
|
1137
1137
|
display: "flex",
|
|
1138
1138
|
flexWrap: "wrap",
|
|
1139
1139
|
gap: "6px"
|
|
1140
1140
|
},
|
|
1141
|
-
children: ie.map((
|
|
1141
|
+
children: ie.map((O) => /* @__PURE__ */ i(
|
|
1142
1142
|
"button",
|
|
1143
1143
|
{
|
|
1144
1144
|
className: "admesh-compact-report-option",
|
|
1145
1145
|
type: "button",
|
|
1146
|
-
onClick: (Te) => D(Te,
|
|
1146
|
+
onClick: (Te) => D(Te, O.value),
|
|
1147
1147
|
style: {
|
|
1148
1148
|
borderRadius: "999px",
|
|
1149
|
-
border: `1px solid ${
|
|
1150
|
-
background:
|
|
1149
|
+
border: `1px solid ${We}`,
|
|
1150
|
+
background: qe,
|
|
1151
1151
|
color: ct,
|
|
1152
1152
|
fontSize: "11px",
|
|
1153
1153
|
fontWeight: 600,
|
|
1154
1154
|
padding: "6px 9px",
|
|
1155
1155
|
cursor: "pointer"
|
|
1156
1156
|
},
|
|
1157
|
-
children:
|
|
1157
|
+
children: O.label
|
|
1158
1158
|
},
|
|
1159
|
-
|
|
1159
|
+
O.value
|
|
1160
1160
|
))
|
|
1161
1161
|
}
|
|
1162
1162
|
) : null,
|
|
@@ -1172,14 +1172,14 @@ const Mr = (t) => {
|
|
|
1172
1172
|
children: "Thanks for reporting this recommendation."
|
|
1173
1173
|
}
|
|
1174
1174
|
) : null,
|
|
1175
|
-
|
|
1175
|
+
De ? /* @__PURE__ */ E(
|
|
1176
1176
|
"div",
|
|
1177
1177
|
{
|
|
1178
1178
|
style: {
|
|
1179
1179
|
marginTop: "2px",
|
|
1180
|
-
border: `1px solid ${
|
|
1180
|
+
border: `1px solid ${We}`,
|
|
1181
1181
|
borderRadius: "12px",
|
|
1182
|
-
background:
|
|
1182
|
+
background: Pt,
|
|
1183
1183
|
padding: "12px",
|
|
1184
1184
|
display: "flex",
|
|
1185
1185
|
flexDirection: "column",
|
|
@@ -1205,27 +1205,27 @@ const Mr = (t) => {
|
|
|
1205
1205
|
Q || "this brand",
|
|
1206
1206
|
" to start a delegated session?"
|
|
1207
1207
|
] }),
|
|
1208
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "12px", lineHeight: 1.45, color:
|
|
1208
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "12px", lineHeight: 1.45, color: St }, children: "The agent will only use the details you choose to share for this request." })
|
|
1209
1209
|
] }),
|
|
1210
1210
|
/* @__PURE__ */ E("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" }, children: [
|
|
1211
1211
|
/* @__PURE__ */ i(
|
|
1212
1212
|
"button",
|
|
1213
1213
|
{
|
|
1214
1214
|
type: "button",
|
|
1215
|
-
disabled:
|
|
1216
|
-
onClick: (
|
|
1217
|
-
|
|
1215
|
+
disabled: pe,
|
|
1216
|
+
onClick: (O) => {
|
|
1217
|
+
O.preventDefault(), O.stopPropagation(), !pe && X(!1);
|
|
1218
1218
|
},
|
|
1219
1219
|
style: {
|
|
1220
1220
|
borderRadius: "10px",
|
|
1221
|
-
border: `1px solid ${
|
|
1222
|
-
background:
|
|
1221
|
+
border: `1px solid ${We}`,
|
|
1222
|
+
background: qe,
|
|
1223
1223
|
color: ct,
|
|
1224
1224
|
fontSize: "12px",
|
|
1225
1225
|
fontWeight: 600,
|
|
1226
1226
|
padding: "8px 12px",
|
|
1227
|
-
cursor:
|
|
1228
|
-
opacity:
|
|
1227
|
+
cursor: pe ? "not-allowed" : "pointer",
|
|
1228
|
+
opacity: pe ? 0.65 : 1
|
|
1229
1229
|
},
|
|
1230
1230
|
children: "Not now"
|
|
1231
1231
|
}
|
|
@@ -1234,9 +1234,9 @@ const Mr = (t) => {
|
|
|
1234
1234
|
"button",
|
|
1235
1235
|
{
|
|
1236
1236
|
type: "button",
|
|
1237
|
-
disabled:
|
|
1238
|
-
onClick: (
|
|
1239
|
-
|
|
1237
|
+
disabled: pe,
|
|
1238
|
+
onClick: (O) => {
|
|
1239
|
+
O.preventDefault(), O.stopPropagation(), !pe && X(!0);
|
|
1240
1240
|
},
|
|
1241
1241
|
style: {
|
|
1242
1242
|
borderRadius: "10px",
|
|
@@ -1246,10 +1246,10 @@ const Mr = (t) => {
|
|
|
1246
1246
|
fontSize: "12px",
|
|
1247
1247
|
fontWeight: 700,
|
|
1248
1248
|
padding: "8px 12px",
|
|
1249
|
-
cursor:
|
|
1250
|
-
opacity:
|
|
1249
|
+
cursor: pe ? "wait" : "pointer",
|
|
1250
|
+
opacity: pe ? 0.86 : 1
|
|
1251
1251
|
},
|
|
1252
|
-
children:
|
|
1252
|
+
children: pe ? "Connecting..." : "Allow agent"
|
|
1253
1253
|
}
|
|
1254
1254
|
)
|
|
1255
1255
|
] })
|
|
@@ -1757,20 +1757,20 @@ const fi = ({
|
|
|
1757
1757
|
}) => {
|
|
1758
1758
|
const [g, h] = ae(null), [p, k] = ae(
|
|
1759
1759
|
/* @__PURE__ */ new Set()
|
|
1760
|
-
), [R, Y] = ae(/* @__PURE__ */ new Map()), [S, A] = ae(null), [W, F] = ae([]), [B, z] = ae(!1), [$, C] = ae(null), [U,
|
|
1760
|
+
), [R, Y] = ae(/* @__PURE__ */ new Map()), [S, A] = ae(null), [W, F] = ae([]), [B, z] = ae(!1), [$, C] = ae(null), [U, V] = ae(!1), Q = L(!1), H = L(0), G = L(null), re = L(null);
|
|
1761
1761
|
re.current = S;
|
|
1762
|
-
const
|
|
1762
|
+
const _e = !!d || v === "ad-slot" || v === "auto" && (!!(m != null && m.trim()) || ci()), te = de(async () => {
|
|
1763
1763
|
if (d)
|
|
1764
1764
|
return d;
|
|
1765
|
-
if (!
|
|
1765
|
+
if (!_e)
|
|
1766
1766
|
return oi();
|
|
1767
1767
|
const N = hi(m);
|
|
1768
1768
|
if (!N)
|
|
1769
1769
|
return s.warn("[AdMeshProvider] Ad-slot context mode requires a real article URL"), C("Article URL is required for ad-slot context"), null;
|
|
1770
|
-
if (!t
|
|
1771
|
-
return s.warn("[AdMeshProvider] Cannot fetch page context: missing API key
|
|
1770
|
+
if (!t)
|
|
1771
|
+
return s.warn("[AdMeshProvider] Cannot fetch page context: missing API key"), Ir(N);
|
|
1772
1772
|
try {
|
|
1773
|
-
|
|
1773
|
+
V(!0);
|
|
1774
1774
|
const X = await di(N, {
|
|
1775
1775
|
apiKey: t,
|
|
1776
1776
|
apiBaseUrl: a || "https://api.useadmesh.com",
|
|
@@ -1784,7 +1784,7 @@ const fi = ({
|
|
|
1784
1784
|
} catch (X) {
|
|
1785
1785
|
return s.error("[AdMeshProvider] Failed to fetch page context:", X), s.warn("[AdMeshProvider] Falling back to URL-path context for suggestions"), Ir(N);
|
|
1786
1786
|
} finally {
|
|
1787
|
-
|
|
1787
|
+
V(!1);
|
|
1788
1788
|
}
|
|
1789
1789
|
}, [
|
|
1790
1790
|
M,
|
|
@@ -1792,7 +1792,7 @@ const fi = ({
|
|
|
1792
1792
|
t,
|
|
1793
1793
|
m,
|
|
1794
1794
|
d,
|
|
1795
|
-
|
|
1795
|
+
_e
|
|
1796
1796
|
]), oe = de(
|
|
1797
1797
|
(N, X) => {
|
|
1798
1798
|
const J = N.filter((ne) => !ne.is_sponsored).slice(0, 3);
|
|
@@ -1805,7 +1805,7 @@ const fi = ({
|
|
|
1805
1805
|
}, []);
|
|
1806
1806
|
Z(() => {
|
|
1807
1807
|
if (!e || e.trim() === "") {
|
|
1808
|
-
s.error("[AdMeshProvider]
|
|
1808
|
+
s.error("[AdMeshProvider] sessionId is required and must be provided by the platform. Use AdMeshSDK.generateSessionIdFromUrl() for URL-based detection.");
|
|
1809
1809
|
return;
|
|
1810
1810
|
}
|
|
1811
1811
|
s.log("[AdMeshProvider] ✅ Session ID available:", e);
|
|
@@ -1815,7 +1815,7 @@ const fi = ({
|
|
|
1815
1815
|
return;
|
|
1816
1816
|
}
|
|
1817
1817
|
if (!e || e.trim() === "") {
|
|
1818
|
-
s.error("[AdMeshProvider]
|
|
1818
|
+
s.error("[AdMeshProvider] Cannot initialize SDK: sessionId is required. Use AdMeshSDK.generateSessionIdFromUrl() for URL-based detection.");
|
|
1819
1819
|
return;
|
|
1820
1820
|
}
|
|
1821
1821
|
try {
|
|
@@ -1827,7 +1827,7 @@ const fi = ({
|
|
|
1827
1827
|
});
|
|
1828
1828
|
h(N), s.log("[AdMeshProvider] ✅ AdMesh SDK initialized with session:", e), a && s.log("[AdMeshProvider] 📍 Using custom API base URL");
|
|
1829
1829
|
} catch (N) {
|
|
1830
|
-
s.error("[AdMeshProvider]
|
|
1830
|
+
s.error("[AdMeshProvider] Failed to initialize AdMesh SDK:", N);
|
|
1831
1831
|
}
|
|
1832
1832
|
return () => {
|
|
1833
1833
|
s.log("[AdMeshProvider] 🧹 Provider unmounted");
|
|
@@ -1835,8 +1835,8 @@ const fi = ({
|
|
|
1835
1835
|
}, [t, o, a, e, r]);
|
|
1836
1836
|
const Je = de(async (N) => {
|
|
1837
1837
|
var X;
|
|
1838
|
-
if (!t
|
|
1839
|
-
s.warn("[AdMeshProvider] ⚠️ Cannot perform intent analysis: missing API key
|
|
1838
|
+
if (!t) {
|
|
1839
|
+
s.warn("[AdMeshProvider] ⚠️ Cannot perform intent analysis: missing API key");
|
|
1840
1840
|
return;
|
|
1841
1841
|
}
|
|
1842
1842
|
if (r)
|
|
@@ -1866,18 +1866,18 @@ const fi = ({
|
|
|
1866
1866
|
});
|
|
1867
1867
|
ie ? (s.log("[AdMeshProvider] ✅ Intent analysis completed:", {
|
|
1868
1868
|
suggestionsCount: ie.suggestions.length,
|
|
1869
|
-
suggestions: (ie.suggestions || []).map((
|
|
1869
|
+
suggestions: (ie.suggestions || []).map((ze) => {
|
|
1870
1870
|
var D;
|
|
1871
1871
|
return {
|
|
1872
|
-
id:
|
|
1873
|
-
text:
|
|
1874
|
-
is_sponsored:
|
|
1875
|
-
recommendationId: ((D =
|
|
1872
|
+
id: ze.id,
|
|
1873
|
+
text: ze.text,
|
|
1874
|
+
is_sponsored: ze.is_sponsored,
|
|
1875
|
+
recommendationId: ((D = ze.recommendation) == null ? void 0 : D.recommendation_id) || null
|
|
1876
1876
|
};
|
|
1877
1877
|
})
|
|
1878
1878
|
}), F(
|
|
1879
|
-
(
|
|
1880
|
-
)) : (s.warn("[AdMeshProvider] ⚠️ Intent analysis returned null"), C("Intent analysis failed"), F((
|
|
1879
|
+
(ze) => Ae(ze, ie.suggestions || [])
|
|
1880
|
+
)) : (s.warn("[AdMeshProvider] ⚠️ Intent analysis returned null"), C("Intent analysis failed"), F((ze) => ze.length > 0 ? (s.log("[AdMeshProvider] ℹ️ Preserving existing suggestions after null intent analysis result"), ze) : [
|
|
1881
1881
|
{
|
|
1882
1882
|
id: "fallback-1",
|
|
1883
1883
|
text: "What are your questions about this content?",
|
|
@@ -1887,7 +1887,7 @@ const fi = ({
|
|
|
1887
1887
|
}
|
|
1888
1888
|
]));
|
|
1889
1889
|
} catch (J) {
|
|
1890
|
-
s.error("[AdMeshProvider]
|
|
1890
|
+
s.error("[AdMeshProvider] Error in intent analysis:", J), C("Intent analysis error"), F((ne) => ne.length > 0 ? (s.log("[AdMeshProvider] ℹ️ Preserving existing suggestions after intent analysis error"), ne) : [
|
|
1891
1891
|
{
|
|
1892
1892
|
id: "error-fallback-1",
|
|
1893
1893
|
text: "Ask me questions about this page",
|
|
@@ -1899,9 +1899,9 @@ const fi = ({
|
|
|
1899
1899
|
} finally {
|
|
1900
1900
|
z(!1);
|
|
1901
1901
|
}
|
|
1902
|
-
}, [t, a, r, y, Ae, te]),
|
|
1902
|
+
}, [t, a, r, y, Ae, te]), De = de(
|
|
1903
1903
|
async (N) => {
|
|
1904
|
-
var ne, ie,
|
|
1904
|
+
var ne, ie, ze, D, ce, P;
|
|
1905
1905
|
if (!g || !t || !t.toLowerCase().startsWith("pub_"))
|
|
1906
1906
|
return;
|
|
1907
1907
|
const X = N ?? await te();
|
|
@@ -1909,47 +1909,47 @@ const fi = ({
|
|
|
1909
1909
|
s.warn("[AdMeshProvider] ⚠️ Failed to extract page content for sponsored suggestion prefetch");
|
|
1910
1910
|
return;
|
|
1911
1911
|
}
|
|
1912
|
-
const J = ((ie = (ne = X.headings) == null ? void 0 : ne[0]) == null ? void 0 : ie.trim()) || ((
|
|
1912
|
+
const J = ((ie = (ne = X.headings) == null ? void 0 : ne[0]) == null ? void 0 : ie.trim()) || ((ze = X.title) == null ? void 0 : ze.trim());
|
|
1913
1913
|
if (!J) {
|
|
1914
1914
|
s.warn("[AdMeshProvider] ⚠️ Skipping sponsored suggestion prefetch: no usable page query");
|
|
1915
1915
|
return;
|
|
1916
1916
|
}
|
|
1917
1917
|
try {
|
|
1918
1918
|
s.log("[AdMeshProvider] 🔄 Prefetching sponsored suggestion from /aip/context...");
|
|
1919
|
-
const
|
|
1919
|
+
const we = await g.fetchPlatformResponse({
|
|
1920
1920
|
query: J,
|
|
1921
1921
|
sessionId: e,
|
|
1922
1922
|
messageId: Sn.createMessageId(e),
|
|
1923
|
-
platformSurface: "
|
|
1923
|
+
platformSurface: "copilot",
|
|
1924
1924
|
model: f,
|
|
1925
1925
|
messages: [],
|
|
1926
1926
|
language: l,
|
|
1927
1927
|
location: c,
|
|
1928
1928
|
userId: y
|
|
1929
|
-
}), I = (P = (ce = (D =
|
|
1930
|
-
if (!I || !
|
|
1929
|
+
}), I = (P = (ce = (D = we.recommendation) == null ? void 0 : D.creative) == null ? void 0 : ce.follow_up_suggestion) == null ? void 0 : P.trim(), he = we.recommendation_id;
|
|
1930
|
+
if (!I || !he) {
|
|
1931
1931
|
s.log("[AdMeshProvider] ℹ️ No sponsored follow-up suggestion returned from /aip/context");
|
|
1932
1932
|
return;
|
|
1933
1933
|
}
|
|
1934
1934
|
const Me = {
|
|
1935
|
-
id:
|
|
1935
|
+
id: he,
|
|
1936
1936
|
text: I,
|
|
1937
1937
|
type: "action",
|
|
1938
1938
|
is_sponsored: !0,
|
|
1939
|
-
recommendation:
|
|
1939
|
+
recommendation: we,
|
|
1940
1940
|
metadata: {
|
|
1941
1941
|
source: "aip_context_prefetch",
|
|
1942
|
-
recommendation_id:
|
|
1942
|
+
recommendation_id: he
|
|
1943
1943
|
}
|
|
1944
1944
|
};
|
|
1945
1945
|
F(
|
|
1946
|
-
(
|
|
1946
|
+
(xe) => oe(xe, Me)
|
|
1947
1947
|
), s.log("[AdMeshProvider] ✅ Sponsored suggestion prefetched from /aip/context", {
|
|
1948
|
-
recommendationId:
|
|
1948
|
+
recommendationId: he,
|
|
1949
1949
|
suggestionText: I
|
|
1950
1950
|
});
|
|
1951
|
-
} catch (
|
|
1952
|
-
s.warn("[AdMeshProvider] ⚠️ Sponsored suggestion prefetch failed (non-blocking):",
|
|
1951
|
+
} catch (we) {
|
|
1952
|
+
s.warn("[AdMeshProvider] ⚠️ Sponsored suggestion prefetch failed (non-blocking):", we);
|
|
1953
1953
|
}
|
|
1954
1954
|
},
|
|
1955
1955
|
[t, l, c, f, g, e, y, oe, te]
|
|
@@ -1960,17 +1960,17 @@ const fi = ({
|
|
|
1960
1960
|
!g || Q.current || (Q.current = !0, (async () => {
|
|
1961
1961
|
const N = await te();
|
|
1962
1962
|
await Promise.allSettled([
|
|
1963
|
-
|
|
1963
|
+
De(N),
|
|
1964
1964
|
Je(N)
|
|
1965
1965
|
]);
|
|
1966
1966
|
})());
|
|
1967
|
-
}, [g, Je,
|
|
1968
|
-
const
|
|
1967
|
+
}, [g, Je, De, te]);
|
|
1968
|
+
const pe = de((N) => {
|
|
1969
1969
|
if (!N || N.status !== "active")
|
|
1970
1970
|
return !1;
|
|
1971
1971
|
const X = Date.parse(N.expires_at);
|
|
1972
1972
|
return Number.isNaN(X) ? !1 : X > Date.now();
|
|
1973
|
-
}, []),
|
|
1973
|
+
}, []), be = de(
|
|
1974
1974
|
async (N, X, J, ne) => {
|
|
1975
1975
|
const ie = ne ?? S;
|
|
1976
1976
|
if (!ie || !g) {
|
|
@@ -1982,7 +1982,7 @@ const fi = ({
|
|
|
1982
1982
|
});
|
|
1983
1983
|
return;
|
|
1984
1984
|
}
|
|
1985
|
-
const
|
|
1985
|
+
const ze = (/* @__PURE__ */ new Date()).toISOString();
|
|
1986
1986
|
s.log("[AdMeshProvider] 📡 Sending delegation event", {
|
|
1987
1987
|
endpoint: N,
|
|
1988
1988
|
eventType: X,
|
|
@@ -2002,20 +2002,20 @@ const fi = ({
|
|
|
2002
2002
|
recommendation_id: ie.recommendation_id,
|
|
2003
2003
|
session_id: ie.session_id,
|
|
2004
2004
|
event_type: X,
|
|
2005
|
-
timestamp:
|
|
2005
|
+
timestamp: ze,
|
|
2006
2006
|
metadata: J || {}
|
|
2007
2007
|
})
|
|
2008
2008
|
});
|
|
2009
2009
|
if (!D.ok) {
|
|
2010
|
-
const
|
|
2011
|
-
throw s.error("[AdMeshProvider]
|
|
2010
|
+
const we = await D.text();
|
|
2011
|
+
throw s.error("[AdMeshProvider] Delegation event failed", {
|
|
2012
2012
|
endpoint: N,
|
|
2013
2013
|
eventType: X,
|
|
2014
2014
|
status: D.status,
|
|
2015
|
-
errorBody:
|
|
2015
|
+
errorBody: we,
|
|
2016
2016
|
recommendationId: ie.recommendation_id,
|
|
2017
2017
|
delegationSessionId: ie.delegation_session_id
|
|
2018
|
-
}), new Error(`Delegation event failed (${D.status}): ${
|
|
2018
|
+
}), new Error(`Delegation event failed (${D.status}): ${we}`);
|
|
2019
2019
|
}
|
|
2020
2020
|
const ce = await D.json(), P = ce == null ? void 0 : ce.session;
|
|
2021
2021
|
s.log("[AdMeshProvider] ✅ Delegation event acknowledged", {
|
|
@@ -2027,9 +2027,9 @@ const fi = ({
|
|
|
2027
2027
|
}), P && A(P);
|
|
2028
2028
|
},
|
|
2029
2029
|
[S, t, g]
|
|
2030
|
-
),
|
|
2031
|
-
|
|
2032
|
-
}, []),
|
|
2030
|
+
), Pe = de(() => {
|
|
2031
|
+
H.current = 0;
|
|
2032
|
+
}, []), ke = de(
|
|
2033
2033
|
async (N = "user_stopped", X) => {
|
|
2034
2034
|
const J = S;
|
|
2035
2035
|
if (!J) {
|
|
@@ -2040,7 +2040,7 @@ const fi = ({
|
|
|
2040
2040
|
reason: N,
|
|
2041
2041
|
recommendationId: J.recommendation_id,
|
|
2042
2042
|
delegationSessionId: J.delegation_session_id
|
|
2043
|
-
}), await
|
|
2043
|
+
}), await be(
|
|
2044
2044
|
"/aip/delegation/stop",
|
|
2045
2045
|
"session_stopped",
|
|
2046
2046
|
{ reason: N, ...X || {} },
|
|
@@ -2059,23 +2059,23 @@ const fi = ({
|
|
|
2059
2059
|
}
|
|
2060
2060
|
}).catch((ne) => {
|
|
2061
2061
|
s.warn("[AdMeshProvider] ⚠️ Failed to track delegation_stopped event:", ne);
|
|
2062
|
-
})),
|
|
2062
|
+
})), H.current = 0, G.current = null, A(null), s.log("[AdMeshProvider] ✅ Delegation session cleared locally after stop");
|
|
2063
2063
|
},
|
|
2064
|
-
[S,
|
|
2064
|
+
[S, be, g]
|
|
2065
2065
|
), le = de(
|
|
2066
2066
|
async (N = "turn_completed", X) => {
|
|
2067
|
-
N === "turn_started" &&
|
|
2067
|
+
N === "turn_started" && Pe(), await be("/aip/delegation/activity", N, X);
|
|
2068
2068
|
},
|
|
2069
|
-
[
|
|
2069
|
+
[be, Pe]
|
|
2070
2070
|
);
|
|
2071
2071
|
Z(() => {
|
|
2072
2072
|
const N = (S == null ? void 0 : S.delegation_session_id) ?? null;
|
|
2073
|
-
N !==
|
|
2073
|
+
N !== G.current && (G.current = N, H.current = 0);
|
|
2074
2074
|
}, [S == null ? void 0 : S.delegation_session_id]), Z(() => {
|
|
2075
2075
|
if (!((S == null ? void 0 : S.delegation_session_id) ?? null) || !g)
|
|
2076
2076
|
return;
|
|
2077
2077
|
const X = re.current;
|
|
2078
|
-
if (!X || !
|
|
2078
|
+
if (!X || !pe(X)) {
|
|
2079
2079
|
A(
|
|
2080
2080
|
(ne) => ne ? {
|
|
2081
2081
|
...ne,
|
|
@@ -2086,21 +2086,21 @@ const fi = ({
|
|
|
2086
2086
|
}
|
|
2087
2087
|
const J = window.setInterval(() => {
|
|
2088
2088
|
const ne = re.current;
|
|
2089
|
-
if (!(!ne || !
|
|
2090
|
-
if (
|
|
2089
|
+
if (!(!ne || !pe(ne))) {
|
|
2090
|
+
if (H.current += 1, H.current >= Tr) {
|
|
2091
2091
|
s.log("[AdMeshProvider] ⏱️ Stopping delegation after idle heartbeats", {
|
|
2092
2092
|
delegationSessionId: ne.delegation_session_id,
|
|
2093
|
-
heartbeatsSinceLastUserTurn:
|
|
2093
|
+
heartbeatsSinceLastUserTurn: H.current,
|
|
2094
2094
|
idleHeartbeatLimit: Tr
|
|
2095
|
-
}),
|
|
2095
|
+
}), ke("idle_timeout", {
|
|
2096
2096
|
source: "heartbeat_idle",
|
|
2097
|
-
heartbeats_without_turn:
|
|
2097
|
+
heartbeats_without_turn: H.current
|
|
2098
2098
|
}).catch((ie) => {
|
|
2099
2099
|
s.warn("[AdMeshProvider] ⚠️ Failed to stop idle delegation session:", ie);
|
|
2100
2100
|
});
|
|
2101
2101
|
return;
|
|
2102
2102
|
}
|
|
2103
|
-
|
|
2103
|
+
be("/aip/delegation/heartbeat", "heartbeat").catch((ie) => {
|
|
2104
2104
|
s.warn("[AdMeshProvider] ⚠️ Failed to send delegation heartbeat:", ie);
|
|
2105
2105
|
});
|
|
2106
2106
|
}
|
|
@@ -2110,12 +2110,12 @@ const fi = ({
|
|
|
2110
2110
|
};
|
|
2111
2111
|
}, [
|
|
2112
2112
|
S == null ? void 0 : S.delegation_session_id,
|
|
2113
|
-
|
|
2114
|
-
|
|
2113
|
+
pe,
|
|
2114
|
+
be,
|
|
2115
2115
|
g,
|
|
2116
|
-
|
|
2116
|
+
ke
|
|
2117
2117
|
]);
|
|
2118
|
-
const
|
|
2118
|
+
const kt = {
|
|
2119
2119
|
sdk: g,
|
|
2120
2120
|
apiKey: t,
|
|
2121
2121
|
sessionId: e,
|
|
@@ -2154,13 +2154,13 @@ const fi = ({
|
|
|
2154
2154
|
setActiveDelegationSession: (N) => {
|
|
2155
2155
|
A(N);
|
|
2156
2156
|
},
|
|
2157
|
-
getActiveDelegationSession: () =>
|
|
2158
|
-
hasActiveDelegationSession: () =>
|
|
2157
|
+
getActiveDelegationSession: () => pe(S) ? S : null,
|
|
2158
|
+
hasActiveDelegationSession: () => pe(S),
|
|
2159
2159
|
refreshDelegationActivity: le,
|
|
2160
|
-
stopDelegationSession:
|
|
2160
|
+
stopDelegationSession: ke,
|
|
2161
2161
|
retryIntentAnalysis: Ce
|
|
2162
2162
|
};
|
|
2163
|
-
return /* @__PURE__ */ i(qr.Provider, { value:
|
|
2163
|
+
return /* @__PURE__ */ i(qr.Provider, { value: kt, children: u });
|
|
2164
2164
|
};
|
|
2165
2165
|
class gi {
|
|
2166
2166
|
constructor() {
|
|
@@ -2179,7 +2179,7 @@ class gi {
|
|
|
2179
2179
|
}
|
|
2180
2180
|
const o = document.getElementById(e.containerId);
|
|
2181
2181
|
if (!o)
|
|
2182
|
-
throw s.error("[AdMeshRenderer]
|
|
2182
|
+
throw s.error("[AdMeshRenderer] Container not found"), new Error(`Container with ID "${e.containerId}" not found`);
|
|
2183
2183
|
s.log("[AdMeshRenderer] ✅ Container ready");
|
|
2184
2184
|
const a = this.roots.get(e.containerId);
|
|
2185
2185
|
a && (s.log("[AdMeshRenderer] 🧹 Cleaning up existing root"), a.unmount(), this.roots.delete(e.containerId)), o.innerHTML = "";
|
|
@@ -2212,7 +2212,7 @@ class gi {
|
|
|
2212
2212
|
)
|
|
2213
2213
|
), o.style.display = "block", s.log("[AdMeshRenderer] ✅ Recommendations rendered successfully"), this.roots.set(e.containerId, l);
|
|
2214
2214
|
} catch (r) {
|
|
2215
|
-
throw s.error("[AdMeshRenderer]
|
|
2215
|
+
throw s.error("[AdMeshRenderer] Error rendering recommendations"), r;
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
2218
|
/**
|
|
@@ -2240,7 +2240,7 @@ const bi = (t) => {
|
|
|
2240
2240
|
return;
|
|
2241
2241
|
const e = t.trim().toUpperCase();
|
|
2242
2242
|
return /^[A-Z]{2}$/.test(e) ? e : void 0;
|
|
2243
|
-
},
|
|
2243
|
+
}, Dt = class Dt {
|
|
2244
2244
|
constructor(e) {
|
|
2245
2245
|
Ze(this, "config");
|
|
2246
2246
|
Ze(this, "apiBaseUrl");
|
|
@@ -2319,12 +2319,12 @@ const bi = (t) => {
|
|
|
2319
2319
|
static generateSessionIdFromUrl(e) {
|
|
2320
2320
|
const r = e || (typeof window < "u" ? window.location.href : "");
|
|
2321
2321
|
if (!r)
|
|
2322
|
-
return
|
|
2322
|
+
return Dt.createSession();
|
|
2323
2323
|
try {
|
|
2324
2324
|
const a = new URL(r).pathname.split("/").filter((c) => c.length > 0), l = a[a.length - 1];
|
|
2325
|
-
return l ? `session_${Date.now()}_${l}` :
|
|
2325
|
+
return l ? `session_${Date.now()}_${l}` : Dt.createSession();
|
|
2326
2326
|
} catch {
|
|
2327
|
-
return
|
|
2327
|
+
return Dt.createSession();
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
2330
|
/**
|
|
@@ -2470,14 +2470,14 @@ const bi = (t) => {
|
|
|
2470
2470
|
const r = `${this.apiBaseUrl}/aip/context`;
|
|
2471
2471
|
if (s.log("[AdMeshSDK] 📥 fetchPlatformResponse called"), !e.sessionId || e.sessionId.trim() === "") {
|
|
2472
2472
|
const U = new Error("sessionId is required and must be provided by the platform. The SDK never generates sessionId automatically.");
|
|
2473
|
-
throw s.error("[AdMeshSDK]
|
|
2473
|
+
throw s.error("[AdMeshSDK] sessionId not provided by platform - cannot process request"), U;
|
|
2474
2474
|
}
|
|
2475
2475
|
const o = e.messageId;
|
|
2476
2476
|
if (!o || o.trim() === "") {
|
|
2477
2477
|
const U = new Error("messageId is required and must be provided by the platform. The SDK never generates messageId automatically.");
|
|
2478
|
-
throw s.error("[AdMeshSDK]
|
|
2478
|
+
throw s.error("[AdMeshSDK] messageId not provided by platform - cannot process request"), U;
|
|
2479
2479
|
}
|
|
2480
|
-
const a =
|
|
2480
|
+
const a = Dt.buildPlatformResponseCacheKey(e.sessionId, o), l = Dt.inFlightPlatformResponses.get(a);
|
|
2481
2481
|
if (l)
|
|
2482
2482
|
return s.log("[AdMeshSDK] ⏳ Reusing in-flight PlatformResponse request", {
|
|
2483
2483
|
sessionId: e.sessionId,
|
|
@@ -2590,24 +2590,24 @@ const bi = (t) => {
|
|
|
2590
2590
|
body: M
|
|
2591
2591
|
});
|
|
2592
2592
|
if (!U.ok) {
|
|
2593
|
-
const
|
|
2594
|
-
throw new Error(`Failed to fetch recommendation from /aip/context: ${
|
|
2593
|
+
const H = (await U.json().catch(() => ({}))).detail || `HTTP ${U.status}`;
|
|
2594
|
+
throw new Error(`Failed to fetch recommendation from /aip/context: ${H}`);
|
|
2595
2595
|
}
|
|
2596
|
-
const
|
|
2596
|
+
const V = await U.json();
|
|
2597
2597
|
return s.log("[AdMeshSDK] 📥 Raw response from /aip/context:", {
|
|
2598
|
-
status:
|
|
2599
|
-
recommendationId:
|
|
2600
|
-
hasRecommendation: !!
|
|
2601
|
-
hasTracking: !!
|
|
2602
|
-
hasDelegation: !!
|
|
2603
|
-
topLevelKeys: Object.keys(
|
|
2604
|
-
}), s.log("[AdMeshSDK] 📦 Full PlatformResponse received from /aip/context",
|
|
2598
|
+
status: V.status,
|
|
2599
|
+
recommendationId: V.recommendation_id,
|
|
2600
|
+
hasRecommendation: !!V.recommendation,
|
|
2601
|
+
hasTracking: !!V.tracking,
|
|
2602
|
+
hasDelegation: !!V.delegation,
|
|
2603
|
+
topLevelKeys: Object.keys(V)
|
|
2604
|
+
}), s.log("[AdMeshSDK] 📦 Full PlatformResponse received from /aip/context", V), V;
|
|
2605
2605
|
})();
|
|
2606
|
-
|
|
2606
|
+
Dt.inFlightPlatformResponses.set(a, g);
|
|
2607
2607
|
try {
|
|
2608
2608
|
return await g;
|
|
2609
2609
|
} finally {
|
|
2610
|
-
|
|
2610
|
+
Dt.inFlightPlatformResponses.delete(a);
|
|
2611
2611
|
}
|
|
2612
2612
|
}
|
|
2613
2613
|
async trackPublisherAssistantEvent(e) {
|
|
@@ -2664,8 +2664,8 @@ const bi = (t) => {
|
|
|
2664
2664
|
return this.getTracker().fireFollowupEngagement(e, r, o);
|
|
2665
2665
|
}
|
|
2666
2666
|
};
|
|
2667
|
-
Ze(
|
|
2668
|
-
let Sn =
|
|
2667
|
+
Ze(Dt, "inFlightPlatformResponses", /* @__PURE__ */ new Map());
|
|
2668
|
+
let Sn = Dt;
|
|
2669
2669
|
class Kr {
|
|
2670
2670
|
constructor(e = {}) {
|
|
2671
2671
|
Ze(this, "autoAddLabels");
|
|
@@ -2864,7 +2864,7 @@ class Kr {
|
|
|
2864
2864
|
}
|
|
2865
2865
|
const r = e.parentNode;
|
|
2866
2866
|
if (!r) {
|
|
2867
|
-
s.error("[WeaveResponseProcessor]
|
|
2867
|
+
s.error("[WeaveResponseProcessor] Link has no parent node, cannot add label");
|
|
2868
2868
|
return;
|
|
2869
2869
|
}
|
|
2870
2870
|
this.removeLeftAdLabel(e);
|
|
@@ -2884,9 +2884,9 @@ class Kr {
|
|
|
2884
2884
|
document.addEventListener("click", l);
|
|
2885
2885
|
try {
|
|
2886
2886
|
const c = e.nextSibling;
|
|
2887
|
-
c ? (r.insertBefore(o, c), s.log("[WeaveResponseProcessor] ✅ Ad label inserted before next sibling")) : (r.appendChild(o), s.log("[WeaveResponseProcessor] ✅ Ad label appended to parent (no next sibling)")), o.isConnected && o.parentNode === r ? s.log("[WeaveResponseProcessor] ✅ Ad label successfully added to link:", e.href) : s.error("[WeaveResponseProcessor]
|
|
2887
|
+
c ? (r.insertBefore(o, c), s.log("[WeaveResponseProcessor] ✅ Ad label inserted before next sibling")) : (r.appendChild(o), s.log("[WeaveResponseProcessor] ✅ Ad label appended to parent (no next sibling)")), o.isConnected && o.parentNode === r ? s.log("[WeaveResponseProcessor] ✅ Ad label successfully added to link:", e.href) : s.error("[WeaveResponseProcessor] Ad label insertion failed - label not in DOM");
|
|
2888
2888
|
} catch (c) {
|
|
2889
|
-
s.error("[WeaveResponseProcessor]
|
|
2889
|
+
s.error("[WeaveResponseProcessor] Error inserting Ad label:", c);
|
|
2890
2890
|
}
|
|
2891
2891
|
}
|
|
2892
2892
|
/**
|
|
@@ -3092,7 +3092,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3092
3092
|
try {
|
|
3093
3093
|
y && w && (s.log("[AdMeshFollowup] 🎯 Firing follow-up engagement tracking"), await r.fireFollowupEngagement(y, w, o)), a && c ? (s.log(`[AdMeshFollowup] 🔍 Executing query: ${c}`), await a(c)) : s.warn("[AdMeshFollowup] ⚠️ onExecuteQuery not provided - cannot execute query");
|
|
3094
3094
|
} catch (p) {
|
|
3095
|
-
s.error("[AdMeshFollowup]
|
|
3095
|
+
s.error("[AdMeshFollowup] Error handling follow-up click:", p);
|
|
3096
3096
|
}
|
|
3097
3097
|
};
|
|
3098
3098
|
return /* @__PURE__ */ i(
|
|
@@ -3155,7 +3155,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3155
3155
|
onFollowupDetected: u,
|
|
3156
3156
|
isContainerReady: g
|
|
3157
3157
|
}) => {
|
|
3158
|
-
var J, ne, ie,
|
|
3158
|
+
var J, ne, ie, ze;
|
|
3159
3159
|
const {
|
|
3160
3160
|
sdk: h,
|
|
3161
3161
|
sessionId: p,
|
|
@@ -3171,57 +3171,57 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3171
3171
|
setRecommendationResult: $,
|
|
3172
3172
|
activeDelegationSession: C,
|
|
3173
3173
|
setActiveDelegationSession: U,
|
|
3174
|
-
hasActiveDelegationSession:
|
|
3175
|
-
} = bn(), Q = (D) => !!D && D.status === "generated" && !!D.recommendation,
|
|
3174
|
+
hasActiveDelegationSession: V
|
|
3175
|
+
} = bn(), Q = (D) => !!D && D.status === "generated" && !!D.recommendation, H = a || S, [G, re] = ae(null), [_e, te] = ae(null), [oe, Ae] = ae(!0), [Je, De] = ae(null), Ce = L(null), pe = L(!1), be = L(!1), Pe = L(t), ke = L(e);
|
|
3176
3176
|
Z(() => {
|
|
3177
|
-
|
|
3177
|
+
Pe.current = t, ke.current = e;
|
|
3178
3178
|
}, [t, e]), Z(() => {
|
|
3179
|
-
Ce.current !== r && (Ce.current = null,
|
|
3179
|
+
Ce.current !== r && (Ce.current = null, be.current = !1, re(null), te(null));
|
|
3180
3180
|
}, [r]);
|
|
3181
|
-
const le =
|
|
3181
|
+
const le = V() && (C == null ? void 0 : C.session_id) === p;
|
|
3182
3182
|
Z(() => {
|
|
3183
|
-
var P,
|
|
3183
|
+
var P, we, I;
|
|
3184
3184
|
if (!r || !z(r) || le)
|
|
3185
3185
|
return;
|
|
3186
3186
|
const D = B(r);
|
|
3187
3187
|
if (!D) {
|
|
3188
|
-
s.log("[AdMeshRecommendations] ♻️ Reusing stored no_match result from provider state"), re(null), te(null),
|
|
3188
|
+
s.log("[AdMeshRecommendations] ♻️ Reusing stored no_match result from provider state"), re(null), te(null), De(null), Ae(!1), Ce.current = r, pe.current = !1, be.current = !0;
|
|
3189
3189
|
return;
|
|
3190
3190
|
}
|
|
3191
3191
|
let ce = ((P = D.recommendation) == null ? void 0 : P.format) || "tail";
|
|
3192
3192
|
(ce === "weave" || ce === "product_card") && (ce = "tail"), s.log("[AdMeshRecommendations] ♻️ Reusing stored recommendation result from provider state", {
|
|
3193
3193
|
messageId: r,
|
|
3194
3194
|
recommendationId: D.recommendation_id,
|
|
3195
|
-
format: (
|
|
3196
|
-
}), re(D), te(ce),
|
|
3195
|
+
format: (we = D.recommendation) == null ? void 0 : we.format
|
|
3196
|
+
}), re(D), te(ce), De(null), Ae(!1), Ce.current = r, pe.current = !1, be.current = !0, (I = Pe.current) == null || I.call(Pe, r, D);
|
|
3197
3197
|
}, [B, z, le, r]), Z(() => {
|
|
3198
|
-
var D, ce, P,
|
|
3198
|
+
var D, ce, P, we, I, he, Me;
|
|
3199
3199
|
if (!(!l || !r) && !le)
|
|
3200
3200
|
try {
|
|
3201
|
-
const
|
|
3202
|
-
if (!Q(
|
|
3203
|
-
if (
|
|
3204
|
-
s.log("[AdMeshRecommendations] ℹ️ Initial recommendation returned no_match - rendering nothing"), re(null), te(null),
|
|
3201
|
+
const xe = l, qe = l.status || "unknown";
|
|
3202
|
+
if (!Q(xe)) {
|
|
3203
|
+
if (qe === "no_match") {
|
|
3204
|
+
s.log("[AdMeshRecommendations] ℹ️ Initial recommendation returned no_match - rendering nothing"), re(null), te(null), De(null), Ae(!1), Ce.current = r, pe.current = !1, be.current = !0, $(r, null);
|
|
3205
3205
|
return;
|
|
3206
3206
|
}
|
|
3207
|
-
throw new Error(`Initial recommendation is not a filled auction response (status=${
|
|
3207
|
+
throw new Error(`Initial recommendation is not a filled auction response (status=${qe})`);
|
|
3208
3208
|
}
|
|
3209
|
-
let
|
|
3210
|
-
(
|
|
3209
|
+
let We = ((D = xe.recommendation) == null ? void 0 : D.format) || "tail";
|
|
3210
|
+
(We === "weave" || We === "product_card") && (We = "tail"), re(xe), te(We), De(null), Ae(!1), Ce.current = r, pe.current = !1, be.current = !0, $(r, xe), (ce = Pe.current) == null || ce.call(Pe, r, xe), s.log("[AdMeshRecommendations] ♻️ Using initial recommendation payload, skipping /aip/context fetch"), s.log("[AdMeshRecommendations] ✅ Accepted initial generated recommendation payload", {
|
|
3211
3211
|
messageId: r,
|
|
3212
|
-
recommendationId:
|
|
3213
|
-
format: (P =
|
|
3214
|
-
brandName: (I = (
|
|
3215
|
-
headline: (Me = (
|
|
3216
|
-
hasTracking: !!
|
|
3212
|
+
recommendationId: xe.recommendation_id,
|
|
3213
|
+
format: (P = xe.recommendation) == null ? void 0 : P.format,
|
|
3214
|
+
brandName: (I = (we = xe.recommendation) == null ? void 0 : we.creative) == null ? void 0 : I.brand_name,
|
|
3215
|
+
headline: (Me = (he = xe.recommendation) == null ? void 0 : he.creative) == null ? void 0 : Me.headline,
|
|
3216
|
+
hasTracking: !!xe.tracking
|
|
3217
3217
|
});
|
|
3218
|
-
} catch (
|
|
3219
|
-
const
|
|
3220
|
-
|
|
3218
|
+
} catch (xe) {
|
|
3219
|
+
const qe = xe instanceof Error ? xe : new Error(String(xe));
|
|
3220
|
+
be.current = !1, s.warn(`[AdMeshRecommendations] ⚠️ Failed to reuse initial recommendation, will fall back to fetch: ${qe.message}`);
|
|
3221
3221
|
}
|
|
3222
3222
|
}, [le, l, r, $]), Z(() => {
|
|
3223
3223
|
if (!r || !o || o.trim() === "") {
|
|
3224
|
-
s.log("[AdMeshRecommendations]
|
|
3224
|
+
s.log("[AdMeshRecommendations] Validation failed - missing required parameters"), Ae(!1);
|
|
3225
3225
|
return;
|
|
3226
3226
|
}
|
|
3227
3227
|
if (le) {
|
|
@@ -3229,14 +3229,14 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3229
3229
|
messageId: r,
|
|
3230
3230
|
conversationSessionId: p,
|
|
3231
3231
|
delegationSessionId: C == null ? void 0 : C.delegation_session_id
|
|
3232
|
-
}), re(null), te(null),
|
|
3232
|
+
}), re(null), te(null), De(null), Ae(!1), pe.current = !1;
|
|
3233
3233
|
return;
|
|
3234
3234
|
}
|
|
3235
3235
|
if (!(h != null && h.fetchPlatformResponse)) {
|
|
3236
3236
|
s.log("[AdMeshRecommendations] SDK fetchPlatformResponse not available"), Ae(!1);
|
|
3237
3237
|
return;
|
|
3238
3238
|
}
|
|
3239
|
-
if (
|
|
3239
|
+
if (be.current) {
|
|
3240
3240
|
s.log("[AdMeshRecommendations] ⏭️ Initial recommendation provided, skipping duplicate fetch");
|
|
3241
3241
|
return;
|
|
3242
3242
|
}
|
|
@@ -3244,14 +3244,14 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3244
3244
|
s.log("[AdMeshRecommendations] ⏭️ Already fetched for this messageId, skipping duplicate fetch");
|
|
3245
3245
|
return;
|
|
3246
3246
|
}
|
|
3247
|
-
if (
|
|
3247
|
+
if (pe.current) {
|
|
3248
3248
|
s.log("[AdMeshRecommendations] ⏭️ Fetch already in progress, skipping duplicate fetch");
|
|
3249
3249
|
return;
|
|
3250
3250
|
}
|
|
3251
3251
|
s.log("[AdMeshRecommendations] 📤 Fetching recommendation from /aip/context (single fetch)"), (async () => {
|
|
3252
|
-
var ce, P,
|
|
3252
|
+
var ce, P, we, I, he, Me, xe, qe, We;
|
|
3253
3253
|
try {
|
|
3254
|
-
|
|
3254
|
+
pe.current = !0, Ae(!0), De(null);
|
|
3255
3255
|
const Ee = await h.fetchPlatformResponse({
|
|
3256
3256
|
query: o.trim(),
|
|
3257
3257
|
sessionId: p,
|
|
@@ -3259,14 +3259,14 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3259
3259
|
// REQUIRED: messageId is mandatory
|
|
3260
3260
|
language: R,
|
|
3261
3261
|
location: Y,
|
|
3262
|
-
userId:
|
|
3262
|
+
userId: H,
|
|
3263
3263
|
model: A,
|
|
3264
3264
|
...W && W.length > 0 && { messages: W }
|
|
3265
3265
|
// Optional: only pass if messages exist
|
|
3266
3266
|
}), Le = (Ee == null ? void 0 : Ee.status) || "unknown";
|
|
3267
3267
|
if (!Q(Ee)) {
|
|
3268
3268
|
if (Le === "no_match") {
|
|
3269
|
-
s.log("[AdMeshRecommendations] ℹ️ No recommendation returned from /aip/context"), re(null), te(null),
|
|
3269
|
+
s.log("[AdMeshRecommendations] ℹ️ No recommendation returned from /aip/context"), re(null), te(null), De(null), Ae(!1), pe.current = !1, Ce.current = r, $(r, null);
|
|
3270
3270
|
return;
|
|
3271
3271
|
}
|
|
3272
3272
|
throw new Error(`No filled recommendation returned from /aip/context (status=${Le})`);
|
|
@@ -3275,18 +3275,18 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3275
3275
|
messageId: r,
|
|
3276
3276
|
recommendationId: Ee.recommendation_id,
|
|
3277
3277
|
format: (ce = Ee.recommendation) == null ? void 0 : ce.format,
|
|
3278
|
-
brandName: (
|
|
3279
|
-
headline: (
|
|
3278
|
+
brandName: (we = (P = Ee.recommendation) == null ? void 0 : P.creative) == null ? void 0 : we.brand_name,
|
|
3279
|
+
headline: (he = (I = Ee.recommendation) == null ? void 0 : I.creative) == null ? void 0 : he.headline,
|
|
3280
3280
|
hasTracking: !!Ee.tracking
|
|
3281
3281
|
});
|
|
3282
3282
|
let Ie = ((Me = Ee.recommendation) == null ? void 0 : Me.format) || "tail";
|
|
3283
3283
|
(Ie === "weave" || Ie === "product_card") && (Ie = "tail"), te(Ie), Ce.current = r, $(r, Ee), s.log("[AdMeshRecommendations] 📊 Format detection:", {
|
|
3284
|
-
preferred_format: (
|
|
3284
|
+
preferred_format: (xe = Ee.recommendation) == null ? void 0 : xe.format,
|
|
3285
3285
|
selected_format: Ie
|
|
3286
|
-
}), Ae(!1),
|
|
3286
|
+
}), Ae(!1), pe.current = !1, (qe = Pe.current) == null || qe.call(Pe, r, Ee);
|
|
3287
3287
|
} catch (Ee) {
|
|
3288
3288
|
const Le = Ee instanceof Error ? Ee : new Error(String(Ee));
|
|
3289
|
-
Le.message.includes("Failed to fetch") || Le.message.includes("NetworkError") ? s.warn(`[AdMeshRecommendations] ⚠️ Network error fetching recommendations(non - critical): ${Le.message} `) : s.error(`[AdMeshRecommendations]
|
|
3289
|
+
Le.message.includes("Failed to fetch") || Le.message.includes("NetworkError") ? s.warn(`[AdMeshRecommendations] ⚠️ Network error fetching recommendations(non - critical): ${Le.message} `) : s.error(`[AdMeshRecommendations] Error fetching recommendations: ${Le.message} `), De(Le), Ae(!1), pe.current = !1, (We = ke.current) == null || We.call(ke, Le);
|
|
3290
3290
|
}
|
|
3291
3291
|
})();
|
|
3292
3292
|
}, [
|
|
@@ -3298,23 +3298,23 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3298
3298
|
o,
|
|
3299
3299
|
R,
|
|
3300
3300
|
Y,
|
|
3301
|
-
|
|
3301
|
+
H,
|
|
3302
3302
|
A,
|
|
3303
3303
|
l,
|
|
3304
3304
|
$
|
|
3305
3305
|
]), Z(() => {
|
|
3306
|
-
var ce, P,
|
|
3307
|
-
if (!
|
|
3306
|
+
var ce, P, we, I;
|
|
3307
|
+
if (!G || !u)
|
|
3308
3308
|
return;
|
|
3309
|
-
const D = (P = (ce =
|
|
3310
|
-
label:
|
|
3311
|
-
query:
|
|
3312
|
-
engagement_url:
|
|
3313
|
-
exposure_url:
|
|
3309
|
+
const D = (P = (ce = G.recommendation) == null ? void 0 : ce.creative) != null && P.follow_up_suggestion && ((we = G.tracking) != null && we.followup_engagement_url) && ((I = G.tracking) != null && I.followup_exposure_url) ? {
|
|
3310
|
+
label: G.recommendation.creative.follow_up_suggestion,
|
|
3311
|
+
query: G.recommendation.creative.follow_up_suggestion,
|
|
3312
|
+
engagement_url: G.tracking.followup_engagement_url,
|
|
3313
|
+
exposure_url: G.tracking.followup_exposure_url
|
|
3314
3314
|
} : null;
|
|
3315
|
-
D && u(D,
|
|
3316
|
-
}, [
|
|
3317
|
-
const
|
|
3315
|
+
D && u(D, G.recommendation_id);
|
|
3316
|
+
}, [G, u]);
|
|
3317
|
+
const kt = de(
|
|
3318
3318
|
async (D) => {
|
|
3319
3319
|
if (!h || !p)
|
|
3320
3320
|
throw new Error("AdMesh SDK activation requires an initialized session");
|
|
@@ -3332,10 +3332,10 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3332
3332
|
})
|
|
3333
3333
|
});
|
|
3334
3334
|
if (!ce.ok) {
|
|
3335
|
-
const
|
|
3336
|
-
throw new Error(`Failed to activate delegation session: ${ce.status} ${
|
|
3335
|
+
const he = await ce.text();
|
|
3336
|
+
throw new Error(`Failed to activate delegation session: ${ce.status} ${he}`);
|
|
3337
3337
|
}
|
|
3338
|
-
const P = await ce.json(),
|
|
3338
|
+
const P = await ce.json(), we = {
|
|
3339
3339
|
...D,
|
|
3340
3340
|
delegation_session_id: P.delegation_session_id || D.delegation_session_id,
|
|
3341
3341
|
session_id: P.session_id || p,
|
|
@@ -3398,22 +3398,22 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3398
3398
|
brand_agent_id: P.brand_agent_id,
|
|
3399
3399
|
source: "recommendation_card"
|
|
3400
3400
|
}
|
|
3401
|
-
}).catch((
|
|
3402
|
-
s.warn("[AdMeshRecommendations] ⚠️ Failed to track delegation_started event:",
|
|
3401
|
+
}).catch((he) => {
|
|
3402
|
+
s.warn("[AdMeshRecommendations] ⚠️ Failed to track delegation_started event:", he);
|
|
3403
3403
|
}), await h.reportDelegationSessionStarted(I, {
|
|
3404
3404
|
brand_agent_id: P.brand_agent_id,
|
|
3405
3405
|
brand_name: I.brand_name
|
|
3406
|
-
}).then((
|
|
3407
|
-
|
|
3408
|
-
}).catch((
|
|
3409
|
-
s.warn("[AdMeshRecommendations] ⚠️ Failed to report delegation session_started event:",
|
|
3406
|
+
}).then((he) => {
|
|
3407
|
+
he && U(he);
|
|
3408
|
+
}).catch((he) => {
|
|
3409
|
+
s.warn("[AdMeshRecommendations] ⚠️ Failed to report delegation session_started event:", he);
|
|
3410
3410
|
}), d) {
|
|
3411
3411
|
try {
|
|
3412
|
-
await d(
|
|
3413
|
-
} catch (
|
|
3412
|
+
await d(we);
|
|
3413
|
+
} catch (he) {
|
|
3414
3414
|
s.warn(
|
|
3415
3415
|
"[AdMeshRecommendations] ⚠️ Host onDelegationActivated callback failed after successful delegation activation:",
|
|
3416
|
-
|
|
3416
|
+
he
|
|
3417
3417
|
);
|
|
3418
3418
|
}
|
|
3419
3419
|
return;
|
|
@@ -3424,16 +3424,16 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3424
3424
|
...D.platform_response,
|
|
3425
3425
|
delegation: {
|
|
3426
3426
|
...D.platform_response.delegation,
|
|
3427
|
-
...
|
|
3427
|
+
...we,
|
|
3428
3428
|
delegation_session_id: P.delegation_session_id,
|
|
3429
3429
|
available: !0,
|
|
3430
3430
|
status: P.status || "active"
|
|
3431
3431
|
}
|
|
3432
3432
|
});
|
|
3433
|
-
} catch (
|
|
3433
|
+
} catch (he) {
|
|
3434
3434
|
s.warn(
|
|
3435
3435
|
"[AdMeshRecommendations] ⚠️ Host onStartDelegation callback failed after successful delegation activation:",
|
|
3436
|
-
|
|
3436
|
+
he
|
|
3437
3437
|
);
|
|
3438
3438
|
}
|
|
3439
3439
|
},
|
|
@@ -3462,41 +3462,41 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3462
3462
|
reason: D.reason,
|
|
3463
3463
|
source: "recommendation_card"
|
|
3464
3464
|
}
|
|
3465
|
-
}).catch((
|
|
3466
|
-
s.warn("[AdMeshRecommendations] ⚠️ Failed to report sponsored recommendation:",
|
|
3465
|
+
}).catch((we) => {
|
|
3466
|
+
s.warn("[AdMeshRecommendations] ⚠️ Failed to report sponsored recommendation:", we);
|
|
3467
3467
|
});
|
|
3468
3468
|
},
|
|
3469
3469
|
[r, v, h, p]
|
|
3470
3470
|
);
|
|
3471
3471
|
if (!r || !o || o.trim() === "" || oe || Je)
|
|
3472
3472
|
return null;
|
|
3473
|
-
if (!
|
|
3473
|
+
if (!G || !_e)
|
|
3474
3474
|
return s.log("[AdMeshRecommendations] 🚫 Nothing to render", {
|
|
3475
3475
|
messageId: r,
|
|
3476
|
-
hasPlatformResult: !!
|
|
3477
|
-
detectedFormat:
|
|
3476
|
+
hasPlatformResult: !!G,
|
|
3477
|
+
detectedFormat: _e,
|
|
3478
3478
|
isLoading: oe,
|
|
3479
3479
|
hasError: !!Je
|
|
3480
3480
|
}), null;
|
|
3481
3481
|
s.log("[AdMeshRecommendations] 🎨 Rendering recommendation component", {
|
|
3482
3482
|
messageId: r,
|
|
3483
|
-
recommendationId:
|
|
3484
|
-
detectedFormat:
|
|
3485
|
-
brandName: (ne = (J =
|
|
3486
|
-
headline: (
|
|
3483
|
+
recommendationId: G.recommendation_id,
|
|
3484
|
+
detectedFormat: _e,
|
|
3485
|
+
brandName: (ne = (J = G.recommendation) == null ? void 0 : J.creative) == null ? void 0 : ne.brand_name,
|
|
3486
|
+
headline: (ze = (ie = G.recommendation) == null ? void 0 : ie.creative) == null ? void 0 : ze.headline
|
|
3487
3487
|
});
|
|
3488
3488
|
const X = typeof document < "u" && y && (g ?? !0) ? document.getElementById(y) : null;
|
|
3489
3489
|
return /* @__PURE__ */ E(dt, { children: [
|
|
3490
3490
|
/* @__PURE__ */ i("div", { className: "admesh-recommendations-container", style: { marginTop: "1rem" }, children: /* @__PURE__ */ i(
|
|
3491
3491
|
jr,
|
|
3492
3492
|
{
|
|
3493
|
-
recommendations: [
|
|
3493
|
+
recommendations: [G],
|
|
3494
3494
|
theme: F,
|
|
3495
3495
|
sessionId: p,
|
|
3496
3496
|
triggerExposureUrl: c,
|
|
3497
3497
|
onPasteToInput: f,
|
|
3498
3498
|
onDelegationConsent: w,
|
|
3499
|
-
onDelegationActivated:
|
|
3499
|
+
onDelegationActivated: kt,
|
|
3500
3500
|
onStartDelegation: m,
|
|
3501
3501
|
onRecommendationReport: N
|
|
3502
3502
|
}
|
|
@@ -3505,7 +3505,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3505
3505
|
/* @__PURE__ */ i(
|
|
3506
3506
|
yi,
|
|
3507
3507
|
{
|
|
3508
|
-
recommendation:
|
|
3508
|
+
recommendation: G,
|
|
3509
3509
|
theme: F,
|
|
3510
3510
|
sdk: h,
|
|
3511
3511
|
sessionId: p,
|
|
@@ -3536,7 +3536,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3536
3536
|
return;
|
|
3537
3537
|
}
|
|
3538
3538
|
if (s.log("[WeaveFallbackRecommendations] ✅ fallback is TRUE, proceeding with recommendations"), !r || !o || o.trim() === "") {
|
|
3539
|
-
s.log("[WeaveFallbackRecommendations]
|
|
3539
|
+
s.log("[WeaveFallbackRecommendations] Validation failed - returning early");
|
|
3540
3540
|
return;
|
|
3541
3541
|
}
|
|
3542
3542
|
if (s.log("[WeaveFallbackRecommendations] ✅ Validation passed"), !c || !h) {
|
|
@@ -3571,21 +3571,21 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3571
3571
|
});
|
|
3572
3572
|
return;
|
|
3573
3573
|
}
|
|
3574
|
-
const C = c, U = C.getRenderer,
|
|
3575
|
-
if (U &&
|
|
3576
|
-
const
|
|
3574
|
+
const C = c, U = C.getRenderer, V = C.getTracker, Q = (B = C.config) == null ? void 0 : B.theme;
|
|
3575
|
+
if (U && V) {
|
|
3576
|
+
const H = {
|
|
3577
3577
|
sessionId: y,
|
|
3578
3578
|
messageId: r,
|
|
3579
3579
|
recommendations: [$]
|
|
3580
|
-
},
|
|
3581
|
-
await
|
|
3580
|
+
}, G = U.call(c), re = V.call(c), _e = (c == null ? void 0 : c.apiBaseUrl) || typeof window < "u" && window.__ADMESH_API_BASE_URL__ || "https://api.useadmesh.com";
|
|
3581
|
+
await G.render({
|
|
3582
3582
|
containerId: h,
|
|
3583
|
-
response:
|
|
3583
|
+
response: H,
|
|
3584
3584
|
theme: f || Q,
|
|
3585
3585
|
tracker: re,
|
|
3586
3586
|
sessionId: y,
|
|
3587
3587
|
apiKey: w || ((z = c == null ? void 0 : c.config) == null ? void 0 : z.apiKey),
|
|
3588
|
-
apiBaseUrl:
|
|
3588
|
+
apiBaseUrl: _e,
|
|
3589
3589
|
language: d,
|
|
3590
3590
|
location: m,
|
|
3591
3591
|
userId: v,
|
|
@@ -3601,7 +3601,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3601
3601
|
});
|
|
3602
3602
|
} catch ($) {
|
|
3603
3603
|
const C = $ instanceof Error ? $ : new Error(String($));
|
|
3604
|
-
s.error(`[WeaveFallbackRecommendations]
|
|
3604
|
+
s.error(`[WeaveFallbackRecommendations] Error rendering previous recommendations: ${C.message}`);
|
|
3605
3605
|
try {
|
|
3606
3606
|
await c.showRecommendations({
|
|
3607
3607
|
query: o.trim(),
|
|
@@ -3628,7 +3628,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3628
3628
|
}), s.log("[WeaveFallbackRecommendations] ✅ Recommendations displayed successfully");
|
|
3629
3629
|
} catch (Y) {
|
|
3630
3630
|
const S = Y instanceof Error ? Y : new Error(String(Y));
|
|
3631
|
-
s.log(`[WeaveFallbackRecommendations]
|
|
3631
|
+
s.log(`[WeaveFallbackRecommendations] Error: ${S.message}`), e == null || e(S);
|
|
3632
3632
|
}
|
|
3633
3633
|
})());
|
|
3634
3634
|
}, [c, y, h, t, r, o, a, e, l, f]), !a || !r || !o || o.trim() === "" ? null : /* @__PURE__ */ i(
|
|
@@ -3650,7 +3650,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3650
3650
|
} catch {
|
|
3651
3651
|
return !1;
|
|
3652
3652
|
}
|
|
3653
|
-
}, Rr = (t) => t && t.trim() ? t.trim() : "", Vt = (t) => typeof t == "string" ? t.trim() : typeof t == "number" ? String(t) : "",
|
|
3653
|
+
}, Rr = (t) => t && t.trim() ? t.trim() : "", Vt = (t) => typeof t == "string" ? t.trim() : typeof t == "number" ? String(t) : "", _t = (t) => Vt(t) || void 0, _i = (t, e) => {
|
|
3654
3654
|
const r = t.split(/\s+/).filter(Boolean);
|
|
3655
3655
|
return r.length <= e ? t : `${r.slice(0, e).join(" ")}...`;
|
|
3656
3656
|
}, vi = (t, e) => {
|
|
@@ -3686,7 +3686,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3686
3686
|
}
|
|
3687
3687
|
const a = Vt(t);
|
|
3688
3688
|
return a ? /%|off/i.test(a) ? a : o === "amount" || o === "fixed" || o === "fixed_amount" ? `${a} off` : `${a}% off` : "";
|
|
3689
|
-
},
|
|
3689
|
+
}, ve = {
|
|
3690
3690
|
surface: "#ffffff",
|
|
3691
3691
|
surfaceMuted: "#f9fafb",
|
|
3692
3692
|
surfaceSubtle: "#f8fafc",
|
|
@@ -3712,10 +3712,10 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3712
3712
|
onStartDelegation: f,
|
|
3713
3713
|
onPasteToInput: w
|
|
3714
3714
|
}) => {
|
|
3715
|
-
var I,
|
|
3715
|
+
var I, he, Me, xe, qe, We, Ee, Le, Ie, St, ct, Pt, Fe, Ye, ye, mt, zt, $t, q, ut, At, jt, Kt, O, Te, et, gt, Nt, Lt, Gt, Ft, Ct, tt;
|
|
3716
3716
|
if (!t || t.length === 0)
|
|
3717
3717
|
return s.log("[AdMesh Tail Ad] No recommendations provided - not rendering"), null;
|
|
3718
|
-
const d = t[0], m = ((I = d == null ? void 0 : d.recommendation) == null ? void 0 : I.offerId) || "", v = ((
|
|
3718
|
+
const d = t[0], m = ((I = d == null ? void 0 : d.recommendation) == null ? void 0 : I.offerId) || "", v = ((he = d == null ? void 0 : d.tracking) == null ? void 0 : he.exposure_url) || "", M = (d == null ? void 0 : d.recommendation_id) || "", u = ((xe = (Me = d == null ? void 0 : d.recommendation) == null ? void 0 : Me.creative) == null ? void 0 : xe.description) || "", g = ((qe = d == null ? void 0 : d.recommendation) == null ? void 0 : qe.disclosure) || "Sponsored", h = ((Ee = (We = d == null ? void 0 : d.recommendation) == null ? void 0 : We.creative) == null ? void 0 : Ee.brand_name) || "", p = ((Ie = (Le = d == null ? void 0 : d.recommendation) == null ? void 0 : Le.creative) == null ? void 0 : Ie.headline) || ((ct = (St = d == null ? void 0 : d.recommendation) == null ? void 0 : St.creative) == null ? void 0 : ct.brand_name) || "", k = ((Fe = (Pt = d == null ? void 0 : d.recommendation) == null ? void 0 : Pt.creative) == null ? void 0 : Fe.logo_url) || "", R = ((Ye = d == null ? void 0 : d.tracking) == null ? void 0 : Ye.click_url) || ((mt = (ye = d == null ? void 0 : d.recommendation) == null ? void 0 : ye.creative) == null ? void 0 : mt.landing_page_url) || "", Y = Rr(($t = (zt = d == null ? void 0 : d.recommendation) == null ? void 0 : zt.creative) == null ? void 0 : $t.cta_text), S = ((ut = (q = d == null ? void 0 : d.recommendation) == null ? void 0 : q.creative) == null ? void 0 : ut.products) || [], A = S.length > 1, W = A ? S.slice(0, 4) : [], F = ((At = d == null ? void 0 : d.recommendation) == null ? void 0 : At.format) || "tail", B = F === "bridge", z = ((jt = d == null ? void 0 : d.delegation) == null ? void 0 : jt.brand_name) || h, $ = ((Kt = d == null ? void 0 : d.delegation) == null ? void 0 : Kt.available) === !0, C = B && $, U = "Talk to Agent", V = !A && !!Y && !!R;
|
|
3719
3719
|
if (!h && !p && !u)
|
|
3720
3720
|
return s.log("[AdMesh Tail Ad] No valid recommendation data provided - not rendering", {
|
|
3721
3721
|
reason: "brand, headline, and description are missing",
|
|
@@ -3724,15 +3724,15 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3724
3724
|
recommendationId: M,
|
|
3725
3725
|
recommendationKeys: d ? Object.keys(d) : []
|
|
3726
3726
|
}), null;
|
|
3727
|
-
let Q = h,
|
|
3728
|
-
p && p !== h && (
|
|
3727
|
+
let Q = h, H = "";
|
|
3728
|
+
p && p !== h && (H = p), H && (Q = `${h} — ${H}`), s.debug("[AdMeshTailAd] 📊 Rendering with tracking data:", {
|
|
3729
3729
|
recommendationId: M,
|
|
3730
3730
|
productId: m,
|
|
3731
3731
|
exposureUrl: v ? "present" : "MISSING",
|
|
3732
3732
|
sessionId: a ? "present" : "MISSING",
|
|
3733
3733
|
recommendationsCount: t.length,
|
|
3734
3734
|
clickUrl: R || "MISSING",
|
|
3735
|
-
clickUrlSource: (
|
|
3735
|
+
clickUrlSource: (O = d == null ? void 0 : d.tracking) != null && O.click_url ? "tracking.click_url" : (et = (Te = d == null ? void 0 : d.recommendation) == null ? void 0 : Te.creative) != null && et.landing_page_url ? "recommendation.creative.landing_page_url" : "none",
|
|
3736
3736
|
shortDescription: u ? "present" : "MISSING",
|
|
3737
3737
|
brandName: h,
|
|
3738
3738
|
productName: p,
|
|
@@ -3747,38 +3747,38 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3747
3747
|
hasLogoUrl: !!k,
|
|
3748
3748
|
recommendationFormat: F
|
|
3749
3749
|
});
|
|
3750
|
-
const
|
|
3751
|
-
|
|
3750
|
+
const G = (K, Be) => {
|
|
3751
|
+
Be && Be.stopPropagation(), s.log(`AdMesh tail ad ${K} clicked`), typeof window < "u" && window.admeshTracker && window.admeshTracker.trackClick({
|
|
3752
3752
|
recommendationId: M,
|
|
3753
3753
|
productId: m,
|
|
3754
3754
|
clickUrl: R,
|
|
3755
|
-
source:
|
|
3755
|
+
source: K
|
|
3756
3756
|
}).catch(() => {
|
|
3757
|
-
s.error(`[AdMesh] Failed to track ${
|
|
3757
|
+
s.error(`[AdMesh] Failed to track ${K} click`);
|
|
3758
3758
|
});
|
|
3759
|
-
}, re = (
|
|
3760
|
-
|
|
3761
|
-
},
|
|
3762
|
-
|
|
3763
|
-
}, te = (
|
|
3764
|
-
|
|
3759
|
+
}, re = (K) => {
|
|
3760
|
+
K.stopPropagation(), G("tail_ad_brand_name");
|
|
3761
|
+
}, _e = (K) => {
|
|
3762
|
+
K.stopPropagation(), G("tail_ad_cta");
|
|
3763
|
+
}, te = (K) => {
|
|
3764
|
+
K.stopPropagation(), G("tail_ad_logo");
|
|
3765
3765
|
}, oe = () => {
|
|
3766
|
-
A || !R || (
|
|
3767
|
-
}, Ae = (
|
|
3768
|
-
A || !R || (
|
|
3769
|
-
}, [Je,
|
|
3766
|
+
A || !R || (G("tail_ad_card"), typeof window < "u" && window.open(R, "_blank", "noopener,noreferrer"));
|
|
3767
|
+
}, Ae = (K) => {
|
|
3768
|
+
A || !R || (K.key === "Enter" || K.key === " ") && (K.preventDefault(), oe());
|
|
3769
|
+
}, [Je, De] = ae(!1), [Ce, pe] = ae(!1), be = L(null);
|
|
3770
3770
|
Z(() => () => {
|
|
3771
|
-
|
|
3771
|
+
be.current && (be.current(!1), be.current = null);
|
|
3772
3772
|
}, []);
|
|
3773
|
-
const
|
|
3774
|
-
var
|
|
3775
|
-
|
|
3776
|
-
},
|
|
3777
|
-
|
|
3773
|
+
const Pe = (K) => {
|
|
3774
|
+
var Be;
|
|
3775
|
+
K && pe(!0), (Be = be.current) == null || Be.call(be, K), be.current = null, K || (pe(!1), De(!1));
|
|
3776
|
+
}, ke = async () => c ? await c(d) : await new Promise((K) => {
|
|
3777
|
+
be.current = K, De(!0);
|
|
3778
3778
|
}), le = async () => {
|
|
3779
3779
|
if (M && a)
|
|
3780
3780
|
try {
|
|
3781
|
-
const
|
|
3781
|
+
const K = typeof window < "u" && window.__ADMESH_API_BASE_URL__ || "https://api.useadmesh.com", Be = await fetch(`${K}/click/bridge-engagement`, {
|
|
3782
3782
|
method: "POST",
|
|
3783
3783
|
headers: {
|
|
3784
3784
|
"Content-Type": "application/json"
|
|
@@ -3789,50 +3789,50 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3789
3789
|
is_test: !1
|
|
3790
3790
|
})
|
|
3791
3791
|
});
|
|
3792
|
-
|
|
3793
|
-
} catch (
|
|
3794
|
-
s.error("[AdMesh Tail Ad] Error tracking delegation engagement:",
|
|
3792
|
+
Be.ok || s.warn("[AdMesh Tail Ad] Delegation engagement tracking failed:", Be.statusText);
|
|
3793
|
+
} catch (K) {
|
|
3794
|
+
s.error("[AdMesh Tail Ad] Error tracking delegation engagement:", K);
|
|
3795
3795
|
}
|
|
3796
|
-
},
|
|
3797
|
-
var
|
|
3798
|
-
if (
|
|
3796
|
+
}, kt = async (K) => {
|
|
3797
|
+
var Et, Wt, Yt, It;
|
|
3798
|
+
if (K.preventDefault(), K.stopPropagation(), !d || !C)
|
|
3799
3799
|
return;
|
|
3800
|
-
if (
|
|
3800
|
+
if (G("tail_ad_delegation_cta"), !await ke()) {
|
|
3801
3801
|
s.log("[AdMesh Tail Ad] Delegation consent declined");
|
|
3802
3802
|
return;
|
|
3803
3803
|
}
|
|
3804
3804
|
le();
|
|
3805
|
-
const me = d.delegation,
|
|
3805
|
+
const me = d.delegation, Mt = me != null && me.available ? {
|
|
3806
3806
|
recommendation_id: d.recommendation_id,
|
|
3807
|
-
brand_id:
|
|
3808
|
-
brand_name:
|
|
3809
|
-
me.brand_name || ((
|
|
3807
|
+
brand_id: _t(me.brand_id),
|
|
3808
|
+
brand_name: _t(
|
|
3809
|
+
me.brand_name || ((Wt = (Et = d.recommendation) == null ? void 0 : Et.creative) == null ? void 0 : Wt.brand_name)
|
|
3810
3810
|
),
|
|
3811
|
-
mcp_endpoint:
|
|
3812
|
-
eligibility_reason:
|
|
3813
|
-
delegate_reason:
|
|
3814
|
-
session_goal:
|
|
3811
|
+
mcp_endpoint: _t(me.mcp_endpoint),
|
|
3812
|
+
eligibility_reason: _t(me.eligibility_reason),
|
|
3813
|
+
delegate_reason: _t(me.delegate_reason),
|
|
3814
|
+
session_goal: _t(me.session_goal),
|
|
3815
3815
|
desired_outcome_type: me.desired_outcome_type,
|
|
3816
3816
|
required_user_inputs: Array.isArray(me.required_user_inputs) ? me.required_user_inputs.filter((bt) => typeof bt == "string") : [],
|
|
3817
3817
|
required_consent_types: Array.isArray(me.required_consent_types) ? me.required_consent_types.filter((bt) => typeof bt == "string") : [],
|
|
3818
|
-
success_outcome:
|
|
3819
|
-
fallback_message:
|
|
3820
|
-
session_mode:
|
|
3821
|
-
status:
|
|
3818
|
+
success_outcome: _t(me.success_outcome),
|
|
3819
|
+
fallback_message: _t(me.fallback_message),
|
|
3820
|
+
session_mode: _t(me.session_mode),
|
|
3821
|
+
status: _t(me.status),
|
|
3822
3822
|
capabilities: me.capabilities || [],
|
|
3823
3823
|
allowed_data_types: me.allowed_data_types || [],
|
|
3824
3824
|
consent_requirements: me.consent_requirements || [],
|
|
3825
|
-
auth_model:
|
|
3825
|
+
auth_model: _t(me.auth_model),
|
|
3826
3826
|
handoff_protocol: me.handoff_protocol && typeof me.handoff_protocol == "object" ? me.handoff_protocol : void 0,
|
|
3827
3827
|
supported_actions: me.supported_actions || [],
|
|
3828
3828
|
metadata: me.metadata && typeof me.metadata == "object" ? me.metadata : void 0,
|
|
3829
3829
|
platform_response: d
|
|
3830
3830
|
} : null;
|
|
3831
|
-
if (y &&
|
|
3831
|
+
if (y && Mt) {
|
|
3832
3832
|
try {
|
|
3833
|
-
await y(
|
|
3833
|
+
await y(Mt);
|
|
3834
3834
|
} finally {
|
|
3835
|
-
|
|
3835
|
+
pe(!1), De(!1);
|
|
3836
3836
|
}
|
|
3837
3837
|
return;
|
|
3838
3838
|
}
|
|
@@ -3840,21 +3840,21 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3840
3840
|
try {
|
|
3841
3841
|
await f(d);
|
|
3842
3842
|
} finally {
|
|
3843
|
-
|
|
3843
|
+
pe(!1), De(!1);
|
|
3844
3844
|
}
|
|
3845
3845
|
return;
|
|
3846
3846
|
}
|
|
3847
|
-
const st = ((
|
|
3847
|
+
const st = ((It = (Yt = d.recommendation) == null ? void 0 : Yt.creative) == null ? void 0 : It.follow_up_suggestion) || "";
|
|
3848
3848
|
if (st && w) {
|
|
3849
|
-
w(st),
|
|
3849
|
+
w(st), pe(!1), De(!1);
|
|
3850
3850
|
return;
|
|
3851
3851
|
}
|
|
3852
3852
|
if (st && typeof window < "u" && window.__admesh_setMessage) {
|
|
3853
|
-
window.__admesh_setMessage(st),
|
|
3853
|
+
window.__admesh_setMessage(st), pe(!1), De(!1);
|
|
3854
3854
|
return;
|
|
3855
3855
|
}
|
|
3856
|
-
|
|
3857
|
-
}, [N, X] = ae(!1), J = h ? h.charAt(0).toUpperCase() : "B", ne =
|
|
3856
|
+
pe(!1), De(!1);
|
|
3857
|
+
}, [N, X] = ae(!1), J = h ? h.charAt(0).toUpperCase() : "B", ne = ve.surface, ie = ve.border, ze = (e == null ? void 0 : e.borderRadius) || ((Nt = (gt = e == null ? void 0 : e.components) == null ? void 0 : gt.card) == null ? void 0 : Nt.borderRadius) || "8px", D = "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)", ce = "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)", P = ((Lt = e == null ? void 0 : e.shadows) == null ? void 0 : Lt.medium) || ((Ft = (Gt = e == null ? void 0 : e.components) == null ? void 0 : Gt.card) == null ? void 0 : Ft.boxShadow) || D, we = ((Ct = e == null ? void 0 : e.shadows) == null ? void 0 : Ct.large) || ce;
|
|
3858
3858
|
return /* @__PURE__ */ E(
|
|
3859
3859
|
An,
|
|
3860
3860
|
{
|
|
@@ -3892,22 +3892,22 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3892
3892
|
style: {
|
|
3893
3893
|
...(tt = e == null ? void 0 : e.components) == null ? void 0 : tt.card,
|
|
3894
3894
|
backgroundColor: ne,
|
|
3895
|
-
borderRadius:
|
|
3895
|
+
borderRadius: ze,
|
|
3896
3896
|
padding: "16px",
|
|
3897
3897
|
boxShadow: P,
|
|
3898
3898
|
border: `1px solid ${ie}`,
|
|
3899
|
-
color:
|
|
3899
|
+
color: ve.text,
|
|
3900
3900
|
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
3901
3901
|
transform: "translateY(0)",
|
|
3902
3902
|
cursor: !A && R ? "pointer" : void 0
|
|
3903
3903
|
},
|
|
3904
3904
|
onClick: oe,
|
|
3905
3905
|
onKeyDown: Ae,
|
|
3906
|
-
onMouseEnter: (
|
|
3907
|
-
|
|
3906
|
+
onMouseEnter: (K) => {
|
|
3907
|
+
K.currentTarget.style.boxShadow = we, K.currentTarget.style.transform = "translateY(-2px)";
|
|
3908
3908
|
},
|
|
3909
|
-
onMouseLeave: (
|
|
3910
|
-
|
|
3909
|
+
onMouseLeave: (K) => {
|
|
3910
|
+
K.currentTarget.style.boxShadow = P, K.currentTarget.style.transform = "translateY(0)";
|
|
3911
3911
|
},
|
|
3912
3912
|
children: [
|
|
3913
3913
|
k && /* @__PURE__ */ i(
|
|
@@ -3964,8 +3964,8 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3964
3964
|
aspectRatio: "1",
|
|
3965
3965
|
borderRadius: "8px",
|
|
3966
3966
|
minHeight: "48px",
|
|
3967
|
-
backgroundColor:
|
|
3968
|
-
color:
|
|
3967
|
+
backgroundColor: ve.logoFallbackBg,
|
|
3968
|
+
color: ve.logoFallbackText,
|
|
3969
3969
|
fontSize: "18px"
|
|
3970
3970
|
},
|
|
3971
3971
|
children: J
|
|
@@ -3983,7 +3983,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3983
3983
|
// Allow flex item to shrink below content size
|
|
3984
3984
|
},
|
|
3985
3985
|
children: [
|
|
3986
|
-
Q && !A && /* @__PURE__ */ i("div", { className: "mb-2", children: /* @__PURE__ */ i("h3", { className: "font-semibold text-base", style: { fontSize: "14px", lineHeight: 1.35, color:
|
|
3986
|
+
Q && !A && /* @__PURE__ */ i("div", { className: "mb-2", children: /* @__PURE__ */ i("h3", { className: "font-semibold text-base", style: { fontSize: "14px", lineHeight: 1.35, color: ve.text }, children: R && h ? /* @__PURE__ */ E(dt, { children: [
|
|
3987
3987
|
/* @__PURE__ */ i(
|
|
3988
3988
|
"a",
|
|
3989
3989
|
{
|
|
@@ -3992,18 +3992,18 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
3992
3992
|
rel: "noopener noreferrer",
|
|
3993
3993
|
className: "underline transition-colors duration-200 font-semibold",
|
|
3994
3994
|
style: {
|
|
3995
|
-
color:
|
|
3995
|
+
color: ve.link,
|
|
3996
3996
|
textDecoration: "underline",
|
|
3997
|
-
textDecorationColor:
|
|
3997
|
+
textDecorationColor: ve.link,
|
|
3998
3998
|
textUnderlineOffset: "2px"
|
|
3999
3999
|
},
|
|
4000
4000
|
onClick: re,
|
|
4001
4001
|
children: h
|
|
4002
4002
|
}
|
|
4003
4003
|
),
|
|
4004
|
-
|
|
4004
|
+
H && ` — ${H}`
|
|
4005
4005
|
] }) : Q }) }),
|
|
4006
|
-
u && !A && /* @__PURE__ */ i("p", { className: "text-sm mb-3 leading-relaxed", style: { fontSize: "13px", lineHeight: 1.45, color:
|
|
4006
|
+
u && !A && /* @__PURE__ */ i("p", { className: "text-sm mb-3 leading-relaxed", style: { fontSize: "13px", lineHeight: 1.45, color: ve.textSecondary }, children: u }),
|
|
4007
4007
|
A && W.length > 0 && /* @__PURE__ */ i("div", { className: "mb-3", children: /* @__PURE__ */ i(
|
|
4008
4008
|
"div",
|
|
4009
4009
|
{
|
|
@@ -4028,38 +4028,38 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4028
4028
|
scrollSnapType: "x proximity",
|
|
4029
4029
|
paddingRight: 0
|
|
4030
4030
|
},
|
|
4031
|
-
children: W.map((
|
|
4032
|
-
const
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
),
|
|
4031
|
+
children: W.map((K) => {
|
|
4032
|
+
const Be = Vt(K.product_name) || "Product", me = Vt(K.product_link) || Vt(K.product_url) || R || "#", Mt = _i(Vt(K.product_description), 10), st = vi(K.product_price, K.product_currency), Et = ki(
|
|
4033
|
+
K.product_discount,
|
|
4034
|
+
K.product_discount_type,
|
|
4035
|
+
K.product_currency
|
|
4036
|
+
), Wt = Vt(K.product_image_url), Yt = k && Wn(k) ? k : "", It = Wt && Wn(Wt) ? Wt : Yt, bt = Rr(K.product_cta_label), rn = me !== "#";
|
|
4037
4037
|
return /* @__PURE__ */ i(
|
|
4038
4038
|
"a",
|
|
4039
4039
|
{
|
|
4040
4040
|
href: me,
|
|
4041
4041
|
target: rn ? "_blank" : void 0,
|
|
4042
4042
|
rel: rn ? "noopener noreferrer" : void 0,
|
|
4043
|
-
onClick: (Cn) =>
|
|
4043
|
+
onClick: (Cn) => G(`tail_ad_product_${K.product_id || "item"}`, Cn),
|
|
4044
4044
|
className: "block",
|
|
4045
4045
|
style: {
|
|
4046
4046
|
border: `1px solid ${ie}`,
|
|
4047
4047
|
borderRadius: "8px",
|
|
4048
4048
|
padding: "10px",
|
|
4049
|
-
backgroundColor:
|
|
4049
|
+
backgroundColor: ve.surfaceMuted,
|
|
4050
4050
|
textDecoration: "none",
|
|
4051
|
-
color:
|
|
4051
|
+
color: ve.text,
|
|
4052
4052
|
minWidth: "min(264px, 82vw)",
|
|
4053
4053
|
width: "clamp(220px, 72vw, 312px)",
|
|
4054
4054
|
flex: "0 0 clamp(220px, 72vw, 312px)",
|
|
4055
4055
|
scrollSnapAlign: "start"
|
|
4056
4056
|
},
|
|
4057
4057
|
children: /* @__PURE__ */ E("div", { className: "flex items-start gap-2", children: [
|
|
4058
|
-
|
|
4058
|
+
It ? /* @__PURE__ */ i(
|
|
4059
4059
|
"img",
|
|
4060
4060
|
{
|
|
4061
|
-
src:
|
|
4062
|
-
alt:
|
|
4061
|
+
src: It,
|
|
4062
|
+
alt: Be,
|
|
4063
4063
|
style: {
|
|
4064
4064
|
width: "44px",
|
|
4065
4065
|
height: "44px",
|
|
@@ -4077,11 +4077,11 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4077
4077
|
height: "44px",
|
|
4078
4078
|
borderRadius: "6px",
|
|
4079
4079
|
flexShrink: 0,
|
|
4080
|
-
backgroundColor:
|
|
4081
|
-
color:
|
|
4080
|
+
backgroundColor: ve.productImageFallbackBg,
|
|
4081
|
+
color: ve.textSecondary,
|
|
4082
4082
|
fontSize: "12px"
|
|
4083
4083
|
},
|
|
4084
|
-
children:
|
|
4084
|
+
children: Be.charAt(0).toUpperCase()
|
|
4085
4085
|
}
|
|
4086
4086
|
),
|
|
4087
4087
|
/* @__PURE__ */ E("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
@@ -4092,26 +4092,26 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4092
4092
|
style: {
|
|
4093
4093
|
fontSize: "13px",
|
|
4094
4094
|
lineHeight: 1.3,
|
|
4095
|
-
color:
|
|
4095
|
+
color: ve.text,
|
|
4096
4096
|
marginBottom: "4px"
|
|
4097
4097
|
},
|
|
4098
|
-
children:
|
|
4098
|
+
children: Be
|
|
4099
4099
|
}
|
|
4100
4100
|
),
|
|
4101
|
-
|
|
4101
|
+
Mt && /* @__PURE__ */ i(
|
|
4102
4102
|
"p",
|
|
4103
4103
|
{
|
|
4104
4104
|
className: "text-xs",
|
|
4105
4105
|
style: {
|
|
4106
4106
|
fontSize: "12px",
|
|
4107
4107
|
lineHeight: 1.3,
|
|
4108
|
-
color:
|
|
4108
|
+
color: ve.textSecondary,
|
|
4109
4109
|
marginBottom: "6px"
|
|
4110
4110
|
},
|
|
4111
|
-
children:
|
|
4111
|
+
children: Mt
|
|
4112
4112
|
}
|
|
4113
4113
|
),
|
|
4114
|
-
(st ||
|
|
4114
|
+
(st || Et) && /* @__PURE__ */ E(
|
|
4115
4115
|
"div",
|
|
4116
4116
|
{
|
|
4117
4117
|
className: "flex items-center gap-2 flex-wrap",
|
|
@@ -4125,7 +4125,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4125
4125
|
{
|
|
4126
4126
|
style: {
|
|
4127
4127
|
fontSize: "10px",
|
|
4128
|
-
color:
|
|
4128
|
+
color: ve.textMuted,
|
|
4129
4129
|
textTransform: "uppercase",
|
|
4130
4130
|
letterSpacing: "0.04em"
|
|
4131
4131
|
},
|
|
@@ -4138,25 +4138,25 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4138
4138
|
className: "font-semibold",
|
|
4139
4139
|
style: {
|
|
4140
4140
|
fontSize: "13px",
|
|
4141
|
-
color:
|
|
4141
|
+
color: ve.text
|
|
4142
4142
|
},
|
|
4143
4143
|
children: st
|
|
4144
4144
|
}
|
|
4145
4145
|
)
|
|
4146
4146
|
] }),
|
|
4147
|
-
|
|
4147
|
+
Et && /* @__PURE__ */ i(
|
|
4148
4148
|
"span",
|
|
4149
4149
|
{
|
|
4150
4150
|
className: "text-xs",
|
|
4151
4151
|
style: {
|
|
4152
4152
|
fontSize: "11px",
|
|
4153
|
-
color:
|
|
4154
|
-
backgroundColor:
|
|
4153
|
+
color: ve.successText,
|
|
4154
|
+
backgroundColor: ve.successBg,
|
|
4155
4155
|
borderRadius: "999px",
|
|
4156
4156
|
padding: "2px 8px",
|
|
4157
4157
|
fontWeight: 600
|
|
4158
4158
|
},
|
|
4159
|
-
children:
|
|
4159
|
+
children: Et
|
|
4160
4160
|
}
|
|
4161
4161
|
)
|
|
4162
4162
|
]
|
|
@@ -4168,7 +4168,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4168
4168
|
className: "font-medium",
|
|
4169
4169
|
style: {
|
|
4170
4170
|
fontSize: "12px",
|
|
4171
|
-
color:
|
|
4171
|
+
color: ve.link,
|
|
4172
4172
|
textDecoration: "underline",
|
|
4173
4173
|
textUnderlineOffset: "2px"
|
|
4174
4174
|
},
|
|
@@ -4178,7 +4178,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4178
4178
|
] })
|
|
4179
4179
|
] })
|
|
4180
4180
|
},
|
|
4181
|
-
|
|
4181
|
+
K.product_id || `${M}-${Be}`
|
|
4182
4182
|
);
|
|
4183
4183
|
})
|
|
4184
4184
|
}
|
|
@@ -4193,7 +4193,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4193
4193
|
className: "text-sm",
|
|
4194
4194
|
style: {
|
|
4195
4195
|
fontSize: "13px",
|
|
4196
|
-
color:
|
|
4196
|
+
color: ve.textSecondary,
|
|
4197
4197
|
fontWeight: 400
|
|
4198
4198
|
},
|
|
4199
4199
|
children: h
|
|
@@ -4203,12 +4203,12 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4203
4203
|
"button",
|
|
4204
4204
|
{
|
|
4205
4205
|
type: "button",
|
|
4206
|
-
onClick:
|
|
4206
|
+
onClick: kt,
|
|
4207
4207
|
className: "underline transition-colors duration-200 font-medium text-sm",
|
|
4208
4208
|
style: {
|
|
4209
|
-
color:
|
|
4209
|
+
color: ve.link,
|
|
4210
4210
|
textDecoration: "underline",
|
|
4211
|
-
textDecorationColor:
|
|
4211
|
+
textDecorationColor: ve.link,
|
|
4212
4212
|
textUnderlineOffset: "2px",
|
|
4213
4213
|
fontSize: "13px",
|
|
4214
4214
|
background: "none",
|
|
@@ -4219,7 +4219,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4219
4219
|
children: U
|
|
4220
4220
|
}
|
|
4221
4221
|
) : null,
|
|
4222
|
-
|
|
4222
|
+
V && /* @__PURE__ */ i(
|
|
4223
4223
|
"a",
|
|
4224
4224
|
{
|
|
4225
4225
|
href: R,
|
|
@@ -4227,13 +4227,13 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4227
4227
|
rel: "noopener noreferrer",
|
|
4228
4228
|
className: "underline transition-colors duration-200 font-medium text-sm",
|
|
4229
4229
|
style: {
|
|
4230
|
-
color:
|
|
4230
|
+
color: ve.link,
|
|
4231
4231
|
textDecoration: "underline",
|
|
4232
|
-
textDecorationColor:
|
|
4232
|
+
textDecorationColor: ve.link,
|
|
4233
4233
|
textUnderlineOffset: "2px",
|
|
4234
4234
|
fontSize: "13px"
|
|
4235
4235
|
},
|
|
4236
|
-
onClick:
|
|
4236
|
+
onClick: _e,
|
|
4237
4237
|
children: Y
|
|
4238
4238
|
}
|
|
4239
4239
|
),
|
|
@@ -4241,7 +4241,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4241
4241
|
"span",
|
|
4242
4242
|
{
|
|
4243
4243
|
className: "text-xs",
|
|
4244
|
-
style: { fontSize: "11px", color:
|
|
4244
|
+
style: { fontSize: "11px", color: ve.textMuted },
|
|
4245
4245
|
children: [
|
|
4246
4246
|
"+",
|
|
4247
4247
|
S.length - W.length,
|
|
@@ -4250,7 +4250,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4250
4250
|
}
|
|
4251
4251
|
)
|
|
4252
4252
|
] }),
|
|
4253
|
-
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ i("p", { className: "text-xs", style: { fontSize: "11px", color:
|
|
4253
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ i("p", { className: "text-xs", style: { fontSize: "11px", color: ve.textMuted }, children: g }) })
|
|
4254
4254
|
] }),
|
|
4255
4255
|
Je ? /* @__PURE__ */ E(
|
|
4256
4256
|
"div",
|
|
@@ -4259,7 +4259,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4259
4259
|
marginTop: "10px",
|
|
4260
4260
|
border: `1px solid ${ie}`,
|
|
4261
4261
|
borderRadius: "12px",
|
|
4262
|
-
backgroundColor:
|
|
4262
|
+
backgroundColor: ve.surfaceSubtle,
|
|
4263
4263
|
padding: "12px",
|
|
4264
4264
|
display: "flex",
|
|
4265
4265
|
flexDirection: "column",
|
|
@@ -4275,7 +4275,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4275
4275
|
fontWeight: 700,
|
|
4276
4276
|
letterSpacing: "0.06em",
|
|
4277
4277
|
textTransform: "uppercase",
|
|
4278
|
-
color:
|
|
4278
|
+
color: ve.link
|
|
4279
4279
|
},
|
|
4280
4280
|
children: "Confirm Agent Access"
|
|
4281
4281
|
}
|
|
@@ -4286,7 +4286,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4286
4286
|
style: {
|
|
4287
4287
|
fontSize: "14px",
|
|
4288
4288
|
lineHeight: 1.4,
|
|
4289
|
-
color:
|
|
4289
|
+
color: ve.text,
|
|
4290
4290
|
fontWeight: 600
|
|
4291
4291
|
},
|
|
4292
4292
|
children: [
|
|
@@ -4302,7 +4302,7 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4302
4302
|
style: {
|
|
4303
4303
|
fontSize: "12px",
|
|
4304
4304
|
lineHeight: 1.45,
|
|
4305
|
-
color:
|
|
4305
|
+
color: ve.textSecondary
|
|
4306
4306
|
},
|
|
4307
4307
|
children: "The agent will only use the details you choose to share for this request."
|
|
4308
4308
|
}
|
|
@@ -4314,14 +4314,14 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4314
4314
|
{
|
|
4315
4315
|
type: "button",
|
|
4316
4316
|
disabled: Ce,
|
|
4317
|
-
onClick: (
|
|
4318
|
-
|
|
4317
|
+
onClick: (K) => {
|
|
4318
|
+
K.preventDefault(), K.stopPropagation(), !Ce && Pe(!1);
|
|
4319
4319
|
},
|
|
4320
4320
|
style: {
|
|
4321
4321
|
borderRadius: "10px",
|
|
4322
4322
|
border: `1px solid ${ie}`,
|
|
4323
4323
|
background: ne,
|
|
4324
|
-
color:
|
|
4324
|
+
color: ve.text,
|
|
4325
4325
|
fontSize: "12px",
|
|
4326
4326
|
fontWeight: 600,
|
|
4327
4327
|
padding: "8px 12px",
|
|
@@ -4336,8 +4336,8 @@ const xi = ({ className: t, size: e = 20 }) => /* @__PURE__ */ E(
|
|
|
4336
4336
|
{
|
|
4337
4337
|
type: "button",
|
|
4338
4338
|
disabled: Ce,
|
|
4339
|
-
onClick: (
|
|
4340
|
-
|
|
4339
|
+
onClick: (K) => {
|
|
4340
|
+
K.preventDefault(), K.stopPropagation(), !Ce && Pe(!0);
|
|
4341
4341
|
},
|
|
4342
4342
|
style: {
|
|
4343
4343
|
borderRadius: "10px",
|
|
@@ -4547,34 +4547,34 @@ function Di({
|
|
|
4547
4547
|
}) {
|
|
4548
4548
|
const R = yo(), Y = L(null), S = L(null), A = L(null), [W, F] = ae({ visibility: "hidden" }), B = y && !w && (d || l.length > 0);
|
|
4549
4549
|
Vn(() => {
|
|
4550
|
-
var
|
|
4550
|
+
var V;
|
|
4551
4551
|
if (!B) return;
|
|
4552
4552
|
const C = () => {
|
|
4553
4553
|
var oe, Ae;
|
|
4554
4554
|
const Q = (oe = Y.current) == null ? void 0 : oe.getBoundingClientRect();
|
|
4555
4555
|
if (!Q) return;
|
|
4556
|
-
const
|
|
4556
|
+
const H = ((Ae = window.visualViewport) == null ? void 0 : Ae.height) ?? window.innerHeight, G = document.documentElement.clientWidth, re = H - Q.bottom - 16, _e = Q.top - 16, te = M === "above" ? !(_e < 96 && re > _e) : re < 96 && _e > re;
|
|
4557
4557
|
F({
|
|
4558
4558
|
position: "fixed",
|
|
4559
|
-
left: Math.max(8, Math.min(Q.left,
|
|
4560
|
-
width: Math.min(Q.width,
|
|
4561
|
-
maxHeight: Math.max(40, Math.min(300, te ?
|
|
4559
|
+
left: Math.max(8, Math.min(Q.left, G - Q.width - 8)),
|
|
4560
|
+
width: Math.min(Q.width, G - 16),
|
|
4561
|
+
maxHeight: Math.max(40, Math.min(300, te ? _e : re)),
|
|
4562
4562
|
...te ? { bottom: window.innerHeight - Q.top + 8 } : { top: Q.bottom + 8 },
|
|
4563
4563
|
zIndex: 2147483002
|
|
4564
4564
|
});
|
|
4565
4565
|
}, U = (Q) => {
|
|
4566
|
-
var
|
|
4567
|
-
const
|
|
4568
|
-
!((
|
|
4566
|
+
var G, re;
|
|
4567
|
+
const H = Q.target;
|
|
4568
|
+
!((G = Y.current) != null && G.contains(H)) && !((re = A.current) != null && re.contains(H)) && f(!1);
|
|
4569
4569
|
};
|
|
4570
|
-
return C(), window.addEventListener("resize", C), window.addEventListener("scroll", C, !0), (
|
|
4570
|
+
return C(), window.addEventListener("resize", C), window.addEventListener("scroll", C, !0), (V = window.visualViewport) == null || V.addEventListener("resize", C), document.addEventListener("pointerdown", U), () => {
|
|
4571
4571
|
var Q;
|
|
4572
4572
|
window.removeEventListener("resize", C), window.removeEventListener("scroll", C, !0), (Q = window.visualViewport) == null || Q.removeEventListener("resize", C), document.removeEventListener("pointerdown", U);
|
|
4573
4573
|
};
|
|
4574
4574
|
}, [B, M, f]);
|
|
4575
4575
|
const z = (C) => {
|
|
4576
|
-
var U,
|
|
4577
|
-
!((U = Y.current) != null && U.contains(C)) && !((
|
|
4576
|
+
var U, V;
|
|
4577
|
+
!((U = Y.current) != null && U.contains(C)) && !((V = A.current) != null && V.contains(C)) && f(!1);
|
|
4578
4578
|
}, $ = () => {
|
|
4579
4579
|
!t.trim() || w || (f(!1), r());
|
|
4580
4580
|
};
|
|
@@ -4619,8 +4619,8 @@ function Di({
|
|
|
4619
4619
|
e(C.target.value), f(!0);
|
|
4620
4620
|
},
|
|
4621
4621
|
onKeyDown: (C) => {
|
|
4622
|
-
var U,
|
|
4623
|
-
C.nativeEvent.isComposing || (C.key === "Escape" && (C.preventDefault(), f(!1)), C.key === "ArrowDown" && (C.preventDefault(), B ? (
|
|
4622
|
+
var U, V;
|
|
4623
|
+
C.nativeEvent.isComposing || (C.key === "Escape" && (C.preventDefault(), f(!1)), C.key === "ArrowDown" && (C.preventDefault(), B ? (V = (U = A.current) == null ? void 0 : U.querySelector("button")) == null || V.focus() : f(!0)), C.key === "Enter" && (C.preventDefault(), $()));
|
|
4624
4624
|
},
|
|
4625
4625
|
style: { flex: 1, minWidth: 0, border: "none", outline: "none", padding: m ? "6px 0" : "10px 0", fontSize: m ? 13 : 15, color: k.text, background: "transparent" }
|
|
4626
4626
|
}
|
|
@@ -4676,11 +4676,11 @@ function Di({
|
|
|
4676
4676
|
className: "admesh-publisher-panel",
|
|
4677
4677
|
onBlur: (C) => z(C.relatedTarget),
|
|
4678
4678
|
onKeyDown: (C) => {
|
|
4679
|
-
var U,
|
|
4679
|
+
var U, V, Q, H;
|
|
4680
4680
|
if (C.key === "Escape" && (C.preventDefault(), (U = S.current) == null || U.focus(), f(!1)), C.key === "ArrowDown" || C.key === "ArrowUp") {
|
|
4681
4681
|
C.preventDefault();
|
|
4682
|
-
const
|
|
4683
|
-
re < 0 ? (Q = S.current) == null || Q.focus() : (
|
|
4682
|
+
const G = Array.from(((V = A.current) == null ? void 0 : V.querySelectorAll("button")) ?? []), re = G.indexOf(document.activeElement) + (C.key === "ArrowDown" ? 1 : -1);
|
|
4683
|
+
re < 0 ? (Q = S.current) == null || Q.focus() : (H = G[Math.min(re, G.length - 1)]) == null || H.focus();
|
|
4684
4684
|
}
|
|
4685
4685
|
},
|
|
4686
4686
|
style: {
|
|
@@ -6193,40 +6193,40 @@ const Oi = {
|
|
|
6193
6193
|
welcomeMessage: $ = "Hi, I’m Ava. I’ll help you find the best options.",
|
|
6194
6194
|
placeholder: C = "Ask me anything about products...",
|
|
6195
6195
|
adsEnabled: U = !0,
|
|
6196
|
-
suggestions:
|
|
6196
|
+
suggestions: V,
|
|
6197
6197
|
// Renamed to avoid conflict
|
|
6198
6198
|
maxSuggestions: Q = 6,
|
|
6199
|
-
suggestionStyle:
|
|
6200
|
-
suggestionTrigger:
|
|
6199
|
+
suggestionStyle: H = "carousel",
|
|
6200
|
+
suggestionTrigger: G = "always",
|
|
6201
6201
|
suggestionPlacement: re = "below",
|
|
6202
|
-
sponsoredCreativePlacement:
|
|
6202
|
+
sponsoredCreativePlacement: _e = "none",
|
|
6203
6203
|
onlyShowWhenSponsored: te = !1,
|
|
6204
6204
|
// New prop to only show modal when sponsored suggestions are available
|
|
6205
6205
|
variant: oe = "default",
|
|
6206
6206
|
queryHandler: Ae,
|
|
6207
6207
|
suggestionsLoader: Je,
|
|
6208
|
-
disclaimerText:
|
|
6208
|
+
disclaimerText: De,
|
|
6209
6209
|
poweredByLabel: Ce = "Powered by AdMesh",
|
|
6210
|
-
subtitle:
|
|
6211
|
-
onOpen:
|
|
6212
|
-
onClose:
|
|
6210
|
+
subtitle: pe = "Publisher Assistant",
|
|
6211
|
+
onOpen: be,
|
|
6212
|
+
onClose: Pe
|
|
6213
6213
|
}) => {
|
|
6214
|
-
const { sdk:
|
|
6214
|
+
const { sdk: ke, sessionId: le, theme: kt, apiKey: N, userId: X } = bn(), {
|
|
6215
6215
|
suggestions: J,
|
|
6216
6216
|
isAnalyzingIntent: ne,
|
|
6217
6217
|
intentError: ie,
|
|
6218
|
-
retryIntentAnalysis:
|
|
6218
|
+
retryIntentAnalysis: ze,
|
|
6219
6219
|
activeDelegationSession: D,
|
|
6220
6220
|
hasActiveDelegationSession: ce,
|
|
6221
6221
|
stopDelegationSession: P,
|
|
6222
|
-
refreshDelegationActivity:
|
|
6222
|
+
refreshDelegationActivity: we
|
|
6223
6223
|
} = Or();
|
|
6224
6224
|
Li(), console.log("[AdMeshIntentAssistant] Context:", {
|
|
6225
|
-
sdk:
|
|
6225
|
+
sdk: ke,
|
|
6226
6226
|
sessionId: le,
|
|
6227
|
-
hasContextTheme: !!
|
|
6227
|
+
hasContextTheme: !!kt
|
|
6228
6228
|
});
|
|
6229
|
-
const I = t ||
|
|
6229
|
+
const I = t || kt || Oi, he = (I == null ? void 0 : I.mode) || "light", Me = d === "ad-slot", xe = (n = !1) => Me && !(n && m === "expand"), [qe, We] = ae(A || B), Ee = W !== void 0, Le = Ee ? W : qe, [Ie, St] = ae(""), [ct, Pt] = ae(!1), [Fe, Ye] = ae([]), [ye, mt] = ae(!1), [zt, $t] = ae(null), [q, ut] = ae(!1), [At, jt] = ae(/* @__PURE__ */ new Set()), [Kt, O] = ae(V || J || []), [Te, et] = ae(0), [gt, Nt] = ae(0), [Lt, Gt] = ae({}), Ft = L(null), Ct = L(!1), tt = L(null), K = L(/* @__PURE__ */ new Map()), Be = L([]), me = L(null), Mt = L(null), st = L(null), Et = L(!1), Wt = L(!1), Yt = L(null), It = L(null), bt = L(null), [rn, Cn] = ae(!1), [Mn, Xr] = ae(!1), Tt = L(null), nt = L(null), Jr = !!(N != null && N.toLowerCase().startsWith("pub_")), rt = ce() && (D == null ? void 0 : D.session_id) === le ? D : null, En = L(/* @__PURE__ */ new Set()), Jn = L(/* @__PURE__ */ new Set()), Zn = L(!1), on = Me && m === "expand" && (q || ye), [xn, Zr] = ae(!1);
|
|
6230
6230
|
Z(() => {
|
|
6231
6231
|
if (typeof window > "u") return;
|
|
6232
6232
|
const n = window.matchMedia("(max-width: 767px)"), b = () => Zr(n.matches);
|
|
@@ -6238,13 +6238,13 @@ const Oi = {
|
|
|
6238
6238
|
document.body.style.overflow = n;
|
|
6239
6239
|
};
|
|
6240
6240
|
}, [on]);
|
|
6241
|
-
const In = Me && m === "sticky" && (
|
|
6242
|
-
b ?
|
|
6241
|
+
const In = Me && m === "sticky" && (q || Fe.length > 0 || ye), Bt = gn(h) ?? "100%", an = gn(p) ?? "100%", eo = zr(h), er = zr(p), tr = Me && (er ?? Number.POSITIVE_INFINITY) <= 60, pt = Me && (eo ?? Number.POSITIVE_INFINITY) <= 360 && (er ?? Number.POSITIVE_INFINITY) <= 120, dn = de((n) => (b) => {
|
|
6242
|
+
b ? K.current.set(n, b) : K.current.delete(n);
|
|
6243
6243
|
}, []), Ne = de(
|
|
6244
6244
|
async (n, b = {}) => {
|
|
6245
|
-
if (!(!
|
|
6245
|
+
if (!(!ke || !le))
|
|
6246
6246
|
try {
|
|
6247
|
-
await
|
|
6247
|
+
await ke.trackPublisherAssistantEvent({
|
|
6248
6248
|
event_name: n,
|
|
6249
6249
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6250
6250
|
session_id: le,
|
|
@@ -6255,10 +6255,10 @@ const Oi = {
|
|
|
6255
6255
|
console.warn(`[AdMeshIntentAssistant] Failed to track ${n}`, x);
|
|
6256
6256
|
}
|
|
6257
6257
|
},
|
|
6258
|
-
[k,
|
|
6258
|
+
[k, ke, le]
|
|
6259
6259
|
), cn = de(
|
|
6260
6260
|
(n, b, x) => {
|
|
6261
|
-
var
|
|
6261
|
+
var j, ue;
|
|
6262
6262
|
const _ = b == null ? void 0 : b.recommendation_id;
|
|
6263
6263
|
if (!_)
|
|
6264
6264
|
return;
|
|
@@ -6267,23 +6267,23 @@ const Oi = {
|
|
|
6267
6267
|
message_id: n,
|
|
6268
6268
|
query: x,
|
|
6269
6269
|
recommendation_id: _,
|
|
6270
|
-
brand_name: (
|
|
6270
|
+
brand_name: (ue = (j = b.recommendation) == null ? void 0 : j.creative) == null ? void 0 : ue.brand_name,
|
|
6271
6271
|
is_sponsored: !0
|
|
6272
6272
|
}));
|
|
6273
6273
|
},
|
|
6274
6274
|
[Ne]
|
|
6275
6275
|
), Tn = de(
|
|
6276
|
-
(n, b, x, _, T,
|
|
6277
|
-
const
|
|
6278
|
-
const
|
|
6279
|
-
return
|
|
6280
|
-
id: `followup_llm_${Re}_${
|
|
6281
|
-
text:
|
|
6282
|
-
type:
|
|
6276
|
+
(n, b, x, _, T, j) => {
|
|
6277
|
+
const ue = Array.isArray(j) && j.length ? j.map((fe, Re) => {
|
|
6278
|
+
const He = nn(fe.text || "");
|
|
6279
|
+
return He ? {
|
|
6280
|
+
id: `followup_llm_${Re}_${He.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`,
|
|
6281
|
+
text: He,
|
|
6282
|
+
type: fe.type || "information",
|
|
6283
6283
|
is_sponsored: !1
|
|
6284
6284
|
} : null;
|
|
6285
|
-
}).filter((
|
|
6286
|
-
|
|
6285
|
+
}).filter((fe) => !!fe).slice(0, 3) : Hi(n, b, x, _), $e = qi(T), Ke = $e ? [$e, ...ue.slice(0, 2)] : ue.slice(0, 3);
|
|
6286
|
+
Ke.length && O(qn(Ke));
|
|
6287
6287
|
},
|
|
6288
6288
|
[]
|
|
6289
6289
|
), mn = de(
|
|
@@ -6311,14 +6311,14 @@ const Oi = {
|
|
|
6311
6311
|
}
|
|
6312
6312
|
}
|
|
6313
6313
|
};
|
|
6314
|
-
|
|
6315
|
-
const
|
|
6316
|
-
return qn([_, ...
|
|
6314
|
+
O((T) => {
|
|
6315
|
+
const j = T.filter((ue) => !ue.is_sponsored).slice(0, 3);
|
|
6316
|
+
return qn([_, ...j].slice(0, 4));
|
|
6317
6317
|
});
|
|
6318
6318
|
},
|
|
6319
6319
|
[]
|
|
6320
6320
|
), nr = de(() => {
|
|
6321
|
-
const n = me.current, b =
|
|
6321
|
+
const n = me.current, b = Mt.current;
|
|
6322
6322
|
if (!n || !b) return !1;
|
|
6323
6323
|
const x = n.getBoundingClientRect(), _ = b.getBoundingClientRect(), T = Math.max(
|
|
6324
6324
|
0,
|
|
@@ -6328,57 +6328,57 @@ const Oi = {
|
|
|
6328
6328
|
}, []);
|
|
6329
6329
|
Vn(() => {
|
|
6330
6330
|
var n;
|
|
6331
|
-
if (
|
|
6332
|
-
nr() && (
|
|
6331
|
+
if (Et.current) {
|
|
6332
|
+
nr() && (Et.current = !1);
|
|
6333
6333
|
return;
|
|
6334
6334
|
}
|
|
6335
|
-
|
|
6335
|
+
Wt.current || (n = It.current) == null || n.scrollIntoView({ behavior: "smooth" });
|
|
6336
6336
|
}, [Fe, nr]), Vn(() => {
|
|
6337
6337
|
if (!Me || on) return;
|
|
6338
6338
|
const n = Yt.current;
|
|
6339
6339
|
if (!n) return;
|
|
6340
6340
|
const b = n.closest(".admesh-publisher-assistant-reactMount"), x = an;
|
|
6341
6341
|
[n, b].forEach((T) => {
|
|
6342
|
-
T && (T.style.width =
|
|
6342
|
+
T && (T.style.width = Bt, T.style.maxWidth = Bt, T.style.height = x, T.style.maxHeight = x, T.style.overflow = "hidden", T.style.boxSizing = "border-box", T.dataset.admeshAdSlotExpanded = In ? "true" : "false");
|
|
6343
6343
|
});
|
|
6344
6344
|
const _ = b == null ? void 0 : b.parentElement;
|
|
6345
|
-
_ && _ !== document.body && _ !== document.documentElement && (_.style.width =
|
|
6346
|
-
}, [an,
|
|
6347
|
-
if (
|
|
6348
|
-
V
|
|
6345
|
+
_ && _ !== document.body && _ !== document.documentElement && (_.style.width = Bt, _.style.maxWidth = Bt, _.style.height = x, _.style.maxHeight = x, _.style.overflow = "hidden", _.style.boxSizing = "border-box");
|
|
6346
|
+
}, [an, Bt, on, Me, In]), Z(() => {
|
|
6347
|
+
if (V && V.length) {
|
|
6348
|
+
O(V);
|
|
6349
6349
|
return;
|
|
6350
6350
|
}
|
|
6351
|
-
J && J.length &&
|
|
6351
|
+
J && J.length && O(
|
|
6352
6352
|
(n) => Ui(n, J)
|
|
6353
6353
|
);
|
|
6354
|
-
}, [
|
|
6354
|
+
}, [V, J]), Z(() => {
|
|
6355
6355
|
if (oe !== "default" || !Je) return;
|
|
6356
6356
|
let n = !1;
|
|
6357
6357
|
return Je().then((b) => {
|
|
6358
|
-
!n && Array.isArray(b) && b.length &&
|
|
6358
|
+
!n && Array.isArray(b) && b.length && O(b);
|
|
6359
6359
|
}).catch((b) => {
|
|
6360
6360
|
console.warn("[AdMeshIntentAssistant] Failed to load suggestions", b);
|
|
6361
6361
|
}), () => {
|
|
6362
6362
|
n = !0;
|
|
6363
6363
|
};
|
|
6364
6364
|
}, [Je, oe]), Z(() => {
|
|
6365
|
-
if (!
|
|
6366
|
-
|
|
6365
|
+
if (!ye) {
|
|
6366
|
+
Nt(0), Ft.current = null;
|
|
6367
6367
|
return;
|
|
6368
6368
|
}
|
|
6369
|
-
|
|
6369
|
+
Ft.current == null && (Ft.current = typeof performance < "u" ? performance.now() : Date.now());
|
|
6370
6370
|
const n = () => {
|
|
6371
|
-
const x =
|
|
6371
|
+
const x = Ft.current;
|
|
6372
6372
|
if (x == null)
|
|
6373
6373
|
return;
|
|
6374
6374
|
const _ = typeof performance < "u" ? performance.now() : Date.now();
|
|
6375
|
-
|
|
6375
|
+
Nt(Math.floor((_ - x) / 1e3));
|
|
6376
6376
|
};
|
|
6377
6377
|
n();
|
|
6378
6378
|
const b = window.setInterval(n, 1e3);
|
|
6379
6379
|
return () => window.clearInterval(b);
|
|
6380
|
-
}, [
|
|
6381
|
-
if (!
|
|
6380
|
+
}, [ye]), Z(() => {
|
|
6381
|
+
if (!ye || oe !== "default") {
|
|
6382
6382
|
et(0);
|
|
6383
6383
|
return;
|
|
6384
6384
|
}
|
|
@@ -6386,8 +6386,8 @@ const Oi = {
|
|
|
6386
6386
|
et((b) => Math.min(b + 1, 7));
|
|
6387
6387
|
}, 3e3);
|
|
6388
6388
|
return () => window.clearInterval(n);
|
|
6389
|
-
}, [
|
|
6390
|
-
Zn.current || !
|
|
6389
|
+
}, [ye, oe]), Z(() => {
|
|
6390
|
+
Zn.current || !ke || !le || (Zn.current = !0, Ne("assistant_loaded", {
|
|
6391
6391
|
metadata: {
|
|
6392
6392
|
layout: w,
|
|
6393
6393
|
surface: d,
|
|
@@ -6395,39 +6395,39 @@ const Oi = {
|
|
|
6395
6395
|
default_open: A || B
|
|
6396
6396
|
}
|
|
6397
6397
|
}));
|
|
6398
|
-
}, [B, A, w,
|
|
6398
|
+
}, [B, A, w, ke, le, d, Ne, oe]);
|
|
6399
6399
|
const qt = de((n) => {
|
|
6400
|
-
Ee ? F == null || F(n) :
|
|
6400
|
+
Ee ? F == null || F(n) : We(n), n ? (Ne("assistant_opened", {
|
|
6401
6401
|
metadata: {
|
|
6402
6402
|
layout: w,
|
|
6403
6403
|
surface: d,
|
|
6404
6404
|
ad_slot_behavior: m,
|
|
6405
6405
|
variant: oe,
|
|
6406
|
-
expanded:
|
|
6406
|
+
expanded: q
|
|
6407
6407
|
}
|
|
6408
|
-
}),
|
|
6409
|
-
}, [Ee,
|
|
6408
|
+
}), be == null || be()) : Pe == null || Pe();
|
|
6409
|
+
}, [Ee, q, w, F, be, Pe, d, Ne, oe]), rr = de(() => {
|
|
6410
6410
|
qt(!0);
|
|
6411
6411
|
}, [qt]), to = de(() => {
|
|
6412
6412
|
qt(!1);
|
|
6413
6413
|
}, [qt]), no = de(() => {
|
|
6414
6414
|
ut((n) => !n);
|
|
6415
|
-
}, []), or = de(async (n, b, x, _, T,
|
|
6416
|
-
var
|
|
6417
|
-
if (!
|
|
6415
|
+
}, []), or = de(async (n, b, x, _, T, j, ue) => {
|
|
6416
|
+
var $e, Ke, fe;
|
|
6417
|
+
if (!ke)
|
|
6418
6418
|
return console.warn("[AdMeshIntentAssistant] SDK not available - using fallback response"), {
|
|
6419
6419
|
text: "I'm a demo assistant. The SDK is not properly configured, but I can still help with suggestions! Try clicking on one of the suggested questions above."
|
|
6420
6420
|
};
|
|
6421
6421
|
try {
|
|
6422
|
-
rt && await
|
|
6422
|
+
rt && await we("turn_started", {
|
|
6423
6423
|
source: "publisher_assistant",
|
|
6424
6424
|
recommendation_id: rt.recommendation_id
|
|
6425
|
-
}).catch((
|
|
6426
|
-
console.warn("[AdMeshIntentAssistant] Failed to report delegation turn_started",
|
|
6425
|
+
}).catch((ge) => {
|
|
6426
|
+
console.warn("[AdMeshIntentAssistant] Failed to report delegation turn_started", ge);
|
|
6427
6427
|
});
|
|
6428
|
-
const Re = await fetch(`${
|
|
6428
|
+
const Re = await fetch(`${ke.getApiBaseUrl()}/api/chat/assistant`, {
|
|
6429
6429
|
method: "POST",
|
|
6430
|
-
signal:
|
|
6430
|
+
signal: j,
|
|
6431
6431
|
headers: {
|
|
6432
6432
|
"Content-Type": "application/json",
|
|
6433
6433
|
Accept: "text/plain",
|
|
@@ -6443,10 +6443,10 @@ const Oi = {
|
|
|
6443
6443
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6444
6444
|
source: "admesh-ui-sdk",
|
|
6445
6445
|
page_context: Lr(k),
|
|
6446
|
-
conversation_history:
|
|
6446
|
+
conversation_history: ue,
|
|
6447
6447
|
sponsored_recommendation: T != null && T.recommendation_id ? {
|
|
6448
6448
|
recommendation_id: T.recommendation_id,
|
|
6449
|
-
brand_name: (
|
|
6449
|
+
brand_name: (Ke = ($e = T.recommendation) == null ? void 0 : $e.creative) == null ? void 0 : Ke.brand_name
|
|
6450
6450
|
} : void 0,
|
|
6451
6451
|
active_delegation_session: rt ? {
|
|
6452
6452
|
delegation_session_id: rt.delegation_session_id,
|
|
@@ -6461,54 +6461,54 @@ const Oi = {
|
|
|
6461
6461
|
});
|
|
6462
6462
|
if (!Re.ok)
|
|
6463
6463
|
throw new Error(`API request failed: ${Re.status} ${Re.statusText}`);
|
|
6464
|
-
const
|
|
6465
|
-
if (!
|
|
6464
|
+
const He = (fe = Re.body) == null ? void 0 : fe.getReader(), Ut = new TextDecoder();
|
|
6465
|
+
if (!He)
|
|
6466
6466
|
throw new Error("Response body is not readable");
|
|
6467
|
-
let Xe = "", ot,
|
|
6467
|
+
let Xe = "", ot, Ht, xt, ee, se;
|
|
6468
6468
|
return await (async () => {
|
|
6469
6469
|
try {
|
|
6470
6470
|
for (; ; ) {
|
|
6471
|
-
const { done:
|
|
6472
|
-
if (
|
|
6473
|
-
const lt =
|
|
6471
|
+
const { done: ge, value: yt } = await He.read();
|
|
6472
|
+
if (ge) break;
|
|
6473
|
+
const lt = Ut.decode(yt, { stream: !0 }).split(`
|
|
6474
6474
|
`);
|
|
6475
6475
|
for (const en of lt)
|
|
6476
6476
|
if (en.startsWith("data: ")) {
|
|
6477
6477
|
const Ln = en.slice(6);
|
|
6478
6478
|
if (Ln.trim() === "[DONE]")
|
|
6479
|
-
return rt &&
|
|
6479
|
+
return rt && we("turn_completed", {
|
|
6480
6480
|
source: "publisher_assistant",
|
|
6481
6481
|
recommendation_id: rt.recommendation_id
|
|
6482
|
-
}).catch((
|
|
6483
|
-
console.warn("[AdMeshIntentAssistant] Failed to report delegation turn_completed",
|
|
6482
|
+
}).catch((je) => {
|
|
6483
|
+
console.warn("[AdMeshIntentAssistant] Failed to report delegation turn_completed", je);
|
|
6484
6484
|
}), {
|
|
6485
6485
|
text: Xe,
|
|
6486
6486
|
source_links: ot,
|
|
6487
|
-
related_items:
|
|
6488
|
-
followup_suggestions:
|
|
6487
|
+
related_items: Ht,
|
|
6488
|
+
followup_suggestions: xt,
|
|
6489
6489
|
used_capability: ee,
|
|
6490
6490
|
response_time_ms: se
|
|
6491
6491
|
};
|
|
6492
6492
|
try {
|
|
6493
|
-
const
|
|
6494
|
-
switch (
|
|
6493
|
+
const je = JSON.parse(Ln);
|
|
6494
|
+
switch (je.type) {
|
|
6495
6495
|
case "content": {
|
|
6496
|
-
const br =
|
|
6496
|
+
const br = je.content || "";
|
|
6497
6497
|
Xe += br, x == null || x(br);
|
|
6498
6498
|
break;
|
|
6499
6499
|
}
|
|
6500
6500
|
case "final": {
|
|
6501
|
-
Xe =
|
|
6501
|
+
Xe = je.reply || Xe, ot = Array.isArray(je.source_links) ? je.source_links : void 0, Ht = Array.isArray(je.related_items) ? je.related_items : void 0, xt = Array.isArray(je.followup_suggestions) ? je.followup_suggestions : void 0, ee = typeof je.used_capability == "string" ? je.used_capability : ee, se = typeof je.response_time_ms == "number" ? je.response_time_ms : se;
|
|
6502
6502
|
break;
|
|
6503
6503
|
}
|
|
6504
6504
|
case "followup_suggestions": {
|
|
6505
|
-
|
|
6505
|
+
xt = Array.isArray(je.followup_suggestions) ? je.followup_suggestions : xt;
|
|
6506
6506
|
break;
|
|
6507
6507
|
}
|
|
6508
6508
|
case "error":
|
|
6509
|
-
throw new Error(
|
|
6509
|
+
throw new Error(je.message || "Unknown streaming error");
|
|
6510
6510
|
case "session_start":
|
|
6511
|
-
_ == null || _(), console.log("Session started:",
|
|
6511
|
+
_ == null || _(), console.log("Session started:", je.session_id);
|
|
6512
6512
|
break;
|
|
6513
6513
|
}
|
|
6514
6514
|
} catch {
|
|
@@ -6517,32 +6517,32 @@ const Oi = {
|
|
|
6517
6517
|
}
|
|
6518
6518
|
}
|
|
6519
6519
|
}
|
|
6520
|
-
} catch (
|
|
6521
|
-
if (
|
|
6520
|
+
} catch (ge) {
|
|
6521
|
+
if (j != null && j.aborted)
|
|
6522
6522
|
return {
|
|
6523
6523
|
text: Xe,
|
|
6524
6524
|
source_links: ot,
|
|
6525
|
-
related_items:
|
|
6526
|
-
followup_suggestions:
|
|
6525
|
+
related_items: Ht,
|
|
6526
|
+
followup_suggestions: xt,
|
|
6527
6527
|
used_capability: ee,
|
|
6528
6528
|
response_time_ms: se,
|
|
6529
6529
|
error: "aborted"
|
|
6530
6530
|
};
|
|
6531
|
-
throw console.error("Stream processing error:",
|
|
6531
|
+
throw console.error("Stream processing error:", ge), ge;
|
|
6532
6532
|
} finally {
|
|
6533
|
-
|
|
6533
|
+
He.releaseLock();
|
|
6534
6534
|
}
|
|
6535
6535
|
return {
|
|
6536
6536
|
text: Xe,
|
|
6537
6537
|
source_links: ot,
|
|
6538
|
-
related_items:
|
|
6539
|
-
followup_suggestions:
|
|
6538
|
+
related_items: Ht,
|
|
6539
|
+
followup_suggestions: xt,
|
|
6540
6540
|
used_capability: ee,
|
|
6541
6541
|
response_time_ms: se
|
|
6542
6542
|
};
|
|
6543
6543
|
})();
|
|
6544
6544
|
} catch (Re) {
|
|
6545
|
-
return
|
|
6545
|
+
return j != null && j.aborted ? {
|
|
6546
6546
|
text: "",
|
|
6547
6547
|
error: "aborted"
|
|
6548
6548
|
} : (console.error("Error calling assistant API:", Re), {
|
|
@@ -6550,25 +6550,25 @@ const Oi = {
|
|
|
6550
6550
|
error: Re instanceof Error ? Re.message : "request_failed"
|
|
6551
6551
|
});
|
|
6552
6552
|
}
|
|
6553
|
-
}, [
|
|
6554
|
-
const n =
|
|
6553
|
+
}, [ke, le, N, X, rt, we]), Rn = de(() => {
|
|
6554
|
+
const n = Tt.current;
|
|
6555
6555
|
if (!n || n.signal.aborted) return;
|
|
6556
|
-
n.abort(), mt(!1), tt.current = null,
|
|
6556
|
+
n.abort(), mt(!1), tt.current = null, Ct.current = !1;
|
|
6557
6557
|
const b = nt.current;
|
|
6558
6558
|
b && Ye((x) => x.map(
|
|
6559
6559
|
(_) => _.id === b && !_.content.trim() ? { ..._, content: "Generation stopped." } : _
|
|
6560
6560
|
));
|
|
6561
6561
|
}, []), Qt = de(async (n) => {
|
|
6562
|
-
var
|
|
6563
|
-
if (!n.trim() ||
|
|
6564
|
-
const b = typeof performance < "u" ? performance.now() : Date.now(), x = n.trim(), _ = Date.now().toString(), T = new AbortController(),
|
|
6562
|
+
var fe, Re, He, Ut, Xe, ot, Ht, xt;
|
|
6563
|
+
if (!n.trim() || ye) return;
|
|
6564
|
+
const b = typeof performance < "u" ? performance.now() : Date.now(), x = n.trim(), _ = Date.now().toString(), T = new AbortController(), j = tt.current, ue = (j == null ? void 0 : j.recommendation) || null, $e = Fe.filter((ee) => (ee.role === "user" || ee.role === "assistant") && ee.content.trim()).slice(-6).map((ee) => ({
|
|
6565
6565
|
role: ee.role,
|
|
6566
6566
|
content: ee.content.trim().slice(0, 1200)
|
|
6567
6567
|
}));
|
|
6568
|
-
|
|
6568
|
+
Tt.current = T, nt.current = null, st.current = _, Et.current = !0, Wt.current = !0, tt.current = null, O(
|
|
6569
6569
|
(ee) => ee.some((se) => se.is_sponsored) ? ee.filter((se) => !se.is_sponsored) : ee
|
|
6570
|
-
),
|
|
6571
|
-
const
|
|
6570
|
+
), $t(null);
|
|
6571
|
+
const Ke = {
|
|
6572
6572
|
id: _,
|
|
6573
6573
|
role: "user",
|
|
6574
6574
|
content: x,
|
|
@@ -6577,7 +6577,7 @@ const Oi = {
|
|
|
6577
6577
|
if (Ne("query_submitted", {
|
|
6578
6578
|
message_id: _,
|
|
6579
6579
|
query: x
|
|
6580
|
-
}), Ye((ee) => [...ee,
|
|
6580
|
+
}), Ye((ee) => [...ee, Ke]), St(""), mt(!0), oe === "default" && Ae) {
|
|
6581
6581
|
try {
|
|
6582
6582
|
const ee = (Date.now() + 1).toString(), se = {
|
|
6583
6583
|
id: ee,
|
|
@@ -6588,27 +6588,27 @@ const Oi = {
|
|
|
6588
6588
|
userQuery: n,
|
|
6589
6589
|
initialRecommendation: null
|
|
6590
6590
|
};
|
|
6591
|
-
|
|
6591
|
+
Ct.current && (jt((yt) => /* @__PURE__ */ new Set([...yt, ee])), Ct.current = !1), Ye((yt) => [...yt, se]), nt.current = ee;
|
|
6592
6592
|
const Ge = await Ae(x, {
|
|
6593
|
-
sponsoredSuggestion:
|
|
6593
|
+
sponsoredSuggestion: j
|
|
6594
6594
|
});
|
|
6595
6595
|
if (T.signal.aborted) {
|
|
6596
6596
|
tt.current = null;
|
|
6597
6597
|
return;
|
|
6598
6598
|
}
|
|
6599
|
-
const
|
|
6599
|
+
const ge = Ge.recommendation || ue || null;
|
|
6600
6600
|
console.log("[AdMeshIntentAssistant] Query handler completed:", {
|
|
6601
6601
|
query: n,
|
|
6602
6602
|
hasResponseRecommendation: !!Ge.recommendation,
|
|
6603
|
-
hasSponsoredSuggestionRecommendation: !!
|
|
6604
|
-
finalRecommendationId:
|
|
6605
|
-
}), Ye((
|
|
6603
|
+
hasSponsoredSuggestionRecommendation: !!ue,
|
|
6604
|
+
finalRecommendationId: ge == null ? void 0 : ge.recommendation_id
|
|
6605
|
+
}), Ye((yt) => yt.map(
|
|
6606
6606
|
(it) => it.id === ee ? {
|
|
6607
6607
|
...it,
|
|
6608
6608
|
content: Ge.answer,
|
|
6609
6609
|
sourceLinks: Ge.source_links,
|
|
6610
6610
|
relatedItems: Ge.related_items,
|
|
6611
|
-
initialRecommendation:
|
|
6611
|
+
initialRecommendation: ge,
|
|
6612
6612
|
responseTimeMs: (typeof performance < "u" ? performance.now() : Date.now()) - b
|
|
6613
6613
|
} : it
|
|
6614
6614
|
)), Tn(
|
|
@@ -6621,8 +6621,8 @@ const Oi = {
|
|
|
6621
6621
|
), Ne("answer_completed", {
|
|
6622
6622
|
message_id: ee,
|
|
6623
6623
|
query: x,
|
|
6624
|
-
recommendation_id:
|
|
6625
|
-
brand_name: (Re = (
|
|
6624
|
+
recommendation_id: ge == null ? void 0 : ge.recommendation_id,
|
|
6625
|
+
brand_name: (Re = (fe = ge == null ? void 0 : ge.recommendation) == null ? void 0 : fe.creative) == null ? void 0 : Re.brand_name,
|
|
6626
6626
|
latency_ms: (typeof performance < "u" ? performance.now() : Date.now()) - b,
|
|
6627
6627
|
status: "completed",
|
|
6628
6628
|
metadata: {
|
|
@@ -6633,14 +6633,14 @@ const Oi = {
|
|
|
6633
6633
|
} catch (ee) {
|
|
6634
6634
|
console.error("Error sending message:", ee);
|
|
6635
6635
|
const se = ee instanceof Error ? ee.message : "Unknown error occurred";
|
|
6636
|
-
|
|
6636
|
+
$t(se);
|
|
6637
6637
|
const Ge = {
|
|
6638
6638
|
id: (Date.now() + 1).toString(),
|
|
6639
6639
|
role: "assistant",
|
|
6640
6640
|
content: "Sorry, I encountered an error. Please try again.",
|
|
6641
6641
|
timestamp: /* @__PURE__ */ new Date()
|
|
6642
6642
|
};
|
|
6643
|
-
Ye((
|
|
6643
|
+
Ye((ge) => [...ge, Ge]), Ne("answer_failed", {
|
|
6644
6644
|
query: x,
|
|
6645
6645
|
status: se,
|
|
6646
6646
|
latency_ms: (typeof performance < "u" ? performance.now() : Date.now()) - b,
|
|
@@ -6650,14 +6650,14 @@ const Oi = {
|
|
|
6650
6650
|
}
|
|
6651
6651
|
}), tt.current = null;
|
|
6652
6652
|
} finally {
|
|
6653
|
-
|
|
6653
|
+
Tt.current === T && (Tt.current = null, nt.current = null, mt(!1));
|
|
6654
6654
|
}
|
|
6655
6655
|
return;
|
|
6656
6656
|
}
|
|
6657
|
-
if (!
|
|
6657
|
+
if (!ke) {
|
|
6658
6658
|
setTimeout(() => {
|
|
6659
6659
|
if (T.signal.aborted) {
|
|
6660
|
-
|
|
6660
|
+
Tt.current === T && (Tt.current = null, nt.current = null);
|
|
6661
6661
|
return;
|
|
6662
6662
|
}
|
|
6663
6663
|
const ee = {
|
|
@@ -6668,12 +6668,12 @@ const Oi = {
|
|
|
6668
6668
|
recommendations: [],
|
|
6669
6669
|
userQuery: n
|
|
6670
6670
|
};
|
|
6671
|
-
Ye((se) => [...se, ee]),
|
|
6671
|
+
Ye((se) => [...se, ee]), Tt.current === T && (Tt.current = null, nt.current = null, mt(!1));
|
|
6672
6672
|
}, 1e3);
|
|
6673
6673
|
return;
|
|
6674
6674
|
}
|
|
6675
6675
|
try {
|
|
6676
|
-
const ee = (Date.now() + 1).toString(), se =
|
|
6676
|
+
const ee = (Date.now() + 1).toString(), se = ue, Ge = {
|
|
6677
6677
|
id: ee,
|
|
6678
6678
|
role: "assistant",
|
|
6679
6679
|
content: "",
|
|
@@ -6682,8 +6682,8 @@ const Oi = {
|
|
|
6682
6682
|
userQuery: n,
|
|
6683
6683
|
initialRecommendation: se
|
|
6684
6684
|
};
|
|
6685
|
-
|
|
6686
|
-
const
|
|
6685
|
+
Ct.current && (jt((it) => /* @__PURE__ */ new Set([...it, ee])), Ct.current = !1), Ye((it) => [...it, Ge]), nt.current = ee;
|
|
6686
|
+
const ge = await or(
|
|
6687
6687
|
x,
|
|
6688
6688
|
_,
|
|
6689
6689
|
// Callback for real-time content updates
|
|
@@ -6697,16 +6697,16 @@ const Oi = {
|
|
|
6697
6697
|
},
|
|
6698
6698
|
se,
|
|
6699
6699
|
T.signal,
|
|
6700
|
-
|
|
6700
|
+
$e
|
|
6701
6701
|
);
|
|
6702
6702
|
if (T.signal.aborted) {
|
|
6703
|
-
|
|
6703
|
+
ge.text.trim() || Ye((it) => it.map(
|
|
6704
6704
|
(lt) => lt.id === ee && !lt.content.trim() ? { ...lt, content: "Generation stopped." } : lt
|
|
6705
6705
|
)), Ne("answer_failed", {
|
|
6706
6706
|
message_id: ee,
|
|
6707
6707
|
query: x,
|
|
6708
6708
|
recommendation_id: se == null ? void 0 : se.recommendation_id,
|
|
6709
|
-
brand_name: (
|
|
6709
|
+
brand_name: (Ut = (He = se == null ? void 0 : se.recommendation) == null ? void 0 : He.creative) == null ? void 0 : Ut.brand_name,
|
|
6710
6710
|
latency_ms: (typeof performance < "u" ? performance.now() : Date.now()) - b,
|
|
6711
6711
|
status: "aborted",
|
|
6712
6712
|
metadata: {
|
|
@@ -6716,30 +6716,30 @@ const Oi = {
|
|
|
6716
6716
|
}), tt.current = null;
|
|
6717
6717
|
return;
|
|
6718
6718
|
}
|
|
6719
|
-
const
|
|
6719
|
+
const yt = typeof ge.response_time_ms == "number" ? ge.response_time_ms : (typeof performance < "u" ? performance.now() : Date.now()) - b;
|
|
6720
6720
|
Ye((it) => it.map(
|
|
6721
6721
|
(lt) => lt.id === ee ? {
|
|
6722
6722
|
...lt,
|
|
6723
|
-
content:
|
|
6724
|
-
sourceLinks:
|
|
6725
|
-
relatedItems:
|
|
6723
|
+
content: ge.text,
|
|
6724
|
+
sourceLinks: ge.source_links,
|
|
6725
|
+
relatedItems: ge.related_items,
|
|
6726
6726
|
initialRecommendation: lt.initialRecommendation || se,
|
|
6727
|
-
responseTimeMs:
|
|
6727
|
+
responseTimeMs: yt
|
|
6728
6728
|
} : lt
|
|
6729
6729
|
)), Tn(
|
|
6730
6730
|
x,
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6731
|
+
ge.text,
|
|
6732
|
+
ge.source_links,
|
|
6733
|
+
ge.related_items,
|
|
6734
6734
|
null,
|
|
6735
|
-
|
|
6736
|
-
),
|
|
6735
|
+
ge.followup_suggestions
|
|
6736
|
+
), ge.error ? Ne("answer_failed", {
|
|
6737
6737
|
message_id: ee,
|
|
6738
6738
|
query: x,
|
|
6739
6739
|
recommendation_id: se == null ? void 0 : se.recommendation_id,
|
|
6740
6740
|
brand_name: (ot = (Xe = se == null ? void 0 : se.recommendation) == null ? void 0 : Xe.creative) == null ? void 0 : ot.brand_name,
|
|
6741
6741
|
latency_ms: (typeof performance < "u" ? performance.now() : Date.now()) - b,
|
|
6742
|
-
status:
|
|
6742
|
+
status: ge.error,
|
|
6743
6743
|
metadata: {
|
|
6744
6744
|
variant: oe,
|
|
6745
6745
|
source: "api_chat_assistant"
|
|
@@ -6748,27 +6748,27 @@ const Oi = {
|
|
|
6748
6748
|
message_id: ee,
|
|
6749
6749
|
query: x,
|
|
6750
6750
|
recommendation_id: se == null ? void 0 : se.recommendation_id,
|
|
6751
|
-
brand_name: (
|
|
6752
|
-
used_capability:
|
|
6753
|
-
latency_ms:
|
|
6751
|
+
brand_name: (xt = (Ht = se == null ? void 0 : se.recommendation) == null ? void 0 : Ht.creative) == null ? void 0 : xt.brand_name,
|
|
6752
|
+
used_capability: ge.used_capability,
|
|
6753
|
+
latency_ms: yt,
|
|
6754
6754
|
status: "completed",
|
|
6755
6755
|
metadata: {
|
|
6756
6756
|
variant: oe,
|
|
6757
6757
|
source: "api_chat_assistant",
|
|
6758
|
-
response_time_ms:
|
|
6758
|
+
response_time_ms: yt
|
|
6759
6759
|
}
|
|
6760
6760
|
}), tt.current = null;
|
|
6761
6761
|
} catch (ee) {
|
|
6762
6762
|
console.error("Error sending message:", ee);
|
|
6763
6763
|
const se = ee instanceof Error ? ee.message : "Unknown error occurred";
|
|
6764
|
-
|
|
6764
|
+
$t(se);
|
|
6765
6765
|
const Ge = {
|
|
6766
6766
|
id: (Date.now() + 1).toString(),
|
|
6767
6767
|
role: "assistant",
|
|
6768
6768
|
content: "Sorry, I encountered an error. Please try again.",
|
|
6769
6769
|
timestamp: /* @__PURE__ */ new Date()
|
|
6770
6770
|
};
|
|
6771
|
-
Ye((
|
|
6771
|
+
Ye((ge) => [...ge, Ge]), Ne("answer_failed", {
|
|
6772
6772
|
query: x,
|
|
6773
6773
|
latency_ms: (typeof performance < "u" ? performance.now() : Date.now()) - b,
|
|
6774
6774
|
status: se,
|
|
@@ -6778,9 +6778,9 @@ const Oi = {
|
|
|
6778
6778
|
}
|
|
6779
6779
|
}), tt.current = null;
|
|
6780
6780
|
} finally {
|
|
6781
|
-
|
|
6781
|
+
Tt.current === T && (Tt.current = null, nt.current = null, mt(!1));
|
|
6782
6782
|
}
|
|
6783
|
-
}, [
|
|
6783
|
+
}, [ye, or, Ae, Tn, ke, Ne, oe]), Ot = Kt, yn = kn(
|
|
6784
6784
|
() => Ot.some((n) => n == null ? void 0 : n.is_sponsored),
|
|
6785
6785
|
[Ot]
|
|
6786
6786
|
), wn = kn(
|
|
@@ -6788,14 +6788,14 @@ const Oi = {
|
|
|
6788
6788
|
(n) => !(n && typeof n.id == "string") ? !1 : te ? yn : !0
|
|
6789
6789
|
),
|
|
6790
6790
|
[yn, te, Ot]
|
|
6791
|
-
),
|
|
6791
|
+
), Oe = kn(
|
|
6792
6792
|
() => qn(wn),
|
|
6793
6793
|
[wn]
|
|
6794
6794
|
), Xt = kn(
|
|
6795
|
-
() =>
|
|
6796
|
-
[U,
|
|
6795
|
+
() => _e === "below-input-container" && U ? Oe.find((n) => n.is_sponsored && n.recommendation) ?? null : null,
|
|
6796
|
+
[U, Oe, _e]
|
|
6797
6797
|
), un = de(async (n) => {
|
|
6798
|
-
var x, _, T,
|
|
6798
|
+
var x, _, T, j, ue, $e, Ke;
|
|
6799
6799
|
console.log("[AdMeshIntentAssistant] 🖱️ Suggestion clicked:", {
|
|
6800
6800
|
text: n.text,
|
|
6801
6801
|
is_sponsored: n.is_sponsored,
|
|
@@ -6803,92 +6803,92 @@ const Oi = {
|
|
|
6803
6803
|
recommendationId: ((x = n.recommendation) == null ? void 0 : x.recommendation_id) || void 0,
|
|
6804
6804
|
hasFollowupEngagementUrl: !!((T = (_ = n.recommendation) == null ? void 0 : _.tracking) != null && T.followup_engagement_url),
|
|
6805
6805
|
sessionId: le
|
|
6806
|
-
}),
|
|
6807
|
-
const b =
|
|
6806
|
+
}), Ct.current = n.is_sponsored || !1, tt.current = n.is_sponsored ? n : null;
|
|
6807
|
+
const b = Oe.findIndex((fe) => fe.id === n.id);
|
|
6808
6808
|
Ne("suggestion_clicked", {
|
|
6809
6809
|
suggestion_id: n.id,
|
|
6810
6810
|
suggestion_text: n.text,
|
|
6811
6811
|
suggestion_type: n.type,
|
|
6812
6812
|
suggestion_position: b >= 0 ? b : void 0,
|
|
6813
6813
|
is_sponsored: n.is_sponsored,
|
|
6814
|
-
recommendation_id: (
|
|
6815
|
-
brand_name: (
|
|
6814
|
+
recommendation_id: (j = n.recommendation) == null ? void 0 : j.recommendation_id,
|
|
6815
|
+
brand_name: (Ke = ($e = (ue = n.recommendation) == null ? void 0 : ue.recommendation) == null ? void 0 : $e.creative) == null ? void 0 : Ke.brand_name,
|
|
6816
6816
|
query: n.text
|
|
6817
|
-
}), Qt(n.text), n.is_sponsored && n.recommendation &&
|
|
6818
|
-
var
|
|
6817
|
+
}), Qt(n.text), n.is_sponsored && n.recommendation && ke ? setTimeout(async () => {
|
|
6818
|
+
var fe;
|
|
6819
6819
|
try {
|
|
6820
|
-
const Re = (
|
|
6820
|
+
const Re = (fe = n.recommendation.tracking) == null ? void 0 : fe.followup_engagement_url, He = n.recommendation.recommendation_id;
|
|
6821
6821
|
console.log("[AdMeshIntentAssistant] 🎯 Preparing to fire sponsored suggestion engagement:", {
|
|
6822
6822
|
followupEngagementUrl: Re,
|
|
6823
|
-
recommendationId:
|
|
6823
|
+
recommendationId: He,
|
|
6824
6824
|
sessionId: le
|
|
6825
|
-
}), Re &&
|
|
6825
|
+
}), Re && He && le ? (console.log("[AdMeshIntentAssistant] 🎯 Firing sponsored suggestion engagement tracking"), await ke.fireFollowupEngagement(Re, He, le), console.log("[AdMeshIntentAssistant] ✅ Engagement tracking fired successfully")) : console.warn("[AdMeshIntentAssistant] ⚠️ Missing required data for engagement tracking:", {
|
|
6826
6826
|
hasFollowupEngagementUrl: !!Re,
|
|
6827
|
-
hasRecommendationId: !!
|
|
6827
|
+
hasRecommendationId: !!He,
|
|
6828
6828
|
hasSessionId: !!le
|
|
6829
6829
|
});
|
|
6830
6830
|
} catch (Re) {
|
|
6831
|
-
console.error("[AdMeshIntentAssistant]
|
|
6831
|
+
console.error("[AdMeshIntentAssistant] Error firing sponsored suggestion engagement:", Re);
|
|
6832
6832
|
}
|
|
6833
6833
|
}, 0) : console.log("[AdMeshIntentAssistant] ℹ️ Not a sponsored suggestion or missing data, skipping engagement tracking");
|
|
6834
|
-
}, [Qt,
|
|
6834
|
+
}, [Qt, Oe, ke, le, Ne]), _n = Ki[Y], ir = Vi[S];
|
|
6835
6835
|
Z(() => {
|
|
6836
|
-
if (
|
|
6837
|
-
return
|
|
6838
|
-
const x =
|
|
6836
|
+
if (Be.current.forEach((n) => n()), Be.current = [], !(typeof window > "u" || typeof IntersectionObserver > "u"))
|
|
6837
|
+
return Oe.forEach((n, b) => {
|
|
6838
|
+
const x = K.current.get(n.id);
|
|
6839
6839
|
if (!x)
|
|
6840
6840
|
return;
|
|
6841
6841
|
const _ = `${le || "anonymous"}:${n.id}:${n.is_sponsored ? "s" : "o"}`;
|
|
6842
6842
|
if (En.current.has(_))
|
|
6843
6843
|
return;
|
|
6844
|
-
let T = null,
|
|
6845
|
-
const
|
|
6846
|
-
T && (clearTimeout(T), T = null),
|
|
6847
|
-
},
|
|
6848
|
-
var
|
|
6844
|
+
let T = null, j = null;
|
|
6845
|
+
const ue = () => {
|
|
6846
|
+
T && (clearTimeout(T), T = null), j == null || j.disconnect(), j = null;
|
|
6847
|
+
}, $e = () => {
|
|
6848
|
+
var Ke, fe, Re, He, Ut;
|
|
6849
6849
|
if (En.current.has(_)) {
|
|
6850
|
-
|
|
6850
|
+
ue();
|
|
6851
6851
|
return;
|
|
6852
6852
|
}
|
|
6853
|
-
if (En.current.add(_),
|
|
6853
|
+
if (En.current.add(_), ue(), Ne("suggestion_exposure", {
|
|
6854
6854
|
suggestion_id: n.id,
|
|
6855
6855
|
suggestion_text: n.text,
|
|
6856
6856
|
suggestion_type: n.type,
|
|
6857
6857
|
suggestion_position: b,
|
|
6858
6858
|
is_sponsored: n.is_sponsored,
|
|
6859
|
-
recommendation_id: (
|
|
6860
|
-
brand_name: (
|
|
6861
|
-
}),
|
|
6862
|
-
const Xe = (
|
|
6859
|
+
recommendation_id: (Ke = n.recommendation) == null ? void 0 : Ke.recommendation_id,
|
|
6860
|
+
brand_name: (He = (Re = (fe = n.recommendation) == null ? void 0 : fe.recommendation) == null ? void 0 : Re.creative) == null ? void 0 : He.brand_name
|
|
6861
|
+
}), ke && le && n.is_sponsored && n.recommendation) {
|
|
6862
|
+
const Xe = (Ut = n.recommendation.tracking) == null ? void 0 : Ut.followup_exposure_url, ot = n.recommendation.recommendation_id;
|
|
6863
6863
|
Xe && ot ? (console.log("[AdMeshIntentAssistant] 🎯 Firing viewable sponsored suggestion exposure:", {
|
|
6864
6864
|
exposureUrl: Xe,
|
|
6865
6865
|
recommendationId: ot,
|
|
6866
6866
|
suggestionText: n.text,
|
|
6867
6867
|
sessionId: le
|
|
6868
|
-
}),
|
|
6868
|
+
}), ke.fireFollowupExposure(Xe, ot, le)) : console.warn("[AdMeshIntentAssistant] ⚠️ Missing exposure URL or recommendation ID for sponsored suggestion:", {
|
|
6869
6869
|
hasExposureUrl: !!Xe,
|
|
6870
6870
|
hasRecommendationId: !!ot,
|
|
6871
6871
|
suggestionText: n.text
|
|
6872
6872
|
});
|
|
6873
6873
|
}
|
|
6874
6874
|
};
|
|
6875
|
-
|
|
6876
|
-
(
|
|
6877
|
-
const
|
|
6878
|
-
if (
|
|
6879
|
-
if (
|
|
6880
|
-
T || (T = setTimeout(
|
|
6875
|
+
j = new IntersectionObserver(
|
|
6876
|
+
(Ke) => {
|
|
6877
|
+
const fe = Ke[0];
|
|
6878
|
+
if (fe) {
|
|
6879
|
+
if (fe.intersectionRatio >= 0.5) {
|
|
6880
|
+
T || (T = setTimeout($e, 1e3));
|
|
6881
6881
|
return;
|
|
6882
6882
|
}
|
|
6883
6883
|
T && (clearTimeout(T), T = null);
|
|
6884
6884
|
}
|
|
6885
6885
|
},
|
|
6886
6886
|
{ threshold: [0, 0.25, 0.5, 0.75, 1], rootMargin: "0px" }
|
|
6887
|
-
),
|
|
6887
|
+
), j.observe(x), Be.current.push(ue);
|
|
6888
6888
|
}), () => {
|
|
6889
|
-
|
|
6889
|
+
Be.current.forEach((n) => n()), Be.current = [];
|
|
6890
6890
|
};
|
|
6891
|
-
}, [
|
|
6891
|
+
}, [Oe, ke, le, Ne, ct]), console.log("[AdMeshIntentAssistant] 📥 Received suggestions:", {
|
|
6892
6892
|
totalSuggestions: Ot.length,
|
|
6893
6893
|
safeSuggestions: wn.length,
|
|
6894
6894
|
isAnalyzingIntent: ne,
|
|
@@ -6910,7 +6910,7 @@ const Oi = {
|
|
|
6910
6910
|
hasFollowupEngagementUrl: !!((_ = (x = n == null ? void 0 : n.recommendation) == null ? void 0 : x.tracking) != null && _.followup_engagement_url)
|
|
6911
6911
|
};
|
|
6912
6912
|
}),
|
|
6913
|
-
renderedSuggestions:
|
|
6913
|
+
renderedSuggestions: Oe.map((n) => {
|
|
6914
6914
|
var b, x, _;
|
|
6915
6915
|
return {
|
|
6916
6916
|
id: n == null ? void 0 : n.id,
|
|
@@ -6923,11 +6923,11 @@ const Oi = {
|
|
|
6923
6923
|
};
|
|
6924
6924
|
})
|
|
6925
6925
|
});
|
|
6926
|
-
const
|
|
6926
|
+
const Se = {
|
|
6927
6927
|
base: `${16 * R}px`,
|
|
6928
6928
|
sm: `${14 * R}px`,
|
|
6929
6929
|
xs: `${12 * R}px`
|
|
6930
|
-
}, ar =
|
|
6930
|
+
}, ar = De || "AI-generated responses may contain errors. Please verify important information independently.", ro = [
|
|
6931
6931
|
"Searching trusted sources...",
|
|
6932
6932
|
"Reviewing publisher coverage...",
|
|
6933
6933
|
"Checking relevant context...",
|
|
@@ -6938,7 +6938,7 @@ const Oi = {
|
|
|
6938
6938
|
"Preparing the clearest answer...",
|
|
6939
6939
|
"Finishing the response..."
|
|
6940
6940
|
], pn = (n) => {
|
|
6941
|
-
const b = (n == null ? void 0 : n.accentColor) ||
|
|
6941
|
+
const b = (n == null ? void 0 : n.accentColor) || Rt, x = (n == null ? void 0 : n.metaColor) || cr, _ = (n == null ? void 0 : n.includeSteps) ?? oe === "default", T = `${gt}s`, j = _ ? `${ro[Te]} (${T})` : `Generating answer... ${T}`;
|
|
6942
6942
|
return /* @__PURE__ */ E(
|
|
6943
6943
|
"div",
|
|
6944
6944
|
{
|
|
@@ -6947,7 +6947,7 @@ const Oi = {
|
|
|
6947
6947
|
alignItems: "center",
|
|
6948
6948
|
gap: n != null && n.compact ? "8px" : "10px",
|
|
6949
6949
|
color: x,
|
|
6950
|
-
fontSize: n != null && n.compact ?
|
|
6950
|
+
fontSize: n != null && n.compact ? Se.xs : Se.sm
|
|
6951
6951
|
},
|
|
6952
6952
|
children: [
|
|
6953
6953
|
/* @__PURE__ */ i(
|
|
@@ -6959,18 +6959,18 @@ const Oi = {
|
|
|
6959
6959
|
borderRadius: 999,
|
|
6960
6960
|
background: b,
|
|
6961
6961
|
animation: "admeshPulse 1.4s ease-in-out infinite",
|
|
6962
|
-
boxShadow: `0 0 0 0 ${
|
|
6962
|
+
boxShadow: `0 0 0 0 ${Ue(Qe, 0.28)}`,
|
|
6963
6963
|
flexShrink: 0
|
|
6964
6964
|
}
|
|
6965
6965
|
}
|
|
6966
6966
|
),
|
|
6967
|
-
/* @__PURE__ */ i("span", { children:
|
|
6967
|
+
/* @__PURE__ */ i("span", { children: j })
|
|
6968
6968
|
]
|
|
6969
6969
|
}
|
|
6970
6970
|
);
|
|
6971
6971
|
}, sr = de(
|
|
6972
6972
|
(n, b) => {
|
|
6973
|
-
if (
|
|
6973
|
+
if (Lt[n.id])
|
|
6974
6974
|
return;
|
|
6975
6975
|
const x = b ? "helpful" : "not_helpful";
|
|
6976
6976
|
Gt((_) => ({ ..._, [n.id]: x })), Ne("answer_feedback", {
|
|
@@ -6983,12 +6983,12 @@ const Oi = {
|
|
|
6983
6983
|
}
|
|
6984
6984
|
});
|
|
6985
6985
|
},
|
|
6986
|
-
[
|
|
6986
|
+
[Lt, Ne]
|
|
6987
6987
|
);
|
|
6988
6988
|
function Dn(n, b) {
|
|
6989
|
-
if (n.role !== "assistant" || !n.content.trim() ||
|
|
6989
|
+
if (n.role !== "assistant" || !n.content.trim() || ye && n.id === nt.current)
|
|
6990
6990
|
return null;
|
|
6991
|
-
const x = (b == null ? void 0 : b.accentColor) ||
|
|
6991
|
+
const x = (b == null ? void 0 : b.accentColor) || Rt, _ = (b == null ? void 0 : b.metaColor) || cr, T = Lt[n.id], j = typeof n.responseTimeMs == "number";
|
|
6992
6992
|
return /* @__PURE__ */ E(
|
|
6993
6993
|
"div",
|
|
6994
6994
|
{
|
|
@@ -7015,7 +7015,7 @@ const Oi = {
|
|
|
7015
7015
|
flexWrap: "wrap"
|
|
7016
7016
|
},
|
|
7017
7017
|
children: [
|
|
7018
|
-
/* @__PURE__ */ i("span", { style: { fontSize:
|
|
7018
|
+
/* @__PURE__ */ i("span", { style: { fontSize: Se.xs, color: _, whiteSpace: "nowrap" }, children: T ? "Thanks for your feedback" : "Is this helpful?" }),
|
|
7019
7019
|
T ? /* @__PURE__ */ i(
|
|
7020
7020
|
"span",
|
|
7021
7021
|
{
|
|
@@ -7026,7 +7026,7 @@ const Oi = {
|
|
|
7026
7026
|
width: 28,
|
|
7027
7027
|
height: 28,
|
|
7028
7028
|
borderRadius: "6px",
|
|
7029
|
-
background:
|
|
7029
|
+
background: Ue(x, 0.12),
|
|
7030
7030
|
color: x,
|
|
7031
7031
|
flexShrink: 0
|
|
7032
7032
|
},
|
|
@@ -7079,11 +7079,11 @@ const Oi = {
|
|
|
7079
7079
|
]
|
|
7080
7080
|
}
|
|
7081
7081
|
),
|
|
7082
|
-
|
|
7082
|
+
j ? /* @__PURE__ */ E(
|
|
7083
7083
|
"span",
|
|
7084
7084
|
{
|
|
7085
7085
|
style: {
|
|
7086
|
-
fontSize:
|
|
7086
|
+
fontSize: Se.xs,
|
|
7087
7087
|
color: _,
|
|
7088
7088
|
whiteSpace: "nowrap",
|
|
7089
7089
|
flex: "0 1 auto",
|
|
@@ -7105,24 +7105,24 @@ const Oi = {
|
|
|
7105
7105
|
const b = Math.max(0, n.scrollWidth - n.clientWidth);
|
|
7106
7106
|
Cn(n.scrollLeft > 4), Xr(n.scrollLeft < b - 4);
|
|
7107
7107
|
}, []);
|
|
7108
|
-
Z(() => (hn(), window.addEventListener("resize", hn), () => window.removeEventListener("resize", hn)), [hn,
|
|
7108
|
+
Z(() => (hn(), window.addEventListener("resize", hn), () => window.removeEventListener("resize", hn)), [hn, Oe.length]);
|
|
7109
7109
|
const lr = de((n) => {
|
|
7110
7110
|
const b = bt.current;
|
|
7111
7111
|
b && b.scrollBy({
|
|
7112
7112
|
left: n === "left" ? -Math.max(160, Math.floor(b.clientWidth * 0.75)) : Math.max(160, Math.floor(b.clientWidth * 0.75)),
|
|
7113
7113
|
behavior: "smooth"
|
|
7114
7114
|
});
|
|
7115
|
-
}, []),
|
|
7115
|
+
}, []), Ue = (n, b) => {
|
|
7116
7116
|
if (!n || !n.startsWith("#")) return `rgba(15, 23, 42, ${b})`;
|
|
7117
|
-
const x = n.slice(1), _ = x.length === 3 ? x.split("").map((
|
|
7117
|
+
const x = n.slice(1), _ = x.length === 3 ? x.split("").map(($e) => `${$e}${$e}`).join("") : x;
|
|
7118
7118
|
if (_.length !== 6) return n;
|
|
7119
|
-
const T = parseInt(_.slice(0, 2), 16),
|
|
7120
|
-
return `rgba(${T}, ${
|
|
7121
|
-
}, Qe = I.primaryColor || "#3F037F", ht = I.surfaceColor || "#ffffff", oo = I.backgroundColor || "#eef2ff", ft = I.borderColor || "#e5e7eb",
|
|
7122
|
-
|
|
7123
|
-
const dr =
|
|
7124
|
-
|
|
7125
|
-
const io = ht,
|
|
7119
|
+
const T = parseInt(_.slice(0, 2), 16), j = parseInt(_.slice(2, 4), 16), ue = parseInt(_.slice(4, 6), 16);
|
|
7120
|
+
return `rgba(${T}, ${j}, ${ue}, ${b})`;
|
|
7121
|
+
}, Qe = I.primaryColor || "#3F037F", ht = I.surfaceColor || "#ffffff", oo = I.backgroundColor || "#eef2ff", ft = I.borderColor || "#e5e7eb", Ve = I.textColor || "#111827", Jt = I.textSecondaryColor || "#6b7280";
|
|
7122
|
+
Ue(Qe, 0.12);
|
|
7123
|
+
const dr = Ue(Qe, 0.24);
|
|
7124
|
+
Ue(Qe, 0.38);
|
|
7125
|
+
const io = ht, Rt = Qe, vn = I.primaryTextColor || "#ffffff", cr = Jt, mr = pe || "Publisher Assistant", sn = ne && Oe.length === 0 && Fe.length === 0, Pn = ht, zn = ht, Zt = ft, ur = ft, pr = "0 16px 64px rgba(15, 23, 42, 0.14)", $n = Jt, ao = Jt, so = Rt, hr = oo, lo = "none", co = "rgba(15, 23, 42, 0.18)";
|
|
7126
7126
|
function fr(n) {
|
|
7127
7127
|
return rt ? /* @__PURE__ */ E(
|
|
7128
7128
|
"div",
|
|
@@ -7135,7 +7135,7 @@ const Oi = {
|
|
|
7135
7135
|
padding: n === "default" ? "10px 12px" : "8px 10px",
|
|
7136
7136
|
borderRadius: n === "default" ? "14px" : "12px",
|
|
7137
7137
|
border: `1px solid ${dr}`,
|
|
7138
|
-
background:
|
|
7138
|
+
background: Ue("#ffffff", 0.9),
|
|
7139
7139
|
marginBottom: "4px"
|
|
7140
7140
|
},
|
|
7141
7141
|
children: [
|
|
@@ -7144,8 +7144,8 @@ const Oi = {
|
|
|
7144
7144
|
"div",
|
|
7145
7145
|
{
|
|
7146
7146
|
style: {
|
|
7147
|
-
color:
|
|
7148
|
-
fontSize:
|
|
7147
|
+
color: Rt,
|
|
7148
|
+
fontSize: Se.xs,
|
|
7149
7149
|
fontWeight: 700,
|
|
7150
7150
|
textTransform: "uppercase",
|
|
7151
7151
|
letterSpacing: "0.06em"
|
|
@@ -7153,7 +7153,7 @@ const Oi = {
|
|
|
7153
7153
|
children: "Agent Connected"
|
|
7154
7154
|
}
|
|
7155
7155
|
),
|
|
7156
|
-
/* @__PURE__ */ E("div", { style: { color:
|
|
7156
|
+
/* @__PURE__ */ E("div", { style: { color: Ve, fontSize: Se.sm, fontWeight: 600, lineHeight: 1.3 }, children: [
|
|
7157
7157
|
rt.brand_name,
|
|
7158
7158
|
" agent is active"
|
|
7159
7159
|
] })
|
|
@@ -7168,10 +7168,10 @@ const Oi = {
|
|
|
7168
7168
|
style: {
|
|
7169
7169
|
border: `1px solid ${dr}`,
|
|
7170
7170
|
borderRadius: 999,
|
|
7171
|
-
background:
|
|
7172
|
-
color:
|
|
7171
|
+
background: Ue("#ffffff", 0.92),
|
|
7172
|
+
color: Rt,
|
|
7173
7173
|
padding: "7px 12px",
|
|
7174
|
-
fontSize:
|
|
7174
|
+
fontSize: Se.xs,
|
|
7175
7175
|
fontWeight: 700,
|
|
7176
7176
|
cursor: "pointer",
|
|
7177
7177
|
whiteSpace: "nowrap"
|
|
@@ -7224,7 +7224,7 @@ const Oi = {
|
|
|
7224
7224
|
width: 28,
|
|
7225
7225
|
height: 28,
|
|
7226
7226
|
borderRadius: "6px",
|
|
7227
|
-
background:
|
|
7227
|
+
background: Ue(Ve, 0.06),
|
|
7228
7228
|
flexShrink: 0
|
|
7229
7229
|
}
|
|
7230
7230
|
}
|
|
@@ -7246,7 +7246,7 @@ const Oi = {
|
|
|
7246
7246
|
maxWidth: "100%",
|
|
7247
7247
|
height: 40,
|
|
7248
7248
|
borderRadius: "6px",
|
|
7249
|
-
background:
|
|
7249
|
+
background: Ue(Ve, 0.06),
|
|
7250
7250
|
backgroundSize: "200% 100%",
|
|
7251
7251
|
animation: "admeshShimmer 1.4s ease-in-out infinite",
|
|
7252
7252
|
boxShadow: "none",
|
|
@@ -7264,7 +7264,7 @@ const Oi = {
|
|
|
7264
7264
|
width: 28,
|
|
7265
7265
|
height: 28,
|
|
7266
7266
|
borderRadius: "6px",
|
|
7267
|
-
background:
|
|
7267
|
+
background: Ue(Ve, 0.06),
|
|
7268
7268
|
flexShrink: 0
|
|
7269
7269
|
}
|
|
7270
7270
|
}
|
|
@@ -7286,10 +7286,10 @@ const Oi = {
|
|
|
7286
7286
|
maxWidth: "100%",
|
|
7287
7287
|
height: n === "publisher" ? 40 : 52,
|
|
7288
7288
|
borderRadius: 999,
|
|
7289
|
-
background: `linear-gradient(90deg, ${
|
|
7289
|
+
background: `linear-gradient(90deg, ${Ue(Qe, 0.08)} 0%, ${Ue(Qe, 0.18)} 50%, ${Ue(Qe, 0.08)} 100%)`,
|
|
7290
7290
|
backgroundSize: "200% 100%",
|
|
7291
7291
|
animation: "admeshShimmer 1.4s ease-in-out infinite",
|
|
7292
|
-
boxShadow: n === "publisher" ? `0 8px 22px ${
|
|
7292
|
+
boxShadow: n === "publisher" ? `0 8px 22px ${Ue(Qe, 0.08)}` : "none"
|
|
7293
7293
|
}
|
|
7294
7294
|
},
|
|
7295
7295
|
`suggestion-skeleton-${_}`
|
|
@@ -7298,12 +7298,12 @@ const Oi = {
|
|
|
7298
7298
|
);
|
|
7299
7299
|
}
|
|
7300
7300
|
function mo(n = Me) {
|
|
7301
|
-
if (
|
|
7301
|
+
if (ye) return null;
|
|
7302
7302
|
if (sn)
|
|
7303
7303
|
return Nn("publisher");
|
|
7304
|
-
if (!
|
|
7305
|
-
const b = n && tr, x =
|
|
7306
|
-
return
|
|
7304
|
+
if (!Oe.length) return null;
|
|
7305
|
+
const b = n && tr, x = Oe.slice(0, Q);
|
|
7306
|
+
return H === "stacked" ? /* @__PURE__ */ i(
|
|
7307
7307
|
"div",
|
|
7308
7308
|
{
|
|
7309
7309
|
style: {
|
|
@@ -7337,7 +7337,7 @@ const Oi = {
|
|
|
7337
7337
|
borderRadius: "8px",
|
|
7338
7338
|
border: `1px solid ${_.is_sponsored ? Qe : ft}`,
|
|
7339
7339
|
background: _.is_sponsored ? Qe : ht,
|
|
7340
|
-
color: _.is_sponsored ? vn :
|
|
7340
|
+
color: _.is_sponsored ? vn : Ve,
|
|
7341
7341
|
padding: n ? "8px 10px" : "10px 14px",
|
|
7342
7342
|
fontSize: n ? "12px" : "13px",
|
|
7343
7343
|
fontWeight: 500,
|
|
@@ -7354,7 +7354,7 @@ const Oi = {
|
|
|
7354
7354
|
style: {
|
|
7355
7355
|
flexShrink: 0,
|
|
7356
7356
|
borderRadius: "6px",
|
|
7357
|
-
background:
|
|
7357
|
+
background: Ue("#ffffff", 0.18),
|
|
7358
7358
|
padding: "2px 6px",
|
|
7359
7359
|
fontSize: "10px",
|
|
7360
7360
|
fontWeight: 700
|
|
@@ -7421,7 +7421,7 @@ const Oi = {
|
|
|
7421
7421
|
borderRadius: "6px",
|
|
7422
7422
|
border: `1px solid ${_.is_sponsored ? Qe : ft}`,
|
|
7423
7423
|
background: _.is_sponsored ? Qe : ht,
|
|
7424
|
-
color: _.is_sponsored ? vn :
|
|
7424
|
+
color: _.is_sponsored ? vn : Ve,
|
|
7425
7425
|
padding: b ? "4px 8px" : pt ? "5px 8px" : n ? "7px 10px" : "8px 14px",
|
|
7426
7426
|
fontSize: b ? "10px" : pt ? "11px" : n ? "12px" : "13px",
|
|
7427
7427
|
fontWeight: 500,
|
|
@@ -7502,10 +7502,10 @@ const Oi = {
|
|
|
7502
7502
|
});
|
|
7503
7503
|
},
|
|
7504
7504
|
style: {
|
|
7505
|
-
color:
|
|
7506
|
-
fontSize:
|
|
7505
|
+
color: Rt,
|
|
7506
|
+
fontSize: Se.xs,
|
|
7507
7507
|
textDecoration: "none",
|
|
7508
|
-
borderBottom: `1px solid ${
|
|
7508
|
+
borderBottom: `1px solid ${Ue(Qe, 0.18)}`
|
|
7509
7509
|
},
|
|
7510
7510
|
children: [
|
|
7511
7511
|
_.title || _.url,
|
|
@@ -7560,7 +7560,7 @@ const Oi = {
|
|
|
7560
7560
|
padding: b ? "10px" : "14px",
|
|
7561
7561
|
borderRadius: "8px",
|
|
7562
7562
|
textDecoration: "none",
|
|
7563
|
-
color:
|
|
7563
|
+
color: Ve,
|
|
7564
7564
|
border: `1px solid ${ft}`,
|
|
7565
7565
|
background: ht,
|
|
7566
7566
|
boxShadow: "none",
|
|
@@ -7579,7 +7579,7 @@ const Oi = {
|
|
|
7579
7579
|
fontSize: b ? "12px" : "14px",
|
|
7580
7580
|
fontWeight: 650,
|
|
7581
7581
|
lineHeight: 1.35,
|
|
7582
|
-
color:
|
|
7582
|
+
color: Ve,
|
|
7583
7583
|
overflowWrap: "anywhere"
|
|
7584
7584
|
},
|
|
7585
7585
|
children: _.title || _.url
|
|
@@ -7619,7 +7619,7 @@ const Oi = {
|
|
|
7619
7619
|
overscrollBehavior: "contain",
|
|
7620
7620
|
WebkitOverflowScrolling: "touch",
|
|
7621
7621
|
scrollbarWidth: "thin",
|
|
7622
|
-
padding: n ? "0 2px 4px" :
|
|
7622
|
+
padding: n ? "0 2px 4px" : q ? "16px 16px 8px" : 0
|
|
7623
7623
|
},
|
|
7624
7624
|
children: [
|
|
7625
7625
|
Fe.map((x) => {
|
|
@@ -7627,10 +7627,10 @@ const Oi = {
|
|
|
7627
7627
|
return /* @__PURE__ */ i(
|
|
7628
7628
|
"div",
|
|
7629
7629
|
{
|
|
7630
|
-
ref: _ ?
|
|
7630
|
+
ref: _ ? Mt : void 0,
|
|
7631
7631
|
style: { marginBottom: n ? "16px" : "28px", textAlign: x.role === "user" ? "right" : "left" },
|
|
7632
7632
|
children: (() => {
|
|
7633
|
-
const
|
|
7633
|
+
const j = !!x.content.trim() || !ye;
|
|
7634
7634
|
return /* @__PURE__ */ i(dt, { children: /* @__PURE__ */ E(
|
|
7635
7635
|
"div",
|
|
7636
7636
|
{
|
|
@@ -7640,45 +7640,47 @@ const Oi = {
|
|
|
7640
7640
|
maxWidth: x.role === "assistant" ? "100%" : "76%",
|
|
7641
7641
|
padding: x.role === "assistant" ? "4px 6px 4px 2px" : "10px 14px",
|
|
7642
7642
|
borderRadius: x.role === "assistant" ? 0 : "8px",
|
|
7643
|
-
background: x.role === "user" ?
|
|
7644
|
-
color:
|
|
7643
|
+
background: x.role === "user" ? Ue(Ve, 0.05) : "transparent",
|
|
7644
|
+
color: Ve,
|
|
7645
7645
|
boxShadow: "none",
|
|
7646
7646
|
border: "none",
|
|
7647
7647
|
fontSize: x.role === "assistant" ? b : n ? "12px" : "13px",
|
|
7648
|
-
lineHeight: x.role === "assistant" ? 1.62 : 1.4
|
|
7648
|
+
lineHeight: x.role === "assistant" ? 1.62 : 1.4,
|
|
7649
|
+
textAlign: "left",
|
|
7650
|
+
overflowWrap: "anywhere"
|
|
7649
7651
|
},
|
|
7650
7652
|
children: [
|
|
7651
|
-
x.role === "assistant" ? x.content.trim() ? /* @__PURE__ */ i(jn, { content: x.content, theme: { ...I, textColor:
|
|
7653
|
+
x.role === "assistant" ? x.content.trim() ? /* @__PURE__ */ i(jn, { content: x.content, theme: { ...I, textColor: Ve }, fontSize: b }) : ye && x.id === nt.current ? pn({ includeSteps: !0 }) : null : /* @__PURE__ */ i("p", { style: { margin: 0, color: Ve }, children: x.content }),
|
|
7652
7654
|
x.role === "assistant" && po(x),
|
|
7653
7655
|
x.role === "assistant" && ho(x, n),
|
|
7654
7656
|
x.role === "assistant" && Dn(x),
|
|
7655
|
-
x.role === "assistant" &&
|
|
7657
|
+
x.role === "assistant" && j && At.has(x.id) && x.initialRecommendation && /* @__PURE__ */ i("div", { "data-admesh-ad-content": !0, style: { marginTop: "14px" }, children: /* @__PURE__ */ i(
|
|
7656
7658
|
fn,
|
|
7657
7659
|
{
|
|
7658
7660
|
messageId: x.id,
|
|
7659
7661
|
query: x.userQuery,
|
|
7660
7662
|
initialRecommendation: x.initialRecommendation,
|
|
7661
7663
|
onFollowupDetected: mn,
|
|
7662
|
-
onRecommendationsShown: (
|
|
7663
|
-
cn(
|
|
7664
|
+
onRecommendationsShown: (ue, $e) => {
|
|
7665
|
+
cn(ue, $e, x.userQuery);
|
|
7664
7666
|
},
|
|
7665
|
-
onError: (
|
|
7666
|
-
console.error("[AdMeshIntentAssistant] Recommendation error:",
|
|
7667
|
+
onError: (ue) => {
|
|
7668
|
+
console.error("[AdMeshIntentAssistant] Recommendation error:", ue);
|
|
7667
7669
|
}
|
|
7668
7670
|
}
|
|
7669
7671
|
) }),
|
|
7670
|
-
x.role === "assistant" &&
|
|
7672
|
+
x.role === "assistant" && j && !At.has(x.id) && (x.initialRecommendation || Jr) && /* @__PURE__ */ i("div", { "data-admesh-ad-content": !0, style: { marginTop: "14px" }, children: /* @__PURE__ */ i(
|
|
7671
7673
|
fn,
|
|
7672
7674
|
{
|
|
7673
7675
|
messageId: x.id,
|
|
7674
7676
|
query: x.userQuery,
|
|
7675
7677
|
initialRecommendation: x.initialRecommendation || void 0,
|
|
7676
7678
|
onFollowupDetected: mn,
|
|
7677
|
-
onRecommendationsShown: (
|
|
7678
|
-
cn(
|
|
7679
|
+
onRecommendationsShown: (ue, $e) => {
|
|
7680
|
+
cn(ue, $e, x.userQuery);
|
|
7679
7681
|
},
|
|
7680
|
-
onError: (
|
|
7681
|
-
console.error("[AdMeshIntentAssistant] Recommendation error:",
|
|
7682
|
+
onError: (ue) => {
|
|
7683
|
+
console.error("[AdMeshIntentAssistant] Recommendation error:", ue);
|
|
7682
7684
|
}
|
|
7683
7685
|
}
|
|
7684
7686
|
) })
|
|
@@ -7690,8 +7692,8 @@ const Oi = {
|
|
|
7690
7692
|
x.id
|
|
7691
7693
|
);
|
|
7692
7694
|
}),
|
|
7693
|
-
|
|
7694
|
-
/* @__PURE__ */ i("div", { ref:
|
|
7695
|
+
zt && /* @__PURE__ */ i("div", { role: "alert", style: { color: Ve, fontSize: Se.sm, border: `1px solid ${ft}`, borderLeft: "3px solid #b45309", borderRadius: "6px", padding: "12px" }, children: "Unable to complete the answer. Please try again." }),
|
|
7696
|
+
/* @__PURE__ */ i("div", { ref: It })
|
|
7695
7697
|
]
|
|
7696
7698
|
}
|
|
7697
7699
|
);
|
|
@@ -7707,33 +7709,33 @@ const Oi = {
|
|
|
7707
7709
|
document.body
|
|
7708
7710
|
);
|
|
7709
7711
|
}, b = function(_ = !1) {
|
|
7710
|
-
const T =
|
|
7712
|
+
const T = xe(_), j = _ || T && q, ue = !j && G === "input", $e = T && !j && tr, Ke = j && !(Me && m === "expand" && !_ && on), fe = j ? $r(xn) : null, Re = !!(fe && xn && !T), He = T ? Bt : fe ? fe.panelWidth : w === "inline" ? "100%" : "min(420px, calc(100vw - 32px))", Ut = T ? an : fe ? fe.panelHeight : "auto", Xe = T ? Bt : (fe == null ? void 0 : fe.panelMaxWidth) ?? "100%", ot = T ? an : fe == null ? void 0 : fe.panelMaxHeight, Ht = c && !$e && j;
|
|
7711
7713
|
return /* @__PURE__ */ E(
|
|
7712
7714
|
"div",
|
|
7713
7715
|
{
|
|
7714
7716
|
className: "admesh-publisher-panel",
|
|
7715
7717
|
"data-compact": T ? "true" : "false",
|
|
7716
7718
|
style: {
|
|
7717
|
-
"--publisher-accent":
|
|
7718
|
-
color:
|
|
7719
|
-
width:
|
|
7720
|
-
maxWidth:
|
|
7721
|
-
height:
|
|
7722
|
-
maxHeight:
|
|
7719
|
+
"--publisher-accent": Rt,
|
|
7720
|
+
color: Ve,
|
|
7721
|
+
width: He,
|
|
7722
|
+
maxWidth: Xe,
|
|
7723
|
+
height: Ut,
|
|
7724
|
+
maxHeight: ot,
|
|
7723
7725
|
boxSizing: "border-box",
|
|
7724
7726
|
display: "flex",
|
|
7725
7727
|
flexDirection: "column",
|
|
7726
|
-
background:
|
|
7727
|
-
borderRadius: !T &&
|
|
7728
|
-
padding:
|
|
7729
|
-
boxShadow:
|
|
7730
|
-
border:
|
|
7728
|
+
background: j ? Pn : io,
|
|
7729
|
+
borderRadius: !T && fe ? fe.panelBorderRadius : "12px",
|
|
7730
|
+
padding: j ? 0 : T ? "6px" : 0,
|
|
7731
|
+
boxShadow: Re ? "none" : j ? pr : "none",
|
|
7732
|
+
border: Re || ue ? "none" : `1px solid ${ur}`,
|
|
7731
7733
|
overflow: "hidden",
|
|
7732
7734
|
minHeight: T ? 0 : void 0
|
|
7733
7735
|
},
|
|
7734
7736
|
children: [
|
|
7735
7737
|
/* @__PURE__ */ i("style", { children: Yr }),
|
|
7736
|
-
|
|
7738
|
+
Ht && /* @__PURE__ */ E(
|
|
7737
7739
|
"div",
|
|
7738
7740
|
{
|
|
7739
7741
|
style: {
|
|
@@ -7742,7 +7744,7 @@ const Oi = {
|
|
|
7742
7744
|
justifyContent: "space-between",
|
|
7743
7745
|
padding: T ? "8px 10px" : "14px 20px",
|
|
7744
7746
|
background: zn,
|
|
7745
|
-
color:
|
|
7747
|
+
color: Ve,
|
|
7746
7748
|
borderBottom: `1px solid ${Zt}`,
|
|
7747
7749
|
flexShrink: 0
|
|
7748
7750
|
},
|
|
@@ -7756,13 +7758,13 @@ const Oi = {
|
|
|
7756
7758
|
height: T ? 26 : 32,
|
|
7757
7759
|
flexShrink: 0,
|
|
7758
7760
|
borderRadius: "6px",
|
|
7759
|
-
background:
|
|
7761
|
+
background: Ue(Ve, 0.04),
|
|
7760
7762
|
display: "flex",
|
|
7761
7763
|
alignItems: "center",
|
|
7762
7764
|
justifyContent: "center",
|
|
7763
7765
|
fontSize: 16,
|
|
7764
7766
|
fontWeight: 700,
|
|
7765
|
-
color:
|
|
7767
|
+
color: Rt,
|
|
7766
7768
|
overflow: "hidden"
|
|
7767
7769
|
},
|
|
7768
7770
|
children: l ? /* @__PURE__ */ i("img", { src: l, alt: `${a || "Assistant"} logo`, style: { width: "100%", height: "100%", objectFit: "contain", background: ht, padding: 4 } }) : /* @__PURE__ */ i(Kn, { size: T ? 14 : 17, strokeWidth: 1.5, "aria-hidden": "true" })
|
|
@@ -7773,7 +7775,7 @@ const Oi = {
|
|
|
7773
7775
|
f && /* @__PURE__ */ i("div", { style: { fontSize: T ? "10px" : "12px", color: $n, marginTop: "2px" }, children: mr })
|
|
7774
7776
|
] })
|
|
7775
7777
|
] }),
|
|
7776
|
-
|
|
7778
|
+
j && (!T || _) && /* @__PURE__ */ i(
|
|
7777
7779
|
"button",
|
|
7778
7780
|
{
|
|
7779
7781
|
type: "button",
|
|
@@ -7803,53 +7805,53 @@ const Oi = {
|
|
|
7803
7805
|
style: {
|
|
7804
7806
|
display: "flex",
|
|
7805
7807
|
flexDirection: "column",
|
|
7806
|
-
gap:
|
|
7808
|
+
gap: $e ? "2px" : T ? "6px" : "16px",
|
|
7807
7809
|
minHeight: 0,
|
|
7808
|
-
flex: T ||
|
|
7809
|
-
overflow: T ||
|
|
7810
|
+
flex: T || j ? "1 1 0" : void 0,
|
|
7811
|
+
overflow: T || j ? "hidden" : void 0,
|
|
7810
7812
|
overscrollBehavior: "contain",
|
|
7811
|
-
padding:
|
|
7812
|
-
justifyContent:
|
|
7813
|
+
padding: ue ? T ? "4px" : "8px" : T ? "8px" : "20px",
|
|
7814
|
+
justifyContent: j ? void 0 : "center",
|
|
7813
7815
|
background: Pn
|
|
7814
7816
|
},
|
|
7815
7817
|
children: [
|
|
7816
7818
|
fr("default"),
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
T && !
|
|
7820
|
-
T && !
|
|
7819
|
+
Ke && fo(T),
|
|
7820
|
+
!ue && /* @__PURE__ */ E(dt, { children: [
|
|
7821
|
+
T && !j && !$e && /* @__PURE__ */ i("div", { "aria-hidden": "true", style: { flex: "1 1 auto", minHeight: 0 } }),
|
|
7822
|
+
T && !j && z && M && Fe.length === 0 && /* @__PURE__ */ i("div", { style: { fontSize: 15, fontWeight: 600, textAlign: "center" }, children: $ }),
|
|
7821
7823
|
mo(T)
|
|
7822
7824
|
] }),
|
|
7823
|
-
(
|
|
7825
|
+
(ue || !T || j || u) && /* @__PURE__ */ i(
|
|
7824
7826
|
Di,
|
|
7825
7827
|
{
|
|
7826
7828
|
value: Ie,
|
|
7827
|
-
onChange:
|
|
7828
|
-
open:
|
|
7829
|
-
onOpenChange:
|
|
7830
|
-
suggestions:
|
|
7829
|
+
onChange: St,
|
|
7830
|
+
open: ue && ct && !q,
|
|
7831
|
+
onOpenChange: ue ? Pt : Fi,
|
|
7832
|
+
suggestions: Oe.slice(0, Q),
|
|
7831
7833
|
registerSuggestion: dn,
|
|
7832
|
-
loading:
|
|
7834
|
+
loading: ye,
|
|
7833
7835
|
analyzing: sn,
|
|
7834
7836
|
compact: T,
|
|
7835
|
-
expanded:
|
|
7836
|
-
showLogo: !
|
|
7837
|
+
expanded: j,
|
|
7838
|
+
showLogo: !j,
|
|
7837
7839
|
suggestionPlacement: re,
|
|
7838
7840
|
logoUrl: l,
|
|
7839
7841
|
title: a,
|
|
7840
7842
|
placeholder: C,
|
|
7841
|
-
colors: { accent:
|
|
7843
|
+
colors: { accent: Rt, accentText: vn, surface: hr, text: Ve, muted: Jt, border: ft },
|
|
7842
7844
|
onStop: Rn,
|
|
7843
7845
|
onSend: () => {
|
|
7844
|
-
tt.current = null,
|
|
7846
|
+
tt.current = null, Ct.current = !1, ut(!0), w === "floating" && qt(!0), Qt(Ie);
|
|
7845
7847
|
},
|
|
7846
|
-
onSuggestion: (
|
|
7847
|
-
ut(!0), w === "floating" && qt(!0), un(
|
|
7848
|
+
onSuggestion: (xt) => {
|
|
7849
|
+
ut(!0), w === "floating" && qt(!0), un(xt);
|
|
7848
7850
|
}
|
|
7849
7851
|
}
|
|
7850
7852
|
),
|
|
7851
|
-
|
|
7852
|
-
!
|
|
7853
|
+
j && gr("default", T),
|
|
7854
|
+
!j && G === "always" && uo(T)
|
|
7853
7855
|
]
|
|
7854
7856
|
}
|
|
7855
7857
|
)
|
|
@@ -7869,14 +7871,14 @@ const Oi = {
|
|
|
7869
7871
|
{
|
|
7870
7872
|
ref: Yt,
|
|
7871
7873
|
className: "admesh-component",
|
|
7872
|
-
"data-admesh-theme":
|
|
7874
|
+
"data-admesh-theme": he,
|
|
7873
7875
|
"data-admesh-surface": "ad-slot",
|
|
7874
7876
|
"data-admesh-ad-slot-behavior": m,
|
|
7875
7877
|
"data-admesh-ad-slot-expanded": In ? "true" : "false",
|
|
7876
7878
|
style: {
|
|
7877
|
-
width:
|
|
7879
|
+
width: Bt,
|
|
7878
7880
|
height: an,
|
|
7879
|
-
maxWidth:
|
|
7881
|
+
maxWidth: Bt,
|
|
7880
7882
|
maxHeight: an,
|
|
7881
7883
|
position: "relative",
|
|
7882
7884
|
overflow: "hidden"
|
|
@@ -7886,11 +7888,11 @@ const Oi = {
|
|
|
7886
7888
|
on && typeof document < "u" && n(b(!0))
|
|
7887
7889
|
]
|
|
7888
7890
|
}
|
|
7889
|
-
) : /* @__PURE__ */ E("div", { className: "admesh-component", "data-admesh-theme":
|
|
7891
|
+
) : /* @__PURE__ */ E("div", { className: "admesh-component", "data-admesh-theme": he, style: { width: "100%", position: "relative" }, children: [
|
|
7890
7892
|
b(!1),
|
|
7891
|
-
|
|
7892
|
-
] }) : Le ? /* @__PURE__ */ E("div", { className: "admesh-component", "data-admesh-theme":
|
|
7893
|
-
!
|
|
7893
|
+
q && typeof document < "u" && n(b(!0))
|
|
7894
|
+
] }) : Le ? /* @__PURE__ */ E("div", { className: "admesh-component", "data-admesh-theme": he, children: [
|
|
7895
|
+
!q && /* @__PURE__ */ i(
|
|
7894
7896
|
"div",
|
|
7895
7897
|
{
|
|
7896
7898
|
style: {
|
|
@@ -7901,8 +7903,8 @@ const Oi = {
|
|
|
7901
7903
|
children: b(!1)
|
|
7902
7904
|
}
|
|
7903
7905
|
),
|
|
7904
|
-
|
|
7905
|
-
] }) : /* @__PURE__ */ i("div", { className: "admesh-component", "data-admesh-theme":
|
|
7906
|
+
q && typeof document < "u" && n(b(!0))
|
|
7907
|
+
] }) : /* @__PURE__ */ i("div", { className: "admesh-component", "data-admesh-theme": he, children: /* @__PURE__ */ E(
|
|
7906
7908
|
"button",
|
|
7907
7909
|
{
|
|
7908
7910
|
type: "button",
|
|
@@ -7931,14 +7933,14 @@ const Oi = {
|
|
|
7931
7933
|
}
|
|
7932
7934
|
) });
|
|
7933
7935
|
}
|
|
7934
|
-
return
|
|
7936
|
+
return Oe.length === 0 && !sn ? (console.log("[AdMeshIntentAssistant] No suggestions available - not rendering"), null) : w === "inline" ? /* @__PURE__ */ i("div", { className: "admesh-component", "data-admesh-theme": he, children: /* @__PURE__ */ i(
|
|
7935
7937
|
"div",
|
|
7936
7938
|
{
|
|
7937
7939
|
className: `overflow-hidden rounded-[2rem] ${e || ""}`,
|
|
7938
7940
|
style: {
|
|
7939
7941
|
width: gn(h) ?? "100%",
|
|
7940
7942
|
backgroundColor: "#eef2ff",
|
|
7941
|
-
fontSize:
|
|
7943
|
+
fontSize: Se.base,
|
|
7942
7944
|
...r
|
|
7943
7945
|
},
|
|
7944
7946
|
children: /* @__PURE__ */ E(
|
|
@@ -7947,7 +7949,7 @@ const Oi = {
|
|
|
7947
7949
|
className: "space-y-4 rounded-[1.75rem] p-4",
|
|
7948
7950
|
style: { backgroundColor: "rgba(255, 255, 255, 0.35)" },
|
|
7949
7951
|
children: [
|
|
7950
|
-
sn ? Nn("legacy") :
|
|
7952
|
+
sn ? Nn("legacy") : Oe.length > 0 && /* @__PURE__ */ i("div", { className: "flex flex-col gap-3", children: Oe.slice(0, Q).map((n, b) => /* @__PURE__ */ E(
|
|
7951
7953
|
"button",
|
|
7952
7954
|
{
|
|
7953
7955
|
ref: dn(n.id),
|
|
@@ -7958,7 +7960,7 @@ const Oi = {
|
|
|
7958
7960
|
backgroundColor: I.surfaceColor || "#ffffff",
|
|
7959
7961
|
color: I.textColor || "#1e293b",
|
|
7960
7962
|
border: `1px solid ${I.borderColor || "#e2e8f0"}`,
|
|
7961
|
-
fontSize:
|
|
7963
|
+
fontSize: Se.sm
|
|
7962
7964
|
},
|
|
7963
7965
|
children: [
|
|
7964
7966
|
/* @__PURE__ */ i("span", { className: "leading-tight", children: n.text }),
|
|
@@ -7991,7 +7993,7 @@ const Oi = {
|
|
|
7991
7993
|
return /* @__PURE__ */ i(
|
|
7992
7994
|
"div",
|
|
7993
7995
|
{
|
|
7994
|
-
ref: b ?
|
|
7996
|
+
ref: b ? Mt : void 0,
|
|
7995
7997
|
className: n.role === "user" ? "text-right" : "text-left",
|
|
7996
7998
|
children: /* @__PURE__ */ i(
|
|
7997
7999
|
"div",
|
|
@@ -8000,15 +8002,17 @@ const Oi = {
|
|
|
8000
8002
|
style: {
|
|
8001
8003
|
backgroundColor: n.role === "user" ? I.primaryColor : "#ffffff",
|
|
8002
8004
|
color: n.role === "user" ? I.primaryTextColor || "#ffffff" : I.textColor,
|
|
8003
|
-
fontSize:
|
|
8005
|
+
fontSize: Se.sm,
|
|
8006
|
+
textAlign: "left",
|
|
8007
|
+
overflowWrap: "anywhere"
|
|
8004
8008
|
},
|
|
8005
8009
|
children: n.role === "assistant" ? n.content.trim() ? /* @__PURE__ */ E(dt, { children: [
|
|
8006
|
-
/* @__PURE__ */ i(jn, { content: n.content, theme: I, fontSize:
|
|
8010
|
+
/* @__PURE__ */ i(jn, { content: n.content, theme: I, fontSize: Se.sm }),
|
|
8007
8011
|
Dn(n, {
|
|
8008
8012
|
accentColor: I.primaryColor,
|
|
8009
8013
|
metaColor: I.textSecondaryColor
|
|
8010
8014
|
})
|
|
8011
|
-
] }) :
|
|
8015
|
+
] }) : ye && n.id === nt.current ? pn({
|
|
8012
8016
|
compact: !0,
|
|
8013
8017
|
accentColor: I.primaryColor,
|
|
8014
8018
|
metaColor: I.textSecondaryColor,
|
|
@@ -8020,7 +8024,7 @@ const Oi = {
|
|
|
8020
8024
|
n.id
|
|
8021
8025
|
);
|
|
8022
8026
|
}),
|
|
8023
|
-
|
|
8027
|
+
ye && !Fe.some(
|
|
8024
8028
|
(n) => n.role === "assistant" && n.id === nt.current && !n.content.trim()
|
|
8025
8029
|
) && /* @__PURE__ */ i("div", { className: "text-sm", style: { color: I.textSecondaryColor }, children: pn({
|
|
8026
8030
|
compact: !0,
|
|
@@ -8028,8 +8032,8 @@ const Oi = {
|
|
|
8028
8032
|
metaColor: I.textSecondaryColor,
|
|
8029
8033
|
includeSteps: !1
|
|
8030
8034
|
}) }),
|
|
8031
|
-
|
|
8032
|
-
/* @__PURE__ */ i("div", { ref:
|
|
8035
|
+
zt && /* @__PURE__ */ i("div", { className: "text-sm", style: { color: I.textSecondaryColor }, children: "Connection issue. Please try again." }),
|
|
8036
|
+
/* @__PURE__ */ i("div", { ref: It })
|
|
8033
8037
|
]
|
|
8034
8038
|
}
|
|
8035
8039
|
),
|
|
@@ -8039,10 +8043,10 @@ const Oi = {
|
|
|
8039
8043
|
{
|
|
8040
8044
|
type: "text",
|
|
8041
8045
|
value: Ie,
|
|
8042
|
-
onChange: (n) =>
|
|
8046
|
+
onChange: (n) => St(n.target.value),
|
|
8043
8047
|
onKeyPress: (n) => {
|
|
8044
8048
|
if (n.key === "Enter") {
|
|
8045
|
-
if (
|
|
8049
|
+
if (ye) {
|
|
8046
8050
|
n.preventDefault();
|
|
8047
8051
|
return;
|
|
8048
8052
|
}
|
|
@@ -8054,7 +8058,7 @@ const Oi = {
|
|
|
8054
8058
|
style: {
|
|
8055
8059
|
backgroundColor: I.backgroundColor || "#ffffff",
|
|
8056
8060
|
color: I.textColor,
|
|
8057
|
-
fontSize:
|
|
8061
|
+
fontSize: Se.sm
|
|
8058
8062
|
}
|
|
8059
8063
|
}
|
|
8060
8064
|
),
|
|
@@ -8062,24 +8066,24 @@ const Oi = {
|
|
|
8062
8066
|
"button",
|
|
8063
8067
|
{
|
|
8064
8068
|
onClick: () => {
|
|
8065
|
-
if (
|
|
8069
|
+
if (ye) {
|
|
8066
8070
|
Rn();
|
|
8067
8071
|
return;
|
|
8068
8072
|
}
|
|
8069
8073
|
Qt(Ie);
|
|
8070
8074
|
},
|
|
8071
|
-
disabled: !
|
|
8075
|
+
disabled: !ye && !Ie.trim(),
|
|
8072
8076
|
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
8073
8077
|
style: {
|
|
8074
|
-
backgroundColor:
|
|
8078
|
+
backgroundColor: ye ? "#dc2626" : I.primaryColor,
|
|
8075
8079
|
color: "#ffffff"
|
|
8076
8080
|
},
|
|
8077
|
-
children:
|
|
8081
|
+
children: ye ? /* @__PURE__ */ i(Fn, { size: 18 }) : /* @__PURE__ */ i(_r, { size: 18 })
|
|
8078
8082
|
}
|
|
8079
8083
|
)
|
|
8080
8084
|
] }) }),
|
|
8081
8085
|
/* @__PURE__ */ E("div", { className: "space-y-2 text-center", children: [
|
|
8082
|
-
/* @__PURE__ */ E("p", { style: { color: I.textSecondaryColor, fontSize:
|
|
8086
|
+
/* @__PURE__ */ E("p", { style: { color: I.textSecondaryColor, fontSize: Se.xs, fontWeight: 600 }, children: [
|
|
8083
8087
|
"Powered by",
|
|
8084
8088
|
" ",
|
|
8085
8089
|
/* @__PURE__ */ i(
|
|
@@ -8093,13 +8097,13 @@ const Oi = {
|
|
|
8093
8097
|
}
|
|
8094
8098
|
)
|
|
8095
8099
|
] }),
|
|
8096
|
-
/* @__PURE__ */ i("p", { style: { color: I.textSecondaryColor, fontSize:
|
|
8100
|
+
/* @__PURE__ */ i("p", { style: { color: I.textSecondaryColor, fontSize: Se.xs, lineHeight: 1.5 }, children: ar })
|
|
8097
8101
|
] })
|
|
8098
8102
|
]
|
|
8099
8103
|
}
|
|
8100
8104
|
)
|
|
8101
8105
|
}
|
|
8102
|
-
) }) : Le ? /* @__PURE__ */ i("div", { className: "admesh-component", "data-admesh-theme":
|
|
8106
|
+
) }) : Le ? /* @__PURE__ */ i("div", { className: "admesh-component", "data-admesh-theme": he, children: /* @__PURE__ */ E(
|
|
8103
8107
|
"div",
|
|
8104
8108
|
{
|
|
8105
8109
|
className: `flex flex-col overflow-hidden ${e || ""}`,
|
|
@@ -8107,7 +8111,7 @@ const Oi = {
|
|
|
8107
8111
|
position: "fixed",
|
|
8108
8112
|
display: "flex",
|
|
8109
8113
|
flexDirection: "column",
|
|
8110
|
-
...
|
|
8114
|
+
...q ? {
|
|
8111
8115
|
top: "50%",
|
|
8112
8116
|
left: "50%",
|
|
8113
8117
|
transform: "translate(-50%, -50%)",
|
|
@@ -8120,12 +8124,12 @@ const Oi = {
|
|
|
8120
8124
|
width: gn(h) ?? ir.width,
|
|
8121
8125
|
height: gn(p) ?? ir.height
|
|
8122
8126
|
},
|
|
8123
|
-
backgroundColor:
|
|
8127
|
+
backgroundColor: q ? Pn : I.backgroundColor,
|
|
8124
8128
|
zIndex: 9999,
|
|
8125
|
-
fontSize:
|
|
8126
|
-
borderRadius:
|
|
8127
|
-
border:
|
|
8128
|
-
boxShadow:
|
|
8129
|
+
fontSize: Se.base,
|
|
8130
|
+
borderRadius: q ? "20px" : "16px",
|
|
8131
|
+
border: q ? `1px solid ${ur}` : "1px solid transparent",
|
|
8132
|
+
boxShadow: q ? pr : "0 20px 40px rgba(15, 23, 42, 0.12)",
|
|
8129
8133
|
...r
|
|
8130
8134
|
},
|
|
8131
8135
|
children: [
|
|
@@ -8137,9 +8141,9 @@ const Oi = {
|
|
|
8137
8141
|
position: "sticky",
|
|
8138
8142
|
top: 0,
|
|
8139
8143
|
zIndex: 10,
|
|
8140
|
-
borderColor:
|
|
8141
|
-
background:
|
|
8142
|
-
padding:
|
|
8144
|
+
borderColor: q ? Zt : "transparent",
|
|
8145
|
+
background: q ? zn : I.backgroundColor,
|
|
8146
|
+
padding: q ? "18px 20px" : "16px"
|
|
8143
8147
|
},
|
|
8144
8148
|
children: [
|
|
8145
8149
|
/* @__PURE__ */ E("div", { className: "flex items-center gap-3", children: [
|
|
@@ -8147,15 +8151,15 @@ const Oi = {
|
|
|
8147
8151
|
"div",
|
|
8148
8152
|
{
|
|
8149
8153
|
style: {
|
|
8150
|
-
width:
|
|
8151
|
-
height:
|
|
8152
|
-
borderRadius:
|
|
8153
|
-
background:
|
|
8154
|
-
color:
|
|
8154
|
+
width: q ? 40 : 32,
|
|
8155
|
+
height: q ? 40 : 32,
|
|
8156
|
+
borderRadius: q ? "14px" : "10px",
|
|
8157
|
+
background: Ue(Qe, 0.08),
|
|
8158
|
+
color: Rt,
|
|
8155
8159
|
display: "flex",
|
|
8156
8160
|
alignItems: "center",
|
|
8157
8161
|
justifyContent: "center",
|
|
8158
|
-
fontSize:
|
|
8162
|
+
fontSize: q ? "15px" : "13px",
|
|
8159
8163
|
fontWeight: 700,
|
|
8160
8164
|
flexShrink: 0,
|
|
8161
8165
|
overflow: "hidden"
|
|
@@ -8163,16 +8167,16 @@ const Oi = {
|
|
|
8163
8167
|
children: l ? /* @__PURE__ */ i("img", { src: l, alt: `${a || "Assistant"} logo`, style: { width: "100%", height: "100%", objectFit: "contain", background: "#ffffff", padding: 4 } }) : (a || "AA").slice(0, 2).toUpperCase()
|
|
8164
8168
|
}
|
|
8165
8169
|
),
|
|
8166
|
-
(y || f &&
|
|
8170
|
+
(y || f && q) && /* @__PURE__ */ E("div", { children: [
|
|
8167
8171
|
y && /* @__PURE__ */ i(
|
|
8168
8172
|
"div",
|
|
8169
8173
|
{
|
|
8170
8174
|
className: "font-medium",
|
|
8171
|
-
style: { color: I.textColor, fontSize:
|
|
8175
|
+
style: { color: I.textColor, fontSize: q ? "20px" : Se.base, fontWeight: 700, letterSpacing: q ? "-0.02em" : 0 },
|
|
8172
8176
|
children: a
|
|
8173
8177
|
}
|
|
8174
8178
|
),
|
|
8175
|
-
f &&
|
|
8179
|
+
f && q && /* @__PURE__ */ i("div", { style: { color: $n, fontSize: "12px", marginTop: "2px" }, children: mr })
|
|
8176
8180
|
] })
|
|
8177
8181
|
] }),
|
|
8178
8182
|
/* @__PURE__ */ E("div", { className: "flex items-center gap-1", children: [
|
|
@@ -8181,18 +8185,18 @@ const Oi = {
|
|
|
8181
8185
|
{
|
|
8182
8186
|
onClick: no,
|
|
8183
8187
|
className: "transition-colors",
|
|
8184
|
-
title:
|
|
8188
|
+
title: q ? "Minimize" : "Expand",
|
|
8185
8189
|
style: {
|
|
8186
|
-
width:
|
|
8187
|
-
height:
|
|
8188
|
-
borderRadius:
|
|
8189
|
-
border: `1px solid ${
|
|
8190
|
-
background:
|
|
8190
|
+
width: q ? 36 : 28,
|
|
8191
|
+
height: q ? 36 : 28,
|
|
8192
|
+
borderRadius: q ? "12px" : "10px",
|
|
8193
|
+
border: `1px solid ${q ? Zt : "transparent"}`,
|
|
8194
|
+
background: q ? "#ffffff" : "transparent",
|
|
8191
8195
|
display: "flex",
|
|
8192
8196
|
alignItems: "center",
|
|
8193
8197
|
justifyContent: "center"
|
|
8194
8198
|
},
|
|
8195
|
-
children:
|
|
8199
|
+
children: q ? /* @__PURE__ */ i(wr, { size: 16, style: { color: I.textSecondaryColor } }) : /* @__PURE__ */ i(Do, { size: 16, style: { color: I.textSecondaryColor } })
|
|
8196
8200
|
}
|
|
8197
8201
|
),
|
|
8198
8202
|
/* @__PURE__ */ i(
|
|
@@ -8201,11 +8205,11 @@ const Oi = {
|
|
|
8201
8205
|
onClick: to,
|
|
8202
8206
|
className: "transition-colors",
|
|
8203
8207
|
style: {
|
|
8204
|
-
width:
|
|
8205
|
-
height:
|
|
8206
|
-
borderRadius:
|
|
8207
|
-
border: `1px solid ${
|
|
8208
|
-
background:
|
|
8208
|
+
width: q ? 36 : 28,
|
|
8209
|
+
height: q ? 36 : 28,
|
|
8210
|
+
borderRadius: q ? "12px" : "10px",
|
|
8211
|
+
border: `1px solid ${q ? Zt : "transparent"}`,
|
|
8212
|
+
background: q ? "#ffffff" : "transparent",
|
|
8209
8213
|
display: "flex",
|
|
8210
8214
|
alignItems: "center",
|
|
8211
8215
|
justifyContent: "center"
|
|
@@ -8228,7 +8232,7 @@ const Oi = {
|
|
|
8228
8232
|
overflowY: "auto",
|
|
8229
8233
|
overscrollBehavior: "contain",
|
|
8230
8234
|
WebkitOverflowScrolling: "touch",
|
|
8231
|
-
padding:
|
|
8235
|
+
padding: q ? "20px" : "16px"
|
|
8232
8236
|
},
|
|
8233
8237
|
children: [
|
|
8234
8238
|
fr("legacy"),
|
|
@@ -8236,7 +8240,7 @@ const Oi = {
|
|
|
8236
8240
|
"div",
|
|
8237
8241
|
{
|
|
8238
8242
|
className: "inline-block p-2 rounded-lg",
|
|
8239
|
-
children: /* @__PURE__ */ i("p", { style: { color: I.textColor, margin: 0, fontSize:
|
|
8243
|
+
children: /* @__PURE__ */ i("p", { style: { color: I.textColor, margin: 0, fontSize: Se.sm }, children: $ })
|
|
8240
8244
|
}
|
|
8241
8245
|
) }),
|
|
8242
8246
|
Fe.map((n) => {
|
|
@@ -8244,8 +8248,9 @@ const Oi = {
|
|
|
8244
8248
|
return /* @__PURE__ */ E(
|
|
8245
8249
|
"div",
|
|
8246
8250
|
{
|
|
8247
|
-
ref: b ?
|
|
8251
|
+
ref: b ? Mt : void 0,
|
|
8248
8252
|
className: "mb-3",
|
|
8253
|
+
style: { textAlign: n.role === "user" ? "right" : "left" },
|
|
8249
8254
|
children: [
|
|
8250
8255
|
/* @__PURE__ */ i(
|
|
8251
8256
|
"div",
|
|
@@ -8255,32 +8260,34 @@ const Oi = {
|
|
|
8255
8260
|
backgroundColor: n.role === "user" ? so : "transparent",
|
|
8256
8261
|
color: n.role === "user" ? I.primaryTextColor || "#ffffff" : I.textColor,
|
|
8257
8262
|
border: "none",
|
|
8258
|
-
borderRadius: n.role === "user" ?
|
|
8259
|
-
padding: n.role === "user" ?
|
|
8260
|
-
boxShadow: "none"
|
|
8263
|
+
borderRadius: n.role === "user" ? q ? "14px" : "12px" : 0,
|
|
8264
|
+
padding: n.role === "user" ? q ? "12px 14px" : void 0 : "2px 6px 2px 2px",
|
|
8265
|
+
boxShadow: "none",
|
|
8266
|
+
textAlign: "left",
|
|
8267
|
+
overflowWrap: "anywhere"
|
|
8261
8268
|
},
|
|
8262
8269
|
children: n.role === "assistant" ? n.content.trim() ? /* @__PURE__ */ E(dt, { children: [
|
|
8263
|
-
/* @__PURE__ */ i("div", { style: { fontSize: `calc(${
|
|
8270
|
+
/* @__PURE__ */ i("div", { style: { fontSize: `calc(${Se.sm} * 1.3)`, lineHeight: 1.65 }, children: /* @__PURE__ */ i(
|
|
8264
8271
|
jn,
|
|
8265
8272
|
{
|
|
8266
8273
|
content: n.content,
|
|
8267
8274
|
theme: I,
|
|
8268
|
-
fontSize: `calc(${
|
|
8275
|
+
fontSize: `calc(${Se.sm} * 1.3)`
|
|
8269
8276
|
}
|
|
8270
8277
|
) }),
|
|
8271
8278
|
Dn(n, {
|
|
8272
8279
|
accentColor: I.primaryColor,
|
|
8273
8280
|
metaColor: I.textSecondaryColor
|
|
8274
8281
|
})
|
|
8275
|
-
] }) :
|
|
8282
|
+
] }) : ye && n.id === nt.current ? pn({
|
|
8276
8283
|
compact: !0,
|
|
8277
8284
|
accentColor: I.primaryColor,
|
|
8278
8285
|
metaColor: I.textSecondaryColor,
|
|
8279
8286
|
includeSteps: !1
|
|
8280
|
-
}) : null : /* @__PURE__ */ i("p", { style: { margin: 0, fontSize:
|
|
8287
|
+
}) : null : /* @__PURE__ */ i("p", { style: { margin: 0, fontSize: Se.sm, lineHeight: "1.4" }, children: n.content })
|
|
8281
8288
|
}
|
|
8282
8289
|
),
|
|
8283
|
-
n.role === "assistant" && !
|
|
8290
|
+
n.role === "assistant" && !At.has(n.id) && /* @__PURE__ */ i(
|
|
8284
8291
|
fn,
|
|
8285
8292
|
{
|
|
8286
8293
|
messageId: n.id,
|
|
@@ -8294,7 +8301,7 @@ const Oi = {
|
|
|
8294
8301
|
}
|
|
8295
8302
|
}
|
|
8296
8303
|
),
|
|
8297
|
-
n.role === "assistant" &&
|
|
8304
|
+
n.role === "assistant" && At.has(n.id) && n.initialRecommendation && !ye && /* @__PURE__ */ E("div", { className: "mb-4", children: [
|
|
8298
8305
|
/* @__PURE__ */ i("div", { className: "text-xs text-gray-500 mb-2 font-semibold", children: "Sponsored Recommendation" }),
|
|
8299
8306
|
/* @__PURE__ */ i(
|
|
8300
8307
|
fn,
|
|
@@ -8317,7 +8324,7 @@ const Oi = {
|
|
|
8317
8324
|
n.id
|
|
8318
8325
|
);
|
|
8319
8326
|
}),
|
|
8320
|
-
|
|
8327
|
+
ye && !Fe.some(
|
|
8321
8328
|
(n) => n.role === "assistant" && n.id === nt.current && !n.content.trim()
|
|
8322
8329
|
) && /* @__PURE__ */ i("div", { className: "mb-3", children: /* @__PURE__ */ i(
|
|
8323
8330
|
"div",
|
|
@@ -8332,7 +8339,7 @@ const Oi = {
|
|
|
8332
8339
|
})
|
|
8333
8340
|
}
|
|
8334
8341
|
) }),
|
|
8335
|
-
|
|
8342
|
+
zt && /* @__PURE__ */ i("div", { className: "mb-3", children: /* @__PURE__ */ i(
|
|
8336
8343
|
"div",
|
|
8337
8344
|
{
|
|
8338
8345
|
className: "inline-block p-2 rounded-lg border",
|
|
@@ -8342,17 +8349,17 @@ const Oi = {
|
|
|
8342
8349
|
color: I.textSecondaryColor
|
|
8343
8350
|
},
|
|
8344
8351
|
children: /* @__PURE__ */ E("div", { className: "flex items-center gap-2", children: [
|
|
8345
|
-
/* @__PURE__ */ i("span", { style: { fontSize:
|
|
8346
|
-
/* @__PURE__ */ i("span", { style: { fontSize:
|
|
8352
|
+
/* @__PURE__ */ i("span", { style: { fontSize: Se.xs }, children: "⚠️" }),
|
|
8353
|
+
/* @__PURE__ */ i("span", { style: { fontSize: Se.sm }, children: "Connection issue. Please try again." })
|
|
8347
8354
|
] })
|
|
8348
8355
|
}
|
|
8349
8356
|
) }),
|
|
8350
|
-
/* @__PURE__ */ i("div", { ref:
|
|
8357
|
+
/* @__PURE__ */ i("div", { ref: It })
|
|
8351
8358
|
]
|
|
8352
8359
|
}
|
|
8353
8360
|
),
|
|
8354
8361
|
Fe.length === 0 && sn && /* @__PURE__ */ i("div", { className: "px-4 pb-2", children: Nn("legacy") }),
|
|
8355
|
-
|
|
8362
|
+
Oe.length > 0 && Fe.length === 0 && !sn && /* @__PURE__ */ i("div", { className: "px-4 pb-2", children: /* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: Oe.slice(0, Q).map((n) => /* @__PURE__ */ E(
|
|
8356
8363
|
"button",
|
|
8357
8364
|
{
|
|
8358
8365
|
ref: dn(n.id),
|
|
@@ -8362,7 +8369,7 @@ const Oi = {
|
|
|
8362
8369
|
backgroundColor: I.surfaceColor || "#f8fafc",
|
|
8363
8370
|
color: I.textColor || "#1e293b",
|
|
8364
8371
|
border: `1px solid ${I.borderColor || "#e2e8f0"}`,
|
|
8365
|
-
fontSize:
|
|
8372
|
+
fontSize: Se.sm,
|
|
8366
8373
|
padding: "10px 12px",
|
|
8367
8374
|
borderRadius: "999px",
|
|
8368
8375
|
fontWeight: 500
|
|
@@ -8392,11 +8399,11 @@ const Oi = {
|
|
|
8392
8399
|
color: I.textSecondaryColor
|
|
8393
8400
|
}, children: [
|
|
8394
8401
|
/* @__PURE__ */ E("div", { className: "flex items-center justify-between mb-2", children: [
|
|
8395
|
-
/* @__PURE__ */ i("span", { style: { fontSize:
|
|
8402
|
+
/* @__PURE__ */ i("span", { style: { fontSize: Se.sm }, children: "Intent analysis failed" }),
|
|
8396
8403
|
/* @__PURE__ */ i(
|
|
8397
8404
|
"button",
|
|
8398
8405
|
{
|
|
8399
|
-
onClick:
|
|
8406
|
+
onClick: ze,
|
|
8400
8407
|
className: "text-xs px-2 py-1 rounded",
|
|
8401
8408
|
style: {
|
|
8402
8409
|
backgroundColor: I.primaryColor,
|
|
@@ -8406,19 +8413,19 @@ const Oi = {
|
|
|
8406
8413
|
}
|
|
8407
8414
|
)
|
|
8408
8415
|
] }),
|
|
8409
|
-
/* @__PURE__ */ i("span", { style: { fontSize:
|
|
8416
|
+
/* @__PURE__ */ i("span", { style: { fontSize: Se.xs }, children: ie })
|
|
8410
8417
|
] }) }) }),
|
|
8411
|
-
/* @__PURE__ */ E("div", { className: "p-3 border-t", style: { borderColor:
|
|
8412
|
-
/* @__PURE__ */ E("div", { className: "flex gap-2", style: { alignItems: "center", border: `1px solid ${Zt}`, borderRadius:
|
|
8418
|
+
/* @__PURE__ */ E("div", { className: "p-3 border-t", style: { borderColor: q ? Zt : "transparent", padding: q ? "18px 20px" : void 0, background: q ? zn : void 0 }, children: [
|
|
8419
|
+
/* @__PURE__ */ E("div", { className: "flex gap-2", style: { alignItems: "center", border: `1px solid ${Zt}`, borderRadius: q ? "16px" : "12px", background: hr, boxShadow: q ? lo : "none", padding: q ? "8px 8px 8px 14px" : void 0 }, children: [
|
|
8413
8420
|
/* @__PURE__ */ i(
|
|
8414
8421
|
"input",
|
|
8415
8422
|
{
|
|
8416
8423
|
type: "text",
|
|
8417
8424
|
value: Ie,
|
|
8418
|
-
onChange: (n) =>
|
|
8425
|
+
onChange: (n) => St(n.target.value),
|
|
8419
8426
|
onKeyPress: (n) => {
|
|
8420
8427
|
if (n.key === "Enter") {
|
|
8421
|
-
if (
|
|
8428
|
+
if (ye) {
|
|
8422
8429
|
n.preventDefault();
|
|
8423
8430
|
return;
|
|
8424
8431
|
}
|
|
@@ -8431,7 +8438,7 @@ const Oi = {
|
|
|
8431
8438
|
backgroundColor: "transparent",
|
|
8432
8439
|
borderColor: "transparent",
|
|
8433
8440
|
color: I.textColor,
|
|
8434
|
-
fontSize:
|
|
8441
|
+
fontSize: q ? "15px" : Se.sm,
|
|
8435
8442
|
"--tw-ring-color": I.primaryColor
|
|
8436
8443
|
}
|
|
8437
8444
|
}
|
|
@@ -8440,26 +8447,26 @@ const Oi = {
|
|
|
8440
8447
|
"button",
|
|
8441
8448
|
{
|
|
8442
8449
|
onClick: () => {
|
|
8443
|
-
if (
|
|
8450
|
+
if (ye) {
|
|
8444
8451
|
Rn();
|
|
8445
8452
|
return;
|
|
8446
8453
|
}
|
|
8447
8454
|
Qt(Ie);
|
|
8448
8455
|
},
|
|
8449
|
-
disabled: !
|
|
8456
|
+
disabled: !ye && !Ie.trim(),
|
|
8450
8457
|
className: "transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
8451
8458
|
style: {
|
|
8452
|
-
backgroundColor:
|
|
8459
|
+
backgroundColor: ye ? "#dc2626" : I.primaryColor,
|
|
8453
8460
|
color: "#ffffff",
|
|
8454
|
-
borderRadius:
|
|
8455
|
-
width:
|
|
8456
|
-
height:
|
|
8461
|
+
borderRadius: q ? "12px" : "10px",
|
|
8462
|
+
width: q ? "46px" : void 0,
|
|
8463
|
+
height: q ? "46px" : void 0,
|
|
8457
8464
|
display: "flex",
|
|
8458
8465
|
alignItems: "center",
|
|
8459
8466
|
justifyContent: "center",
|
|
8460
|
-
boxShadow:
|
|
8467
|
+
boxShadow: q ? `0 10px 20px ${Ue(Qe, 0.18)}` : "none"
|
|
8461
8468
|
},
|
|
8462
|
-
children:
|
|
8469
|
+
children: ye ? /* @__PURE__ */ i(Fn, { size: 14 }) : /* @__PURE__ */ i(_r, { size: 14 })
|
|
8463
8470
|
}
|
|
8464
8471
|
)
|
|
8465
8472
|
] }),
|
|
@@ -8467,7 +8474,7 @@ const Oi = {
|
|
|
8467
8474
|
] })
|
|
8468
8475
|
]
|
|
8469
8476
|
}
|
|
8470
|
-
) }) : /* @__PURE__ */ i("div", { className: "admesh-component", "data-admesh-theme":
|
|
8477
|
+
) }) : /* @__PURE__ */ i("div", { className: "admesh-component", "data-admesh-theme": he, children: /* @__PURE__ */ i(
|
|
8471
8478
|
"button",
|
|
8472
8479
|
{
|
|
8473
8480
|
onClick: rr,
|
|
@@ -8478,7 +8485,7 @@ const Oi = {
|
|
|
8478
8485
|
backgroundColor: I.primaryColor,
|
|
8479
8486
|
color: "#ffffff",
|
|
8480
8487
|
zIndex: 9999,
|
|
8481
|
-
fontSize:
|
|
8488
|
+
fontSize: Se.base,
|
|
8482
8489
|
...r
|
|
8483
8490
|
},
|
|
8484
8491
|
children: /* @__PURE__ */ i("span", { className: "font-medium", children: o })
|
|
@@ -8620,7 +8627,7 @@ const Xn = () => {
|
|
|
8620
8627
|
try {
|
|
8621
8628
|
const F = document.getElementById(k.current);
|
|
8622
8629
|
if (!F) {
|
|
8623
|
-
s.warn("[FinalLinkDetectionCheck]
|
|
8630
|
+
s.warn("[FinalLinkDetectionCheck] Container not found"), d(!0), y();
|
|
8624
8631
|
return;
|
|
8625
8632
|
}
|
|
8626
8633
|
const B = new Kr({
|
|
@@ -8628,12 +8635,12 @@ const Xn = () => {
|
|
|
8628
8635
|
fireExposurePixels: !0
|
|
8629
8636
|
}), z = l.length > 0 ? l : [];
|
|
8630
8637
|
s.log(`[FinalLinkDetectionCheck] 📋 Using ${z.length} recommendations for link detection`), z.length > 0 && process.env.NODE_ENV === "development" && z.forEach((C, U) => {
|
|
8631
|
-
var
|
|
8638
|
+
var V, Q, H, G, re, _e, te, oe, Ae;
|
|
8632
8639
|
s.log(`[FinalLinkDetectionCheck] 📋 Recommendation ${U + 1} (DEV):`, {
|
|
8633
8640
|
recommendation_id: C == null ? void 0 : C.recommendation_id,
|
|
8634
|
-
click_url: ((
|
|
8635
|
-
format: (
|
|
8636
|
-
brand_name: (te = (
|
|
8641
|
+
click_url: ((V = C == null ? void 0 : C.tracking) == null ? void 0 : V.click_url) || ((H = (Q = C == null ? void 0 : C.recommendation) == null ? void 0 : Q.creative) == null ? void 0 : H.landing_page_url),
|
|
8642
|
+
format: (G = C == null ? void 0 : C.recommendation) == null ? void 0 : G.format,
|
|
8643
|
+
brand_name: (te = (_e = (re = C.render) == null ? void 0 : re.creative) == null ? void 0 : _e.advertiser) == null ? void 0 : te.brand_name,
|
|
8637
8644
|
cta_url: (Ae = (oe = C.render) == null ? void 0 : oe.creative) == null ? void 0 : Ae.landing_page_url
|
|
8638
8645
|
});
|
|
8639
8646
|
});
|
|
@@ -8641,11 +8648,11 @@ const Xn = () => {
|
|
|
8641
8648
|
F,
|
|
8642
8649
|
z,
|
|
8643
8650
|
// Use fetched recommendations for brand URL matching
|
|
8644
|
-
({ exposureUrl: C, recommendationId: U, linkElement:
|
|
8651
|
+
({ exposureUrl: C, recommendationId: U, linkElement: V }) => A({ exposureUrl: C, recommendationId: U, linkElement: V })
|
|
8645
8652
|
);
|
|
8646
8653
|
s.log(`[FinalLinkDetectionCheck] 📊 Final check result: ${$.length} links`), $.length > 0 ? (s.log("[FinalLinkDetectionCheck] ✅ Links detected - canceling fallback (no API call)"), u(!0), h.current($.length)) : (s.log(`[FinalLinkDetectionCheck] ⚠️ No links found - rendering fallback (will use ${z.length} previous recommendation(s) if available)`), u(!1), p.current()), d(!0);
|
|
8647
8654
|
} catch {
|
|
8648
|
-
s.error("[FinalLinkDetectionCheck]
|
|
8655
|
+
s.error("[FinalLinkDetectionCheck] Error during final check"), d(!0), p.current();
|
|
8649
8656
|
}
|
|
8650
8657
|
}, [A, l]);
|
|
8651
8658
|
return Z(() => {
|
|
@@ -8703,7 +8710,7 @@ const Xn = () => {
|
|
|
8703
8710
|
}
|
|
8704
8711
|
try {
|
|
8705
8712
|
s.log("[WeaveAdFormatContainer] 📤 Fetching recommendations from SDK for brand URL matching");
|
|
8706
|
-
const
|
|
8713
|
+
const H = await v.fetchPlatformResponse({
|
|
8707
8714
|
query: y.trim(),
|
|
8708
8715
|
sessionId: m,
|
|
8709
8716
|
messageId: t,
|
|
@@ -8712,33 +8719,33 @@ const Xn = () => {
|
|
|
8712
8719
|
userId: g,
|
|
8713
8720
|
model: h,
|
|
8714
8721
|
messages: p
|
|
8715
|
-
}),
|
|
8716
|
-
if (F(
|
|
8717
|
-
status:
|
|
8718
|
-
recommendationId:
|
|
8719
|
-
hasRecommendation: !!(
|
|
8720
|
-
format: (Q =
|
|
8721
|
-
}),
|
|
8722
|
-
const re =
|
|
8722
|
+
}), G = (H == null ? void 0 : H.status) === "generated" ? [H] : [];
|
|
8723
|
+
if (F(G), B.current = G, s.log("[WeaveAdFormatContainer] 📥 Got platform response:", {
|
|
8724
|
+
status: H == null ? void 0 : H.status,
|
|
8725
|
+
recommendationId: H == null ? void 0 : H.recommendation_id,
|
|
8726
|
+
hasRecommendation: !!(H != null && H.recommendation),
|
|
8727
|
+
format: (Q = H == null ? void 0 : H.recommendation) == null ? void 0 : Q.format
|
|
8728
|
+
}), H != null && H.recommendation) {
|
|
8729
|
+
const re = H.recommendation.creative, _e = re.landing_page_url;
|
|
8723
8730
|
s.log("[WeaveAdFormatContainer] 🎯 Found creative in platform response:", {
|
|
8724
8731
|
brandName: re.brand_name,
|
|
8725
8732
|
headline: re.headline,
|
|
8726
8733
|
description: re.description,
|
|
8727
|
-
brandUrl:
|
|
8734
|
+
brandUrl: _e
|
|
8728
8735
|
});
|
|
8729
8736
|
} else
|
|
8730
8737
|
s.log("[WeaveAdFormatContainer] ⚠️ No recommendation found in platform response");
|
|
8731
|
-
} catch (
|
|
8732
|
-
s.warn("[WeaveAdFormatContainer] ⚠️ Failed to fetch recommendations, falling back to pattern-based detection:",
|
|
8738
|
+
} catch (H) {
|
|
8739
|
+
s.warn("[WeaveAdFormatContainer] ⚠️ Failed to fetch recommendations, falling back to pattern-based detection:", H), F([]);
|
|
8733
8740
|
}
|
|
8734
8741
|
})();
|
|
8735
8742
|
}, [v, m, t, y]), Z(() => {
|
|
8736
|
-
const
|
|
8737
|
-
if (!
|
|
8743
|
+
const V = k.current;
|
|
8744
|
+
if (!V || !A.current)
|
|
8738
8745
|
return;
|
|
8739
|
-
const Q = A.current,
|
|
8746
|
+
const Q = A.current, H = ({ exposureUrl: _e, recommendationId: te, linkElement: oe }) => {
|
|
8740
8747
|
Y.current.startTracking({
|
|
8741
|
-
exposureUrl:
|
|
8748
|
+
exposureUrl: _e,
|
|
8742
8749
|
recommendationId: te,
|
|
8743
8750
|
linkElement: oe,
|
|
8744
8751
|
sessionId: m,
|
|
@@ -8746,22 +8753,22 @@ const Xn = () => {
|
|
|
8746
8753
|
});
|
|
8747
8754
|
}, re = setTimeout(() => {
|
|
8748
8755
|
s.log("[WeaveAdFormatContainer] 🔍 Weave injection attempt started"), w == null || w(t);
|
|
8749
|
-
const
|
|
8750
|
-
s.log(`[WeaveAdFormatContainer] 📋 Using ${
|
|
8756
|
+
const _e = B.current.length > 0 ? B.current : [];
|
|
8757
|
+
s.log(`[WeaveAdFormatContainer] 📋 Using ${_e.length} recommendations for link detection`);
|
|
8751
8758
|
try {
|
|
8752
8759
|
const te = Q.scanAndProcessLinks(
|
|
8753
|
-
|
|
8754
|
-
|
|
8760
|
+
V,
|
|
8761
|
+
_e,
|
|
8755
8762
|
// Use fetched recommendations for brand URL matching
|
|
8756
|
-
|
|
8763
|
+
H
|
|
8757
8764
|
);
|
|
8758
8765
|
te.length > 0 && !S.current ? (S.current = !0, s.log(`[WeaveAdFormatContainer] ✅ Weave injection succeeded: ${te.length} links detected`), d == null || d(t, !0, `Found ${te.length} links`), o == null || o(te.length), f == null || f(!1)) : S.current || s.log("[WeaveAdFormatContainer] ⚠️ Weave injection: no links found on initial scan");
|
|
8759
8766
|
} catch (te) {
|
|
8760
8767
|
const oe = te instanceof Error ? te.message : String(te);
|
|
8761
|
-
s.error(`[WeaveAdFormatContainer]
|
|
8768
|
+
s.error(`[WeaveAdFormatContainer] Weave injection failed: ${oe}`), d == null || d(t, !1, oe), a == null || a(), f == null || f(!0);
|
|
8762
8769
|
}
|
|
8763
8770
|
}, 100);
|
|
8764
|
-
return Q.watchForNewLinks(
|
|
8771
|
+
return Q.watchForNewLinks(V, B.current, H), () => {
|
|
8765
8772
|
clearTimeout(re), Q.stopWatching();
|
|
8766
8773
|
};
|
|
8767
8774
|
}, [e, m, t, o, f, w, d]);
|
|
@@ -8789,8 +8796,8 @@ const Xn = () => {
|
|
|
8789
8796
|
sdk: v,
|
|
8790
8797
|
query: y,
|
|
8791
8798
|
recommendations: W,
|
|
8792
|
-
onLinksFound: (
|
|
8793
|
-
s.log(`[WeaveAdFormatContainer] ✅ Links found (${
|
|
8799
|
+
onLinksFound: (V) => {
|
|
8800
|
+
s.log(`[WeaveAdFormatContainer] ✅ Links found (${V}) - no fallback needed`), d == null || d(t, !0, `Found ${V} links in final check`), o == null || o(V), f == null || f(!1);
|
|
8794
8801
|
},
|
|
8795
8802
|
onNoLinksFound: () => {
|
|
8796
8803
|
s.log("[WeaveAdFormatContainer] ⚠️ No links found - rendering fallback"), s.log(`[WeaveAdFormatContainer] 📋 Passing ${W.length} recommendation(s) to fallback component`), d == null || d(t, !1, "No links detected in final check"), a == null || a(), f == null || f(!0);
|