@active-reach/web-sdk 1.30.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/inapp/renderers/reviews.d.ts +9 -9
- package/dist/inapp/renderers/reviews.d.ts.map +1 -1
- package/dist/index.js +309 -284
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -585,13 +585,13 @@ function paintRating(card) {
|
|
|
585
585
|
const count = Number(meta.review_count ?? 0);
|
|
586
586
|
const rr = document.createElement("div");
|
|
587
587
|
rr.style.cssText = "display:flex;align-items:center;gap:3px;font-size:11px;line-height:1;";
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
588
|
+
const star2 = document.createElement("span");
|
|
589
|
+
star2.textContent = "★";
|
|
590
|
+
star2.style.cssText = "color:#059669;";
|
|
591
591
|
const val = document.createElement("span");
|
|
592
592
|
val.textContent = avg.toFixed(1);
|
|
593
593
|
val.style.cssText = "color:#059669;font-weight:700;";
|
|
594
|
-
rr.appendChild(
|
|
594
|
+
rr.appendChild(star2);
|
|
595
595
|
rr.appendChild(val);
|
|
596
596
|
if (count > 0) {
|
|
597
597
|
const c = document.createElement("span");
|
|
@@ -841,15 +841,15 @@ function renderNpsReasonStep(wrap, el2, ctx, score, fg, accent) {
|
|
|
841
841
|
const chipRow = document.createElement("div");
|
|
842
842
|
chipRow.style.cssText = "display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin-bottom:8px;";
|
|
843
843
|
chips.slice(0, 8).forEach((c) => {
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
844
|
+
const chip = document.createElement("button");
|
|
845
|
+
chip.type = "button";
|
|
846
|
+
chip.textContent = c;
|
|
847
|
+
chip.style.cssText = `padding:5px 11px;border-radius:999px;border:1px solid color-mix(in srgb, ${accent} 35%, transparent);background:transparent;color:${fg};font-size:12px;cursor:pointer;`;
|
|
848
|
+
chip.addEventListener("click", () => {
|
|
849
849
|
ta.value = ta.value ? `${ta.value}, ${c}` : c;
|
|
850
850
|
ta.focus();
|
|
851
851
|
});
|
|
852
|
-
chipRow.appendChild(
|
|
852
|
+
chipRow.appendChild(chip);
|
|
853
853
|
});
|
|
854
854
|
wrap.appendChild(chipRow);
|
|
855
855
|
}
|
|
@@ -1171,10 +1171,10 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1171
1171
|
case "category": {
|
|
1172
1172
|
const cat = meta.category;
|
|
1173
1173
|
if (typeof cat !== "string" || !cat) break;
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
container.appendChild(
|
|
1174
|
+
const chip = document.createElement("span");
|
|
1175
|
+
chip.textContent = cat;
|
|
1176
|
+
chip.style.cssText = "align-self:flex-start;background:#f3f4f6;color:#6b7280;font-size:10px;font-weight:500;padding:2px 7px;border-radius:6px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;";
|
|
1177
|
+
container.appendChild(chip);
|
|
1178
1178
|
break;
|
|
1179
1179
|
}
|
|
1180
1180
|
// ── rich-card-editor elements (P0) ──────────────────────────────────
|
|
@@ -2748,10 +2748,10 @@ function renderStreak(ctx) {
|
|
|
2748
2748
|
s.content.appendChild(gEl("div", "font-size:22px;font-weight:800;margin:4px 0 2px", `${count}-day streak!`));
|
|
2749
2749
|
const chips = gEl("div", "display:flex;justify-content:center;gap:8px;margin:12px 0");
|
|
2750
2750
|
for (let i = 0; i < 7; i++) {
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
chips.appendChild(
|
|
2751
|
+
const chip = gEl("div", "display:inline-flex;flex-direction:column;align-items:center;gap:3px;font-size:11px;opacity:0.8");
|
|
2752
|
+
chip.appendChild(gEl("span", "", days[i]));
|
|
2753
|
+
chip.appendChild(gEl("span", "font-size:16px", i < count % 7 || count >= 7 && i < 7 ? "✅" : i === count % 7 ? "🔥" : "⚪"));
|
|
2754
|
+
chips.appendChild(chip);
|
|
2755
2755
|
}
|
|
2756
2756
|
s.content.appendChild(chips);
|
|
2757
2757
|
const note = gEl("div", "font-size:13px;opacity:0.8");
|
|
@@ -4116,15 +4116,15 @@ class AegisChat {
|
|
|
4116
4116
|
row.className = "aegis-chat-quickreplies";
|
|
4117
4117
|
for (const label of this.quickReplies) {
|
|
4118
4118
|
if (typeof label !== "string" || !label.trim()) continue;
|
|
4119
|
-
const
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4119
|
+
const chip = document.createElement("button");
|
|
4120
|
+
chip.type = "button";
|
|
4121
|
+
chip.className = "aegis-chat-chip";
|
|
4122
|
+
chip.textContent = label;
|
|
4123
|
+
chip.addEventListener("click", () => {
|
|
4124
4124
|
row.remove();
|
|
4125
4125
|
void this.send(label);
|
|
4126
4126
|
});
|
|
4127
|
-
row.appendChild(
|
|
4127
|
+
row.appendChild(chip);
|
|
4128
4128
|
}
|
|
4129
4129
|
if (row.childElementCount > 0) this.thread.appendChild(row);
|
|
4130
4130
|
}
|
|
@@ -5033,74 +5033,107 @@ function el(tag, css, text) {
|
|
|
5033
5033
|
if (text != null) e.textContent = text;
|
|
5034
5034
|
return e;
|
|
5035
5035
|
}
|
|
5036
|
-
function
|
|
5037
|
-
const
|
|
5036
|
+
function star(filled, size) {
|
|
5037
|
+
const svg = document.createElementNS(SVG_NS, "svg");
|
|
5038
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
5039
|
+
svg.setAttribute("width", String(size));
|
|
5040
|
+
svg.setAttribute("height", String(size));
|
|
5041
|
+
const p = document.createElementNS(SVG_NS, "path");
|
|
5042
|
+
p.setAttribute(
|
|
5043
|
+
"d",
|
|
5044
|
+
"M12 2l2.9 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l7.1-1.01L12 2z"
|
|
5045
|
+
);
|
|
5046
|
+
p.setAttribute("fill", filled ? "#f59e0b" : "#e5e7eb");
|
|
5047
|
+
svg.appendChild(p);
|
|
5048
|
+
return svg;
|
|
5049
|
+
}
|
|
5050
|
+
function stars(rating, size = 15) {
|
|
5051
|
+
const wrap = el("span", "display:inline-flex;gap:2px;vertical-align:middle;");
|
|
5038
5052
|
wrap.setAttribute("aria-label", `${rating} out of 5`);
|
|
5039
|
-
for (let i = 1; i <= 5; i++)
|
|
5040
|
-
const svg = document.createElementNS(SVG_NS, "svg");
|
|
5041
|
-
svg.setAttribute("viewBox", "0 0 24 24");
|
|
5042
|
-
svg.setAttribute("width", String(size));
|
|
5043
|
-
svg.setAttribute("height", String(size));
|
|
5044
|
-
const path = document.createElementNS(SVG_NS, "path");
|
|
5045
|
-
path.setAttribute(
|
|
5046
|
-
"d",
|
|
5047
|
-
"M12 2l2.9 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l7.1-1.01L12 2z"
|
|
5048
|
-
);
|
|
5049
|
-
path.setAttribute("fill", i <= rating ? "#f59e0b" : "#e2e8f0");
|
|
5050
|
-
svg.appendChild(path);
|
|
5051
|
-
wrap.appendChild(svg);
|
|
5052
|
-
}
|
|
5053
|
+
for (let i = 1; i <= 5; i++) wrap.appendChild(star(i <= rating, size));
|
|
5053
5054
|
return wrap;
|
|
5054
5055
|
}
|
|
5055
|
-
function
|
|
5056
|
-
const
|
|
5057
|
-
return el(
|
|
5056
|
+
function verifiedBadge() {
|
|
5057
|
+
const b = el(
|
|
5058
5058
|
"span",
|
|
5059
|
-
|
|
5060
|
-
text
|
|
5059
|
+
"display:inline-flex;align-items:center;gap:3px;font-size:12px;font-weight:600;color:#059669;"
|
|
5061
5060
|
);
|
|
5062
|
-
}
|
|
5063
|
-
function sparkles() {
|
|
5064
5061
|
const svg = document.createElementNS(SVG_NS, "svg");
|
|
5065
5062
|
svg.setAttribute("viewBox", "0 0 24 24");
|
|
5066
|
-
svg.setAttribute("width", "
|
|
5067
|
-
svg.setAttribute("height", "
|
|
5063
|
+
svg.setAttribute("width", "13");
|
|
5064
|
+
svg.setAttribute("height", "13");
|
|
5068
5065
|
const p = document.createElementNS(SVG_NS, "path");
|
|
5069
|
-
p.setAttribute("d", "
|
|
5070
|
-
p.setAttribute("fill", "
|
|
5066
|
+
p.setAttribute("d", "M9 12l2 2 4-4M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z");
|
|
5067
|
+
p.setAttribute("fill", "none");
|
|
5068
|
+
p.setAttribute("stroke", "#059669");
|
|
5069
|
+
p.setAttribute("stroke-width", "2");
|
|
5070
|
+
p.setAttribute("stroke-linecap", "round");
|
|
5071
|
+
p.setAttribute("stroke-linejoin", "round");
|
|
5071
5072
|
svg.appendChild(p);
|
|
5072
|
-
|
|
5073
|
+
b.appendChild(svg);
|
|
5074
|
+
b.appendChild(el("span", "", "Verified purchase"));
|
|
5075
|
+
return b;
|
|
5073
5076
|
}
|
|
5074
|
-
function
|
|
5077
|
+
function avatar(name, accent) {
|
|
5078
|
+
const initial = (name.trim()[0] || "?").toUpperCase();
|
|
5079
|
+
const a = el(
|
|
5080
|
+
"span",
|
|
5081
|
+
`flex:0 0 auto;width:34px;height:34px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;color:${accent};background:${accent}1a;`,
|
|
5082
|
+
initial
|
|
5083
|
+
);
|
|
5084
|
+
return a;
|
|
5085
|
+
}
|
|
5086
|
+
function thumbBtn(up, count, reviewId, creds) {
|
|
5087
|
+
const btn = el(
|
|
5088
|
+
"button",
|
|
5089
|
+
"display:inline-flex;align-items:center;gap:5px;font-size:13px;color:#6b7280;background:none;border:none;cursor:pointer;padding:4px 6px;border-radius:8px;font-family:inherit;"
|
|
5090
|
+
);
|
|
5075
5091
|
const svg = document.createElementNS(SVG_NS, "svg");
|
|
5076
5092
|
svg.setAttribute("viewBox", "0 0 24 24");
|
|
5077
|
-
svg.setAttribute("width", "
|
|
5078
|
-
svg.setAttribute("height", "
|
|
5093
|
+
svg.setAttribute("width", "15");
|
|
5094
|
+
svg.setAttribute("height", "15");
|
|
5095
|
+
if (!up) svg.style.cssText = "transform:rotate(180deg);";
|
|
5079
5096
|
const p = document.createElementNS(SVG_NS, "path");
|
|
5080
5097
|
p.setAttribute(
|
|
5081
5098
|
"d",
|
|
5082
|
-
"
|
|
5099
|
+
"M2 21h4V9H2v12zM23 10a2 2 0 0 0-2-2h-6.31l.95-4.57.03-.32a1.5 1.5 0 0 0-.44-1.06L14.17 1 7.59 7.59A2 2 0 0 0 7 9v10a2 2 0 0 0 2 2h9a2 2 0 0 0 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-1z"
|
|
5083
5100
|
);
|
|
5084
|
-
p.setAttribute("fill", "
|
|
5101
|
+
p.setAttribute("fill", "currentColor");
|
|
5085
5102
|
svg.appendChild(p);
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
const
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
const label = el("span", "width:26px;display:inline-flex;align-items:center;gap:2px;color:#334155;", String(r));
|
|
5095
|
-
label.appendChild(miniStar());
|
|
5096
|
-
row.appendChild(label);
|
|
5097
|
-
const track = el("div", "flex:1;height:6px;background:#f1f5f9;border-radius:999px;overflow:hidden;");
|
|
5098
|
-
track.appendChild(el("div", `width:${pct}%;height:100%;background:#f59e0b;`));
|
|
5099
|
-
row.appendChild(track);
|
|
5100
|
-
row.appendChild(el("span", "width:28px;text-align:right;", String(n)));
|
|
5101
|
-
box.appendChild(row);
|
|
5103
|
+
btn.appendChild(svg);
|
|
5104
|
+
const c = el("span", "", String(count));
|
|
5105
|
+
btn.appendChild(c);
|
|
5106
|
+
const key = `aegis_rv_voted_${reviewId}`;
|
|
5107
|
+
let voted = false;
|
|
5108
|
+
try {
|
|
5109
|
+
voted = typeof localStorage !== "undefined" && localStorage.getItem(key) != null;
|
|
5110
|
+
} catch {
|
|
5102
5111
|
}
|
|
5103
|
-
|
|
5112
|
+
if (voted) btn.style.opacity = "0.5";
|
|
5113
|
+
btn.addEventListener("mouseenter", () => {
|
|
5114
|
+
if (!voted) btn.style.color = "#111827";
|
|
5115
|
+
});
|
|
5116
|
+
btn.addEventListener("mouseleave", () => {
|
|
5117
|
+
btn.style.color = "#6b7280";
|
|
5118
|
+
});
|
|
5119
|
+
btn.addEventListener("click", () => {
|
|
5120
|
+
try {
|
|
5121
|
+
if (localStorage.getItem(key) != null) return;
|
|
5122
|
+
localStorage.setItem(key, up ? "up" : "down");
|
|
5123
|
+
} catch {
|
|
5124
|
+
}
|
|
5125
|
+
voted = true;
|
|
5126
|
+
c.textContent = String(count + 1);
|
|
5127
|
+
btn.style.opacity = "0.5";
|
|
5128
|
+
const url = new URL(`/v1/reviews/${reviewId}/helpful`, creds.apiHost);
|
|
5129
|
+
void fetch(url.toString(), {
|
|
5130
|
+
method: "POST",
|
|
5131
|
+
headers: { "X-Aegis-Write-Key": creds.writeKey, "Content-Type": "application/json" },
|
|
5132
|
+
body: JSON.stringify({ direction: up ? "up" : "down" })
|
|
5133
|
+
}).catch(() => {
|
|
5134
|
+
});
|
|
5135
|
+
});
|
|
5136
|
+
return btn;
|
|
5104
5137
|
}
|
|
5105
5138
|
function injectJsonLd(target, data, productId) {
|
|
5106
5139
|
if (!data.aggregate.count || data.aggregate.avg_rating == null) return;
|
|
@@ -5128,116 +5161,22 @@ function injectJsonLd(target, data, productId) {
|
|
|
5128
5161
|
script.textContent = JSON.stringify(ld);
|
|
5129
5162
|
target.appendChild(script);
|
|
5130
5163
|
}
|
|
5131
|
-
function thumbSvg(up) {
|
|
5132
|
-
const svg = document.createElementNS(SVG_NS, "svg");
|
|
5133
|
-
svg.setAttribute("viewBox", "0 0 24 24");
|
|
5134
|
-
svg.setAttribute("width", "14");
|
|
5135
|
-
svg.setAttribute("height", "14");
|
|
5136
|
-
if (!up) svg.style.cssText = "transform:rotate(180deg);";
|
|
5137
|
-
const p = document.createElementNS(SVG_NS, "path");
|
|
5138
|
-
p.setAttribute(
|
|
5139
|
-
"d",
|
|
5140
|
-
"M2 21h4V9H2v12zM23 10a2 2 0 0 0-2-2h-6.31l.95-4.57.03-.32a1.5 1.5 0 0 0-.44-1.06L14.17 1 7.59 7.59A2 2 0 0 0 7 9v10a2 2 0 0 0 2 2h9a2 2 0 0 0 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-1z"
|
|
5141
|
-
);
|
|
5142
|
-
p.setAttribute("fill", "currentColor");
|
|
5143
|
-
svg.appendChild(p);
|
|
5144
|
-
return svg;
|
|
5145
|
-
}
|
|
5146
|
-
function helpfulButton(reviewId, up, count, creds) {
|
|
5147
|
-
const btn = el(
|
|
5148
|
-
"button",
|
|
5149
|
-
"display:inline-flex;align-items:center;gap:4px;font-size:12px;color:#64748b;background:none;border:none;cursor:pointer;padding:2px 4px;"
|
|
5150
|
-
);
|
|
5151
|
-
btn.appendChild(thumbSvg(up));
|
|
5152
|
-
const countEl = el("span", "", String(count));
|
|
5153
|
-
btn.appendChild(countEl);
|
|
5154
|
-
const voteKey = `aegis_rv_voted_${reviewId}`;
|
|
5155
|
-
const already = (() => {
|
|
5156
|
-
try {
|
|
5157
|
-
return typeof localStorage !== "undefined" && localStorage.getItem(voteKey) != null;
|
|
5158
|
-
} catch {
|
|
5159
|
-
return false;
|
|
5160
|
-
}
|
|
5161
|
-
})();
|
|
5162
|
-
if (already) btn.style.opacity = "0.5";
|
|
5163
|
-
btn.addEventListener("click", () => {
|
|
5164
|
-
try {
|
|
5165
|
-
if (localStorage.getItem(voteKey) != null) return;
|
|
5166
|
-
localStorage.setItem(voteKey, up ? "up" : "down");
|
|
5167
|
-
} catch {
|
|
5168
|
-
}
|
|
5169
|
-
countEl.textContent = String(count + 1);
|
|
5170
|
-
btn.style.opacity = "0.5";
|
|
5171
|
-
const url = new URL(`/v1/reviews/${reviewId}/helpful`, creds.apiHost);
|
|
5172
|
-
void fetch(url.toString(), {
|
|
5173
|
-
method: "POST",
|
|
5174
|
-
headers: { "X-Aegis-Write-Key": creds.writeKey, "Content-Type": "application/json" },
|
|
5175
|
-
body: JSON.stringify({ direction: up ? "up" : "down" })
|
|
5176
|
-
}).catch(() => {
|
|
5177
|
-
});
|
|
5178
|
-
});
|
|
5179
|
-
return btn;
|
|
5180
|
-
}
|
|
5181
|
-
function reviewCard(ctx, r, creds) {
|
|
5182
|
-
var _a, _b;
|
|
5183
|
-
const li = el("li", "padding:14px 0;border-top:1px solid #e2e8f0;");
|
|
5184
|
-
const meta = el("div", "display:flex;flex-wrap:wrap;align-items:center;gap:8px;");
|
|
5185
|
-
meta.appendChild(stars(r.rating ?? 0));
|
|
5186
|
-
meta.appendChild(el("span", "font-size:14px;font-weight:600;", ((_a = r.reviewer_snapshot) == null ? void 0 : _a.name) ?? "Customer"));
|
|
5187
|
-
if (r.verified_purchase) meta.appendChild(chip("Verified purchase", "verified"));
|
|
5188
|
-
if (r.is_incentivized) meta.appendChild(chip("Reward included", "reward"));
|
|
5189
|
-
if (r.created_at) {
|
|
5190
|
-
const d = new Date(r.created_at);
|
|
5191
|
-
if (!Number.isNaN(d.getTime())) {
|
|
5192
|
-
meta.appendChild(el("span", "margin-left:auto;font-size:12px;color:#94a3b8;", d.toLocaleDateString()));
|
|
5193
|
-
}
|
|
5194
|
-
}
|
|
5195
|
-
li.appendChild(meta);
|
|
5196
|
-
if (r.review_text) {
|
|
5197
|
-
li.appendChild(el("p", "margin:6px 0 0;font-size:14px;line-height:1.5;color:#334155;", r.review_text));
|
|
5198
|
-
}
|
|
5199
|
-
if (r.media && r.media.length > 0) {
|
|
5200
|
-
const gallery = el("div", "display:flex;gap:6px;margin-top:8px;");
|
|
5201
|
-
for (const m2 of r.media.slice(0, 6)) {
|
|
5202
|
-
const safe = ctx.sanitizeUrl(m2.url);
|
|
5203
|
-
if (!safe) continue;
|
|
5204
|
-
const img = document.createElement("img");
|
|
5205
|
-
img.src = safe;
|
|
5206
|
-
img.loading = "lazy";
|
|
5207
|
-
img.alt = "";
|
|
5208
|
-
img.style.cssText = "width:56px;height:56px;object-fit:cover;border-radius:8px;";
|
|
5209
|
-
gallery.appendChild(img);
|
|
5210
|
-
}
|
|
5211
|
-
if (gallery.childElementCount) li.appendChild(gallery);
|
|
5212
|
-
}
|
|
5213
|
-
if ((_b = r.operator_reply) == null ? void 0 : _b.text) {
|
|
5214
|
-
const reply = el(
|
|
5215
|
-
"div",
|
|
5216
|
-
"margin-top:8px;padding:8px 10px;background:#f8fafc;border-radius:8px;font-size:13px;color:#475569;"
|
|
5217
|
-
);
|
|
5218
|
-
reply.appendChild(el("span", "font-weight:600;margin-right:6px;", "Reply"));
|
|
5219
|
-
reply.appendChild(el("span", "", r.operator_reply.text));
|
|
5220
|
-
li.appendChild(reply);
|
|
5221
|
-
}
|
|
5222
|
-
const votes = el("div", "display:flex;align-items:center;gap:10px;margin-top:8px;");
|
|
5223
|
-
votes.appendChild(el("span", "font-size:12px;color:#94a3b8;", "Helpful?"));
|
|
5224
|
-
votes.appendChild(helpfulButton(r.id, true, r.helpful_count ?? 0, creds));
|
|
5225
|
-
votes.appendChild(helpfulButton(r.id, false, r.not_helpful_count ?? 0, creds));
|
|
5226
|
-
li.appendChild(votes);
|
|
5227
|
-
return li;
|
|
5228
|
-
}
|
|
5229
5164
|
const SORTS = [
|
|
5230
5165
|
{ key: "recent", label: "Most recent" },
|
|
5231
5166
|
{ key: "helpful", label: "Most helpful" },
|
|
5232
5167
|
{ key: "rating", label: "Highest rated" }
|
|
5233
5168
|
];
|
|
5234
5169
|
function renderReviewsInline(ctx, target, creds) {
|
|
5235
|
-
var _a;
|
|
5236
5170
|
if (typeof document === "undefined" || !(creds == null ? void 0 : creds.apiHost) || !(creds == null ? void 0 : creds.writeKey)) return false;
|
|
5171
|
+
ensureInAppFont();
|
|
5172
|
+
const ic = ctx.campaign.interactive_config || {};
|
|
5173
|
+
const accent = ctx.sanitizeColor(ctx.campaign.background_color || "#4169e1");
|
|
5174
|
+
const rawBrand = (target.getAttribute("data-brand-name") || String(ic.brand_name || "")).trim();
|
|
5175
|
+
const brand = (rawBrand.split(/\s[|·–-]\s/)[0] || "").trim() || "The store";
|
|
5237
5176
|
const productId = target.getAttribute("data-product-id") || ctx.campaign.product_id || null;
|
|
5238
5177
|
const state = { sort: "recent", withPhotos: false };
|
|
5239
5178
|
target.innerHTML = "";
|
|
5240
|
-
target.appendChild(el("div",
|
|
5179
|
+
target.appendChild(el("div", `font-family:${IN_APP_FONT_STACK};font-size:13px;color:#9ca3af;padding:10px 0;`, "Loading reviews…"));
|
|
5241
5180
|
function buildUrl() {
|
|
5242
5181
|
const url = new URL("/v1/reviews/public", creds.apiHost);
|
|
5243
5182
|
if (productId) url.searchParams.set("product_id", productId);
|
|
@@ -5250,125 +5189,211 @@ function renderReviewsInline(ctx, target, creds) {
|
|
|
5250
5189
|
return fetch(buildUrl(), { method: "GET", headers: { "X-Aegis-Write-Key": creds.writeKey } }).then((r) => r.ok ? r.json() : null).catch(() => null);
|
|
5251
5190
|
}
|
|
5252
5191
|
let listContainer = null;
|
|
5192
|
+
function reviewCard(r) {
|
|
5193
|
+
var _a, _b, _c;
|
|
5194
|
+
const li = el("li", "padding:22px 0;border-top:1px solid #f0f1f3;");
|
|
5195
|
+
const head = el("div", "display:flex;align-items:center;gap:10px;");
|
|
5196
|
+
head.appendChild(avatar(((_a = r.reviewer_snapshot) == null ? void 0 : _a.name) ?? "Customer", accent));
|
|
5197
|
+
const idn = el("div", "display:flex;flex-direction:column;gap:2px;min-width:0;");
|
|
5198
|
+
const nameRow = el("div", "display:flex;flex-wrap:wrap;align-items:center;gap:8px;");
|
|
5199
|
+
nameRow.appendChild(el("span", "font-size:15px;font-weight:700;color:#111827;", ((_b = r.reviewer_snapshot) == null ? void 0 : _b.name) ?? "Customer"));
|
|
5200
|
+
if (r.verified_purchase) nameRow.appendChild(verifiedBadge());
|
|
5201
|
+
idn.appendChild(nameRow);
|
|
5202
|
+
idn.appendChild(stars(r.rating ?? 0, 14));
|
|
5203
|
+
head.appendChild(idn);
|
|
5204
|
+
if (r.created_at) {
|
|
5205
|
+
const d = new Date(r.created_at);
|
|
5206
|
+
if (!Number.isNaN(d.getTime())) {
|
|
5207
|
+
head.appendChild(el(
|
|
5208
|
+
"span",
|
|
5209
|
+
"margin-left:auto;font-size:12px;color:#9ca3af;white-space:nowrap;",
|
|
5210
|
+
d.toLocaleDateString(void 0, { day: "numeric", month: "short", year: "numeric" })
|
|
5211
|
+
));
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
li.appendChild(head);
|
|
5215
|
+
if (r.review_text) {
|
|
5216
|
+
li.appendChild(el("p", "margin:12px 0 0;font-size:15px;line-height:1.6;color:#374151;", r.review_text));
|
|
5217
|
+
}
|
|
5218
|
+
if (r.media && r.media.length > 0) {
|
|
5219
|
+
const gallery = el("div", "display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;");
|
|
5220
|
+
for (const m2 of r.media.slice(0, 6)) {
|
|
5221
|
+
const safe = ctx.sanitizeUrl(m2.url);
|
|
5222
|
+
if (!safe) continue;
|
|
5223
|
+
const img = document.createElement("img");
|
|
5224
|
+
img.src = safe;
|
|
5225
|
+
img.loading = "lazy";
|
|
5226
|
+
img.alt = "";
|
|
5227
|
+
img.style.cssText = "width:72px;height:72px;object-fit:cover;border-radius:12px;border:1px solid #f0f1f3;";
|
|
5228
|
+
gallery.appendChild(img);
|
|
5229
|
+
}
|
|
5230
|
+
if (gallery.childElementCount) li.appendChild(gallery);
|
|
5231
|
+
}
|
|
5232
|
+
const foot = el("div", "display:flex;align-items:center;gap:6px;margin-top:12px;");
|
|
5233
|
+
foot.appendChild(el("span", "font-size:13px;color:#9ca3af;margin-right:2px;", "Was this helpful?"));
|
|
5234
|
+
foot.appendChild(thumbBtn(true, r.helpful_count ?? 0, r.id, creds));
|
|
5235
|
+
foot.appendChild(thumbBtn(false, r.not_helpful_count ?? 0, r.id, creds));
|
|
5236
|
+
li.appendChild(foot);
|
|
5237
|
+
if ((_c = r.operator_reply) == null ? void 0 : _c.text) {
|
|
5238
|
+
const reply = el(
|
|
5239
|
+
"div",
|
|
5240
|
+
`margin-top:14px;margin-left:44px;border-left:3px solid ${accent};background:${accent}0d;border-radius:0 12px 12px 0;padding:12px 14px;`
|
|
5241
|
+
);
|
|
5242
|
+
const rlabel = el("div", "display:flex;align-items:center;gap:6px;margin-bottom:5px;");
|
|
5243
|
+
rlabel.appendChild(el("span", `width:7px;height:7px;border-radius:999px;background:${accent};display:inline-block;`));
|
|
5244
|
+
rlabel.appendChild(el("span", `font-size:12px;font-weight:700;color:${accent};`, brand));
|
|
5245
|
+
rlabel.appendChild(el("span", "font-size:12px;color:#9ca3af;", "· replied"));
|
|
5246
|
+
reply.appendChild(rlabel);
|
|
5247
|
+
reply.appendChild(el("p", "margin:0;font-size:14px;line-height:1.55;color:#4b5563;", r.operator_reply.text));
|
|
5248
|
+
li.appendChild(reply);
|
|
5249
|
+
}
|
|
5250
|
+
return li;
|
|
5251
|
+
}
|
|
5253
5252
|
function renderList(items) {
|
|
5254
5253
|
if (!listContainer) return;
|
|
5255
5254
|
listContainer.innerHTML = "";
|
|
5256
5255
|
if (items.length === 0) {
|
|
5257
|
-
listContainer.appendChild(el("p", "padding:
|
|
5256
|
+
listContainer.appendChild(el("p", "padding:20px 0;font-size:14px;color:#9ca3af;text-align:center;", "No reviews match this filter."));
|
|
5258
5257
|
return;
|
|
5259
5258
|
}
|
|
5260
5259
|
const ul = el("ul", "list-style:none;margin:0;padding:0;");
|
|
5261
|
-
for (const r of items) ul.appendChild(reviewCard(
|
|
5260
|
+
for (const r of items) ul.appendChild(reviewCard(r));
|
|
5262
5261
|
listContainer.appendChild(ul);
|
|
5263
5262
|
}
|
|
5264
|
-
function
|
|
5265
|
-
const
|
|
5263
|
+
function pill(label, active, onClick) {
|
|
5264
|
+
const b = el(
|
|
5265
|
+
"button",
|
|
5266
|
+
`font-size:13px;font-weight:600;padding:7px 16px;border-radius:999px;cursor:pointer;font-family:inherit;` + (active ? `background:${accent};color:#fff;border:1px solid ${accent};` : "background:#fff;color:#374151;border:1px solid #e5e7eb;"),
|
|
5267
|
+
label
|
|
5268
|
+
);
|
|
5269
|
+
b.addEventListener("click", onClick);
|
|
5270
|
+
return b;
|
|
5271
|
+
}
|
|
5272
|
+
function controls(rerender) {
|
|
5273
|
+
const bar = el("div", "display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:18px 0 4px;");
|
|
5266
5274
|
const sel = document.createElement("select");
|
|
5267
|
-
sel.style.cssText =
|
|
5275
|
+
sel.style.cssText = `font-size:13px;font-weight:600;padding:7px 30px 7px 14px;border:1px solid #e5e7eb;border-radius:999px;background:#fff;color:#374151;cursor:pointer;font-family:inherit;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;`;
|
|
5268
5276
|
for (const s of SORTS) {
|
|
5269
|
-
const
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
sel.appendChild(
|
|
5277
|
+
const o = document.createElement("option");
|
|
5278
|
+
o.value = s.key;
|
|
5279
|
+
o.textContent = s.label;
|
|
5280
|
+
sel.appendChild(o);
|
|
5273
5281
|
}
|
|
5274
5282
|
sel.value = state.sort;
|
|
5275
5283
|
sel.addEventListener("change", () => {
|
|
5276
5284
|
state.sort = sel.value;
|
|
5277
|
-
|
|
5285
|
+
rerender();
|
|
5278
5286
|
});
|
|
5279
5287
|
bar.appendChild(sel);
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
"font-size:13px;padding:4px 12px;border:1px solid #e2e8f0;border-radius:999px;background:#fff;color:#334155;cursor:pointer;",
|
|
5283
|
-
"With photos"
|
|
5284
|
-
);
|
|
5285
|
-
photos.addEventListener("click", () => {
|
|
5288
|
+
let photosBtn = null;
|
|
5289
|
+
photosBtn = pill("With photos", state.withPhotos, () => {
|
|
5286
5290
|
state.withPhotos = !state.withPhotos;
|
|
5287
|
-
|
|
5288
|
-
|
|
5291
|
+
if (photosBtn) {
|
|
5292
|
+
photosBtn.style.cssText = `font-size:13px;font-weight:600;padding:7px 16px;border-radius:999px;cursor:pointer;font-family:inherit;` + (state.withPhotos ? `background:${accent};color:#fff;border:1px solid ${accent};` : "background:#fff;color:#374151;border:1px solid #e5e7eb;");
|
|
5293
|
+
}
|
|
5294
|
+
rerender();
|
|
5289
5295
|
});
|
|
5290
|
-
bar.appendChild(
|
|
5296
|
+
bar.appendChild(photosBtn);
|
|
5291
5297
|
return bar;
|
|
5292
5298
|
}
|
|
5299
|
+
function distributionPanel(dist, total) {
|
|
5300
|
+
const box = el("div", "flex:1 1 260px;max-width:340px;display:flex;flex-direction:column;gap:7px;");
|
|
5301
|
+
for (let r = 5; r >= 1; r--) {
|
|
5302
|
+
const n = dist[String(r)] ?? 0;
|
|
5303
|
+
const pct = total > 0 ? Math.round(n / total * 100) : 0;
|
|
5304
|
+
const row = el("div", "display:flex;align-items:center;gap:10px;font-size:13px;color:#6b7280;");
|
|
5305
|
+
const lbl = el("span", "width:30px;display:inline-flex;align-items:center;gap:3px;color:#374151;font-weight:600;", String(r));
|
|
5306
|
+
lbl.appendChild(star(true, 11));
|
|
5307
|
+
row.appendChild(lbl);
|
|
5308
|
+
const track = el("div", "flex:1;height:8px;background:#f0f1f3;border-radius:999px;overflow:hidden;");
|
|
5309
|
+
track.appendChild(el("div", `width:${pct}%;height:100%;background:${accent};border-radius:999px;`));
|
|
5310
|
+
row.appendChild(track);
|
|
5311
|
+
row.appendChild(el("span", "width:24px;text-align:right;font-variant-numeric:tabular-nums;", String(n)));
|
|
5312
|
+
box.appendChild(row);
|
|
5313
|
+
}
|
|
5314
|
+
return box;
|
|
5315
|
+
}
|
|
5316
|
+
function aiSummaryCard(summary) {
|
|
5317
|
+
const card = el(
|
|
5318
|
+
"div",
|
|
5319
|
+
"position:relative;border-radius:18px;padding:18px 20px;margin-bottom:24px;background:linear-gradient(135deg,#faf5ff 0%,#f5f3ff 100%);border:1px solid #ede9fe;"
|
|
5320
|
+
);
|
|
5321
|
+
const head = el("div", "display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;");
|
|
5322
|
+
const left = el("div", "display:flex;align-items:center;gap:7px;");
|
|
5323
|
+
const sp = document.createElementNS(SVG_NS, "svg");
|
|
5324
|
+
sp.setAttribute("viewBox", "0 0 24 24");
|
|
5325
|
+
sp.setAttribute("width", "16");
|
|
5326
|
+
sp.setAttribute("height", "16");
|
|
5327
|
+
const spp = document.createElementNS(SVG_NS, "path");
|
|
5328
|
+
spp.setAttribute("d", "M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6L12 3z");
|
|
5329
|
+
spp.setAttribute("fill", "#7c3aed");
|
|
5330
|
+
sp.appendChild(spp);
|
|
5331
|
+
left.appendChild(sp);
|
|
5332
|
+
left.appendChild(el("span", "font-size:12px;font-weight:800;letter-spacing:.07em;color:#6d28d9;text-transform:uppercase;", "What customers say"));
|
|
5333
|
+
head.appendChild(left);
|
|
5334
|
+
head.appendChild(el("span", "font-size:11px;font-weight:600;color:#a78bda;", "AI-generated"));
|
|
5335
|
+
card.appendChild(head);
|
|
5336
|
+
card.appendChild(el("p", "margin:0;font-size:15px;line-height:1.6;color:#3b2a63;", summary.text));
|
|
5337
|
+
card.appendChild(el("p", "margin:8px 0 0;font-size:12px;color:#a78bda;text-align:right;", `from ${summary.review_count} reviews`));
|
|
5338
|
+
return card;
|
|
5339
|
+
}
|
|
5293
5340
|
function renderWall(data) {
|
|
5294
5341
|
target.innerHTML = "";
|
|
5295
5342
|
const root = el(
|
|
5296
5343
|
"section",
|
|
5297
|
-
|
|
5344
|
+
`font-family:${IN_APP_FONT_STACK};color:#111827;max-width:860px;margin:0 auto;-webkit-font-smoothing:antialiased;`
|
|
5298
5345
|
);
|
|
5299
5346
|
root.setAttribute("data-aegis-reviews", "true");
|
|
5300
5347
|
const summary = data.aggregate.ai_summary;
|
|
5301
|
-
if (summary && summary.text)
|
|
5302
|
-
const card = el(
|
|
5303
|
-
"div",
|
|
5304
|
-
"border:1px solid #ede9fe;background:#faf5ff;border-radius:12px;padding:12px 14px;margin-bottom:14px;"
|
|
5305
|
-
);
|
|
5306
|
-
const h = el("div", "display:flex;align-items:center;gap:6px;margin-bottom:6px;");
|
|
5307
|
-
h.appendChild(sparkles());
|
|
5308
|
-
h.appendChild(el("span", "font-size:12px;font-weight:700;color:#7c3aed;text-transform:uppercase;letter-spacing:.04em;", "AI summary"));
|
|
5309
|
-
card.appendChild(h);
|
|
5310
|
-
card.appendChild(el("p", "margin:0;font-size:14px;line-height:1.5;color:#334155;", summary.text));
|
|
5311
|
-
card.appendChild(
|
|
5312
|
-
el("p", "margin:6px 0 0;font-size:11px;color:#a78bda;text-align:right;", `summarized from ${summary.review_count} reviews`)
|
|
5313
|
-
);
|
|
5314
|
-
root.appendChild(card);
|
|
5315
|
-
}
|
|
5316
|
-
const head = el("div", "display:flex;align-items:center;gap:8px;");
|
|
5317
|
-
const avg = data.aggregate.avg_rating ?? 0;
|
|
5318
|
-
head.appendChild(stars(Math.round(avg), 18));
|
|
5319
|
-
head.appendChild(el("span", "font-size:20px;font-weight:700;", avg ? avg.toFixed(1) : "—"));
|
|
5320
|
-
head.appendChild(
|
|
5321
|
-
el("span", "font-size:13px;color:#64748b;", `${data.aggregate.count} review${data.aggregate.count === 1 ? "" : "s"}`)
|
|
5322
|
-
);
|
|
5323
|
-
root.appendChild(head);
|
|
5348
|
+
if (summary && summary.text) root.appendChild(aiSummaryCard(summary));
|
|
5324
5349
|
if (data.aggregate.count === 0) {
|
|
5325
|
-
root.appendChild(el("p", "
|
|
5350
|
+
root.appendChild(el("p", "font-size:15px;color:#9ca3af;padding:6px 0;", "No reviews yet — be the first to share your experience."));
|
|
5326
5351
|
target.appendChild(root);
|
|
5327
5352
|
return;
|
|
5328
5353
|
}
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
);
|
|
5335
|
-
|
|
5354
|
+
const header = el("div", "display:flex;flex-wrap:wrap;align-items:center;gap:24px 40px;padding-bottom:4px;");
|
|
5355
|
+
const ratingBlock = el("div", "display:flex;flex-direction:column;gap:4px;");
|
|
5356
|
+
const topRow = el("div", "display:flex;align-items:center;gap:12px;");
|
|
5357
|
+
const avg = data.aggregate.avg_rating ?? 0;
|
|
5358
|
+
topRow.appendChild(stars(Math.round(avg), 20));
|
|
5359
|
+
topRow.appendChild(el("span", "font-size:32px;font-weight:800;line-height:1;letter-spacing:-0.02em;", avg ? avg.toFixed(1) : "—"));
|
|
5360
|
+
ratingBlock.appendChild(topRow);
|
|
5361
|
+
ratingBlock.appendChild(el("span", "font-size:13px;color:#6b7280;", `${data.aggregate.count} review${data.aggregate.count === 1 ? "" : "s"} · 100% verified`));
|
|
5362
|
+
header.appendChild(ratingBlock);
|
|
5363
|
+
header.appendChild(distributionPanel(data.aggregate.distribution, data.aggregate.count));
|
|
5364
|
+
root.appendChild(header);
|
|
5365
|
+
root.appendChild(controls(() => {
|
|
5366
|
+
void fetchReviews().then((d) => renderList((d == null ? void 0 : d.items) ?? []));
|
|
5367
|
+
}));
|
|
5368
|
+
listContainer = el("div", "margin-top:2px;");
|
|
5336
5369
|
root.appendChild(listContainer);
|
|
5337
5370
|
renderList(data.items);
|
|
5338
5371
|
target.appendChild(root);
|
|
5339
5372
|
injectJsonLd(target, data, productId);
|
|
5340
5373
|
ctx.trackEvent(ctx.campaign.id, "impression");
|
|
5341
5374
|
}
|
|
5342
|
-
const
|
|
5343
|
-
const compact = displayStyle === "compact";
|
|
5375
|
+
const compact = ic.display_style === "compact";
|
|
5344
5376
|
function renderCompact(data) {
|
|
5345
|
-
var
|
|
5377
|
+
var _a;
|
|
5346
5378
|
target.innerHTML = "";
|
|
5347
5379
|
if (data.aggregate.count === 0) return;
|
|
5348
5380
|
const root = el(
|
|
5349
5381
|
"section",
|
|
5350
|
-
|
|
5382
|
+
`font-family:${IN_APP_FONT_STACK};color:#111827;max-width:860px;margin:0 auto;border:1px solid #f0f1f3;border-radius:16px;padding:16px 18px;`
|
|
5351
5383
|
);
|
|
5352
5384
|
const line = el("div", "display:flex;align-items:center;gap:8px;");
|
|
5353
5385
|
const avg = data.aggregate.avg_rating ?? 0;
|
|
5354
5386
|
line.appendChild(stars(Math.round(avg), 16));
|
|
5355
|
-
line.appendChild(el("span", "font-size:
|
|
5356
|
-
line.appendChild(el("span", "font-size:13px;color:#
|
|
5357
|
-
line.appendChild(
|
|
5387
|
+
line.appendChild(el("span", "font-size:16px;font-weight:700;", avg ? avg.toFixed(1) : "—"));
|
|
5388
|
+
line.appendChild(el("span", "font-size:13px;color:#6b7280;", `(${data.aggregate.count})`));
|
|
5389
|
+
line.appendChild(verifiedBadge());
|
|
5358
5390
|
root.appendChild(line);
|
|
5359
5391
|
const top = data.items.find((i) => i.review_text);
|
|
5360
5392
|
if (top && top.review_text) {
|
|
5361
|
-
|
|
5362
|
-
root.appendChild(
|
|
5363
|
-
root.appendChild(
|
|
5364
|
-
el("span", "font-size:12px;color:#94a3b8;", `— ${((_a2 = top.reviewer_snapshot) == null ? void 0 : _a2.name) ?? "Customer"}`)
|
|
5365
|
-
);
|
|
5393
|
+
root.appendChild(el("p", "margin:10px 0 0;font-size:15px;color:#374151;line-height:1.5;", `“${top.review_text}”`));
|
|
5394
|
+
root.appendChild(el("span", "font-size:13px;color:#9ca3af;", `— ${((_a = top.reviewer_snapshot) == null ? void 0 : _a.name) ?? "Customer"}`));
|
|
5366
5395
|
}
|
|
5367
|
-
const seeAll = el(
|
|
5368
|
-
"button",
|
|
5369
|
-
"margin-top:10px;font-size:13px;font-weight:600;color:#4169e1;background:none;border:none;cursor:pointer;padding:0;",
|
|
5370
|
-
"See all reviews"
|
|
5371
|
-
);
|
|
5396
|
+
const seeAll = el("button", `margin-top:12px;font-size:14px;font-weight:700;color:${accent};background:none;border:none;cursor:pointer;padding:0;font-family:inherit;`, "See all reviews →");
|
|
5372
5397
|
seeAll.addEventListener("click", () => renderWall(data));
|
|
5373
5398
|
root.appendChild(seeAll);
|
|
5374
5399
|
target.appendChild(root);
|
|
@@ -5386,27 +5411,27 @@ function renderReviewsInline(ctx, target, creds) {
|
|
|
5386
5411
|
}
|
|
5387
5412
|
function renderReviewsOverlay(ctx, creds) {
|
|
5388
5413
|
if (typeof document === "undefined" || !(creds == null ? void 0 : creds.apiHost) || !(creds == null ? void 0 : creds.writeKey)) return;
|
|
5414
|
+
ensureInAppFont();
|
|
5389
5415
|
const overlay = document.createElement("div");
|
|
5390
5416
|
overlay.setAttribute("data-campaign-id", ctx.campaign.id);
|
|
5391
|
-
overlay.style.cssText = "position:fixed;inset:0;background:rgba(
|
|
5417
|
+
overlay.style.cssText = "position:fixed;inset:0;background:rgba(17,24,39,0.5);display:flex;align-items:flex-end;justify-content:center;z-index:99999;";
|
|
5392
5418
|
const sheet = document.createElement("div");
|
|
5393
|
-
sheet.style.cssText =
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
const
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
xsvg.setAttribute("height", "18");
|
|
5419
|
+
sheet.style.cssText = `background:#fff;color:#111827;max-width:680px;width:100%;max-height:84vh;overflow-y:auto;border-radius:24px 24px 0 0;padding:18px 18px 28px;font-family:${IN_APP_FONT_STACK};box-shadow:0 -16px 40px rgba(0,0,0,0.14);`;
|
|
5420
|
+
sheet.appendChild(el("div", "width:38px;height:4px;border-radius:999px;background:#e5e7eb;margin:0 auto 14px;"));
|
|
5421
|
+
const bar = el("div", "display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;");
|
|
5422
|
+
bar.appendChild(el("div", "font-weight:800;font-size:17px;", ctx.campaign.title || "Customer reviews"));
|
|
5423
|
+
const close = el("button", "background:none;border:none;cursor:pointer;padding:4px 8px;color:#6b7280;");
|
|
5424
|
+
const x = document.createElementNS(SVG_NS, "svg");
|
|
5425
|
+
x.setAttribute("viewBox", "0 0 24 24");
|
|
5426
|
+
x.setAttribute("width", "20");
|
|
5427
|
+
x.setAttribute("height", "20");
|
|
5403
5428
|
const xp = document.createElementNS(SVG_NS, "path");
|
|
5404
5429
|
xp.setAttribute("d", "M18 6L6 18M6 6l12 12");
|
|
5405
5430
|
xp.setAttribute("stroke", "currentColor");
|
|
5406
5431
|
xp.setAttribute("stroke-width", "2");
|
|
5407
5432
|
xp.setAttribute("stroke-linecap", "round");
|
|
5408
|
-
|
|
5409
|
-
close.appendChild(
|
|
5433
|
+
x.appendChild(xp);
|
|
5434
|
+
close.appendChild(x);
|
|
5410
5435
|
close.setAttribute("aria-label", "Close");
|
|
5411
5436
|
close.addEventListener("click", () => {
|
|
5412
5437
|
ctx.trackEvent(ctx.campaign.id, "dismissed");
|
|
@@ -6677,10 +6702,10 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
6677
6702
|
cbody.appendChild(b);
|
|
6678
6703
|
}
|
|
6679
6704
|
if (couponCode) {
|
|
6680
|
-
const
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
cbody.appendChild(
|
|
6705
|
+
const chip = document.createElement("span");
|
|
6706
|
+
chip.style.cssText = `align-self: flex-start; border: 1px dashed ${text}66; border-radius: 6px; padding: 2px 8px; font-family: monospace; font-size: 11px; letter-spacing: 0.04em;`;
|
|
6707
|
+
chip.textContent = couponCode;
|
|
6708
|
+
cbody.appendChild(chip);
|
|
6684
6709
|
}
|
|
6685
6710
|
if (buttonText) {
|
|
6686
6711
|
const btn = document.createElement("button");
|
|
@@ -7263,19 +7288,19 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
7263
7288
|
ov.appendChild(eyebrow);
|
|
7264
7289
|
ov.appendChild(big);
|
|
7265
7290
|
if (r.code) {
|
|
7266
|
-
const
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7291
|
+
const chip = document.createElement("button");
|
|
7292
|
+
chip.type = "button";
|
|
7293
|
+
chip.textContent = `${r.code} ⧉`;
|
|
7294
|
+
chip.style.cssText = `margin-top: 4px; padding: 9px 16px; border-radius: 999px; border: 1.5px dashed ${text}66; background: transparent; color: ${text}; font-weight: 800; font-size: 14px; letter-spacing: 1px; cursor: pointer;`;
|
|
7295
|
+
chip.addEventListener("click", () => {
|
|
7271
7296
|
var _a;
|
|
7272
7297
|
try {
|
|
7273
7298
|
void ((_a = navigator.clipboard) == null ? void 0 : _a.writeText(r.code));
|
|
7274
|
-
|
|
7299
|
+
chip.textContent = "Copied";
|
|
7275
7300
|
} catch {
|
|
7276
7301
|
}
|
|
7277
7302
|
});
|
|
7278
|
-
ov.appendChild(
|
|
7303
|
+
ov.appendChild(chip);
|
|
7279
7304
|
} else if (r.kind === "freebie") {
|
|
7280
7305
|
const hint = document.createElement("div");
|
|
7281
7306
|
hint.textContent = "🎟️ Show this screen to claim";
|
|
@@ -7309,20 +7334,20 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
7309
7334
|
result.textContent = "";
|
|
7310
7335
|
const tag = document.createElement("span");
|
|
7311
7336
|
tag.textContent = `${r.label} — `;
|
|
7312
|
-
const
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7337
|
+
const chip = document.createElement("button");
|
|
7338
|
+
chip.type = "button";
|
|
7339
|
+
chip.textContent = `${r.code} ⧉`;
|
|
7340
|
+
chip.style.cssText = `padding: 2px 8px; border-radius: 999px; border: 1.5px dashed ${text}66; background: transparent; color: ${text}; font-weight: 800; font-size: 12px; letter-spacing: 0.5px; cursor: pointer;`;
|
|
7341
|
+
chip.addEventListener("click", () => {
|
|
7317
7342
|
var _a;
|
|
7318
7343
|
try {
|
|
7319
7344
|
void ((_a = navigator.clipboard) == null ? void 0 : _a.writeText(r.code));
|
|
7320
|
-
|
|
7345
|
+
chip.textContent = "Copied";
|
|
7321
7346
|
} catch {
|
|
7322
7347
|
}
|
|
7323
7348
|
});
|
|
7324
7349
|
result.appendChild(tag);
|
|
7325
|
-
result.appendChild(
|
|
7350
|
+
result.appendChild(chip);
|
|
7326
7351
|
} else result.textContent = r.label || "Thanks for playing!";
|
|
7327
7352
|
retireCta();
|
|
7328
7353
|
};
|
|
@@ -7974,19 +7999,19 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
7974
7999
|
ov.appendChild(eb);
|
|
7975
8000
|
ov.appendChild(big);
|
|
7976
8001
|
if (code) {
|
|
7977
|
-
const
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
8002
|
+
const chip = document.createElement("button");
|
|
8003
|
+
chip.type = "button";
|
|
8004
|
+
chip.textContent = `${code} ⧉`;
|
|
8005
|
+
chip.style.cssText = `margin-top: 4px; padding: 8px 14px; border-radius: 999px; border: 1.5px dashed ${text}66; background: transparent; color: ${text}; font-weight: 800; font-size: 13px; letter-spacing: 1px; cursor: pointer;`;
|
|
8006
|
+
chip.addEventListener("click", () => {
|
|
7982
8007
|
var _a;
|
|
7983
8008
|
try {
|
|
7984
8009
|
void ((_a = navigator.clipboard) == null ? void 0 : _a.writeText(code));
|
|
7985
|
-
|
|
8010
|
+
chip.textContent = "Copied";
|
|
7986
8011
|
} catch {
|
|
7987
8012
|
}
|
|
7988
8013
|
});
|
|
7989
|
-
ov.appendChild(
|
|
8014
|
+
ov.appendChild(chip);
|
|
7990
8015
|
}
|
|
7991
8016
|
card.appendChild(ov);
|
|
7992
8017
|
try {
|
|
@@ -7996,10 +8021,10 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
7996
8021
|
} else {
|
|
7997
8022
|
prizeText.textContent = icoVal && !isUrl(icoVal) ? `${icoVal} ${label}` : label;
|
|
7998
8023
|
if (code) {
|
|
7999
|
-
const
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
body.appendChild(
|
|
8024
|
+
const chip = document.createElement("div");
|
|
8025
|
+
chip.style.cssText = `margin-top: 6px; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: ${text}14; color: ${text};`;
|
|
8026
|
+
chip.textContent = code;
|
|
8027
|
+
body.appendChild(chip);
|
|
8003
8028
|
}
|
|
8004
8029
|
this._playReaction(body, "celebrate", "gift.json", ic);
|
|
8005
8030
|
}
|