@elementor/editor-site-navigation 0.26.0 → 0.28.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/index.js +726 -730
  3. package/dist/index.mjs +767 -771
  4. package/package.json +12 -13
  5. package/src/api/post.ts +2 -1
  6. package/src/api/recent-posts.ts +2 -1
  7. package/src/components/panel/actions-menu/action-menu-item.tsx +2 -2
  8. package/src/components/panel/actions-menu/actions/delete.tsx +7 -6
  9. package/src/components/panel/actions-menu/actions/duplicate.tsx +4 -3
  10. package/src/components/panel/actions-menu/actions/rename.tsx +3 -2
  11. package/src/components/panel/actions-menu/actions/set-home.tsx +5 -4
  12. package/src/components/panel/actions-menu/actions/view.tsx +3 -2
  13. package/src/components/panel/add-new-button.tsx +2 -1
  14. package/src/components/panel/error-snackbar.tsx +1 -1
  15. package/src/components/panel/panel.ts +1 -0
  16. package/src/components/panel/posts-list/collapsible-list.tsx +4 -4
  17. package/src/components/panel/posts-list/error-state.tsx +1 -1
  18. package/src/components/panel/posts-list/list-items/edit-mode-template.tsx +3 -2
  19. package/src/components/panel/posts-list/list-items/list-item-create.tsx +2 -1
  20. package/src/components/panel/posts-list/list-items/list-item-duplicate.tsx +2 -1
  21. package/src/components/panel/posts-list/list-items/list-item-rename.tsx +4 -3
  22. package/src/components/panel/posts-list/list-items/list-item-view.tsx +11 -10
  23. package/src/components/panel/posts-list/post-list-item.tsx +4 -3
  24. package/src/components/panel/posts-list/posts-collapsible-list.tsx +6 -5
  25. package/src/components/panel/shell.tsx +2 -1
  26. package/src/components/shared/page-title-and-status.tsx +1 -0
  27. package/src/components/top-bar/chip-doc-type.tsx +2 -1
  28. package/src/components/top-bar/create-post-list-item.tsx +4 -3
  29. package/src/components/top-bar/indicator.tsx +2 -2
  30. package/src/components/top-bar/post-list-item.tsx +4 -3
  31. package/src/components/top-bar/recently-edited.tsx +15 -14
  32. package/src/contexts/post-list-context.tsx +3 -2
  33. package/src/hooks/use-create-page.ts +1 -1
  34. package/src/hooks/use-homepage-actions.ts +2 -1
  35. package/src/hooks/use-homepage.ts +1 -0
  36. package/src/hooks/use-posts-actions.ts +11 -2
  37. package/src/hooks/use-posts.ts +3 -2
  38. package/src/hooks/use-recent-posts.ts +1 -0
  39. package/src/hooks/use-rename-active-document.ts +1 -1
  40. package/src/hooks/use-toggle-button-props.ts +2 -1
  41. package/src/hooks/use-user.ts +1 -0
  42. package/src/icons-map.ts +4 -5
  43. package/src/init.ts +3 -2
package/dist/index.js CHANGED
@@ -51,316 +51,107 @@ function getIconsMap() {
51
51
  return iconsMap;
52
52
  }
53
53
 
54
- // src/components/top-bar/recently-edited.tsx
55
- var React5 = __toESM(require("react"));
56
- var import_ui5 = require("@elementor/ui");
57
- var import_icons4 = require("@elementor/icons");
58
- var import_editor_documents3 = require("@elementor/editor-documents");
54
+ // src/init.ts
55
+ var import_editor_app_bar = require("@elementor/editor-app-bar");
56
+ var import_editor_panels3 = require("@elementor/editor-panels");
59
57
 
60
- // src/components/top-bar/indicator.tsx
58
+ // src/components/panel/panel.ts
59
+ var import_editor_panels2 = require("@elementor/editor-panels");
60
+
61
+ // src/components/panel/shell.tsx
62
+ var React20 = __toESM(require("react"));
63
+ var import_editor_panels = require("@elementor/editor-panels");
64
+ var import_i18n13 = require("@wordpress/i18n");
65
+
66
+ // src/contexts/post-list-context.tsx
61
67
  var React = __toESM(require("react"));
