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

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-43HQRF5K.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) {
@@ -1194,6 +1194,62 @@ async function resolveScoredTemplate(opts) {
1194
1194
  return { value, decisionValue, setSlots, unsetSlots };
1195
1195
  }
1196
1196
 
1197
+ // src/storefront-urls.ts
1198
+ function storefrontBase(runtime2) {
1199
+ if (!runtime2 || typeof runtime2 !== "object" || !("storefrontUrl" in runtime2)) return void 0;
1200
+ if (typeof runtime2.storefrontUrl !== "string") return void 0;
1201
+ try {
1202
+ const base = new URL(runtime2.storefrontUrl);
1203
+ return base.protocol === "https:" || base.protocol === "http:" ? base : void 0;
1204
+ } catch {
1205
+ return void 0;
1206
+ }
1207
+ }
1208
+ function resolveAgainst(value, base) {
1209
+ if (typeof value !== "string" || !value || /^(?:[a-z][a-z\d+.-]*:|\/\/|[?#])/i.test(value))
1210
+ return value;
1211
+ try {
1212
+ const resolved = new URL(value, base);
1213
+ return resolved.protocol === "https:" || resolved.protocol === "http:" ? resolved.href : value;
1214
+ } catch {
1215
+ return value;
1216
+ }
1217
+ }
1218
+ function resolveStorePath(value, runtime2) {
1219
+ const base = storefrontBase(runtime2);
1220
+ return base ? resolveAgainst(value, base) : value;
1221
+ }
1222
+ function resolveStorefrontProps(props, runtime2) {
1223
+ const base = storefrontBase(runtime2);
1224
+ if (!base) return props;
1225
+ const resolve = (value) => resolveAgainst(value, base);
1226
+ const product = (value) => ({
1227
+ ...value,
1228
+ ...value.image ? { image: { ...value.image, src: resolve(value.image.src) } } : {},
1229
+ ...Array.isArray(value.ctas) ? {
1230
+ ctas: value.ctas.map((cta) => ({
1231
+ ...cta,
1232
+ ...cta.href ? { href: resolve(cta.href) } : {}
1233
+ }))
1234
+ } : {}
1235
+ });
1236
+ const content = props;
1237
+ return {
1238
+ ...props,
1239
+ ...content.product ? { product: product(content.product) } : {},
1240
+ ...Array.isArray(content.products) ? { products: content.products.map((value) => value ? product(value) : value) } : {},
1241
+ ...Array.isArray(content.items) ? {
1242
+ items: content.items.map(
1243
+ (item) => item ? {
1244
+ ...item,
1245
+ ...item.image_url ? { image_url: resolve(item.image_url) } : {},
1246
+ pdp_href: resolve(item.pdp_href)
1247
+ } : item
1248
+ )
1249
+ } : {}
1250
+ };
1251
+ }
1252
+
1197
1253
  // src/takeover/resurrectionGuard.ts
1198
1254
  function startResurrectionGuard(opts) {
1199
1255
  const maxRetries = opts.maxRetries ?? 3;
@@ -2024,7 +2080,7 @@ var OTHER_PRODUCT_TILE_CSS = `
2024
2080
  font-size: 10px;
2025
2081
  text-transform: uppercase;
2026
2082
  letter-spacing: 0.14em;
2027
- color: var(--opt-primary);
2083
+ color: var(--syntro-pdp-primary-ink, var(--opt-primary));
2028
2084
  font-weight: 600;
2029
2085
  display: flex;
2030
2086
  align-items: center;
@@ -2113,6 +2169,22 @@ var OtherProductTileLit = class extends LitElement3 {
2113
2169
  constructor() {
2114
2170
  super(...arguments);
2115
2171
  this.tile = null;
2172
+ /**
2173
+ * View asks whoever holds the page to open this product. The event crosses
2174
+ * shadow roots, so a canvas that mounts the page can answer it; on a page
2175
+ * where nothing listens, the button does nothing.
2176
+ */
2177
+ this._onView = () => {
2178
+ if (!this.tile) return;
2179
+ const { recommended_product_id: productId, name, image_url, price_cents } = this.tile;
2180
+ this.dispatchEvent(
2181
+ new CustomEvent("syntro:view-product", {
2182
+ bubbles: true,
2183
+ composed: true,
2184
+ detail: { productId, name, image_url, price_cents }
2185
+ })
2186
+ );
2187
+ };
2116
2188
  }
2117
2189
  createRenderRoot() {
2118
2190
  return this;
@@ -2145,7 +2217,9 @@ var OtherProductTileLit = class extends LitElement3 {
2145
2217
  </div>` : null}
2146
2218
  <div class="opt-footer">
2147
2219
  <span class="opt-price">${price}</span>
2148
- <button type="button" class="opt-cta" data-action="view-product">View</button>
2220
+ <button type="button" class="opt-cta" data-action="view-product" @click=${this._onView}>
2221
+ View
2222
+ </button>
2149
2223
  </div>
2150
2224
  </article>
2151
2225
  `;
@@ -3437,13 +3511,35 @@ var _SyntroPdpLit = class _SyntroPdpLit extends LitElement6 {
3437
3511
  }
3438
3512
  container.innerHTML = "";
3439
3513
  const el = document.createElement(tag);
3440
- el.data = inst.content;
3514
+ el.data = this._withStoreImages(tag, inst.content);
3441
3515
  container.appendChild(el);
3442
3516
  this._mountDurations.set(slotId, Math.round(performance.now() - slotStartedAt));
3443
3517
  outcomes.push({ status: "mounted", slot: slotId });
3444
3518
  }
3445
3519
  return outcomes;
3446
3520
  }
3521
+ /**
3522
+ * The cross-sell tiles' images are store-relative catalog paths. Inside an
3523
+ * app host's card the document is the host's sandbox and <base> is blocked,
3524
+ * so each is resolved against the runtime's storefront before the carousel
3525
+ * or grid gets it. On a storefront page there is no storefrontUrl and
3526
+ * nothing changes.
3527
+ */
3528
+ _withStoreImages(tag, content) {
3529
+ if (tag !== "syntro-pdp-other-products-carousel" && tag !== "syntro-pdp-other-products-grid")
3530
+ return content;
3531
+ const tiles = content?.tiles;
3532
+ if (!Array.isArray(tiles)) return content;
3533
+ return {
3534
+ ...content,
3535
+ tiles: tiles.map(
3536
+ (tile) => tile && typeof tile === "object" && "image_url" in tile ? {
3537
+ ...tile,
3538
+ image_url: resolveStorePath(tile.image_url, this.runtimeRef)
3539
+ } : tile
3540
+ )
3541
+ };
3542
+ }
3447
3543
  /** Render from config: score the archetype → mount the preset set-values. */
3448
3544
  async _fireFromConfig(productPresets, score, authedFetch, generation, run, scoreMulti) {
3449
3545
  const startedAt = performance.now();
@@ -3736,7 +3832,7 @@ var _SyntroPdpLit = class _SyntroPdpLit extends LitElement6 {
3736
3832
  [data-syntro-pdp-why][open] > summary { margin-bottom: 6px; }
3737
3833
  [data-syntro-pdp-why-note] { font-size: 11px; color: var(--syntro-pdp-muted, #666); margin: 0 0 4px; }
3738
3834
  [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); }
3835
+ [data-syntro-pdp-why-archetype] strong { color: var(--syntro-pdp-primary-ink, var(--syntro-pdp-primary, #1a1a1a)); }
3740
3836
  [data-syntro-pdp-why-summary] {
3741
3837
  font-size: 12.5px; font-style: italic; color: var(--syntro-pdp-muted, #666); margin: 6px 0 8px;
3742
3838
  border-left: 2px solid var(--syntro-pdp-accent, #555); padding-left: 10px;
@@ -4433,54 +4529,6 @@ function startNativeSlotWatcher() {
4433
4529
  return currentStop;
4434
4530
  }
4435
4531
 
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
4532
  // src/widgets/ProductCardLit.ts
4485
4533
  import { html as html9, LitElement as LitElement8, nothing as nothing4 } from "lit";
4486
4534
  import { styleMap } from "lit/directives/style-map.js";
@@ -8059,8 +8107,10 @@ var ProductDetailsLit = class extends LitElement10 {
8059
8107
  const eyebrow = [d?.category, d?.gender].filter(Boolean).join(" \xB7 ");
8060
8108
  const badges = d?.badges ?? [];
8061
8109
  const benefits = d?.benefits ?? [];
8110
+ const moreBenefits = benefits.slice(3);
8111
+ const hasFabric = Boolean(d?.fabric || moreBenefits.length);
8062
8112
  const hasCols = Boolean(
8063
- d && (d.fabric || (d.benefits?.length ?? 0) > 0 || (d.care?.length ?? 0) > 0 || d.shipping || d.returns)
8113
+ d && (hasFabric || (d.care?.length ?? 0) > 0 || d.shipping || d.returns)
8064
8114
  );
8065
8115
  const hasLead = Boolean(
8066
8116
  eyebrow || badges.length || details.rating || details.description || benefits.length
@@ -8081,13 +8131,13 @@ var ProductDetailsLit = class extends LitElement10 {
8081
8131
  </ul>` : nothing6}
8082
8132
  </div>
8083
8133
  ${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>
8134
+ ${hasFabric ? html11`<div>
8135
+ <h3>Fabric &amp; benefits</h3>
8136
+ ${d?.fabric ? html11`<p>${d.fabric}</p>` : nothing6}
8137
+ ${moreBenefits.length ? html11`<ul>
8138
+ ${moreBenefits.map((b) => html11`<li>${b}</li>`)}
8139
+ </ul>` : nothing6}
8140
+ </div>` : nothing6}
8091
8141
  <div>
8092
8142
  <h3>Shipping &amp; returns</h3>
8093
8143
  ${d?.shipping ? html11`<p>${d.shipping}</p>` : nothing6}
@@ -8608,11 +8658,12 @@ var TRENDING_NEWS_CSS = `
8608
8658
  outline: none;
8609
8659
  }
8610
8660
  .pdp-tn-headline-link::after {
8611
- content: ' \\2197';
8661
+ /* Decoration: empty alternative text keeps it out of the link's name. */
8662
+ content: ' \\2197' / '';
8612
8663
  font-family: var(--tn-sans);
8613
8664
  font-size: 0.65em;
8614
8665
  letter-spacing: 0;
8615
- color: var(--tn-primary);
8666
+ color: var(--syntro-pdp-primary-ink, var(--tn-primary));
8616
8667
  opacity: 0.55;
8617
8668
  vertical-align: 0.18em;
8618
8669
  margin-left: 0.2em;
@@ -8631,7 +8682,7 @@ var TRENDING_NEWS_CSS = `
8631
8682
  font-style: italic;
8632
8683
  font-size: 11px;
8633
8684
  letter-spacing: 0.06em;
8634
- color: color-mix(in srgb, var(--tn-primary) 70%, transparent);
8685
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--tn-primary) 70%, transparent));
8635
8686
  padding: 3px 9px 3px 8px;
8636
8687
  border-radius: 999px;
8637
8688
  background: color-mix(in srgb, var(--tn-primary) 12%, transparent);
@@ -10213,12 +10264,12 @@ var CHART_CSS = `
10213
10264
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc-primary) 12%, transparent), transparent 80%);
10214
10265
  }
10215
10266
  .pdp-chart-table tbody tr.is-winning td:first-child {
10216
- color: color-mix(in srgb, var(--pc-primary) 70%, white 30%);
10267
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pc-primary) 70%, white 30%));
10217
10268
  }
10218
10269
  .pdp-chart-table tbody tr.is-winning td:first-child::before {
10219
10270
  content: '\\2726 ';
10220
10271
  font-size: 11px;
10221
- color: color-mix(in srgb, var(--pc-primary) 60%, white 40%);
10272
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pc-primary) 60%, white 40%));
10222
10273
  vertical-align: 1px;
10223
10274
  margin-right: 2px;
10224
10275
  }
@@ -11436,7 +11487,7 @@ var RIBBON_CSS = `
11436
11487
  width: 16px;
11437
11488
  height: 16px;
11438
11489
  display: inline-block;
11439
- color: var(--rb-primary);
11490
+ color: var(--syntro-pdp-primary-ink, var(--rb-primary));
11440
11491
  }
