@elementor/editor-site-navigation 0.22.5 → 0.22.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +38 -328
  2. package/dist/index.js +147 -156
  3. package/dist/index.mjs +168 -175
  4. package/package.json +49 -49
  5. package/src/api/post.ts +18 -18
  6. package/src/api/recent-posts.ts +1 -1
  7. package/src/api/settings.ts +4 -4
  8. package/src/api/user.ts +4 -4
  9. package/src/components/panel/actions-menu/action-menu-item.tsx +7 -10
  10. package/src/components/panel/actions-menu/actions/__tests__/set-home.test.tsx +12 -9
  11. package/src/components/panel/actions-menu/actions/delete.tsx +27 -25
  12. package/src/components/panel/actions-menu/actions/duplicate.tsx +5 -7
  13. package/src/components/panel/actions-menu/actions/rename.tsx +11 -13
  14. package/src/components/panel/actions-menu/actions/set-home.tsx +6 -8
  15. package/src/components/panel/actions-menu/actions/view.tsx +3 -5
  16. package/src/components/panel/error-snackbar.tsx +4 -3
  17. package/src/components/panel/panel.ts +1 -5
  18. package/src/components/panel/posts-list/__tests__/posts-collapsible-list.test.tsx +66 -19
  19. package/src/components/panel/posts-list/collapsible-list.tsx +38 -29
  20. package/src/components/panel/posts-list/error-state.tsx +35 -27
  21. package/src/components/panel/posts-list/list-items/edit-mode-template.tsx +18 -40
  22. package/src/components/panel/posts-list/list-items/list-item-create.tsx +5 -1
  23. package/src/components/panel/posts-list/list-items/list-item-duplicate.tsx +5 -1
  24. package/src/components/panel/posts-list/list-items/list-item-rename.tsx +3 -5
  25. package/src/components/panel/posts-list/list-items/list-item-view.tsx +20 -19
  26. package/src/components/panel/posts-list/posts-collapsible-list.tsx +22 -24
  27. package/src/components/shared/page-title-and-status.tsx +4 -2
  28. package/src/components/top-bar/__tests__/add-new-page.test.tsx +33 -16
  29. package/src/components/top-bar/__tests__/recently-edited.test.tsx +157 -120
  30. package/src/components/top-bar/chip-doc-type.tsx +1 -3
  31. package/src/components/top-bar/create-post-list-item.tsx +1 -1
  32. package/src/components/top-bar/indicator.tsx +17 -15
  33. package/src/components/top-bar/post-list-item.tsx +2 -6
  34. package/src/components/top-bar/recently-edited.tsx +13 -19
  35. package/src/contexts/post-list-context.tsx +40 -34
  36. package/src/env.ts +2 -2
  37. package/src/hooks/__tests__/use-posts.test.ts +19 -3
  38. package/src/hooks/use-create-page.ts +2 -2
  39. package/src/hooks/use-homepage.ts +1 -1
  40. package/src/hooks/use-posts.ts +1 -1
  41. package/src/hooks/use-toggle-button-props.ts +1 -5
  42. package/src/hooks/use-user.ts +1 -1
  43. package/src/icons-map.ts +1 -1
  44. package/src/types.ts +22 -22
