@syntrologie/adapt-product 2.8.0-canary.596 → 2.8.0-canary.598

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/cdn.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  onActivate,
3
3
  runtime
4
- } from "./chunk-PSDTEKMC.js";
5
- import "./chunk-7HPU72GE.js";
4
+ } from "./chunk-3UZIKQK5.js";
5
+ import "./chunk-SOOOZIJJ.js";
6
6
 
7
7
  // src/cdn.ts
8
8
  var manifest = {
@@ -12,7 +12,7 @@ import {
12
12
  heroSchema,
13
13
  recoSchema,
14
14
  takeoverPlanSchema
15
- } from "./chunk-7HPU72GE.js";
15
+ } from "./chunk-SOOOZIJJ.js";
16
16
 
17
17
  // ../../../node_modules/@lit/context/lib/create-context.js
18
18
  function n(n2) {
@@ -244,6 +244,12 @@ var TELEMETRY_EVENTS = {
244
244
  };
245
245
  var TELEMETRY_EVENT_NAMES = Object.keys(TELEMETRY_EVENTS);
246
246
 
247
+ // ../../sdk-contracts/dist/card-lifecycle.js
248
+ var MCP_APP_SURFACE_ATTRIBUTES = Object.freeze({
249
+ surface_type: "mcp-app",
250
+ surface: "personal_agent"
251
+ });
252
+
247
253
  // ../../sdk-contracts/dist/detector-events.js
248
254
  var DETECTOR_EVENT_NAMES = [
249
255
  "ui.hover",
@@ -1194,6 +1200,62 @@ async function resolveScoredTemplate(opts) {
1194
1200
  return { value, decisionValue, setSlots, unsetSlots };
1195
1201
  }
1196
1202
 
1203
+ // src/storefront-urls.ts
1204
+ function storefrontBase(runtime2) {
1205
+ if (!runtime2 || typeof runtime2 !== "object" || !("storefrontUrl" in runtime2)) return void 0;
1206
+ if (typeof runtime2.storefrontUrl !== "string") return void 0;
1207
+ try {
1208
+ const base = new URL(runtime2.storefrontUrl);
1209
+ return base.protocol === "https:" || base.protocol === "http:" ? base : void 0;
1210
+ } catch {
1211
+ return void 0;
1212
+ }
1213
+ }
1214
+ function resolveAgainst(value, base) {
1215
+ if (typeof value !== "string" || !value || /^(?:[a-z][a-z\d+.-]*:|\/\/|[?#])/i.test(value))
1216
+ return value;
1217
+ try {
1218
+ const resolved = new URL(value, base);
1219
+ return resolved.protocol === "https:" || resolved.protocol === "http:" ? resolved.href : value;
1220
+ } catch {
1221
+ return value;
1222
+ }
1223
+ }
1224
+ function resolveStorePath(value, runtime2) {
1225
+ const base = storefrontBase(runtime2);
1226
+ return base ? resolveAgainst(value, base) : value;
1227
+ }
1228
+ function resolveStorefrontProps(props, runtime2) {
1229
+ const base = storefrontBase(runtime2);
1230
+ if (!base) return props;
1231
+ const resolve = (value) => resolveAgainst(value, base);
1232
+ const product = (value) => ({
1233
+ ...value,
1234
+ ...value.image ? { image: { ...value.image, src: resolve(value.image.src) } } : {},
1235
+ ...Array.isArray(value.ctas) ? {
1236
+ ctas: value.ctas.map((cta) => ({
1237
+ ...cta,
1238
+ ...cta.href ? { href: resolve(cta.href) } : {}
1239
+ }))
1240
+ } : {}
1241
+ });
1242
+ const content = props;
1243
+ return {
1244
+ ...props,
1245
+ ...content.product ? { product: product(content.product) } : {},
1246
+ ...Array.isArray(content.products) ? { products: content.products.map((value) => value ? product(value) : value) } : {},
1247
+ ...Array.isArray(content.items) ? {
1248
+ items: content.items.map(
1249
+ (item) => item ? {
1250
+ ...item,
1251
+ ...item.image_url ? { image_url: resolve(item.image_url) } : {},
1252
+ pdp_href: resolve(item.pdp_href)
1253
+ } : item
1254
+ )
1255
+ } : {}
1256
+ };
1257
+ }
1258
+
1197
1259
  // src/takeover/resurrectionGuard.ts
1198
1260
  function startResurrectionGuard(opts) {
1199
1261
  const maxRetries = opts.maxRetries ?? 3;
@@ -2024,7 +2086,7 @@ var OTHER_PRODUCT_TILE_CSS = `
2024
2086
  font-size: 10px;
2025
2087
  text-transform: uppercase;
2026
2088
  letter-spacing: 0.14em;
2027
- color: var(--opt-primary);
2089
+ color: var(--syntro-pdp-primary-ink, var(--opt-primary));
2028
2090
  font-weight: 600;
2029
2091
  display: flex;
2030
2092
  align-items: center;
@@ -2113,6 +2175,22 @@ var OtherProductTileLit = class extends LitElement3 {
2113
2175
  constructor() {
2114
2176
  super(...arguments);
2115
2177
  this.tile = null;
2178
+ /**
2179
+ * View asks whoever holds the page to open this product. The event crosses
2180
+ * shadow roots, so a canvas that mounts the page can answer it; on a page
2181
+ * where nothing listens, the button does nothing.
2182
+ */
2183
+ this._onView = () => {
2184
+ if (!this.tile) return;
2185
+ const { recommended_product_id: productId, name, image_url, price_cents } = this.tile;
2186
+ this.dispatchEvent(
2187
+ new CustomEvent("syntro:view-product", {
2188
+ bubbles: true,
2189
+ composed: true,
2190
+ detail: { productId, name, image_url, price_cents }
2191
+ })
2192
+ );
2193
+ };
2116
2194
  }
2117
2195
  createRenderRoot() {
2118
2196
  return this;
@@ -2145,7 +2223,9 @@ var OtherProductTileLit = class extends LitElement3 {
2145
2223
  </div>` : null}
2146
2224
  <div class="opt-footer">
2147
2225
  <span class="opt-price">${price}</span>
2148
- <button type="button" class="opt-cta" data-action="view-product">View</button>
2226
+ <button type="button" class="opt-cta" data-action="view-product" @click=${this._onView}>
2227
+ View
2228
+ </button>
2149
2229
  </div>
2150
2230
  </article>
2151
2231
  `;
@@ -3437,13 +3517,35 @@ var _SyntroPdpLit = class _SyntroPdpLit extends LitElement6 {
3437
3517
  }
3438
3518
  container.innerHTML = "";
3439
3519
  const el = document.createElement(tag);
3440
- el.data = inst.content;
3520
+ el.data = this._withStoreImages(tag, inst.content);
3441
3521
  container.appendChild(el);
3442
3522
  this._mountDurations.set(slotId, Math.round(performance.now() - slotStartedAt));
3443
3523
  outcomes.push({ status: "mounted", slot: slotId });
3444
3524
  }
3445
3525
  return outcomes;
3446
3526
  }
3527
+ /**
3528
+ * The cross-sell tiles' images are store-relative catalog paths. Inside an
3529
+ * app host's card the document is the host's sandbox and <base> is blocked,
3530
+ * so each is resolved against the runtime's storefront before the carousel
3531
+ * or grid gets it. On a storefront page there is no storefrontUrl and
3532
+ * nothing changes.
3533
+ */
3534
+ _withStoreImages(tag, content) {
3535
+ if (tag !== "syntro-pdp-other-products-carousel" && tag !== "syntro-pdp-other-products-grid")
3536
+ return content;
3537
+ const tiles = content?.tiles;
3538
+ if (!Array.isArray(tiles)) return content;
3539
+ return {
3540
+ ...content,
3541
+ tiles: tiles.map(
3542
+ (tile) => tile && typeof tile === "object" && "image_url" in tile ? {
3543
+ ...tile,
3544
+ image_url: resolveStorePath(tile.image_url, this.runtimeRef)
3545
+ } : tile
3546
+ )
3547
+ };
3548
+ }
3447
3549
  /** Render from config: score the archetype → mount the preset set-values. */
3448
3550
  async _fireFromConfig(productPresets, score, authedFetch, generation, run, scoreMulti) {
3449
3551
  const startedAt = performance.now();
@@ -3736,7 +3838,7 @@ var _SyntroPdpLit = class _SyntroPdpLit extends LitElement6 {
3736
3838
  [data-syntro-pdp-why][open] > summary { margin-bottom: 6px; }
3737
3839
  [data-syntro-pdp-why-note] { font-size: 11px; color: var(--syntro-pdp-muted, #666); margin: 0 0 4px; }
3738
3840
  [data-syntro-pdp-why-archetype] { font-size: 13px; margin: 3px 0; color: var(--syntro-pdp-fg, #1a1a1a); }
3739
- [data-syntro-pdp-why-archetype] strong { color: var(--syntro-pdp-primary, #1a1a1a); }
3841
+ [data-syntro-pdp-why-archetype] strong { color: var(--syntro-pdp-primary-ink, var(--syntro-pdp-primary, #1a1a1a)); }
3740
3842
  [data-syntro-pdp-why-summary] {
3741
3843
  font-size: 12.5px; font-style: italic; color: var(--syntro-pdp-muted, #666); margin: 6px 0 8px;
3742
3844
  border-left: 2px solid var(--syntro-pdp-accent, #555); padding-left: 10px;
@@ -4433,54 +4535,6 @@ function startNativeSlotWatcher() {
4433
4535
  return currentStop;
4434
4536
  }
4435
4537
 
4436
- // src/storefront-urls.ts
4437
- function resolveStorefrontProps(props, runtime2) {
4438
- if (!runtime2 || typeof runtime2 !== "object" || !("storefrontUrl" in runtime2)) return props;
4439
- if (typeof runtime2.storefrontUrl !== "string") return props;
4440
- let base;
4441
- try {
4442
- base = new URL(runtime2.storefrontUrl);
4443
- if (base.protocol !== "https:" && base.protocol !== "http:") return props;
4444
- } catch {
4445
- return props;
4446
- }
4447
- const resolve = (value) => {
4448
- if (typeof value !== "string" || !value || /^(?:[a-z][a-z\d+.-]*:|\/\/|[?#])/i.test(value))
4449
- return value;
4450
- try {
4451
- const resolved = new URL(value, base);
4452
- return resolved.protocol === "https:" || resolved.protocol === "http:" ? resolved.href : value;
4453
- } catch {
4454
- return value;
4455
- }
4456
- };
4457
- const product = (value) => ({
4458
- ...value,
4459
- ...value.image ? { image: { ...value.image, src: resolve(value.image.src) } } : {},
4460
- ...Array.isArray(value.ctas) ? {
4461
- ctas: value.ctas.map((cta) => ({
4462
- ...cta,
4463
- ...cta.href ? { href: resolve(cta.href) } : {}
4464
- }))
4465
- } : {}
4466
- });
4467
- const content = props;
4468
- return {
4469
- ...props,
4470
- ...content.product ? { product: product(content.product) } : {},
4471
- ...Array.isArray(content.products) ? { products: content.products.map((value) => value ? product(value) : value) } : {},
4472
- ...Array.isArray(content.items) ? {
4473
- items: content.items.map(
4474
- (item) => item ? {
4475
- ...item,
4476
- ...item.image_url ? { image_url: resolve(item.image_url) } : {},
4477
- pdp_href: resolve(item.pdp_href)
4478
- } : item
4479
- )
4480
- } : {}
4481
- };
4482
- }
4483
-
4484
4538
  // src/widgets/ProductCardLit.ts
4485
4539
  import { html as html9, LitElement as LitElement8, nothing as nothing4 } from "lit";
4486
4540
  import { styleMap } from "lit/directives/style-map.js";
@@ -8059,8 +8113,10 @@ var ProductDetailsLit = class extends LitElement10 {
8059
8113
  const eyebrow = [d?.category, d?.gender].filter(Boolean).join(" \xB7 ");
8060
8114
  const badges = d?.badges ?? [];
8061
8115
  const benefits = d?.benefits ?? [];
8116
+ const moreBenefits = benefits.slice(3);
8117
+ const hasFabric = Boolean(d?.fabric || moreBenefits.length);
8062
8118
  const hasCols = Boolean(
8063
- d && (d.fabric || (d.benefits?.length ?? 0) > 0 || (d.care?.length ?? 0) > 0 || d.shipping || d.returns)
8119
+ d && (hasFabric || (d.care?.length ?? 0) > 0 || d.shipping || d.returns)
8064
8120
  );
8065
8121
  const hasLead = Boolean(
8066
8122
  eyebrow || badges.length || details.rating || details.description || benefits.length
@@ -8081,13 +8137,13 @@ var ProductDetailsLit = class extends LitElement10 {
8081
8137
  </ul>` : nothing6}
8082
8138
  </div>
8083
8139
  ${hasCols ? html11`<div class="pd-cols">
8084
- <div>
8085
- <h3>Fabric &amp; benefits</h3>
8086
- ${d?.fabric ? html11`<p>${d.fabric}</p>` : nothing6}
8087
- ${d?.benefits?.length ? html11`<ul>
8088
- ${d.benefits.map((b) => html11`<li>${b}</li>`)}
8089
- </ul>` : nothing6}
8090
- </div>
8140
+ ${hasFabric ? html11`<div>
8141
+ <h3>Fabric &amp; benefits</h3>
8142
+ ${d?.fabric ? html11`<p>${d.fabric}</p>` : nothing6}
8143
+ ${moreBenefits.length ? html11`<ul>
8144
+ ${moreBenefits.map((b) => html11`<li>${b}</li>`)}
8145
+ </ul>` : nothing6}
8146
+ </div>` : nothing6}
8091
8147
  <div>
8092
8148
  <h3>Shipping &amp; returns</h3>
8093
8149
  ${d?.shipping ? html11`<p>${d.shipping}</p>` : nothing6}
@@ -8608,11 +8664,12 @@ var TRENDING_NEWS_CSS = `
8608
8664
  outline: none;
8609
8665
  }
8610
8666
  .pdp-tn-headline-link::after {
8611
- content: ' \\2197';
8667
+ /* Decoration: empty alternative text keeps it out of the link's name. */
8668
+ content: ' \\2197' / '';
8612
8669
  font-family: var(--tn-sans);
8613
8670
  font-size: 0.65em;
8614
8671
  letter-spacing: 0;
8615
- color: var(--tn-primary);
8672
+ color: var(--syntro-pdp-primary-ink, var(--tn-primary));
8616
8673
  opacity: 0.55;
8617
8674
  vertical-align: 0.18em;
8618
8675
  margin-left: 0.2em;
@@ -8631,7 +8688,7 @@ var TRENDING_NEWS_CSS = `
8631
8688
  font-style: italic;
8632
8689
  font-size: 11px;
8633
8690
  letter-spacing: 0.06em;
8634
- color: color-mix(in srgb, var(--tn-primary) 70%, transparent);
8691
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--tn-primary) 70%, transparent));
8635
8692
  padding: 3px 9px 3px 8px;
8636
8693
  border-radius: 999px;
8637
8694
  background: color-mix(in srgb, var(--tn-primary) 12%, transparent);
@@ -10213,12 +10270,12 @@ var CHART_CSS = `
10213
10270
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc-primary) 12%, transparent), transparent 80%);
10214
10271
  }
10215
10272
  .pdp-chart-table tbody tr.is-winning td:first-child {
10216
- color: color-mix(in srgb, var(--pc-primary) 70%, white 30%);
10273
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pc-primary) 70%, white 30%));
10217
10274
  }
