@cogenta/widgets 0.2.3
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/LICENSE +373 -0
- package/dist/areas.d.ts +26 -0
- package/dist/areas.d.ts.map +1 -0
- package/dist/areas.js +49 -0
- package/dist/areas.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/store.d.ts +80 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +263 -0
- package/dist/store.js.map +1 -0
- package/dist/visibility.d.ts +86 -0
- package/dist/visibility.d.ts.map +1 -0
- package/dist/visibility.js +141 -0
- package/dist/visibility.js.map +1 -0
- package/dist/vocabulary.d.ts +194 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +196 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +45 -0
package/dist/store.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { CogentaError, identifier, newId, sql, } from '@cogenta/core';
|
|
2
|
+
import { jsonColumn, textColumn, timestampColumn, uuidColumn } from '@cogenta/schema';
|
|
3
|
+
import { isWidgetAreaId } from './areas.js';
|
|
4
|
+
import { validateWidgetVisibility } from './visibility.js';
|
|
5
|
+
import { validateWidgetSettings } from './vocabulary.js';
|
|
6
|
+
/**
|
|
7
|
+
* The widgets of a site: one fixed table (`cogenta_widgets`), created and
|
|
8
|
+
* edited at runtime from the admin, the same shape as the menus.
|
|
9
|
+
*
|
|
10
|
+
* Every write goes through the vocabulary's validation, so a stored widget
|
|
11
|
+
* always renders. An area is a free key, not a foreign key to anything: a
|
|
12
|
+
* widget whose area the active theme does not offer is kept, and the admin
|
|
13
|
+
* lists it as inactive, the way WordPress keeps widgets across a theme switch.
|
|
14
|
+
*/
|
|
15
|
+
export const WIDGETS_TABLE = 'cogenta_widgets';
|
|
16
|
+
export async function ensureWidgetTables(db) {
|
|
17
|
+
const dialect = db.dialect;
|
|
18
|
+
const table = identifier(WIDGETS_TABLE, dialect);
|
|
19
|
+
await db.query(sql `create table if not exists ${table} (
|
|
20
|
+
${identifier('id', dialect)} ${uuidColumn(dialect)} not null primary key,
|
|
21
|
+
${identifier('area', dialect)} ${textColumn(dialect, 64)} not null,
|
|
22
|
+
${identifier('position', dialect)} integer not null,
|
|
23
|
+
${identifier('type', dialect)} ${textColumn(dialect, 64)} not null,
|
|
24
|
+
${identifier('title', dialect)} ${textColumn(dialect, 255)},
|
|
25
|
+
${identifier('settings', dialect)} ${jsonColumn()} not null,
|
|
26
|
+
${identifier('visibility', dialect)} ${jsonColumn()} not null,
|
|
27
|
+
${identifier('enabled', dialect)} ${textColumn(dialect, 8)} not null,
|
|
28
|
+
${identifier('created_at', dialect)} ${timestampColumn(dialect)} not null,
|
|
29
|
+
${identifier('updated_at', dialect)} ${timestampColumn(dialect)} not null,
|
|
30
|
+
${identifier('updated_by', dialect)} ${textColumn(dialect, 64)}
|
|
31
|
+
)`);
|
|
32
|
+
await db
|
|
33
|
+
.query(sql `create index ${identifier('cogenta_widgets_area_position', dialect)} on ${table} (${identifier('area', dialect)}, ${identifier('position', dialect)})`)
|
|
34
|
+
.catch(() => undefined);
|
|
35
|
+
}
|
|
36
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
37
|
+
function text(value) {
|
|
38
|
+
return typeof value === 'string' ? value : String(value);
|
|
39
|
+
}
|
|
40
|
+
function areaInvalid(area) {
|
|
41
|
+
return new CogentaError({
|
|
42
|
+
code: 'WIDGET_INVALID',
|
|
43
|
+
message: `"${String(area)}" is not a widget area key.`,
|
|
44
|
+
hint: 'An area key is lower case letters, digits and dashes, such as "sidebar" or "footer-1".',
|
|
45
|
+
details: { area },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function notFound(id) {
|
|
49
|
+
return new CogentaError({
|
|
50
|
+
code: 'WIDGET_NOT_FOUND',
|
|
51
|
+
message: `No widget "${id}".`,
|
|
52
|
+
hint: 'It may already have been deleted. Reload the widget list.',
|
|
53
|
+
details: { id },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function titleOf(value) {
|
|
57
|
+
if (value === undefined || value === null)
|
|
58
|
+
return null;
|
|
59
|
+
const trimmed = value.trim();
|
|
60
|
+
if (trimmed.length > 255) {
|
|
61
|
+
throw new CogentaError({
|
|
62
|
+
code: 'WIDGET_INVALID',
|
|
63
|
+
message: 'A widget title is at most 255 characters.',
|
|
64
|
+
hint: 'Shorten the title.',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return trimmed.length === 0 ? null : trimmed;
|
|
68
|
+
}
|
|
69
|
+
export function createWidgetStore(options) {
|
|
70
|
+
const { db } = options;
|
|
71
|
+
const dialect = db.dialect;
|
|
72
|
+
const now = options.now ?? (() => new Date());
|
|
73
|
+
const mintId = options.newId ?? newId;
|
|
74
|
+
const table = identifier(WIDGETS_TABLE, dialect);
|
|
75
|
+
const id = identifier('id', dialect);
|
|
76
|
+
const area = identifier('area', dialect);
|
|
77
|
+
const position = identifier('position', dialect);
|
|
78
|
+
function toWidget(row) {
|
|
79
|
+
return {
|
|
80
|
+
id: text(row['id']),
|
|
81
|
+
area: text(row['area']),
|
|
82
|
+
position: Number(row['position']),
|
|
83
|
+
type: text(row['type']),
|
|
84
|
+
title: row['title'] === null || row['title'] === undefined ? null : text(row['title']),
|
|
85
|
+
settings: JSON.parse(text(row['settings'])),
|
|
86
|
+
visibility: JSON.parse(text(row['visibility'])),
|
|
87
|
+
enabled: text(row['enabled']) === 'true',
|
|
88
|
+
createdAt: text(row['created_at']),
|
|
89
|
+
updatedAt: text(row['updated_at']),
|
|
90
|
+
updatedBy: row['updated_by'] === null || row['updated_by'] === undefined
|
|
91
|
+
? null
|
|
92
|
+
: text(row['updated_by']),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async function rowOf(tx, widgetId) {
|
|
96
|
+
// Postgres types the column as `uuid` and refuses to compare it with any
|
|
97
|
+
// other string, so an id that cannot exist is answered here, identically
|
|
98
|
+
// on every dialect.
|
|
99
|
+
if (!UUID.test(widgetId))
|
|
100
|
+
return null;
|
|
101
|
+
const found = await tx.query(sql `select * from ${table} where ${id} = ${widgetId}`);
|
|
102
|
+
return found.rows[0] ?? null;
|
|
103
|
+
}
|
|
104
|
+
async function areaIds(tx, areaKey, except) {
|
|
105
|
+
const found = await tx.query(sql `select ${id} from ${table} where ${area} = ${areaKey} order by ${position} asc, ${identifier('created_at', dialect)} asc`);
|
|
106
|
+
return found.rows.map((row) => text(row['id'])).filter((value) => value !== except);
|
|
107
|
+
}
|
|
108
|
+
/** Writes positions 0..n for the ids, in order, into the area. */
|
|
109
|
+
async function writeOrder(tx, areaKey, ids, stamp, updatedBy, touched) {
|
|
110
|
+
for (const [index, widgetId] of ids.entries()) {
|
|
111
|
+
if (widgetId === touched) {
|
|
112
|
+
await tx.query(sql `update ${table} set ${area} = ${areaKey}, ${position} = ${index}, ${identifier('updated_at', dialect)} = ${stamp}, ${identifier('updated_by', dialect)} = ${updatedBy} where ${id} = ${widgetId}`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
await tx.query(sql `update ${table} set ${position} = ${index} where ${id} = ${widgetId}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const store = {
|
|
120
|
+
async list(listOptions) {
|
|
121
|
+
const found = listOptions?.area === undefined
|
|
122
|
+
? await db.query(sql `select * from ${table} order by ${area} asc, ${position} asc, ${identifier('created_at', dialect)} asc`)
|
|
123
|
+
: await db.query(sql `select * from ${table} where ${area} = ${listOptions.area} order by ${position} asc, ${identifier('created_at', dialect)} asc`);
|
|
124
|
+
return found.rows.map(toWidget);
|
|
125
|
+
},
|
|
126
|
+
async read(widgetId) {
|
|
127
|
+
const row = await rowOf(db, widgetId);
|
|
128
|
+
return row === null ? null : toWidget(row);
|
|
129
|
+
},
|
|
130
|
+
create: (input) => db.transaction(async (tx) => {
|
|
131
|
+
if (!isWidgetAreaId(input.area))
|
|
132
|
+
throw areaInvalid(input.area);
|
|
133
|
+
const settings = validateWidgetSettings(input.type, input.settings, options.extraTypes);
|
|
134
|
+
const visibility = validateWidgetVisibility(input.visibility);
|
|
135
|
+
const widgetId = input.id ?? mintId();
|
|
136
|
+
if (!UUID.test(widgetId)) {
|
|
137
|
+
throw new CogentaError({
|
|
138
|
+
code: 'WIDGET_INVALID',
|
|
139
|
+
message: `"${widgetId}" is not a widget id.`,
|
|
140
|
+
hint: 'Leave the id out to have one minted, or pass a UUID.',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const stamp = now().toISOString();
|
|
144
|
+
const siblings = await areaIds(tx, input.area);
|
|
145
|
+
const index = input.position === undefined
|
|
146
|
+
? siblings.length
|
|
147
|
+
: Math.max(0, Math.min(siblings.length, Math.trunc(input.position)));
|
|
148
|
+
await tx.query(sql `insert into ${table} (
|
|
149
|
+
${id}, ${area}, ${position}, ${identifier('type', dialect)}, ${identifier('title', dialect)},
|
|
150
|
+
${identifier('settings', dialect)}, ${identifier('visibility', dialect)}, ${identifier('enabled', dialect)},
|
|
151
|
+
${identifier('created_at', dialect)}, ${identifier('updated_at', dialect)}, ${identifier('updated_by', dialect)}
|
|
152
|
+
) values (
|
|
153
|
+
${widgetId}, ${input.area}, ${index}, ${input.type}, ${titleOf(input.title)},
|
|
154
|
+
${JSON.stringify(settings)}, ${JSON.stringify(visibility)}, ${String(input.enabled ?? true)},
|
|
155
|
+
${stamp}, ${stamp}, ${input.updatedBy ?? null}
|
|
156
|
+
)`);
|
|
157
|
+
const order = [...siblings];
|
|
158
|
+
order.splice(index, 0, widgetId);
|
|
159
|
+
await writeOrder(tx, input.area, order, stamp, input.updatedBy ?? null, null);
|
|
160
|
+
const row = await rowOf(tx, widgetId);
|
|
161
|
+
if (row === null)
|
|
162
|
+
throw notFound(widgetId);
|
|
163
|
+
return toWidget(row);
|
|
164
|
+
}, { immediate: true }),
|
|
165
|
+
update: (widgetId, input) => db.transaction(async (tx) => {
|
|
166
|
+
const row = await rowOf(tx, widgetId);
|
|
167
|
+
if (row === null)
|
|
168
|
+
throw notFound(widgetId);
|
|
169
|
+
const current = toWidget(row);
|
|
170
|
+
const settings = input.settings === undefined
|
|
171
|
+
? current.settings
|
|
172
|
+
: validateWidgetSettings(current.type, input.settings, options.extraTypes);
|
|
173
|
+
const visibility = input.visibility === undefined
|
|
174
|
+
? current.visibility
|
|
175
|
+
: validateWidgetVisibility(input.visibility);
|
|
176
|
+
const title = input.title === undefined ? current.title : titleOf(input.title);
|
|
177
|
+
const enabled = input.enabled ?? current.enabled;
|
|
178
|
+
await tx.query(sql `update ${table} set
|
|
179
|
+
${identifier('title', dialect)} = ${title},
|
|
180
|
+
${identifier('settings', dialect)} = ${JSON.stringify(settings)},
|
|
181
|
+
${identifier('visibility', dialect)} = ${JSON.stringify(visibility)},
|
|
182
|
+
${identifier('enabled', dialect)} = ${String(enabled)},
|
|
183
|
+
${identifier('updated_at', dialect)} = ${now().toISOString()},
|
|
184
|
+
${identifier('updated_by', dialect)} = ${input.updatedBy ?? null}
|
|
185
|
+
where ${id} = ${widgetId}`);
|
|
186
|
+
const updated = await rowOf(tx, widgetId);
|
|
187
|
+
if (updated === null)
|
|
188
|
+
throw notFound(widgetId);
|
|
189
|
+
return toWidget(updated);
|
|
190
|
+
}, { immediate: true }),
|
|
191
|
+
delete: (widgetId) => db.transaction(async (tx) => {
|
|
192
|
+
const row = await rowOf(tx, widgetId);
|
|
193
|
+
if (row === null)
|
|
194
|
+
return false;
|
|
195
|
+
await tx.query(sql `delete from ${table} where ${id} = ${widgetId}`);
|
|
196
|
+
const areaKey = text(row['area']);
|
|
197
|
+
await writeOrder(tx, areaKey, await areaIds(tx, areaKey), '', null, null);
|
|
198
|
+
return true;
|
|
199
|
+
}, { immediate: true }),
|
|
200
|
+
move: (widgetId, target) => db.transaction(async (tx) => {
|
|
201
|
+
if (!isWidgetAreaId(target.area))
|
|
202
|
+
throw areaInvalid(target.area);
|
|
203
|
+
const row = await rowOf(tx, widgetId);
|
|
204
|
+
if (row === null)
|
|
205
|
+
throw notFound(widgetId);
|
|
206
|
+
const from = text(row['area']);
|
|
207
|
+
const stamp = now().toISOString();
|
|
208
|
+
const destination = await areaIds(tx, target.area, widgetId);
|
|
209
|
+
const index = Math.max(0, Math.min(destination.length, Math.trunc(target.position)));
|
|
210
|
+
destination.splice(index, 0, widgetId);
|
|
211
|
+
await writeOrder(tx, target.area, destination, stamp, target.updatedBy ?? null, widgetId);
|
|
212
|
+
if (from !== target.area) {
|
|
213
|
+
await writeOrder(tx, from, await areaIds(tx, from), stamp, null, null);
|
|
214
|
+
}
|
|
215
|
+
const moved = await rowOf(tx, widgetId);
|
|
216
|
+
if (moved === null)
|
|
217
|
+
throw notFound(widgetId);
|
|
218
|
+
return toWidget(moved);
|
|
219
|
+
}, { immediate: true }),
|
|
220
|
+
reorder: (areaKey, ids, updatedBy) => db.transaction(async (tx) => {
|
|
221
|
+
if (!isWidgetAreaId(areaKey))
|
|
222
|
+
throw areaInvalid(areaKey);
|
|
223
|
+
const current = await areaIds(tx, areaKey);
|
|
224
|
+
const same = current.length === ids.length &&
|
|
225
|
+
new Set(ids).size === ids.length &&
|
|
226
|
+
ids.every((widgetId) => current.includes(widgetId));
|
|
227
|
+
if (!same) {
|
|
228
|
+
throw new CogentaError({
|
|
229
|
+
code: 'WIDGET_INVALID',
|
|
230
|
+
message: `A new order for "${areaKey}" must list exactly the widgets of that area, once each.`,
|
|
231
|
+
hint: 'Reload the widget list: someone may have added or removed a widget meanwhile.',
|
|
232
|
+
details: { area: areaKey, expected: current, received: ids },
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
const stamp = now().toISOString();
|
|
236
|
+
await writeOrder(tx, areaKey, ids, stamp, updatedBy ?? null, null);
|
|
237
|
+
const found = await tx.query(sql `select * from ${table} where ${area} = ${areaKey} order by ${position} asc`);
|
|
238
|
+
return found.rows.map(toWidget);
|
|
239
|
+
}, { immediate: true }),
|
|
240
|
+
async duplicate(widgetId, updatedBy) {
|
|
241
|
+
const original = await store.read(widgetId);
|
|
242
|
+
if (original === null)
|
|
243
|
+
throw notFound(widgetId);
|
|
244
|
+
return store.create({
|
|
245
|
+
area: original.area,
|
|
246
|
+
type: original.type,
|
|
247
|
+
title: original.title,
|
|
248
|
+
settings: original.settings,
|
|
249
|
+
visibility: original.visibility,
|
|
250
|
+
enabled: false,
|
|
251
|
+
position: original.position + 1,
|
|
252
|
+
updatedBy: updatedBy ?? null,
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
async clear() {
|
|
256
|
+
const found = await db.query(sql `select count(*) as n from ${table}`);
|
|
257
|
+
await db.query(sql `delete from ${table}`);
|
|
258
|
+
return Number(found.rows[0]?.['n'] ?? 0);
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
return store;
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,UAAU,EACV,KAAK,EAEL,GAAG,GACJ,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,wBAAwB,EAAyB,MAAM,iBAAiB,CAAA;AACjF,OAAO,EAAyB,sBAAsB,EAAmB,MAAM,iBAAiB,CAAA;AAEhG;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAA;AA4E9C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EAAkB;IACzD,MAAM,OAAO,GAAG,EAA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
|
+
kind: z.ZodLiteral<"home">;
|
|
4
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5
|
+
kind: z.ZodLiteral<"collection">;
|
|
6
|
+
collection: z.ZodString;
|
|
7
|
+
entryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
9
|
+
kind: z.ZodLiteral<"taxonomy">;
|
|
10
|
+
taxonomy: z.ZodString;
|
|
11
|
+
termIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"dateArchive">;
|
|
14
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
15
|
+
kind: z.ZodLiteral<"search">;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"path">;
|
|
18
|
+
path: z.ZodString;
|
|
19
|
+
}, z.core.$strict>], "kind">;
|
|
20
|
+
export type PageTarget = z.infer<typeof pageTargetSchema>;
|
|
21
|
+
export declare const widgetVisibilitySchema: z.ZodObject<{
|
|
22
|
+
pages: z.ZodDefault<z.ZodObject<{
|
|
23
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
24
|
+
all: "all";
|
|
25
|
+
except: "except";
|
|
26
|
+
only: "only";
|
|
27
|
+
}>>;
|
|
28
|
+
targets: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
29
|
+
kind: z.ZodLiteral<"home">;
|
|
30
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
31
|
+
kind: z.ZodLiteral<"collection">;
|
|
32
|
+
collection: z.ZodString;
|
|
33
|
+
entryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"taxonomy">;
|
|
36
|
+
taxonomy: z.ZodString;
|
|
37
|
+
termIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
38
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
39
|
+
kind: z.ZodLiteral<"dateArchive">;
|
|
40
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"search">;
|
|
42
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
43
|
+
kind: z.ZodLiteral<"path">;
|
|
44
|
+
path: z.ZodString;
|
|
45
|
+
}, z.core.$strict>], "kind">>>;
|
|
46
|
+
}, z.core.$strict>>;
|
|
47
|
+
audience: z.ZodDefault<z.ZodEnum<{
|
|
48
|
+
everyone: "everyone";
|
|
49
|
+
members: "members";
|
|
50
|
+
visitors: "visitors";
|
|
51
|
+
}>>;
|
|
52
|
+
devices: z.ZodDefault<z.ZodObject<{
|
|
53
|
+
desktop: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
tablet: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
+
mobile: z.ZodDefault<z.ZodBoolean>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
from: z.ZodDefault<z.ZodNullable<z.ZodISODateTime>>;
|
|
58
|
+
until: z.ZodDefault<z.ZodNullable<z.ZodISODateTime>>;
|
|
59
|
+
locales: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export type WidgetVisibility = z.infer<typeof widgetVisibilitySchema>;
|
|
62
|
+
export declare const DEFAULT_VISIBILITY: WidgetVisibility;
|
|
63
|
+
export declare function validateWidgetVisibility(input: unknown): WidgetVisibility;
|
|
64
|
+
/** What the host knows about the page being rendered. */
|
|
65
|
+
export interface WidgetRequestContext {
|
|
66
|
+
readonly path: string;
|
|
67
|
+
readonly kind: 'home' | 'entry' | 'taxonomy' | 'dateArchive' | 'search' | 'other';
|
|
68
|
+
readonly collection?: string;
|
|
69
|
+
readonly entryId?: string;
|
|
70
|
+
readonly taxonomy?: string;
|
|
71
|
+
readonly termId?: string;
|
|
72
|
+
readonly signedIn: boolean;
|
|
73
|
+
readonly locale: string;
|
|
74
|
+
readonly now: Date;
|
|
75
|
+
}
|
|
76
|
+
export declare function targetMatches(target: PageTarget, context: WidgetRequestContext): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether a widget shows on this request. Devices are not decided here: the
|
|
79
|
+
* same cached page serves every screen, so they travel to the markup as
|
|
80
|
+
* attributes and the stylesheet hides what a screen should not see.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isWidgetVisible(widget: {
|
|
83
|
+
readonly enabled: boolean;
|
|
84
|
+
readonly visibility: WidgetVisibility;
|
|
85
|
+
}, context: WidgetRequestContext): boolean;
|
|
86
|
+
//# sourceMappingURL=visibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../src/visibility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;4BA0B3B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqBjC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,eAAO,MAAM,kBAAkB,EAAE,gBAAmD,CAAA;AAEpF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAwBzE;AAED,yDAAyD;AACzD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAA;IACjF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;CACnB;AAaD,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CA2BxF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAA;CAAE,EAC5E,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAaT"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { CogentaError } from '@cogenta/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Where, for whom, on what and when a widget shows (L30 D4) — the rules the
|
|
5
|
+
* WordPress visibility extensions add, as data, evaluated by one pure function
|
|
6
|
+
* so the admin preview and the public site can never disagree.
|
|
7
|
+
*/
|
|
8
|
+
const identifierLike = z.string().trim().min(1).max(128);
|
|
9
|
+
export const pageTargetSchema = z.discriminatedUnion('kind', [
|
|
10
|
+
z.strictObject({ kind: z.literal('home') }),
|
|
11
|
+
z.strictObject({
|
|
12
|
+
kind: z.literal('collection'),
|
|
13
|
+
collection: identifierLike,
|
|
14
|
+
/** Absent or empty: every entry of the collection. */
|
|
15
|
+
entryIds: z.array(identifierLike).max(200).optional(),
|
|
16
|
+
}),
|
|
17
|
+
z.strictObject({
|
|
18
|
+
kind: z.literal('taxonomy'),
|
|
19
|
+
taxonomy: identifierLike,
|
|
20
|
+
/** Absent or empty: every term's archive. */
|
|
21
|
+
termIds: z.array(identifierLike).max(200).optional(),
|
|
22
|
+
}),
|
|
23
|
+
z.strictObject({ kind: z.literal('dateArchive') }),
|
|
24
|
+
z.strictObject({ kind: z.literal('search') }),
|
|
25
|
+
z.strictObject({
|
|
26
|
+
kind: z.literal('path'),
|
|
27
|
+
/** A site path; `/guides/*` matches everything below `/guides/`. */
|
|
28
|
+
path: z
|
|
29
|
+
.string()
|
|
30
|
+
.trim()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(512)
|
|
33
|
+
.refine((value) => value.startsWith('/'), { message: 'must start with "/"' }),
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
export const widgetVisibilitySchema = z.strictObject({
|
|
37
|
+
pages: z
|
|
38
|
+
.strictObject({
|
|
39
|
+
mode: z.enum(['all', 'only', 'except']).default('all'),
|
|
40
|
+
targets: z.array(pageTargetSchema).max(100).default([]),
|
|
41
|
+
})
|
|
42
|
+
.default({ mode: 'all', targets: [] }),
|
|
43
|
+
audience: z.enum(['everyone', 'visitors', 'members']).default('everyone'),
|
|
44
|
+
devices: z
|
|
45
|
+
.strictObject({
|
|
46
|
+
desktop: z.boolean().default(true),
|
|
47
|
+
tablet: z.boolean().default(true),
|
|
48
|
+
mobile: z.boolean().default(true),
|
|
49
|
+
})
|
|
50
|
+
.default({ desktop: true, tablet: true, mobile: true }),
|
|
51
|
+
/** ISO 8601; the widget shows from this instant. */
|
|
52
|
+
from: z.iso.datetime({ offset: true }).nullable().default(null),
|
|
53
|
+
/** ISO 8601; the widget stops showing at this instant. */
|
|
54
|
+
until: z.iso.datetime({ offset: true }).nullable().default(null),
|
|
55
|
+
/** Empty: every language of the site. */
|
|
56
|
+
locales: z.array(z.string().trim().min(2).max(16)).max(50).default([]),
|
|
57
|
+
});
|
|
58
|
+
export const DEFAULT_VISIBILITY = widgetVisibilitySchema.parse({});
|
|
59
|
+
export function validateWidgetVisibility(input) {
|
|
60
|
+
const parsed = widgetVisibilitySchema.safeParse(input ?? {});
|
|
61
|
+
if (!parsed.success) {
|
|
62
|
+
const issue = parsed.error.issues[0];
|
|
63
|
+
throw new CogentaError({
|
|
64
|
+
code: 'WIDGET_INVALID',
|
|
65
|
+
message: `The widget's visibility rules are not valid at "${issue?.path.join('.') ?? ''}": ${issue?.message ?? 'unknown problem'}.`,
|
|
66
|
+
hint: 'Pages take a mode (all, only, except) and targets; audience is everyone, visitors or members; dates are ISO 8601.',
|
|
67
|
+
details: { issues: parsed.error.issues.map((item) => item.message) },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const value = parsed.data;
|
|
71
|
+
if (value.from !== null &&
|
|
72
|
+
value.until !== null &&
|
|
73
|
+
Date.parse(value.from) >= Date.parse(value.until)) {
|
|
74
|
+
throw new CogentaError({
|
|
75
|
+
code: 'WIDGET_INVALID',
|
|
76
|
+
message: 'A widget cannot stop showing before it starts.',
|
|
77
|
+
hint: 'Set "until" after "from", or clear one of them.',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
function pathMatches(pattern, path) {
|
|
83
|
+
const normalise = (value) => value.length > 1 && value.endsWith('/') ? value.slice(0, -1) : value;
|
|
84
|
+
if (pattern.endsWith('/*')) {
|
|
85
|
+
const base = normalise(pattern.slice(0, -2));
|
|
86
|
+
const current = normalise(path);
|
|
87
|
+
return current === base || current.startsWith(`${base === '/' ? '' : base}/`);
|
|
88
|
+
}
|
|
89
|
+
return normalise(pattern) === normalise(path);
|
|
90
|
+
}
|
|
91
|
+
export function targetMatches(target, context) {
|
|
92
|
+
switch (target.kind) {
|
|
93
|
+
case 'home':
|
|
94
|
+
return context.kind === 'home';
|
|
95
|
+
case 'collection':
|
|
96
|
+
return (context.kind === 'entry' &&
|
|
97
|
+
context.collection === target.collection &&
|
|
98
|
+
(target.entryIds === undefined ||
|
|
99
|
+
target.entryIds.length === 0 ||
|
|
100
|
+
(context.entryId !== undefined && target.entryIds.includes(context.entryId))));
|
|
101
|
+
case 'taxonomy':
|
|
102
|
+
return (context.kind === 'taxonomy' &&
|
|
103
|
+
context.taxonomy === target.taxonomy &&
|
|
104
|
+
(target.termIds === undefined ||
|
|
105
|
+
target.termIds.length === 0 ||
|
|
106
|
+
(context.termId !== undefined && target.termIds.includes(context.termId))));
|
|
107
|
+
case 'dateArchive':
|
|
108
|
+
return context.kind === 'dateArchive';
|
|
109
|
+
case 'search':
|
|
110
|
+
return context.kind === 'search';
|
|
111
|
+
case 'path':
|
|
112
|
+
return pathMatches(target.path, context.path);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Whether a widget shows on this request. Devices are not decided here: the
|
|
117
|
+
* same cached page serves every screen, so they travel to the markup as
|
|
118
|
+
* attributes and the stylesheet hides what a screen should not see.
|
|
119
|
+
*/
|
|
120
|
+
export function isWidgetVisible(widget, context) {
|
|
121
|
+
if (!widget.enabled)
|
|
122
|
+
return false;
|
|
123
|
+
const { visibility } = widget;
|
|
124
|
+
if (visibility.audience === 'visitors' && context.signedIn)
|
|
125
|
+
return false;
|
|
126
|
+
if (visibility.audience === 'members' && !context.signedIn)
|
|
127
|
+
return false;
|
|
128
|
+
if (visibility.locales.length > 0 && !visibility.locales.includes(context.locale))
|
|
129
|
+
return false;
|
|
130
|
+
const now = context.now.getTime();
|
|
131
|
+
if (visibility.from !== null && now < Date.parse(visibility.from))
|
|
132
|
+
return false;
|
|
133
|
+
if (visibility.until !== null && now >= Date.parse(visibility.until))
|
|
134
|
+
return false;
|
|
135
|
+
const { mode, targets } = visibility.pages;
|
|
136
|
+
if (mode === 'all')
|
|
137
|
+
return true;
|
|
138
|
+
const matched = targets.some((target) => targetMatches(target, context));
|
|
139
|
+
return mode === 'only' ? matched : !matched;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.js","sourceRoot":"","sources":["../src/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