@@ -1,6 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { fireEvent, render, screen } from '@testing-library/react';
3
- import { __useHostDocument as useHostDocument, __useActiveDocument as useActiveDocument, __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
3
+ import {
4
+ __useHostDocument as useHostDocument,
5
+ __useActiveDocument as useActiveDocument,
6
+ __useNavigateToDocument as useNavigateToDocument,
7
+ } from '@elementor/editor-documents';
4
8
  import RecentlyEdited from '../recently-edited';
5
9
  import { createMockDocument } from 'test-utils';
6
10
  import useRecentPosts from '../../../hooks/use-recent-posts';
@@ -12,29 +16,32 @@ jest.mock( '@elementor/editor-documents', () => ( {
12
16
  __useNavigateToDocument: jest.fn(),
13
17
  } ) );
14
18
 
15
- jest.mock( '../../../hooks/use-recent-posts', () => (
16
- {
17
- default: jest.fn( () => ( { isLoading: false, data: [] } ) ),
18
- __esModule: true,
19
- }
20
- ) );
21
-
22
- jest.mock( '../../../hooks/use-user', () => (
23
- {
24
- default: jest.fn( () => ( { isLoading: false, data: { capabilities: {
25
- edit_posts: true,
26
- } } } ) ),
27
- __esModule: true,
28
- }
29
- ) );
19
+ jest.mock( '../../../hooks/use-recent-posts', () => ( {
20
+ default: jest.fn( () => ( { isLoading: false, data: [] } ) ),
21
+ __esModule: true,
22
+ } ) );
23
+
24
+ jest.mock( '../../../hooks/use-user', () => ( {
25
+ default: jest.fn( () => ( {
26
+ isLoading: false,
27
+ data: {
28
+ capabilities: {
29
+ edit_posts: true,
30
+ },
31
+ },
32
+ } ) ),
33
+ __esModule: true,
34
+ } ) );
30
35
 
31
36
  describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
32
37
  it( 'should show the title of the active document without its status when the document is published', async () => {
33
38
  // Arrange.
34
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
35
- id: 1,
36
- title: 'Active Document',
37
- } ) );
39
+ jest.mocked( useActiveDocument ).mockReturnValue(
40
+ createMockDocument( {
41
+ id: 1,
42
+ title: 'Active Document',
43
+ } )
44
+ );
38
45
 
39
46
  // Act.
40
47
  render( <RecentlyEdited /> );
@@ -46,14 +53,16 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
46
53
 
47
54
  it( 'should show the title of the active document with its status when the document is not published', async () => {
48
55
  // Arrange.
49
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
50
- id: 1,
51
- title: 'Active Document',
52
- status: {
53
- value: 'draft',
54
- label: 'Draft',
55
- },
56
- } ) );
56
+ jest.mocked( useActiveDocument ).mockReturnValue(
57
+ createMockDocument( {
58
+ id: 1,
59
+ title: 'Active Document',
60
+ status: {
61
+ value: 'draft',
62
+ label: 'Draft',
63
+ },
64
+ } )
65
+ );
57
66
 
58
67
  // Act.
59
68
  render( <RecentlyEdited /> );
@@ -67,10 +76,12 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
67
76
  // Arrange.
68
77
  jest.mocked( useActiveDocument ).mockReturnValue( null );
69
78
 
70
- jest.mocked( useHostDocument ).mockReturnValue( createMockDocument( {
71
- id: 1,
72
- title: 'Host Document',
73
- } ) );
79
+ jest.mocked( useHostDocument ).mockReturnValue(
80
+ createMockDocument( {
81
+ id: 1,
82
+ title: 'Host Document',
83
+ } )
84
+ );
74
85
 
75
86
  // Act.
76
87
  render( <RecentlyEdited /> );
@@ -81,19 +92,23 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
81
92
 
82
93
  it( 'should show the title of the host document when the active document is kit', () => {
83
94
  // Arrange.
84
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
85
- id: 1,
86
- title: 'Active Document',
87
- type: {
88
- value: 'kit',
89
- label: 'Kit',
90
- },
91
- } ) );
95
+ jest.mocked( useActiveDocument ).mockReturnValue(
96
+ createMockDocument( {
97
+ id: 1,
98
+ title: 'Active Document',
99
+ type: {
100
+ value: 'kit',
101
+ label: 'Kit',
102
+ },
103
+ } )
104
+ );
92
105
 
93
- jest.mocked( useHostDocument ).mockReturnValue( createMockDocument( {
94
- id: 2,
95
- title: 'Host Document',
96
- } ) );
106
+ jest.mocked( useHostDocument ).mockReturnValue(
107
+ createMockDocument( {
108
+ id: 2,
109
+ title: 'Host Document',
110
+ } )
111
+ );
97
112
 
98
113
  // Act.
99
114
  render( <RecentlyEdited /> );
@@ -117,19 +132,23 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
117
132
 
118
133
  it( 'should show empty state', () => {
119
134
  // Arrange.
120
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
121
- id: 1,
122
- title: 'Header',
123
- type: {
124
- value: 'header',
125
- label: 'Header',
126
- },
127
- } ) );
135
+ jest.mocked( useActiveDocument ).mockReturnValue(
136
+ createMockDocument( {
137
+ id: 1,
138
+ title: 'Header',
139
+ type: {
140
+ value: 'header',
141
+ label: 'Header',
142
+ },
143
+ } )
144
+ );
128
145
 