10218
10275
  .pdp-chart-table tbody tr.is-winning td:first-child::before {
10219
10276
  content: '\\2726 ';
10220
10277
  font-size: 11px;
10221
- color: color-mix(in srgb, var(--pc-primary) 60%, white 40%);
10278
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pc-primary) 60%, white 40%));
10222
10279
  vertical-align: 1px;
10223
10280
  margin-right: 2px;
10224
10281
  }
@@ -11436,7 +11493,7 @@ var RIBBON_CSS = `
11436
11493
  width: 16px;
11437
11494
  height: 16px;
11438
11495
  display: inline-block;
11439
- color: var(--rb-primary);
11496
+ color: var(--syntro-pdp-primary-ink, var(--rb-primary));
11440
11497
  }
11441
11498
  .syntro-pdp-ribbon-copy {
11442
11499
  font-family: var(--rb-display);
@@ -11453,7 +11510,7 @@ var RIBBON_CSS = `
11453
11510
  font-style: normal;
11454
11511
  font-family: var(--syntro-pdp-sans, inherit);
11455
11512
  font-weight: 500;
11456
- color: var(--rb-primary);
11513
+ color: var(--syntro-pdp-primary-ink, var(--rb-primary));
11457
11514
  font-size: 14.5px;
11458
11515
  letter-spacing: 0;
