@refrakt-md/marketing 0.33.0 → 0.35.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/config.d.ts.map +1 -1
- package/dist/config.js +81 -12
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +100 -20
- package/dist/index.js.map +1 -1
- package/dist/props.d.ts.map +1 -1
- package/dist/tags/bento.d.ts.map +1 -1
- package/dist/tags/bento.js +107 -26
- package/dist/tags/bento.js.map +1 -1
- package/dist/tags/comparison.d.ts.map +1 -1
- package/dist/tags/comparison.js +73 -34
- package/dist/tags/comparison.js.map +1 -1
- package/dist/tags/cta.d.ts.map +1 -1
- package/dist/tags/cta.js +12 -8
- package/dist/tags/cta.js.map +1 -1
- package/dist/tags/feature.d.ts.map +1 -1
- package/dist/tags/feature.js +54 -26
- package/dist/tags/feature.js.map +1 -1
- package/dist/tags/hero.d.ts.map +1 -1
- package/dist/tags/hero.js +46 -19
- package/dist/tags/hero.js.map +1 -1
- package/dist/tags/pricing.d.ts +26 -0
- package/dist/tags/pricing.d.ts.map +1 -1
- package/dist/tags/pricing.js +92 -34
- package/dist/tags/pricing.js.map +1 -1
- package/dist/tags/steps.d.ts.map +1 -1
- package/dist/tags/steps.js +21 -20
- package/dist/tags/steps.js.map +1 -1
- package/dist/tags/testimonial.d.ts +23 -0
- package/dist/tags/testimonial.d.ts.map +1 -1
- package/dist/tags/testimonial.js +45 -27
- package/dist/tags/testimonial.js.map +1 -1
- package/package.json +4 -4
package/dist/tags/pricing.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Ast, Tag } = Markdoc;
|
|
3
|
-
import { createComponentRenderable, createContentModelSchema, asNodes, RenderableNodeCursor, headingsToList, descriptionHelper as description, pageSectionProperties } from '@refrakt-md/runes';
|
|
3
|
+
import { createComponentRenderable, createContentModelSchema, asNodes, RenderableNodeCursor, headingsToList, descriptionHelper as description, pageSectionProperties, } from '@refrakt-md/runes';
|
|
4
4
|
const NAME_PRICE_PATTERN = /^(.+?)\s*[-–—]\s*(.+)$/;
|
|
5
5
|
const CURRENCY_SYMBOLS = {
|
|
6
|
-
|
|
7
|
-
'
|
|
6
|
+
$: 'USD',
|
|
7
|
+
'€': 'EUR',
|
|
8
|
+
'£': 'GBP',
|
|
9
|
+
'¥': 'JPY',
|
|
10
|
+
'₹': 'INR',
|
|
11
|
+
kr: 'SEK',
|
|
12
|
+
CHF: 'CHF',
|
|
13
|
+
A$: 'AUD',
|
|
14
|
+
C$: 'CAD',
|
|
8
15
|
};
|
|
9
16
|
function inferCurrency(priceText) {
|
|
10
17
|
for (const [symbol, code] of Object.entries(CURRENCY_SYMBOLS)) {
|
|
@@ -15,10 +22,13 @@ function inferCurrency(priceText) {
|
|
|
15
22
|
}
|
|
16
23
|
function convertHeadings(nodes) {
|
|
17
24
|
// Auto-detect heading level from the first heading that matches "Name — Price"
|
|
18
|
-
const level = nodes.find(n => {
|
|
25
|
+
const level = nodes.find((n) => {
|
|
19
26
|
if (n.type !== 'heading')
|
|
20
27
|
return false;
|
|
21
|
-
const text = Array.from(n.walk())
|
|
28
|
+
const text = Array.from(n.walk())
|
|
29
|
+
.filter((c) => c.type === 'text')
|
|
30
|
+
.map((t) => t.attributes.content)
|
|
31
|
+
.join(' ');
|
|
22
32
|
return NAME_PRICE_PATTERN.test(text);
|
|
23
33
|
})?.attributes.level;
|
|
24
34
|
if (!level)
|
|
@@ -32,8 +42,8 @@ function convertHeadings(nodes) {
|
|
|
32
42
|
for (const item of converted[n].children) {
|
|
33
43
|
const heading = item.children[0];
|
|
34
44
|
const headingText = Array.from(heading.walk())
|
|
35
|
-
.filter(n => n.type === 'text')
|
|
36
|
-
.map(t => t.attributes.content)
|
|
45
|
+
.filter((n) => n.type === 'text')
|
|
46
|
+
.map((t) => t.attributes.content)
|
|
37
47
|
.join(' ');
|
|
38
48
|
const match = headingText.match(NAME_PRICE_PATTERN);
|
|
39
49
|
if (match) {
|
|
@@ -49,15 +59,36 @@ function convertHeadings(nodes) {
|
|
|
49
59
|
// SPEC-125 Phase 2 — join tables the rune declares about itself. Referenced
|
|
50
60
|
// from the theme config rather than owned by it: a theme may not redefine
|
|
51
61
|
// what a section *is* (ADR-028).
|
|
52
|
-
export const pricingSections = {
|
|
62
|
+
export const pricingSections = {
|
|
63
|
+
preamble: 'preamble',
|
|
64
|
+
headline: 'title',
|
|
65
|
+
blurb: 'description',
|
|
66
|
+
};
|
|
67
|
+
// SPEC-130 / WORK-568 — Group B, and where D6 shows. `offers` is declared a
|
|
68
|
+
// list, so a one-tier pricing block serialises `"offers": [{…}]` instead of the
|
|
69
|
+
// bare object it used to emit — the shape no longer varies with how much content
|
|
70
|
+
// an author wrote.
|
|
71
|
+
//
|
|
72
|
+
// The tiers are retyped from here rather than from `tier` itself (D9): the
|
|
73
|
+
// property that holds a child and the child's type are one declaration, and only
|
|
74
|
+
// the parent can supply the property. `featured-tier` is the same rune under a
|
|
75
|
+
// different name, so both keys are listed.
|
|
76
|
+
export const pricingSchema = {
|
|
77
|
+
type: 'Product',
|
|
78
|
+
properties: { headline: 'name', blurb: 'description' },
|
|
79
|
+
lists: ['offers'],
|
|
80
|
+
children: {
|
|
81
|
+
tier: { type: 'Offer', property: 'offers' },
|
|
82
|
+
'featured-tier': { type: 'Offer', property: 'offers' },
|
|
83
|
+
},
|
|
84
|
+
};
|
|
53
85
|
export const pricing = createContentModelSchema({
|
|
86
|
+
schema: pricingSchema,
|
|
54
87
|
sections: pricingSections,
|
|
55
88
|
attributes: {},
|
|
56
89
|
contentModel: {
|
|
57
90
|
type: 'sequence',
|
|
58
|
-
fields: [
|
|
59
|
-
{ name: 'content', match: 'any', optional: true, greedy: true },
|
|
60
|
-
],
|
|
91
|
+
fields: [{ name: 'content', match: 'any', optional: true, greedy: true }],
|
|
61
92
|
},
|
|
62
93
|
transform(resolved, attrs, config) {
|
|
63
94
|
const processed = convertHeadings(asNodes(resolved.content));
|
|
@@ -66,8 +97,12 @@ export const pricing = createContentModelSchema({
|
|
|
66
97
|
const header = allNodes.tags('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p');
|
|
67
98
|
const tiers = allNodes.tag('li');
|
|
68
99
|
const sectionProps = pageSectionProperties(header);
|
|
69
|
-
const tiersList = tiers.wrap('ul', {
|
|
70
|
-
|
|
100
|
+
const tiersList = tiers.wrap('ul', {
|
|
101
|
+
'data-layout': 'grid',
|
|
102
|
+
'data-columns': tiers.nodes.length,
|
|
103
|
+
});
|
|
104
|
+
return createComponentRenderable({
|
|
105
|
+
rune: 'pricing',
|
|
71
106
|
tag: 'section',
|
|
72
107
|
property: 'contentSection',
|
|
73
108
|
properties: {
|
|
@@ -77,19 +112,26 @@ export const pricing = createContentModelSchema({
|
|
|
77
112
|
...sectionProps,
|
|
78
113
|
tiers: tiersList.tag('ul'),
|
|
79
114
|
},
|
|
80
|
-
|
|
81
|
-
name: sectionProps.headline,
|
|
82
|
-
description: sectionProps.blurb,
|
|
83
|
-
offers: tiers,
|
|
84
|
-
},
|
|
85
|
-
children: [
|
|
86
|
-
header.wrap('header').next(),
|
|
87
|
-
tiersList.next(),
|
|
88
|
-
]
|
|
115
|
+
children: [header.wrap('header').next(), tiersList.next()],
|
|
89
116
|
});
|
|
90
117
|
},
|
|
91
118
|
});
|
|
119
|
+
// SPEC-130 / WORK-568 — Group B, and the pair's careful half. `parsedPrice` and
|
|
120
|
+
// `resolvedCurrency` survived only *because* the rune declared them in `schema:`
|
|
121
|
+
// — that is the `isSeoMeta` check in `createComponentRenderable`. With the
|
|
122
|
+
// declaration gone they are dropped as pure data, and the applier rebuilds them
|
|
123
|
+
// from the field bag, which works only because WORK-561 put them there. Had this
|
|
124
|
+
// landed first, the price would have vanished from the structured data while the
|
|
125
|
+
// HTML looked identical.
|
|
126
|
+
//
|
|
127
|
+
// `pricing` restates this type in its `children` row: a standalone `{% tier %}`
|
|
128
|
+
// is still an `Offer`, and inside a `{% pricing %}` the parent is what nests it.
|
|
129
|
+
export const tierSchema = {
|
|
130
|
+
type: 'Offer',
|
|
131
|
+
properties: { name: 'name', parsedPrice: 'price', resolvedCurrency: 'priceCurrency' },
|
|
132
|
+
};
|
|
92
133
|
export const tier = createContentModelSchema({
|
|
134
|
+
schema: tierSchema,
|
|
93
135
|
attributes: {
|
|
94
136
|
name: { type: String, required: true },
|
|
95
137
|
price: { type: String, required: false },
|
|
@@ -99,9 +141,7 @@ export const tier = createContentModelSchema({
|
|
|
99
141
|
},
|
|
100
142
|
contentModel: {
|
|
101
143
|
type: 'sequence',
|
|
102
|
-
fields: [
|
|
103
|
-
{ name: 'body', match: 'any', optional: true, greedy: true },
|
|
104
|
-
],
|
|
144
|
+
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
105
145
|
},
|
|
106
146
|
transform(resolved, attrs, config) {
|
|
107
147
|
const runeName = attrs.featured ? 'featured-tier' : 'tier';
|
|
@@ -113,26 +153,44 @@ export const tier = createContentModelSchema({
|
|
|
113
153
|
const currencyMeta = attrs.currency ? new Tag('meta', { content: attrs.currency }) : undefined;
|
|
114
154
|
// Schema.org price parsing: extract numeric value and infer currency
|
|
115
155
|
const numericMatch = priceValue.match(/[\d.]+/);
|
|
116
|
-
const parsedPriceMeta = new Tag('meta', {
|
|
117
|
-
|
|
118
|
-
|
|
156
|
+
const parsedPriceMeta = new Tag('meta', {
|
|
157
|
+
content: numericMatch ? numericMatch[0] : priceValue,
|
|
158
|
+
});
|
|
159
|
+
const resolvedCurrencyMeta = new Tag('meta', {
|
|
160
|
+
content: attrs.currency || inferCurrency(priceValue),
|
|
161
|
+
});
|
|
162
|
+
return createComponentRenderable({
|
|
163
|
+
rune: runeName,
|
|
119
164
|
tag: 'li',
|
|
120
165
|
properties: {
|
|
121
166
|
description: description(children),
|
|
122
167
|
...(currencyMeta ? { currency: currencyMeta } : {}),
|
|
123
168
|
url: children.flatten().tag('a'),
|
|
169
|
+
// WORK-561 — value-only SEO carriers, addressable by name for
|
|
170
|
+
// WORK-565's applier. Both stay in `schema:`, so they keep their
|
|
171
|
+
// `property=` and are not dropped; the bag entry is additional.
|
|
172
|
+
//
|
|
173
|
+
// Deliberately *not* named `price`/`currency`: `price` is already the
|
|
174
|
+
// `<p>` ref (the rendered price, "$19") and `currency` is already the
|
|
175
|
+
// author's raw attribute. These two are the parsed numeric value and
|
|
176
|
+
// the resolved-or-inferred code — different nodes with different
|
|
177
|
+
// values, so they get their own names rather than shadowing.
|
|
178
|
+
parsedPrice: parsedPriceMeta,
|
|
179
|
+
resolvedCurrency: resolvedCurrencyMeta,
|
|
124
180
|
},
|
|
125
181
|
refs: {
|
|
126
182
|
body: body.tag('div'),
|
|
127
183
|
name: nameTag,
|
|
128
184
|
price: priceTag,
|
|
129
185
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
186
|
+
children: [
|
|
187
|
+
nameTag,
|
|
188
|
+
priceTag,
|
|
189
|
+
parsedPriceMeta,
|
|
190
|
+
resolvedCurrencyMeta,
|
|
191
|
+
...(currencyMeta ? [currencyMeta] : []),
|
|
192
|
+
body.next(),
|
|
193
|
+
],
|
|
136
194
|
});
|
|
137
195
|
},
|
|
138
196
|
});
|
package/dist/tags/pricing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/tags/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../src/tags/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;A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BAAgB,EAAE,oBAAoB;aACtC;YACD,IAAI,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;gBACrB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,QAAQ;aACf;YACD,QAAQ,EAAE;gBACT,OAAO;gBACP,QAAQ;gBACR,eAAe;gBACf,oBAAoB;gBACpB,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,IAAI,CAAC,IAAI,EAAE;aACX;SACD,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
package/dist/tags/steps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/tags/steps.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/tags/steps.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAmBvC,eAAO,MAAM,cAAc;;CAA8B,CAAC;AAE1D,eAAO,MAAM,IAAI,gBA2Ef,CAAC;AAKH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,eAAO,MAAM,KAAK,gBA2EhB,CAAC"}
|
package/dist/tags/steps.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Ast, Tag } = Markdoc;
|
|
3
|
-
import { createComponentRenderable, createContentModelSchema, SplitLayoutModel, buildLayoutMetas, nameHelper as name, pageSectionProperties, asNodes, unwrapParagraphImages } from '@refrakt-md/runes';
|
|
3
|
+
import { createComponentRenderable, createContentModelSchema, SplitLayoutModel, buildLayoutMetas, nameHelper as name, pageSectionProperties, asNodes, unwrapParagraphImages, } from '@refrakt-md/runes';
|
|
4
4
|
import { RenderableNodeCursor } from '@refrakt-md/runes';
|
|
5
5
|
// SPEC-125 Phase 2 — join tables the rune declares about itself. Referenced
|
|
6
6
|
// from the theme config rather than owned by it: a theme may not redefine
|
|
@@ -18,17 +18,13 @@ export const step = createContentModelSchema({
|
|
|
18
18
|
{
|
|
19
19
|
name: 'media',
|
|
20
20
|
type: 'sequence',
|
|
21
|
-
fields: [
|
|
22
|
-
{ name: 'content', match: 'any', optional: true, greedy: true },
|
|
23
|
-
],
|
|
21
|
+
fields: [{ name: 'content', match: 'any', optional: true, greedy: true }],
|
|
24
22
|
},
|
|
25
23
|
{
|
|
26
24
|
name: 'content',
|
|
27
25
|
primary: true,
|
|
28
26
|
type: 'sequence',
|
|
29
|
-
fields: [
|
|
30
|
-
{ name: 'content', match: 'any', optional: true, greedy: true },
|
|
31
|
-
],
|
|
27
|
+
fields: [{ name: 'content', match: 'any', optional: true, greedy: true }],
|
|
32
28
|
},
|
|
33
29
|
],
|
|
34
30
|
},
|
|
@@ -42,14 +38,18 @@ export const step = createContentModelSchema({
|
|
|
42
38
|
const mainContent = main.wrap('div');
|
|
43
39
|
const sideContent = side.wrap('div');
|
|
44
40
|
// Content-first DOM → the truthful stacked default is `bottom` (BUG-001).
|
|
45
|
-
const { metas: layoutMetas, children: layoutChildren } = buildLayoutMetas({
|
|
46
|
-
|
|
41
|
+
const { metas: layoutMetas, children: layoutChildren } = buildLayoutMetas({
|
|
42
|
+
...attrs,
|
|
43
|
+
'media-position': attrs['media-position'] ?? 'bottom',
|
|
44
|
+
});
|
|
45
|
+
const { mediaPosition: mediaPositionMeta, mediaRatio: mediaRatioMeta, valign: valignMeta, collapse: collapseMeta, } = layoutMetas;
|
|
47
46
|
const children = [
|
|
48
47
|
...layoutChildren,
|
|
49
48
|
mainContent.next(),
|
|
50
49
|
...(side.toArray().length > 0 ? [sideContent.next()] : []),
|
|
51
50
|
];
|
|
52
|
-
return createComponentRenderable({
|
|
51
|
+
return createComponentRenderable({
|
|
52
|
+
rune: 'step',
|
|
53
53
|
tag: 'li',
|
|
54
54
|
properties: {
|
|
55
55
|
name: name(main),
|
|
@@ -69,7 +69,11 @@ export const step = createContentModelSchema({
|
|
|
69
69
|
// SPEC-125 Phase 2 — join tables the rune declares about itself. Referenced
|
|
70
70
|
// from the theme config rather than owned by it: a theme may not redefine
|
|
71
71
|
// what a section *is* (ADR-028).
|
|
72
|
-
export const stepsSections = {
|
|
72
|
+
export const stepsSections = {
|
|
73
|
+
preamble: 'preamble',
|
|
74
|
+
headline: 'title',
|
|
75
|
+
blurb: 'description',
|
|
76
|
+
};
|
|
73
77
|
export const steps = createContentModelSchema({
|
|
74
78
|
sections: stepsSections,
|
|
75
79
|
attributes: {},
|
|
@@ -80,9 +84,7 @@ export const steps = createContentModelSchema({
|
|
|
80
84
|
model: {
|
|
81
85
|
type: 'sections',
|
|
82
86
|
sectionHeading: 'heading',
|
|
83
|
-
fields: [
|
|
84
|
-
{ name: 'header', match: 'heading|paragraph', optional: true, greedy: true },
|
|
85
|
-
],
|
|
87
|
+
fields: [{ name: 'header', match: 'heading|paragraph', optional: true, greedy: true }],
|
|
86
88
|
sectionModel: {
|
|
87
89
|
type: 'sequence',
|
|
88
90
|
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
@@ -104,7 +106,7 @@ export const steps = createContentModelSchema({
|
|
|
104
106
|
if (resolved.sections) {
|
|
105
107
|
// Heading-based steps: build step tags from resolved sections
|
|
106
108
|
const sections = resolved.sections;
|
|
107
|
-
const stepTagNodes = sections.map(section => new Ast.Node('tag', {}, [section.$headingNode, ...asNodes(section.body)], 'step'));
|
|
109
|
+
const stepTagNodes = sections.map((section) => new Ast.Node('tag', {}, [section.$headingNode, ...asNodes(section.body)], 'step'));
|
|
108
110
|
const stepStream = new RenderableNodeCursor(Markdoc.transform(stepTagNodes, config));
|
|
109
111
|
stepItems = stepStream.tag('li').typeof('Step');
|
|
110
112
|
}
|
|
@@ -112,15 +114,14 @@ export const steps = createContentModelSchema({
|
|
|
112
114
|
// List-based steps: convert ordered list items to step tags
|
|
113
115
|
const listNode = asNodes(resolved.list)[0];
|
|
114
116
|
const itemNodes = listNode?.children ?? [];
|
|
115
|
-
const stepTagNodes = itemNodes.map(item => new Ast.Node('tag', {}, item.children, 'step'));
|
|
117
|
+
const stepTagNodes = itemNodes.map((item) => new Ast.Node('tag', {}, item.children, 'step'));
|
|
116
118
|
const stepStream = new RenderableNodeCursor(Markdoc.transform(stepTagNodes, config));
|
|
117
119
|
stepItems = stepStream.tag('li').typeof('Step');
|
|
118
120
|
}
|
|
119
121
|
const stepList = new Tag('ol', {}, stepItems.toArray());
|
|
120
|
-
const children = headerNodes.count() > 0
|
|
121
|
-
|
|
122
|
-
:
|
|
123
|
-
return createComponentRenderable({ rune: 'steps',
|
|
122
|
+
const children = headerNodes.count() > 0 ? [...headerNodes.toArray(), stepList] : [stepList];
|
|
123
|
+
return createComponentRenderable({
|
|
124
|
+
rune: 'steps',
|
|
124
125
|
tag: 'section',
|
|
125
126
|
property: 'contentSection',
|
|
126
127
|
properties: {
|
package/dist/tags/steps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/tags/steps.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAGvC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/tags/steps.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAGvC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAC7B,OAAO,EACN,yBAAyB,EACzB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,IAAI,IAAI,EAClB,qBAAqB,EACrB,OAAO,EACP,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA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EAAE,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;QAExD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAE7F,OAAO,yBAAyB,CAAC;YAChC,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,gBAAgB;YAC1B,UAAU,EAAE;gBACX,IAAI,EAAE,SAAS;aACf;YACD,IAAI,EAAE;gBACL,GAAG,qBAAqB,CAAC,WAAW,CAAC;aACrC;YACD,QAAQ;SACR,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -5,5 +5,28 @@ export declare const testimonialSections: {
|
|
|
5
5
|
export declare const testimonialMediaSlots: {
|
|
6
6
|
readonly avatar: "portrait";
|
|
7
7
|
};
|
|
8
|
+
export declare const testimonialSchema: {
|
|
9
|
+
readonly type: "Review";
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly quote: "reviewBody";
|
|
12
|
+
};
|
|
13
|
+
readonly entities: {
|
|
14
|
+
readonly author: {
|
|
15
|
+
readonly type: "Person";
|
|
16
|
+
readonly property: "author";
|
|
17
|
+
readonly properties: {
|
|
18
|
+
readonly 'author-name': "name";
|
|
19
|
+
readonly 'author-role': "jobTitle";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly rating: {
|
|
23
|
+
readonly type: "Rating";
|
|
24
|
+
readonly property: "reviewRating";
|
|
25
|
+
readonly properties: {
|
|
26
|
+
readonly rating: "ratingValue";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
8
31
|
export declare const testimonial: Markdoc.Schema;
|
|
9
32
|
//# sourceMappingURL=testimonial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testimonial.d.ts","sourceRoot":"","sources":["../../src/tags/testimonial.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"testimonial.d.ts","sourceRoot":"","sources":["../../src/tags/testimonial.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAgBvC,eAAO,MAAM,mBAAmB;;CAA+B,CAAC;AAChE,eAAO,MAAM,qBAAqB;;CAAkC,CAAC;AAWrE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CAepB,CAAC;AAEX,eAAO,MAAM,WAAW,gBAyGtB,CAAC"}
|
package/dist/tags/testimonial.js
CHANGED
|
@@ -1,24 +1,57 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
|
-
import { createContentModelSchema, createComponentRenderable, asNodes, RenderableNodeCursor, isMediaNode } from '@refrakt-md/runes';
|
|
3
|
+
import { createContentModelSchema, createComponentRenderable, asNodes, RenderableNodeCursor, isMediaNode, } from '@refrakt-md/runes';
|
|
4
4
|
const variantType = ['card', 'inline', 'quote'];
|
|
5
5
|
// SPEC-125 Phase 2 — join tables the rune declares about itself. Referenced
|
|
6
6
|
// from the theme config rather than owned by it: a theme may not redefine
|
|
7
7
|
// what a section *is* (ADR-028).
|
|
8
8
|
export const testimonialSections = { avatar: 'media' };
|
|
9
9
|
export const testimonialMediaSlots = { avatar: 'portrait' };
|
|
10
|
+
// SPEC-130 / WORK-565 — the rune's schema.org mapping, as data. Beside
|
|
11
|
+
// `sections` and `mediaSlots` because it is the same kind of fact: what this
|
|
12
|
+
// rune *is*, not how a theme renders it (ADR-028).
|
|
13
|
+
//
|
|
14
|
+
// The two nested entities were hand-built spans below. `entities:` carries them
|
|
15
|
+
// declaratively, and the applier resolves each source by name — `quote` and
|
|
16
|
+
// `author-name` survive in the output as refs, while `rating`'s meta is dropped
|
|
17
|
+
// by `createComponentRenderable` as pure data and is rebuilt from the field bag.
|
|
18
|
+
// That third case is what settled the mechanism's shape.
|
|
19
|
+
export const testimonialSchema = {
|
|
20
|
+
type: 'Review',
|
|
21
|
+
properties: { quote: 'reviewBody' },
|
|
22
|
+
entities: {
|
|
23
|
+
author: {
|
|
24
|
+
type: 'Person',
|
|
25
|
+
property: 'author',
|
|
26
|
+
properties: { 'author-name': 'name', 'author-role': 'jobTitle' },
|
|
27
|
+
},
|
|
28
|
+
rating: {
|
|
29
|
+
type: 'Rating',
|
|
30
|
+
property: 'reviewRating',
|
|
31
|
+
properties: { rating: 'ratingValue' },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
10
35
|
export const testimonial = createContentModelSchema({
|
|
11
36
|
sections: testimonialSections,
|
|
12
37
|
mediaSlots: testimonialMediaSlots,
|
|
38
|
+
schema: testimonialSchema,
|
|
13
39
|
attributes: {
|
|
14
|
-
rating: {
|
|
15
|
-
|
|
40
|
+
rating: {
|
|
41
|
+
type: Number,
|
|
42
|
+
required: false,
|
|
43
|
+
description: 'Star rating value (1-5) shown alongside the testimonial',
|
|
44
|
+
},
|
|
45
|
+
variant: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: false,
|
|
48
|
+
matches: variantType.slice(),
|
|
49
|
+
description: 'Visual style: card with border, inline with text flow, or quote with large quotation marks',
|
|
50
|
+
},
|
|
16
51
|
},
|
|
17
52
|
contentModel: {
|
|
18
53
|
type: 'sequence',
|
|
19
|
-
fields: [
|
|
20
|
-
{ name: 'body', match: 'any', optional: true, greedy: true },
|
|
21
|
-
],
|
|
54
|
+
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
22
55
|
},
|
|
23
56
|
deprecations: {
|
|
24
57
|
layout: { newName: 'variant' },
|
|
@@ -44,7 +77,8 @@ export const testimonial = createContentModelSchema({
|
|
|
44
77
|
authorNameTag = new Tag('span', {}, [nameText]);
|
|
45
78
|
// Get the role text after the strong tag
|
|
46
79
|
const idx = node.children.indexOf(child);
|
|
47
|
-
const rest = node.children
|
|
80
|
+
const rest = node.children
|
|
81
|
+
.slice(idx + 1)
|
|
48
82
|
.filter((c) => typeof c === 'string')
|
|
49
83
|
.join('')
|
|
50
84
|
.replace(/^\s*[-–—]\s*/, '')
|
|
@@ -55,7 +89,8 @@ export const testimonial = createContentModelSchema({
|
|
|
55
89
|
}
|
|
56
90
|
}
|
|
57
91
|
}
|
|
58
|
-
else if (isMediaNode(node) ||
|
|
92
|
+
else if (isMediaNode(node) ||
|
|
93
|
+
(node.name === 'p' && node.children.some((c) => isMediaNode(c)))) {
|
|
59
94
|
// Extract the avatar — an <img> or a scheme-resolved <svg>
|
|
60
95
|
// (placeholder:/icon:), direct or wrapped in a paragraph (SPEC-106).
|
|
61
96
|
if (isMediaNode(node)) {
|
|
@@ -82,22 +117,8 @@ export const testimonial = createContentModelSchema({
|
|
|
82
117
|
resultChildren.push(variantMeta);
|
|
83
118
|
if (avatarTag)
|
|
84
119
|
resultChildren.push(avatarTag);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const authorMetas = [
|
|
88
|
-
new Tag('meta', { property: 'name', content: authorNameTag.children.filter((c) => typeof c === 'string').join('') }),
|
|
89
|
-
];
|
|
90
|
-
if (authorRoleTag) {
|
|
91
|
-
authorMetas.push(new Tag('meta', { property: 'jobTitle', content: authorRoleTag.children.filter((c) => typeof c === 'string').join('') }));
|
|
92
|
-
}
|
|
93
|
-
resultChildren.push(new Tag('span', { typeof: 'Person', property: 'author' }, authorMetas));
|
|
94
|
-
}
|
|
95
|
-
if (rating !== undefined) {
|
|
96
|
-
resultChildren.push(new Tag('span', { typeof: 'Rating', property: 'reviewRating' }, [
|
|
97
|
-
new Tag('meta', { property: 'ratingValue', content: rating }),
|
|
98
|
-
]));
|
|
99
|
-
}
|
|
100
|
-
return createComponentRenderable({ rune: 'testimonial', schemaOrgType: 'Review',
|
|
120
|
+
return createComponentRenderable({
|
|
121
|
+
rune: 'testimonial',
|
|
101
122
|
tag: 'article',
|
|
102
123
|
properties: {
|
|
103
124
|
rating: ratingMeta,
|
|
@@ -108,9 +129,6 @@ export const testimonial = createContentModelSchema({
|
|
|
108
129
|
'author-role': authorRoleTag,
|
|
109
130
|
avatar: avatarTag,
|
|
110
131
|
},
|
|
111
|
-
schema: {
|
|
112
|
-
reviewBody: quoteTag,
|
|
113
|
-
},
|
|
114
132
|
children: resultChildren,
|
|
115
133
|
});
|
|
116
134
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testimonial.js","sourceRoot":"","sources":["../../src/tags/testimonial.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"testimonial.js","sourceRoot":"","sources":["../../src/tags/testimonial.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EACN,wBAAwB,EACxB,yBAAyB,EACzB,OAAO,EACP,oBAAoB,EACpB,WAAW,GACX,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAEzD,4EAA4E;AAC5E,0EAA0E;AAC1E,iCAAiC;AACjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAW,CAAC;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,MAAM,EAAE,UAAU,EAAW,CAAC;AAErE,uEAAuE;AACvE,6EAA6E;AAC7E,mDAAmD;AACnD,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,gFAAgF;AAChF,iFAAiF;AACjF,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,IAAI,EAAE,QAAQ;IACd,UA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tD,IAAI,UAAU;YAAE,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACjC,IAAI,SAAS;YAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO,yBAAyB,CAAC;YAChC,IAAI,EAAE,aAAa;YACnB,GAAG,EAAE,SAAS;YACd,UAAU,EAAE;gBACX,MAAM,EAAE,UAAU;aAClB;YACD,IAAI,EAAE;gBACL,KAAK,EAAE,QAAQ;gBACf,aAAa,EAAE,aAAa;gBAC5B,aAAa,EAAE,aAAa;gBAC5B,MAAM,EAAE,SAAS;aACjB;YACD,QAAQ,EAAE,cAAc;SACxB,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refrakt-md/marketing",
|
|
3
3
|
"description": "Marketing runes for refrakt.md — hero, CTA, pricing, and more",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"build": "tsc"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@refrakt-md/types": "0.
|
|
25
|
-
"@refrakt-md/transform": "0.
|
|
26
|
-
"@refrakt-md/runes": "0.
|
|
24
|
+
"@refrakt-md/types": "0.35.0",
|
|
25
|
+
"@refrakt-md/transform": "0.35.0",
|
|
26
|
+
"@refrakt-md/runes": "0.35.0",
|
|
27
27
|
"@markdoc/markdoc": "0.4.0",
|
|
28
28
|
"reflect-metadata": "^0.2.0"
|
|
29
29
|
}
|