@veroxm/react-sdk 1.9.0 → 1.11.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/CHANGELOG.md +43 -0
- package/dist/client-slots.d.ts +2 -2
- package/dist/client-slots.js +2 -2
- package/dist/editor/handler.js +4 -0
- package/dist/editor/i18n.d.ts +255 -0
- package/dist/editor/i18n.js +491 -0
- package/dist/editor/inline.d.ts +4 -0
- package/dist/editor/inline.js +10 -3
- package/dist/editor/menu-input.d.ts +1 -1
- package/dist/editor/menu-input.js +8 -6
- package/dist/editor/overlay.d.ts +35 -0
- package/dist/editor/overlay.js +365 -144
- package/dist/editor/rich-text.d.ts +1 -1
- package/dist/editor/rich-text.js +8 -6
- package/dist/editor/seed.d.ts +19 -1
- package/dist/editor/seed.js +53 -9
- package/dist/editor/ui-context.d.ts +4 -0
- package/dist/editor/ui-context.js +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/next/cached.d.ts +2 -2
- package/dist/next/index.d.ts +1 -1
- package/dist/next/slot.d.ts +2 -2
- package/dist/next/slot.js +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/site/site-parts.d.ts +8 -8
- package/dist/slots-core.d.ts +59 -22
- package/dist/slots-core.js +24 -3
- package/package.json +1 -1
package/dist/slots-core.js
CHANGED
|
@@ -22,7 +22,15 @@ export const field = {
|
|
|
22
22
|
link: (o = {}) => ({ type: 'link', ...o }),
|
|
23
23
|
number: (o = {}) => ({ type: 'number', ...o }),
|
|
24
24
|
boolean: (o = {}) => ({ type: 'boolean', ...o }),
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* A choice from `options` (the values stored). `options` in the second argument gives each value a display label,
|
|
27
|
+
* one text or one per language; the stored values don't change:
|
|
28
|
+
* `field.select(['motor', 'health'], { label: 'Product line', options: { motor: { en: 'Motor', ar: 'المركبات' } } })`.
|
|
29
|
+
*/
|
|
30
|
+
select: (options, o = {}) => {
|
|
31
|
+
const { options: optionLabels, ...rest } = o;
|
|
32
|
+
return { type: 'select', options, ...rest, ...(optionLabels ? { optionLabels: optionLabels } : {}) };
|
|
33
|
+
},
|
|
26
34
|
/**
|
|
27
35
|
* A navigation menu marketers edit: links, with sub-menus up to `depth` levels (default 2, at most 3). Each item may
|
|
28
36
|
* have a badge ("New") and a description; with `icons`, an icon chosen from those names (your site draws them).
|
|
@@ -33,12 +41,18 @@ export const field = {
|
|
|
33
41
|
* has the `fields` you give (text, rich text, image, link, number, yes/no, choice, and one list of plain values, such
|
|
34
42
|
* as a card's ticked points). `max` 1 to 50 items (default 20).
|
|
35
43
|
* With `schedule`, each item may have a first and a last day it shows on (a ticker, a "New" badge that expires).
|
|
44
|
+
* `titleField` names the item field a collapsed item shows in the editor (default: the first required text field,
|
|
45
|
+
* then the first text field).
|
|
36
46
|
*
|
|
37
47
|
* ```tsx
|
|
38
48
|
* cards: field.list({ title: field.text({ max: 40, required: true }), badge: field.text({ max: 24 }), link: field.link() }, { max: 12 })
|
|
39
49
|
* ```
|
|
40
50
|
*/
|
|
41
|
-
list: (fields, o = {}) => ({
|
|
51
|
+
list: (fields, o = {}) => ({
|
|
52
|
+
type: 'list',
|
|
53
|
+
fields,
|
|
54
|
+
...o,
|
|
55
|
+
}),
|
|
42
56
|
/** A YouTube or Vimeo link, or a video file, that the site shows as a player. */
|
|
43
57
|
video: (o = {}) => ({ type: 'video', ...o }),
|
|
44
58
|
/** Slides for a slider: each an image with optional title, text and link. `max` 1 to 20 (default 10). */
|
|
@@ -214,7 +228,7 @@ export async function reportSlotNow(name, fields, label, path, shown) {
|
|
|
214
228
|
reported.add(key);
|
|
215
229
|
await sendReports([queued(key, name, fields, label, path, shown)]);
|
|
216
230
|
}
|
|
217
|
-
const reportKey = (name, fields, label, shown) => `${name}|${stable(fields)}|${label ?? ''}|${shown ? `${shown.locale ?? ''}:${stable(shown.values)}` : ''}`;
|
|
231
|
+
const reportKey = (name, fields, label, shown) => `${name}|${stable(fields)}|${stable(label ?? '')}|${shown ? `${shown.locale ?? ''}:${stable(shown.values)}` : ''}`;
|
|
218
232
|
function queued(key, name, fields, label, path, shown) {
|
|
219
233
|
const hasShown = shown && Object.keys(shown.values).length > 0;
|
|
220
234
|
return { key, name, label, fields, path, ...(hasShown ? { shown: shown.values, ...(shown.locale ? { locale: shown.locale } : {}) } : {}) };
|
|
@@ -461,3 +475,10 @@ function withoutTrailingSlashes(url) {
|
|
|
461
475
|
end--;
|
|
462
476
|
return url.slice(0, end);
|
|
463
477
|
}
|
|
478
|
+
/** A slot's label as the page marks it for the editor: data-veroxm-label (one text) and, for a per-language label, data-veroxm-labels. */
|
|
479
|
+
export function labelAttributes(label) {
|
|
480
|
+
if (!label || typeof label === 'string')
|
|
481
|
+
return { 'data-veroxm-label': label ?? '' };
|
|
482
|
+
const one = label.en ?? Object.values(label).find((v) => typeof v === 'string' && v !== '') ?? '';
|
|
483
|
+
return { 'data-veroxm-label': one, 'data-veroxm-labels': JSON.stringify(label) };
|
|
484
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veroxm/react-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "React and Next.js SDK for VeroXM: content hooks, visual slots with A/B tests, the on-page editor, forms and product journeys, llms.txt and structured data.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veroxm",
|