129
146
  const isLoading = false;
130
147
  const recentPosts: RecentPost[] = [];
131
148
 
132
- jest.mocked( useRecentPosts ).mockReturnValue( { isLoading, data: recentPosts } as ReturnType<typeof useRecentPosts> );
149
+ jest.mocked( useRecentPosts ).mockReturnValue( { isLoading, data: recentPosts } as ReturnType<
150
+ typeof useRecentPosts
151
+ > );
133
152
 
134
153
  render( <RecentlyEdited /> );
135
154
 
@@ -144,32 +163,38 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
144
163
 
145
164
  it( 'should open the recently edited menu on click', () => {
146
165
  // Arrange.
147
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
148
- id: 1,
149
- title: 'Header',
150
- type: {
151
- value: 'header',
152
- label: 'Header',
153
- },
154
- } ) );
166
+ jest.mocked( useActiveDocument ).mockReturnValue(
167
+ createMockDocument( {
168
+ id: 1,
169
+ title: 'Header',
170
+ type: {
171
+ value: 'header',
172
+ label: 'Header',
173
+ },
174
+ } )
175
+ );
155
176
 
156
177
  const isLoading = false;
157
- const recentPosts: RecentPost[] = [ {
158
- id: 2,
159
- title: 'Test post',
160
- edit_url: 'some_url',
161
- type: {
162
- post_type: 'post',
163
- doc_type: 'wp-post',
164
- label: 'Post',
165
- },
166
- date_modified: 123,
167
- user_can: {
168
- edit: true,
178
+ const recentPosts: RecentPost[] = [
179
+ {
180
+ id: 2,
181
+ title: 'Test post',
182
+ edit_url: 'some_url',
183
+ type: {
184
+ post_type: 'post',
185
+ doc_type: 'wp-post',
186
+ label: 'Post',
187
+ },
188
+ date_modified: 123,
189
+ user_can: {
190
+ edit: true,
191
+ },
169
192
  },
170
- } ];
193
+ ];
171
194
 
172
- jest.mocked( useRecentPosts ).mockReturnValue( { isLoading, data: recentPosts } as ReturnType<typeof useRecentPosts> );
195
+ jest.mocked( useRecentPosts ).mockReturnValue( { isLoading, data: recentPosts } as ReturnType<
196
+ typeof useRecentPosts
197
+ > );
173
198
 
174
199
  render( <RecentlyEdited /> );
175
200
 
@@ -189,14 +214,16 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
189
214
 
190
215
  it( 'should render titles with HTML entities', () => {
191
216
  // Arrange.
192
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
193
- id: 1,
194
- title: 'Header title with special char &#165;',
195
- type: {
196
- value: 'header',
197
- label: 'Header',
198
- },
199
- } ) );
217
+ jest.mocked( useActiveDocument ).mockReturnValue(
218
+ createMockDocument( {
219
+ id: 1,
220
+ title: 'Header title with special char &#165;',
221
+ type: {
222
+ value: 'header',
223
+ label: 'Header',
224
+ },
225
+ } )
226
+ );
200
227
 
201
228
  const isLoading = false;
202
229
  const recentPosts: RecentPost[] = [
@@ -244,7 +271,9 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
244
271
  },
245
272
  ];
246
273
 
247
- jest.mocked( useRecentPosts ).mockReturnValue( { isLoading, data: recentPosts } as ReturnType<typeof useRecentPosts> );
274
+ jest.mocked( useRecentPosts ).mockReturnValue( { isLoading, data: recentPosts } as ReturnType<
275
+ typeof useRecentPosts
276
+ > );
248
277
 
249
278
  // Act.
250
279
  render( <RecentlyEdited /> );
@@ -262,10 +291,12 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
262
291
 
263
292
  it( 'should navigate to document on click', () => {
264
293
  // Arrange.
265
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
266
- id: 1,
267
- title: 'Test',
268
- } ) );
294
+ jest.mocked( useActiveDocument ).mockReturnValue(
295
+ createMockDocument( {
296
+ id: 1,
297
+ title: 'Test',
298
+ } )
299
+ );
269
300
 
270
301
  const navigateToDocument = jest.fn();
