@active-reach/web-sdk 1.31.0 → 1.33.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.
@@ -1 +1 @@
1
- {"version":3,"file":"reviews.d.ts","sourceRoot":"","sources":["../../../src/inapp/renderers/reviews.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C;iFACiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAuKD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAuQT;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAgCxF"}
1
+ {"version":3,"file":"reviews.d.ts","sourceRoot":"","sources":["../../../src/inapp/renderers/reviews.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C;iFACiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAuKD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAqRT;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAgCxF"}
package/dist/index.js CHANGED
@@ -5170,8 +5170,11 @@ function renderReviewsInline(ctx, target, creds) {
5170
5170
  if (typeof document === "undefined" || !(creds == null ? void 0 : creds.apiHost) || !(creds == null ? void 0 : creds.writeKey)) return false;
5171
5171
  ensureInAppFont();
5172
5172
  const ic = ctx.campaign.interactive_config || {};
5173
- const accent = ctx.sanitizeColor(ctx.campaign.background_color || "#4169e1");
5174
- const brand = String(ic.brand_name || "").trim() || "The store";
5173
+ const accent = ctx.sanitizeColor(
5174
+ target.getAttribute("data-accent") || ctx.campaign.background_color || "#4169e1"
5175
+ );
5176
+ const rawBrand = (target.getAttribute("data-brand-name") || String(ic.brand_name || "")).trim();
5177
+ const brand = (rawBrand.split(/\s[|·–-]\s/)[0] || "").trim() || "The store";
5175
5178
  const productId = target.getAttribute("data-product-id") || ctx.campaign.product_id || null;
5176
5179
  const state = { sort: "recent", withPhotos: false };
5177
5180
  target.innerHTML = "";
@@ -5185,7 +5188,7 @@ function renderReviewsInline(ctx, target, creds) {
5185
5188
  return url.toString();
5186
5189
  }
5187
5190
  function fetchReviews() {
5188
- return fetch(buildUrl(), { method: "GET", headers: { "X-Aegis-Write-Key": creds.writeKey } }).then((r) => r.ok ? r.json() : null).catch(() => null);
5191
+ return fetch(buildUrl(), { method: "GET", cache: "no-store", headers: { "X-Aegis-Write-Key": creds.writeKey } }).then((r) => r.ok ? r.json() : null).catch(() => null);
5189
5192
  }
5190
5193
  let listContainer = null;
5191
5194
  function reviewCard(r) {
@@ -5296,7 +5299,7 @@ function renderReviewsInline(ctx, target, creds) {
5296
5299
  return bar;
5297
5300
  }
5298
5301
  function distributionPanel(dist, total) {
5299
- const box = el("div", "flex:1 1 260px;max-width:340px;display:flex;flex-direction:column;gap:7px;");
5302
+ const box = el("div", "flex:0 1 300px;width:300px;max-width:100%;display:flex;flex-direction:column;gap:7px;");
5300
5303
  for (let r = 5; r >= 1; r--) {
5301
5304
  const n = dist[String(r)] ?? 0;
5302
5305
  const pct = total > 0 ? Math.round(n / total * 100) : 0;