@elementor/editor-components 4.1.0-692 → 4.1.0-694

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-components",
3
3
  "description": "Elementor editor components",
4
- "version": "4.1.0-692",
4
+ "version": "4.1.0-694",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,31 +40,31 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor": "4.1.0-692",
44
- "@elementor/editor-canvas": "4.1.0-692",
45
- "@elementor/editor-controls": "4.1.0-692",
46
- "@elementor/editor-documents": "4.1.0-692",
47
- "@elementor/editor-editing-panel": "4.1.0-692",
48
- "@elementor/editor-elements": "4.1.0-692",
49
- "@elementor/editor-elements-panel": "4.1.0-692",
50
- "@elementor/editor-mcp": "4.1.0-692",
51
- "@elementor/editor-templates": "4.1.0-692",
52
- "@elementor/editor-panels": "4.1.0-692",
53
- "@elementor/editor-props": "4.1.0-692",
54
- "@elementor/editor-styles-repository": "4.1.0-692",
55
- "@elementor/editor-ui": "4.1.0-692",
56
- "@elementor/editor-v1-adapters": "4.1.0-692",
57
- "@elementor/http-client": "4.1.0-692",
43
+ "@elementor/editor": "4.1.0-694",
44
+ "@elementor/editor-canvas": "4.1.0-694",
45
+ "@elementor/editor-controls": "4.1.0-694",
46
+ "@elementor/editor-documents": "4.1.0-694",
47
+ "@elementor/editor-editing-panel": "4.1.0-694",
48
+ "@elementor/editor-elements": "4.1.0-694",
49
+ "@elementor/editor-elements-panel": "4.1.0-694",
50
+ "@elementor/editor-mcp": "4.1.0-694",
51
+ "@elementor/editor-templates": "4.1.0-694",
52
+ "@elementor/editor-panels": "4.1.0-694",
53
+ "@elementor/editor-props": "4.1.0-694",
54
+ "@elementor/editor-styles-repository": "4.1.0-694",
55
+ "@elementor/editor-ui": "4.1.0-694",
56
+ "@elementor/editor-v1-adapters": "4.1.0-694",
57
+ "@elementor/http-client": "4.1.0-694",
58
58
  "@elementor/icons": "^1.68.0",
59
- "@elementor/events": "4.1.0-692",
60
- "@elementor/query": "4.1.0-692",
61
- "@elementor/schema": "4.1.0-692",
62
- "@elementor/store": "4.1.0-692",
59
+ "@elementor/events": "4.1.0-694",
60
+ "@elementor/query": "4.1.0-694",
61
+ "@elementor/schema": "4.1.0-694",
62
+ "@elementor/store": "4.1.0-694",
63
63
  "@elementor/ui": "1.36.17",
64
- "@elementor/utils": "4.1.0-692",
64
+ "@elementor/utils": "4.1.0-694",
65
65
  "@wordpress/i18n": "^5.13.0",
66
- "@elementor/editor-notifications": "4.1.0-692",
67
- "@elementor/editor-current-user": "4.1.0-692"
66
+ "@elementor/editor-notifications": "4.1.0-694",
67
+ "@elementor/editor-current-user": "4.1.0-694"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^18.3.1",
@@ -1,17 +1,18 @@
1
1
  import * as React from 'react';
2
2
  import { ComponentsIcon, CrownFilledIcon } from '@elementor/icons';
3
3
  import { Box, Button, Divider, Link, List, Stack, Typography } from '@elementor/ui';
4
- import { hasProInstalled } from '@elementor/utils';
5
4
  import { __ } from '@wordpress/i18n';
6
5
 
7
6
  import { useComponents } from '../../hooks/use-components';
8
7
  import { useComponentsPermissions } from '../../hooks/use-components-permissions';
8
+ import { isProComponentsSupported, isProOutdatedForComponents } from '../../utils/is-pro-components-supported';
9
9
  import { ComponentItem } from './components-item';
10
10
  import { LoadingComponents } from './loading-components';
11
11
  import { useSearch } from './search-provider';
12
12
 
13
13
  const LEARN_MORE_URL = 'http://go.elementor.com/components-guide-article';
14
14
  const UPGRADE_URL = 'https://go.elementor.com/go-pro-components/';
15
+ const UPDATE_PLUGINS_URL = '/wp-admin/plugins.php';
15
16
 