271
302
 
@@ -273,21 +304,23 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
273
304
 
274
305
  jest.mocked( useRecentPosts ).mockReturnValue( {
275
306
  isLoading: false,
276
- data: [ {
277
- id: 123,
278
- title: 'Test post',
279
- edit_url: 'some_url',
280
- type: {
281
- post_type: 'post',
282
- doc_type: 'wp-post',
283
- label: 'Post',
284
- },
285
- date_modified: 123,
286
- user_can: {
287
- edit: true,
307
+ data: [
308
+ {
309
+ id: 123,
310
+ title: 'Test post',
311
+ edit_url: 'some_url',
312
+ type: {
313
+ post_type: 'post',
314
+ doc_type: 'wp-post',
315
+ label: 'Post',
316
+ },
317
+ date_modified: 123,
318
+ user_can: {
319
+ edit: true,
320
+ },
288
321
  },
289
- } ],
290
- } as ReturnType<typeof useRecentPosts> );
322
+ ],
323
+ } as ReturnType< typeof useRecentPosts > );
291
324
 
292
325
  render( <RecentlyEdited /> );
293
326
 
@@ -304,10 +337,12 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
304
337
 
305
338
  it( 'should be disabled when user cant edit post', () => {
306
339
  // Arrange.
307
- jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
308
- id: 1,
309
- title: 'Test',
310
- } ) );
340
+ jest.mocked( useActiveDocument ).mockReturnValue(
341
+ createMockDocument( {
342
+ id: 1,
343
+ title: 'Test',
344
+ } )
345
+ );
311
346
 
312
347
  const navigateToDocument = jest.fn();
313
348
 
@@ -315,21 +350,23 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
315
350
 
316
351
  jest.mocked( useRecentPosts ).mockReturnValue( {
317
352
  isLoading: false,
318
- data: [ {
319
- id: 123,
320
- title: 'Test post',
321
- edit_url: 'some_url',
322
- type: {
323
- post_type: 'post',
324
- doc_type: 'wp-post',
325
- label: 'Post',
326
- },
327
- date_modified: 123,
328
- user_can: {
329
- edit: false,
353
+ data: [
354
+ {
355
+ id: 123,
356
+ title: 'Test post',
357
+ edit_url: 'some_url',
358
+ type: {
359
+ post_type: 'post',
360
+ doc_type: 'wp-post',
361
+ label: 'Post',
362
+ },
363
+ date_modified: 123,
364
+ user_can: {
365
+ edit: false,
366
+ },
330
367
  },
331
- } ],
332
- } as ReturnType<typeof useRecentPosts> );
368
+ ],
369
+ } as ReturnType< typeof useRecentPosts > );
333
370
 
334
371
  render( <RecentlyEdited /> );
335
372
 
@@ -1,6 +1,4 @@
1
- import {
2
- PostTypeIcon,
3
- } from '@elementor/icons';
1
+ import { PostTypeIcon } from '@elementor/icons';
4
2
  import { Chip } from '@elementor/ui';
5
3
  import * as React from 'react';
6
4
  import { getIconsMap } from '../../icons-map';
@@ -8,7 +8,7 @@ import useUser from '../../hooks/use-user';
8
8
 
9
9
  type Props = MenuItemProps & {
10
10
  closePopup: () => void;
11
- }
11
+ };
12
12
 
13
13
  export function CreatePostListItem( { closePopup, ...props }: Props ) {
14
14
  const { create, isLoading } = useCreatePage();
@@ -3,36 +3,38 @@ import { Typography, Stack, Tooltip as BaseTooltip, TooltipProps } from '@elemen
3
3
  import { Document } from '@elementor/editor-documents';
4
4
 
5
5
  type Props = {
6
- title: Document['title'],
7
- status: Document['status']
8
- }
6
+ title: Document[ 'title' ];
7
+ status: Document[ 'status' ];
8
+ };
9
9
 
