@wordpress/edit-site 6.35.2-next.dc3f6d3c1.0 → 6.36.1-next.8b30e05b0.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 +1 -1
- package/build/components/add-new-template-legacy/add-custom-generic-template-modal-content.js +109 -0
- package/build/components/add-new-template-legacy/add-custom-generic-template-modal-content.js.map +7 -0
- package/build/components/add-new-template-legacy/add-custom-template-modal-content.js +328 -0
- package/build/components/add-new-template-legacy/add-custom-template-modal-content.js.map +7 -0
- package/build/components/add-new-template-legacy/index.js +389 -0
- package/build/components/add-new-template-legacy/index.js.map +7 -0
- package/build/components/add-new-template-legacy/utils.js +620 -0
- package/build/components/add-new-template-legacy/utils.js.map +7 -0
- package/build/components/page-templates/fields.js +3 -1
- package/build/components/page-templates/fields.js.map +2 -2
- package/build/components/page-templates/index-legacy.js +185 -0
- package/build/components/page-templates/index-legacy.js.map +7 -0
- package/build/components/post-list/index.js +10 -0
- package/build/components/post-list/index.js.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.js +101 -0
- package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.js.map +7 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +2 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +3 -3
- package/build/components/site-editor-routes/templates.js +10 -2
- package/build/components/site-editor-routes/templates.js.map +3 -3
- package/build/components/site-hub/index.js +1 -1
- package/build/components/site-hub/index.js.map +2 -2
- package/build/utils/constants.js +6 -0
- package/build/utils/constants.js.map +2 -2
- package/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.js +93 -0
- package/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.js.map +7 -0
- package/build-module/components/add-new-template-legacy/add-custom-template-modal-content.js +316 -0
- package/build-module/components/add-new-template-legacy/add-custom-template-modal-content.js.map +7 -0
- package/build-module/components/add-new-template-legacy/index.js +390 -0
- package/build-module/components/add-new-template-legacy/index.js.map +7 -0
- package/build-module/components/add-new-template-legacy/utils.js +589 -0
- package/build-module/components/add-new-template-legacy/utils.js.map +7 -0
- package/build-module/components/page-templates/fields.js +3 -1
- package/build-module/components/page-templates/fields.js.map +2 -2
- package/build-module/components/page-templates/index-legacy.js +154 -0
- package/build-module/components/page-templates/index-legacy.js.map +7 -0
- package/build-module/components/post-list/index.js +12 -0
- package/build-module/components/post-list/index.js.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.js +70 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.js.map +7 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +2 -2
- package/build-module/components/site-editor-routes/templates.js +10 -2
- package/build-module/components/site-editor-routes/templates.js.map +2 -2
- package/build-module/components/site-hub/index.js +1 -1
- package/build-module/components/site-hub/index.js.map +2 -2
- package/build-module/utils/constants.js +4 -0
- package/build-module/utils/constants.js.map +2 -2
- package/build-style/style-rtl.css +263 -27
- package/build-style/style.css +263 -27
- package/package.json +46 -46
- package/src/components/add-new-template-legacy/add-custom-generic-template-modal-content.js +94 -0
- package/src/components/add-new-template-legacy/add-custom-template-modal-content.js +314 -0
- package/src/components/add-new-template-legacy/index.js +454 -0
- package/src/components/add-new-template-legacy/utils.js +760 -0
- package/src/components/page-templates/fields.js +13 -9
- package/src/components/page-templates/index-legacy.js +166 -0
- package/src/components/post-list/index.js +13 -0
- package/src/components/sidebar-navigation-screen-templates-browse/content-legacy.js +79 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +8 -1
- package/src/components/site-editor-routes/templates.js +22 -3
- package/src/components/site-hub/index.js +1 -1
- package/src/utils/constants.js +2 -0
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
// packages/edit-site/src/components/add-new-template-legacy/utils.js
|
|
2
|
+
import { useSelect } from "@wordpress/data";
|
|
3
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
4
|
+
import { decodeEntities } from "@wordpress/html-entities";
|
|
5
|
+
import { useMemo, useCallback } from "@wordpress/element";
|
|
6
|
+
import { __, _x, sprintf } from "@wordpress/i18n";
|
|
7
|
+
import { blockMeta, post, archive } from "@wordpress/icons";
|
|
8
|
+
import { safeDecodeURI } from "@wordpress/url";
|
|
9
|
+
import { TEMPLATE_POST_TYPE } from "../../utils/constants";
|
|
10
|
+
var EMPTY_OBJECT = {};
|
|
11
|
+
var getValueFromObjectPath = (object, path) => {
|
|
12
|
+
let value = object;
|
|
13
|
+
path.split(".").forEach((fieldName) => {
|
|
14
|
+
value = value?.[fieldName];
|
|
15
|
+
});
|
|
16
|
+
return value;
|
|
17
|
+
};
|
|
18
|
+
function prefixSlug(prefix, slug) {
|
|
19
|
+
return `${prefix}-${safeDecodeURI(slug)}`;
|
|
20
|
+
}
|
|
21
|
+
var mapToIHasNameAndId = (entities, path) => {
|
|
22
|
+
return (entities || []).map((entity) => ({
|
|
23
|
+
...entity,
|
|
24
|
+
name: decodeEntities(getValueFromObjectPath(entity, path))
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
var useExistingTemplates = () => {
|
|
28
|
+
return useSelect(
|
|
29
|
+
(select) => select(coreStore).getEntityRecords(
|
|
30
|
+
"postType",
|
|
31
|
+
TEMPLATE_POST_TYPE,
|
|
32
|
+
{
|
|
33
|
+
per_page: -1
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
[]
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
var useDefaultTemplateTypes = () => {
|
|
40
|
+
return useSelect(
|
|
41
|
+
(select) => select(coreStore).getCurrentTheme()?.default_template_types || [],
|
|
42
|
+
[]
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
var usePublicPostTypes = () => {
|
|
46
|
+
const postTypes = useSelect(
|
|
47
|
+
(select) => select(coreStore).getPostTypes({ per_page: -1 }),
|
|
48
|
+
[]
|
|
49
|
+
);
|
|
50
|
+
return useMemo(() => {
|
|
51
|
+
const excludedPostTypes = ["attachment"];
|
|
52
|
+
return postTypes?.filter(
|
|
53
|
+
({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug)
|
|
54
|
+
).sort((a, b) => {
|
|
55
|
+
if (a.slug === "post" || b.slug === "post") {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
return a.name.localeCompare(b.name);
|
|
59
|
+
});
|
|
60
|
+
}, [postTypes]);
|
|
61
|
+
};
|
|
62
|
+
var usePublicTaxonomies = () => {
|
|
63
|
+
const taxonomies = useSelect(
|
|
64
|
+
(select) => select(coreStore).getTaxonomies({ per_page: -1 }),
|
|
65
|
+
[]
|
|
66
|
+
);
|
|
67
|
+
return useMemo(() => {
|
|
68
|
+
return taxonomies?.filter(
|
|
69
|
+
({ visibility }) => visibility?.publicly_queryable
|
|
70
|
+
);
|
|
71
|
+
}, [taxonomies]);
|
|
72
|
+
};
|
|
73
|
+
function usePostTypeArchiveMenuItems() {
|
|
74
|
+
const publicPostTypes = usePublicPostTypes();
|
|
75
|
+
const postTypesWithArchives = useMemo(
|
|
76
|
+
() => publicPostTypes?.filter((postType) => postType.has_archive),
|
|
77
|
+
[publicPostTypes]
|
|
78
|
+
);
|
|
79
|
+
const existingTemplates = useExistingTemplates();
|
|
80
|
+
const postTypeLabels = useMemo(
|
|
81
|
+
() => publicPostTypes?.reduce((accumulator, { labels }) => {
|
|
82
|
+
const singularName = labels.singular_name.toLowerCase();
|
|
83
|
+
accumulator[singularName] = (accumulator[singularName] || 0) + 1;
|
|
84
|
+
return accumulator;
|
|
85
|
+
}, {}),
|
|
86
|
+
[publicPostTypes]
|
|
87
|
+
);
|
|
88
|
+
const needsUniqueIdentifier = useCallback(
|
|
89
|
+
({ labels, slug }) => {
|
|
90
|
+
const singularName = labels.singular_name.toLowerCase();
|
|
91
|
+
return postTypeLabels[singularName] > 1 && singularName !== slug;
|
|
92
|
+
},
|
|
93
|
+
[postTypeLabels]
|
|
94
|
+
);
|
|
95
|
+
return useMemo(
|
|
96
|
+
() => postTypesWithArchives?.filter(
|
|
97
|
+
(postType) => !(existingTemplates || []).some(
|
|
98
|
+
(existingTemplate) => existingTemplate.slug === "archive-" + postType.slug
|
|
99
|
+
)
|
|
100
|
+
).map((postType) => {
|
|
101
|
+
let title;
|
|
102
|
+
if (needsUniqueIdentifier(postType)) {
|
|
103
|
+
title = sprintf(
|
|
104
|
+
// translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
|
|
105
|
+
__("Archive: %1$s (%2$s)"),
|
|
106
|
+
postType.labels.singular_name,
|
|
107
|
+
postType.slug
|
|
108
|
+
);
|
|
109
|
+
} else {
|
|
110
|
+
title = sprintf(
|
|
111
|
+
// translators: %s: Name of the post type e.g: "Post".
|
|
112
|
+
__("Archive: %s"),
|
|
113
|
+
postType.labels.singular_name
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
slug: "archive-" + postType.slug,
|
|
118
|
+
description: sprintf(
|
|
119
|
+
// translators: %s: Name of the post type e.g: "Post".
|
|
120
|
+
__(
|
|
121
|
+
"Displays an archive with the latest posts of type: %s."
|
|
122
|
+
),
|
|
123
|
+
postType.labels.singular_name
|
|
124
|
+
),
|
|
125
|
+
title,
|
|
126
|
+
// `icon` is the `menu_icon` property of a post type. We
|
|
127
|
+
// only handle `dashicons` for now, even if the `menu_icon`
|
|
128
|
+
// also supports urls and svg as values.
|
|
129
|
+
icon: typeof postType.icon === "string" && postType.icon.startsWith("dashicons-") ? postType.icon.slice(10) : archive,
|
|
130
|
+
templatePrefix: "archive"
|
|
131
|
+
};
|
|
132
|
+
}) || [],
|
|
133
|
+
[postTypesWithArchives, existingTemplates, needsUniqueIdentifier]
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
var usePostTypeMenuItems = (onClickMenuItem) => {
|
|
137
|
+
const publicPostTypes = usePublicPostTypes();
|
|
138
|
+
const existingTemplates = useExistingTemplates();
|
|
139
|
+
const defaultTemplateTypes = useDefaultTemplateTypes();
|
|
140
|
+
const templateLabels = useMemo(
|
|
141
|
+
() => publicPostTypes?.reduce((accumulator, { labels }) => {
|
|
142
|
+
const templateName = (labels.template_name || labels.singular_name).toLowerCase();
|
|
143
|
+
accumulator[templateName] = (accumulator[templateName] || 0) + 1;
|
|
144
|
+
return accumulator;
|
|
145
|
+
}, {}),
|
|
146
|
+
[publicPostTypes]
|
|
147
|
+
);
|
|
148
|
+
const needsUniqueIdentifier = useCallback(
|
|
149
|
+
({ labels, slug }) => {
|
|
150
|
+
const templateName = (labels.template_name || labels.singular_name).toLowerCase();
|
|
151
|
+
return templateLabels[templateName] > 1 && templateName !== slug;
|
|
152
|
+
},
|
|
153
|
+
[templateLabels]
|
|
154
|
+
);
|
|
155
|
+
const templatePrefixes = useMemo(
|
|
156
|
+
() => publicPostTypes?.reduce((accumulator, { slug }) => {
|
|
157
|
+
let suffix = slug;
|
|
158
|
+
if (slug !== "page") {
|
|
159
|
+
suffix = `single-${suffix}`;
|
|
160
|
+
}
|
|
161
|
+
accumulator[slug] = suffix;
|
|
162
|
+
return accumulator;
|
|
163
|
+
}, {}),
|
|
164
|
+
[publicPostTypes]
|
|
165
|
+
);
|
|
166
|
+
const postTypesInfo = useEntitiesInfo("postType", templatePrefixes);
|
|
167
|
+
const existingTemplateSlugs = (existingTemplates || []).map(
|
|
168
|
+
({ slug }) => slug
|
|
169
|
+
);
|
|
170
|
+
const menuItems = (publicPostTypes || []).reduce(
|
|
171
|
+
(accumulator, postType) => {
|
|
172
|
+
const { slug, labels, icon } = postType;
|
|
173
|
+
const generalTemplateSlug = templatePrefixes[slug];
|
|
174
|
+
const defaultTemplateType = defaultTemplateTypes?.find(
|
|
175
|
+
({ slug: _slug }) => _slug === generalTemplateSlug
|
|
176
|
+
);
|
|
177
|
+
const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
|
|
178
|
+
const _needsUniqueIdentifier = needsUniqueIdentifier(postType);
|
|
179
|
+
let menuItemTitle = labels.template_name || sprintf(
|
|
180
|
+
// translators: %s: Name of the post type e.g: "Post".
|
|
181
|
+
__("Single item: %s"),
|
|
182
|
+
labels.singular_name
|
|
183
|
+
);
|
|
184
|
+
if (_needsUniqueIdentifier) {
|
|
185
|
+
menuItemTitle = labels.template_name ? sprintf(
|
|
186
|
+
// translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book".
|
|
187
|
+
_x("%1$s (%2$s)", "post type menu label"),
|
|
188
|
+
labels.template_name,
|
|
189
|
+
slug
|
|
190
|
+
) : sprintf(
|
|
191
|
+
// translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book".
|
|
192
|
+
_x(
|
|
193
|
+
"Single item: %1$s (%2$s)",
|
|
194
|
+
"post type menu label"
|
|
195
|
+
),
|
|
196
|
+
labels.singular_name,
|
|
197
|
+
slug
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
const menuItem = defaultTemplateType ? {
|
|
201
|
+
...defaultTemplateType,
|
|
202
|
+
templatePrefix: templatePrefixes[slug]
|
|
203
|
+
} : {
|
|
204
|
+
slug: generalTemplateSlug,
|
|
205
|
+
title: menuItemTitle,
|
|
206
|
+
description: sprintf(
|
|
207
|
+
// translators: %s: Name of the post type e.g: "Post".
|
|
208
|
+
__("Displays a single item: %s."),
|
|
209
|
+
labels.singular_name
|
|
210
|
+
),
|
|
211
|
+
// `icon` is the `menu_icon` property of a post type. We
|
|
212
|
+
// only handle `dashicons` for now, even if the `menu_icon`
|
|
213
|
+
// also supports urls and svg as values.
|
|
214
|
+
icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post,
|
|
215
|
+
templatePrefix: templatePrefixes[slug]
|
|
216
|
+
};
|
|
217
|
+
const hasEntities = postTypesInfo?.[slug]?.hasEntities;
|
|
218
|
+
if (hasEntities) {
|
|
219
|
+
menuItem.onClick = (template) => {
|
|
220
|
+
onClickMenuItem({
|
|
221
|
+
type: "postType",
|
|
222
|
+
slug,
|
|
223
|
+
config: {
|
|
224
|
+
recordNamePath: "title.rendered",
|
|
225
|
+
queryArgs: ({ search }) => {
|
|
226
|
+
return {
|
|
227
|
+
_fields: "id,title,slug,link",
|
|
228
|
+
orderBy: search ? "relevance" : "modified",
|
|
229
|
+
exclude: postTypesInfo[slug].existingEntitiesIds
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
getSpecificTemplate: (suggestion) => {
|
|
233
|
+
const templateSlug = prefixSlug(
|
|
234
|
+
templatePrefixes[slug],
|
|
235
|
+
suggestion.slug
|
|
236
|
+
);
|
|
237
|
+
return {
|
|
238
|
+
title: templateSlug,
|
|
239
|
+
slug: templateSlug,
|
|
240
|
+
templatePrefix: templatePrefixes[slug]
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
labels,
|
|
245
|
+
hasGeneralTemplate,
|
|
246
|
+
template
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
if (!hasGeneralTemplate || hasEntities) {
|
|
251
|
+
accumulator.push(menuItem);
|
|
252
|
+
}
|
|
253
|
+
return accumulator;
|
|
254
|
+
},
|
|
255
|
+
[]
|
|
256
|
+
);
|
|
257
|
+
const postTypesMenuItems = useMemo(
|
|
258
|
+
() => menuItems.reduce(
|
|
259
|
+
(accumulator, postType) => {
|
|
260
|
+
const { slug } = postType;
|
|
261
|
+
let key = "postTypesMenuItems";
|
|
262
|
+
if (slug === "page") {
|
|
263
|
+
key = "defaultPostTypesMenuItems";
|
|
264
|
+
}
|
|
265
|
+
accumulator[key].push(postType);
|
|
266
|
+
return accumulator;
|
|
267
|
+
},
|
|
268
|
+
{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }
|
|
269
|
+
),
|
|
270
|
+
[menuItems]
|
|
271
|
+
);
|
|
272
|
+
return postTypesMenuItems;
|
|
273
|
+
};
|
|
274
|
+
var useTaxonomiesMenuItems = (onClickMenuItem) => {
|
|
275
|
+
const publicTaxonomies = usePublicTaxonomies();
|
|
276
|
+
const existingTemplates = useExistingTemplates();
|
|
277
|
+
const defaultTemplateTypes = useDefaultTemplateTypes();
|
|
278
|
+
const templatePrefixes = useMemo(
|
|
279
|
+
() => publicTaxonomies?.reduce((accumulator, { slug }) => {
|
|
280
|
+
let suffix = slug;
|
|
281
|
+
if (!["category", "post_tag"].includes(slug)) {
|
|
282
|
+
suffix = `taxonomy-${suffix}`;
|
|
283
|
+
}
|
|
284
|
+
if (slug === "post_tag") {
|
|
285
|
+
suffix = `tag`;
|
|
286
|
+
}
|
|
287
|
+
accumulator[slug] = suffix;
|
|
288
|
+
return accumulator;
|
|
289
|
+
}, {}),
|
|
290
|
+
[publicTaxonomies]
|
|
291
|
+
);
|
|
292
|
+
const taxonomyLabels = publicTaxonomies?.reduce(
|
|
293
|
+
(accumulator, { labels }) => {
|
|
294
|
+
const templateName = (labels.template_name || labels.singular_name).toLowerCase();
|
|
295
|
+
accumulator[templateName] = (accumulator[templateName] || 0) + 1;
|
|
296
|
+
return accumulator;
|
|
297
|
+
},
|
|
298
|
+
{}
|
|
299
|
+
);
|
|
300
|
+
const needsUniqueIdentifier = (labels, slug) => {
|
|
301
|
+
if (["category", "post_tag"].includes(slug)) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
const templateName = (labels.template_name || labels.singular_name).toLowerCase();
|
|
305
|
+
return taxonomyLabels[templateName] > 1 && templateName !== slug;
|
|
306
|
+
};
|
|
307
|
+
const taxonomiesInfo = useEntitiesInfo("taxonomy", templatePrefixes);
|
|
308
|
+
const existingTemplateSlugs = (existingTemplates || []).map(
|
|
309
|
+
({ slug }) => slug
|
|
310
|
+
);
|
|
311
|
+
const menuItems = (publicTaxonomies || []).reduce(
|
|
312
|
+
(accumulator, taxonomy) => {
|
|
313
|
+
const { slug, labels } = taxonomy;
|
|
314
|
+
const generalTemplateSlug = templatePrefixes[slug];
|
|
315
|
+
const defaultTemplateType = defaultTemplateTypes?.find(
|
|
316
|
+
({ slug: _slug }) => _slug === generalTemplateSlug
|
|
317
|
+
);
|
|
318
|
+
const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
|
|
319
|
+
const _needsUniqueIdentifier = needsUniqueIdentifier(
|
|
320
|
+
labels,
|
|
321
|
+
slug
|
|
322
|
+
);
|
|
323
|
+
let menuItemTitle = labels.template_name || labels.singular_name;
|
|
324
|
+
if (_needsUniqueIdentifier) {
|
|
325
|
+
menuItemTitle = labels.template_name ? sprintf(
|
|
326
|
+
// translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat".
|
|
327
|
+
_x("%1$s (%2$s)", "taxonomy template menu label"),
|
|
328
|
+
labels.template_name,
|
|
329
|
+
slug
|
|
330
|
+
) : sprintf(
|
|
331
|
+
// translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat".
|
|
332
|
+
_x("%1$s (%2$s)", "taxonomy menu label"),
|
|
333
|
+
labels.singular_name,
|
|
334
|
+
slug
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
const menuItem = defaultTemplateType ? {
|
|
338
|
+
...defaultTemplateType,
|
|
339
|
+
templatePrefix: templatePrefixes[slug]
|
|
340
|
+
} : {
|
|
341
|
+
slug: generalTemplateSlug,
|
|
342
|
+
title: menuItemTitle,
|
|
343
|
+
description: sprintf(
|
|
344
|
+
// translators: %s: Name of the taxonomy e.g: "Product Categories".
|
|
345
|
+
__("Displays taxonomy: %s."),
|
|
346
|
+
labels.singular_name
|
|
347
|
+
),
|
|
348
|
+
icon: blockMeta,
|
|
349
|
+
templatePrefix: templatePrefixes[slug]
|
|
350
|
+
};
|
|
351
|
+
const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
|
|
352
|
+
if (hasEntities) {
|
|
353
|
+
menuItem.onClick = (template) => {
|
|
354
|
+
onClickMenuItem({
|
|
355
|
+
type: "taxonomy",
|
|
356
|
+
slug,
|
|
357
|
+
config: {
|
|
358
|
+
queryArgs: ({ search }) => {
|
|
359
|
+
return {
|
|
360
|
+
_fields: "id,name,slug,link",
|
|
361
|
+
orderBy: search ? "name" : "count",
|
|
362
|
+
exclude: taxonomiesInfo[slug].existingEntitiesIds
|
|
363
|
+
};
|
|
364
|
+
},
|
|
365
|
+
getSpecificTemplate: (suggestion) => {
|
|
366
|
+
const templateSlug = prefixSlug(
|
|
367
|
+
templatePrefixes[slug],
|
|
368
|
+
suggestion.slug
|
|
369
|
+
);
|
|
370
|
+
return {
|
|
371
|
+
title: templateSlug,
|
|
372
|
+
slug: templateSlug,
|
|
373
|
+
templatePrefix: templatePrefixes[slug]
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
labels,
|
|
378
|
+
hasGeneralTemplate,
|
|
379
|
+
template
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
if (!hasGeneralTemplate || hasEntities) {
|
|
384
|
+
accumulator.push(menuItem);
|
|
385
|
+
}
|
|
386
|
+
return accumulator;
|
|
387
|
+
},
|
|
388
|
+
[]
|
|
389
|
+
);
|
|
390
|
+
const taxonomiesMenuItems = useMemo(
|
|
391
|
+
() => menuItems.reduce(
|
|
392
|
+
(accumulator, taxonomy) => {
|
|
393
|
+
const { slug } = taxonomy;
|
|
394
|
+
let key = "taxonomiesMenuItems";
|
|
395
|
+
if (["category", "tag"].includes(slug)) {
|
|
396
|
+
key = "defaultTaxonomiesMenuItems";
|
|
397
|
+
}
|
|
398
|
+
accumulator[key].push(taxonomy);
|
|
399
|
+
return accumulator;
|
|
400
|
+
},
|
|
401
|
+
{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }
|
|
402
|
+
),
|
|
403
|
+
[menuItems]
|
|
404
|
+
);
|
|
405
|
+
return taxonomiesMenuItems;
|
|
406
|
+
};
|
|
407
|
+
var USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: "author" };
|
|
408
|
+
var USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: "authors" } };
|
|
409
|
+
function useAuthorMenuItem(onClickMenuItem) {
|
|
410
|
+
const existingTemplates = useExistingTemplates();
|
|
411
|
+
const defaultTemplateTypes = useDefaultTemplateTypes();
|
|
412
|
+
const authorInfo = useEntitiesInfo(
|
|
413
|
+
"root",
|
|
414
|
+
USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,
|
|
415
|
+
USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS
|
|
416
|
+
);
|
|
417
|
+
let authorMenuItem = defaultTemplateTypes?.find(
|
|
418
|
+
({ slug }) => slug === "author"
|
|
419
|
+
);
|
|
420
|
+
if (!authorMenuItem) {
|
|
421
|
+
authorMenuItem = {
|
|
422
|
+
description: __(
|
|
423
|
+
"Displays latest posts written by a single author."
|
|
424
|
+
),
|
|
425
|
+
slug: "author",
|
|
426
|
+
title: "Author"
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
const hasGeneralTemplate = !!existingTemplates?.find(
|
|
430
|
+
({ slug }) => slug === "author"
|
|
431
|
+
);
|
|
432
|
+
if (authorInfo.user?.hasEntities) {
|
|
433
|
+
authorMenuItem = { ...authorMenuItem, templatePrefix: "author" };
|
|
434
|
+
authorMenuItem.onClick = (template) => {
|
|
435
|
+
onClickMenuItem({
|
|
436
|
+
type: "root",
|
|
437
|
+
slug: "user",
|
|
438
|
+
config: {
|
|
439
|
+
queryArgs: ({ search }) => {
|
|
440
|
+
return {
|
|
441
|
+
_fields: "id,name,slug,link",
|
|
442
|
+
orderBy: search ? "name" : "registered_date",
|
|
443
|
+
exclude: authorInfo.user.existingEntitiesIds,
|
|
444
|
+
who: "authors"
|
|
445
|
+
};
|
|
446
|
+
},
|
|
447
|
+
getSpecificTemplate: (suggestion) => {
|
|
448
|
+
const templateSlug = prefixSlug(
|
|
449
|
+
"author",
|
|
450
|
+
suggestion.slug
|
|
451
|
+
);
|
|
452
|
+
return {
|
|
453
|
+
title: templateSlug,
|
|
454
|
+
slug: templateSlug,
|
|
455
|
+
templatePrefix: "author"
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
labels: {
|
|
460
|
+
singular_name: __("Author"),
|
|
461
|
+
search_items: __("Search Authors"),
|
|
462
|
+
not_found: __("No authors found."),
|
|
463
|
+
all_items: __("All Authors")
|
|
464
|
+
},
|
|
465
|
+
hasGeneralTemplate,
|
|
466
|
+
template
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
|
|
471
|
+
return authorMenuItem;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
var useExistingTemplateSlugs = (templatePrefixes) => {
|
|
475
|
+
const existingTemplates = useExistingTemplates();
|
|
476
|
+
const existingSlugs = useMemo(() => {
|
|
477
|
+
return Object.entries(templatePrefixes || {}).reduce(
|
|
478
|
+
(accumulator, [slug, prefix]) => {
|
|
479
|
+
const slugsWithTemplates = (existingTemplates || []).reduce(
|
|
480
|
+
(_accumulator, existingTemplate) => {
|
|
481
|
+
const _prefix = `${prefix}-`;
|
|
482
|
+
if (existingTemplate.slug.startsWith(_prefix)) {
|
|
483
|
+
_accumulator.push(
|
|
484
|
+
existingTemplate.slug.substring(
|
|
485
|
+
_prefix.length
|
|
486
|
+
)
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
return _accumulator;
|
|
490
|
+
},
|
|
491
|
+
[]
|
|
492
|
+
);
|
|
493
|
+
if (slugsWithTemplates.length) {
|
|
494
|
+
accumulator[slug] = slugsWithTemplates;
|
|
495
|
+
}
|
|
496
|
+
return accumulator;
|
|
497
|
+
},
|
|
498
|
+
{}
|
|
499
|
+
);
|
|
500
|
+
}, [templatePrefixes, existingTemplates]);
|
|
501
|
+
return existingSlugs;
|
|
502
|
+
};
|
|
503
|
+
var useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
|
|
504
|
+
const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
|
|
505
|
+
const recordsToExcludePerEntity = useSelect(
|
|
506
|
+
(select) => {
|
|
507
|
+
return Object.entries(slugsToExcludePerEntity || {}).reduce(
|
|
508
|
+
(accumulator, [slug, slugsWithTemplates]) => {
|
|
509
|
+
const entitiesWithTemplates = select(
|
|
510
|
+
coreStore
|
|
511
|
+
).getEntityRecords(entityName, slug, {
|
|
512
|
+
_fields: "id",
|
|
513
|
+
context: "view",
|
|
514
|
+
slug: slugsWithTemplates,
|
|
515
|
+
...additionalQueryParameters[slug]
|
|
516
|
+
});
|
|
517
|
+
if (entitiesWithTemplates?.length) {
|
|
518
|
+
accumulator[slug] = entitiesWithTemplates;
|
|
519
|
+
}
|
|
520
|
+
return accumulator;
|
|
521
|
+
},
|
|
522
|
+
{}
|
|
523
|
+
);
|
|
524
|
+
},
|
|
525
|
+
[slugsToExcludePerEntity]
|
|
526
|
+
);
|
|
527
|
+
return recordsToExcludePerEntity;
|
|
528
|
+
};
|
|
529
|
+
var useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => {
|
|
530
|
+
const recordsToExcludePerEntity = useTemplatesToExclude(
|
|
531
|
+
entityName,
|
|
532
|
+
templatePrefixes,
|
|
533
|
+
additionalQueryParameters
|
|
534
|
+
);
|
|
535
|
+
const entitiesHasRecords = useSelect(
|
|
536
|
+
(select) => {
|
|
537
|
+
return Object.keys(templatePrefixes || {}).reduce(
|
|
538
|
+
(accumulator, slug) => {
|
|
539
|
+
const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
|
|
540
|
+
({ id }) => id
|
|
541
|
+
) || [];
|
|
542
|
+
accumulator[slug] = !!select(
|
|
543
|
+
coreStore
|
|
544
|
+
).getEntityRecords(entityName, slug, {
|
|
545
|
+
per_page: 1,
|
|
546
|
+
_fields: "id",
|
|
547
|
+
context: "view",
|
|
548
|
+
exclude: existingEntitiesIds,
|
|
549
|
+
...additionalQueryParameters[slug]
|
|
550
|
+
})?.length;
|
|
551
|
+
return accumulator;
|
|
552
|
+
},
|
|
553
|
+
{}
|
|
554
|
+
);
|
|
555
|
+
},
|
|
556
|
+
[
|
|
557
|
+
templatePrefixes,
|
|
558
|
+
recordsToExcludePerEntity,
|
|
559
|
+
entityName,
|
|
560
|
+
additionalQueryParameters
|
|
561
|
+
]
|
|
562
|
+
);
|
|
563
|
+
const entitiesInfo = useMemo(() => {
|
|
564
|
+
return Object.keys(templatePrefixes || {}).reduce(
|
|
565
|
+
(accumulator, slug) => {
|
|
566
|
+
const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
|
|
567
|
+
({ id }) => id
|
|
568
|
+
) || [];
|
|
569
|
+
accumulator[slug] = {
|
|
570
|
+
hasEntities: entitiesHasRecords[slug],
|
|
571
|
+
existingEntitiesIds
|
|
572
|
+
};
|
|
573
|
+
return accumulator;
|
|
574
|
+
},
|
|
575
|
+
{}
|
|
576
|
+
);
|
|
577
|
+
}, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]);
|
|
578
|
+
return entitiesInfo;
|
|
579
|
+
};
|
|
580
|
+
export {
|
|
581
|
+
mapToIHasNameAndId,
|
|
582
|
+
useAuthorMenuItem,
|
|
583
|
+
useDefaultTemplateTypes,
|
|
584
|
+
useExistingTemplates,
|
|
585
|
+
usePostTypeArchiveMenuItems,
|
|
586
|
+
usePostTypeMenuItems,
|
|
587
|
+
useTaxonomiesMenuItems
|
|
588
|
+
};
|
|
589
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/add-new-template-legacy/utils.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { blockMeta, post, archive } from '@wordpress/icons';\nimport { safeDecodeURI } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.split( '.' ).forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Helper that adds a prefix to a post slug. The slug needs to be URL-decoded first,\n * so that we have raw Unicode characters there. The server will truncate the slug to\n * 200 characters, respecing Unicode char boundary. On the other hand, the server\n * doesn't detect urlencoded octet boundary and can possibly construct slugs that\n * are not valid urlencoded strings.\n * @param {string} prefix The prefix to add to the slug.\n * @param {string} slug The slug to add the prefix to.\n * @return {string} The slug with the prefix.\n */\nfunction prefixSlug( prefix, slug ) {\n\treturn `${ prefix }-${ safeDecodeURI( slug ) }`;\n}\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( getValueFromObjectPath( entity, path ) ),\n\t} ) );\n};\n\n/**\n * @typedef {Object} EntitiesInfo\n * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).\n * @property {number[]} existingEntitiesIds An array of the existing entities ids.\n */\n\nexport const useExistingTemplates = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t),\n\t\t[]\n\t);\n};\n\nexport const useDefaultTemplateTypes = () => {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()?.default_template_types || [],\n\t\t[]\n\t);\n};\n\nconst usePublicPostTypes = () => {\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\treturn postTypes\n\t\t\t?.filter(\n\t\t\t\t( { viewable, slug } ) =>\n\t\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t\t)\n\t\t\t.sort( ( a, b ) => {\n\t\t\t\t// Sort post types alphabetically by name,\n\t\t\t\t// but exclude the built-in 'post' type from sorting.\n\t\t\t\tif ( a.slug === 'post' || b.slug === 'post' ) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\treturn a.name.localeCompare( b.name );\n\t\t\t} );\n\t}, [ postTypes ] );\n};\n\nconst usePublicTaxonomies = () => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\treturn useMemo( () => {\n\t\treturn taxonomies?.filter(\n\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t);\n\t}, [ taxonomies ] );\n};\n\nexport function usePostTypeArchiveMenuItems() {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst postTypesWithArchives = useMemo(\n\t\t() => publicPostTypes?.filter( ( postType ) => postType.has_archive ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst existingTemplates = useExistingTemplates();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst postTypeLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\t\taccumulator[ singularName ] =\n\t\t\t\t\t( accumulator[ singularName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst singularName = labels.singular_name.toLowerCase();\n\t\t\treturn postTypeLabels[ singularName ] > 1 && singularName !== slug;\n\t\t},\n\t\t[ postTypeLabels ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tpostTypesWithArchives\n\t\t\t\t?.filter(\n\t\t\t\t\t( postType ) =>\n\t\t\t\t\t\t! ( existingTemplates || [] ).some(\n\t\t\t\t\t\t\t( existingTemplate ) =>\n\t\t\t\t\t\t\t\texistingTemplate.slug ===\n\t\t\t\t\t\t\t\t'archive-' + postType.slug\n\t\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( postType ) => {\n\t\t\t\t\tlet title;\n\t\t\t\t\tif ( needsUniqueIdentifier( postType ) ) {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %1s: Name of the post type e.g: \"Post\"; %2s: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t__( 'Archive: %1$s (%2$s)' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name,\n\t\t\t\t\t\t\tpostType.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttitle = sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Archive: %s' ),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tslug: 'archive-' + postType.slug,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Displays an archive with the latest posts of type: %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tpostType.labels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof postType.icon === 'string' &&\n\t\t\t\t\t\t\tpostType.icon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? postType.icon.slice( 10 )\n\t\t\t\t\t\t\t\t: archive,\n\t\t\t\t\t\ttemplatePrefix: 'archive',\n\t\t\t\t\t};\n\t\t\t\t} ) || [],\n\t\t[ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]\n\t);\n}\n\nexport const usePostTypeMenuItems = ( onClickMenuItem ) => {\n\tconst publicPostTypes = usePublicPostTypes();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst templateLabels = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { labels } ) => {\n\t\t\t\tconst templateName = (\n\t\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t\t).toLowerCase();\n\t\t\t\taccumulator[ templateName ] =\n\t\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst needsUniqueIdentifier = useCallback(\n\t\t( { labels, slug } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\treturn templateLabels[ templateName ] > 1 && templateName !== slug;\n\t\t},\n\t\t[ templateLabels ]\n\t);\n\n\t// `page`is a special case in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicPostTypes?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( slug !== 'page' ) {\n\t\t\t\t\tsuffix = `single-${ suffix }`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicPostTypes ]\n\t);\n\tconst postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicPostTypes || [] ).reduce(\n\t\t( accumulator, postType ) => {\n\t\t\tconst { slug, labels, icon } = postType;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier( postType );\n\t\t\tlet menuItemTitle =\n\t\t\t\tlabels.template_name ||\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t__( 'Single item: %s' ),\n\t\t\t\t\tlabels.singular_name\n\t\t\t\t);\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Single Item: Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'post type menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the post type e.g: \"Post\". 2: Slug of the post type e.g: \"book\".\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Single item: %1$s (%2$s)',\n\t\t\t\t\t\t\t\t'post type menu label'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t\t\t\t__( 'Displays a single item: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t\t\t\t// also supports urls and svg as values.\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\ttypeof icon === 'string' &&\n\t\t\t\t\t\t\ticon.startsWith( 'dashicons-' )\n\t\t\t\t\t\t\t\t? icon.slice( 10 )\n\t\t\t\t\t\t\t\t: post,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = postTypesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'postType',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\trecordNamePath: 'title.rendered',\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,title,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'relevance' : 'modified',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\tpostTypesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = prefixSlug(\n\t\t\t\t\t\t\t\t\ttemplatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t\tsuggestion.slug\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default post types\n\t// and one for the rest.\n\tconst postTypesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, postType ) => {\n\t\t\t\t\tconst { slug } = postType;\n\t\t\t\t\tlet key = 'postTypesMenuItems';\n\t\t\t\t\tif ( slug === 'page' ) {\n\t\t\t\t\t\tkey = 'defaultPostTypesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( postType );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultPostTypesMenuItems: [], postTypesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn postTypesMenuItems;\n};\n\nexport const useTaxonomiesMenuItems = ( onClickMenuItem ) => {\n\tconst publicTaxonomies = usePublicTaxonomies();\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\t// `category` and `post_tag` are special cases in template hierarchy.\n\tconst templatePrefixes = useMemo(\n\t\t() =>\n\t\t\tpublicTaxonomies?.reduce( ( accumulator, { slug } ) => {\n\t\t\t\tlet suffix = slug;\n\t\t\t\tif ( ! [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\t\t\tsuffix = `taxonomy-${ suffix }`;\n\t\t\t\t}\n\t\t\t\tif ( slug === 'post_tag' ) {\n\t\t\t\t\tsuffix = `tag`;\n\t\t\t\t}\n\t\t\t\taccumulator[ slug ] = suffix;\n\t\t\t\treturn accumulator;\n\t\t\t}, {} ),\n\t\t[ publicTaxonomies ]\n\t);\n\t// We need to keep track of naming conflicts. If a conflict\n\t// occurs, we need to add slug.\n\tconst taxonomyLabels = publicTaxonomies?.reduce(\n\t\t( accumulator, { labels } ) => {\n\t\t\tconst templateName = (\n\t\t\t\tlabels.template_name || labels.singular_name\n\t\t\t).toLowerCase();\n\t\t\taccumulator[ templateName ] =\n\t\t\t\t( accumulator[ templateName ] || 0 ) + 1;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{}\n\t);\n\tconst needsUniqueIdentifier = ( labels, slug ) => {\n\t\tif ( [ 'category', 'post_tag' ].includes( slug ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst templateName = (\n\t\t\tlabels.template_name || labels.singular_name\n\t\t).toLowerCase();\n\t\treturn taxonomyLabels[ templateName ] > 1 && templateName !== slug;\n\t};\n\tconst taxonomiesInfo = useEntitiesInfo( 'taxonomy', templatePrefixes );\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst menuItems = ( publicTaxonomies || [] ).reduce(\n\t\t( accumulator, taxonomy ) => {\n\t\t\tconst { slug, labels } = taxonomy;\n\t\t\t// We need to check if the general template is part of the\n\t\t\t// defaultTemplateTypes. If it is, just use that info and\n\t\t\t// augment it with the specific template functionality.\n\t\t\tconst generalTemplateSlug = templatePrefixes[ slug ];\n\t\t\tconst defaultTemplateType = defaultTemplateTypes?.find(\n\t\t\t\t( { slug: _slug } ) => _slug === generalTemplateSlug\n\t\t\t);\n\t\t\tconst hasGeneralTemplate =\n\t\t\t\texistingTemplateSlugs?.includes( generalTemplateSlug );\n\t\t\tconst _needsUniqueIdentifier = needsUniqueIdentifier(\n\t\t\t\tlabels,\n\t\t\t\tslug\n\t\t\t);\n\t\t\tlet menuItemTitle = labels.template_name || labels.singular_name;\n\t\t\tif ( _needsUniqueIdentifier ) {\n\t\t\t\tmenuItemTitle = labels.template_name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the template e.g: \"Products by Category\". 2: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy template menu label' ),\n\t\t\t\t\t\t\tlabels.template_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: 1: Name of the taxonomy e.g: \"Category\". 2: Slug of the taxonomy e.g: \"product_cat\".\n\t\t\t\t\t\t\t_x( '%1$s (%2$s)', 'taxonomy menu label' ),\n\t\t\t\t\t\t\tlabels.singular_name,\n\t\t\t\t\t\t\tslug\n\t\t\t\t\t );\n\t\t\t}\n\t\t\tconst menuItem = defaultTemplateType\n\t\t\t\t? {\n\t\t\t\t\t\t...defaultTemplateType,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tslug: generalTemplateSlug,\n\t\t\t\t\t\ttitle: menuItemTitle,\n\t\t\t\t\t\tdescription: sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the taxonomy e.g: \"Product Categories\".\n\t\t\t\t\t\t\t__( 'Displays taxonomy: %s.' ),\n\t\t\t\t\t\t\tlabels.singular_name\n\t\t\t\t\t\t),\n\t\t\t\t\t\ticon: blockMeta,\n\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t };\n\t\t\tconst hasEntities = taxonomiesInfo?.[ slug ]?.hasEntities;\n\t\t\t// We have a different template creation flow only if they have entities.\n\t\t\tif ( hasEntities ) {\n\t\t\t\tmenuItem.onClick = ( template ) => {\n\t\t\t\t\tonClickMenuItem( {\n\t\t\t\t\t\ttype: 'taxonomy',\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\t\t\torderBy: search ? 'name' : 'count',\n\t\t\t\t\t\t\t\t\texclude:\n\t\t\t\t\t\t\t\t\t\ttaxonomiesInfo[ slug ]\n\t\t\t\t\t\t\t\t\t\t\t.existingEntitiesIds,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\t\t\tconst templateSlug = prefixSlug(\n\t\t\t\t\t\t\t\t\ttemplatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t\tsuggestion.slug\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\t\t\ttemplatePrefix: templatePrefixes[ slug ],\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlabels,\n\t\t\t\t\t\thasGeneralTemplate,\n\t\t\t\t\t\ttemplate,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t}\n\t\t\t// We don't need to add the menu item if there are no\n\t\t\t// entities and the general template exists.\n\t\t\tif ( ! hasGeneralTemplate || hasEntities ) {\n\t\t\t\taccumulator.push( menuItem );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\t// Split menu items into two groups: one for the default taxonomies\n\t// and one for the rest.\n\tconst taxonomiesMenuItems = useMemo(\n\t\t() =>\n\t\t\tmenuItems.reduce(\n\t\t\t\t( accumulator, taxonomy ) => {\n\t\t\t\t\tconst { slug } = taxonomy;\n\t\t\t\t\tlet key = 'taxonomiesMenuItems';\n\t\t\t\t\tif ( [ 'category', 'tag' ].includes( slug ) ) {\n\t\t\t\t\t\tkey = 'defaultTaxonomiesMenuItems';\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ key ].push( taxonomy );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }\n\t\t\t),\n\t\t[ menuItems ]\n\t);\n\treturn taxonomiesMenuItems;\n};\n\nconst USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };\nconst USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };\nexport function useAuthorMenuItem( onClickMenuItem ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst authorInfo = useEntitiesInfo(\n\t\t'root',\n\t\tUSE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,\n\t\tUSE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS\n\t);\n\tlet authorMenuItem = defaultTemplateTypes?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( ! authorMenuItem ) {\n\t\tauthorMenuItem = {\n\t\t\tdescription: __(\n\t\t\t\t'Displays latest posts written by a single author.'\n\t\t\t),\n\t\t\tslug: 'author',\n\t\t\ttitle: 'Author',\n\t\t};\n\t}\n\tconst hasGeneralTemplate = !! existingTemplates?.find(\n\t\t( { slug } ) => slug === 'author'\n\t);\n\tif ( authorInfo.user?.hasEntities ) {\n\t\tauthorMenuItem = { ...authorMenuItem, templatePrefix: 'author' };\n\t\tauthorMenuItem.onClick = ( template ) => {\n\t\t\tonClickMenuItem( {\n\t\t\t\ttype: 'root',\n\t\t\t\tslug: 'user',\n\t\t\t\tconfig: {\n\t\t\t\t\tqueryArgs: ( { search } ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t_fields: 'id,name,slug,link',\n\t\t\t\t\t\t\torderBy: search ? 'name' : 'registered_date',\n\t\t\t\t\t\t\texclude: authorInfo.user.existingEntitiesIds,\n\t\t\t\t\t\t\twho: 'authors',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tgetSpecificTemplate: ( suggestion ) => {\n\t\t\t\t\t\tconst templateSlug = prefixSlug(\n\t\t\t\t\t\t\t'author',\n\t\t\t\t\t\t\tsuggestion.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: templateSlug,\n\t\t\t\t\t\t\tslug: templateSlug,\n\t\t\t\t\t\t\ttemplatePrefix: 'author',\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlabels: {\n\t\t\t\t\tsingular_name: __( 'Author' ),\n\t\t\t\t\tsearch_items: __( 'Search Authors' ),\n\t\t\t\t\tnot_found: __( 'No authors found.' ),\n\t\t\t\t\tall_items: __( 'All Authors' ),\n\t\t\t\t},\n\t\t\t\thasGeneralTemplate,\n\t\t\t\ttemplate,\n\t\t\t} );\n\t\t};\n\t}\n\tif ( ! hasGeneralTemplate || authorInfo.user?.hasEntities ) {\n\t\treturn authorMenuItem;\n\t}\n}\n\n/**\n * Helper hook that filters all the existing templates by the given\n * object with the entity's slug as key and the template prefix as value.\n *\n * Example:\n * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]\n * `templatePrefixes` is: { post_tag: 'tag' }\n * It will return: { post_tag: ['apple'] }\n *\n * Note: We append the `-` to the given template prefix in this function for our checks.\n *\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.\n */\nconst useExistingTemplateSlugs = ( templatePrefixes ) => {\n\tconst existingTemplates = useExistingTemplates();\n\tconst existingSlugs = useMemo( () => {\n\t\treturn Object.entries( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, [ slug, prefix ] ) => {\n\t\t\t\tconst slugsWithTemplates = ( existingTemplates || [] ).reduce(\n\t\t\t\t\t( _accumulator, existingTemplate ) => {\n\t\t\t\t\t\tconst _prefix = `${ prefix }-`;\n\t\t\t\t\t\tif ( existingTemplate.slug.startsWith( _prefix ) ) {\n\t\t\t\t\t\t\t_accumulator.push(\n\t\t\t\t\t\t\t\texistingTemplate.slug.substring(\n\t\t\t\t\t\t\t\t\t_prefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn _accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tif ( slugsWithTemplates.length ) {\n\t\t\t\t\taccumulator[ slug ] = slugsWithTemplates;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, existingTemplates ] );\n\treturn existingSlugs;\n};\n\n/**\n * Helper hook that finds the existing records with an associated template,\n * as they need to be excluded from the template suggestions.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.\n */\nconst useTemplatesToExclude = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = {}\n) => {\n\tconst slugsToExcludePerEntity =\n\t\tuseExistingTemplateSlugs( templatePrefixes );\n\tconst recordsToExcludePerEntity = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.entries( slugsToExcludePerEntity || {} ).reduce(\n\t\t\t\t( accumulator, [ slug, slugsWithTemplates ] ) => {\n\t\t\t\t\tconst entitiesWithTemplates = select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\tslug: slugsWithTemplates,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} );\n\t\t\t\t\tif ( entitiesWithTemplates?.length ) {\n\t\t\t\t\t\taccumulator[ slug ] = entitiesWithTemplates;\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[ slugsToExcludePerEntity ]\n\t);\n\treturn recordsToExcludePerEntity;\n};\n\n/**\n * Helper hook that returns information about an entity having\n * records that we can create a specific template for.\n *\n * For example we can search for `terms` in `taxonomy` entity or\n * `posts` in `postType` entity.\n *\n * First we need to find the existing records with an associated template,\n * to query afterwards for any remaining record, by excluding them.\n *\n * @param {string} entityName The entity's name.\n * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.\n * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.\n * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.\n */\nconst useEntitiesInfo = (\n\tentityName,\n\ttemplatePrefixes,\n\tadditionalQueryParameters = EMPTY_OBJECT\n) => {\n\tconst recordsToExcludePerEntity = useTemplatesToExclude(\n\t\tentityName,\n\t\ttemplatePrefixes,\n\t\tadditionalQueryParameters\n\t);\n\tconst entitiesHasRecords = useSelect(\n\t\t( select ) => {\n\t\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t\t( accumulator, slug ) => {\n\t\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t\t) || [];\n\t\t\t\t\taccumulator[ slug ] = !! select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getEntityRecords( entityName, slug, {\n\t\t\t\t\t\tper_page: 1,\n\t\t\t\t\t\t_fields: 'id',\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t\texclude: existingEntitiesIds,\n\t\t\t\t\t\t...additionalQueryParameters[ slug ],\n\t\t\t\t\t} )?.length;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t},\n\t\t[\n\t\t\ttemplatePrefixes,\n\t\t\trecordsToExcludePerEntity,\n\t\t\tentityName,\n\t\t\tadditionalQueryParameters,\n\t\t]\n\t);\n\tconst entitiesInfo = useMemo( () => {\n\t\treturn Object.keys( templatePrefixes || {} ).reduce(\n\t\t\t( accumulator, slug ) => {\n\t\t\t\tconst existingEntitiesIds =\n\t\t\t\t\trecordsToExcludePerEntity?.[ slug ]?.map(\n\t\t\t\t\t\t( { id } ) => id\n\t\t\t\t\t) || [];\n\t\t\t\taccumulator[ slug ] = {\n\t\t\t\t\thasEntities: entitiesHasRecords[ slug ],\n\t\t\t\t\texistingEntitiesIds,\n\t\t\t\t};\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}, [ templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords ] );\n\treturn entitiesInfo;\n};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,iBAAiB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