11441
11492
  .syntro-pdp-ribbon-copy {
11442
11493
  font-family: var(--rb-display);
@@ -11453,7 +11504,7 @@ var RIBBON_CSS = `
11453
11504
  font-style: normal;
11454
11505
  font-family: var(--syntro-pdp-sans, inherit);
11455
11506
  font-weight: 500;
11456
- color: var(--rb-primary);
11507
+ color: var(--syntro-pdp-primary-ink, var(--rb-primary));
11457
11508
  font-size: 14.5px;
11458
11509
  letter-spacing: 0;
11459
11510
  }
@@ -11655,7 +11706,7 @@ var QA_CSS = `
11655
11706
  background: color-mix(in srgb, var(--qa-primary) 14%, transparent);
11656
11707
  display: grid;
11657
11708
  place-items: center;
11658
- color: color-mix(in srgb, var(--qa-primary) 80%, white 20%);
11709
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--qa-primary) 80%, white 20%));
11659
11710
  transition: background 200ms ease, transform 200ms ease;
11660
11711
  }
11661
11712
  .pdp-qa-item[open] .pdp-qa-toggle {
@@ -11881,7 +11932,7 @@ var REGIONAL_CSS = `
11881
11932
  font-size: 11px;
11882
11933
  letter-spacing: 0.12em;
11883
11934
  text-transform: uppercase;
11884
- color: color-mix(in srgb, var(--rg-primary) 75%, white 25%);
11935
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--rg-primary) 75%, white 25%));
11885
11936
  font-weight: 500;
11886
11937
  margin-bottom: 22px;
11887
11938
  }
@@ -11913,7 +11964,7 @@ var REGIONAL_CSS = `
11913
11964
  .pdp-regional-headline em {
11914
11965
  font-style: italic;
11915
11966
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
11916
- color: var(--rg-primary);
11967
+ color: var(--syntro-pdp-primary-ink, var(--rg-primary));
11917
11968
  }
11918
11969
 
11919
11970
  .pdp-regional-body {
@@ -11937,7 +11988,7 @@ var REGIONAL_CSS = `
11937
11988
  font-family: var(--rg-display);
11938
11989
  font-size: 14.5px;
11939
11990
  font-variation-settings: 'SOFT' 70;
11940
- color: color-mix(in srgb, var(--rg-primary) 65%, white 35%);
11991
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--rg-primary) 65%, white 35%));
11941
11992
  line-height: 1.5;
11942
11993
  }
11943
11994
  .pdp-regional-footer-spark {
@@ -12184,14 +12235,14 @@ var PEER_FEED_CSS = `
12184
12235
  }
12185
12236
  .pdp-peer-quote::before {
12186
12237
  content: '\u201C ';
12187
- color: color-mix(in srgb, var(--pf-primary) 60%, transparent);
12238
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pf-primary) 60%, transparent));
12188
12239
  font-size: 1.4em;