10
10
  export default function Indicator( { title, status }: Props ) {
11
11
  return (
12
12
  <Tooltip title={ title }>
13
- <Stack component="span" direction="row" alignItems="center" spacing={ 0.5 }>
13
+ <Stack component="span" direction="row" alignItems="center" spacing={ 0.5 }>
14
14
  <Typography component="span" variant="body2" sx={ { maxWidth: '120px' } } noWrap>
15
15
  { title }
16
16
  </Typography>
17
- { status.value !== 'publish' &&
17
+ { status.value !== 'publish' && (
18
18
  <Typography component="span" variant="body2" sx={ { fontStyle: 'italic' } }>
19
19
  ({ status.label })
20
20
  </Typography>
21
- }
21
+ ) }
22
22
  </Stack>
23
23
  </Tooltip>
24
24
  );
25
25
  }
26
26
 
27
27
  function Tooltip( props: TooltipProps ) {
28
- return <BaseTooltip
29
- PopperProps={ {
30
- sx: {
31
- '&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom': {
32
- mt: 2.7,
28
+ return (
29
+ <BaseTooltip
30
+ PopperProps={ {
31
+ sx: {
32
+ '&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom': {
33
+ mt: 2.7,
34
+ },
33
35
  },
34
- },
35
- } }
36
- { ...props }
37
- />;
36
+ } }
37
+ { ...props }
38
+ />
39
+ );
38
40
  }
@@ -8,7 +8,7 @@ import { RecentPost } from '../../types';
8
8
  type Props = MenuItemProps & {
9
9
  post: RecentPost;
10
10
  closePopup: () => void;
11
- }
11
+ };
12
12
 
13
13
  export function PostListItem( { post, closePopup, ...props }: Props ) {
14
14
  const navigateToDocument = useNavigateToDocument();
@@ -28,11 +28,7 @@ export function PostListItem( { post, closePopup, ...props }: Props ) {
28
28
  primaryTypographyProps={ { variant: 'body2', noWrap: true } }
29
29
  primary={ postTitle }
30
30
  />
31
- <DocTypeChip
32
- postType={ post.type.post_type }
33
- docType={ post.type.doc_type }
34
- label={ post.type.label }
35
- />
31
+ <DocTypeChip postType={ post.type.post_type } docType={ post.type.doc_type } label={ post.type.label } />
36
32
  </MenuItem>
37
33
  );
38
34
  }
@@ -11,7 +11,10 @@ import {
11
11
  MenuItem,
12
12
  } from '@elementor/ui';
13
13
  import { ChevronDownIcon } from '@elementor/icons';
14
- import { __useActiveDocument as useActiveDocument, __useHostDocument as useHostDocument } from '@elementor/editor-documents';
14
+ import {
15
+ __useActiveDocument as useActiveDocument,
16
+ __useHostDocument as useHostDocument,
17
+ } from '@elementor/editor-documents';
15
18
  import Indicator from './indicator';
16
19
  import useRecentPosts from '../../hooks/use-recent-posts';
17
20
  import { __ } from '@wordpress/i18n';
