@syntrologie/adapt-product 2.46.0 → 2.48.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.
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Which CTA opens the item's own page?
3
+ *
4
+ * Both tappable product surfaces (the comparison media card, the card's
5
+ * name-link) used to answer this with `ctas.find((c) => c.href)` — "the first
6
+ * CTA that navigates". That silently encoded the COMMERCE CTA shape:
7
+ *
8
+ * commerce: [0] Add to cart (actionId, NO href) -> skipped
9
+ * [1] Product Page (href) -> correct target
10
+ *
11
+ * booking: [0] Book a consult (href!) -> STOPS HERE (bug)
12
+ * [1] Service Page (href) -> the real target
13
+ *
14
+ * On iGlow Med Spa every catalog entry is booking fulfilment with no href of
15
+ * its own, so all 50 resolved to ONE generic workspace default
16
+ * (go.booker.com/location/iglowmed/service-menu). Tapping a comparison image
17
+ * opened a generic scheduling menu instead of the treatment's page.
18
+ *
19
+ * The server now marks the entity's own page in BOTH shapes with
20
+ * `actionId: "view_detail"` (product_hydration.VIEW_DETAIL_ACTION_ID), so the
21
+ * choice is semantic instead of positional.
22
+ */
23
+ /** The server's marker for "this CTA points at the entity's own page". */
24
+ export declare const VIEW_DETAIL_ACTION_ID = "view_detail";
25
+ /** Structural minimum this module needs; the full CTA type lives in the Zod schema. */
26
+ export interface DetailCtaLike {
27
+ href?: string;
28
+ actionId?: string;
29
+ variant?: string;
30
+ target?: string;
31
+ label?: string;
32
+ }
33
+ /**
34
+ * Resolve the detail-page CTA, or `undefined` when nothing navigates (the card
35
+ * then renders as plain, non-tappable content rather than a dead link).
36
+ *
37
+ * Preference order — a marked CTA always wins, but the unmarked tiers keep
38
+ * LLM- and config-authored `ctas[]` (which never carry `view_detail`) working,
39
+ * and cover a runtime talking to a server older than the marker:
40
+ *
41
+ * 1. `actionId === "view_detail"` WITH an href — the explicit answer.
42
+ * 2. A navigating CTA that is not the primary action. In both server shapes
43
+ * the page link is the ghost/secondary one, so this recovers the correct
44
+ * target for unmarked booking data instead of reproducing the bug.
45
+ * 3. Any navigating CTA — the tier-3 hydration case, where the primary CTA
46
+ * IS the entity's page and no second CTA exists.
47
+ */
48
+ export declare function pickDetailCta<T extends DetailCtaLike>(ctas: readonly T[] | undefined): T | undefined;
49
+ //# sourceMappingURL=detail-cta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detail-cta.d.ts","sourceRoot":"","sources":["../src/detail-cta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD,uFAAuF;AACvF,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,aAAa,EACnD,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAC7B,CAAC,GAAG,SAAS,CASf"}
package/dist/runtime.d.ts CHANGED
@@ -57,7 +57,15 @@ export declare const ProductCardMountable: {
57
57
  mount(container: HTMLElement, config?: ({
58
58
  product: {
59
59
  name: string;
60
- image: {
60
+ id: string;
61
+ ctas: {
62
+ label: string;
63
+ target: "_self" | "_blank";
64
+ variant: "primary" | "secondary" | "ghost";
65
+ href?: string | undefined;
66
+ actionId?: string | undefined;
67
+ }[];
68
+ image?: {
61
69
  src: string;
62
70
  alt: string;
63
71
  bind?: {
@@ -74,15 +82,7 @@ export declare const ProductCardMountable: {
74
82
  type: "jsonld";
75
83
  url?: string | undefined;
76
84
  } | undefined;
77
- };
78
- id: string;
79
- ctas: {
80
- label: string;
81
- target: "_self" | "_blank";
82
- variant: "primary" | "secondary" | "ghost";
83
- href?: string | undefined;
84
- actionId?: string | undefined;
85
- }[];
85
+ } | undefined;
86
86
  tagline?: string | undefined;
87
87
  price?: {
88
88
  amount: string;
@@ -188,7 +188,15 @@ export declare const ProductComparisonMountable: {
188
188
  mount(container: HTMLElement, config?: ({
189
189
  products: {
190
190
  name: string;
191
- image: {
191
+ id: string;
192
+ ctas: {
193
+ label: string;
194
+ target: "_self" | "_blank";
195
+ variant: "primary" | "secondary" | "ghost";
196
+ href?: string | undefined;
197
+ actionId?: string | undefined;
198
+ }[];
199
+ image?: {
192
200
  src: string;
193
201
  alt: string;
194
202
  bind?: {
@@ -205,15 +213,7 @@ export declare const ProductComparisonMountable: {
205
213
  type: "jsonld";
206
214
  url?: string | undefined;
207
215
  } | undefined;
208
- };
209
- id: string;
210
- ctas: {
211
- label: string;
212
- target: "_self" | "_blank";
213
- variant: "primary" | "secondary" | "ghost";
214
- href?: string | undefined;
215
- actionId?: string | undefined;
216
- }[];
216
+ } | undefined;
217
217
  tagline?: string | undefined;
218
218
  price?: {
219
219
  amount: string;
@@ -325,7 +325,15 @@ export declare const ProductHeroMountable: {
325
325
  mount(container: HTMLElement, config?: ({
326
326
  product: {
327
327
  name: string;
328
- image: {
328
+ id: string;
329
+ ctas: {
330
+ label: string;
331
+ target: "_self" | "_blank";
332
+ variant: "primary" | "secondary" | "ghost";
333
+ href?: string | undefined;
334
+ actionId?: string | undefined;
335
+ }[];
336
+ image?: {
329
337
  src: string;
330
338
  alt: string;
331
339
  bind?: {
@@ -342,15 +350,7 @@ export declare const ProductHeroMountable: {
342
350
  type: "jsonld";
343
351
  url?: string | undefined;
344
352
  } | undefined;
345
- };
346
- id: string;
347
- ctas: {
348
- label: string;
349
- target: "_self" | "_blank";
350
- variant: "primary" | "secondary" | "ghost";
351
- href?: string | undefined;
352
- actionId?: string | undefined;
353
- }[];
353
+ } | undefined;
354
354
  tagline?: string | undefined;
355
355
  price?: {
356
356
  amount: string;
@@ -456,7 +456,15 @@ export declare const ProductGridMountable: {
456
456
  mount(container: HTMLElement, config?: ({
457
457
  products: {
458
458
  name: string;
459
- image: {
459
+ id: string;
460
+ ctas: {
461
+ label: string;
462
+ target: "_self" | "_blank";
463
+ variant: "primary" | "secondary" | "ghost";
464
+ href?: string | undefined;
465
+ actionId?: string | undefined;
466
+ }[];
467
+ image?: {
460
468
  src: string;
461
469
  alt: string;
462
470
  bind?: {
@@ -473,15 +481,7 @@ export declare const ProductGridMountable: {
473
481
  type: "jsonld";
474
482
  url?: string | undefined;
475
483
  } | undefined;
476
- };
477
- id: string;
478
- ctas: {
479
- label: string;
480
- target: "_self" | "_blank";
481
- variant: "primary" | "secondary" | "ghost";
482
- href?: string | undefined;
483
- actionId?: string | undefined;
484
- }[];
484
+ } | undefined;
485
485
  tagline?: string | undefined;
486
486
  price?: {
487
487
  amount: string;
@@ -608,7 +608,15 @@ export declare const runtime: {
608
608
  mount(container: HTMLElement, config?: ({
609
609
  product: {
610
610
  name: string;
611
- image: {
611
+ id: string;
612
+ ctas: {
613
+ label: string;
614
+ target: "_self" | "_blank";
615
+ variant: "primary" | "secondary" | "ghost";
616
+ href?: string | undefined;
617
+ actionId?: string | undefined;
618
+ }[];
619
+ image?: {
612
620
  src: string;
613
621
  alt: string;
614
622
  bind?: {
@@ -625,15 +633,7 @@ export declare const runtime: {
625
633
  type: "jsonld";
626
634
  url?: string | undefined;
627
635
  } | undefined;
628
- };
629
- id: string;
630
- ctas: {
631
- label: string;
632
- target: "_self" | "_blank";
633
- variant: "primary" | "secondary" | "ghost";
634
- href?: string | undefined;
635
- actionId?: string | undefined;
636
- }[];
636
+ } | undefined;
637
637
  tagline?: string | undefined;
638
638
  price?: {
639
639
  amount: string;
@@ -746,7 +746,15 @@ export declare const runtime: {
746
746
  mount(container: HTMLElement, config?: ({
747
747
  products: {
748
748
  name: string;
749
- image: {
749
+ id: string;
750
+ ctas: {
751
+ label: string;
752
+ target: "_self" | "_blank";
753
+ variant: "primary" | "secondary" | "ghost";
754
+ href?: string | undefined;
755
+ actionId?: string | undefined;
756
+ }[];
757
+ image?: {
750
758
  src: string;
751
759
  alt: string;
752
760
  bind?: {
@@ -763,15 +771,7 @@ export declare const runtime: {
763
771
  type: "jsonld";
764
772
  url?: string | undefined;
765
773
  } | undefined;
766
- };
767
- id: string;
768
- ctas: {
769
- label: string;
770
- target: "_self" | "_blank";
771
- variant: "primary" | "secondary" | "ghost";
772
- href?: string | undefined;
773
- actionId?: string | undefined;
774
- }[];
774
+ } | undefined;
775
775
  tagline?: string | undefined;
776
776
  price?: {
777
777
  amount: string;
@@ -890,7 +890,15 @@ export declare const runtime: {
890
890
  mount(container: HTMLElement, config?: ({
891
891
  product: {
892
892
  name: string;
893
- image: {
893
+ id: string;
894
+ ctas: {
895
+ label: string;
896
+ target: "_self" | "_blank";
897
+ variant: "primary" | "secondary" | "ghost";
898
+ href?: string | undefined;
899
+ actionId?: string | undefined;
900
+ }[];
901
+ image?: {
894
902
  src: string;
895
903
  alt: string;
896
904
  bind?: {
@@ -907,15 +915,7 @@ export declare const runtime: {
907
915
  type: "jsonld";
908
916
  url?: string | undefined;
909
917
  } | undefined;
910
- };
911
- id: string;
912
- ctas: {
913
- label: string;
914
- target: "_self" | "_blank";
915
- variant: "primary" | "secondary" | "ghost";
916
- href?: string | undefined;
917
- actionId?: string | undefined;
918
- }[];
918
+ } | undefined;
919
919
  tagline?: string | undefined;
920
920
  price?: {
921
921
  amount: string;
@@ -1028,7 +1028,15 @@ export declare const runtime: {
1028
1028
  mount(container: HTMLElement, config?: ({
1029
1029
  products: {
1030
1030
  name: string;
1031
- image: {
1031
+ id: string;
1032
+ ctas: {
1033
+ label: string;
1034
+ target: "_self" | "_blank";
1035
+ variant: "primary" | "secondary" | "ghost";
1036
+ href?: string | undefined;
1037
+ actionId?: string | undefined;
1038
+ }[];
1039
+ image?: {
1032
1040
  src: string;
1033
1041
  alt: string;
1034
1042
  bind?: {
@@ -1045,15 +1053,7 @@ export declare const runtime: {
1045
1053
  type: "jsonld";
1046
1054
  url?: string | undefined;
1047
1055
  } | undefined;
1048
- };
1049
- id: string;
1050
- ctas: {
1051
- label: string;
1052
- target: "_self" | "_blank";
1053
- variant: "primary" | "secondary" | "ghost";
1054
- href?: string | undefined;
1055
- actionId?: string | undefined;
1056
- }[];
1056
+ } | undefined;
1057
1057
  tagline?: string | undefined;
1058
1058
  price?: {
1059
1059
  amount: string;
package/dist/runtime.js CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  runTakeover,
12
12
  runtime,
13
13
  runtime_default
14
- } from "./chunk-VUU65MYQ.js";
15
- import "./chunk-Y2QAYCSK.js";
14
+ } from "./chunk-XZVLFHRB.js";
15
+ import "./chunk-D2W6UYLT.js";
16
16
  export {
17
17
  ProductCardMountable,
18
18
  ProductComparisonMountable,
@@ -87,7 +87,7 @@ export declare const productSchema: z.ZodObject<{
87
87
  id: z.ZodString;
88
88
  name: z.ZodString;
89
89
  tagline: z.ZodOptional<z.ZodString>;
90
- image: z.ZodObject<{
90
+ image: z.ZodOptional<z.ZodObject<{
91
91
  src: z.ZodEffects<z.ZodString, string, string>;
92
92
  alt: z.ZodString;
93
93
  bind: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -164,7 +164,7 @@ export declare const productSchema: z.ZodObject<{
164
164
  type: "jsonld";
165
165
  url?: string | undefined;
166
166
  } | undefined;
167
- }>;
167
+ }>>;
168
168
  price: z.ZodOptional<z.ZodObject<{
169
169
  amount: z.ZodString;
170
170
  cadence: z.ZodOptional<z.ZodString>;
@@ -582,7 +582,15 @@ export declare const productSchema: z.ZodObject<{
582
582
  }>>;
583
583
  }, "strict", z.ZodTypeAny, {
584
584
  name: string;
585
- image: {
585
+ id: string;
586
+ ctas: {
587
+ label: string;
588
+ target: "_self" | "_blank";
589
+ variant: "primary" | "secondary" | "ghost";
590
+ href?: string | undefined;
591
+ actionId?: string | undefined;
592
+ }[];
593
+ image?: {
586
594
  src: string;
587
595
  alt: string;
588
596
  bind?: {
@@ -599,15 +607,7 @@ export declare const productSchema: z.ZodObject<{
599
607
  type: "jsonld";
600
608
  url?: string | undefined;
601
609
  } | undefined;
602
- };
603
- id: string;
604
- ctas: {
605
- label: string;
606
- target: "_self" | "_blank";
607
- variant: "primary" | "secondary" | "ghost";
608
- href?: string | undefined;
609
- actionId?: string | undefined;
610
- }[];
610
+ } | undefined;
611
611
  tagline?: string | undefined;
612
612
  price?: {
613
613
  amount: string;
@@ -706,7 +706,15 @@ export declare const productSchema: z.ZodObject<{
706
706
  } | undefined;
707
707
  }, {
708
708
  name: string;
709
- image: {
709
+ id: string;
710
+ ctas: {
711
+ label: string;
712
+ href?: string | undefined;
713
+ target?: "_self" | "_blank" | undefined;
714
+ variant?: "primary" | "secondary" | "ghost" | undefined;
715
+ actionId?: string | undefined;
716
+ }[];
717
+ image?: {
710
718
  src: string;
711
719
  alt: string;
712
720
  bind?: {
@@ -723,15 +731,7 @@ export declare const productSchema: z.ZodObject<{
723
731
  type: "jsonld";
724
732
  url?: string | undefined;
725
733
  } | undefined;
726
- };
727
- id: string;
728
- ctas: {
729
- label: string;
730
- href?: string | undefined;
731
- target?: "_self" | "_blank" | undefined;
732
- variant?: "primary" | "secondary" | "ghost" | undefined;
733
- actionId?: string | undefined;
734
- }[];
734
+ } | undefined;
735
735
  tagline?: string | undefined;
736
736
  price?: {
737
737
  amount: string;
@@ -1 +1 @@
1
- {"version":3,"file":"schema-primitives.d.ts","sourceRoot":"","sources":["../src/schema-primitives.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,KAAK,2CAiBf,CAAC;AAEJ,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAarB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOrB,CAAC;AAsCH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;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