11459
11516
  }
@@ -11655,7 +11712,7 @@ var QA_CSS = `
11655
11712
  background: color-mix(in srgb, var(--qa-primary) 14%, transparent);
11656
11713
  display: grid;
11657
11714
  place-items: center;
11658
- color: color-mix(in srgb, var(--qa-primary) 80%, white 20%);
11715
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--qa-primary) 80%, white 20%));
11659
11716
  transition: background 200ms ease, transform 200ms ease;
11660
11717
  }
11661
11718
  .pdp-qa-item[open] .pdp-qa-toggle {
@@ -11881,7 +11938,7 @@ var REGIONAL_CSS = `
11881
11938
  font-size: 11px;
11882
11939
  letter-spacing: 0.12em;
11883
11940
  text-transform: uppercase;
11884
- color: color-mix(in srgb, var(--rg-primary) 75%, white 25%);
11941
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--rg-primary) 75%, white 25%));
11885
11942
  font-weight: 500;
11886
11943
  margin-bottom: 22px;
11887
11944
  }
@@ -11913,7 +11970,7 @@ var REGIONAL_CSS = `
11913
11970
  .pdp-regional-headline em {
11914
11971
  font-style: italic;
11915
11972
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
11916
- color: var(--rg-primary);
11973
+ color: var(--syntro-pdp-primary-ink, var(--rg-primary));
11917
11974
  }
11918
11975
 
11919
11976
  .pdp-regional-body {
@@ -11937,7 +11994,7 @@ var REGIONAL_CSS = `
11937
11994
  font-family: var(--rg-display);