12189
12240
  vertical-align: -0.2em;
12190
12241
  margin-right: -2px;
12191
12242
  }
12192
12243
  .pdp-peer-quote::after {
12193
12244
  content: ' \u201D';
12194
- color: color-mix(in srgb, var(--pf-primary) 60%, transparent);
12245
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pf-primary) 60%, transparent));
12195
12246
  font-size: 1.4em;
12196
12247
  vertical-align: -0.2em;
12197
12248
  margin-left: -2px;
@@ -12202,7 +12253,7 @@ var PEER_FEED_CSS = `
12202
12253
  align-items: center;
12203
12254
  gap: 7px;
12204
12255
  font-size: 12.5px;
12205
- color: color-mix(in srgb, var(--pf-primary) 75%, white 25%);
12256
+ color: var(--syntro-pdp-primary-ink, color-mix(in srgb, var(--pf-primary) 75%, white 25%));
12206
12257
  font-style: italic;
12207
12258
  font-family: var(--pf-display);
12208
12259
  margin-top: 2px;
@@ -12578,4 +12629,4 @@ export {
12578
12629
  * SPDX-License-Identifier: BSD-3-Clause
12579
12630
  *)
12580
12631
  */
12581
- //# sourceMappingURL=chunk-PSDTEKMC.js.map
12632
+ //# sourceMappingURL=chunk-43HQRF5K.js.map