16
17
  // Override legacy panel CSS reset that sets h1-h6 to font-size:100% and font-weight:normal.
17
18
  // See: assets/dev/scss/editor/panel/_reset.scss (applied via :where() selector in panel.scss).
@@ -34,7 +35,11 @@ export function ComponentsList() {
34
35
  return <EmptySearchResult />;
35
36
  }
36
37
 
37
- return hasProInstalled() ? <EmptyState /> : <ProUpgradeEmptyState />;
38
+ if ( isProOutdatedForComponents() ) {
39
+ return <ProOutdatedEmptyState />;
40
+ }
41
+
42
+ return isProComponentsSupported() ? <EmptyState /> : <ProUpgradeEmptyState />;
38
43
  }
39
44
 
40
45
  return (
@@ -83,6 +88,46 @@ const ProUpgradeEmptyState = () => {
83
88
  );
84
89
  };
85
90
 
91
+ const ProOutdatedEmptyState = () => {
92
+ return (
93
+ <Stack
94
+ alignItems="center"
95
+ justifyContent="start"
96
+ height="100%"
97
+ sx={ { px: 2, py: 4, maxWidth: 268, m: 'auto' } }
98
+ gap={ 2 }
99
+ overflow="hidden"
100
+ >
101
+ <Stack alignItems="center" gap={ 1 }>
102
+ <ComponentsIcon fontSize="large" sx={ { color: 'text.secondary' } } />
103
+
104
+ <Typography align="center" variant="subtitle2" color="text.secondary" sx={ SUBTITLE_OVERRIDE_SX }>
105
+ { __( 'Create Reusable Components', 'elementor' ) }
106
+ </Typography>
107
+
108
+ <Typography align="center" variant="caption" color="secondary">
109
+ { __( 'Create design elements that sync across your entire site.', 'elementor' ) }
110
+ </Typography>
111
+
112
+ <Typography align="center" variant="caption" color="secondary" sx={ { mt: 1 } }>
113
+ { __( 'To create components, update Elementor Pro to the latest version.', 'elementor' ) }
114
+ </Typography>
115
+ </Stack>
116
+
117
+ <Button
118
+ variant="text"
119
+ color="info"
120
+ size="small"
121
+ href={ UPDATE_PLUGINS_URL }
122
+ target="_blank"
123
+ rel="noopener noreferrer"
124
+ >
125
+ { __( 'Update Elementor Pro', 'elementor' ) }
126
+ </Button>
127
+ </Stack>
128
+ );
129
+ };
130
+
86
131
  const EmptyState = () => {
87
132
  const { canCreate } = useComponentsPermissions();
88
133
 
@@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
3
3
 
4
4
  import { ComponentsUpgradeAlert } from '../components-upgrade-alert';
5
5
 
6
- const UPGRADE_URL = 'https://go.elementor.com/go-pro-components-create/';
6
+ export const UPGRADE_URL = 'https://go.elementor.com/go-pro-components-exist-footer/';
7
7
 
8
8
  export function ComponentsProNotification() {
9
9
  return (
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { __ } from '@wordpress/i18n';
3
+
4
+ import { ComponentsUpdateAlert } from '../components-update-alert';
5
+
6
+ export function ComponentsUpdateNotification() {
7
+ return (
8
+ <ComponentsUpdateAlert
9
+ title={ __( 'Create new Components', 'elementor' ) }
10
+ description={ __( 'To create new components, update Elementor Pro to the latest version.', 'elementor' ) }
11
+ />
12
+ );
13
+ }
@@ -2,12 +2,13 @@ import * as React from 'react';
2
2
  import { useLayoutEffect } from 'react';
3
3
  import { ThemeProvider } from '@elementor/editor-ui';
4
4
  import { Stack } from '@elementor/ui';
5
- import { hasProInstalled } from '@elementor/utils';
6
5
 
7
6
  import { useComponents } from '../../hooks/use-components';
7
+ import { isProComponentsSupported, isProOutdatedForComponents } from '../../utils/is-pro-components-supported';
8
8
  import { ComponentSearch } from './component-search';
9
9
  import { ComponentsList } from './components-list';
10
10
  import { ComponentsProNotification } from './components-pro-notification';
11
+ import { ComponentsUpdateNotification } from './components-update-notification';
11
12
  import { SearchProvider } from './search-provider';
12
13
 
13
14
  const FULL_HEIGHT_STYLE_ID = 'components-full-height-panel';
@@ -54,8 +55,8 @@ const useFullHeightPanel = () => {
54
55
  const ComponentsContent = () => {
55
56
  const { components, isLoading } = useComponents();
56
57
  const hasComponents = ! isLoading && components.length > 0;
57
- const hasPro = hasProInstalled();
58
- const showProNotification = ! hasPro && hasComponents;
58
+ const showProNotification = ! isProComponentsSupported() && hasComponents;
59
+ const isOutdated = isProOutdatedForComponents();
59
60
 
60
61
  useFullHeightPanel();
61
62
 
@@ -63,7 +64,7 @@ const ComponentsContent = () => {
63
64
  <Stack justifyContent="space-between" sx={ { flex: 1, minHeight: 0 } }>
64
65
  { hasComponents && <ComponentSearch /> }
65
66
  <ComponentsList />
66
- { showProNotification && <ComponentsProNotification /> }
67
+ { showProNotification && ( isOutdated ? <ComponentsUpdateNotification /> : <ComponentsProNotification /> ) }
67
68
  </Stack>
68
69
  );
69
70
  };
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+ import { InfoCircleFilledIcon } from '@elementor/icons';
3
+ import { Alert, AlertAction, AlertTitle, Box, Typography } from '@elementor/ui';
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ const UPDATE_PLUGINS_URL = '/wp-admin/plugins.php';
7
+
8
+ interface ComponentsUpdateAlertProps {
9
+ title: string;
10
+ description: string;
11
+ }
12
+
13
+ export function ComponentsUpdateAlert( { title, description }: ComponentsUpdateAlertProps ) {
14
+ return (
15
+ <Box sx={ { mt: 'auto', position: 'sticky', bottom: 0 } }>
16
+ <Alert
17
+ variant="standard"
18
+ color="info"
19
+ icon={ <InfoCircleFilledIcon fontSize="tiny" /> }
20
+ role="status"
21
+ size="small"
22
+ action={
23
+ <AlertAction
24
+ variant="contained"
25
+ color="info"
26
+ href={ UPDATE_PLUGINS_URL }
27
+ target="_blank"
28
+ rel="noopener noreferrer"
29
+ >
30
+ { __( 'Upgrade Now', 'elementor' ) }
31
+ </AlertAction>
32
+ }
33
+ sx={ { m: 2, mt: 1 } }
34
+ >
35
+ <AlertTitle>{ title }</AlertTitle>
36
+ <Typography variant="caption">{ description }</Typography>
37
+ </Alert>
38
+ </Box>
39
+ );
40
+ }
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import { PencilIcon } from '@elementor/icons';
3
3
  import { Box, Stack } from '@elementor/ui';
4
- import { hasProInstalled } from '@elementor/utils';
5
4
  import { __ } from '@wordpress/i18n';
6
5
 
7
6
  import { useComponentsPermissions } from '../../hooks/use-components-permissions';
8
7
  import { ComponentInstanceProvider } from '../../provider/component-instance-context';
8
+ import { isProComponentsSupported, isProOutdatedForComponents } from '../../utils/is-pro-components-supported';
9
+ import { ComponentsUpdateAlert } from '../components-update-alert';
9
10
  import { ComponentsUpgradeAlert } from '../components-upgrade-alert';
10
11
  import { DetachAction } from './detach-action';
11
12
  import { EmptyState } from './empty-state';
@@ -13,12 +14,11 @@ import { InstancePanelBody } from './instance-panel-body';
13
14
  import { EditComponentAction, InstancePanelHeader } from './instance-panel-header';
14
15
  import { useInstancePanelData } from './use-instance-panel-data';
15
16
 
16
- const EDIT_UPGRADE_URL = 'https://go.elementor.com/go-pro-components-edit/';
17
+ const EDIT_UPGRADE_URL = 'https://go.elementor.com/go-pro-components-Instance-edit-footer/';
17
18
 
18
19
  export function InstanceEditingPanel() {
19
20
  const { canEdit } = useComponentsPermissions();
20
21
  const data = useInstancePanelData();
21
- const hasPro = hasProInstalled();
22
22
 
23
23
  if ( ! data ) {
24
24
  return null;
@@ -51,13 +51,22 @@ export function InstanceEditingPanel() {
51
51
  componentInstanceId={ componentInstanceId }
52
52
  />
53
53
  </ComponentInstanceProvider>
54
- { ! hasPro && (
55
- <ComponentsUpgradeAlert
56
- title={ __( 'Edit components', 'elementor' ) }
57
- description={ __( 'Editing components requires an active Pro subscription.', 'elementor' ) }
58
- upgradeUrl={ EDIT_UPGRADE_URL }
59
- />
60
- ) }
54
+ { ! isProComponentsSupported() &&
55
+ ( isProOutdatedForComponents() ? (
56
+ <ComponentsUpdateAlert
57
+ title={ __( 'Edit Component', 'elementor' ) }
58
+ description={ __(
59
+ 'To edit components, update Elementor Pro to the latest version.',
60
+ 'elementor'
61
+ ) }
62
+ />
63
+ ) : (
64
+ <ComponentsUpgradeAlert
65
+ title={ __( 'Edit components', 'elementor' ) }
66
+ description={ __( 'Editing components requires an active Pro subscription.', 'elementor' ) }
67
+ upgradeUrl={ EDIT_UPGRADE_URL }
68
+ />
69
+ ) ) }
61
70
  </Box>
62
71
  );
63
72
  }
@@ -25,6 +25,7 @@ import { type ComponentsSlice, selectComponentByUid } from './store/store';
25
25
  import { type ComponentRenderContext, type ExtendedWindow } from './types';
26
26
  import { detachComponentInstance } from './utils/detach-component-instance';
27
27
  import { formatComponentElementsId } from './utils/format-component-elements-id';
28
+ import { isProComponentsSupported, isProOutdatedForComponents } from './utils/is-pro-components-supported';
28
29
  import { switchToComponent } from './utils/switch-to-component';
29
30
  import { trackComponentEvent } from './utils/tracking';
30
31
 
@@ -53,9 +54,15 @@ type ComponentModelInstance = BackboneModel< ComponentModel > & {
53
54
 
54
55
  export const COMPONENT_WIDGET_TYPE = 'e-component';
55
56
 
56
- const EDIT_COMPONENT_UPGRADE_URL = 'https://go.elementor.com/go-pro-components-edit/';
57
+ const EDIT_COMPONENT_DB_CLICK_UPGRADE_URL =
58
+ 'https://go.elementor.com/go-pro-components-Instance-edit-canvas-double-click/';
59
+ const EDIT_COMPONENT_CONTEXT_MENU_UPGRADE_URL =
60
+ 'https://go.elementor.com/go-pro-components-Instance-edit-context-menu/';
61
+
62
+ const UPDATE_PLUGINS_URL = '/wp-admin/plugins.php';
57
63
 
58
64
  const COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = 'component-edit-upgrade';
65
+ const COMPONENT_EDIT_UPDATE_NOTIFICATION_ID = 'component-edit-update';
59
66
 
60
67
  function notifyComponentEditUpgrade() {
61
68
  notify( {
@@ -67,7 +74,7 @@ function notifyComponentEditUpgrade() {
67
74
  size: 'small',
68
75
  variant: 'contained',
69
76
  color: 'promotion',
70
- href: EDIT_COMPONENT_UPGRADE_URL,
77
+ href: EDIT_COMPONENT_DB_CLICK_UPGRADE_URL,
71
78
  target: '_blank',
72
79
  children: __( 'Upgrade Now', 'elementor' ),
73
80
  },
@@ -75,6 +82,24 @@ function notifyComponentEditUpgrade() {
75
82
  } );
76
83
  }
77
84
 
85
+ function notifyComponentEditUpdate() {
86
+ notify( {
87
+ type: 'info',
88
+ id: COMPONENT_EDIT_UPDATE_NOTIFICATION_ID,
89
+ message: __( 'To edit components, update Elementor Pro to the latest version.', 'elementor' ),
90
+ additionalActionProps: [
91
+ {
92
+ size: 'small',
93
+ variant: 'contained',
94
+ color: 'info',
95
+ href: UPDATE_PLUGINS_URL,
96
+ target: '_blank',
97
+ children: __( 'Update Now', 'elementor' ),
98
+ },
99
+ ],
100
+ } );
101
+ }
102
+
78
103
  const updateGroups = ( groups: ContextMenuGroup[], config: ContextMenuGroupConfig ): ContextMenuGroup[] => {
79
104
  const disableMap = new Map( Object.entries( config.disable ?? {} ) );
80
105
  const addMap = new Map( Object.entries( config.add ?? {} ) );
@@ -235,16 +260,18 @@ function createComponentView( options: ComponentTypeOptions ): typeof ElementVie
235
260
  _getContextMenuConfig() {
236
261
  const isAdministrator = isUserAdministrator();
237
262
  const hasPro = hasProInstalled();
263
+ const isOutdated = isProOutdatedForComponents();
264
+ const showPromoBadge = ! hasPro && ! isOutdated;
238
265
 
239
266
  const badgeClass = 'elementor-context-menu-list__item__shortcut__promotion-badge';
240
- const proBadge = `<a href="${ EDIT_COMPONENT_UPGRADE_URL }" target="_blank" onclick="event.stopPropagation()" class="${ badgeClass }"><i class="eicon-upgrade-crown"></i></a>`;
267
+ const proBadge = `<a href="${ EDIT_COMPONENT_CONTEXT_MENU_UPGRADE_URL }" target="_blank" onclick="event.stopPropagation()" class="${ badgeClass }"><i class="eicon-upgrade-crown"></i></a>`;
241
268
 
242
269
  const editComponentAction: ContextMenuAction = {
243
270
  name: 'edit component',
244
271
  icon: 'eicon-edit',
245
272
  title: () => __( 'Edit Component', 'elementor' ),
246
- ...( ! hasPro && { shortcut: proBadge, hasShortcutAction: true } ),
247
- isEnabled: () => hasPro,
273
+ ...( showPromoBadge && { shortcut: proBadge, hasShortcutAction: true } ),
274
+ isEnabled: () => isProComponentsSupported() || isOutdated,
248
275
  callback: ( _: unknown, eventData: ContextMenuEventData ) => this.editComponent( eventData ),
249
276
  };
250
277
 
@@ -286,9 +313,12 @@ function createComponentView( options: ComponentTypeOptions ): typeof ElementVie
286
313
  }
287
314
 
288
315
  editComponent( { trigger, location, secondaryLocation }: ContextMenuEventData ) {
289
- const hasPro = hasProInstalled();
316
+ if ( isProOutdatedForComponents() ) {
317
+ notifyComponentEditUpdate();
318
+ return;
319
+ }
290
320
 
291
- if ( ! hasPro || this.isComponentCurrentlyEdited() ) {
321
+ if ( ! isProComponentsSupported() || this.isComponentCurrentlyEdited() ) {
292
322
  return;
293
323
  }
294
324
 
@@ -341,6 +371,11 @@ function createComponentView( options: ComponentTypeOptions ): typeof ElementVie
341
371
  return;
342
372
  }
343
373
 
374
+ if ( isProOutdatedForComponents() ) {
375
+ notifyComponentEditUpdate();
376
+ return;
377
+ }
378
+
344
379
  if ( ! hasProInstalled() ) {
345
380
  notifyComponentEditUpgrade();
346
381
  return;
@@ -9,7 +9,7 @@ import { type DocumentSaveStatus } from '../types';
9
9
  import { getComponentDocuments } from '../utils/get-component-documents';
10
10
 
11
11
  const INSUFFICIENT_PERMISSIONS_ERROR_CODE = 'insufficient_permissions';
12
- const PUBLISH_UPGRADE_URL = 'https://go.elementor.com/go-pro-components-edit/';
12
+ const PUBLISH_UPGRADE_URL = 'https://go.elementor.com/go-pro-components-Instance-draft-failure/';
13
13
  const PUBLISH_UPGRADE_NOTIFICATION_ID = 'component-publish-upgrade';
14
14
 
15
15
  type Options = {
@@ -0,0 +1,11 @@
1
+ import { hasProInstalled, isProAtLeast } from '@elementor/utils';
2
+
3
+ const MIN_PRO_VERSION_FOR_COMPONENTS = '4.0';
4
+
5
+ export function isProComponentsSupported(): boolean {
6
+ return hasProInstalled() && isProAtLeast( MIN_PRO_VERSION_FOR_COMPONENTS );
7
+ }
8
+
9
+ export function isProOutdatedForComponents(): boolean {
10
+ return hasProInstalled() && ! isProAtLeast( MIN_PRO_VERSION_FOR_COMPONENTS );
11
+ }