11938
11995
  font-size: 14.5px;
11939
11996
  font-variation-settings: 'SOFT' 70;
11940
- color: color-mix(in srgb, var(--rg-primary) 65%, white 35%);
11997
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--rg-primary) 65%, white 35%));
11941
11998
  line-height: 1.5;
11942
11999
  }
11943
12000
  .pdp-regional-footer-spark {
@@ -12184,14 +12241,14 @@ var PEER_FEED_CSS = `
12184
12241
  }
12185
12242
  .pdp-peer-quote::before {
12186
12243
  content: '\u201C ';
12187
- color: color-mix(in srgb, var(--pf-primary) 60%, transparent);
12244
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pf-primary) 60%, transparent));
12188
12245
  font-size: 1.4em;
12189
12246
  vertical-align: -0.2em;
12190
12247
  margin-right: -2px;
12191
12248
  }
12192
12249
  .pdp-peer-quote::after {
12193
12250
  content: ' \u201D';
12194
- color: color-mix(in srgb, var(--pf-primary) 60%, transparent);
12251
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pf-primary) 60%, transparent));
12195
12252
  font-size: 1.4em;
12196
12253
  vertical-align: -0.2em;
12197
12254
  margin-left: -2px;
@@ -12202,7 +12259,7 @@ var PEER_FEED_CSS = `
12202
12259
  align-items: center;
12203
12260
  gap: 7px;
12204
12261
  font-size: 12.5px;
12205
- color: color-mix(in srgb, var(--pf-primary) 75%, white 25%);
12262
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pf-primary) 75%, white 25%));
12206
12263
  font-style: italic;
12207
12264
  font-family: var(--pf-display);
12208
12265
  margin-top: 2px;
@@ -12578,4 +12635,4 @@ export {
12578
12635
  * SPDX-License-Identifier: BSD-3-Clause
12579
12636
  *)
12580
12637
  */
12581
- //# sourceMappingURL=chunk-PSDTEKMC.js.map
12638
+ //# sourceMappingURL=chunk-3UZIKQK5.js.map