62
- var import_ui = require("@elementor/ui");
63
- function Indicator({ title, status }) {
64
- return /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(import_ui.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React.createElement(import_ui.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React.createElement(import_ui.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
65
- }
66
- function Tooltip(props) {
68
+ var import_react = require("react");
69
+ var defaultValues = {
70
+ type: "page",
71
+ editMode: { mode: "none", details: {} },
72
+ setEditMode: () => null,
73
+ resetEditMode: () => null,
74
+ setError: () => null
75
+ };
76
+ var PostListContext = (0, import_react.createContext)(defaultValues);
77
+ var PostListContextProvider = ({
78
+ type,
79
+ setError,
80
+ children
81
+ }) => {
82
+ const [editMode, setEditMode] = (0, import_react.useState)(defaultValues.editMode);
83
+ const resetEditMode = () => {
84
+ setEditMode(defaultValues.editMode);
85
+ };
67
86
  return /* @__PURE__ */ React.createElement(
68
- import_ui.Tooltip,
87
+ PostListContext.Provider,
69
88
  {
70
- PopperProps: {
71
- sx: {
72
- "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
73
- mt: 2.7
74
- }
75
- }
76
- },
77
- ...props
78
- }
89
+ value: {
90
+ type,
91
+ editMode,
92
+ setEditMode,
93
+ resetEditMode,
94
+ setError
95
+ }
96
+ },
97
+ children
79
98
  );
80
- }
81
-
82
- // src/hooks/use-recent-posts.ts
83
- var import_query = require("@elementor/query");
84
-
85
- // src/api/recent-posts.ts
86
- var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
87
- var baseUrl = "/elementor/v1/site-navigation/recent-posts";
88
- var NUMBER_OF_RECENT_POSTS = 6;
89
- var getRequest = () => {
90
- const queryParams = new URLSearchParams({
91
- posts_per_page: `${NUMBER_OF_RECENT_POSTS}`
92
- });
93
- const path = `${baseUrl}?${queryParams.toString()}`;
94
- return (0, import_api_fetch.default)({ path });
95
99
  };
96
-
97
- // src/hooks/use-recent-posts.ts
98
- var recentPostsQueryKey = ["site-navigation", "recent-posts"];
99
- function useRecentPosts() {
100
- return (0, import_query.useQuery)({
101
- queryKey: recentPostsQueryKey,
102
- queryFn: () => getRequest()
103
- });
100
+ function usePostListContext() {
101
+ const context = (0, import_react.useContext)(PostListContext);
102
+ if (!context) {
103
+ throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
104
+ }
105
+ return context;
104
106
  }
105
107
 
106
- // src/components/top-bar/recently-edited.tsx
107
- var import_i18n2 = require("@wordpress/i18n");
108
-
109
- // src/components/top-bar/chip-doc-type.tsx
110
- var import_icons2 = require("@elementor/icons");
111
- var import_ui2 = require("@elementor/ui");
108
+ // src/components/panel/error-snackbar.tsx
112
109
  var React2 = __toESM(require("react"));
113
- var iconsMap2 = getIconsMap();
114
- function DocTypeChip({ postType, docType, label }) {
115
- const color = "elementor_library" === postType ? "global" : "primary";
116
- const Icon = iconsMap2[docType] || import_icons2.PostTypeIcon;
110
+ var import_ui = require("@elementor/ui");
111
+ var ErrorSnackbar = ({ open, onClose }) => {
117
112
  return /* @__PURE__ */ React2.createElement(
118
- import_ui2.Chip,
119
- {
120
- component: "span",
121
- size: "small",
122
- variant: "outlined",
123
- label,
124
- "data-value": docType,
125
- color,
126
- icon: /* @__PURE__ */ React2.createElement(Icon, null),
127
- sx: { ml: 1, cursor: "inherit" }
128
- }
129
- );
130
- }
131
-
132
- // src/components/top-bar/post-list-item.tsx
133
- var import_ui3 = require("@elementor/ui");
134
- var React3 = __toESM(require("react"));
135
- var import_editor_documents = require("@elementor/editor-documents");
136
-
137
- // src/hooks/use-reverse-html-entities.ts
138
- var import_react = require("react");
139
- function useReverseHtmlEntities(escapedHTML = "") {
140
- return (0, import_react.useMemo)(() => {
141
- const textarea = document.createElement("textarea");
142
- textarea.innerHTML = escapedHTML;
143
- const { value } = textarea;
144
- textarea.remove();
145
- return value;
146
- }, [escapedHTML]);
147
- }
148
-
149
- // src/components/top-bar/post-list-item.tsx
150
- function PostListItem({ post, closePopup, ...props }) {
151
- const navigateToDocument = (0, import_editor_documents.__useNavigateToDocument)();
152
- const postTitle = useReverseHtmlEntities(post.title);
153
- return /* @__PURE__ */ React3.createElement(
154
- import_ui3.MenuItem,
113
+ import_ui.Snackbar,
155
114
  {
156
- disabled: !post.user_can.edit,
157
- onClick: async () => {
158
- closePopup();
159
- await navigateToDocument(post.id);
160
- },
161
- ...props
162
- },
163
- /* @__PURE__ */ React3.createElement(
164
- import_ui3.ListItemText,
165
- {
166
- sx: { flexGrow: 0 },
167
- primaryTypographyProps: { variant: "body2", noWrap: true },
168
- primary: postTitle
115
+ open,
116
+ onClose,
117
+ anchorOrigin: {
118
+ vertical: "bottom",
119
+ horizontal: "left"
169
120
  }
170
- ),
171
- /* @__PURE__ */ React3.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
172
- );
173
- }
174
-
175
- // src/components/top-bar/create-post-list-item.tsx
176
- var import_ui4 = require("@elementor/ui");
177
- var React4 = __toESM(require("react"));
178
-
179
- // src/hooks/use-create-page.ts
180
- var import_api_fetch2 = __toESM(require("@wordpress/api-fetch"));
181
- var import_react2 = require("react");
182
- var endpointPath = "/elementor/v1/site-navigation/add-new-post";
183
- function useCreatePage() {
184
- const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
185
- return {
186
- create: () => {
187
- setIsLoading(true);
188
- return addNewPage().then((newPost) => newPost).finally(() => setIsLoading(false));
189
121
  },
190
- isLoading
191
- };
192
- }
193
- async function addNewPage() {
194
- return await (0, import_api_fetch2.default)({
195
- path: endpointPath,
196
- method: "POST",
197
- data: { post_type: "page" }
198
- });
199
- }
200
-
201
- // src/components/top-bar/create-post-list-item.tsx
202
- var import_icons3 = require("@elementor/icons");
203
- var import_i18n = require("@wordpress/i18n");
204
- var import_editor_documents2 = require("@elementor/editor-documents");
205
-
206
- // src/hooks/use-user.ts
207
- var import_query2 = require("@elementor/query");
208
-
209
- // src/api/user.ts
210
- var import_api_fetch3 = __toESM(require("@wordpress/api-fetch"));
211
- var getUser = () => {
212
- const baseUri = "/wp/v2/users/me";
213
- const keys = ["capabilities"];
214
- const queryParams = new URLSearchParams({
215
- _fields: keys.join(","),
216
- context: "edit"
217
- });
218
- const uri = baseUri + "?" + queryParams.toString();
219
- return (0, import_api_fetch3.default)({ path: uri });
220
- };
221
-
222
- // src/hooks/use-user.ts
223
- var userQueryKey = () => ["site-navigation", "user"];
224
- function useUser() {
225
- return (0, import_query2.useQuery)({
226
- queryKey: userQueryKey(),
227
- queryFn: () => getUser()
228
- });
229
- }
230
-
231
- // src/components/top-bar/create-post-list-item.tsx
232
- function CreatePostListItem({ closePopup, ...props }) {
233
- const { create, isLoading } = useCreatePage();
234
- const navigateToDocument = (0, import_editor_documents2.__useNavigateToDocument)();
235
- const { data: user } = useUser();
236
- return /* @__PURE__ */ React4.createElement(
237
- import_ui4.MenuItem,
238
- {
239
- disabled: isLoading || !user?.capabilities?.edit_pages,
240
- onClick: async () => {
241
- const { id } = await create();
242
- closePopup();
243
- await navigateToDocument(id);
244
- },
245
- ...props
246
- },
247
- /* @__PURE__ */ React4.createElement(import_ui4.ListItemIcon, null, isLoading ? /* @__PURE__ */ React4.createElement(import_ui4.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React4.createElement(import_icons3.PlusIcon, { fontSize: "small" })),
248
- /* @__PURE__ */ React4.createElement(
249
- import_ui4.ListItemText,
122
+ /* @__PURE__ */ React2.createElement(import_ui.Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React2.createElement(
123
+ import_ui.Typography,
250
124
  {
251
- primaryTypographyProps: { variant: "body2" },
252
- primary: (0, import_i18n.__)("Add new page", "elementor")
253
- }
254
- )
255
- );
256
- }
257
-
258
- // src/components/top-bar/recently-edited.tsx
259
- function RecentlyEdited() {
260
- const activeDocument = (0, import_editor_documents3.__useActiveDocument)();
261
- const hostDocument = (0, import_editor_documents3.__useHostDocument)();
262
- const document2 = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument;
263
- const { data } = useRecentPosts();
264
- const getRecentPosts = () => {
265
- if (!data) {
266
- return [];
267
- }
268
- return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
269
- };
270
- const recentPosts = getRecentPosts();
271
- const popupState = (0, import_ui5.usePopupState)({
272
- variant: "popover",
273
- popupId: "elementor-v2-top-bar-recently-edited"
274
- });
275
- const documentTitle = useReverseHtmlEntities(document2?.title);
276
- if (!document2) {
277
- return null;
278
- }
279
- const buttonProps = (0, import_ui5.bindTrigger)(popupState);
280
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
281
- import_ui5.Button,
282
- {
283
- color: "inherit",
284
- size: "small",
285
- endIcon: /* @__PURE__ */ React5.createElement(import_icons4.ChevronDownIcon, { fontSize: "small" }),
286
- ...buttonProps,
287
- onClick: (e) => {
288
- const extendedWindow = window;
289
- const config = extendedWindow?.elementor?.editorEvents?.config;
290
- if (config) {
291
- extendedWindow.elementor.editorEvents.dispatchEvent(config.names.topBar.documentNameDropdown, {
292
- location: config.locations.topBar,
293
- secondaryLocation: config.secondaryLocations.documentNameDropdown,
294
- trigger: config.triggers.dropdownClick,
295
- element: config.elements.dropdown
296
- });
125
+ component: "span",
126
+ sx: {
127
+ fontWeight: "bold"
297
128
  }
298
- buttonProps.onClick(e);
299
- }
300
- },
301
- /* @__PURE__ */ React5.createElement(Indicator, { title: documentTitle, status: document2.status })
302
- ), /* @__PURE__ */ React5.createElement(
303
- import_ui5.Menu,
304
- {
305
- MenuListProps: {
306
- subheader: /* @__PURE__ */ React5.createElement(import_ui5.ListSubheader, { color: "primary", sx: { fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n2.__)("Recent", "elementor"))
307
129
  },
308
- PaperProps: { sx: { mt: 2.5, width: 320 } },
309
- ...(0, import_ui5.bindMenu)(popupState)
310
- },
311
- recentPosts.map((post) => /* @__PURE__ */ React5.createElement(PostListItem, { key: post.id, post, closePopup: popupState.close })),
312
- recentPosts.length === 0 && /* @__PURE__ */ React5.createElement(import_ui5.MenuItem, { disabled: true }, /* @__PURE__ */ React5.createElement(
313
- import_ui5.ListItemText,
314
- {
315
- primaryTypographyProps: {
316
- variant: "caption",
317
- fontStyle: "italic"
318
- },
319
- primary: (0, import_i18n2.__)("There are no other pages or templates on this site yet.", "elementor")
320
- }
321
- )),
322
- /* @__PURE__ */ React5.createElement(import_ui5.Divider, { disabled: recentPosts.length === 0 }),
323
- /* @__PURE__ */ React5.createElement(CreatePostListItem, { closePopup: popupState.close })
324
- ));
325
- }
326
-
327
- // src/init.ts
328
- var import_editor_app_bar = require("@elementor/editor-app-bar");
329
-
330
- // src/hooks/use-toggle-button-props.ts
331
- var import_i18n16 = require("@wordpress/i18n");
332
- var import_icons16 = require("@elementor/icons");
333
-
334
- // src/components/panel/panel.ts
335
- var import_editor_panels2 = require("@elementor/editor-panels");
336
-
337
- // src/components/panel/shell.tsx
338
- var React25 = __toESM(require("react"));
339
- var import_editor_panels = require("@elementor/editor-panels");
340
- var import_i18n15 = require("@wordpress/i18n");
130
+ "We couldn\u2019t complete the action."
131
+ ), " ", "Please try again")
132
+ );
133
+ };
134
+ var error_snackbar_default = ErrorSnackbar;
341
135
 
342
136
  // src/components/panel/posts-list/posts-collapsible-list.tsx
343
- var React23 = __toESM(require("react"));
344
- var import_icons15 = require("@elementor/icons");
345
- var import_ui15 = require("@elementor/ui");
346
-
347
- // src/hooks/use-posts.ts
348
- var import_query3 = require("@elementor/query");
137
+ var React19 = __toESM(require("react"));
138
+ var import_icons12 = require("@elementor/icons");
139
+ var import_ui11 = require("@elementor/ui");
349
140
 
350
141
  // src/api/post.ts
351
- var import_api_fetch4 = __toESM(require("@wordpress/api-fetch"));
352
- var import_i18n3 = require("@wordpress/i18n");
142
+ var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
143
+ var import_i18n = require("@wordpress/i18n");
353
144
  var postTypesMap = {
354
145
  page: {
355
146
  labels: {
356
- singular_name: (0, import_i18n3.__)("Page", "elementor"),
357
- plural_name: (0, import_i18n3.__)("Pages", "elementor")
147
+ singular_name: (0, import_i18n.__)("Page", "elementor"),
148
+ plural_name: (0, import_i18n.__)("Pages", "elementor")
358
149
  },
359
150
  rest_base: "pages"
360
151
  }
361
152
  };
362
153
  var POST_PER_PAGE = 10;
363
- var getRequest2 = async (postTypeSlug, page) => {
154
+ var getRequest = async (postTypeSlug, page) => {
364
155
  const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
365
156
  const keys = ["id", "type", "title", "link", "status", "user_can"];
366
157
  const queryParams = new URLSearchParams({
@@ -371,7 +162,7 @@ var getRequest2 = async (postTypeSlug, page) => {
371
162
  _fields: keys.join(",")
372
163
  });
373
164
  const uri = baseUri + "?" + queryParams.toString();
374
- const result = await (0, import_api_fetch4.default)({ path: uri, parse: false });
165
+ const result = await (0, import_api_fetch.default)({ path: uri, parse: false });
375
166
  const data = await result.json();
376
167
  const totalPages = Number(result.headers.get("x-wp-totalpages"));
377
168
  const totalPosts = Number(result.headers.get("x-wp-total"));
@@ -384,7 +175,7 @@ var getRequest2 = async (postTypeSlug, page) => {
384
175
  };
385
176
  var createRequest = (postTypeSlug, newPost) => {
386
177
  const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
387
- return (0, import_api_fetch4.default)({
178
+ return (0, import_api_fetch.default)({
388
179
  path,
389
180
  method: "POST",
390
181
  data: newPost
@@ -393,7 +184,7 @@ var createRequest = (postTypeSlug, newPost) => {
393
184
  var updateRequest = (postTypeSlug, updatedPost) => {
394
185
  const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
395
186
  const { id, ...data } = updatedPost;
396
- return (0, import_api_fetch4.default)({
187
+ return (0, import_api_fetch.default)({
397
188
  path: `${path}/${id}`,
398
189
  method: "POST",
399
190
  data
@@ -401,14 +192,14 @@ var updateRequest = (postTypeSlug, updatedPost) => {
401
192
  };
402
193
  var deleteRequest = (postTypeSlug, postId) => {
403
194
  const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
404
- return (0, import_api_fetch4.default)({
195
+ return (0, import_api_fetch.default)({
405
196
  path: `${path}/${postId}`,
406
197
  method: "DELETE"
407
198
  });
408
199
  };
409
200
  var duplicateRequest = (originalPost) => {
410
201
  const path = `/elementor/v1/site-navigation/duplicate-post`;
411
- return (0, import_api_fetch4.default)({
202
+ return (0, import_api_fetch.default)({
412
203
  path,
413
204
  method: "POST",
414
205
  data: {
@@ -418,7 +209,35 @@ var duplicateRequest = (originalPost) => {
418
209
  });
419
210
  };
420
211
 
212
+ // src/hooks/use-homepage.ts
213
+ var import_query = require("@elementor/query");
214
+
215
+ // src/api/settings.ts
216
+ var import_api_fetch2 = __toESM(require("@wordpress/api-fetch"));
217
+ var getSettings = () => {
218
+ const baseUri = "/elementor/v1/site-navigation/homepage";
219
+ const uri = baseUri;
220
+ return (0, import_api_fetch2.default)({ path: uri });
221
+ };
222
+ var updateSettings = (settings) => {
223
+ return (0, import_api_fetch2.default)({
224
+ path: "/wp/v2/settings",
225
+ method: "POST",
226
+ data: settings
227
+ });
228
+ };
229
+
230
+ // src/hooks/use-homepage.ts
231
+ var settingsQueryKey = () => ["site-navigation", "homepage"];
232
+ function useHomepage() {
233
+ return (0, import_query.useQuery)({
234
+ queryKey: settingsQueryKey(),
235
+ queryFn: () => getSettings()
236
+ });
237
+ }
238
+
421
239
  // src/hooks/use-posts.ts
240
+ var import_query2 = require("@elementor/query");
422
241
  var postsQueryKey = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
423
242
  var flattenData = (data) => {
424
243
  if (!data) {
@@ -431,9 +250,9 @@ var flattenData = (data) => {
431
250
  return flattened;
432
251
  };
433
252
  function usePosts(postTypeSlug) {
434
- const query = (0, import_query3.useInfiniteQuery)({
253
+ const query = (0, import_query2.useInfiniteQuery)({
435
254
  queryKey: postsQueryKey(postTypeSlug),
436
- queryFn: ({ pageParam = 1 }) => getRequest2(postTypeSlug, pageParam),
255
+ queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam),
437
256
  initialPageParam: 1,
438
257
  getNextPageParam: (lastPage) => {
439
258
  return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
@@ -442,54 +261,64 @@ function usePosts(postTypeSlug) {
442
261
  return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
443
262
  }
444
263
 
445
- // src/contexts/post-list-context.tsx
446
- var React6 = __toESM(require("react"));
447
- var import_react3 = require("react");
448
- var defaultValues = {
449
- type: "page",
450
- editMode: { mode: "none", details: {} },
451
- setEditMode: () => null,
452
- resetEditMode: () => null,
453
- setError: () => null
454
- };
455
- var PostListContext = (0, import_react3.createContext)(defaultValues);
456
- var PostListContextProvider = ({
457
- type,
458
- setError,
459
- children
460
- }) => {
461
- const [editMode, setEditMode] = (0, import_react3.useState)(defaultValues.editMode);
462
- const resetEditMode = () => {
463
- setEditMode(defaultValues.editMode);
464
- };
465
- return /* @__PURE__ */ React6.createElement(
466
- PostListContext.Provider,
264
+ // src/components/panel/add-new-button.tsx
265
+ var React3 = __toESM(require("react"));
266
+ var import_icons2 = require("@elementor/icons");
267
+ var import_ui2 = require("@elementor/ui");
268
+ var import_i18n2 = require("@wordpress/i18n");
269
+
270
+ // src/hooks/use-user.ts
271
+ var import_query3 = require("@elementor/query");
272
+
273
+ // src/api/user.ts
274
+ var import_api_fetch3 = __toESM(require("@wordpress/api-fetch"));
275
+ var getUser = () => {
276
+ const baseUri = "/wp/v2/users/me";
277
+ const keys = ["capabilities"];
278
+ const queryParams = new URLSearchParams({
279
+ _fields: keys.join(","),
280
+ context: "edit"
281
+ });
282
+ const uri = baseUri + "?" + queryParams.toString();
283
+ return (0, import_api_fetch3.default)({ path: uri });
284
+ };
285
+
286
+ // src/hooks/use-user.ts
287
+ var userQueryKey = () => ["site-navigation", "user"];
288
+ function useUser() {
289
+ return (0, import_query3.useQuery)({
290
+ queryKey: userQueryKey(),
291
+ queryFn: () => getUser()
292
+ });
293
+ }
294
+
295
+ // src/components/panel/add-new-button.tsx
296
+ function AddNewButton() {
297
+ const { setEditMode } = usePostListContext();
298
+ const { data: user } = useUser();
299
+ return /* @__PURE__ */ React3.createElement(
300
+ import_ui2.Button,
467
301
  {
468
- value: {
469
- type,
470
- editMode,
471
- setEditMode,
472
- resetEditMode,
473
- setError
302
+ size: "small",
303
+ startIcon: /* @__PURE__ */ React3.createElement(import_icons2.PlusIcon, null),
304
+ disabled: !user?.capabilities?.edit_pages,
305
+ onClick: () => {
306
+ setEditMode({ mode: "create", details: {} });
307
+ },
308
+ sx: {
309
+ px: 1.5
474
310
  }
475
311
  },
476
- children
312
+ (0, import_i18n2.__)("Add New", "elementor")
477
313
  );
478
- };
479
- function usePostListContext() {
480
- const context = (0, import_react3.useContext)(PostListContext);
481
- if (!context) {
482
- throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
483
- }
484
- return context;
485
314
  }
486
315
 
487
316
  // src/components/panel/posts-list/collapsible-list.tsx
488
- var React7 = __toESM(require("react"));
489
- var import_react4 = require("react");
490
- var import_ui6 = require("@elementor/ui");
491
- var import_icons5 = require("@elementor/icons");
492
- var RotateIcon = (0, import_ui6.styled)(import_icons5.ChevronDownIcon, {
317
+ var React4 = __toESM(require("react"));
318
+ var import_react2 = require("react");
319
+ var import_icons3 = require("@elementor/icons");
320
+ var import_ui3 = require("@elementor/ui");
321
+ var RotateIcon = (0, import_ui3.styled)(import_icons3.ChevronDownIcon, {
493
322
  shouldForwardProp: (prop) => prop !== "isOpen"
494
323
  })(({ theme, isOpen }) => ({
495
324
  transform: isOpen ? "rotate(0deg)" : "rotate(-90deg)",
@@ -497,7 +326,7 @@ var RotateIcon = (0, import_ui6.styled)(import_icons5.ChevronDownIcon, {
497
326
  duration: theme.transitions.duration.standard
498
327
  })
499
328
  }));
500
- var StyledListItemIcon = (0, import_ui6.styled)(import_ui6.ListItemIcon)(({ theme }) => ({
329
+ var StyledListItemIcon = (0, import_ui3.styled)(import_ui3.ListItemIcon)(({ theme }) => ({
501
330
  minWidth: theme.spacing(4)
502
331
  }));
503
332
  function CollapsibleList({
@@ -506,16 +335,16 @@ function CollapsibleList({
506
335
  isOpenByDefault = false,
507
336
  children
508
337
  }) {
509
- const [isOpen, setIsOpen] = (0, import_react4.useState)(isOpenByDefault);
510
- return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui6.ListItem, null, /* @__PURE__ */ React7.createElement(
338
+ const [isOpen, setIsOpen] = (0, import_react2.useState)(isOpenByDefault);
339
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(import_ui3.ListItem, null, /* @__PURE__ */ React4.createElement(
511
340
  StyledListItemIcon,
512
341
  {
513
342
  sx: {
514
343
  color: "text.secondary"
515
344
  }
516
345
  },
517
- /* @__PURE__ */ React7.createElement(
518
- import_ui6.IconButton,
346
+ /* @__PURE__ */ React4.createElement(
347
+ import_ui3.IconButton,
519
348
  {
520
349
  onClick: () => setIsOpen((prev) => !prev),
521
350
  size: "small",
@@ -523,9 +352,9 @@ function CollapsibleList({
523
352
  color: "inherit"
524
353
  }
525
354
  },
526
- /* @__PURE__ */ React7.createElement(RotateIcon, { fontSize: "small", isOpen })
355
+ /* @__PURE__ */ React4.createElement(RotateIcon, { fontSize: "small", isOpen })
527
356
  )
528
- ), /* @__PURE__ */ React7.createElement(
357
+ ), /* @__PURE__ */ React4.createElement(
529
358
  StyledListItemIcon,
530
359
  {
531
360
  size: "small",
@@ -533,40 +362,104 @@ function CollapsibleList({
533
362
  color: "inherit"
534
363
  }
535
364
  },
536
- /* @__PURE__ */ React7.createElement(Icon, { fontSize: "small" })
537
- ), /* @__PURE__ */ React7.createElement(
538
- import_ui6.ListItemText,
365
+ /* @__PURE__ */ React4.createElement(Icon, { fontSize: "small" })
366
+ ), /* @__PURE__ */ React4.createElement(
367
+ import_ui3.ListItemText,
539
368
  {
540
369
  primaryTypographyProps: { variant: "subtitle2", component: "span" },
541
370
  primary: label
542
371
  }
543
- )), /* @__PURE__ */ React7.createElement(import_ui6.Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React7.createElement(import_ui6.List, { dense: true }, children)), /* @__PURE__ */ React7.createElement(import_ui6.Divider, { sx: { mt: 1 } }));
372
+ )), /* @__PURE__ */ React4.createElement(import_ui3.Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React4.createElement(import_ui3.List, { dense: true }, children)), /* @__PURE__ */ React4.createElement(import_ui3.Divider, { sx: { mt: 1 } }));
373
+ }
374
+
375
+ // src/components/panel/posts-list/error-state.tsx
376
+ var React5 = __toESM(require("react"));
377
+ var import_icons4 = require("@elementor/icons");
378
+ var import_ui4 = require("@elementor/ui");
379
+ var import_i18n3 = require("@wordpress/i18n");
380
+ function ErrorState() {
381
+ return /* @__PURE__ */ React5.createElement(
382
+ import_ui4.Box,
383
+ {
384
+ sx: {
385
+ display: "flex",
386
+ flexDirection: "column",
387
+ justifyContent: "center",
388
+ alignItems: "center",
389
+ pt: "40px",
390
+ gap: "16px"
391
+ }
392
+ },
393
+ /* @__PURE__ */ React5.createElement(import_icons4.Error404TemplateIcon, null),
394
+ /* @__PURE__ */ React5.createElement(
395
+ import_ui4.Box,
396
+ {
397
+ sx: {
398
+ display: "flex",
399
+ flexDirection: "column",
400
+ justifyContent: "center",
401
+ alignItems: "center",
402
+ gap: "8px"
403
+ }
404
+ },
405
+ /* @__PURE__ */ React5.createElement(import_ui4.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n3.__)("We couldn\u2019t display your pages.", "elementor")),
406
+ /* @__PURE__ */ React5.createElement(import_ui4.Box, null, /* @__PURE__ */ React5.createElement(import_ui4.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n3.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React5.createElement(import_ui4.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n3.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React5.createElement(import_ui4.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
407
+ )
408
+ );
544
409
  }
545
410
 
546
411
  // src/components/panel/posts-list/post-list-item.tsx
547
- var React20 = __toESM(require("react"));
412
+ var React18 = __toESM(require("react"));
548
413
 
549
- // src/components/panel/posts-list/list-items/list-item-rename.tsx
550
- var React9 = __toESM(require("react"));
414
+ // src/components/panel/posts-list/list-items/list-item-create.tsx
415
+ var React7 = __toESM(require("react"));
416
+ var import_editor_documents = require("@elementor/editor-documents");
417
+ var import_i18n5 = require("@wordpress/i18n");
551
418
 
552
419
  // src/hooks/use-posts-actions.ts
420
+ var import_query5 = require("@elementor/query");
421
+
422
+ // src/hooks/use-recent-posts.ts
553
423
  var import_query4 = require("@elementor/query");
424
+
425
+ // src/api/recent-posts.ts
426
+ var import_api_fetch4 = __toESM(require("@wordpress/api-fetch"));
427
+ var baseUrl = "/elementor/v1/site-navigation/recent-posts";
428
+ var NUMBER_OF_RECENT_POSTS = 6;
429
+ var getRequest2 = () => {
430
+ const queryParams = new URLSearchParams({
431
+ posts_per_page: `${NUMBER_OF_RECENT_POSTS}`
432
+ });
433
+ const path = `${baseUrl}?${queryParams.toString()}`;
434
+ return (0, import_api_fetch4.default)({ path });
435
+ };
436
+
437
+ // src/hooks/use-recent-posts.ts
438
+ var recentPostsQueryKey = ["site-navigation", "recent-posts"];
439
+ function useRecentPosts() {
440
+ return (0, import_query4.useQuery)({
441
+ queryKey: recentPostsQueryKey,
442
+ queryFn: () => getRequest2()
443
+ });
444
+ }
445
+
446
+ // src/hooks/use-posts-actions.ts
554
447
  function usePostActions(postTypeSlug) {
555
448
  const invalidatePosts = useInvalidatePosts(postTypeSlug);
556
449
  const onSuccess = () => invalidatePosts({ exact: true });
557
- const createPost = (0, import_query4.useMutation)({
450
+ const createPost = (0, import_query5.useMutation)({
558
451
  mutationFn: (newPost) => createRequest(postTypeSlug, newPost),
559
452
  onSuccess
560
453
  });
561
- const updatePost = (0, import_query4.useMutation)({
454
+ const updatePost = (0, import_query5.useMutation)({
562
455
  mutationFn: (updatedPost) => updateRequest(postTypeSlug, updatedPost),
563
456
  onSuccess
564
457
  });
565
- const deletePost = (0, import_query4.useMutation)({
458
+ const deletePost = (0, import_query5.useMutation)({
566
459
  mutationFn: (postId) => deleteRequest(postTypeSlug, postId),
567
460
  onSuccess
568
461
  });
569
- const duplicatePost = (0, import_query4.useMutation)({
462
+ const duplicatePost = (0, import_query5.useMutation)({
570
463
  mutationFn: (originalPost) => duplicateRequest(originalPost),
571
464
  onSuccess
572
465
  });
@@ -578,7 +471,7 @@ function usePostActions(postTypeSlug) {
578
471
  };
579
472
  }
580
473
  function useInvalidatePosts(postTypeSlug) {
581
- const queryClient = (0, import_query4.useQueryClient)();
474
+ const queryClient = (0, import_query5.useQueryClient)();
582
475
  return (options = {}) => {
583
476
  const queryKey = postsQueryKey(postTypeSlug);
584
477
  queryClient.invalidateQueries({ queryKey: recentPostsQueryKey }, options);
@@ -587,16 +480,16 @@ function useInvalidatePosts(postTypeSlug) {
587
480
  }
588
481
 
589
482
  // src/components/panel/posts-list/list-items/edit-mode-template.tsx
590
- var React8 = __toESM(require("react"));
591
- var import_react5 = require("react");
592
- var import_ui7 = require("@elementor/ui");
593
- var import_icons6 = require("@elementor/icons");
483
+ var React6 = __toESM(require("react"));
484
+ var import_react3 = require("react");
485
+ var import_icons5 = require("@elementor/icons");
486
+ var import_ui5 = require("@elementor/ui");
594
487
  var import_i18n4 = require("@wordpress/i18n");
595
488
  function EditModeTemplate({ postTitle, isLoading, callback }) {
596
- const [title, setTitle] = (0, import_react5.useState)(postTitle);
597
- const [touched, setTouched] = (0, import_react5.useState)(false);
598
- const [inputError, setInputError] = (0, import_react5.useState)(null);
599
- const closeButton = (0, import_react5.useRef)();
489
+ const [title, setTitle] = (0, import_react3.useState)(postTitle);
490
+ const [touched, setTouched] = (0, import_react3.useState)(false);
491
+ const [inputError, setInputError] = (0, import_react3.useState)(null);
492
+ const closeButton = (0, import_react3.useRef)();
600
493
  const onBlur = (e) => {
601
494
  if (closeButton.current === e.relatedTarget) {
602
495
  return;
@@ -628,8 +521,8 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
628
521
  }
629
522
  setTitle(value);
630
523
  };
631
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(import_ui7.ListItem, { secondaryAction: /* @__PURE__ */ React8.createElement(CloseButton, { isLoading, closeButton }) }, /* @__PURE__ */ React8.createElement(import_ui7.Box, { width: "100%", component: "form", onSubmit: onFormSubmit }, /* @__PURE__ */ React8.createElement(
632
- import_ui7.TextField,
524
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(import_ui5.ListItem, { secondaryAction: /* @__PURE__ */ React6.createElement(CloseButton, { isLoading, closeButton }) }, /* @__PURE__ */ React6.createElement(import_ui5.Box, { width: "100%", component: "form", onSubmit: onFormSubmit }, /* @__PURE__ */ React6.createElement(
525
+ import_ui5.TextField,
633
526
  {
634
527
  autoFocus: true,
635
528
  fullWidth: true,
@@ -642,75 +535,18 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
642
535
  color: "secondary",
643
536
  size: "small"
644
537
  }
645
- ))), inputError && /* @__PURE__ */ React8.createElement(import_ui7.ListItem, null, /* @__PURE__ */ React8.createElement(import_ui7.ListItemText, { sx: { color: "error.main" } }, inputError)));
538
+ ))), inputError && /* @__PURE__ */ React6.createElement(import_ui5.ListItem, null, /* @__PURE__ */ React6.createElement(import_ui5.ListItemText, { sx: { color: "error.main" } }, inputError)));
646
539
  }
647
540
  function CloseButton({ isLoading, closeButton }) {
648
541
  const { resetEditMode } = usePostListContext();
649
- return /* @__PURE__ */ React8.createElement(import_ui7.IconButton, { size: "small", color: "secondary", onClick: resetEditMode, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React8.createElement(import_ui7.CircularProgress, null) : /* @__PURE__ */ React8.createElement(import_icons6.XIcon, { fontSize: "small" }));
650
- }
651
-
652
- // src/components/panel/posts-list/list-items/list-item-rename.tsx
653
- var import_editor_documents4 = require("@elementor/editor-documents");
654
-
655
- // src/hooks/use-rename-active-document.ts
656
- var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
657
- function getV1DocumentsManager() {
658
- const documentsManager = window.elementor?.documents;
659
- if (!documentsManager) {
660
- throw new Error("Elementor Editor V1 documents manager not found");
661
- }
662
- return documentsManager;
663
- }
664
- function useRenameActiveDocument() {
665
- return async (title) => {
666
- const currentDocument = getV1DocumentsManager().getCurrent();
667
- const container = currentDocument.container;
668
- await (0, import_editor_v1_adapters.__privateRunCommand)("document/elements/settings", {
669
- container,
670
- settings: { post_title: title }
671
- });
672
- };
673
- }
674
-
675
- // src/components/panel/posts-list/list-items/list-item-rename.tsx
676
- function ListItemRename({ post }) {
677
- const { type, resetEditMode } = usePostListContext();
678
- const { updatePost } = usePostActions(type);
679
- const { setError } = usePostListContext();
680
- const activeDocument = (0, import_editor_documents4.__useActiveDocument)();
681
- const rename = useRenameActiveDocument();
682
- const isActive = activeDocument?.id === post.id;
683
- const title = isActive ? activeDocument?.title : post.title.rendered;
684
- const renamePostCallback = async (inputValue) => {
685
- if (inputValue === title) {
686
- resetEditMode();
687
- }
688
- try {
689
- if (isActive) {
690
- await rename(inputValue);
691
- } else {
692
- await updatePost.mutateAsync({
693
- id: post.id,
694
- title: inputValue
695
- });
696
- }
697
- } catch {
698
- setError();
699
- } finally {
700
- resetEditMode();
701
- }
702
- };
703
- return /* @__PURE__ */ React9.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
542
+ return /* @__PURE__ */ React6.createElement(import_ui5.IconButton, { size: "small", color: "secondary", onClick: resetEditMode, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React6.createElement(import_ui5.CircularProgress, null) : /* @__PURE__ */ React6.createElement(import_icons5.XIcon, { fontSize: "small" }));
704
543
  }
705
544
 
706
545
  // src/components/panel/posts-list/list-items/list-item-create.tsx
707
- var React10 = __toESM(require("react"));
708
- var import_i18n5 = require("@wordpress/i18n");
709
- var import_editor_documents5 = require("@elementor/editor-documents");
710
546
  function ListItemCreate() {
711
547
  const { type, resetEditMode } = usePostListContext();
712
548
  const { createPost } = usePostActions(type);
713
- const navigateToDocument = (0, import_editor_documents5.__useNavigateToDocument)();
549
+ const navigateToDocument = (0, import_editor_documents.__useNavigateToDocument)();
714
550
  const { setError } = usePostListContext();
715
551
  const createPostCallback = async (inputValue) => {
716
552
  try {
@@ -725,7 +561,7 @@ function ListItemCreate() {
725
561
  resetEditMode();
726
562
  }
727
563
  };
728
- return /* @__PURE__ */ React10.createElement(
564
+ return /* @__PURE__ */ React7.createElement(
729
565
  EditModeTemplate,
730
566
  {
731
567
  postTitle: (0, import_i18n5.__)("New Page", "elementor"),
@@ -736,12 +572,12 @@ function ListItemCreate() {
736
572
  }
737
573
 
738
574
  // src/components/panel/posts-list/list-items/list-item-duplicate.tsx
739
- var React11 = __toESM(require("react"));
575
+ var React8 = __toESM(require("react"));
576
+ var import_editor_documents2 = require("@elementor/editor-documents");
740
577
  var import_i18n6 = require("@wordpress/i18n");
741
- var import_editor_documents6 = require("@elementor/editor-documents");
742
578
  function ListItemDuplicate() {
743
579
  const { type, editMode, resetEditMode } = usePostListContext();
744
- const navigateToDocument = (0, import_editor_documents6.__useNavigateToDocument)();
580
+ const navigateToDocument = (0, import_editor_documents2.__useNavigateToDocument)();
745
581
  const { duplicatePost } = usePostActions(type);
746
582
  const { setError } = usePostListContext();
747
583
  if ("duplicate" !== editMode.mode) {
@@ -760,7 +596,7 @@ function ListItemDuplicate() {
760
596
  resetEditMode();
761
597
  }
762
598
  };
763
- return /* @__PURE__ */ React11.createElement(
599
+ return /* @__PURE__ */ React8.createElement(
764
600
  EditModeTemplate,
765
601
  {
766
602
  postTitle: `${editMode.details.title} ${(0, import_i18n6.__)("copy", "elementor")}`,
@@ -770,21 +606,91 @@ function ListItemDuplicate() {
770
606
  );
771
607
  }
772
608
 
773
- // src/components/panel/posts-list/list-items/list-item-view.tsx
774
- var React19 = __toESM(require("react"));
775
- var import_ui12 = require("@elementor/ui");
776
- var import_icons12 = require("@elementor/icons");
777
- var import_editor_documents8 = require("@elementor/editor-documents");
778
-
609
+ // src/components/panel/posts-list/list-items/list-item-rename.tsx
610
+ var React9 = __toESM(require("react"));
611
+ var import_editor_documents3 = require("@elementor/editor-documents");
612
+
613
+ // src/hooks/use-rename-active-document.ts
614
+ var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
615
+ function getV1DocumentsManager() {
616
+ const documentsManager = window.elementor?.documents;
617
+ if (!documentsManager) {
618
+ throw new Error("Elementor Editor V1 documents manager not found");
619
+ }
620
+ return documentsManager;
621
+ }
622
+ function useRenameActiveDocument() {
623
+ return async (title) => {
624
+ const currentDocument = getV1DocumentsManager().getCurrent();
625
+ const container = currentDocument.container;
626
+ await (0, import_editor_v1_adapters.__privateRunCommand)("document/elements/settings", {
627
+ container,
628
+ settings: { post_title: title }
629
+ });
630
+ };
631
+ }
632
+
633
+ // src/components/panel/posts-list/list-items/list-item-rename.tsx
634
+ function ListItemRename({ post }) {
635
+ const { type, resetEditMode } = usePostListContext();
636
+ const { updatePost } = usePostActions(type);
637
+ const { setError } = usePostListContext();
638
+ const activeDocument = (0, import_editor_documents3.__useActiveDocument)();
639
+ const rename = useRenameActiveDocument();
640
+ const isActive = activeDocument?.id === post.id;
641
+ const title = isActive ? activeDocument?.title : post.title.rendered;
642
+ const renamePostCallback = async (inputValue) => {
643
+ if (inputValue === title) {
644
+ resetEditMode();
645
+ }
646
+ try {
647
+ if (isActive) {
648
+ await rename(inputValue);
649
+ } else {
650
+ await updatePost.mutateAsync({
651
+ id: post.id,
652
+ title: inputValue
653
+ });
654
+ }
655
+ } catch {
656
+ setError();
657
+ } finally {
658
+ resetEditMode();
659
+ }
660
+ };
661
+ return /* @__PURE__ */ React9.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
662
+ }
663
+
664
+ // src/components/panel/posts-list/list-items/list-item-view.tsx
665
+ var React17 = __toESM(require("react"));
666
+ var import_editor_documents5 = require("@elementor/editor-documents");
667
+ var import_icons11 = require("@elementor/icons");
668
+ var import_ui10 = require("@elementor/ui");
669
+ var import_i18n12 = require("@wordpress/i18n");
670
+
671
+ // src/components/shared/page-title-and-status.tsx
672
+ var React10 = __toESM(require("react"));
673
+ var import_ui6 = require("@elementor/ui");
674
+
675
+ // src/hooks/use-reverse-html-entities.ts
676
+ var import_react4 = require("react");
677
+ function useReverseHtmlEntities(escapedHTML = "") {
678
+ return (0, import_react4.useMemo)(() => {
679
+ const textarea = document.createElement("textarea");
680
+ textarea.innerHTML = escapedHTML;
681
+ const { value } = textarea;
682
+ textarea.remove();
683
+ return value;
684
+ }, [escapedHTML]);
685
+ }
686
+
779
687
  // src/components/shared/page-title-and-status.tsx
780
- var React12 = __toESM(require("react"));
781
- var import_ui8 = require("@elementor/ui");
782
688
  var PageStatus = ({ status }) => {
783
689
  if ("publish" === status) {
784
690
  return null;
785
691
  }
786
- return /* @__PURE__ */ React12.createElement(
787
- import_ui8.Typography,
692
+ return /* @__PURE__ */ React10.createElement(
693
+ import_ui6.Typography,
788
694
  {
789
695
  component: "span",
790
696
  variant: "body2",
@@ -803,8 +709,8 @@ var PageStatus = ({ status }) => {
803
709
  };
804
710
  var PageTitle = ({ title }) => {
805
711
  const modifiedTitle = useReverseHtmlEntities(title);
806
- return /* @__PURE__ */ React12.createElement(
807
- import_ui8.Typography,
712
+ return /* @__PURE__ */ React10.createElement(
713
+ import_ui6.Typography,
808
714
  {
809
715
  component: "span",
810
716
  variant: "body2",
@@ -818,108 +724,51 @@ var PageTitle = ({ title }) => {
818
724
  );
819
725
  };
820
726
  function PageTitleAndStatus({ title, status }) {
821
- return /* @__PURE__ */ React12.createElement(import_ui8.Box, { display: "flex" }, /* @__PURE__ */ React12.createElement(PageTitle, { title }), "\xA0", /* @__PURE__ */ React12.createElement(PageStatus, { status }));
727
+ return /* @__PURE__ */ React10.createElement(import_ui6.Box, { display: "flex" }, /* @__PURE__ */ React10.createElement(PageTitle, { title }), "\xA0", /* @__PURE__ */ React10.createElement(PageStatus, { status }));
822
728
  }
823
729
 
824
- // src/components/panel/actions-menu/actions/rename.tsx
825
- var React14 = __toESM(require("react"));
826
- var import_icons7 = require("@elementor/icons");
730
+ // src/components/panel/actions-menu/actions/delete.tsx
731
+ var React12 = __toESM(require("react"));
732
+ var import_react5 = require("react");
733
+ var import_editor_documents4 = require("@elementor/editor-documents");
734
+ var import_icons6 = require("@elementor/icons");
735
+ var import_ui8 = require("@elementor/ui");
827
736
  var import_i18n7 = require("@wordpress/i18n");
828
737
 
829
738
  // src/components/panel/actions-menu/action-menu-item.tsx
830
- var React13 = __toESM(require("react"));
831
- var import_ui9 = require("@elementor/ui");
832
- function ActionMenuItem({ title, icon: Icon, MenuItemProps: MenuItemProps3 }) {
833
- return /* @__PURE__ */ React13.createElement(import_ui9.MenuItem, { ...MenuItemProps3 }, /* @__PURE__ */ React13.createElement(
834
- import_ui9.ListItemIcon,
739
+ var React11 = __toESM(require("react"));
740
+ var import_ui7 = require("@elementor/ui");
741
+ function ActionMenuItem({ title, icon: Icon, MenuItemProps }) {
742
+ return /* @__PURE__ */ React11.createElement(import_ui7.MenuItem, { ...MenuItemProps }, /* @__PURE__ */ React11.createElement(
743
+ import_ui7.ListItemIcon,
835
744
  {
836
745
  sx: {
837
746
  color: "inherit"
838
747
  }
839
748
  },
840
- /* @__PURE__ */ React13.createElement(Icon, null)
841
- ), /* @__PURE__ */ React13.createElement(import_ui9.ListItemText, { primary: title }));
842
- }
843
-
844
- // src/components/panel/actions-menu/actions/rename.tsx
845
- function Rename({ post }) {
846
- const { setEditMode } = usePostListContext();
847
- return /* @__PURE__ */ React14.createElement(
848
- ActionMenuItem,
849
- {
850
- title: (0, import_i18n7.__)("Rename", "elementor"),
851
- icon: import_icons7.EraseIcon,
852
- MenuItemProps: {
853
- disabled: !post.user_can.edit,
854
- onClick: () => {
855
- setEditMode({
856
- mode: "rename",
857
- details: {
858
- postId: post.id
859
- }
860
- });
861
- }
862
- }
863
- }
864
- );
865
- }
866
-
867
- // src/components/panel/actions-menu/actions/duplicate.tsx
868
- var React15 = __toESM(require("react"));
869
- var import_icons8 = require("@elementor/icons");
870
- var import_i18n8 = require("@wordpress/i18n");
871
- function Duplicate({ post, popupState }) {
872
- const { setEditMode } = usePostListContext();
873
- const { data: user } = useUser();
874
- const onClick = () => {
875
- popupState.close();
876
- setEditMode({
877
- mode: "duplicate",
878
- details: {
879
- postId: post.id,
880
- title: post.title.rendered
881
- }
882
- });
883
- };
884
- const isDisabled = !user?.capabilities?.edit_pages;
885
- return /* @__PURE__ */ React15.createElement(
886
- ActionMenuItem,
887
- {
888
- title: (0, import_i18n8.__)("Duplicate", "elementor"),
889
- icon: import_icons8.CopyIcon,
890
- MenuItemProps: {
891
- disabled: isDisabled,
892
- onClick
893
- }
894
- }
895
- );
749
+ /* @__PURE__ */ React11.createElement(Icon, null)
750
+ ), /* @__PURE__ */ React11.createElement(import_ui7.ListItemText, { primary: title }));
896
751
  }
897
752
 
898
753
  // src/components/panel/actions-menu/actions/delete.tsx
899
- var React16 = __toESM(require("react"));
900
- var import_icons9 = require("@elementor/icons");
901
- var import_i18n9 = require("@wordpress/i18n");
902
- var import_ui10 = require("@elementor/ui");
903
- var import_react6 = require("react");
904
- var import_editor_documents7 = require("@elementor/editor-documents");
905
754
  function Delete({ post }) {
906
- const [isDialogOpen, setIsDialogOpen] = (0, import_react6.useState)(false);
907
- const activeDocument = (0, import_editor_documents7.__useActiveDocument)();
755
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react5.useState)(false);
756
+ const activeDocument = (0, import_editor_documents4.__useActiveDocument)();
908
757
  const isPostActive = activeDocument?.id === post.id;
909
758
  const userCanDelete = post.user_can.delete;
910
759
  const isDisabled = !userCanDelete || post.isHome || isPostActive;
911
- return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
760
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
912
761
  ActionMenuItem,
913
762
  {
914
- title: (0, import_i18n9.__)("Delete", "elementor"),
915
- icon: import_icons9.TrashIcon,
763
+ title: (0, import_i18n7.__)("Delete", "elementor"),
764
+ icon: import_icons6.TrashIcon,
916
765
  MenuItemProps: {
917
766
  disabled: isDisabled,
918
767
  onClick: () => setIsDialogOpen(true),
919
768
  sx: { "&:hover": { color: "error.main" } }
920
769
  }
921
770
  }
922
- ), isDialogOpen && /* @__PURE__ */ React16.createElement(DeleteDialog, { post, setIsDialogOpen }));
771
+ ), isDialogOpen && /* @__PURE__ */ React12.createElement(DeleteDialog, { post, setIsDialogOpen }));
923
772
  }
924
773
  function DeleteDialog({
925
774
  post,
@@ -928,7 +777,7 @@ function DeleteDialog({
928
777
  const { type } = usePostListContext();
929
778
  const { deletePost } = usePostActions(type);
930
779
  const { setError } = usePostListContext();
931
- const dialogTitle = (0, import_i18n9.sprintf)((0, import_i18n9.__)('Delete "%s"?', "elementor"), post.title.rendered);
780
+ const dialogTitle = (0, import_i18n7.sprintf)((0, import_i18n7.__)('Delete "%s"?', "elementor"), post.title.rendered);
932
781
  const deletePage = async () => {
933
782
  try {
934
783
  await deletePost.mutateAsync(post.id);
@@ -943,74 +792,86 @@ function DeleteDialog({
943
792
  }
944
793
  setIsDialogOpen(false);
945
794
  };
946
- return /* @__PURE__ */ React16.createElement(import_ui10.Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React16.createElement(import_ui10.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React16.createElement(import_ui10.Divider, null), /* @__PURE__ */ React16.createElement(import_ui10.DialogContent, null, /* @__PURE__ */ React16.createElement(import_ui10.DialogContentText, null, (0, import_i18n9.__)(
795
+ return /* @__PURE__ */ React12.createElement(import_ui8.Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React12.createElement(import_ui8.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React12.createElement(import_ui8.Divider, null), /* @__PURE__ */ React12.createElement(import_ui8.DialogContent, null, /* @__PURE__ */ React12.createElement(import_ui8.DialogContentText, null, (0, import_i18n7.__)(
947
796
  "The page and its content will be deleted forever and we won\u2019t be able to recover them.",
948
797
  "elementor"
949
- ))), /* @__PURE__ */ React16.createElement(import_ui10.DialogActions, null, /* @__PURE__ */ React16.createElement(
950
- import_ui10.Button,
798
+ ))), /* @__PURE__ */ React12.createElement(import_ui8.DialogActions, null, /* @__PURE__ */ React12.createElement(
799
+ import_ui8.Button,
951
800
  {
952
801
  variant: "contained",
953
802
  color: "secondary",
954
803
  onClick: handleCancel,
955
804
  disabled: deletePost.isPending
956
805
  },
957
- (0, import_i18n9.__)("Cancel", "elementor")
958
- ), /* @__PURE__ */ React16.createElement(import_ui10.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n9.__)("Delete", "elementor") : /* @__PURE__ */ React16.createElement(import_ui10.CircularProgress, null))));
806
+ (0, import_i18n7.__)("Cancel", "elementor")
807
+ ), /* @__PURE__ */ React12.createElement(import_ui8.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n7.__)("Delete", "elementor") : /* @__PURE__ */ React12.createElement(import_ui8.CircularProgress, null))));
959
808
  }
960
809
 
961
- // src/components/panel/actions-menu/actions/view.tsx
962
- var React17 = __toESM(require("react"));
963
- var import_icons10 = require("@elementor/icons");
964
- var import_i18n10 = require("@wordpress/i18n");
965
- function View({ post }) {
966
- const { type } = usePostListContext();
967
- const title = (0, import_i18n10.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
968
- return /* @__PURE__ */ React17.createElement(
810
+ // src/components/panel/actions-menu/actions/duplicate.tsx
811
+ var React13 = __toESM(require("react"));
812
+ var import_icons7 = require("@elementor/icons");
813
+ var import_i18n8 = require("@wordpress/i18n");
814
+ function Duplicate({ post, popupState }) {
815
+ const { setEditMode } = usePostListContext();
816
+ const { data: user } = useUser();
817
+ const onClick = () => {
818
+ popupState.close();
819
+ setEditMode({
820
+ mode: "duplicate",
821
+ details: {
822
+ postId: post.id,
823
+ title: post.title.rendered
824
+ }
825
+ });
826
+ };
827
+ const isDisabled = !user?.capabilities?.edit_pages;
828
+ return /* @__PURE__ */ React13.createElement(
969
829
  ActionMenuItem,
970
830
  {
971
- title,
972
- icon: import_icons10.EyeIcon,
831
+ title: (0, import_i18n8.__)("Duplicate", "elementor"),
832
+ icon: import_icons7.CopyIcon,
973
833
  MenuItemProps: {
974
- onClick: () => window.open(post.link, "_blank")
834
+ disabled: isDisabled,
835
+ onClick
836
+ }
837
+ }
838
+ );
839
+ }
840
+
841
+ // src/components/panel/actions-menu/actions/rename.tsx
842
+ var React14 = __toESM(require("react"));
843
+ var import_icons8 = require("@elementor/icons");
844
+ var import_i18n9 = require("@wordpress/i18n");
845
+ function Rename({ post }) {
846
+ const { setEditMode } = usePostListContext();
847
+ return /* @__PURE__ */ React14.createElement(
848
+ ActionMenuItem,
849
+ {
850
+ title: (0, import_i18n9.__)("Rename", "elementor"),
851
+ icon: import_icons8.EraseIcon,
852
+ MenuItemProps: {
853
+ disabled: !post.user_can.edit,
854
+ onClick: () => {
855
+ setEditMode({
856
+ mode: "rename",
857
+ details: {
858
+ postId: post.id
859
+ }
860
+ });
861
+ }
975
862
  }
976
863
  }
977
864
  );
978
865
  }
979
866
 
980
867
  // src/components/panel/actions-menu/actions/set-home.tsx
981
- var React18 = __toESM(require("react"));
982
- var import_icons11 = require("@elementor/icons");
983
- var import_i18n11 = require("@wordpress/i18n");
868
+ var React15 = __toESM(require("react"));
869
+ var import_icons9 = require("@elementor/icons");
870
+ var import_ui9 = require("@elementor/ui");
871
+ var import_i18n10 = require("@wordpress/i18n");
984
872
 
985
873
  // src/hooks/use-homepage-actions.ts
986
874
  var import_query6 = require("@elementor/query");
987
-
988
- // src/api/settings.ts
989
- var import_api_fetch5 = __toESM(require("@wordpress/api-fetch"));
990
- var getSettings = () => {
991
- const baseUri = "/elementor/v1/site-navigation/homepage";
992
- const uri = baseUri;
993
- return (0, import_api_fetch5.default)({ path: uri });
994
- };
995
- var updateSettings = (settings) => {
996
- return (0, import_api_fetch5.default)({
997
- path: "/wp/v2/settings",
998
- method: "POST",
999
- data: settings
1000
- });
1001
- };
1002
-
1003
- // src/hooks/use-homepage.ts
1004
- var import_query5 = require("@elementor/query");
1005
- var settingsQueryKey = () => ["site-navigation", "homepage"];
1006
- function useHomepage() {
1007
- return (0, import_query5.useQuery)({
1008
- queryKey: settingsQueryKey(),
1009
- queryFn: () => getSettings()
1010
- });
1011
- }
1012
-
1013
- // src/hooks/use-homepage-actions.ts
1014
875
  function useHomepageActions() {
1015
876
  const invalidateSettings = useInvalidateSettings();
1016
877
  const onSuccess = async () => invalidateSettings({ exact: true });
@@ -1029,7 +890,6 @@ function useInvalidateSettings() {
1029
890
  }
1030
891
 
1031
892
  // src/components/panel/actions-menu/actions/set-home.tsx
1032
- var import_ui11 = require("@elementor/ui");
1033
893
  function SetHome({ post, closeMenu }) {
1034
894
  const { updateSettingsMutation } = useHomepageActions();
1035
895
  const { setError } = usePostListContext();
@@ -1047,11 +907,11 @@ function SetHome({ post, closeMenu }) {
1047
907
  const isPostPublished = post.status === "publish";
1048
908
  const isPostHomepage = !!post.isHome;
1049
909
  const isDisabled = !canManageOptions || isPostHomepage || !isPostPublished || updateSettingsMutation.isPending;
1050
- return /* @__PURE__ */ React18.createElement(
910
+ return /* @__PURE__ */ React15.createElement(
1051
911
  ActionMenuItem,
1052
912
  {
1053
- title: (0, import_i18n11.__)("Set as homepage", "elementor"),
1054
- icon: !updateSettingsMutation.isPending ? import_icons11.HomeIcon : import_ui11.CircularProgress,
913
+ title: (0, import_i18n10.__)("Set as homepage", "elementor"),
914
+ icon: !updateSettingsMutation.isPending ? import_icons9.HomeIcon : import_ui9.CircularProgress,
1055
915
  MenuItemProps: {
1056
916
  disabled: isDisabled,
1057
917
  onClick: handleClick
@@ -1060,141 +920,98 @@ function SetHome({ post, closeMenu }) {
1060
920
  );
1061
921
  }
1062
922
 
923
+ // src/components/panel/actions-menu/actions/view.tsx
924
+ var React16 = __toESM(require("react"));
925
+ var import_icons10 = require("@elementor/icons");
926
+ var import_i18n11 = require("@wordpress/i18n");
927
+ function View({ post }) {
928
+ const { type } = usePostListContext();
929
+ const title = (0, import_i18n11.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
930
+ return /* @__PURE__ */ React16.createElement(
931
+ ActionMenuItem,
932
+ {
933
+ title,
934
+ icon: import_icons10.EyeIcon,
935
+ MenuItemProps: {
936
+ onClick: () => window.open(post.link, "_blank")
937
+ }
938
+ }
939
+ );
940
+ }
941
+
1063
942
  // src/components/panel/posts-list/list-items/list-item-view.tsx
1064
- var import_i18n12 = require("@wordpress/i18n");
1065
943
  var DisabledPostTooltip = ({ children, isDisabled }) => {
1066
944
  if (isDisabled) {
1067
- const title = /* @__PURE__ */ React19.createElement(import_ui12.Typography, { variant: "caption" }, "You cannot edit this page.", /* @__PURE__ */ React19.createElement("br", null), "To edit it directly, contact the site owner");
1068
- return /* @__PURE__ */ React19.createElement(import_ui12.Tooltip, { title, placement: "bottom", arrow: false }, children);
945
+ const title = /* @__PURE__ */ React17.createElement(import_ui10.Typography, { variant: "caption" }, "You cannot edit this page.", /* @__PURE__ */ React17.createElement("br", null), "To edit it directly, contact the site owner");
946
+ return /* @__PURE__ */ React17.createElement(import_ui10.Tooltip, { title, placement: "bottom", arrow: false }, children);
1069
947
  }
1070
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, children);
948
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, children);
1071
949
  };
1072
950
  function ListItemView({ post }) {
1073
- const activeDocument = (0, import_editor_documents8.__useActiveDocument)();
1074
- const navigateToDocument = (0, import_editor_documents8.__useNavigateToDocument)();
1075
- const popupState = (0, import_ui12.usePopupState)({
951
+ const activeDocument = (0, import_editor_documents5.__useActiveDocument)();
952
+ const navigateToDocument = (0, import_editor_documents5.__useNavigateToDocument)();
953
+ const popupState = (0, import_ui10.usePopupState)({
1076
954
  variant: "popover",
1077
955
  popupId: "post-actions",
1078
956
  disableAutoFocus: true
1079
957
  });
1080
958
  const isActive = activeDocument?.id === post.id;
1081
959
  const status = isActive ? activeDocument?.status.value : post.status;
1082
- const title = isActive ? activeDocument?.title : post.title.rendered;
1083
- const isDisabled = !post.user_can.edit;
1084
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(DisabledPostTooltip, { isDisabled }, /* @__PURE__ */ React19.createElement(
1085
- import_ui12.ListItem,
1086
- {
1087
- disablePadding: true,
1088
- secondaryAction: /* @__PURE__ */ React19.createElement(import_ui12.IconButton, { value: true, size: "small", ...(0, import_ui12.bindTrigger)(popupState) }, /* @__PURE__ */ React19.createElement(import_icons12.DotsVerticalIcon, { fontSize: "small" }))
1089
- },
1090
- /* @__PURE__ */ React19.createElement(
1091
- import_ui12.ListItemButton,
1092
- {
1093
- selected: isActive,
1094
- disabled: isDisabled,
1095
- onClick: () => {
1096
- if (!isActive) {
1097
- navigateToDocument(post.id);
1098
- }
1099
- },
1100
- dense: true
1101
- },
1102
- /* @__PURE__ */ React19.createElement(import_ui12.ListItemText, { disableTypography: true }, /* @__PURE__ */ React19.createElement(PageTitleAndStatus, { title, status })),
1103
- post.isHome && /* @__PURE__ */ React19.createElement(import_icons12.HomeIcon, { titleAccess: (0, import_i18n12.__)("Homepage", "elementor"), color: "disabled" })
1104
- )
1105
- )), /* @__PURE__ */ React19.createElement(
1106
- import_ui12.Menu,
1107
- {
1108
- PaperProps: { sx: { mt: 2, width: 200 } },
1109
- MenuListProps: { dense: true },
1110
- ...(0, import_ui12.bindMenu)(popupState)
1111
- },
1112
- /* @__PURE__ */ React19.createElement(Rename, { post }),
1113
- /* @__PURE__ */ React19.createElement(Duplicate, { post, popupState }),
1114
- /* @__PURE__ */ React19.createElement(Delete, { post }),
1115
- /* @__PURE__ */ React19.createElement(View, { post }),
1116
- /* @__PURE__ */ React19.createElement(import_ui12.Divider, null),
1117
- /* @__PURE__ */ React19.createElement(SetHome, { post, closeMenu: () => popupState.close() })
1118
- ));
1119
- }
1120
-
1121
- // src/components/panel/posts-list/post-list-item.tsx
1122
- function PostListItem2({ post }) {
1123
- const { editMode } = usePostListContext();
1124
- if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
1125
- return /* @__PURE__ */ React20.createElement(ListItemRename, { post });
1126
- }
1127
- if ("create" === editMode.mode && !post) {
1128
- return /* @__PURE__ */ React20.createElement(ListItemCreate, null);
1129
- }
1130
- if ("duplicate" === editMode.mode && !post) {
1131
- return /* @__PURE__ */ React20.createElement(ListItemDuplicate, null);
1132
- }
1133
- if (!post) {
1134
- return null;
1135
- }
1136
- return /* @__PURE__ */ React20.createElement(ListItemView, { post });
1137
- }
1138
-
1139
- // src/components/panel/add-new-button.tsx
1140
- var React21 = __toESM(require("react"));
1141
- var import_ui13 = require("@elementor/ui");
1142
- var import_icons13 = require("@elementor/icons");
1143
- var import_i18n13 = require("@wordpress/i18n");
1144
- function AddNewButton() {
1145
- const { setEditMode } = usePostListContext();
1146
- const { data: user } = useUser();
1147
- return /* @__PURE__ */ React21.createElement(
1148
- import_ui13.Button,
1149
- {
1150
- size: "small",
1151
- startIcon: /* @__PURE__ */ React21.createElement(import_icons13.PlusIcon, null),
1152
- disabled: !user?.capabilities?.edit_pages,
1153
- onClick: () => {
1154
- setEditMode({ mode: "create", details: {} });
1155
- },
1156
- sx: {
1157
- px: 1.5
1158
- }
1159
- },
1160
- (0, import_i18n13.__)("Add New", "elementor")
1161
- );
1162
- }
1163
-
1164
- // src/components/panel/posts-list/error-state.tsx
1165
- var import_icons14 = require("@elementor/icons");
1166
- var import_ui14 = require("@elementor/ui");
1167
- var import_i18n14 = require("@wordpress/i18n");
1168
- var React22 = __toESM(require("react"));
1169
- function ErrorState() {
1170
- return /* @__PURE__ */ React22.createElement(
1171
- import_ui14.Box,
960
+ const title = isActive ? activeDocument?.title : post.title.rendered;
961
+ const isDisabled = !post.user_can.edit;
962
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(DisabledPostTooltip, { isDisabled }, /* @__PURE__ */ React17.createElement(
963
+ import_ui10.ListItem,
1172
964
  {
1173
- sx: {
1174
- display: "flex",
1175
- flexDirection: "column",
1176
- justifyContent: "center",
1177
- alignItems: "center",
1178
- pt: "40px",
1179
- gap: "16px"
1180
- }
965
+ disablePadding: true,
966
+ secondaryAction: /* @__PURE__ */ React17.createElement(import_ui10.IconButton, { value: true, size: "small", ...(0, import_ui10.bindTrigger)(popupState) }, /* @__PURE__ */ React17.createElement(import_icons11.DotsVerticalIcon, { fontSize: "small" }))
1181
967
  },
1182
- /* @__PURE__ */ React22.createElement(import_icons14.Error404TemplateIcon, null),
1183
- /* @__PURE__ */ React22.createElement(
1184
- import_ui14.Box,
968
+ /* @__PURE__ */ React17.createElement(
969
+ import_ui10.ListItemButton,
1185
970
  {
1186
- sx: {
1187
- display: "flex",
1188
- flexDirection: "column",
1189
- justifyContent: "center",
1190
- alignItems: "center",
1191
- gap: "8px"
1192
- }
971
+ selected: isActive,
972
+ disabled: isDisabled,
973
+ onClick: () => {
974
+ if (!isActive) {
975
+ navigateToDocument(post.id);
976
+ }
977
+ },
978
+ dense: true
1193
979
  },
1194
- /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n14.__)("We couldn\u2019t display your pages.", "elementor")),
1195
- /* @__PURE__ */ React22.createElement(import_ui14.Box, null, /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n14.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n14.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React22.createElement(import_ui14.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
980
+ /* @__PURE__ */ React17.createElement(import_ui10.ListItemText, { disableTypography: true }, /* @__PURE__ */ React17.createElement(PageTitleAndStatus, { title, status })),
981
+ post.isHome && /* @__PURE__ */ React17.createElement(import_icons11.HomeIcon, { titleAccess: (0, import_i18n12.__)("Homepage", "elementor"), color: "disabled" })
1196
982
  )
1197
- );
983
+ )), /* @__PURE__ */ React17.createElement(
984
+ import_ui10.Menu,
985
+ {
986
+ PaperProps: { sx: { mt: 2, width: 200 } },
987
+ MenuListProps: { dense: true },
988
+ ...(0, import_ui10.bindMenu)(popupState)
989
+ },
990
+ /* @__PURE__ */ React17.createElement(Rename, { post }),
991
+ /* @__PURE__ */ React17.createElement(Duplicate, { post, popupState }),
992
+ /* @__PURE__ */ React17.createElement(Delete, { post }),
993
+ /* @__PURE__ */ React17.createElement(View, { post }),
994
+ /* @__PURE__ */ React17.createElement(import_ui10.Divider, null),
995
+ /* @__PURE__ */ React17.createElement(SetHome, { post, closeMenu: () => popupState.close() })
996
+ ));
997
+ }
998
+
999
+ // src/components/panel/posts-list/post-list-item.tsx
1000
+ function PostListItem({ post }) {
1001
+ const { editMode } = usePostListContext();
1002
+ if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
1003
+ return /* @__PURE__ */ React18.createElement(ListItemRename, { post });
1004
+ }
1005
+ if ("create" === editMode.mode && !post) {
1006
+ return /* @__PURE__ */ React18.createElement(ListItemCreate, null);
1007
+ }
1008
+ if ("duplicate" === editMode.mode && !post) {
1009
+ return /* @__PURE__ */ React18.createElement(ListItemDuplicate, null);
1010
+ }
1011
+ if (!post) {
1012
+ return null;
1013
+ }
1014
+ return /* @__PURE__ */ React18.createElement(ListItemView, { post });
1198
1015
  }
1199
1016
 
1200
1017
  // src/components/panel/posts-list/posts-collapsible-list.tsx
@@ -1210,10 +1027,10 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1210
1027
  } = usePosts(type);
1211
1028
  const { data: homepageId } = useHomepage();
1212
1029
  if (postsError) {
1213
- return /* @__PURE__ */ React23.createElement(ErrorState, null);
1030
+ return /* @__PURE__ */ React19.createElement(ErrorState, null);
1214
1031
  }
1215
1032
  if (!posts || postsLoading) {
1216
- return /* @__PURE__ */ React23.createElement(import_ui15.Box, { sx: { px: 5 } }, /* @__PURE__ */ React23.createElement(import_ui15.Box, { display: "flex", justifyContent: "flex-end", alignItems: "center" }, /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 4 }, animation: "wave", variant: "rounded", width: "110px", height: "28px" })), /* @__PURE__ */ React23.createElement(import_ui15.Box, null, /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1033
+ return /* @__PURE__ */ React19.createElement(import_ui11.Box, { sx: { px: 5 } }, /* @__PURE__ */ React19.createElement(import_ui11.Box, { display: "flex", justifyContent: "flex-end", alignItems: "center" }, /* @__PURE__ */ React19.createElement(import_ui11.Skeleton, { sx: { my: 4 }, animation: "wave", variant: "rounded", width: "110px", height: "28px" })), /* @__PURE__ */ React19.createElement(import_ui11.Box, null, /* @__PURE__ */ React19.createElement(import_ui11.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React19.createElement(import_ui11.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React19.createElement(import_ui11.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React19.createElement(import_ui11.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1217
1034
  }
1218
1035
  const label = `${postTypesMap[type].labels.plural_name} (${total.toString()})`;
1219
1036
  const mappedPosts = posts.map((post) => {
@@ -1231,8 +1048,8 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1231
1048
  }
1232
1049
  return 0;
1233
1050
  });
1234
- return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(
1235
- import_ui15.Box,
1051
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
1052
+ import_ui11.Box,
1236
1053
  {
1237
1054
  display: "flex",
1238
1055
  justifyContent: "flex-end",
@@ -1242,63 +1059,251 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1242
1059
  px: 2
1243
1060
  }
1244
1061
  },
1245
- /* @__PURE__ */ React23.createElement(AddNewButton, null)
1246
- ), /* @__PURE__ */ React23.createElement(import_ui15.List, { dense: true }, /* @__PURE__ */ React23.createElement(CollapsibleList, { label, Icon: import_icons15.PageTypeIcon, isOpenByDefault: isOpenByDefault || false }, sortedPosts.map((post) => {
1247
- return /* @__PURE__ */ React23.createElement(PostListItem2, { key: post.id, post });
1248
- }), ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React23.createElement(PostListItem2, null), hasNextPage && /* @__PURE__ */ React23.createElement(
1249
- import_ui15.Box,
1062
+ /* @__PURE__ */ React19.createElement(AddNewButton, null)
1063
+ ), /* @__PURE__ */ React19.createElement(import_ui11.List, { dense: true }, /* @__PURE__ */ React19.createElement(CollapsibleList, { label, Icon: import_icons12.PageTypeIcon, isOpenByDefault: isOpenByDefault || false }, sortedPosts.map((post) => {
1064
+ return /* @__PURE__ */ React19.createElement(PostListItem, { key: post.id, post });
1065
+ }), ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React19.createElement(PostListItem, null), hasNextPage && /* @__PURE__ */ React19.createElement(
1066
+ import_ui11.Box,
1250
1067
  {
1251
1068
  sx: {
1252
1069
  display: "flex",
1253
1070
  justifyContent: "center"
1254
1071
  }
1255
1072
  },
1256
- /* @__PURE__ */ React23.createElement(import_ui15.Button, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(import_ui15.CircularProgress, null) : "Load More")
1073
+ /* @__PURE__ */ React19.createElement(import_ui11.Button, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React19.createElement(import_ui11.CircularProgress, null) : "Load More")
1257
1074
  ))));
1258
1075
  }
1259
1076
 
1260
- // src/components/panel/error-snackbar.tsx
1077
+ // src/components/panel/shell.tsx
1078
+ var Shell = () => {
1079
+ const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = React20.useState(false);
1080
+ return /* @__PURE__ */ React20.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React20.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React20.createElement(import_editor_panels.PanelHeaderTitle, null, (0, import_i18n13.__)("Pages", "elementor"))), /* @__PURE__ */ React20.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React20.createElement(PostListContextProvider, { type: "page", setError: () => setIsErrorSnackbarOpen(true) }, /* @__PURE__ */ React20.createElement(PostsCollapsibleList, { isOpenByDefault: true })), /* @__PURE__ */ React20.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) })));
1081
+ };
1082
+ var shell_default = Shell;
1083
+
1084
+ // src/components/panel/panel.ts
1085
+ var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.__createPanel)({
1086
+ id: "site-navigation-panel",
1087
+ component: shell_default
1088
+ });
1089
+
1090
+ // src/components/top-bar/recently-edited.tsx
1091
+ var React25 = __toESM(require("react"));
1092
+ var import_editor_documents8 = require("@elementor/editor-documents");
1093
+ var import_icons15 = require("@elementor/icons");
1261
1094
  var import_ui16 = require("@elementor/ui");
1262
- var React24 = __toESM(require("react"));
1263
- var ErrorSnackbar = ({ open, onClose }) => {
1264
- return /* @__PURE__ */ React24.createElement(
1265
- import_ui16.Snackbar,
1095
+ var import_i18n15 = require("@wordpress/i18n");
1096
+
1097
+ // src/components/top-bar/create-post-list-item.tsx
1098
+ var React21 = __toESM(require("react"));
1099
+ var import_editor_documents6 = require("@elementor/editor-documents");
1100
+ var import_icons13 = require("@elementor/icons");
1101
+ var import_ui12 = require("@elementor/ui");
1102
+ var import_i18n14 = require("@wordpress/i18n");
1103
+
1104
+ // src/hooks/use-create-page.ts
1105
+ var import_react6 = require("react");
1106
+ var import_api_fetch5 = __toESM(require("@wordpress/api-fetch"));
1107
+ var endpointPath = "/elementor/v1/site-navigation/add-new-post";
1108
+ function useCreatePage() {
1109
+ const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
1110
+ return {
1111
+ create: () => {
1112
+ setIsLoading(true);
1113
+ return addNewPage().then((newPost) => newPost).finally(() => setIsLoading(false));
1114
+ },
1115
+ isLoading
1116
+ };
1117
+ }
1118
+ async function addNewPage() {
1119
+ return await (0, import_api_fetch5.default)({
1120
+ path: endpointPath,
1121
+ method: "POST",
1122
+ data: { post_type: "page" }
1123
+ });
1124
+ }
1125
+
1126
+ // src/components/top-bar/create-post-list-item.tsx
1127
+ function CreatePostListItem({ closePopup, ...props }) {
1128
+ const { create, isLoading } = useCreatePage();
1129
+ const navigateToDocument = (0, import_editor_documents6.__useNavigateToDocument)();
1130
+ const { data: user } = useUser();
1131
+ return /* @__PURE__ */ React21.createElement(
1132
+ import_ui12.MenuItem,
1266
1133
  {
1267
- open,
1268
- onClose,
1269
- anchorOrigin: {
1270
- vertical: "bottom",
1271
- horizontal: "left"
1272
- }
1134
+ disabled: isLoading || !user?.capabilities?.edit_pages,
1135
+ onClick: async () => {
1136
+ const { id } = await create();
1137
+ closePopup();
1138
+ await navigateToDocument(id);
1139
+ },
1140
+ ...props
1273
1141
  },
1274
- /* @__PURE__ */ React24.createElement(import_ui16.Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React24.createElement(
1275
- import_ui16.Typography,
1142
+ /* @__PURE__ */ React21.createElement(import_ui12.ListItemIcon, null, isLoading ? /* @__PURE__ */ React21.createElement(import_ui12.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React21.createElement(import_icons13.PlusIcon, { fontSize: "small" })),
1143
+ /* @__PURE__ */ React21.createElement(
1144
+ import_ui12.ListItemText,
1276
1145
  {
1277
- component: "span",
1146
+ primaryTypographyProps: { variant: "body2" },
1147
+ primary: (0, import_i18n14.__)("Add new page", "elementor")
1148
+ }
1149
+ )
1150
+ );
1151
+ }
1152
+
1153
+ // src/components/top-bar/indicator.tsx
1154
+ var React22 = __toESM(require("react"));
1155
+ var import_ui13 = require("@elementor/ui");
1156
+ function Indicator({ title, status }) {
1157
+ return /* @__PURE__ */ React22.createElement(Tooltip2, { title }, /* @__PURE__ */ React22.createElement(import_ui13.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React22.createElement(import_ui13.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React22.createElement(import_ui13.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
1158
+ }
1159
+ function Tooltip2(props) {
1160
+ return /* @__PURE__ */ React22.createElement(
1161
+ import_ui13.Tooltip,
1162
+ {
1163
+ PopperProps: {
1278
1164
  sx: {
1279
- fontWeight: "bold"
1165
+ "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
1166
+ mt: 2.7
1167
+ }
1280
1168
  }
1281
1169
  },
1282
- "We couldn\u2019t complete the action."
1283
- ), " ", "Please try again")
1170
+ ...props
1171
+ }
1284
1172
  );
1285
- };
1286
- var error_snackbar_default = ErrorSnackbar;
1173
+ }
1287
1174
 
1288
- // src/components/panel/shell.tsx
1289
- var Shell = () => {
1290
- const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = React25.useState(false);
1291
- return /* @__PURE__ */ React25.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React25.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React25.createElement(import_editor_panels.PanelHeaderTitle, null, (0, import_i18n15.__)("Pages", "elementor"))), /* @__PURE__ */ React25.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React25.createElement(PostListContextProvider, { type: "page", setError: () => setIsErrorSnackbarOpen(true) }, /* @__PURE__ */ React25.createElement(PostsCollapsibleList, { isOpenByDefault: true })), /* @__PURE__ */ React25.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) })));
1292
- };
1293
- var shell_default = Shell;
1175
+ // src/components/top-bar/post-list-item.tsx
1176
+ var React24 = __toESM(require("react"));
1177
+ var import_editor_documents7 = require("@elementor/editor-documents");
1178
+ var import_ui15 = require("@elementor/ui");
1294
1179
 
1295
- // src/components/panel/panel.ts
1296
- var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.__createPanel)({
1297
- id: "site-navigation-panel",
1298
- component: shell_default
1180
+ // src/components/top-bar/chip-doc-type.tsx
1181
+ var React23 = __toESM(require("react"));
1182
+ var import_icons14 = require("@elementor/icons");
1183
+ var import_ui14 = require("@elementor/ui");
1184
+ var iconsMap2 = getIconsMap();
1185
+ function DocTypeChip({ postType, docType, label }) {
1186
+ const color = "elementor_library" === postType ? "global" : "primary";
1187
+ const Icon = iconsMap2[docType] || import_icons14.PostTypeIcon;
1188
+ return /* @__PURE__ */ React23.createElement(
1189
+ import_ui14.Chip,
1190
+ {
1191
+ component: "span",
1192
+ size: "small",
1193
+ variant: "outlined",
1194
+ label,
1195
+ "data-value": docType,
1196
+ color,
1197
+ icon: /* @__PURE__ */ React23.createElement(Icon, null),
1198
+ sx: { ml: 1, cursor: "inherit" }
1199
+ }
1200
+ );
1201
+ }
1202
+
1203
+ // src/components/top-bar/post-list-item.tsx
1204
+ function PostListItem2({ post, closePopup, ...props }) {
1205
+ const navigateToDocument = (0, import_editor_documents7.__useNavigateToDocument)();
1206
+ const postTitle = useReverseHtmlEntities(post.title);
1207
+ return /* @__PURE__ */ React24.createElement(
1208
+ import_ui15.MenuItem,
1209
+ {
1210
+ disabled: !post.user_can.edit,
1211
+ onClick: async () => {
1212
+ closePopup();
1213
+ await navigateToDocument(post.id);
1214
+ },
1215
+ ...props
1216
+ },
1217
+ /* @__PURE__ */ React24.createElement(
1218
+ import_ui15.ListItemText,
1219
+ {
1220
+ sx: { flexGrow: 0 },
1221
+ primaryTypographyProps: { variant: "body2", noWrap: true },
1222
+ primary: postTitle
1223
+ }
1224
+ ),
1225
+ /* @__PURE__ */ React24.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
1226
+ );
1227
+ }
1228
+
1229
+ // src/components/top-bar/recently-edited.tsx
1230
+ function RecentlyEdited() {
1231
+ const activeDocument = (0, import_editor_documents8.__useActiveDocument)();
1232
+ const hostDocument = (0, import_editor_documents8.__useHostDocument)();
1233
+ const document2 = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument;
1234
+ const { data } = useRecentPosts();
1235
+ const getRecentPosts = () => {
1236
+ if (!data) {
1237
+ return [];
1238
+ }
1239
+ return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
1240
+ };
1241
+ const recentPosts = getRecentPosts();
1242
+ const popupState = (0, import_ui16.usePopupState)({
1243
+ variant: "popover",
1244
+ popupId: "elementor-v2-top-bar-recently-edited"
1245
+ });
1246
+ const documentTitle = useReverseHtmlEntities(document2?.title);
1247
+ if (!document2) {
1248
+ return null;
1249
+ }
1250
+ const buttonProps = (0, import_ui16.bindTrigger)(popupState);
1251
+ return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
1252
+ import_ui16.Button,
1253
+ {
1254
+ color: "inherit",
1255
+ size: "small",
1256
+ endIcon: /* @__PURE__ */ React25.createElement(import_icons15.ChevronDownIcon, { fontSize: "small" }),
1257
+ ...buttonProps,
1258
+ onClick: (e) => {
1259
+ const extendedWindow = window;
1260
+ const config = extendedWindow?.elementor?.editorEvents?.config;
1261
+ if (config) {
1262
+ extendedWindow.elementor.editorEvents.dispatchEvent(config.names.topBar.documentNameDropdown, {
1263
+ location: config.locations.topBar,
1264
+ secondaryLocation: config.secondaryLocations.documentNameDropdown,
1265
+ trigger: config.triggers.dropdownClick,
1266
+ element: config.elements.dropdown
1267
+ });
1268
+ }
1269
+ buttonProps.onClick(e);
1270
+ }
1271
+ },
1272
+ /* @__PURE__ */ React25.createElement(Indicator, { title: documentTitle, status: document2.status })
1273
+ ), /* @__PURE__ */ React25.createElement(
1274
+ import_ui16.Menu,
1275
+ {
1276
+ MenuListProps: {
1277
+ subheader: /* @__PURE__ */ React25.createElement(import_ui16.ListSubheader, { color: "primary", sx: { fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n15.__)("Recent", "elementor"))
1278
+ },
1279
+ PaperProps: { sx: { mt: 2.5, width: 320 } },
1280
+ ...(0, import_ui16.bindMenu)(popupState)
1281
+ },
1282
+ recentPosts.map((post) => /* @__PURE__ */ React25.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
1283
+ recentPosts.length === 0 && /* @__PURE__ */ React25.createElement(import_ui16.MenuItem, { disabled: true }, /* @__PURE__ */ React25.createElement(
1284
+ import_ui16.ListItemText,
1285
+ {
1286
+ primaryTypographyProps: {
1287
+ variant: "caption",
1288
+ fontStyle: "italic"
1289
+ },
1290
+ primary: (0, import_i18n15.__)("There are no other pages or templates on this site yet.", "elementor")
1291
+ }
1292
+ )),
1293
+ /* @__PURE__ */ React25.createElement(import_ui16.Divider, { disabled: recentPosts.length === 0 }),
1294
+ /* @__PURE__ */ React25.createElement(CreatePostListItem, { closePopup: popupState.close })
1295
+ ));
1296
+ }
1297
+
1298
+ // src/env.ts
1299
+ var import_env = require("@elementor/env");
1300
+ var { env, validateEnv } = (0, import_env.parseEnv)("@elementor/editor-site-navigation", (envData) => {
1301
+ return envData;
1299
1302
  });
1300
1303
 
1301
1304
  // src/hooks/use-toggle-button-props.ts
1305
+ var import_icons16 = require("@elementor/icons");
1306
+ var import_i18n16 = require("@wordpress/i18n");
1302
1307
  function useToggleButtonProps() {
1303
1308
  const { isOpen, isBlocked } = usePanelStatus();
1304
1309
  const { open, close } = usePanelActions();
@@ -1311,15 +1316,6 @@ function useToggleButtonProps() {
1311
1316
  };
1312
1317
  }
1313
1318
 
1314
- // src/init.ts
1315
- var import_editor_panels3 = require("@elementor/editor-panels");
1316
-
1317
- // src/env.ts
1318
- var import_env = require("@elementor/env");
1319
- var { env, validateEnv } = (0, import_env.parseEnv)("@elementor/editor-site-navigation", (envData) => {
1320
- return envData;
1321
- });
1322
-
1323
1319
  // src/init.ts
1324
1320
  function init() {
1325
1321
  registerTopBarMenuItems();