@@ -24,9 +27,7 @@ import { ExtendedWindow } from '../../types';
24
27
  export default function RecentlyEdited() {
25
28
  const activeDocument = useActiveDocument();
26
29
  const hostDocument = useHostDocument();
27
- const document = activeDocument && activeDocument.type.value !== 'kit'
28
- ? activeDocument
29
- : hostDocument;
30
+ const document = activeDocument && activeDocument.type.value !== 'kit' ? activeDocument : hostDocument;
30
31
 
31
32
  const { data } = useRecentPosts();
32
33
 
@@ -59,30 +60,23 @@ export default function RecentlyEdited() {
59
60
  size="small"
60
61
  endIcon={ <ChevronDownIcon fontSize="small" /> }
61
62
  { ...buttonProps }
62
- onClick={ ( e: React.MouseEvent ) => {
63
+ onClick={ ( e: React.MouseEvent ) => {
63
64
  const extendedWindow = window as unknown as ExtendedWindow;
64
65
  const config = extendedWindow?.elementor?.editorEvents?.config;
65
66
 
66
67
  if ( config ) {
67
- extendedWindow.elementor.editorEvents.dispatchEvent(
68
- config.names.topBar.documentNameDropdown,
69
- {
70
- location: config.locations.topBar,
71
- secondaryLocation: config.secondaryLocations.documentNameDropdown,
72
- trigger: config.triggers.dropdownClick,
73
- element: config.elements.dropdown,
74
- },
75
- );
68
+ extendedWindow.elementor.editorEvents.dispatchEvent( config.names.topBar.documentNameDropdown, {
69
+ location: config.locations.topBar,
70
+ secondaryLocation: config.secondaryLocations.documentNameDropdown,
71
+ trigger: config.triggers.dropdownClick,
72
+ element: config.elements.dropdown,
73
+ } );
76
74
  }
77
75
 
78
76
  buttonProps.onClick( e );
79
77
  } }
80
-
81
78
  >
82
- <Indicator
83
- title={ documentTitle }
84
- status={ document.status }
85
- />
79
+ <Indicator title={ documentTitle } status={ document.status } />
86
80
  </Button>
87
81
  <Menu
88
82
  MenuListProps={ {
@@ -2,31 +2,35 @@ import * as React from 'react';
2
2
  import { useState, useContext, createContext, Dispatch, SetStateAction, ReactNode } from 'react';
3
3
  import { Slug } from '../api/post';
4
4
 
5
- export type EditMode = {
6
- mode: 'rename',
7
- details: {
8
- postId: number,
9
- },
10
- } | {
11
- mode: 'create',
12
- details: Record<string, never>,
13
- } | {
14
- mode: 'duplicate',
15
- details: {
16
- postId: number,
17
- title: string,
18
- },
19
- } | {
20
- mode: 'none',
21
- details: Record<string, never>,
22
- };
5
+ export type EditMode =
6
+ | {
7
+ mode: 'rename';
8
+ details: {
9
+ postId: number;
10
+ };
11
+ }
12
+ | {
13
+ mode: 'create';
14
+ details: Record< string, never >;
15
+ }
16
+ | {
17
+ mode: 'duplicate';
18
+ details: {
19
+ postId: number;
20
+ title: string;
21
+ };
22
+ }
23
+ | {
24
+ mode: 'none';
25
+ details: Record< string, never >;
26
+ };
23
27
 
24
28
  type ContextType = {
25
- type: Slug,
26
- editMode: EditMode,
27
- setEditMode: Dispatch<SetStateAction<EditMode>>,
28
- resetEditMode: () => void,
29
- setError: () => void,
29
+ type: Slug;
30
+ editMode: EditMode;
31
+ setEditMode: Dispatch< SetStateAction< EditMode > >;
32
+ resetEditMode: () => void;
33
+ setError: () => void;
30
34
  };
31
35
 
32
36
  const defaultValues: ContextType = {
@@ -37,16 +41,16 @@ const defaultValues: ContextType = {
37
41
  setError: () => null,
38
42
  };
39
43
 
40
- export const PostListContext = createContext<ContextType>( defaultValues );
44
+ export const PostListContext = createContext< ContextType >( defaultValues );
41
45
 
42
46
  export const PostListContextProvider = ( {
43
47
  type,
44
48
  setError,
45
49
  children,
46
50
  }: {
47
- type: ContextType[ 'type' ],
48
- setError: ContextType[ 'setError' ],
49
- children: ReactNode,
51
+ type: ContextType[ 'type' ];
52
+ setError: ContextType[ 'setError' ];
53
+ children: ReactNode;
50
54
  } ) => {
51
55
  const [ editMode, setEditMode ] = useState( defaultValues.editMode );
52
56
 
@@ -55,13 +59,15 @@ export const PostListContextProvider = ( {
55
59
  };
56
60
 
57
61
  return (
58
- <PostListContext.Provider value={ {
59
- type,
60
- editMode,
61
- setEditMode,
62
- resetEditMode,
63
- setError,
64
- } }>
62
+ <PostListContext.Provider
63
+ value={ {
64
+ type,
65
+ editMode,
66
+ setEditMode,
67
+ resetEditMode,
68
+ setError,
69
+ } }
70
+ >
65
71
  { children }
66
72
  </PostListContext.Provider>
67
73
  );
package/src/env.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { parseEnv } from '@elementor/env';
2
2
 
3
- export const { env, validateEnv } = parseEnv<{
3
+ export const { env, validateEnv } = parseEnv< {
4
4
  is_pages_panel_active: boolean;
5
- }>( '@elementor/editor-site-navigation', ( envData ) => {
5
+ } >( '@elementor/editor-site-navigation', ( envData ) => {
6
6
  return envData as {
7
7
  is_pages_panel_active: boolean;
8
8
  };