← All changes
|
assets/js/packages/editor-site-navigation/editor-site-navigation.js
+1163
-2655
4.2.0-dev2
→
trunk
View file →
| @@ -1,2705 +1,1213 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ "use strict"; | |
| 3 | -/******/ var __webpack_modules__ = ({ | |
| 1 | +(function(_elementor_icons, _elementor_editor_app_bar, _elementor_editor_panels, react, _wordpress_i18n, _elementor_ui, _wordpress_api_fetch, _elementor_query, _elementor_editor_documents, _elementor_editor_v1_adapters, _elementor_events, _elementor_env) { | |
| 4 | 2 | |
| 5 | -/***/ "./packages/packages/core/editor-site-navigation/src/api/post.ts": | |
| 6 | -/*!***********************************************************************!*\ | |
| 7 | - !*** ./packages/packages/core/editor-site-navigation/src/api/post.ts ***! | |
| 8 | - \***********************************************************************/ | |
| 9 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3 | +//#region \0rolldown/runtime.js | |
| 4 | + var __create = Object.create; | |
| 5 | + var __defProp = Object.defineProperty; | |
| 6 | + var __name = (target, value) => __defProp(target, "name", { | |
| 7 | + value, | |
| 8 | + configurable: true | |
| 9 | + }); | |
| 10 | + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | |
| 11 | + var __getOwnPropNames = Object.getOwnPropertyNames; | |
| 12 | + var __getProtoOf = Object.getPrototypeOf; | |
| 13 | + var __hasOwnProp = Object.prototype.hasOwnProperty; | |
| 14 | + var __exportAll = (all, no_symbols) => { | |
| 15 | + let target = {}; | |
| 16 | + for (var name in all) { | |
| 17 | + __defProp(target, name, { | |
| 18 | + get: all[name], | |
| 19 | + enumerable: true | |
| 20 | + }); | |
| 21 | + } | |
| 22 | + if (!no_symbols) { | |
| 23 | + __defProp(target, Symbol.toStringTag, { value: "Module" }); | |
| 24 | + } | |
| 25 | + return target; | |
| 26 | + }; | |
| 27 | + var __copyProps = (to, from, except, desc) => { | |
| 28 | + if (from && typeof from === "object" || typeof from === "function") { | |
| 29 | + for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { | |
| 30 | + key = keys[i]; | |
| 31 | + if (!__hasOwnProp.call(to, key) && key !== except) { | |
| 32 | + __defProp(to, key, { | |
| 33 | + get: ((k) => from[k]).bind(null, key), | |
| 34 | + enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable | |
| 35 | + }); | |
| 36 | + } | |
| 37 | + } | |
| 38 | + } | |
| 39 | + return to; | |
| 40 | + }; | |
| 41 | + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { | |
| 42 | + value: mod, | |
| 43 | + enumerable: true | |
| 44 | + }) : target, mod)); | |
| 10 | 45 | |
| 11 | -__webpack_require__.r(__webpack_exports__); | |
| 12 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 13 | -/* harmony export */ POST_PER_PAGE: function() { return /* binding */ POST_PER_PAGE; }, | |
| 14 | -/* harmony export */ createRequest: function() { return /* binding */ createRequest; }, | |
| 15 | -/* harmony export */ deleteRequest: function() { return /* binding */ deleteRequest; }, | |
| 16 | -/* harmony export */ duplicateRequest: function() { return /* binding */ duplicateRequest; }, | |
| 17 | -/* harmony export */ getRequest: function() { return /* binding */ getRequest; }, | |
| 18 | -/* harmony export */ postTypesMap: function() { return /* binding */ postTypesMap; }, | |
| 19 | -/* harmony export */ updateRequest: function() { return /* binding */ updateRequest; } | |
| 20 | -/* harmony export */ }); | |
| 21 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); | |
| 22 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__); | |
| 23 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 24 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); | |
| 46 | +//#endregion | |
| 47 | +react = __toESM(react); | |
| 48 | +_wordpress_api_fetch = __toESM(_wordpress_api_fetch); | |
| 25 | 49 | |
| 50 | +//#region packages/packages/core/editor-site-navigation/src/icons-map.ts | |
| 51 | + var initialIconsMap = { | |
| 52 | + page: _elementor_icons.PageTemplateIcon, | |
| 53 | + section: _elementor_icons.SectionTemplateIcon, | |
| 54 | + container: _elementor_icons.ContainerTemplateIcon, | |
| 55 | + "wp-page": _elementor_icons.PageTypeIcon, | |
| 56 | + "wp-post": _elementor_icons.PostTypeIcon | |
| 57 | + }; | |
| 58 | + var iconsMap$1 = { ...initialIconsMap }; | |
| 59 | + function extendIconsMap(additionalIcons) { | |
| 60 | + Object.assign(iconsMap$1, additionalIcons); | |
| 61 | + } | |
| 62 | + function getIconsMap() { | |
| 63 | + return iconsMap$1; | |
| 64 | + } | |
| 26 | 65 | |
| 27 | -const postTypesMap = { | |
| 28 | - page: { | |
| 29 | - labels: { | |
| 30 | - singular_name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page', 'elementor'), | |
| 31 | - plural_name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Pages', 'elementor') | |
| 32 | - }, | |
| 33 | - rest_base: 'pages' | |
| 34 | - } | |
| 35 | -}; | |
| 36 | -const POST_PER_PAGE = 10; | |
| 37 | -const getRequest = async (postTypeSlug, page) => { | |
| 38 | - const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; | |
| 39 | - const keys = ['id', 'type', 'title', 'link', 'status', 'user_can']; | |
| 40 | - const queryParams = new URLSearchParams({ | |
| 41 | - status: 'any', | |
| 42 | - order: 'asc', | |
| 43 | - page: page.toString(), | |
| 44 | - per_page: POST_PER_PAGE.toString(), | |
| 45 | - _fields: keys.join(',') | |
| 46 | - }); | |
| 47 | - const uri = baseUri + '?' + queryParams.toString(); | |
| 48 | - const result = await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 49 | - path: uri, | |
| 50 | - parse: false | |
| 51 | - }); | |
| 52 | - const data = await result.json(); | |
| 53 | - const totalPages = Number(result.headers.get('x-wp-totalpages')); | |
| 54 | - const totalPosts = Number(result.headers.get('x-wp-total')); | |
| 55 | - return { | |
| 56 | - data, | |
| 57 | - totalPages, | |
| 58 | - totalPosts, | |
| 59 | - currentPage: page | |
| 60 | - }; | |
| 61 | -}; | |
| 62 | -const createRequest = (postTypeSlug, newPost) => { | |
| 63 | - const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; | |
| 64 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 65 | - path, | |
| 66 | - method: 'POST', | |
| 67 | - data: newPost | |
| 68 | - }); | |
| 69 | -}; | |
| 70 | -const updateRequest = (postTypeSlug, updatedPost) => { | |
| 71 | - const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; | |
| 72 | - const { | |
| 73 | - id, | |
| 74 | - ...data | |
| 75 | - } = updatedPost; | |
| 76 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 77 | - path: `${path}/${id}`, | |
| 78 | - method: 'POST', | |
| 79 | - data | |
| 80 | - }); | |
| 81 | -}; | |
| 82 | -const deleteRequest = (postTypeSlug, postId) => { | |
| 83 | - const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; | |
| 84 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 85 | - path: `${path}/${postId}`, | |
| 86 | - method: 'DELETE' | |
| 87 | - }); | |
| 88 | -}; | |
| 89 | -const duplicateRequest = originalPost => { | |
| 90 | - const path = `/elementor/v1/site-navigation/duplicate-post`; | |
| 91 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 92 | - path, | |
| 93 | - method: 'POST', | |
| 94 | - data: { | |
| 95 | - post_id: originalPost.id, | |
| 96 | - title: originalPost.title | |
| 97 | - } | |
| 98 | - }); | |
| 99 | -}; | |
| 66 | +//#endregion | |
| 67 | +//#region packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx | |
| 68 | + var defaultValues = { | |
| 69 | + type: "page", | |
| 70 | + editMode: { | |
| 71 | + mode: "none", | |
| 72 | + details: {} | |
| 73 | + }, | |
| 74 | + setEditMode: () => null, | |
| 75 | + resetEditMode: () => null, | |
| 76 | + setError: () => null | |
| 77 | + }; | |
| 78 | + var PostListContext = (0, react.createContext)(defaultValues); | |
| 79 | + var PostListContextProvider = ({ type, setError, children }) => { | |
| 80 | + const [editMode, setEditMode] = (0, react.useState)(defaultValues.editMode); | |
| 81 | + const resetEditMode = () => { | |
| 82 | + setEditMode(defaultValues.editMode); | |
| 83 | + }; | |
| 84 | + return /* @__PURE__ */ react.createElement(PostListContext.Provider, { value: { | |
| 85 | + type, | |
| 86 | + editMode, | |
| 87 | + setEditMode, | |
| 88 | + resetEditMode, | |
| 89 | + setError | |
| 90 | + } }, children); | |
| 91 | + }; | |
| 92 | + function usePostListContext() { | |
| 93 | + const context = (0, react.useContext)(PostListContext); | |
| 94 | + if (!context) throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`"); | |
| 95 | + return context; | |
| 96 | + } | |
| 100 | 97 | |
| 101 | -/***/ }), | |
| 98 | +//#endregion | |
| 99 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/error-snackbar.tsx | |
| 100 | + var ErrorSnackbar = ({ open, onClose }) => { | |
| 101 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Snackbar, { | |
| 102 | + open, | |
| 103 | + onClose, | |
| 104 | + anchorOrigin: { | |
| 105 | + vertical: "bottom", | |
| 106 | + horizontal: "left" | |
| 107 | + } | |
| 108 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Alert, { | |
| 109 | + onClose, | |
| 110 | + severity: "error", | |
| 111 | + sx: { width: "100%" } | |
| 112 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 113 | + component: "span", | |
| 114 | + sx: { fontWeight: "bold" } | |
| 115 | + }, "We couldn’t complete the action."), " ", "Please try again")); | |
| 116 | + }; | |
| 102 | 117 | |
| 103 | -/***/ "./packages/packages/core/editor-site-navigation/src/api/recent-posts.ts": | |
| 104 | -/*!*******************************************************************************!*\ | |
| 105 | - !*** ./packages/packages/core/editor-site-navigation/src/api/recent-posts.ts ***! | |
| 106 | - \*******************************************************************************/ | |
| 107 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 118 | +//#endregion | |
| 119 | +//#region packages/packages/core/editor-site-navigation/src/api/post.ts | |
| 120 | + var postTypesMap = { page: { | |
| 121 | + labels: { | |
| 122 | + singular_name: (0, _wordpress_i18n.__)("Page", "elementor"), | |
| 123 | + plural_name: (0, _wordpress_i18n.__)("Pages", "elementor") | |
| 124 | + }, | |
| 125 | + rest_base: "pages" | |
| 126 | + } }; | |
| 127 | + var POST_PER_PAGE = 10; | |
| 128 | + var getRequest$1 = /* @__PURE__ */ __name(async (postTypeSlug, page) => { | |
| 129 | + const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; | |
| 130 | + const queryParams = new URLSearchParams({ | |
| 131 | + status: "any", | |
| 132 | + order: "asc", | |
| 133 | + page: page.toString(), | |
| 134 | + per_page: 10 .toString(), | |
| 135 | + _fields: [ | |
| 136 | + "id", | |
| 137 | + "type", | |
| 138 | + "title", | |
| 139 | + "link", | |
| 140 | + "status", | |
| 141 | + "user_can" | |
| 142 | + ].join(",") | |
| 143 | + }); | |
| 144 | + const result = await (0, _wordpress_api_fetch.default)({ | |
| 145 | + path: baseUri + "?" + queryParams.toString(), | |
| 146 | + parse: false | |
| 147 | + }); | |
| 148 | + return { | |
| 149 | + data: await result.json(), | |
| 150 | + totalPages: Number(result.headers.get("x-wp-totalpages")), | |
| 151 | + totalPosts: Number(result.headers.get("x-wp-total")), | |
| 152 | + currentPage: page | |
| 153 | + }; | |
| 154 | + }, "getRequest"); | |
| 155 | + var createRequest = (postTypeSlug, newPost) => { | |
| 156 | + return (0, _wordpress_api_fetch.default)({ | |
| 157 | + path: `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`, | |
| 158 | + method: "POST", | |
| 159 | + data: newPost | |
| 160 | + }); | |
| 161 | + }; | |
| 162 | + var updateRequest = (postTypeSlug, updatedPost) => { | |
| 163 | + const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; | |
| 164 | + const { id, ...data } = updatedPost; | |
| 165 | + return (0, _wordpress_api_fetch.default)({ | |
| 166 | + path: `${path}/${id}`, | |
| 167 | + method: "POST", | |
| 168 | + data | |
| 169 | + }); | |
| 170 | + }; | |
| 171 | + var deleteRequest = (postTypeSlug, postId) => { | |
| 172 | + return (0, _wordpress_api_fetch.default)({ | |
| 173 | + path: `${`/wp/v2/${postTypesMap[postTypeSlug].rest_base}`}/${postId}`, | |
| 174 | + method: "DELETE" | |
| 175 | + }); | |
| 176 | + }; | |
| 177 | + var duplicateRequest = (originalPost) => { | |
| 178 | + return (0, _wordpress_api_fetch.default)({ | |
| 179 | + path: `/elementor/v1/site-navigation/duplicate-post`, | |
| 180 | + method: "POST", | |
| 181 | + data: { | |
| 182 | + post_id: originalPost.id, | |
| 183 | + title: originalPost.title | |
| 184 | + } | |
| 185 | + }); | |
| 186 | + }; | |
| 108 | 187 | |
| 109 | -__webpack_require__.r(__webpack_exports__); | |
| 110 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 111 | -/* harmony export */ NUMBER_OF_RECENT_POSTS: function() { return /* binding */ NUMBER_OF_RECENT_POSTS; }, | |
| 112 | -/* harmony export */ baseUrl: function() { return /* binding */ baseUrl; }, | |
| 113 | -/* harmony export */ getRequest: function() { return /* binding */ getRequest; } | |
| 114 | -/* harmony export */ }); | |
| 115 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); | |
| 116 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__); | |
| 188 | +//#endregion | |
| 189 | +//#region packages/packages/core/editor-site-navigation/src/api/settings.ts | |
| 190 | + var getSettings = () => { | |
| 191 | + return (0, _wordpress_api_fetch.default)({ path: "/elementor/v1/site-navigation/homepage" }); | |
| 192 | + }; | |
| 193 | + var updateSettings = (settings) => { | |
| 194 | + return (0, _wordpress_api_fetch.default)({ | |
| 195 | + path: "/wp/v2/settings", | |
| 196 | + method: "POST", | |
| 197 | + data: settings | |
| 198 | + }); | |
| 199 | + }; | |
| 117 | 200 | |
| 118 | -const baseUrl = '/elementor/v1/site-navigation/recent-posts'; | |
| 119 | -const NUMBER_OF_RECENT_POSTS = 6; | |
| 120 | -const getRequest = () => { | |
| 121 | - const queryParams = new URLSearchParams({ | |
| 122 | - posts_per_page: `${NUMBER_OF_RECENT_POSTS}` | |
| 123 | - }); | |
| 124 | - const path = `${baseUrl}?${queryParams.toString()}`; | |
| 125 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 126 | - path | |
| 127 | - }); | |
| 128 | -}; | |
| 201 | +//#endregion | |
| 202 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-homepage.ts | |
| 203 | + var settingsQueryKey = () => ["site-navigation", "homepage"]; | |
| 204 | + function useHomepage() { | |
| 205 | + return (0, _elementor_query.useQuery)({ | |
| 206 | + queryKey: settingsQueryKey(), | |
| 207 | + queryFn: () => getSettings() | |
| 208 | + }); | |
| 209 | + } | |
| 129 | 210 | |
| 130 | -/***/ }), | |
| 211 | +//#endregion | |
| 212 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-posts.ts | |
| 213 | + var postsQueryKey = (postTypeSlug) => [ | |
| 214 | + "site-navigation", | |
| 215 | + "posts", | |
| 216 | + postTypeSlug | |
| 217 | + ]; | |
| 218 | + var flattenData = (data) => { | |
| 219 | + if (!data) return data; | |
| 220 | + const flattened = []; | |
| 221 | + data.pages.forEach((page) => { | |
| 222 | + flattened.push(...page.data); | |
| 223 | + }); | |
| 224 | + return flattened; | |
| 225 | + }; | |
| 226 | + function usePosts(postTypeSlug) { | |
| 227 | + const query = (0, _elementor_query.useInfiniteQuery)({ | |
| 228 | + queryKey: postsQueryKey(postTypeSlug), | |
| 229 | + queryFn: ({ pageParam = 1 }) => getRequest$1(postTypeSlug, pageParam), | |
| 230 | + initialPageParam: 1, | |
| 231 | + getNextPageParam: (lastPage) => { | |
| 232 | + return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0; | |
| 233 | + } | |
| 234 | + }); | |
| 235 | + return { | |
| 236 | + ...query, | |
| 237 | + data: { | |
| 238 | + posts: flattenData(query.data), | |
| 239 | + total: query.data?.pages[0]?.totalPosts ?? 0 | |
| 240 | + } | |
| 241 | + }; | |
| 242 | + } | |
| 131 | 243 | |
| 132 | -/***/ "./packages/packages/core/editor-site-navigation/src/api/settings.ts": | |
| 133 | -/*!***************************************************************************!*\ | |
| 134 | - !*** ./packages/packages/core/editor-site-navigation/src/api/settings.ts ***! | |
| 135 | - \***************************************************************************/ | |
| 136 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 244 | +//#endregion | |
| 245 | +//#region packages/packages/core/editor-site-navigation/src/api/user.ts | |
| 246 | + var getUser = () => { | |
| 247 | + return (0, _wordpress_api_fetch.default)({ path: "/wp/v2/users/me?" + new URLSearchParams({ | |
| 248 | + _fields: ["capabilities"].join(","), | |
| 249 | + context: "edit" | |
| 250 | + }).toString() }); | |
| 251 | + }; | |
| 137 | 252 | |
| 138 | -__webpack_require__.r(__webpack_exports__); | |
| 139 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 140 | -/* harmony export */ getSettings: function() { return /* binding */ getSettings; }, | |
| 141 | -/* harmony export */ updateSettings: function() { return /* binding */ updateSettings; } | |
| 142 | -/* harmony export */ }); | |
| 143 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); | |
| 144 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__); | |
| 253 | +//#endregion | |
| 254 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-user.ts | |
| 255 | + var userQueryKey = () => ["site-navigation", "user"]; | |
| 256 | + function useUser() { | |
| 257 | + return (0, _elementor_query.useQuery)({ | |
| 258 | + queryKey: userQueryKey(), | |
| 259 | + queryFn: getUser, | |
| 260 | + staleTime: 1800 * 1e3 | |
| 261 | + }); | |
| 262 | + } | |
| 145 | 263 | |
| 146 | -const getSettings = () => { | |
| 147 | - const baseUri = '/elementor/v1/site-navigation/homepage'; | |
| 148 | - const uri = baseUri; | |
| 149 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 150 | - path: uri | |
| 151 | - }); | |
| 152 | -}; | |
| 153 | -const updateSettings = settings => { | |
| 154 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 155 | - path: '/wp/v2/settings', | |
| 156 | - method: 'POST', | |
| 157 | - data: settings | |
| 158 | - }); | |
| 159 | -}; | |
| 264 | +//#endregion | |
| 265 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/add-new-button.tsx | |
| 266 | + function AddNewButton() { | |
| 267 | + const { setEditMode } = usePostListContext(); | |
| 268 | + const { data: user } = useUser(); | |
| 269 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Button, { | |
| 270 | + size: "small", | |
| 271 | + startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.PlusIcon, null), | |
| 272 | + disabled: !user?.capabilities?.edit_pages, | |
| 273 | + onClick: () => { | |
| 274 | + setEditMode({ | |
| 275 | + mode: "create", | |
| 276 | + details: {} | |
| 277 | + }); | |
| 278 | + }, | |
| 279 | + sx: { px: 1.5 } | |
| 280 | + }, (0, _wordpress_i18n.__)("Add New", "elementor")); | |
| 281 | + } | |
| 160 | 282 | |
| 161 | -/***/ }), | |
| 283 | +//#endregion | |
| 284 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/collapsible-list.tsx | |
| 285 | + var RotateIcon = (0, _elementor_ui.styled)(_elementor_icons.ChevronDownIcon, { shouldForwardProp: (prop) => prop !== "isOpen" })(({ theme, isOpen }) => ({ | |
| 286 | + transform: isOpen ? "rotate(0deg)" : "rotate(-90deg)", | |
| 287 | + transition: theme.transitions.create("transform", { duration: theme.transitions.duration.standard }) | |
| 288 | + })); | |
| 289 | + var StyledListItemIcon = (0, _elementor_ui.styled)(_elementor_ui.ListItemIcon)(({ theme }) => ({ minWidth: theme.spacing(4) })); | |
| 290 | + function CollapsibleList({ label, Icon, isOpenByDefault = false, children }) { | |
| 291 | + const [isOpen, setIsOpen] = (0, react.useState)(isOpenByDefault); | |
| 292 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.ListItem, null, /* @__PURE__ */ react.createElement(StyledListItemIcon, { sx: { color: "text.secondary" } }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, { | |
| 293 | + onClick: () => setIsOpen((prev) => !prev), | |
| 294 | + size: "small", | |
| 295 | + sx: { color: "inherit" } | |
| 296 | + }, /* @__PURE__ */ react.createElement(RotateIcon, { | |
| 297 | + fontSize: "small", | |
| 298 | + isOpen | |
| 299 | + }))), /* @__PURE__ */ react.createElement(StyledListItemIcon, { | |
| 300 | + size: "small", | |
| 301 | + sx: { color: "inherit" } | |
| 302 | + }, /* @__PURE__ */ react.createElement(Icon, { fontSize: "small" })), /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { | |
| 303 | + primaryTypographyProps: { | |
| 304 | + variant: "subtitle2", | |
| 305 | + component: "span" | |
| 306 | + }, | |
| 307 | + primary: label | |
| 308 | + })), /* @__PURE__ */ react.createElement(_elementor_ui.Collapse, { | |
| 309 | + in: isOpen, | |
| 310 | + timeout: "auto", | |
| 311 | + unmountOnExit: true | |
| 312 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.List, { dense: true }, children)), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, { sx: { mt: 1 } })); | |
| 313 | + } | |
| 162 | 314 | |
| 163 | -/***/ "./packages/packages/core/editor-site-navigation/src/api/user.ts": | |
| 164 | -/*!***********************************************************************!*\ | |
| 165 | - !*** ./packages/packages/core/editor-site-navigation/src/api/user.ts ***! | |
| 166 | - \***********************************************************************/ | |
| 167 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 315 | +//#endregion | |
| 316 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/error-state.tsx | |
| 317 | + function ErrorState() { | |
| 318 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { | |
| 319 | + display: "flex", | |
| 320 | + flexDirection: "column", | |
| 321 | + justifyContent: "center", | |
| 322 | + alignItems: "center", | |
| 323 | + pt: "40px", | |
| 324 | + gap: "16px" | |
| 325 | + } }, /* @__PURE__ */ react.createElement(_elementor_icons.Error404TemplateIcon, null), /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { | |
| 326 | + display: "flex", | |
| 327 | + flexDirection: "column", | |
| 328 | + justifyContent: "center", | |
| 329 | + alignItems: "center", | |
| 330 | + gap: "8px" | |
| 331 | + } }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 332 | + variant: "body1", | |
| 333 | + color: "text.primary" | |
| 334 | + }, (0, _wordpress_i18n.__)("We couldn’t display your pages.", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 335 | + variant: "body2", | |
| 336 | + color: "text.primary", | |
| 337 | + sx: { textAlign: "center" } | |
| 338 | + }, (0, _wordpress_i18n.__)("It’s probably a temporary issue.", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 339 | + variant: "body2", | |
| 340 | + color: "text.primary", | |
| 341 | + sx: { textAlign: "center" } | |
| 342 | + }, (0, _wordpress_i18n.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ react.createElement(_elementor_ui.Link, { | |
| 343 | + target: "_blank", | |
| 344 | + href: "https://go.elementor.com/wp-editor-support-open-ticket/" | |
| 345 | + }, "Notify support"))))); | |
| 346 | + } | |
| 168 | 347 | |
| 169 | -__webpack_require__.r(__webpack_exports__); | |
| 170 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 171 | -/* harmony export */ getUser: function() { return /* binding */ getUser; } | |
| 172 | -/* harmony export */ }); | |
| 173 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); | |
| 174 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__); | |
| 348 | +//#endregion | |
| 349 | +//#region packages/packages/core/editor-site-navigation/src/api/recent-posts.ts | |
| 350 | + var baseUrl = "/elementor/v1/site-navigation/recent-posts"; | |
| 351 | + var NUMBER_OF_RECENT_POSTS = 6; | |
| 352 | + var getRequest = () => { | |
| 353 | + const queryParams = new URLSearchParams({ posts_per_page: `${6}` }); | |
| 354 | + return (0, _wordpress_api_fetch.default)({ path: `${baseUrl}?${queryParams.toString()}` }); | |
| 355 | + }; | |
| 175 | 356 | |
| 176 | -const getUser = () => { | |
| 177 | - const baseUri = '/wp/v2/users/me'; | |
| 178 | - const keys = ['capabilities']; | |
| 179 | - const queryParams = new URLSearchParams({ | |
| 180 | - _fields: keys.join(','), | |
| 181 | - context: 'edit' | |
| 182 | - }); | |
| 183 | - const uri = baseUri + '?' + queryParams.toString(); | |
| 184 | - return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()({ | |
| 185 | - path: uri | |
| 186 | - }); | |
| 187 | -}; | |
| 357 | +//#endregion | |
| 358 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-recent-posts.ts | |
| 359 | + var recentPostsQueryKey = ["site-navigation", "recent-posts"]; | |
| 360 | + function useRecentPosts() { | |
| 361 | + return (0, _elementor_query.useQuery)({ | |
| 362 | + queryKey: recentPostsQueryKey, | |
| 363 | + queryFn: () => getRequest() | |
| 364 | + }); | |
| 365 | + } | |
| 188 | 366 | |
| 189 | -/***/ }), | |
| 367 | +//#endregion | |
| 368 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-posts-actions.ts | |
| 369 | + function usePostActions(postTypeSlug) { | |
| 370 | + const invalidatePosts = useInvalidatePosts(postTypeSlug); | |
| 371 | + const onSuccess = () => invalidatePosts({ exact: true }); | |
| 372 | + return { | |
| 373 | + createPost: (0, _elementor_query.useMutation)({ | |
| 374 | + mutationFn: (newPost) => createRequest(postTypeSlug, newPost), | |
| 375 | + onSuccess | |
| 376 | + }), | |
| 377 | + updatePost: (0, _elementor_query.useMutation)({ | |
| 378 | + mutationFn: (updatedPost) => updateRequest(postTypeSlug, updatedPost), | |
| 379 | + onSuccess | |
| 380 | + }), | |
| 381 | + deletePost: (0, _elementor_query.useMutation)({ | |
| 382 | + mutationFn: (postId) => deleteRequest(postTypeSlug, postId), | |
| 383 | + onSuccess | |
| 384 | + }), | |
| 385 | + duplicatePost: (0, _elementor_query.useMutation)({ | |
| 386 | + mutationFn: (originalPost) => duplicateRequest(originalPost), | |
| 387 | + onSuccess | |
| 388 | + }) | |
| 389 | + }; | |
| 390 | + } | |
| 391 | + function useInvalidatePosts(postTypeSlug) { | |
| 392 | + const queryClient = (0, _elementor_query.useQueryClient)(); | |
| 393 | + return (options = {}) => { | |
| 394 | + const queryKey = postsQueryKey(postTypeSlug); | |
| 395 | + queryClient.invalidateQueries({ queryKey: recentPostsQueryKey }, options); | |
| 396 | + return queryClient.invalidateQueries({ queryKey }, options); | |
| 397 | + }; | |
| 398 | + } | |
| 190 | 399 | |
| 191 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx": | |
| 192 | -/*!**************************************************************************************************************!*\ | |
| 193 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx ***! | |
| 194 | - \**************************************************************************************************************/ | |
| 195 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 400 | +//#endregion | |
| 401 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/edit-mode-template.tsx | |
| 402 | + function EditModeTemplate({ postTitle, isLoading, callback }) { | |
| 403 | + const [title, setTitle] = (0, react.useState)(postTitle); | |
| 404 | + const [touched, setTouched] = (0, react.useState)(false); | |
| 405 | + const [inputError, setInputError] = (0, react.useState)(null); | |
| 406 | + const closeButton = (0, react.useRef)(); | |
| 407 | + const onBlur = (e) => { | |
| 408 | + if (closeButton.current === e.relatedTarget) return; | |
| 409 | + runCallback(); | |
| 410 | + }; | |
| 411 | + const onFormSubmit = (e) => { | |
| 412 | + e.preventDefault(); | |
| 413 | + runCallback(); | |
| 414 | + }; | |
| 415 | + const validateInput = (input) => { | |
| 416 | + return input.trim() !== ""; | |
| 417 | + }; | |
| 418 | + const runCallback = () => { | |
| 419 | + if (!validateInput(title)) return; | |
| 420 | + callback(title); | |
| 421 | + }; | |
| 422 | + const onChange = (e) => { | |
| 423 | + if (!touched) setTouched(true); | |
| 424 | + const value = e.target.value; | |
| 425 | + if (!validateInput(value)) setInputError((0, _wordpress_i18n.__)("Name is required", "elementor")); | |
| 426 | + else setInputError(null); | |
| 427 | + setTitle(value); | |
| 428 | + }; | |
| 429 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.ListItem, { secondaryAction: /* @__PURE__ */ react.createElement(CloseButton, { | |
| 430 | + isLoading, | |
| 431 | + closeButton | |
| 432 | + }) }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { | |
| 433 | + width: "100%", | |
| 434 | + component: "form", | |
| 435 | + onSubmit: onFormSubmit | |
| 436 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, { | |
| 437 | + autoFocus: true, | |
| 438 | + fullWidth: true, | |
| 439 | + value: title, | |
| 440 | + onChange, | |
| 441 | + disabled: isLoading, | |
| 442 | + error: !!inputError, | |
| 443 | + onBlur, | |
| 444 | + variant: "outlined", | |
| 445 | + color: "secondary", | |
| 446 | + size: "small" | |
| 447 | + }))), inputError && /* @__PURE__ */ react.createElement(_elementor_ui.ListItem, null, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { sx: { color: "error.main" } }, inputError))); | |
| 448 | + } | |
| 449 | + function CloseButton({ isLoading, closeButton }) { | |
| 450 | + const { resetEditMode } = usePostListContext(); | |
| 451 | + return /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, { | |
| 452 | + size: "small", | |
| 453 | + color: "secondary", | |
| 454 | + onClick: resetEditMode, | |
| 455 | + ref: closeButton, | |
| 456 | + disabled: isLoading | |
| 457 | + }, isLoading ? /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, null) : /* @__PURE__ */ react.createElement(_elementor_icons.XIcon, { fontSize: "small" })); | |
| 458 | + } | |
| 196 | 459 | |
| 197 | -__webpack_require__.r(__webpack_exports__); | |
| 198 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 199 | -/* harmony export */ "default": function() { return /* binding */ ActionMenuItem; } | |
| 200 | -/* harmony export */ }); | |
| 201 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 202 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 203 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 204 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__); | |
| 460 | +//#endregion | |
| 461 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-create.tsx | |
| 462 | + function ListItemCreate() { | |
| 463 | + const { type, resetEditMode } = usePostListContext(); | |
| 464 | + const { createPost } = usePostActions(type); | |
| 465 | + const navigateToDocument = (0, _elementor_editor_documents.__useNavigateToDocument)(); | |
| 466 | + const { setError } = usePostListContext(); | |
| 467 | + const createPostCallback = async (inputValue) => { | |
| 468 | + try { | |
| 469 | + const { id } = await createPost.mutateAsync({ | |
| 470 | + title: inputValue, | |
| 471 | + status: "draft" | |
| 472 | + }); | |
| 473 | + navigateToDocument(id); | |
| 474 | + } catch { | |
| 475 | + setError(); | |
| 476 | + } finally { | |
| 477 | + resetEditMode(); | |
| 478 | + } | |
| 479 | + }; | |
| 480 | + return /* @__PURE__ */ react.createElement(EditModeTemplate, { | |
| 481 | + postTitle: (0, _wordpress_i18n.__)("New Page", "elementor"), | |
| 482 | + isLoading: createPost.isPending, | |
| 483 | + callback: createPostCallback | |
| 484 | + }); | |
| 485 | + } | |
| 205 | 486 | |
| 487 | +//#endregion | |
| 488 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-duplicate.tsx | |
| 489 | + function ListItemDuplicate() { | |
| 490 | + const { type, editMode, resetEditMode } = usePostListContext(); | |
| 491 | + const navigateToDocument = (0, _elementor_editor_documents.__useNavigateToDocument)(); | |
| 492 | + const { duplicatePost } = usePostActions(type); | |
| 493 | + const { setError } = usePostListContext(); | |
| 494 | + if ("duplicate" !== editMode.mode) return null; | |
| 495 | + const duplicatePostCallback = async (inputValue) => { | |
| 496 | + try { | |
| 497 | + const { post_id: postId } = await duplicatePost.mutateAsync({ | |
| 498 | + id: editMode.details.postId, | |
| 499 | + title: inputValue | |
| 500 | + }); | |
| 501 | + navigateToDocument(postId); | |
| 502 | + } catch { | |
| 503 | + setError(); | |
| 504 | + } finally { | |
| 505 | + resetEditMode(); | |
| 506 | + } | |
| 507 | + }; | |
| 508 | + return /* @__PURE__ */ react.createElement(EditModeTemplate, { | |
| 509 | + postTitle: `${editMode.details.title} ${(0, _wordpress_i18n.__)("copy", "elementor")}`, | |
| 510 | + isLoading: duplicatePost.isPending, | |
| 511 | + callback: duplicatePostCallback | |
| 512 | + }); | |
| 513 | + } | |
| 206 | 514 | |
| 207 | -function ActionMenuItem({ | |
| 208 | - title, | |
| 209 | - icon: Icon, | |
| 210 | - MenuItemProps | |
| 211 | -}) { | |
| 212 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.MenuItem, MenuItemProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.ListItemIcon, { | |
| 213 | - sx: { | |
| 214 | - color: 'inherit' | |
| 215 | - } | |
| 216 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Icon, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.ListItemText, { | |
| 217 | - primary: title | |
| 218 | - })); | |
| 219 | -} | |
| 515 | +//#endregion | |
| 516 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-rename-active-document.ts | |
| 517 | + function getV1DocumentsManager() { | |
| 518 | + const documentsManager = window.elementor?.documents; | |
| 519 | + if (!documentsManager) throw new Error("Elementor Editor V1 documents manager not found"); | |
| 520 | + return documentsManager; | |
| 521 | + } | |
| 522 | + function useRenameActiveDocument() { | |
| 523 | + return async (title) => { | |
| 524 | + const container = getV1DocumentsManager().getCurrent().container; | |
| 525 | + await (0, _elementor_editor_v1_adapters.__privateRunCommand)("document/elements/settings", { | |
| 526 | + container, | |
| 527 | + settings: { post_title: title } | |
| 528 | + }); | |
| 529 | + }; | |
| 530 | + } | |
| 220 | 531 | |
| 221 | -/***/ }), | |
| 532 | +//#endregion | |
| 533 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-rename.tsx | |
| 534 | + function ListItemRename({ post }) { | |
| 535 | + const { type, resetEditMode } = usePostListContext(); | |
| 536 | + const { updatePost } = usePostActions(type); | |
| 537 | + const { setError } = usePostListContext(); | |
| 538 | + const activeDocument = (0, _elementor_editor_documents.__useActiveDocument)(); | |
| 539 | + const rename = useRenameActiveDocument(); | |
| 540 | + const isActive = activeDocument?.id === post.id; | |
| 541 | + const title = isActive ? activeDocument?.title : post.title.rendered; | |
| 542 | + const renamePostCallback = async (inputValue) => { | |
| 543 | + if (inputValue === title) resetEditMode(); | |
| 544 | + try { | |
| 545 | + if (isActive) await rename(inputValue); | |
| 546 | + else await updatePost.mutateAsync({ | |
| 547 | + id: post.id, | |
| 548 | + title: inputValue | |
| 549 | + }); | |
| 550 | + } catch { | |
| 551 | + setError(); | |
| 552 | + } finally { | |
| 553 | + resetEditMode(); | |
| 554 | + } | |
| 555 | + }; | |
| 556 | + return /* @__PURE__ */ react.createElement(EditModeTemplate, { | |
| 557 | + postTitle: title, | |
| 558 | + isLoading: updatePost.isPending, | |
| 559 | + callback: renamePostCallback | |
| 560 | + }); | |
| 561 | + } | |
| 222 | 562 | |
| 223 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/delete.tsx": | |
| 224 | -/*!************************************************************************************************************!*\ | |
| 225 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/delete.tsx ***! | |
| 226 | - \************************************************************************************************************/ | |
| 227 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 563 | +//#endregion | |
| 564 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-reverse-html-entities.ts | |
| 565 | + function useReverseHtmlEntities(escapedHTML = "") { | |
| 566 | + return (0, react.useMemo)(() => { | |
| 567 | + const textarea = document.createElement("textarea"); | |
| 568 | + textarea.innerHTML = escapedHTML; | |
| 569 | + const { value } = textarea; | |
| 570 | + textarea.remove(); | |
| 571 | + return value; | |
| 572 | + }, [escapedHTML]); | |
| 573 | + } | |
| 228 | 574 | |
| 229 | -__webpack_require__.r(__webpack_exports__); | |
| 230 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 231 | -/* harmony export */ "default": function() { return /* binding */ Delete; } | |
| 232 | -/* harmony export */ }); | |
| 233 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 234 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 235 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 236 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 237 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 238 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__); | |
| 239 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 240 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 241 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 242 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); | |
| 243 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 244 | -/* harmony import */ var _hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../hooks/use-posts-actions */ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts-actions.ts"); | |
| 245 | -/* harmony import */ var _action_menu_item__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../action-menu-item */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx"); | |
| 575 | +//#endregion | |
| 576 | +//#region packages/packages/core/editor-site-navigation/src/components/shared/page-title-and-status.tsx | |
| 577 | + var PageStatus = ({ status }) => { | |
| 578 | + if ("publish" === status) return null; | |
| 579 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 580 | + component: "span", | |
| 581 | + variant: "body2", | |
| 582 | + color: "text.secondary", | |
| 583 | + sx: { | |
| 584 | + textTransform: "capitalize", | |
| 585 | + fontStyle: "italic", | |
| 586 | + whiteSpace: "nowrap", | |
| 587 | + flexBasis: "content" | |
| 588 | + } | |
| 589 | + }, "(", status, ")"); | |
| 590 | + }; | |
| 591 | + var PageTitle = ({ title }) => { | |
| 592 | + const modifiedTitle = useReverseHtmlEntities(title); | |
| 593 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 594 | + component: "span", | |
| 595 | + variant: "body2", | |
| 596 | + color: "text.secondary", | |
| 597 | + noWrap: true, | |
| 598 | + sx: { flexBasis: "auto" } | |
| 599 | + }, modifiedTitle); | |
| 600 | + }; | |
| 601 | + function PageTitleAndStatus({ title, status }) { | |
| 602 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { display: "flex" }, /* @__PURE__ */ react.createElement(PageTitle, { title }), "\xA0", /* @__PURE__ */ react.createElement(PageStatus, { status })); | |
| 603 | + } | |
| 246 | 604 | |
| 605 | +//#endregion | |
| 606 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx | |
| 607 | + function ActionMenuItem({ title, icon: Icon, MenuItemProps }) { | |
| 608 | + return /* @__PURE__ */ react.createElement(_elementor_ui.MenuItem, { ...MenuItemProps }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemIcon, { sx: { color: "inherit" } }, /* @__PURE__ */ react.createElement(Icon, null)), /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { primary: title })); | |
| 609 | + } | |
| 247 | 610 | |
| 611 | +//#endregion | |
| 612 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/delete.tsx | |
| 613 | + function Delete({ post }) { | |
| 614 | + const [isDialogOpen, setIsDialogOpen] = (0, react.useState)(false); | |
| 615 | + const isPostActive = (0, _elementor_editor_documents.__useActiveDocument)()?.id === post.id; | |
| 616 | + const isDisabled = !post.user_can.delete || post.isHome || isPostActive; | |
| 617 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(ActionMenuItem, { | |
| 618 | + title: (0, _wordpress_i18n.__)("Delete", "elementor"), | |
| 619 | + icon: _elementor_icons.TrashIcon, | |
| 620 | + MenuItemProps: { | |
| 621 | + disabled: isDisabled, | |
| 622 | + onClick: () => setIsDialogOpen(true), | |
| 623 | + sx: { "&:hover": { color: "error.main" } } | |
| 624 | + } | |
| 625 | + }), isDialogOpen && /* @__PURE__ */ react.createElement(DeleteDialog, { | |
| 626 | + post, | |
| 627 | + setIsDialogOpen | |
| 628 | + })); | |
| 629 | + } | |
| 630 | + function DeleteDialog({ post, setIsDialogOpen }) { | |
| 631 | + const { type } = usePostListContext(); | |
| 632 | + const { deletePost } = usePostActions(type); | |
| 633 | + const { setError } = usePostListContext(); | |
| 634 | + const dialogTitle = (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Delete \"%s\"?", "elementor"), post.title.rendered); | |
| 635 | + const deletePage = async () => { | |
| 636 | + try { | |
| 637 | + await deletePost.mutateAsync(post.id); | |
| 638 | + } catch { | |
| 639 | + setError(); | |
| 640 | + setIsDialogOpen(false); | |
| 641 | + } | |
| 642 | + }; | |
| 643 | + const handleCancel = () => { | |
| 644 | + if (deletePost.isPending) return; | |
| 645 | + setIsDialogOpen(false); | |
| 646 | + }; | |
| 647 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Dialog, { | |
| 648 | + open: true, | |
| 649 | + onClose: handleCancel, | |
| 650 | + "aria-labelledby": "delete-dialog" | |
| 651 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(_elementor_ui.DialogContent, null, /* @__PURE__ */ react.createElement(_elementor_ui.DialogContentText, null, (0, _wordpress_i18n.__)("The page and its content will be deleted forever and we won’t be able to recover them.", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.DialogActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Button, { | |
| 652 | + variant: "contained", | |
| 653 | + color: "secondary", | |
| 654 | + onClick: handleCancel, | |
| 655 | + disabled: deletePost.isPending | |
| 656 | + }, (0, _wordpress_i18n.__)("Cancel", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Button, { | |
| 657 | + variant: "contained", | |
| 658 | + color: "error", | |
| 659 | + onClick: deletePage, | |
| 660 | + disabled: deletePost.isPending | |
| 661 | + }, !deletePost.isPending ? (0, _wordpress_i18n.__)("Delete", "elementor") : /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, null)))); | |
| 662 | + } | |
| 248 | 663 | |
| 664 | +//#endregion | |
| 665 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/duplicate.tsx | |
| 666 | + function Duplicate({ post, popupState }) { | |
| 667 | + const { setEditMode } = usePostListContext(); | |
| 668 | + const { data: user } = useUser(); | |
| 669 | + const onClick = () => { | |
| 670 | + popupState.close(); | |
| 671 | + setEditMode({ | |
| 672 | + mode: "duplicate", | |
| 673 | + details: { | |
| 674 | + postId: post.id, | |
| 675 | + title: post.title.rendered | |
| 676 | + } | |
| 677 | + }); | |
| 678 | + }; | |
| 679 | + const isDisabled = !user?.capabilities?.edit_pages; | |
| 680 | + return /* @__PURE__ */ react.createElement(ActionMenuItem, { | |
| 681 | + title: (0, _wordpress_i18n.__)("Duplicate", "elementor"), | |
| 682 | + icon: _elementor_icons.CopyIcon, | |
| 683 | + MenuItemProps: { | |
| 684 | + disabled: isDisabled, | |
| 685 | + onClick | |
| 686 | + } | |
| 687 | + }); | |
| 688 | + } | |
| 249 | 689 | |
| 690 | +//#endregion | |
| 691 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/rename.tsx | |
| 692 | + function Rename({ post }) { | |
| 693 | + const { setEditMode } = usePostListContext(); | |
| 694 | + return /* @__PURE__ */ react.createElement(ActionMenuItem, { | |
| 695 | + title: (0, _wordpress_i18n.__)("Rename", "elementor"), | |
| 696 | + icon: _elementor_icons.EraseIcon, | |
| 697 | + MenuItemProps: { | |
| 698 | + disabled: !post.user_can.edit, | |
| 699 | + onClick: () => { | |
| 700 | + setEditMode({ | |
| 701 | + mode: "rename", | |
| 702 | + details: { postId: post.id } | |
| 703 | + }); | |
| 704 | + } | |
| 705 | + } | |
| 706 | + }); | |
| 707 | + } | |
| 250 | 708 | |
| 709 | +//#endregion | |
| 710 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-homepage-actions.ts | |
| 711 | + function useHomepageActions() { | |
| 712 | + const invalidateSettings = useInvalidateSettings(); | |
| 713 | + const onSuccess = async () => invalidateSettings({ exact: true }); | |
| 714 | + return { updateSettingsMutation: (0, _elementor_query.useMutation)({ | |
| 715 | + mutationFn: (settings) => updateSettings(settings), | |
| 716 | + onSuccess | |
| 717 | + }) }; | |
| 718 | + } | |
| 719 | + function useInvalidateSettings() { | |
| 720 | + const queryClient = (0, _elementor_query.useQueryClient)(); | |
| 721 | + return (options = {}) => { | |
| 722 | + const queryKey = settingsQueryKey(); | |
| 723 | + return queryClient.invalidateQueries({ queryKey }, options); | |
| 724 | + }; | |
| 725 | + } | |
| 251 | 726 | |
| 727 | +//#endregion | |
| 728 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/set-home.tsx | |
| 729 | + function SetHome({ post, closeMenu }) { | |
| 730 | + const { updateSettingsMutation } = useHomepageActions(); | |
| 731 | + const { setError } = usePostListContext(); | |
| 732 | + const { data: user } = useUser(); | |
| 733 | + const handleClick = async () => { | |
| 734 | + try { | |
| 735 | + await updateSettingsMutation.mutateAsync({ | |
| 736 | + show_on_front: "page", | |
| 737 | + page_on_front: post.id | |
| 738 | + }); | |
| 739 | + } catch { | |
| 740 | + setError(); | |
| 741 | + } finally { | |
| 742 | + closeMenu(); | |
| 743 | + } | |
| 744 | + }; | |
| 745 | + const canManageOptions = !!user?.capabilities?.manage_options; | |
| 746 | + const isPostPublished = post.status === "publish"; | |
| 747 | + const isPostHomepage = !!post.isHome; | |
| 748 | + const isDisabled = !canManageOptions || isPostHomepage || !isPostPublished || updateSettingsMutation.isPending; | |
| 749 | + return /* @__PURE__ */ react.createElement(ActionMenuItem, { | |
| 750 | + title: (0, _wordpress_i18n.__)("Set as homepage", "elementor"), | |
| 751 | + icon: !updateSettingsMutation.isPending ? _elementor_icons.HomeIcon : _elementor_ui.CircularProgress, | |
| 752 | + MenuItemProps: { | |
| 753 | + disabled: isDisabled, | |
| 754 | + onClick: handleClick | |
| 755 | + } | |
| 756 | + }); | |
| 757 | + } | |
| 252 | 758 | |
| 759 | +//#endregion | |
| 760 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/view.tsx | |
| 761 | + function View({ post }) { | |
| 762 | + const { type } = usePostListContext(); | |
| 763 | + const title = (0, _wordpress_i18n.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name); | |
| 764 | + return /* @__PURE__ */ react.createElement(ActionMenuItem, { | |
| 765 | + title, | |
| 766 | + icon: _elementor_icons.EyeIcon, | |
| 767 | + MenuItemProps: { onClick: () => window.open(post.link, "_blank") } | |
| 768 | + }); | |
| 769 | + } | |
| 253 | 770 | |
| 771 | +//#endregion | |
| 772 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-view.tsx | |
| 773 | + var DisabledPostTooltip = ({ children, isDisabled }) => { | |
| 774 | + if (isDisabled) { | |
| 775 | + const title = /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { variant: "caption" }, "You cannot edit this page.", /* @__PURE__ */ react.createElement("br", null), "To edit it directly, contact the site owner"); | |
| 776 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, { | |
| 777 | + title, | |
| 778 | + placement: "bottom", | |
| 779 | + arrow: false | |
| 780 | + }, children); | |
| 781 | + } | |
| 782 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, children); | |
| 783 | + }; | |
| 784 | + function ListItemView({ post }) { | |
| 785 | + const activeDocument = (0, _elementor_editor_documents.__useActiveDocument)(); | |
| 786 | + const navigateToDocument = (0, _elementor_editor_documents.__useNavigateToDocument)(); | |
| 787 | + const popupState = (0, _elementor_ui.usePopupState)({ | |
| 788 | + variant: "popover", | |
| 789 | + popupId: "post-actions", | |
| 790 | + disableAutoFocus: true | |
| 791 | + }); | |
| 792 | + const isActive = activeDocument?.id === post.id; | |
| 793 | + const status = isActive ? activeDocument?.status.value : post.status; | |
| 794 | + const title = isActive ? activeDocument?.title : post.title.rendered; | |
| 795 | + const isDisabled = !post.user_can.edit; | |
| 796 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(DisabledPostTooltip, { isDisabled }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItem, { | |
| 797 | + disablePadding: true, | |
| 798 | + secondaryAction: /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, { | |
| 799 | + value: true, | |
| 800 | + size: "small", | |
| 801 | + ...(0, _elementor_ui.bindTrigger)(popupState) | |
| 802 | + }, /* @__PURE__ */ react.createElement(_elementor_icons.DotsVerticalIcon, { fontSize: "small" })) | |
| 803 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemButton, { | |
| 804 | + selected: isActive, | |
| 805 | + disabled: isDisabled, | |
| 806 | + onClick: () => { | |
| 807 | + if (!isActive) navigateToDocument(post.id); | |
| 808 | + }, | |
| 809 | + dense: true | |
| 810 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { disableTypography: true }, /* @__PURE__ */ react.createElement(PageTitleAndStatus, { | |
| 811 | + title, | |
| 812 | + status | |
| 813 | + })), post.isHome && /* @__PURE__ */ react.createElement(_elementor_icons.HomeIcon, { | |
| 814 | + titleAccess: (0, _wordpress_i18n.__)("Homepage", "elementor"), | |
| 815 | + color: "disabled" | |
| 816 | + })))), /* @__PURE__ */ react.createElement(_elementor_ui.Menu, { | |
| 817 | + PaperProps: { sx: { | |
| 818 | + mt: 2, | |
| 819 | + width: 200 | |
| 820 | + } }, | |
| 821 | + MenuListProps: { dense: true }, | |
| 822 | + ...(0, _elementor_ui.bindMenu)(popupState) | |
| 823 | + }, /* @__PURE__ */ react.createElement(Rename, { post }), /* @__PURE__ */ react.createElement(Duplicate, { | |
| 824 | + post, | |
| 825 | + popupState | |
| 826 | + }), /* @__PURE__ */ react.createElement(Delete, { post }), /* @__PURE__ */ react.createElement(View, { post }), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(SetHome, { | |
| 827 | + post, | |
| 828 | + closeMenu: () => popupState.close() | |
| 829 | + }))); | |
| 830 | + } | |
| 254 | 831 | |
| 255 | -function Delete({ | |
| 256 | - post | |
| 257 | -}) { | |
| 258 | - const [isDialogOpen, setIsDialogOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); | |
| 259 | - const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useActiveDocument)(); | |
| 260 | - const isPostActive = activeDocument?.id === post.id; | |
| 261 | - const userCanDelete = post.user_can.delete; | |
| 262 | - const isDisabled = !userCanDelete || post.isHome || isPostActive; | |
| 263 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_action_menu_item__WEBPACK_IMPORTED_MODULE_7__["default"], { | |
| 264 | - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Delete', 'elementor'), | |
| 265 | - icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.TrashIcon, | |
| 266 | - MenuItemProps: { | |
| 267 | - disabled: isDisabled, | |
| 268 | - onClick: () => setIsDialogOpen(true), | |
| 269 | - sx: { | |
| 270 | - '&:hover': { | |
| 271 | - color: 'error.main' | |
| 272 | - } | |
| 273 | - } | |
| 274 | - } | |
| 275 | - }), isDialogOpen && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(DeleteDialog, { | |
| 276 | - post: post, | |
| 277 | - setIsDialogOpen: setIsDialogOpen | |
| 278 | - })); | |
| 279 | -} | |
| 280 | -function DeleteDialog({ | |
| 281 | - post, | |
| 282 | - setIsDialogOpen | |
| 283 | -}) { | |
| 284 | - const { | |
| 285 | - type | |
| 286 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_5__.usePostListContext)(); | |
| 287 | - const { | |
| 288 | - deletePost | |
| 289 | - } = (0,_hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_6__.usePostActions)(type); | |
| 290 | - const { | |
| 291 | - setError | |
| 292 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_5__.usePostListContext)(); | |
| 832 | +//#endregion | |
| 833 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/post-list-item.tsx | |
| 834 | + function PostListItem$1({ post }) { | |
| 835 | + const { editMode } = usePostListContext(); | |
| 836 | + if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) return /* @__PURE__ */ react.createElement(ListItemRename, { post }); | |
| 837 | + if ("create" === editMode.mode && !post) return /* @__PURE__ */ react.createElement(ListItemCreate, null); | |
| 838 | + if ("duplicate" === editMode.mode && !post) return /* @__PURE__ */ react.createElement(ListItemDuplicate, null); | |
| 839 | + if (!post) return null; | |
| 840 | + return /* @__PURE__ */ react.createElement(ListItemView, { post }); | |
| 841 | + } | |
| 842 | + __name(PostListItem$1, "PostListItem"); | |
| 293 | 843 | |
| 294 | - /* translators: %s: Post title. */ | |
| 295 | - const dialogTitle = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Delete "%s"?', 'elementor'), post.title.rendered); | |
| 296 | - const deletePage = async () => { | |
| 297 | - try { | |
| 298 | - await deletePost.mutateAsync(post.id); | |
| 299 | - } catch { | |
| 300 | - setError(); | |
| 301 | - setIsDialogOpen(false); | |
| 302 | - } | |
| 303 | - }; | |
| 304 | - const handleCancel = () => { | |
| 305 | - if (deletePost.isPending) { | |
| 306 | - return; | |
| 307 | - } | |
| 308 | - setIsDialogOpen(false); | |
| 309 | - }; | |
| 310 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Dialog, { | |
| 311 | - open: true, | |
| 312 | - onClose: handleCancel, | |
| 313 | - "aria-labelledby": "delete-dialog" | |
| 314 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.DialogTitle, { | |
| 315 | - noWrap: true | |
| 316 | - }, dialogTitle), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.DialogContent, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.DialogContentText, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('The page and its content will be deleted forever and we won’t be able to recover them.', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.DialogActions, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, { | |
| 317 | - variant: "contained", | |
| 318 | - color: "secondary", | |
| 319 | - onClick: handleCancel, | |
| 320 | - disabled: deletePost.isPending | |
| 321 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Cancel', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, { | |
| 322 | - variant: "contained", | |
| 323 | - color: "error", | |
| 324 | - onClick: deletePage, | |
| 325 | - disabled: deletePost.isPending | |
| 326 | - }, !deletePost.isPending ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Delete', 'elementor') : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.CircularProgress, null)))); | |
| 327 | -} | |
| 844 | +//#endregion | |
| 845 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/posts-list/posts-collapsible-list.tsx | |
| 846 | + function PostsCollapsibleList({ isOpenByDefault = false }) { | |
| 847 | + const { type, editMode } = usePostListContext(); | |
| 848 | + const { data: { posts, total }, isLoading: postsLoading, isError: postsError, fetchNextPage, hasNextPage, isFetchingNextPage } = usePosts(type); | |
| 849 | + const { data: homepageId } = useHomepage(); | |
| 850 | + if (postsError) return /* @__PURE__ */ react.createElement(ErrorState, null); | |
| 851 | + if (!posts || postsLoading) return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { px: 5 } }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { | |
| 852 | + display: "flex", | |
| 853 | + justifyContent: "flex-end", | |
| 854 | + alignItems: "center" | |
| 855 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Skeleton, { | |
| 856 | + sx: { my: 4 }, | |
| 857 | + animation: "wave", | |
| 858 | + variant: "rounded", | |
| 859 | + width: "110px", | |
| 860 | + height: "28px" | |
| 861 | + })), /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, /* @__PURE__ */ react.createElement(_elementor_ui.Skeleton, { | |
| 862 | + sx: { my: 3 }, | |
| 863 | + animation: "wave", | |
| 864 | + variant: "rounded", | |
| 865 | + width: "100%", | |
| 866 | + height: "24px" | |
| 867 | + }), /* @__PURE__ */ react.createElement(_elementor_ui.Skeleton, { | |
| 868 | + sx: { my: 3 }, | |
| 869 | + animation: "wave", | |
| 870 | + variant: "rounded", | |
| 871 | + width: "70%", | |
| 872 | + height: "24px" | |
| 873 | + }), /* @__PURE__ */ react.createElement(_elementor_ui.Skeleton, { | |
| 874 | + sx: { my: 3 }, | |
| 875 | + animation: "wave", | |
| 876 | + variant: "rounded", | |
| 877 | + width: "70%", | |
| 878 | + height: "24px" | |
| 879 | + }), /* @__PURE__ */ react.createElement(_elementor_ui.Skeleton, { | |
| 880 | + sx: { my: 3 }, | |
| 881 | + animation: "wave", | |
| 882 | + variant: "rounded", | |
| 883 | + width: "70%", | |
| 884 | + height: "24px" | |
| 885 | + }))); | |
| 886 | + const label = `${postTypesMap[type].labels.plural_name} (${total.toString()})`; | |
| 887 | + const sortedPosts = posts.map((post) => { | |
| 888 | + if (post.id === homepageId) return { | |
| 889 | + ...post, | |
| 890 | + isHome: true | |
| 891 | + }; | |
| 892 | + return post; | |
| 893 | + }).sort((a, b) => { | |
| 894 | + if (a.id === homepageId) return -1; | |
| 895 | + if (b.id === homepageId) return 1; | |
| 896 | + return 0; | |
| 897 | + }); | |
| 898 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { | |
| 899 | + display: "flex", | |
| 900 | + justifyContent: "flex-end", | |
| 901 | + alignItems: "center", | |
| 902 | + sx: { | |
| 903 | + py: 1, | |
| 904 | + px: 2 | |
| 905 | + } | |
| 906 | + }, /* @__PURE__ */ react.createElement(AddNewButton, null)), /* @__PURE__ */ react.createElement(_elementor_ui.List, { dense: true }, /* @__PURE__ */ react.createElement(CollapsibleList, { | |
| 907 | + label, | |
| 908 | + Icon: _elementor_icons.PageTypeIcon, | |
| 909 | + isOpenByDefault: isOpenByDefault || false | |
| 910 | + }, sortedPosts.map((post) => { | |
| 911 | + return /* @__PURE__ */ react.createElement(PostListItem$1, { | |
| 912 | + key: post.id, | |
| 913 | + post | |
| 914 | + }); | |
| 915 | + }), ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ react.createElement(PostListItem$1, null), hasNextPage && /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { | |
| 916 | + display: "flex", | |
| 917 | + justifyContent: "center" | |
| 918 | + } }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, { | |
| 919 | + onClick: fetchNextPage, | |
| 920 | + color: "secondary" | |
| 921 | + }, isFetchingNextPage ? /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, null) : "Load More"))))); | |
| 922 | + } | |
| 328 | 923 | |
| 329 | -/***/ }), | |
| 924 | +//#endregion | |
| 925 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/shell.tsx | |
| 926 | + var Shell = () => { | |
| 927 | + const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, react.useState)(false); | |
| 928 | + return /* @__PURE__ */ react.createElement(_elementor_editor_panels.Panel, null, /* @__PURE__ */ react.createElement(_elementor_editor_panels.PanelHeader, null, /* @__PURE__ */ react.createElement(_elementor_editor_panels.PanelHeaderTitle, null, (0, _wordpress_i18n.__)("Pages", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_editor_panels.PanelBody, null, /* @__PURE__ */ react.createElement(PostListContextProvider, { | |
| 929 | + type: "page", | |
| 930 | + setError: () => setIsErrorSnackbarOpen(true) | |
| 931 | + }, /* @__PURE__ */ react.createElement(PostsCollapsibleList, { isOpenByDefault: true })), /* @__PURE__ */ react.createElement(ErrorSnackbar, { | |
| 932 | + open: isErrorSnackbarOpen, | |
| 933 | + onClose: () => setIsErrorSnackbarOpen(false) | |
| 934 | + }))); | |
| 935 | + }; | |
| 330 | 936 | |
| 331 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/duplicate.tsx": | |
| 332 | -/*!***************************************************************************************************************!*\ | |
| 333 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/duplicate.tsx ***! | |
| 334 | - \***************************************************************************************************************/ | |
| 335 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 937 | +//#endregion | |
| 938 | +//#region packages/packages/core/editor-site-navigation/src/components/panel/panel.ts | |
| 939 | + var { panel, usePanelStatus, usePanelActions } = (0, _elementor_editor_panels.createPanel)({ | |
| 940 | + id: "site-navigation-panel", | |
| 941 | + component: Shell | |
| 942 | + }); | |
| 336 | 943 | |
| 337 | -__webpack_require__.r(__webpack_exports__); | |
| 338 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 339 | -/* harmony export */ "default": function() { return /* binding */ Duplicate; } | |
| 340 | -/* harmony export */ }); | |
| 341 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 342 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 343 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 344 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 345 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 346 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 347 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 348 | -/* harmony import */ var _hooks_use_user__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../hooks/use-user */ "./packages/packages/core/editor-site-navigation/src/hooks/use-user.ts"); | |
| 349 | -/* harmony import */ var _action_menu_item__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../action-menu-item */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx"); | |
| 944 | +//#endregion | |
| 945 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-create-page.ts | |
| 946 | + var endpointPath = "/elementor/v1/site-navigation/add-new-post"; | |
| 947 | + function useCreatePage() { | |
| 948 | + const [isLoading, setIsLoading] = (0, react.useState)(false); | |
| 949 | + return { | |
| 950 | + create: () => { | |
| 951 | + setIsLoading(true); | |
| 952 | + return addNewPage().then((newPost) => newPost).finally(() => setIsLoading(false)); | |
| 953 | + }, | |
| 954 | + isLoading | |
| 955 | + }; | |
| 956 | + } | |
| 957 | + async function addNewPage() { | |
| 958 | + return await (0, _wordpress_api_fetch.default)({ | |
| 959 | + path: endpointPath, | |
| 960 | + method: "POST", | |
| 961 | + data: { post_type: "page" } | |
| 962 | + }); | |
| 963 | + } | |
| 350 | 964 | |
| 965 | +//#endregion | |
| 966 | +//#region packages/packages/core/editor-site-navigation/src/components/top-bar/create-post-list-item.tsx | |
| 967 | + function CreatePostListItem({ closePopup, ...props }) { | |
| 968 | + const { create, isLoading } = useCreatePage(); | |
| 969 | + const navigateToDocument = (0, _elementor_editor_documents.__useNavigateToDocument)(); | |
| 970 | + const { data: user } = useUser(); | |
| 971 | + const { dispatchEvent, config } = (0, _elementor_events.useMixpanel)(); | |
| 972 | + return /* @__PURE__ */ react.createElement(_elementor_ui.MenuItem, { | |
| 973 | + disabled: isLoading || !user?.capabilities?.edit_pages, | |
| 974 | + onClick: async () => { | |
| 975 | + const eventName = config?.names?.editorOne?.topBarPageList; | |
| 976 | + if (eventName) dispatchEvent?.(eventName, { | |
| 977 | + window_name: config?.appTypes?.editor, | |
| 978 | + interaction_type: config?.triggers?.click?.toLowerCase(), | |
| 979 | + target_type: config?.targetTypes?.dropdownItem, | |
| 980 | + target_name: config?.targetNames?.pageList?.addNewPage, | |
| 981 | + interaction_result: config?.interactionResults?.create, | |
| 982 | + target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(), | |
| 983 | + location_l1: config?.secondaryLocations?.pageListDropdown?.replace(/\s+/g, "_").toLowerCase(), | |
| 984 | + location_l2: config?.targetTypes?.dropdownItem | |
| 985 | + }); | |
| 986 | + const { id } = await create(); | |
| 987 | + closePopup(); | |
| 988 | + await navigateToDocument(id); | |
| 989 | + }, | |
| 990 | + ...props | |
| 991 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemIcon, null, isLoading ? /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ react.createElement(_elementor_icons.PlusIcon, { fontSize: "small" })), /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { | |
| 992 | + primaryTypographyProps: { variant: "body2" }, | |
| 993 | + primary: (0, _wordpress_i18n.__)("Add new page", "elementor") | |
| 994 | + })); | |
| 995 | + } | |
| 351 | 996 | |
| 997 | +//#endregion | |
| 998 | +//#region packages/packages/core/editor-site-navigation/src/components/top-bar/indicator.tsx | |
| 999 | + function Indicator({ title, status }) { | |
| 1000 | + return /* @__PURE__ */ react.createElement(Tooltip, { title }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { | |
| 1001 | + component: "span", | |
| 1002 | + direction: "row", | |
| 1003 | + alignItems: "center", | |
| 1004 | + spacing: .5 | |
| 1005 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 1006 | + component: "span", | |
| 1007 | + variant: "body2", | |
| 1008 | + sx: { maxWidth: "120px" }, | |
| 1009 | + noWrap: true | |
| 1010 | + }, title), status.value !== "publish" && /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 1011 | + component: "span", | |
| 1012 | + variant: "body2", | |
| 1013 | + sx: { fontStyle: "italic" } | |
| 1014 | + }, "(", status.label, ")"))); | |
| 1015 | + } | |
| 1016 | + function Tooltip(props) { | |
| 1017 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, { | |
| 1018 | + PopperProps: { sx: { "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { mt: 2.7 } } }, | |
| 1019 | + ...props | |
| 1020 | + }); | |
| 1021 | + } | |
| 352 | 1022 | |
| 1023 | +//#endregion | |
| 1024 | +//#region packages/packages/core/editor-site-navigation/src/components/top-bar/chip-doc-type.tsx | |
| 1025 | + var iconsMap = getIconsMap(); | |
| 1026 | + function DocTypeChip({ postType, docType, label }) { | |
| 1027 | + const color = "elementor_library" === postType ? "global" : "primary"; | |
| 1028 | + const Icon = iconsMap[docType] || _elementor_icons.PostTypeIcon; | |
| 1029 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Chip, { | |
| 1030 | + component: "span", | |
| 1031 | + size: "small", | |
| 1032 | + variant: "outlined", | |
| 1033 | + label, | |
| 1034 | + "data-value": docType, | |
| 1035 | + color, | |
| 1036 | + icon: /* @__PURE__ */ react.createElement(Icon, null), | |
| 1037 | + sx: { | |
| 1038 | + ml: 1, | |
| 1039 | + cursor: "inherit" | |
| 1040 | + } | |
| 1041 | + }); | |
| 1042 | + } | |
| 353 | 1043 | |
| 1044 | +//#endregion | |
| 1045 | +//#region packages/packages/core/editor-site-navigation/src/components/top-bar/post-list-item.tsx | |
| 1046 | + function PostListItem({ post, closePopup, ...props }) { | |
| 1047 | + const navigateToDocument = (0, _elementor_editor_documents.__useNavigateToDocument)(); | |
| 1048 | + const postTitle = useReverseHtmlEntities(post.title); | |
| 1049 | + const { dispatchEvent, config } = (0, _elementor_events.useMixpanel)(); | |
| 1050 | + return /* @__PURE__ */ react.createElement(_elementor_ui.MenuItem, { | |
| 1051 | + disabled: !post.user_can.edit, | |
| 1052 | + onClick: async () => { | |
| 1053 | + const eventName = config?.names?.editorOne?.topBarPageList; | |
| 1054 | + if (eventName) dispatchEvent?.(eventName, { | |
| 1055 | + window_name: config?.appTypes?.editor, | |
| 1056 | + interaction_type: config?.triggers?.click?.toLowerCase(), | |
| 1057 | + target_type: config?.targetTypes?.dropdownItem, | |
| 1058 | + target_name: postTitle, | |
| 1059 | + interaction_result: config?.interactionResults?.navigate, | |
| 1060 | + target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(), | |
| 1061 | + location_l1: config?.secondaryLocations?.pageListDropdown?.replace(/\s+/g, "_").toLowerCase(), | |
| 1062 | + location_l2: config?.targetTypes?.dropdownItem | |
| 1063 | + }); | |
| 1064 | + closePopup(); | |
| 1065 | + await navigateToDocument(post.id); | |
| 1066 | + }, | |
| 1067 | + ...props | |
| 1068 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { | |
| 1069 | + sx: { flexGrow: 0 }, | |
| 1070 | + primaryTypographyProps: { | |
| 1071 | + variant: "body2", | |
| 1072 | + noWrap: true | |
| 1073 | + }, | |
| 1074 | + primary: postTitle | |
| 1075 | + }), /* @__PURE__ */ react.createElement(DocTypeChip, { | |
| 1076 | + postType: post.type.post_type, | |
| 1077 | + docType: post.type.doc_type, | |
| 1078 | + label: post.type.label | |
| 1079 | + })); | |
| 1080 | + } | |
| 354 | 1081 | |
| 1082 | +//#endregion | |
| 1083 | +//#region packages/packages/core/editor-site-navigation/src/components/top-bar/recently-edited.tsx | |
| 1084 | + function RecentlyEdited() { | |
| 1085 | + const activeDocument = (0, _elementor_editor_documents.__useActiveDocument)(); | |
| 1086 | + const hostDocument = (0, _elementor_editor_documents.__useHostDocument)(); | |
| 1087 | + const document = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument; | |
| 1088 | + const { data } = useRecentPosts(); | |
| 1089 | + const getRecentPosts = () => { | |
| 1090 | + if (!data) return []; | |
| 1091 | + return data.filter((post) => post.id !== document?.id).splice(0, 6 - 1); | |
| 1092 | + }; | |
| 1093 | + const recentPosts = getRecentPosts(); | |
| 1094 | + const popupState = (0, _elementor_ui.usePopupState)({ | |
| 1095 | + variant: "popover", | |
| 1096 | + popupId: "elementor-v2-top-bar-recently-edited" | |
| 1097 | + }); | |
| 1098 | + const documentTitle = useReverseHtmlEntities(document?.title); | |
| 1099 | + if (!document) return null; | |
| 1100 | + const buttonProps = (0, _elementor_ui.bindTrigger)(popupState); | |
| 1101 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Button, { | |
| 1102 | + color: "inherit", | |
| 1103 | + size: "small", | |
| 1104 | + endIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ChevronDownIcon, { fontSize: "small" }), | |
| 1105 | + ...buttonProps, | |
| 1106 | + onClick: (e) => { | |
| 1107 | + const extendedWindow = window; | |
| 1108 | + const config = extendedWindow?.elementorCommon?.eventsManager?.config; | |
| 1109 | + if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.documentNameDropdown, { | |
| 1110 | + location: config.locations.topBar, | |
| 1111 | + secondaryLocation: config.secondaryLocations.documentNameDropdown, | |
| 1112 | + trigger: config.triggers.dropdownClick, | |
| 1113 | + element: config.elements.dropdown | |
| 1114 | + }); | |
| 1115 | + buttonProps.onClick(e); | |
| 1116 | + } | |
| 1117 | + }, /* @__PURE__ */ react.createElement(Indicator, { | |
| 1118 | + title: documentTitle, | |
| 1119 | + status: document.status | |
| 1120 | + })), /* @__PURE__ */ react.createElement(_elementor_ui.Menu, { | |
| 1121 | + MenuListProps: { subheader: /* @__PURE__ */ react.createElement(_elementor_ui.ListSubheader, { | |
| 1122 | + color: "primary", | |
| 1123 | + sx: { | |
| 1124 | + fontStyle: "italic", | |
| 1125 | + fontWeight: "300" | |
| 1126 | + } | |
| 1127 | + }, (0, _wordpress_i18n.__)("Recent", "elementor")) }, | |
| 1128 | + PaperProps: { sx: { | |
| 1129 | + mt: 2.5, | |
| 1130 | + width: 320 | |
| 1131 | + } }, | |
| 1132 | + ...(0, _elementor_ui.bindMenu)(popupState) | |
| 1133 | + }, recentPosts.map((post) => /* @__PURE__ */ react.createElement(PostListItem, { | |
| 1134 | + key: post.id, | |
| 1135 | + post, | |
| 1136 | + closePopup: popupState.close | |
| 1137 | + })), recentPosts.length === 0 && /* @__PURE__ */ react.createElement(_elementor_ui.MenuItem, { disabled: true }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { | |
| 1138 | + primaryTypographyProps: { | |
| 1139 | + variant: "caption", | |
| 1140 | + fontStyle: "italic" | |
| 1141 | + }, | |
| 1142 | + primary: (0, _wordpress_i18n.__)("There are no other pages or templates on this site yet.", "elementor") | |
| 1143 | + })), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, { disabled: recentPosts.length === 0 }), /* @__PURE__ */ react.createElement(CreatePostListItem, { closePopup: popupState.close }))); | |
| 1144 | + } | |
| 355 | 1145 | |
| 356 | -function Duplicate({ | |
| 357 | - post, | |
| 358 | - popupState | |
| 359 | -}) { | |
| 360 | - const { | |
| 361 | - setEditMode | |
| 362 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__.usePostListContext)(); | |
| 363 | - const { | |
| 364 | - data: user | |
| 365 | - } = (0,_hooks_use_user__WEBPACK_IMPORTED_MODULE_4__["default"])(); | |
| 366 | - const onClick = () => { | |
| 367 | - popupState.close(); | |
| 368 | - setEditMode({ | |
| 369 | - mode: 'duplicate', | |
| 370 | - details: { | |
| 371 | - postId: post.id, | |
| 372 | - title: post.title.rendered | |
| 373 | - } | |
| 374 | - }); | |
| 375 | - }; | |
| 376 | - const isDisabled = !user?.capabilities?.edit_pages; | |
| 377 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_action_menu_item__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 378 | - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Duplicate', 'elementor'), | |
| 379 | - icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_1__.CopyIcon, | |
| 380 | - MenuItemProps: { | |
| 381 | - disabled: isDisabled, | |
| 382 | - onClick | |
| 383 | - } | |
| 384 | - }); | |
| 385 | -} | |
| 1146 | +//#endregion | |
| 1147 | +//#region packages/packages/core/editor-site-navigation/src/env.ts | |
| 1148 | + var { env } = (0, _elementor_env.parseEnv)("@elementor/editor-site-navigation", (envData) => { | |
| 1149 | + return envData; | |
| 1150 | + }); | |
| 386 | 1151 | |
| 387 | -/***/ }), | |
| 1152 | +//#endregion | |
| 1153 | +//#region packages/packages/core/editor-site-navigation/src/hooks/use-toggle-button-props.ts | |
| 1154 | + function useToggleButtonProps() { | |
| 1155 | + const { isOpen: selectedState, isBlocked } = usePanelStatus(); | |
| 1156 | + const { open, close } = usePanelActions(); | |
| 1157 | + return { | |
| 1158 | + title: (0, _wordpress_i18n.__)("Pages", "elementor"), | |
| 1159 | + icon: _elementor_icons.PagesIcon, | |
| 1160 | + onClick: () => { | |
| 1161 | + const extendedWindow = window; | |
| 1162 | + const config = extendedWindow?.elementorCommon?.eventsManager?.config; | |
| 1163 | + if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent("top_bar_pages", { | |
| 1164 | + location: config.locations.topBar, | |
| 1165 | + secondaryLocation: config.secondaryLocations.elementorLogo, | |
| 1166 | + trigger: config.triggers.click, | |
| 1167 | + element: config.elements.buttonIcon | |
| 1168 | + }); | |
| 1169 | + return selectedState ? close() : open(); | |
| 1170 | + }, | |
| 1171 | + selected: selectedState, | |
| 1172 | + disabled: isBlocked | |
| 1173 | + }; | |
| 1174 | + } | |
| 388 | 1175 | |
| 389 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/rename.tsx": | |
| 390 | -/*!************************************************************************************************************!*\ | |
| 391 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/rename.tsx ***! | |
| 392 | - \************************************************************************************************************/ | |
| 393 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1176 | +//#endregion | |
| 1177 | +//#region packages/packages/core/editor-site-navigation/src/init.ts | |
| 1178 | + function init() { | |
| 1179 | + registerTopBarMenuItems(); | |
| 1180 | + if (env.is_pages_panel_active) { | |
| 1181 | + (0, _elementor_editor_panels.registerPanel)(panel); | |
| 1182 | + registerButton(); | |
| 1183 | + } | |
| 1184 | + } | |
| 1185 | + function registerTopBarMenuItems() { | |
| 1186 | + (0, _elementor_editor_app_bar.injectIntoPageIndication)({ | |
| 1187 | + id: "document-recently-edited", | |
| 1188 | + component: RecentlyEdited | |
| 1189 | + }); | |
| 1190 | + } | |
| 1191 | + function registerButton() { | |
| 1192 | + _elementor_editor_app_bar.toolsMenu.registerToggleAction({ | |
| 1193 | + id: "toggle-site-navigation-panel", | |
| 1194 | + priority: 6, | |
| 1195 | + useProps: useToggleButtonProps | |
| 1196 | + }); | |
| 1197 | + } | |
| 394 | 1198 | |
| 395 | -__webpack_require__.r(__webpack_exports__); | |
| 396 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 397 | -/* harmony export */ "default": function() { return /* binding */ Rename; } | |
| 398 | -/* harmony export */ }); | |
| 399 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 400 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 401 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 402 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 403 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 404 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 405 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 406 | -/* harmony import */ var _action_menu_item__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../action-menu-item */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx"); | |
| 1199 | +//#endregion | |
| 1200 | +//#region packages/packages/core/editor-site-navigation/src/index.ts | |
| 1201 | + var src_exports = /* @__PURE__ */ __exportAll({ | |
| 1202 | + extendIconsMap: () => extendIconsMap, | |
| 1203 | + init: () => init | |
| 1204 | + }); | |
| 407 | 1205 | |
| 1206 | +//#endregion | |
| 1207 | +//#region \0elementor-package-library-entry | |
| 1208 | + (window.elementorV2 = window.elementorV2 || {}).editorSiteNavigation = src_exports; | |
| 408 | 1209 | |
| 409 | - | |
| 410 | - | |
| 411 | - | |
| 412 | -function Rename({ | |
| 413 | - post | |
| 414 | -}) { | |
| 415 | - const { | |
| 416 | - setEditMode | |
| 417 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__.usePostListContext)(); | |
| 418 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_action_menu_item__WEBPACK_IMPORTED_MODULE_4__["default"], { | |
| 419 | - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Rename', 'elementor'), | |
| 420 | - icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_1__.EraseIcon, | |
| 421 | - MenuItemProps: { | |
| 422 | - disabled: !post.user_can.edit, | |
| 423 | - onClick: () => { | |
| 424 | - setEditMode({ | |
| 425 | - mode: 'rename', | |
| 426 | - details: { | |
| 427 | - postId: post.id | |
| 428 | - } | |
| 429 | - }); | |
| 430 | - } | |
| 431 | - } | |
| 432 | - }); | |
| 433 | -} | |
| 434 | - | |
| 435 | -/***/ }), | |
| 436 | - | |
| 437 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/set-home.tsx": | |
| 438 | -/*!**************************************************************************************************************!*\ | |
| 439 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/set-home.tsx ***! | |
| 440 | - \**************************************************************************************************************/ | |
| 441 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 442 | - | |
| 443 | -__webpack_require__.r(__webpack_exports__); | |
| 444 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 445 | -/* harmony export */ "default": function() { return /* binding */ SetHome; } | |
| 446 | -/* harmony export */ }); | |
| 447 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 448 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 449 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 450 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 451 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 452 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 453 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 454 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 455 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 456 | -/* harmony import */ var _hooks_use_homepage_actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../hooks/use-homepage-actions */ "./packages/packages/core/editor-site-navigation/src/hooks/use-homepage-actions.ts"); | |
| 457 | -/* harmony import */ var _hooks_use_user__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../hooks/use-user */ "./packages/packages/core/editor-site-navigation/src/hooks/use-user.ts"); | |
| 458 | -/* harmony import */ var _action_menu_item__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../action-menu-item */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx"); | |
| 459 | - | |
| 460 | - | |
| 461 | - | |
| 462 | - | |
| 463 | - | |
| 464 | - | |
| 465 | - | |
| 466 | - | |
| 467 | -function SetHome({ | |
| 468 | - post, | |
| 469 | - closeMenu | |
| 470 | -}) { | |
| 471 | - const { | |
| 472 | - updateSettingsMutation | |
| 473 | - } = (0,_hooks_use_homepage_actions__WEBPACK_IMPORTED_MODULE_5__.useHomepageActions)(); | |
| 474 | - const { | |
| 475 | - setError | |
| 476 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__.usePostListContext)(); | |
| 477 | - const { | |
| 478 | - data: user | |
| 479 | - } = (0,_hooks_use_user__WEBPACK_IMPORTED_MODULE_6__["default"])(); | |
| 480 | - const handleClick = async () => { | |
| 481 | - try { | |
| 482 | - await updateSettingsMutation.mutateAsync({ | |
| 483 | - show_on_front: 'page', | |
| 484 | - page_on_front: post.id | |
| 485 | - }); | |
| 486 | - } catch { | |
| 487 | - setError(); | |
| 488 | - } finally { | |
| 489 | - closeMenu(); | |
| 490 | - } | |
| 491 | - }; | |
| 492 | - const canManageOptions = !!user?.capabilities?.manage_options; | |
| 493 | - const isPostPublished = post.status === 'publish'; | |
| 494 | - const isPostHomepage = !!post.isHome; | |
| 495 | - const isDisabled = !canManageOptions || isPostHomepage || !isPostPublished || updateSettingsMutation.isPending; | |
| 496 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_action_menu_item__WEBPACK_IMPORTED_MODULE_7__["default"], { | |
| 497 | - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Set as homepage', 'elementor'), | |
| 498 | - icon: !updateSettingsMutation.isPending ? _elementor_icons__WEBPACK_IMPORTED_MODULE_1__.HomeIcon : _elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CircularProgress, | |
| 499 | - MenuItemProps: { | |
| 500 | - disabled: isDisabled, | |
| 501 | - onClick: handleClick | |
| 502 | - } | |
| 503 | - }); | |
| 504 | -} | |
| 505 | - | |
| 506 | -/***/ }), | |
| 507 | - | |
| 508 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/view.tsx": | |
| 509 | -/*!**********************************************************************************************************!*\ | |
| 510 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/view.tsx ***! | |
| 511 | - \**********************************************************************************************************/ | |
| 512 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 513 | - | |
| 514 | -__webpack_require__.r(__webpack_exports__); | |
| 515 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 516 | -/* harmony export */ "default": function() { return /* binding */ View; } | |
| 517 | -/* harmony export */ }); | |
| 518 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 519 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 520 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 521 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 522 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 523 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 524 | -/* harmony import */ var _api_post__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../api/post */ "./packages/packages/core/editor-site-navigation/src/api/post.ts"); | |
| 525 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 526 | -/* harmony import */ var _action_menu_item__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../action-menu-item */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/action-menu-item.tsx"); | |
| 527 | - | |
| 528 | - | |
| 529 | - | |
| 530 | - | |
| 531 | - | |
| 532 | - | |
| 533 | -function View({ | |
| 534 | - post | |
| 535 | -}) { | |
| 536 | - const { | |
| 537 | - type | |
| 538 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__.usePostListContext)(); | |
| 539 | - | |
| 540 | - // translators: %s: Post type (e.g. Page, Post, etc.) | |
| 541 | - const title = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('View %s', 'elementor').replace('%s', _api_post__WEBPACK_IMPORTED_MODULE_3__.postTypesMap[type].labels.singular_name); | |
| 542 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_action_menu_item__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 543 | - title: title, | |
| 544 | - icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_1__.EyeIcon, | |
| 545 | - MenuItemProps: { | |
| 546 | - onClick: () => window.open(post.link, '_blank') | |
| 547 | - } | |
| 548 | - }); | |
| 549 | -} | |
| 550 | - | |
| 551 | -/***/ }), | |
| 552 | - | |
| 553 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/add-new-button.tsx": | |
| 554 | -/*!***********************************************************************************************!*\ | |
| 555 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/add-new-button.tsx ***! | |
| 556 | - \***********************************************************************************************/ | |
| 557 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 558 | - | |
| 559 | -__webpack_require__.r(__webpack_exports__); | |
| 560 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 561 | -/* harmony export */ "default": function() { return /* binding */ AddNewButton; } | |
| 562 | -/* harmony export */ }); | |
| 563 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 564 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 565 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 566 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 567 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 568 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 569 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 570 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 571 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 572 | -/* harmony import */ var _hooks_use_user__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../hooks/use-user */ "./packages/packages/core/editor-site-navigation/src/hooks/use-user.ts"); | |
| 573 | - | |
| 574 | - | |
| 575 | - | |
| 576 | - | |
| 577 | - | |
| 578 | - | |
| 579 | -function AddNewButton() { | |
| 580 | - const { | |
| 581 | - setEditMode | |
| 582 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__.usePostListContext)(); | |
| 583 | - const { | |
| 584 | - data: user | |
| 585 | - } = (0,_hooks_use_user__WEBPACK_IMPORTED_MODULE_5__["default"])(); | |
| 586 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, { | |
| 587 | - size: 'small', | |
| 588 | - startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PlusIcon, null), | |
| 589 | - disabled: !user?.capabilities?.edit_pages, | |
| 590 | - onClick: () => { | |
| 591 | - setEditMode({ | |
| 592 | - mode: 'create', | |
| 593 | - details: {} | |
| 594 | - }); | |
| 595 | - }, | |
| 596 | - sx: { | |
| 597 | - px: 1.5 | |
| 598 | - } | |
| 599 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Add New', 'elementor')); | |
| 600 | -} | |
| 601 | - | |
| 602 | -/***/ }), | |
| 603 | - | |
| 604 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/error-snackbar.tsx": | |
| 605 | -/*!***********************************************************************************************!*\ | |
| 606 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/error-snackbar.tsx ***! | |
| 607 | - \***********************************************************************************************/ | |
| 608 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 609 | - | |
| 610 | -__webpack_require__.r(__webpack_exports__); | |
| 611 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 612 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 613 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 614 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__); | |
| 615 | - | |
| 616 | - | |
| 617 | -const ErrorSnackbar = ({ | |
| 618 | - open, | |
| 619 | - onClose | |
| 620 | -}) => { | |
| 621 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Snackbar, { | |
| 622 | - open: open, | |
| 623 | - onClose: onClose, | |
| 624 | - anchorOrigin: { | |
| 625 | - vertical: 'bottom', | |
| 626 | - horizontal: 'left' | |
| 627 | - } | |
| 628 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Alert, { | |
| 629 | - onClose: onClose, | |
| 630 | - severity: "error", | |
| 631 | - sx: { | |
| 632 | - width: '100%' | |
| 633 | - } | |
| 634 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Typography, { | |
| 635 | - component: "span", | |
| 636 | - sx: { | |
| 637 | - fontWeight: 'bold' | |
| 638 | - } | |
| 639 | - }, "We couldn\u2019t complete the action."), ' ', "Please try again")); | |
| 640 | -}; | |
| 641 | -/* harmony default export */ __webpack_exports__["default"] = (ErrorSnackbar); | |
| 642 | - | |
| 643 | -/***/ }), | |
| 644 | - | |
| 645 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/panel.ts": | |
| 646 | -/*!*************************************************************************************!*\ | |
| 647 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/panel.ts ***! | |
| 648 | - \*************************************************************************************/ | |
| 649 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 650 | - | |
| 651 | -__webpack_require__.r(__webpack_exports__); | |
| 652 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 653 | -/* harmony export */ panel: function() { return /* binding */ panel; }, | |
| 654 | -/* harmony export */ usePanelActions: function() { return /* binding */ usePanelActions; }, | |
| 655 | -/* harmony export */ usePanelStatus: function() { return /* binding */ usePanelStatus; } | |
| 656 | -/* harmony export */ }); | |
| 657 | -/* harmony import */ var _elementor_editor_panels__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-panels */ "@elementor/editor-panels"); | |
| 658 | -/* harmony import */ var _elementor_editor_panels__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_0__); | |
| 659 | -/* harmony import */ var _shell__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shell */ "./packages/packages/core/editor-site-navigation/src/components/panel/shell.tsx"); | |
| 660 | - | |
| 661 | - | |
| 662 | -const { | |
| 663 | - panel, | |
| 664 | - usePanelStatus, | |
| 665 | - usePanelActions | |
| 666 | -} = (0,_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_0__.__createPanel)({ | |
| 667 | - id: 'site-navigation-panel', | |
| 668 | - component: _shell__WEBPACK_IMPORTED_MODULE_1__["default"] | |
| 669 | -}); | |
| 670 | - | |
| 671 | -/***/ }), | |
| 672 | - | |
| 673 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/collapsible-list.tsx": | |
| 674 | -/*!************************************************************************************************************!*\ | |
| 675 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/collapsible-list.tsx ***! | |
| 676 | - \************************************************************************************************************/ | |
| 677 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 678 | - | |
| 679 | -__webpack_require__.r(__webpack_exports__); | |
| 680 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 681 | -/* harmony export */ "default": function() { return /* binding */ CollapsibleList; } | |
| 682 | -/* harmony export */ }); | |
| 683 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 684 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 685 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 686 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 687 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 688 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 689 | - | |
| 690 | - | |
| 691 | - | |
| 692 | - | |
| 693 | -// TODO 21/06/2023 : Should replace this with future Rotate component that will be implemented in elementor-ui | |
| 694 | -const RotateIcon = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.ChevronDownIcon, { | |
| 695 | - shouldForwardProp: prop => prop !== 'isOpen' | |
| 696 | -})(({ | |
| 697 | - theme, | |
| 698 | - isOpen | |
| 699 | -}) => ({ | |
| 700 | - transform: isOpen ? 'rotate(0deg)' : 'rotate(-90deg)', | |
| 701 | - transition: theme.transitions.create('transform', { | |
| 702 | - duration: theme.transitions.duration.standard | |
| 703 | - }) | |
| 704 | -})); | |
| 705 | -const StyledListItemIcon = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemIcon)(({ | |
| 706 | - theme | |
| 707 | -}) => ({ | |
| 708 | - minWidth: theme.spacing(4) | |
| 709 | -})); | |
| 710 | -function CollapsibleList({ | |
| 711 | - label, | |
| 712 | - Icon, | |
| 713 | - isOpenByDefault = false, | |
| 714 | - children | |
| 715 | -}) { | |
| 716 | - const [isOpen, setIsOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(isOpenByDefault); | |
| 717 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItem, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledListItemIcon, { | |
| 718 | - sx: { | |
| 719 | - color: 'text.secondary' | |
| 720 | - } | |
| 721 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, { | |
| 722 | - onClick: () => setIsOpen(prev => !prev), | |
| 723 | - size: "small", | |
| 724 | - sx: { | |
| 725 | - color: 'inherit' | |
| 726 | - } | |
| 727 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(RotateIcon, { | |
| 728 | - fontSize: "small", | |
| 729 | - isOpen: isOpen | |
| 730 | - }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledListItemIcon, { | |
| 731 | - size: "small", | |
| 732 | - sx: { | |
| 733 | - color: 'inherit' | |
| 734 | - } | |
| 735 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Icon, { | |
| 736 | - fontSize: "small" | |
| 737 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, { | |
| 738 | - primaryTypographyProps: { | |
| 739 | - variant: 'subtitle2', | |
| 740 | - component: 'span' | |
| 741 | - }, | |
| 742 | - primary: label | |
| 743 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Collapse, { | |
| 744 | - in: isOpen, | |
| 745 | - timeout: "auto", | |
| 746 | - unmountOnExit: true | |
| 747 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.List, { | |
| 748 | - dense: true | |
| 749 | - }, children)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, { | |
| 750 | - sx: { | |
| 751 | - mt: 1 | |
| 752 | - } | |
| 753 | - })); | |
| 754 | -} | |
| 755 | - | |
| 756 | -/***/ }), | |
| 757 | - | |
| 758 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/error-state.tsx": | |
| 759 | -/*!*******************************************************************************************************!*\ | |
| 760 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/error-state.tsx ***! | |
| 761 | - \*******************************************************************************************************/ | |
| 762 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 763 | - | |
| 764 | -__webpack_require__.r(__webpack_exports__); | |
| 765 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 766 | -/* harmony export */ "default": function() { return /* binding */ ErrorState; } | |
| 767 | -/* harmony export */ }); | |
| 768 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 769 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 770 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 771 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 772 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 773 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 774 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 775 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 776 | - | |
| 777 | - | |
| 778 | - | |
| 779 | - | |
| 780 | -function ErrorState() { | |
| 781 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { | |
| 782 | - sx: { | |
| 783 | - display: 'flex', | |
| 784 | - flexDirection: 'column', | |
| 785 | - justifyContent: 'center', | |
| 786 | - alignItems: 'center', | |
| 787 | - pt: '40px', | |
| 788 | - gap: '16px' | |
| 789 | - } | |
| 790 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.Error404TemplateIcon, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { | |
| 791 | - sx: { | |
| 792 | - display: 'flex', | |
| 793 | - flexDirection: 'column', | |
| 794 | - justifyContent: 'center', | |
| 795 | - alignItems: 'center', | |
| 796 | - gap: '8px' | |
| 797 | - } | |
| 798 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { | |
| 799 | - variant: "body1", | |
| 800 | - color: "text.primary" | |
| 801 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('We couldn’t display your pages.', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { | |
| 802 | - variant: "body2", | |
| 803 | - color: "text.primary", | |
| 804 | - sx: { | |
| 805 | - textAlign: 'center' | |
| 806 | - } | |
| 807 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('It’s probably a temporary issue.', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { | |
| 808 | - variant: "body2", | |
| 809 | - color: "text.primary", | |
| 810 | - sx: { | |
| 811 | - textAlign: 'center' | |
| 812 | - } | |
| 813 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('If the problem persists,', 'elementor'), ' ', /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Link, { | |
| 814 | - target: "_blank", | |
| 815 | - href: "https://go.elementor.com/wp-editor-support-open-ticket/" | |
| 816 | - }, "Notify support"))))); | |
| 817 | -} | |
| 818 | - | |
| 819 | -/***/ }), | |
| 820 | - | |
| 821 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/edit-mode-template.tsx": | |
| 822 | -/*!*************************************************************************************************************************!*\ | |
| 823 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/edit-mode-template.tsx ***! | |
| 824 | - \*************************************************************************************************************************/ | |
| 825 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 826 | - | |
| 827 | -__webpack_require__.r(__webpack_exports__); | |
| 828 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 829 | -/* harmony export */ "default": function() { return /* binding */ EditModeTemplate; } | |
| 830 | -/* harmony export */ }); | |
| 831 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 832 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 833 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 834 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 835 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 836 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 837 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 838 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 839 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 840 | - | |
| 841 | - | |
| 842 | - | |
| 843 | - | |
| 844 | - | |
| 845 | - | |
| 846 | -function EditModeTemplate({ | |
| 847 | - postTitle, | |
| 848 | - isLoading, | |
| 849 | - callback | |
| 850 | -}) { | |
| 851 | - const [title, setTitle] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(postTitle); | |
| 852 | - const [touched, setTouched] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); | |
| 853 | - const [inputError, setInputError] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); | |
| 854 | - const closeButton = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); | |
| 855 | - const onBlur = e => { | |
| 856 | - if (closeButton.current === e.relatedTarget) { | |
| 857 | - return; | |
| 858 | - } | |
| 859 | - runCallback(); | |
| 860 | - }; | |
| 861 | - const onFormSubmit = e => { | |
| 862 | - e.preventDefault(); | |
| 863 | - runCallback(); | |
| 864 | - }; | |
| 865 | - const validateInput = input => { | |
| 866 | - return input.trim() !== ''; | |
| 867 | - }; | |
| 868 | - const runCallback = () => { | |
| 869 | - if (!validateInput(title)) { | |
| 870 | - return; | |
| 871 | - } | |
| 872 | - callback(title); | |
| 873 | - }; | |
| 874 | - const onChange = e => { | |
| 875 | - if (!touched) { | |
| 876 | - setTouched(true); | |
| 877 | - } | |
| 878 | - const value = e.target.value; | |
| 879 | - if (!validateInput(value)) { | |
| 880 | - setInputError((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Name is required', 'elementor')); | |
| 881 | - } else { | |
| 882 | - setInputError(null); | |
| 883 | - } | |
| 884 | - setTitle(value); | |
| 885 | - }; | |
| 886 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItem, { | |
| 887 | - secondaryAction: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(CloseButton, { | |
| 888 | - isLoading: isLoading, | |
| 889 | - closeButton: closeButton | |
| 890 | - }) | |
| 891 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { | |
| 892 | - width: "100%", | |
| 893 | - component: "form", | |
| 894 | - onSubmit: onFormSubmit | |
| 895 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, { | |
| 896 | - autoFocus: true // eslint-disable-line jsx-a11y/no-autofocus | |
| 897 | - , | |
| 898 | - fullWidth: true, | |
| 899 | - value: title, | |
| 900 | - onChange: onChange, | |
| 901 | - disabled: isLoading, | |
| 902 | - error: !!inputError, | |
| 903 | - onBlur: onBlur, | |
| 904 | - variant: "outlined", | |
| 905 | - color: "secondary", | |
| 906 | - size: "small" | |
| 907 | - }))), inputError && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItem, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, { | |
| 908 | - sx: { | |
| 909 | - color: 'error.main' | |
| 910 | - } | |
| 911 | - }, inputError))); | |
| 912 | -} | |
| 913 | -function CloseButton({ | |
| 914 | - isLoading, | |
| 915 | - closeButton | |
| 916 | -}) { | |
| 917 | - const { | |
| 918 | - resetEditMode | |
| 919 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__.usePostListContext)(); | |
| 920 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, { | |
| 921 | - size: "small", | |
| 922 | - color: "secondary", | |
| 923 | - onClick: resetEditMode, | |
| 924 | - ref: closeButton, | |
| 925 | - disabled: isLoading | |
| 926 | - }, isLoading ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CircularProgress, null) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.XIcon, { | |
| 927 | - fontSize: "small" | |
| 928 | - })); | |
| 929 | -} | |
| 930 | - | |
| 931 | -/***/ }), | |
| 932 | - | |
| 933 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-create.tsx": | |
| 934 | -/*!***********************************************************************************************************************!*\ | |
| 935 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-create.tsx ***! | |
| 936 | - \***********************************************************************************************************************/ | |
| 937 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 938 | - | |
| 939 | -__webpack_require__.r(__webpack_exports__); | |
| 940 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 941 | -/* harmony export */ "default": function() { return /* binding */ ListItemCreate; } | |
| 942 | -/* harmony export */ }); | |
| 943 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 944 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 945 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 946 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 947 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 948 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 949 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 950 | -/* harmony import */ var _hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../hooks/use-posts-actions */ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts-actions.ts"); | |
| 951 | -/* harmony import */ var _edit_mode_template__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./edit-mode-template */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/edit-mode-template.tsx"); | |
| 952 | - | |
| 953 | - | |
| 954 | - | |
| 955 | - | |
| 956 | - | |
| 957 | - | |
| 958 | -function ListItemCreate() { | |
| 959 | - const { | |
| 960 | - type, | |
| 961 | - resetEditMode | |
| 962 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__.usePostListContext)(); | |
| 963 | - const { | |
| 964 | - createPost | |
| 965 | - } = (0,_hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_4__.usePostActions)(type); | |
| 966 | - const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useNavigateToDocument)(); | |
| 967 | - const { | |
| 968 | - setError | |
| 969 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__.usePostListContext)(); | |
| 970 | - const createPostCallback = async inputValue => { | |
| 971 | - try { | |
| 972 | - const { | |
| 973 | - id | |
| 974 | - } = await createPost.mutateAsync({ | |
| 975 | - title: inputValue, | |
| 976 | - status: 'draft' | |
| 977 | - }); | |
| 978 | - navigateToDocument(id); | |
| 979 | - } catch { | |
| 980 | - setError(); | |
| 981 | - } finally { | |
| 982 | - resetEditMode(); | |
| 983 | - } | |
| 984 | - }; | |
| 985 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_edit_mode_template__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 986 | - postTitle: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('New Page', 'elementor'), | |
| 987 | - isLoading: createPost.isPending, | |
| 988 | - callback: createPostCallback | |
| 989 | - }); | |
| 990 | -} | |
| 991 | - | |
| 992 | -/***/ }), | |
| 993 | - | |
| 994 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-duplicate.tsx": | |
| 995 | -/*!**************************************************************************************************************************!*\ | |
| 996 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-duplicate.tsx ***! | |
| 997 | - \**************************************************************************************************************************/ | |
| 998 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 999 | - | |
| 1000 | -__webpack_require__.r(__webpack_exports__); | |
| 1001 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1002 | -/* harmony export */ "default": function() { return /* binding */ ListItemDuplicate; } | |
| 1003 | -/* harmony export */ }); | |
| 1004 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1005 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1006 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 1007 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 1008 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1009 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 1010 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 1011 | -/* harmony import */ var _hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../hooks/use-posts-actions */ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts-actions.ts"); | |
| 1012 | -/* harmony import */ var _edit_mode_template__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./edit-mode-template */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/edit-mode-template.tsx"); | |
| 1013 | - | |
| 1014 | - | |
| 1015 | - | |
| 1016 | - | |
| 1017 | - | |
| 1018 | - | |
| 1019 | -function ListItemDuplicate() { | |
| 1020 | - const { | |
| 1021 | - type, | |
| 1022 | - editMode, | |
| 1023 | - resetEditMode | |
| 1024 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__.usePostListContext)(); | |
| 1025 | - const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useNavigateToDocument)(); | |
| 1026 | - const { | |
| 1027 | - duplicatePost | |
| 1028 | - } = (0,_hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_4__.usePostActions)(type); | |
| 1029 | - const { | |
| 1030 | - setError | |
| 1031 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__.usePostListContext)(); | |
| 1032 | - if ('duplicate' !== editMode.mode) { | |
| 1033 | - return null; | |
| 1034 | - } | |
| 1035 | - const duplicatePostCallback = async inputValue => { | |
| 1036 | - try { | |
| 1037 | - const { | |
| 1038 | - post_id: postId | |
| 1039 | - } = await duplicatePost.mutateAsync({ | |
| 1040 | - id: editMode.details.postId, | |
| 1041 | - title: inputValue | |
| 1042 | - }); | |
| 1043 | - navigateToDocument(postId); | |
| 1044 | - } catch { | |
| 1045 | - setError(); | |
| 1046 | - } finally { | |
| 1047 | - resetEditMode(); | |
| 1048 | - } | |
| 1049 | - }; | |
| 1050 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_edit_mode_template__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 1051 | - postTitle: `${editMode.details.title} ${(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('copy', 'elementor')}`, | |
| 1052 | - isLoading: duplicatePost.isPending, | |
| 1053 | - callback: duplicatePostCallback | |
| 1054 | - }); | |
| 1055 | -} | |
| 1056 | - | |
| 1057 | -/***/ }), | |
| 1058 | - | |
| 1059 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-rename.tsx": | |
| 1060 | -/*!***********************************************************************************************************************!*\ | |
| 1061 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-rename.tsx ***! | |
| 1062 | - \***********************************************************************************************************************/ | |
| 1063 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1064 | - | |
| 1065 | -__webpack_require__.r(__webpack_exports__); | |
| 1066 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1067 | -/* harmony export */ "default": function() { return /* binding */ ListItemRename; } | |
| 1068 | -/* harmony export */ }); | |
| 1069 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1070 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1071 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 1072 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 1073 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 1074 | -/* harmony import */ var _hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../hooks/use-posts-actions */ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts-actions.ts"); | |
| 1075 | -/* harmony import */ var _hooks_use_rename_active_document__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../hooks/use-rename-active-document */ "./packages/packages/core/editor-site-navigation/src/hooks/use-rename-active-document.ts"); | |
| 1076 | -/* harmony import */ var _edit_mode_template__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./edit-mode-template */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/edit-mode-template.tsx"); | |
| 1077 | - | |
| 1078 | - | |
| 1079 | - | |
| 1080 | - | |
| 1081 | - | |
| 1082 | - | |
| 1083 | -function ListItemRename({ | |
| 1084 | - post | |
| 1085 | -}) { | |
| 1086 | - const { | |
| 1087 | - type, | |
| 1088 | - resetEditMode | |
| 1089 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_2__.usePostListContext)(); | |
| 1090 | - const { | |
| 1091 | - updatePost | |
| 1092 | - } = (0,_hooks_use_posts_actions__WEBPACK_IMPORTED_MODULE_3__.usePostActions)(type); | |
| 1093 | - const { | |
| 1094 | - setError | |
| 1095 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_2__.usePostListContext)(); | |
| 1096 | - const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useActiveDocument)(); | |
| 1097 | - const rename = (0,_hooks_use_rename_active_document__WEBPACK_IMPORTED_MODULE_4__["default"])(); | |
| 1098 | - const isActive = activeDocument?.id === post.id; | |
| 1099 | - const title = isActive ? activeDocument?.title : post.title.rendered; | |
| 1100 | - const renamePostCallback = async inputValue => { | |
| 1101 | - if (inputValue === title) { | |
| 1102 | - resetEditMode(); | |
| 1103 | - } | |
| 1104 | - try { | |
| 1105 | - if (isActive) { | |
| 1106 | - await rename(inputValue); | |
| 1107 | - } else { | |
| 1108 | - await updatePost.mutateAsync({ | |
| 1109 | - id: post.id, | |
| 1110 | - title: inputValue | |
| 1111 | - }); | |
| 1112 | - } | |
| 1113 | - } catch { | |
| 1114 | - setError(); | |
| 1115 | - } finally { | |
| 1116 | - resetEditMode(); | |
| 1117 | - } | |
| 1118 | - }; | |
| 1119 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_edit_mode_template__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 1120 | - postTitle: title, | |
| 1121 | - isLoading: updatePost.isPending, | |
| 1122 | - callback: renamePostCallback | |
| 1123 | - }); | |
| 1124 | -} | |
| 1125 | - | |
| 1126 | -/***/ }), | |
| 1127 | - | |
| 1128 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-view.tsx": | |
| 1129 | -/*!*********************************************************************************************************************!*\ | |
| 1130 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-view.tsx ***! | |
| 1131 | - \*********************************************************************************************************************/ | |
| 1132 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1133 | - | |
| 1134 | -__webpack_require__.r(__webpack_exports__); | |
| 1135 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1136 | -/* harmony export */ "default": function() { return /* binding */ ListItemView; } | |
| 1137 | -/* harmony export */ }); | |
| 1138 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1139 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1140 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 1141 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 1142 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 1143 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__); | |
| 1144 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1145 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 1146 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1147 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); | |
| 1148 | -/* harmony import */ var _shared_page_title_and_status__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../shared/page-title-and-status */ "./packages/packages/core/editor-site-navigation/src/components/shared/page-title-and-status.tsx"); | |
| 1149 | -/* harmony import */ var _actions_menu_actions_delete__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../actions-menu/actions/delete */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/delete.tsx"); | |
| 1150 | -/* harmony import */ var _actions_menu_actions_duplicate__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../actions-menu/actions/duplicate */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/duplicate.tsx"); | |
| 1151 | -/* harmony import */ var _actions_menu_actions_rename__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../actions-menu/actions/rename */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/rename.tsx"); | |
| 1152 | -/* harmony import */ var _actions_menu_actions_set_home__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../actions-menu/actions/set-home */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/set-home.tsx"); | |
| 1153 | -/* harmony import */ var _actions_menu_actions_view__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../actions-menu/actions/view */ "./packages/packages/core/editor-site-navigation/src/components/panel/actions-menu/actions/view.tsx"); | |
| 1154 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 1155 | - | |
| 1156 | - | |
| 1157 | - | |
| 1158 | - | |
| 1159 | - | |
| 1160 | - | |
| 1161 | - | |
| 1162 | - | |
| 1163 | - | |
| 1164 | - | |
| 1165 | - | |
| 1166 | -const DisabledPostTooltip = ({ | |
| 1167 | - children, | |
| 1168 | - isDisabled | |
| 1169 | -}) => { | |
| 1170 | - if (isDisabled) { | |
| 1171 | - const title = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Typography, { | |
| 1172 | - variant: "caption" | |
| 1173 | - }, "You cannot edit this page.", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("br", null), "To edit it directly, contact the site owner"); | |
| 1174 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Tooltip, { | |
| 1175 | - title: title, | |
| 1176 | - placement: "bottom", | |
| 1177 | - arrow: false | |
| 1178 | - }, children); | |
| 1179 | - } | |
| 1180 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, children); | |
| 1181 | -}; | |
| 1182 | -function ListItemView({ | |
| 1183 | - post | |
| 1184 | -}) { | |
| 1185 | - const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useActiveDocument)(); | |
| 1186 | - const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useNavigateToDocument)(); | |
| 1187 | - const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.usePopupState)({ | |
| 1188 | - variant: 'popover', | |
| 1189 | - popupId: 'post-actions', | |
| 1190 | - disableAutoFocus: true | |
| 1191 | - }); | |
| 1192 | - const isActive = activeDocument?.id === post.id; | |
| 1193 | - const status = isActive ? activeDocument?.status.value : post.status; | |
| 1194 | - const title = isActive ? activeDocument?.title : post.title.rendered; | |
| 1195 | - const isDisabled = !post.user_can.edit; | |
| 1196 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(DisabledPostTooltip, { | |
| 1197 | - isDisabled: isDisabled | |
| 1198 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ListItem, { | |
| 1199 | - disablePadding: true, | |
| 1200 | - secondaryAction: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.IconButton, _extends({ | |
| 1201 | - value: true, | |
| 1202 | - size: "small" | |
| 1203 | - }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindTrigger)(popupState)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.DotsVerticalIcon, { | |
| 1204 | - fontSize: "small" | |
| 1205 | - })) | |
| 1206 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ListItemButton, { | |
| 1207 | - selected: isActive, | |
| 1208 | - disabled: isDisabled, | |
| 1209 | - onClick: () => { | |
| 1210 | - if (!isActive) { | |
| 1211 | - navigateToDocument(post.id); | |
| 1212 | - } | |
| 1213 | - }, | |
| 1214 | - dense: true | |
| 1215 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ListItemText, { | |
| 1216 | - disableTypography: true | |
| 1217 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_shared_page_title_and_status__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 1218 | - title: title, | |
| 1219 | - status: status | |
| 1220 | - })), post.isHome && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.HomeIcon, { | |
| 1221 | - titleAccess: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Homepage', 'elementor'), | |
| 1222 | - color: "disabled" | |
| 1223 | - })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Menu, _extends({ | |
| 1224 | - PaperProps: { | |
| 1225 | - sx: { | |
| 1226 | - mt: 2, | |
| 1227 | - width: 200 | |
| 1228 | - } | |
| 1229 | - }, | |
| 1230 | - MenuListProps: { | |
| 1231 | - dense: true | |
| 1232 | - } | |
| 1233 | - }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindMenu)(popupState)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_actions_menu_actions_rename__WEBPACK_IMPORTED_MODULE_8__["default"], { | |
| 1234 | - post: post | |
| 1235 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_actions_menu_actions_duplicate__WEBPACK_IMPORTED_MODULE_7__["default"], { | |
| 1236 | - post: post, | |
| 1237 | - popupState: popupState | |
| 1238 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_actions_menu_actions_delete__WEBPACK_IMPORTED_MODULE_6__["default"], { | |
| 1239 | - post: post | |
| 1240 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_actions_menu_actions_view__WEBPACK_IMPORTED_MODULE_10__["default"], { | |
| 1241 | - post: post | |
| 1242 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_actions_menu_actions_set_home__WEBPACK_IMPORTED_MODULE_9__["default"], { | |
| 1243 | - post: post, | |
| 1244 | - closeMenu: () => popupState.close() | |
| 1245 | - }))); | |
| 1246 | -} | |
| 1247 | - | |
| 1248 | -/***/ }), | |
| 1249 | - | |
| 1250 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/post-list-item.tsx": | |
| 1251 | -/*!**********************************************************************************************************!*\ | |
| 1252 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/post-list-item.tsx ***! | |
| 1253 | - \**********************************************************************************************************/ | |
| 1254 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1255 | - | |
| 1256 | -__webpack_require__.r(__webpack_exports__); | |
| 1257 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1258 | -/* harmony export */ "default": function() { return /* binding */ PostListItem; } | |
| 1259 | -/* harmony export */ }); | |
| 1260 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1261 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1262 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 1263 | -/* harmony import */ var _list_items_list_item_create__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./list-items/list-item-create */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-create.tsx"); | |
| 1264 | -/* harmony import */ var _list_items_list_item_duplicate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./list-items/list-item-duplicate */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-duplicate.tsx"); | |
| 1265 | -/* harmony import */ var _list_items_list_item_rename__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./list-items/list-item-rename */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-rename.tsx"); | |
| 1266 | -/* harmony import */ var _list_items_list_item_view__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./list-items/list-item-view */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/list-items/list-item-view.tsx"); | |
| 1267 | - | |
| 1268 | - | |
| 1269 | - | |
| 1270 | - | |
| 1271 | - | |
| 1272 | - | |
| 1273 | -function PostListItem({ | |
| 1274 | - post | |
| 1275 | -}) { | |
| 1276 | - const { | |
| 1277 | - editMode | |
| 1278 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_1__.usePostListContext)(); | |
| 1279 | - if ('rename' === editMode.mode && post?.id && post?.id === editMode.details.postId) { | |
| 1280 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_list_items_list_item_rename__WEBPACK_IMPORTED_MODULE_4__["default"], { | |
| 1281 | - post: post | |
| 1282 | - }); | |
| 1283 | - } | |
| 1284 | - if ('create' === editMode.mode && !post) { | |
| 1285 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_list_items_list_item_create__WEBPACK_IMPORTED_MODULE_2__["default"], null); | |
| 1286 | - } | |
| 1287 | - if ('duplicate' === editMode.mode && !post) { | |
| 1288 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_list_items_list_item_duplicate__WEBPACK_IMPORTED_MODULE_3__["default"], null); | |
| 1289 | - } | |
| 1290 | - if (!post) { | |
| 1291 | - return null; | |
| 1292 | - } | |
| 1293 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_list_items_list_item_view__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 1294 | - post: post | |
| 1295 | - }); | |
| 1296 | -} | |
| 1297 | - | |
| 1298 | -/***/ }), | |
| 1299 | - | |
| 1300 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/posts-collapsible-list.tsx": | |
| 1301 | -/*!******************************************************************************************************************!*\ | |
| 1302 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/posts-collapsible-list.tsx ***! | |
| 1303 | - \******************************************************************************************************************/ | |
| 1304 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1305 | - | |
| 1306 | -__webpack_require__.r(__webpack_exports__); | |
| 1307 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1308 | -/* harmony export */ "default": function() { return /* binding */ PostsCollapsibleList; } | |
| 1309 | -/* harmony export */ }); | |
| 1310 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1311 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1312 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 1313 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 1314 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1315 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 1316 | -/* harmony import */ var _api_post__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../api/post */ "./packages/packages/core/editor-site-navigation/src/api/post.ts"); | |
| 1317 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 1318 | -/* harmony import */ var _hooks_use_homepage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../hooks/use-homepage */ "./packages/packages/core/editor-site-navigation/src/hooks/use-homepage.ts"); | |
| 1319 | -/* harmony import */ var _hooks_use_posts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../hooks/use-posts */ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts.ts"); | |
| 1320 | -/* harmony import */ var _add_new_button__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../add-new-button */ "./packages/packages/core/editor-site-navigation/src/components/panel/add-new-button.tsx"); | |
| 1321 | -/* harmony import */ var _collapsible_list__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./collapsible-list */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/collapsible-list.tsx"); | |
| 1322 | -/* harmony import */ var _error_state__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./error-state */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/error-state.tsx"); | |
| 1323 | -/* harmony import */ var _post_list_item__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./post-list-item */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/post-list-item.tsx"); | |
| 1324 | - | |
| 1325 | - | |
| 1326 | - | |
| 1327 | - | |
| 1328 | - | |
| 1329 | - | |
| 1330 | - | |
| 1331 | - | |
| 1332 | - | |
| 1333 | - | |
| 1334 | - | |
| 1335 | -function PostsCollapsibleList({ | |
| 1336 | - isOpenByDefault = false | |
| 1337 | -}) { | |
| 1338 | - const { | |
| 1339 | - type, | |
| 1340 | - editMode | |
| 1341 | - } = (0,_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_4__.usePostListContext)(); | |
| 1342 | - const { | |
| 1343 | - data: { | |
| 1344 | - posts, | |
| 1345 | - total | |
| 1346 | - }, | |
| 1347 | - isLoading: postsLoading, | |
| 1348 | - isError: postsError, | |
| 1349 | - fetchNextPage, | |
| 1350 | - hasNextPage, | |
| 1351 | - isFetchingNextPage | |
| 1352 | - } = (0,_hooks_use_posts__WEBPACK_IMPORTED_MODULE_6__.usePosts)(type); | |
| 1353 | - const { | |
| 1354 | - data: homepageId | |
| 1355 | - } = (0,_hooks_use_homepage__WEBPACK_IMPORTED_MODULE_5__.useHomepage)(); | |
| 1356 | - if (postsError) { | |
| 1357 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_error_state__WEBPACK_IMPORTED_MODULE_9__["default"], null); | |
| 1358 | - } | |
| 1359 | - if (!posts || postsLoading) { | |
| 1360 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { | |
| 1361 | - sx: { | |
| 1362 | - px: 5 | |
| 1363 | - } | |
| 1364 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { | |
| 1365 | - display: "flex", | |
| 1366 | - justifyContent: "flex-end", | |
| 1367 | - alignItems: "center" | |
| 1368 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { | |
| 1369 | - sx: { | |
| 1370 | - my: 4 | |
| 1371 | - }, | |
| 1372 | - animation: "wave", | |
| 1373 | - variant: "rounded", | |
| 1374 | - width: "110px", | |
| 1375 | - height: "28px" | |
| 1376 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { | |
| 1377 | - sx: { | |
| 1378 | - my: 3 | |
| 1379 | - }, | |
| 1380 | - animation: "wave", | |
| 1381 | - variant: "rounded", | |
| 1382 | - width: "100%", | |
| 1383 | - height: "24px" | |
| 1384 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { | |
| 1385 | - sx: { | |
| 1386 | - my: 3 | |
| 1387 | - }, | |
| 1388 | - animation: "wave", | |
| 1389 | - variant: "rounded", | |
| 1390 | - width: "70%", | |
| 1391 | - height: "24px" | |
| 1392 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { | |
| 1393 | - sx: { | |
| 1394 | - my: 3 | |
| 1395 | - }, | |
| 1396 | - animation: "wave", | |
| 1397 | - variant: "rounded", | |
| 1398 | - width: "70%", | |
| 1399 | - height: "24px" | |
| 1400 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { | |
| 1401 | - sx: { | |
| 1402 | - my: 3 | |
| 1403 | - }, | |
| 1404 | - animation: "wave", | |
| 1405 | - variant: "rounded", | |
| 1406 | - width: "70%", | |
| 1407 | - height: "24px" | |
| 1408 | - }))); | |
| 1409 | - } | |
| 1410 | - const label = `${_api_post__WEBPACK_IMPORTED_MODULE_3__.postTypesMap[type].labels.plural_name} (${total.toString()})`; | |
| 1411 | - const mappedPosts = posts.map(post => { | |
| 1412 | - if (post.id === homepageId) { | |
| 1413 | - return { | |
| 1414 | - ...post, | |
| 1415 | - isHome: true | |
| 1416 | - }; | |
| 1417 | - } | |
| 1418 | - return post; | |
| 1419 | - }); | |
| 1420 | - const sortedPosts = mappedPosts.sort((a, b) => { | |
| 1421 | - if (a.id === homepageId) { | |
| 1422 | - return -1; | |
| 1423 | - } | |
| 1424 | - if (b.id === homepageId) { | |
| 1425 | - return 1; | |
| 1426 | - } | |
| 1427 | - return 0; | |
| 1428 | - }); | |
| 1429 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { | |
| 1430 | - display: "flex", | |
| 1431 | - justifyContent: "flex-end", | |
| 1432 | - alignItems: "center", | |
| 1433 | - sx: { | |
| 1434 | - py: 1, | |
| 1435 | - px: 2 | |
| 1436 | - } | |
| 1437 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_add_new_button__WEBPACK_IMPORTED_MODULE_7__["default"], null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.List, { | |
| 1438 | - dense: true | |
| 1439 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_collapsible_list__WEBPACK_IMPORTED_MODULE_8__["default"], { | |
| 1440 | - label: label, | |
| 1441 | - Icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PageTypeIcon, | |
| 1442 | - isOpenByDefault: isOpenByDefault || false | |
| 1443 | - }, sortedPosts.map(post => { | |
| 1444 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_post_list_item__WEBPACK_IMPORTED_MODULE_10__["default"], { | |
| 1445 | - key: post.id, | |
| 1446 | - post: post | |
| 1447 | - }); | |
| 1448 | - }), ['duplicate', 'create'].includes(editMode.mode) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_post_list_item__WEBPACK_IMPORTED_MODULE_10__["default"], null), hasNextPage && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { | |
| 1449 | - sx: { | |
| 1450 | - display: 'flex', | |
| 1451 | - justifyContent: 'center' | |
| 1452 | - } | |
| 1453 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, { | |
| 1454 | - onClick: fetchNextPage, | |
| 1455 | - color: "secondary" | |
| 1456 | - }, isFetchingNextPage ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CircularProgress, null) : 'Load More'))))); | |
| 1457 | -} | |
| 1458 | - | |
| 1459 | -/***/ }), | |
| 1460 | - | |
| 1461 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/panel/shell.tsx": | |
| 1462 | -/*!**************************************************************************************!*\ | |
| 1463 | - !*** ./packages/packages/core/editor-site-navigation/src/components/panel/shell.tsx ***! | |
| 1464 | - \**************************************************************************************/ | |
| 1465 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1466 | - | |
| 1467 | -__webpack_require__.r(__webpack_exports__); | |
| 1468 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1469 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1470 | -/* harmony import */ var _elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-panels */ "@elementor/editor-panels"); | |
| 1471 | -/* harmony import */ var _elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__); | |
| 1472 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1473 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 1474 | -/* harmony import */ var _contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../contexts/post-list-context */ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx"); | |
| 1475 | -/* harmony import */ var _error_snackbar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./error-snackbar */ "./packages/packages/core/editor-site-navigation/src/components/panel/error-snackbar.tsx"); | |
| 1476 | -/* harmony import */ var _posts_list_posts_collapsible_list__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./posts-list/posts-collapsible-list */ "./packages/packages/core/editor-site-navigation/src/components/panel/posts-list/posts-collapsible-list.tsx"); | |
| 1477 | - | |
| 1478 | - | |
| 1479 | - | |
| 1480 | - | |
| 1481 | - | |
| 1482 | - | |
| 1483 | - | |
| 1484 | -const Shell = () => { | |
| 1485 | - const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); | |
| 1486 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__.Panel, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__.PanelHeader, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__.PanelHeaderTitle, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Pages', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__.PanelBody, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_contexts_post_list_context__WEBPACK_IMPORTED_MODULE_3__.PostListContextProvider, { | |
| 1487 | - type: 'page', | |
| 1488 | - setError: () => setIsErrorSnackbarOpen(true) | |
| 1489 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_posts_list_posts_collapsible_list__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 1490 | - isOpenByDefault: true | |
| 1491 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_error_snackbar__WEBPACK_IMPORTED_MODULE_4__["default"], { | |
| 1492 | - open: isErrorSnackbarOpen, | |
| 1493 | - onClose: () => setIsErrorSnackbarOpen(false) | |
| 1494 | - }))); | |
| 1495 | -}; | |
| 1496 | -/* harmony default export */ __webpack_exports__["default"] = (Shell); | |
| 1497 | - | |
| 1498 | -/***/ }), | |
| 1499 | - | |
| 1500 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/shared/page-title-and-status.tsx": | |
| 1501 | -/*!*******************************************************************************************************!*\ | |
| 1502 | - !*** ./packages/packages/core/editor-site-navigation/src/components/shared/page-title-and-status.tsx ***! | |
| 1503 | - \*******************************************************************************************************/ | |
| 1504 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1505 | - | |
| 1506 | -__webpack_require__.r(__webpack_exports__); | |
| 1507 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1508 | -/* harmony export */ "default": function() { return /* binding */ PageTitleAndStatus; } | |
| 1509 | -/* harmony export */ }); | |
| 1510 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1511 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1512 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1513 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__); | |
| 1514 | -/* harmony import */ var _hooks_use_reverse_html_entities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../hooks/use-reverse-html-entities */ "./packages/packages/core/editor-site-navigation/src/hooks/use-reverse-html-entities.ts"); | |
| 1515 | - | |
| 1516 | - | |
| 1517 | - | |
| 1518 | -const PageStatus = ({ | |
| 1519 | - status | |
| 1520 | -}) => { | |
| 1521 | - if ('publish' === status) { | |
| 1522 | - return null; | |
| 1523 | - } | |
| 1524 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Typography, { | |
| 1525 | - component: "span", | |
| 1526 | - variant: "body2", | |
| 1527 | - color: "text.secondary", | |
| 1528 | - sx: { | |
| 1529 | - textTransform: 'capitalize', | |
| 1530 | - fontStyle: 'italic', | |
| 1531 | - whiteSpace: 'nowrap', | |
| 1532 | - flexBasis: 'content' | |
| 1533 | - } | |
| 1534 | - }, "(", status, ")"); | |
| 1535 | -}; | |
| 1536 | -const PageTitle = ({ | |
| 1537 | - title | |
| 1538 | -}) => { | |
| 1539 | - const modifiedTitle = (0,_hooks_use_reverse_html_entities__WEBPACK_IMPORTED_MODULE_2__.useReverseHtmlEntities)(title); | |
| 1540 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Typography, { | |
| 1541 | - component: "span", | |
| 1542 | - variant: "body2", | |
| 1543 | - color: "text.secondary", | |
| 1544 | - noWrap: true, | |
| 1545 | - sx: { | |
| 1546 | - flexBasis: 'auto' | |
| 1547 | - } | |
| 1548 | - }, modifiedTitle); | |
| 1549 | -}; | |
| 1550 | -function PageTitleAndStatus({ | |
| 1551 | - title, | |
| 1552 | - status | |
| 1553 | -}) { | |
| 1554 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, { | |
| 1555 | - display: "flex" | |
| 1556 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PageTitle, { | |
| 1557 | - title: title | |
| 1558 | - }), "\xA0", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PageStatus, { | |
| 1559 | - status: status | |
| 1560 | - })); | |
| 1561 | -} | |
| 1562 | - | |
| 1563 | -/***/ }), | |
| 1564 | - | |
| 1565 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/top-bar/chip-doc-type.tsx": | |
| 1566 | -/*!************************************************************************************************!*\ | |
| 1567 | - !*** ./packages/packages/core/editor-site-navigation/src/components/top-bar/chip-doc-type.tsx ***! | |
| 1568 | - \************************************************************************************************/ | |
| 1569 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1570 | - | |
| 1571 | -__webpack_require__.r(__webpack_exports__); | |
| 1572 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1573 | -/* harmony export */ "default": function() { return /* binding */ DocTypeChip; } | |
| 1574 | -/* harmony export */ }); | |
| 1575 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1576 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1577 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 1578 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 1579 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1580 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 1581 | -/* harmony import */ var _icons_map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../icons-map */ "./packages/packages/core/editor-site-navigation/src/icons-map.ts"); | |
| 1582 | - | |
| 1583 | - | |
| 1584 | - | |
| 1585 | - | |
| 1586 | -const iconsMap = (0,_icons_map__WEBPACK_IMPORTED_MODULE_3__.getIconsMap)(); | |
| 1587 | -function DocTypeChip({ | |
| 1588 | - postType, | |
| 1589 | - docType, | |
| 1590 | - label | |
| 1591 | -}) { | |
| 1592 | - const color = 'elementor_library' === postType ? 'global' : 'primary'; | |
| 1593 | - const Icon = iconsMap[docType] || _elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PostTypeIcon; | |
| 1594 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Chip, { | |
| 1595 | - component: "span", | |
| 1596 | - size: "small", | |
| 1597 | - variant: "outlined", | |
| 1598 | - label: label, | |
| 1599 | - "data-value": docType, | |
| 1600 | - color: color, | |
| 1601 | - icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Icon, null), | |
| 1602 | - sx: { | |
| 1603 | - ml: 1, | |
| 1604 | - cursor: 'inherit' | |
| 1605 | - } | |
| 1606 | - }); | |
| 1607 | -} | |
| 1608 | - | |
| 1609 | -/***/ }), | |
| 1610 | - | |
| 1611 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/top-bar/create-post-list-item.tsx": | |
| 1612 | -/*!********************************************************************************************************!*\ | |
| 1613 | - !*** ./packages/packages/core/editor-site-navigation/src/components/top-bar/create-post-list-item.tsx ***! | |
| 1614 | - \********************************************************************************************************/ | |
| 1615 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1616 | - | |
| 1617 | -__webpack_require__.r(__webpack_exports__); | |
| 1618 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1619 | -/* harmony export */ CreatePostListItem: function() { return /* binding */ CreatePostListItem; } | |
| 1620 | -/* harmony export */ }); | |
| 1621 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1622 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1623 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 1624 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 1625 | -/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/events */ "@elementor/events"); | |
| 1626 | -/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_events__WEBPACK_IMPORTED_MODULE_2__); | |
| 1627 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 1628 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__); | |
| 1629 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1630 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__); | |
| 1631 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1632 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__); | |
| 1633 | -/* harmony import */ var _hooks_use_create_page__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../hooks/use-create-page */ "./packages/packages/core/editor-site-navigation/src/hooks/use-create-page.ts"); | |
| 1634 | -/* harmony import */ var _hooks_use_user__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../hooks/use-user */ "./packages/packages/core/editor-site-navigation/src/hooks/use-user.ts"); | |
| 1635 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 1636 | - | |
| 1637 | - | |
| 1638 | - | |
| 1639 | - | |
| 1640 | - | |
| 1641 | - | |
| 1642 | - | |
| 1643 | - | |
| 1644 | -function CreatePostListItem({ | |
| 1645 | - closePopup, | |
| 1646 | - ...props | |
| 1647 | -}) { | |
| 1648 | - const { | |
| 1649 | - create, | |
| 1650 | - isLoading | |
| 1651 | - } = (0,_hooks_use_create_page__WEBPACK_IMPORTED_MODULE_6__["default"])(); | |
| 1652 | - const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useNavigateToDocument)(); | |
| 1653 | - const { | |
| 1654 | - data: user | |
| 1655 | - } = (0,_hooks_use_user__WEBPACK_IMPORTED_MODULE_7__["default"])(); | |
| 1656 | - const { | |
| 1657 | - dispatchEvent, | |
| 1658 | - config | |
| 1659 | - } = (0,_elementor_events__WEBPACK_IMPORTED_MODULE_2__.useMixpanel)(); | |
| 1660 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.MenuItem, _extends({ | |
| 1661 | - disabled: isLoading || !user?.capabilities?.edit_pages, | |
| 1662 | - onClick: async () => { | |
| 1663 | - const eventName = config?.names?.editorOne?.topBarPageList; | |
| 1664 | - if (eventName) { | |
| 1665 | - dispatchEvent?.(eventName, { | |
| 1666 | - app_type: config?.appTypes?.editor, | |
| 1667 | - window_name: config?.appTypes?.editor, | |
| 1668 | - interaction_type: config?.triggers?.click?.toLowerCase(), | |
| 1669 | - target_type: config?.targetTypes?.dropdownItem, | |
| 1670 | - target_name: config?.targetNames?.pageList?.addNewPage, | |
| 1671 | - interaction_result: config?.interactionResults?.create, | |
| 1672 | - target_location: config?.locations?.topBar?.replace(/\s+/g, '_').toLowerCase(), | |
| 1673 | - location_l1: config?.secondaryLocations?.pageListDropdown?.replace(/\s+/g, '_').toLowerCase(), | |
| 1674 | - location_l2: config?.targetTypes?.dropdownItem | |
| 1675 | - }); | |
| 1676 | - } | |
| 1677 | - const { | |
| 1678 | - id | |
| 1679 | - } = await create(); | |
| 1680 | - closePopup(); | |
| 1681 | - await navigateToDocument(id); | |
| 1682 | - } | |
| 1683 | - }, props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.ListItemIcon, null, isLoading ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.CircularProgress, { | |
| 1684 | - size: "1.25rem" | |
| 1685 | - }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.PlusIcon, { | |
| 1686 | - fontSize: "small" | |
| 1687 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.ListItemText, { | |
| 1688 | - primaryTypographyProps: { | |
| 1689 | - variant: 'body2' | |
| 1690 | - }, | |
| 1691 | - primary: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Add new page', 'elementor') | |
| 1692 | - })); | |
| 1693 | -} | |
| 1694 | - | |
| 1695 | -/***/ }), | |
| 1696 | - | |
| 1697 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/top-bar/indicator.tsx": | |
| 1698 | -/*!********************************************************************************************!*\ | |
| 1699 | - !*** ./packages/packages/core/editor-site-navigation/src/components/top-bar/indicator.tsx ***! | |
| 1700 | - \********************************************************************************************/ | |
| 1701 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1702 | - | |
| 1703 | -__webpack_require__.r(__webpack_exports__); | |
| 1704 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1705 | -/* harmony export */ "default": function() { return /* binding */ Indicator; } | |
| 1706 | -/* harmony export */ }); | |
| 1707 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1708 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1709 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1710 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__); | |
| 1711 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 1712 | - | |
| 1713 | - | |
| 1714 | -function Indicator({ | |
| 1715 | - title, | |
| 1716 | - status | |
| 1717 | -}) { | |
| 1718 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Tooltip, { | |
| 1719 | - title: title | |
| 1720 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Stack, { | |
| 1721 | - component: "span", | |
| 1722 | - direction: "row", | |
| 1723 | - alignItems: "center", | |
| 1724 | - spacing: 0.5 | |
| 1725 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Typography, { | |
| 1726 | - component: "span", | |
| 1727 | - variant: "body2", | |
| 1728 | - sx: { | |
| 1729 | - maxWidth: '120px' | |
| 1730 | - }, | |
| 1731 | - noWrap: true | |
| 1732 | - }, title), status.value !== 'publish' && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Typography, { | |
| 1733 | - component: "span", | |
| 1734 | - variant: "body2", | |
| 1735 | - sx: { | |
| 1736 | - fontStyle: 'italic' | |
| 1737 | - } | |
| 1738 | - }, "(", status.label, ")"))); | |
| 1739 | -} | |
| 1740 | -function Tooltip(props) { | |
| 1741 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tooltip, _extends({ | |
| 1742 | - PopperProps: { | |
| 1743 | - sx: { | |
| 1744 | - '&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom': { | |
| 1745 | - mt: 2.7 | |
| 1746 | - } | |
| 1747 | - } | |
| 1748 | - } | |
| 1749 | - }, props)); | |
| 1750 | -} | |
| 1751 | - | |
| 1752 | -/***/ }), | |
| 1753 | - | |
| 1754 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/top-bar/post-list-item.tsx": | |
| 1755 | -/*!*************************************************************************************************!*\ | |
| 1756 | - !*** ./packages/packages/core/editor-site-navigation/src/components/top-bar/post-list-item.tsx ***! | |
| 1757 | - \*************************************************************************************************/ | |
| 1758 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1759 | - | |
| 1760 | -__webpack_require__.r(__webpack_exports__); | |
| 1761 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1762 | -/* harmony export */ PostListItem: function() { return /* binding */ PostListItem; } | |
| 1763 | -/* harmony export */ }); | |
| 1764 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1765 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1766 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 1767 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 1768 | -/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/events */ "@elementor/events"); | |
| 1769 | -/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_events__WEBPACK_IMPORTED_MODULE_2__); | |
| 1770 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1771 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 1772 | -/* harmony import */ var _hooks_use_reverse_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../hooks/use-reverse-html-entities */ "./packages/packages/core/editor-site-navigation/src/hooks/use-reverse-html-entities.ts"); | |
| 1773 | -/* harmony import */ var _chip_doc_type__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./chip-doc-type */ "./packages/packages/core/editor-site-navigation/src/components/top-bar/chip-doc-type.tsx"); | |
| 1774 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 1775 | - | |
| 1776 | - | |
| 1777 | - | |
| 1778 | - | |
| 1779 | - | |
| 1780 | - | |
| 1781 | -function PostListItem({ | |
| 1782 | - post, | |
| 1783 | - closePopup, | |
| 1784 | - ...props | |
| 1785 | -}) { | |
| 1786 | - const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useNavigateToDocument)(); | |
| 1787 | - const postTitle = (0,_hooks_use_reverse_html_entities__WEBPACK_IMPORTED_MODULE_4__.useReverseHtmlEntities)(post.title); | |
| 1788 | - const { | |
| 1789 | - dispatchEvent, | |
| 1790 | - config | |
| 1791 | - } = (0,_elementor_events__WEBPACK_IMPORTED_MODULE_2__.useMixpanel)(); | |
| 1792 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.MenuItem, _extends({ | |
| 1793 | - disabled: !post.user_can.edit, | |
| 1794 | - onClick: async () => { | |
| 1795 | - const eventName = config?.names?.editorOne?.topBarPageList; | |
| 1796 | - if (eventName) { | |
| 1797 | - dispatchEvent?.(eventName, { | |
| 1798 | - app_type: config?.appTypes?.editor, | |
| 1799 | - window_name: config?.appTypes?.editor, | |
| 1800 | - interaction_type: config?.triggers?.click?.toLowerCase(), | |
| 1801 | - target_type: config?.targetTypes?.dropdownItem, | |
| 1802 | - target_name: postTitle, | |
| 1803 | - interaction_result: config?.interactionResults?.navigate, | |
| 1804 | - target_location: config?.locations?.topBar?.replace(/\s+/g, '_').toLowerCase(), | |
| 1805 | - location_l1: config?.secondaryLocations?.pageListDropdown?.replace(/\s+/g, '_').toLowerCase(), | |
| 1806 | - location_l2: config?.targetTypes?.dropdownItem | |
| 1807 | - }); | |
| 1808 | - } | |
| 1809 | - closePopup(); | |
| 1810 | - await navigateToDocument(post.id); | |
| 1811 | - } | |
| 1812 | - }, props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ListItemText, { | |
| 1813 | - sx: { | |
| 1814 | - flexGrow: 0 | |
| 1815 | - }, | |
| 1816 | - primaryTypographyProps: { | |
| 1817 | - variant: 'body2', | |
| 1818 | - noWrap: true | |
| 1819 | - }, | |
| 1820 | - primary: postTitle | |
| 1821 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_chip_doc_type__WEBPACK_IMPORTED_MODULE_5__["default"], { | |
| 1822 | - postType: post.type.post_type, | |
| 1823 | - docType: post.type.doc_type, | |
| 1824 | - label: post.type.label | |
| 1825 | - })); | |
| 1826 | -} | |
| 1827 | - | |
| 1828 | -/***/ }), | |
| 1829 | - | |
| 1830 | -/***/ "./packages/packages/core/editor-site-navigation/src/components/top-bar/recently-edited.tsx": | |
| 1831 | -/*!**************************************************************************************************!*\ | |
| 1832 | - !*** ./packages/packages/core/editor-site-navigation/src/components/top-bar/recently-edited.tsx ***! | |
| 1833 | - \**************************************************************************************************/ | |
| 1834 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1835 | - | |
| 1836 | -__webpack_require__.r(__webpack_exports__); | |
| 1837 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1838 | -/* harmony export */ "default": function() { return /* binding */ RecentlyEdited; } | |
| 1839 | -/* harmony export */ }); | |
| 1840 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1841 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1842 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); | |
| 1843 | -/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__); | |
| 1844 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 1845 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__); | |
| 1846 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1847 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 1848 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1849 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); | |
| 1850 | -/* harmony import */ var _api_recent_posts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../api/recent-posts */ "./packages/packages/core/editor-site-navigation/src/api/recent-posts.ts"); | |
| 1851 | -/* harmony import */ var _hooks_use_recent_posts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../hooks/use-recent-posts */ "./packages/packages/core/editor-site-navigation/src/hooks/use-recent-posts.ts"); | |
| 1852 | -/* harmony import */ var _hooks_use_reverse_html_entities__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../hooks/use-reverse-html-entities */ "./packages/packages/core/editor-site-navigation/src/hooks/use-reverse-html-entities.ts"); | |
| 1853 | -/* harmony import */ var _create_post_list_item__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./create-post-list-item */ "./packages/packages/core/editor-site-navigation/src/components/top-bar/create-post-list-item.tsx"); | |
| 1854 | -/* harmony import */ var _indicator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./indicator */ "./packages/packages/core/editor-site-navigation/src/components/top-bar/indicator.tsx"); | |
| 1855 | -/* harmony import */ var _post_list_item__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./post-list-item */ "./packages/packages/core/editor-site-navigation/src/components/top-bar/post-list-item.tsx"); | |
| 1856 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 1857 | - | |
| 1858 | - | |
| 1859 | - | |
| 1860 | - | |
| 1861 | - | |
| 1862 | - | |
| 1863 | - | |
| 1864 | - | |
| 1865 | - | |
| 1866 | - | |
| 1867 | - | |
| 1868 | -function RecentlyEdited() { | |
| 1869 | - const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useActiveDocument)(); | |
| 1870 | - const hostDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_1__.__useHostDocument)(); | |
| 1871 | - const document = activeDocument && activeDocument.type.value !== 'kit' ? activeDocument : hostDocument; | |
| 1872 | - const { | |
| 1873 | - data | |
| 1874 | - } = (0,_hooks_use_recent_posts__WEBPACK_IMPORTED_MODULE_6__["default"])(); | |
| 1875 | - const getRecentPosts = () => { | |
| 1876 | - if (!data) { | |
| 1877 | - return []; | |
| 1878 | - } | |
| 1879 | - return data.filter(post => post.id !== document?.id).splice(0, _api_recent_posts__WEBPACK_IMPORTED_MODULE_5__.NUMBER_OF_RECENT_POSTS - 1); | |
| 1880 | - }; | |
| 1881 | - const recentPosts = getRecentPosts(); | |
| 1882 | - const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.usePopupState)({ | |
| 1883 | - variant: 'popover', | |
| 1884 | - popupId: 'elementor-v2-top-bar-recently-edited' | |
| 1885 | - }); | |
| 1886 | - const documentTitle = (0,_hooks_use_reverse_html_entities__WEBPACK_IMPORTED_MODULE_7__.useReverseHtmlEntities)(document?.title); | |
| 1887 | - if (!document) { | |
| 1888 | - return null; | |
| 1889 | - } | |
| 1890 | - const buttonProps = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindTrigger)(popupState); | |
| 1891 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, _extends({ | |
| 1892 | - color: "inherit", | |
| 1893 | - size: "small", | |
| 1894 | - endIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ChevronDownIcon, { | |
| 1895 | - fontSize: "small" | |
| 1896 | - }) | |
| 1897 | - }, buttonProps, { | |
| 1898 | - onClick: e => { | |
| 1899 | - const extendedWindow = window; | |
| 1900 | - const config = extendedWindow?.elementorCommon?.eventsManager?.config; | |
| 1901 | - if (config) { | |
| 1902 | - extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.documentNameDropdown, { | |
| 1903 | - location: config.locations.topBar, | |
| 1904 | - secondaryLocation: config.secondaryLocations.documentNameDropdown, | |
| 1905 | - trigger: config.triggers.dropdownClick, | |
| 1906 | - element: config.elements.dropdown | |
| 1907 | - }); | |
| 1908 | - } | |
| 1909 | - buttonProps.onClick(e); | |
| 1910 | - } | |
| 1911 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_indicator__WEBPACK_IMPORTED_MODULE_9__["default"], { | |
| 1912 | - title: documentTitle, | |
| 1913 | - status: document.status | |
| 1914 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Menu, _extends({ | |
| 1915 | - MenuListProps: { | |
| 1916 | - subheader: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ListSubheader, { | |
| 1917 | - color: "primary", | |
| 1918 | - sx: { | |
| 1919 | - fontStyle: 'italic', | |
| 1920 | - fontWeight: '300' | |
| 1921 | - } | |
| 1922 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Recent', 'elementor')) | |
| 1923 | - }, | |
| 1924 | - PaperProps: { | |
| 1925 | - sx: { | |
| 1926 | - mt: 2.5, | |
| 1927 | - width: 320 | |
| 1928 | - } | |
| 1929 | - } | |
| 1930 | - }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindMenu)(popupState)), recentPosts.map(post => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_post_list_item__WEBPACK_IMPORTED_MODULE_10__.PostListItem, { | |
| 1931 | - key: post.id, | |
| 1932 | - post: post, | |
| 1933 | - closePopup: popupState.close | |
| 1934 | - })), recentPosts.length === 0 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.MenuItem, { | |
| 1935 | - disabled: true | |
| 1936 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ListItemText, { | |
| 1937 | - primaryTypographyProps: { | |
| 1938 | - variant: 'caption', | |
| 1939 | - fontStyle: 'italic' | |
| 1940 | - }, | |
| 1941 | - primary: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('There are no other pages or templates on this site yet.', 'elementor') | |
| 1942 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Divider, { | |
| 1943 | - disabled: recentPosts.length === 0 | |
| 1944 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_create_post_list_item__WEBPACK_IMPORTED_MODULE_8__.CreatePostListItem, { | |
| 1945 | - closePopup: popupState.close | |
| 1946 | - }))); | |
| 1947 | -} | |
| 1948 | - | |
| 1949 | -/***/ }), | |
| 1950 | - | |
| 1951 | -/***/ "./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx": | |
| 1952 | -/*!******************************************************************************************!*\ | |
| 1953 | - !*** ./packages/packages/core/editor-site-navigation/src/contexts/post-list-context.tsx ***! | |
| 1954 | - \******************************************************************************************/ | |
| 1955 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1956 | - | |
| 1957 | -__webpack_require__.r(__webpack_exports__); | |
| 1958 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1959 | -/* harmony export */ PostListContextProvider: function() { return /* binding */ PostListContextProvider; }, | |
| 1960 | -/* harmony export */ usePostListContext: function() { return /* binding */ usePostListContext; } | |
| 1961 | -/* harmony export */ }); | |
| 1962 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1963 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1964 | - | |
| 1965 | - | |
| 1966 | -const defaultValues = { | |
| 1967 | - type: 'page', | |
| 1968 | - editMode: { | |
| 1969 | - mode: 'none', | |
| 1970 | - details: {} | |
| 1971 | - }, | |
| 1972 | - setEditMode: () => null, | |
| 1973 | - resetEditMode: () => null, | |
| 1974 | - setError: () => null | |
| 1975 | -}; | |
| 1976 | -const PostListContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(defaultValues); | |
| 1977 | -const PostListContextProvider = ({ | |
| 1978 | - type, | |
| 1979 | - setError, | |
| 1980 | - children | |
| 1981 | -}) => { | |
| 1982 | - const [editMode, setEditMode] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultValues.editMode); | |
| 1983 | - const resetEditMode = () => { | |
| 1984 | - setEditMode(defaultValues.editMode); | |
| 1985 | - }; | |
| 1986 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PostListContext.Provider, { | |
| 1987 | - value: { | |
| 1988 | - type, | |
| 1989 | - editMode, | |
| 1990 | - setEditMode, | |
| 1991 | - resetEditMode, | |
| 1992 | - setError | |
| 1993 | - } | |
| 1994 | - }, children); | |
| 1995 | -}; | |
| 1996 | -function usePostListContext() { | |
| 1997 | - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PostListContext); | |
| 1998 | - if (!context) { | |
| 1999 | - throw new Error('The `usePostListContext()` hook must be used within an `<PostListContextProvider />`'); | |
| 2000 | - } | |
| 2001 | - return context; | |
| 2002 | -} | |
| 2003 | - | |
| 2004 | -/***/ }), | |
| 2005 | - | |
| 2006 | -/***/ "./packages/packages/core/editor-site-navigation/src/env.ts": | |
| 2007 | -/*!******************************************************************!*\ | |
| 2008 | - !*** ./packages/packages/core/editor-site-navigation/src/env.ts ***! | |
| 2009 | - \******************************************************************/ | |
| 2010 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2011 | - | |
| 2012 | -__webpack_require__.r(__webpack_exports__); | |
| 2013 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2014 | -/* harmony export */ env: function() { return /* binding */ env; } | |
| 2015 | -/* harmony export */ }); | |
| 2016 | -/* harmony import */ var _elementor_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/env */ "@elementor/env"); | |
| 2017 | -/* harmony import */ var _elementor_env__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_env__WEBPACK_IMPORTED_MODULE_0__); | |
| 2018 | - | |
| 2019 | -const { | |
| 2020 | - env | |
| 2021 | -} = (0,_elementor_env__WEBPACK_IMPORTED_MODULE_0__.parseEnv)('@elementor/editor-site-navigation', envData => { | |
| 2022 | - return envData; | |
| 2023 | -}); | |
| 2024 | - | |
| 2025 | -/***/ }), | |
| 2026 | - | |
| 2027 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-create-page.ts": | |
| 2028 | -/*!************************************************************************************!*\ | |
| 2029 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-create-page.ts ***! | |
| 2030 | - \************************************************************************************/ | |
| 2031 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2032 | - | |
| 2033 | -__webpack_require__.r(__webpack_exports__); | |
| 2034 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2035 | -/* harmony export */ "default": function() { return /* binding */ useCreatePage; }, | |
| 2036 | -/* harmony export */ endpointPath: function() { return /* binding */ endpointPath; } | |
| 2037 | -/* harmony export */ }); | |
| 2038 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 2039 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 2040 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); | |
| 2041 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1__); | |
| 2042 | - | |
| 2043 | - | |
| 2044 | -const endpointPath = '/elementor/v1/site-navigation/add-new-post'; | |
| 2045 | -function useCreatePage() { | |
| 2046 | - const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); | |
| 2047 | - return { | |
| 2048 | - create: () => { | |
| 2049 | - setIsLoading(true); | |
| 2050 | - return addNewPage().then(newPost => newPost).finally(() => setIsLoading(false)); | |
| 2051 | - }, | |
| 2052 | - isLoading | |
| 2053 | - }; | |
| 2054 | -} | |
| 2055 | -async function addNewPage() { | |
| 2056 | - return await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ | |
| 2057 | - path: endpointPath, | |
| 2058 | - method: 'POST', | |
| 2059 | - data: { | |
| 2060 | - post_type: 'page' | |
| 2061 | - } | |
| 2062 | - }); | |
| 2063 | -} | |
| 2064 | - | |
| 2065 | -/***/ }), | |
| 2066 | - | |
| 2067 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-homepage-actions.ts": | |
| 2068 | -/*!*****************************************************************************************!*\ | |
| 2069 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-homepage-actions.ts ***! | |
| 2070 | - \*****************************************************************************************/ | |
| 2071 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2072 | - | |
| 2073 | -__webpack_require__.r(__webpack_exports__); | |
| 2074 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2075 | -/* harmony export */ useHomepageActions: function() { return /* binding */ useHomepageActions; } | |
| 2076 | -/* harmony export */ }); | |
| 2077 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/query */ "@elementor/query"); | |
| 2078 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_query__WEBPACK_IMPORTED_MODULE_0__); | |
| 2079 | -/* harmony import */ var _api_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api/settings */ "./packages/packages/core/editor-site-navigation/src/api/settings.ts"); | |
| 2080 | -/* harmony import */ var _use_homepage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./use-homepage */ "./packages/packages/core/editor-site-navigation/src/hooks/use-homepage.ts"); | |
| 2081 | - | |
| 2082 | - | |
| 2083 | - | |
| 2084 | -function useHomepageActions() { | |
| 2085 | - const invalidateSettings = useInvalidateSettings(); | |
| 2086 | - const onSuccess = async () => invalidateSettings({ | |
| 2087 | - exact: true | |
| 2088 | - }); | |
| 2089 | - const updateSettingsMutation = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useMutation)({ | |
| 2090 | - mutationFn: settings => (0,_api_settings__WEBPACK_IMPORTED_MODULE_1__.updateSettings)(settings), | |
| 2091 | - onSuccess | |
| 2092 | - }); | |
| 2093 | - return { | |
| 2094 | - updateSettingsMutation | |
| 2095 | - }; | |
| 2096 | -} | |
| 2097 | -function useInvalidateSettings() { | |
| 2098 | - const queryClient = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useQueryClient)(); | |
| 2099 | - return (options = {}) => { | |
| 2100 | - const queryKey = (0,_use_homepage__WEBPACK_IMPORTED_MODULE_2__.settingsQueryKey)(); | |
| 2101 | - return queryClient.invalidateQueries({ | |
| 2102 | - queryKey | |
| 2103 | - }, options); | |
| 2104 | - }; | |
| 2105 | -} | |
| 2106 | - | |
| 2107 | -/***/ }), | |
| 2108 | - | |
| 2109 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-homepage.ts": | |
| 2110 | -/*!*********************************************************************************!*\ | |
| 2111 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-homepage.ts ***! | |
| 2112 | - \*********************************************************************************/ | |
| 2113 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2114 | - | |
| 2115 | -__webpack_require__.r(__webpack_exports__); | |
| 2116 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2117 | -/* harmony export */ settingsQueryKey: function() { return /* binding */ settingsQueryKey; }, | |
| 2118 | -/* harmony export */ useHomepage: function() { return /* binding */ useHomepage; } | |
| 2119 | -/* harmony export */ }); | |
| 2120 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/query */ "@elementor/query"); | |
| 2121 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_query__WEBPACK_IMPORTED_MODULE_0__); | |
| 2122 | -/* harmony import */ var _api_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api/settings */ "./packages/packages/core/editor-site-navigation/src/api/settings.ts"); | |
| 2123 | - | |
| 2124 | - | |
| 2125 | -const settingsQueryKey = () => ['site-navigation', 'homepage']; | |
| 2126 | -function useHomepage() { | |
| 2127 | - return (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({ | |
| 2128 | - queryKey: settingsQueryKey(), | |
| 2129 | - queryFn: () => (0,_api_settings__WEBPACK_IMPORTED_MODULE_1__.getSettings)() | |
| 2130 | - }); | |
| 2131 | -} | |
| 2132 | - | |
| 2133 | -/***/ }), | |
| 2134 | - | |
| 2135 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts-actions.ts": | |
| 2136 | -/*!**************************************************************************************!*\ | |
| 2137 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-posts-actions.ts ***! | |
| 2138 | - \**************************************************************************************/ | |
| 2139 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2140 | - | |
| 2141 | -__webpack_require__.r(__webpack_exports__); | |
| 2142 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2143 | -/* harmony export */ usePostActions: function() { return /* binding */ usePostActions; } | |
| 2144 | -/* harmony export */ }); | |
| 2145 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/query */ "@elementor/query"); | |
| 2146 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_query__WEBPACK_IMPORTED_MODULE_0__); | |
| 2147 | -/* harmony import */ var _api_post__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api/post */ "./packages/packages/core/editor-site-navigation/src/api/post.ts"); | |
| 2148 | -/* harmony import */ var _use_posts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./use-posts */ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts.ts"); | |
| 2149 | -/* harmony import */ var _use_recent_posts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./use-recent-posts */ "./packages/packages/core/editor-site-navigation/src/hooks/use-recent-posts.ts"); | |
| 2150 | - | |
| 2151 | - | |
| 2152 | - | |
| 2153 | - | |
| 2154 | -function usePostActions(postTypeSlug) { | |
| 2155 | - const invalidatePosts = useInvalidatePosts(postTypeSlug); | |
| 2156 | - const onSuccess = () => invalidatePosts({ | |
| 2157 | - exact: true | |
| 2158 | - }); | |
| 2159 | - const createPost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useMutation)({ | |
| 2160 | - mutationFn: newPost => (0,_api_post__WEBPACK_IMPORTED_MODULE_1__.createRequest)(postTypeSlug, newPost), | |
| 2161 | - onSuccess | |
| 2162 | - }); | |
| 2163 | - const updatePost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useMutation)({ | |
| 2164 | - mutationFn: updatedPost => (0,_api_post__WEBPACK_IMPORTED_MODULE_1__.updateRequest)(postTypeSlug, updatedPost), | |
| 2165 | - onSuccess | |
| 2166 | - }); | |
| 2167 | - const deletePost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useMutation)({ | |
| 2168 | - mutationFn: postId => (0,_api_post__WEBPACK_IMPORTED_MODULE_1__.deleteRequest)(postTypeSlug, postId), | |
| 2169 | - onSuccess | |
| 2170 | - }); | |
| 2171 | - const duplicatePost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useMutation)({ | |
| 2172 | - mutationFn: originalPost => (0,_api_post__WEBPACK_IMPORTED_MODULE_1__.duplicateRequest)(originalPost), | |
| 2173 | - onSuccess | |
| 2174 | - }); | |
| 2175 | - return { | |
| 2176 | - createPost, | |
| 2177 | - updatePost, | |
| 2178 | - deletePost, | |
| 2179 | - duplicatePost | |
| 2180 | - }; | |
| 2181 | -} | |
| 2182 | -function useInvalidatePosts(postTypeSlug) { | |
| 2183 | - const queryClient = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useQueryClient)(); | |
| 2184 | - return (options = {}) => { | |
| 2185 | - const queryKey = (0,_use_posts__WEBPACK_IMPORTED_MODULE_2__.postsQueryKey)(postTypeSlug); | |
| 2186 | - queryClient.invalidateQueries({ | |
| 2187 | - queryKey: _use_recent_posts__WEBPACK_IMPORTED_MODULE_3__.recentPostsQueryKey | |
| 2188 | - }, options); | |
| 2189 | - return queryClient.invalidateQueries({ | |
| 2190 | - queryKey | |
| 2191 | - }, options); | |
| 2192 | - }; | |
| 2193 | -} | |
| 2194 | - | |
| 2195 | -/***/ }), | |
| 2196 | - | |
| 2197 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-posts.ts": | |
| 2198 | -/*!******************************************************************************!*\ | |
| 2199 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-posts.ts ***! | |
| 2200 | - \******************************************************************************/ | |
| 2201 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2202 | - | |
| 2203 | -__webpack_require__.r(__webpack_exports__); | |
| 2204 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2205 | -/* harmony export */ postsQueryKey: function() { return /* binding */ postsQueryKey; }, | |
| 2206 | -/* harmony export */ usePosts: function() { return /* binding */ usePosts; } | |
| 2207 | -/* harmony export */ }); | |
| 2208 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/query */ "@elementor/query"); | |
| 2209 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_query__WEBPACK_IMPORTED_MODULE_0__); | |
| 2210 | -/* harmony import */ var _api_post__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api/post */ "./packages/packages/core/editor-site-navigation/src/api/post.ts"); | |
| 2211 | - | |
| 2212 | - | |
| 2213 | -const postsQueryKey = postTypeSlug => ['site-navigation', 'posts', postTypeSlug]; | |
| 2214 | -const flattenData = data => { | |
| 2215 | - if (!data) { | |
| 2216 | - return data; | |
| 2217 | - } | |
| 2218 | - const flattened = []; | |
| 2219 | - data.pages.forEach(page => { | |
| 2220 | - flattened.push(...page.data); | |
| 2221 | - }); | |
| 2222 | - return flattened; | |
| 2223 | -}; | |
| 2224 | -function usePosts(postTypeSlug) { | |
| 2225 | - const query = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useInfiniteQuery)({ | |
| 2226 | - queryKey: postsQueryKey(postTypeSlug), | |
| 2227 | - queryFn: ({ | |
| 2228 | - pageParam = 1 | |
| 2229 | - }) => (0,_api_post__WEBPACK_IMPORTED_MODULE_1__.getRequest)(postTypeSlug, pageParam), | |
| 2230 | - initialPageParam: 1, | |
| 2231 | - getNextPageParam: lastPage => { | |
| 2232 | - return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : undefined; | |
| 2233 | - } | |
| 2234 | - }); | |
| 2235 | - return { | |
| 2236 | - ...query, | |
| 2237 | - data: { | |
| 2238 | - posts: flattenData(query.data), | |
| 2239 | - total: query.data?.pages[0]?.totalPosts ?? 0 | |
| 2240 | - } | |
| 2241 | - }; | |
| 2242 | -} | |
| 2243 | - | |
| 2244 | -/***/ }), | |
| 2245 | - | |
| 2246 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-recent-posts.ts": | |
| 2247 | -/*!*************************************************************************************!*\ | |
| 2248 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-recent-posts.ts ***! | |
| 2249 | - \*************************************************************************************/ | |
| 2250 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2251 | - | |
| 2252 | -__webpack_require__.r(__webpack_exports__); | |
| 2253 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2254 | -/* harmony export */ "default": function() { return /* binding */ useRecentPosts; }, | |
| 2255 | -/* harmony export */ recentPostsQueryKey: function() { return /* binding */ recentPostsQueryKey; } | |
| 2256 | -/* harmony export */ }); | |
| 2257 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/query */ "@elementor/query"); | |
| 2258 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_query__WEBPACK_IMPORTED_MODULE_0__); | |
| 2259 | -/* harmony import */ var _api_recent_posts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api/recent-posts */ "./packages/packages/core/editor-site-navigation/src/api/recent-posts.ts"); | |
| 2260 | - | |
| 2261 | - | |
| 2262 | -const recentPostsQueryKey = ['site-navigation', 'recent-posts']; | |
| 2263 | -function useRecentPosts() { | |
| 2264 | - return (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({ | |
| 2265 | - queryKey: recentPostsQueryKey, | |
| 2266 | - queryFn: () => (0,_api_recent_posts__WEBPACK_IMPORTED_MODULE_1__.getRequest)() | |
| 2267 | - }); | |
| 2268 | -} | |
| 2269 | - | |
| 2270 | -/***/ }), | |
| 2271 | - | |
| 2272 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-rename-active-document.ts": | |
| 2273 | -/*!***********************************************************************************************!*\ | |
| 2274 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-rename-active-document.ts ***! | |
| 2275 | - \***********************************************************************************************/ | |
| 2276 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2277 | - | |
| 2278 | -__webpack_require__.r(__webpack_exports__); | |
| 2279 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2280 | -/* harmony export */ "default": function() { return /* binding */ useRenameActiveDocument; } | |
| 2281 | -/* harmony export */ }); | |
| 2282 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters"); | |
| 2283 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_0__); | |
| 2284 | - | |
| 2285 | -function getV1DocumentsManager() { | |
| 2286 | - const documentsManager = window.elementor?.documents; | |
| 2287 | - if (!documentsManager) { | |
| 2288 | - throw new Error('Elementor Editor V1 documents manager not found'); | |
| 2289 | - } | |
| 2290 | - return documentsManager; | |
| 2291 | -} | |
| 2292 | -function useRenameActiveDocument() { | |
| 2293 | - return async title => { | |
| 2294 | - const currentDocument = getV1DocumentsManager().getCurrent(); | |
| 2295 | - const container = currentDocument.container; | |
| 2296 | - await (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_0__.__privateRunCommand)('document/elements/settings', { | |
| 2297 | - container, | |
| 2298 | - settings: { | |
| 2299 | - post_title: title | |
| 2300 | - } | |
| 2301 | - }); | |
| 2302 | - }; | |
| 2303 | -} | |
| 2304 | - | |
| 2305 | -/***/ }), | |
| 2306 | - | |
| 2307 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-reverse-html-entities.ts": | |
| 2308 | -/*!**********************************************************************************************!*\ | |
| 2309 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-reverse-html-entities.ts ***! | |
| 2310 | - \**********************************************************************************************/ | |
| 2311 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2312 | - | |
| 2313 | -__webpack_require__.r(__webpack_exports__); | |
| 2314 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2315 | -/* harmony export */ useReverseHtmlEntities: function() { return /* binding */ useReverseHtmlEntities; } | |
| 2316 | -/* harmony export */ }); | |
| 2317 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 2318 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 2319 | - | |
| 2320 | -function useReverseHtmlEntities(escapedHTML = '') { | |
| 2321 | - return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { | |
| 2322 | - const textarea = document.createElement('textarea'); | |
| 2323 | - textarea.innerHTML = escapedHTML; | |
| 2324 | - const { | |
| 2325 | - value | |
| 2326 | - } = textarea; | |
| 2327 | - textarea.remove(); | |
| 2328 | - return value; | |
| 2329 | - }, [escapedHTML]); | |
| 2330 | -} | |
| 2331 | - | |
| 2332 | -/***/ }), | |
| 2333 | - | |
| 2334 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-toggle-button-props.ts": | |
| 2335 | -/*!********************************************************************************************!*\ | |
| 2336 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-toggle-button-props.ts ***! | |
| 2337 | - \********************************************************************************************/ | |
| 2338 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2339 | - | |
| 2340 | -__webpack_require__.r(__webpack_exports__); | |
| 2341 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2342 | -/* harmony export */ useToggleButtonProps: function() { return /* binding */ useToggleButtonProps; } | |
| 2343 | -/* harmony export */ }); | |
| 2344 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 2345 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__); | |
| 2346 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 2347 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); | |
| 2348 | -/* harmony import */ var _components_panel_panel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/panel/panel */ "./packages/packages/core/editor-site-navigation/src/components/panel/panel.ts"); | |
| 2349 | - | |
| 2350 | - | |
| 2351 | - | |
| 2352 | -function useToggleButtonProps() { | |
| 2353 | - const { | |
| 2354 | - isOpen: selectedState, | |
| 2355 | - isBlocked | |
| 2356 | - } = (0,_components_panel_panel__WEBPACK_IMPORTED_MODULE_2__.usePanelStatus)(); | |
| 2357 | - const { | |
| 2358 | - open, | |
| 2359 | - close | |
| 2360 | - } = (0,_components_panel_panel__WEBPACK_IMPORTED_MODULE_2__.usePanelActions)(); | |
| 2361 | - return { | |
| 2362 | - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Pages', 'elementor'), | |
| 2363 | - icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PagesIcon, | |
| 2364 | - onClick: () => { | |
| 2365 | - const extendedWindow = window; | |
| 2366 | - const config = extendedWindow?.elementorCommon?.eventsManager?.config; | |
| 2367 | - if (config) { | |
| 2368 | - extendedWindow.elementorCommon.eventsManager.dispatchEvent('top_bar_pages', { | |
| 2369 | - location: config.locations.topBar, | |
| 2370 | - secondaryLocation: config.secondaryLocations.elementorLogo, | |
| 2371 | - trigger: config.triggers.click, | |
| 2372 | - element: config.elements.buttonIcon | |
| 2373 | - }); | |
| 2374 | - } | |
| 2375 | - return selectedState ? close() : open(); | |
| 2376 | - }, | |
| 2377 | - selected: selectedState, | |
| 2378 | - disabled: isBlocked | |
| 2379 | - }; | |
| 2380 | -} | |
| 2381 | - | |
| 2382 | -/***/ }), | |
| 2383 | - | |
| 2384 | -/***/ "./packages/packages/core/editor-site-navigation/src/hooks/use-user.ts": | |
| 2385 | -/*!*****************************************************************************!*\ | |
| 2386 | - !*** ./packages/packages/core/editor-site-navigation/src/hooks/use-user.ts ***! | |
| 2387 | - \*****************************************************************************/ | |
| 2388 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2389 | - | |
| 2390 | -__webpack_require__.r(__webpack_exports__); | |
| 2391 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2392 | -/* harmony export */ "default": function() { return /* binding */ useUser; } | |
| 2393 | -/* harmony export */ }); | |
| 2394 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/query */ "@elementor/query"); | |
| 2395 | -/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_query__WEBPACK_IMPORTED_MODULE_0__); | |
| 2396 | -/* harmony import */ var _api_user__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api/user */ "./packages/packages/core/editor-site-navigation/src/api/user.ts"); | |
| 2397 | - | |
| 2398 | - | |
| 2399 | -const userQueryKey = () => ['site-navigation', 'user']; | |
| 2400 | -function useUser() { | |
| 2401 | - return (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({ | |
| 2402 | - queryKey: userQueryKey(), | |
| 2403 | - queryFn: _api_user__WEBPACK_IMPORTED_MODULE_1__.getUser, | |
| 2404 | - staleTime: 30 * 60 * 1000 | |
| 2405 | - }); | |
| 2406 | -} | |
| 2407 | - | |
| 2408 | -/***/ }), | |
| 2409 | - | |
| 2410 | -/***/ "./packages/packages/core/editor-site-navigation/src/icons-map.ts": | |
| 2411 | -/*!************************************************************************!*\ | |
| 2412 | - !*** ./packages/packages/core/editor-site-navigation/src/icons-map.ts ***! | |
| 2413 | - \************************************************************************/ | |
| 2414 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2415 | - | |
| 2416 | -__webpack_require__.r(__webpack_exports__); | |
| 2417 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2418 | -/* harmony export */ extendIconsMap: function() { return /* binding */ extendIconsMap; }, | |
| 2419 | -/* harmony export */ getIconsMap: function() { return /* binding */ getIconsMap; }, | |
| 2420 | -/* harmony export */ resetIconsMap: function() { return /* binding */ resetIconsMap; } | |
| 2421 | -/* harmony export */ }); | |
| 2422 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 2423 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__); | |
| 2424 | - | |
| 2425 | -const initialIconsMap = { | |
| 2426 | - page: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PageTemplateIcon, | |
| 2427 | - section: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.SectionTemplateIcon, | |
| 2428 | - container: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.ContainerTemplateIcon, | |
| 2429 | - 'wp-page': _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PageTypeIcon, | |
| 2430 | - 'wp-post': _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PostTypeIcon | |
| 2431 | -}; | |
| 2432 | -let iconsMap = { | |
| 2433 | - ...initialIconsMap | |
| 2434 | -}; | |
| 2435 | -function extendIconsMap(additionalIcons) { | |
| 2436 | - Object.assign(iconsMap, additionalIcons); | |
| 2437 | -} | |
| 2438 | -function getIconsMap() { | |
| 2439 | - return iconsMap; | |
| 2440 | -} | |
| 2441 | -function resetIconsMap() { | |
| 2442 | - iconsMap = { | |
| 2443 | - ...initialIconsMap | |
| 2444 | - }; | |
| 2445 | -} | |
| 2446 | - | |
| 2447 | -/***/ }), | |
| 2448 | - | |
| 2449 | -/***/ "./packages/packages/core/editor-site-navigation/src/init.ts": | |
| 2450 | -/*!*******************************************************************!*\ | |
| 2451 | - !*** ./packages/packages/core/editor-site-navigation/src/init.ts ***! | |
| 2452 | - \*******************************************************************/ | |
| 2453 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2454 | - | |
| 2455 | -__webpack_require__.r(__webpack_exports__); | |
| 2456 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2457 | -/* harmony export */ init: function() { return /* binding */ init; } | |
| 2458 | -/* harmony export */ }); | |
| 2459 | -/* harmony import */ var _elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-app-bar */ "@elementor/editor-app-bar"); | |
| 2460 | -/* harmony import */ var _elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_0__); | |
| 2461 | -/* harmony import */ var _elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-panels */ "@elementor/editor-panels"); | |
| 2462 | -/* harmony import */ var _elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__); | |
| 2463 | -/* harmony import */ var _components_panel_panel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/panel/panel */ "./packages/packages/core/editor-site-navigation/src/components/panel/panel.ts"); | |
| 2464 | -/* harmony import */ var _components_top_bar_recently_edited__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/top-bar/recently-edited */ "./packages/packages/core/editor-site-navigation/src/components/top-bar/recently-edited.tsx"); | |
| 2465 | -/* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./env */ "./packages/packages/core/editor-site-navigation/src/env.ts"); | |
| 2466 | -/* harmony import */ var _hooks_use_toggle_button_props__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hooks/use-toggle-button-props */ "./packages/packages/core/editor-site-navigation/src/hooks/use-toggle-button-props.ts"); | |
| 2467 | - | |
| 2468 | - | |
| 2469 | - | |
| 2470 | - | |
| 2471 | - | |
| 2472 | - | |
| 2473 | -function init() { | |
| 2474 | - registerTopBarMenuItems(); | |
| 2475 | - // TODO 06/06/2023 : remove if when we are production ready | |
| 2476 | - if (_env__WEBPACK_IMPORTED_MODULE_4__.env.is_pages_panel_active) { | |
| 2477 | - (0,_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_1__.__registerPanel)(_components_panel_panel__WEBPACK_IMPORTED_MODULE_2__.panel); | |
| 2478 | - registerButton(); | |
| 2479 | - } | |
| 2480 | -} | |
| 2481 | -function registerTopBarMenuItems() { | |
| 2482 | - (0,_elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_0__.injectIntoPageIndication)({ | |
| 2483 | - id: 'document-recently-edited', | |
| 2484 | - component: _components_top_bar_recently_edited__WEBPACK_IMPORTED_MODULE_3__["default"] | |
| 2485 | - }); | |
| 2486 | -} | |
| 2487 | -function registerButton() { | |
| 2488 | - _elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_0__.toolsMenu.registerToggleAction({ | |
| 2489 | - id: 'toggle-site-navigation-panel', | |
| 2490 | - priority: 20, | |
| 2491 | - useProps: _hooks_use_toggle_button_props__WEBPACK_IMPORTED_MODULE_5__.useToggleButtonProps | |
| 2492 | - }); | |
| 2493 | -} | |
| 2494 | - | |
| 2495 | -/***/ }), | |
| 2496 | - | |
| 2497 | -/***/ "@elementor/editor-app-bar": | |
| 2498 | -/*!***********************************************!*\ | |
| 2499 | - !*** external ["elementorV2","editorAppBar"] ***! | |
| 2500 | - \***********************************************/ | |
| 2501 | -/***/ (function(module) { | |
| 2502 | - | |
| 2503 | -module.exports = window["elementorV2"]["editorAppBar"]; | |
| 2504 | - | |
| 2505 | -/***/ }), | |
| 2506 | - | |
| 2507 | -/***/ "@elementor/editor-documents": | |
| 2508 | -/*!**************************************************!*\ | |
| 2509 | - !*** external ["elementorV2","editorDocuments"] ***! | |
| 2510 | - \**************************************************/ | |
| 2511 | -/***/ (function(module) { | |
| 2512 | - | |
| 2513 | -module.exports = window["elementorV2"]["editorDocuments"]; | |
| 2514 | - | |
| 2515 | -/***/ }), | |
| 2516 | - | |
| 2517 | -/***/ "@elementor/editor-panels": | |
| 2518 | -/*!***********************************************!*\ | |
| 2519 | - !*** external ["elementorV2","editorPanels"] ***! | |
| 2520 | - \***********************************************/ | |
| 2521 | -/***/ (function(module) { | |
| 2522 | - | |
| 2523 | -module.exports = window["elementorV2"]["editorPanels"]; | |
| 2524 | - | |
| 2525 | -/***/ }), | |
| 2526 | - | |
| 2527 | -/***/ "@elementor/editor-v1-adapters": | |
| 2528 | -/*!***************************************************!*\ | |
| 2529 | - !*** external ["elementorV2","editorV1Adapters"] ***! | |
| 2530 | - \***************************************************/ | |
| 2531 | -/***/ (function(module) { | |
| 2532 | - | |
| 2533 | -module.exports = window["elementorV2"]["editorV1Adapters"]; | |
| 2534 | - | |
| 2535 | -/***/ }), | |
| 2536 | - | |
| 2537 | -/***/ "@elementor/env": | |
| 2538 | -/*!**************************************!*\ | |
| 2539 | - !*** external ["elementorV2","env"] ***! | |
| 2540 | - \**************************************/ | |
| 2541 | -/***/ (function(module) { | |
| 2542 | - | |
| 2543 | -module.exports = window["elementorV2"]["env"]; | |
| 2544 | - | |
| 2545 | -/***/ }), | |
| 2546 | - | |
| 2547 | -/***/ "@elementor/events": | |
| 2548 | -/*!*****************************************!*\ | |
| 2549 | - !*** external ["elementorV2","events"] ***! | |
| 2550 | - \*****************************************/ | |
| 2551 | -/***/ (function(module) { | |
| 2552 | - | |
| 2553 | -module.exports = window["elementorV2"]["events"]; | |
| 2554 | - | |
| 2555 | -/***/ }), | |
| 2556 | - | |
| 2557 | -/***/ "@elementor/icons": | |
| 2558 | -/*!****************************************!*\ | |
| 2559 | - !*** external ["elementorV2","icons"] ***! | |
| 2560 | - \****************************************/ | |
| 2561 | -/***/ (function(module) { | |
| 2562 | - | |
| 2563 | -module.exports = window["elementorV2"]["icons"]; | |
| 2564 | - | |
| 2565 | -/***/ }), | |
| 2566 | - | |
| 2567 | -/***/ "@elementor/query": | |
| 2568 | -/*!****************************************!*\ | |
| 2569 | - !*** external ["elementorV2","query"] ***! | |
| 2570 | - \****************************************/ | |
| 2571 | -/***/ (function(module) { | |
| 2572 | - | |
| 2573 | -module.exports = window["elementorV2"]["query"]; | |
| 2574 | - | |
| 2575 | -/***/ }), | |
| 2576 | - | |
| 2577 | -/***/ "@elementor/ui": | |
| 2578 | -/*!*************************************!*\ | |
| 2579 | - !*** external ["elementorV2","ui"] ***! | |
| 2580 | - \*************************************/ | |
| 2581 | -/***/ (function(module) { | |
| 2582 | - | |
| 2583 | -module.exports = window["elementorV2"]["ui"]; | |
| 2584 | - | |
| 2585 | -/***/ }), | |
| 2586 | - | |
| 2587 | -/***/ "@wordpress/api-fetch": | |
| 2588 | -/*!**********************************!*\ | |
| 2589 | - !*** external ["wp","apiFetch"] ***! | |
| 2590 | - \**********************************/ | |
| 2591 | -/***/ (function(module) { | |
| 2592 | - | |
| 2593 | -module.exports = window["wp"]["apiFetch"]; | |
| 2594 | - | |
| 2595 | -/***/ }), | |
| 2596 | - | |
| 2597 | -/***/ "@wordpress/i18n": | |
| 2598 | -/*!******************************!*\ | |
| 2599 | - !*** external ["wp","i18n"] ***! | |
| 2600 | - \******************************/ | |
| 2601 | -/***/ (function(module) { | |
| 2602 | - | |
| 2603 | -module.exports = window["wp"]["i18n"]; | |
| 2604 | - | |
| 2605 | -/***/ }), | |
| 2606 | - | |
| 2607 | -/***/ "react": | |
| 2608 | -/*!**************************!*\ | |
| 2609 | - !*** external ["React"] ***! | |
| 2610 | - \**************************/ | |
| 2611 | -/***/ (function(module) { | |
| 2612 | - | |
| 2613 | -module.exports = window["React"]; | |
| 2614 | - | |
| 2615 | -/***/ }) | |
| 2616 | - | |
| 2617 | -/******/ }); | |
| 2618 | -/************************************************************************/ | |
| 2619 | -/******/ // The module cache | |
| 2620 | -/******/ var __webpack_module_cache__ = {}; | |
| 2621 | -/******/ | |
| 2622 | -/******/ // The require function | |
| 2623 | -/******/ function __webpack_require__(moduleId) { | |
| 2624 | -/******/ // Check if module is in cache | |
| 2625 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 2626 | -/******/ if (cachedModule !== undefined) { | |
| 2627 | -/******/ return cachedModule.exports; | |
| 2628 | -/******/ } | |
| 2629 | -/******/ // Create a new module (and put it into the cache) | |
| 2630 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 2631 | -/******/ // no module.id needed | |
| 2632 | -/******/ // no module.loaded needed | |
| 2633 | -/******/ exports: {} | |
| 2634 | -/******/ }; | |
| 2635 | -/******/ | |
| 2636 | -/******/ // Execute the module function | |
| 2637 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 2638 | -/******/ | |
| 2639 | -/******/ // Return the exports of the module | |
| 2640 | -/******/ return module.exports; | |
| 2641 | -/******/ } | |
| 2642 | -/******/ | |
| 2643 | -/************************************************************************/ | |
| 2644 | -/******/ /* webpack/runtime/compat get default export */ | |
| 2645 | -/******/ !function() { | |
| 2646 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 2647 | -/******/ __webpack_require__.n = function(module) { | |
| 2648 | -/******/ var getter = module && module.__esModule ? | |
| 2649 | -/******/ function() { return module['default']; } : | |
| 2650 | -/******/ function() { return module; }; | |
| 2651 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 2652 | -/******/ return getter; | |
| 2653 | -/******/ }; | |
| 2654 | -/******/ }(); | |
| 2655 | -/******/ | |
| 2656 | -/******/ /* webpack/runtime/define property getters */ | |
| 2657 | -/******/ !function() { | |
| 2658 | -/******/ // define getter functions for harmony exports | |
| 2659 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 2660 | -/******/ for(var key in definition) { | |
| 2661 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 2662 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 2663 | -/******/ } | |
| 2664 | -/******/ } | |
| 2665 | -/******/ }; | |
| 2666 | -/******/ }(); | |
| 2667 | -/******/ | |
| 2668 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 2669 | -/******/ !function() { | |
| 2670 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 2671 | -/******/ }(); | |
| 2672 | -/******/ | |
| 2673 | -/******/ /* webpack/runtime/make namespace object */ | |
| 2674 | -/******/ !function() { | |
| 2675 | -/******/ // define __esModule on exports | |
| 2676 | -/******/ __webpack_require__.r = function(exports) { | |
| 2677 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 2678 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 2679 | -/******/ } | |
| 2680 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 2681 | -/******/ }; | |
| 2682 | -/******/ }(); | |
| 2683 | -/******/ | |
| 2684 | -/************************************************************************/ | |
| 2685 | -var __webpack_exports__ = {}; | |
| 2686 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 2687 | -!function() { | |
| 2688 | -/*!********************************************************************!*\ | |
| 2689 | - !*** ./packages/packages/core/editor-site-navigation/src/index.ts ***! | |
| 2690 | - \********************************************************************/ | |
| 2691 | -__webpack_require__.r(__webpack_exports__); | |
| 2692 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2693 | -/* harmony export */ extendIconsMap: function() { return /* reexport safe */ _icons_map__WEBPACK_IMPORTED_MODULE_0__.extendIconsMap; }, | |
| 2694 | -/* harmony export */ init: function() { return /* reexport safe */ _init__WEBPACK_IMPORTED_MODULE_1__.init; } | |
| 2695 | -/* harmony export */ }); | |
| 2696 | -/* harmony import */ var _icons_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./icons-map */ "./packages/packages/core/editor-site-navigation/src/icons-map.ts"); | |
| 2697 | -/* harmony import */ var _init__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./init */ "./packages/packages/core/editor-site-navigation/src/init.ts"); | |
| 2698 | - | |
| 2699 | - | |
| 2700 | -}(); | |
| 2701 | -(window.elementorV2 = window.elementorV2 || {}).editorSiteNavigation = __webpack_exports__; | |
| 2702 | -/******/ })() | |
| 2703 | -; | |
| 1210 | +//#endregion | |
| 1211 | +})(elementorV2.icons, elementorV2.editorAppBar, elementorV2.editorPanels, React, wp.i18n, elementorV2.ui, wp.apiFetch, elementorV2.query, elementorV2.editorDocuments, elementorV2.editorV1Adapters, elementorV2.events, elementorV2.env); | |
| 2704 | 1212 | window.elementorV2.editorSiteNavigation?.init?.(); |
| 2705 | 1213 | //# sourceMappingURL=editor-site-navigation.js.map |