@elementor/editor-interactions 4.1.0-764 → 4.1.0-765

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-interactions",
3
- "version": "4.1.0-764",
3
+ "version": "4.1.0-765",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,19 +39,19 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor-controls": "4.1.0-764",
43
- "@elementor/editor-elements": "4.1.0-764",
44
- "@elementor/editor-mcp": "4.1.0-764",
45
- "@elementor/editor-props": "4.1.0-764",
46
- "@elementor/editor-responsive": "4.1.0-764",
47
- "@elementor/editor-ui": "4.1.0-764",
48
- "@elementor/editor-v1-adapters": "4.1.0-764",
42
+ "@elementor/editor-controls": "4.1.0-765",
43
+ "@elementor/editor-elements": "4.1.0-765",
44
+ "@elementor/editor-mcp": "4.1.0-765",
45
+ "@elementor/editor-props": "4.1.0-765",
46
+ "@elementor/editor-responsive": "4.1.0-765",
47
+ "@elementor/editor-ui": "4.1.0-765",
48
+ "@elementor/editor-v1-adapters": "4.1.0-765",
49
49
  "@elementor/icons": "^1.68.0",
50
- "@elementor/schema": "4.1.0-764",
51
- "@elementor/session": "4.1.0-764",
50
+ "@elementor/schema": "4.1.0-765",
51
+ "@elementor/session": "4.1.0-765",
52
52
  "@elementor/ui": "1.36.17",
53
- "@elementor/utils": "4.1.0-764",
54
- "@elementor/events": "4.1.0-764",
53
+ "@elementor/utils": "4.1.0-765",
54
+ "@elementor/events": "4.1.0-765",
55
55
  "@wordpress/i18n": "^5.13.0"
56
56
  },
57
57
  "peerDependencies": {
@@ -31,6 +31,7 @@ export function InteractionsList( props: InteractionListProps ) {
31
31
  const { elementId } = useInteractionsContext();
32
32
 
33
33
  const hasInitializedRef = useRef( false );
34
+ const newlyCreatedIdsRef = useRef< Set< string > >( new Set() );
34
35
 
35
36
  const handleUpdateInteractions = useCallback(
36
37
  ( newInteractions: ElementInteractions ) => {
@@ -46,9 +47,11 @@ export function InteractionsList( props: InteractionListProps ) {
46
47
  ( ! interactions.items || interactions.items?.length === 0 )
47
48
  ) {
48
49
  hasInitializedRef.current = true;
50
+ const newItem = createDefaultInteractionItem();
51
+ newlyCreatedIdsRef.current.add( extractString( newItem.value.interaction_id ) );
49
52
  const newState: ElementInteractions = {
50
53
  version: 1,
51
- items: [ createDefaultInteractionItem() ],
54
+ items: [ newItem ],
52
55
  };
53
56
  handleUpdateInteractions( newState );
54
57
  }
@@ -83,11 +86,11 @@ export function InteractionsList( props: InteractionListProps ) {
83
86
  if ( meta?.action?.type === 'add' ) {
84
87
  const addedItem = meta.action.payload[ 0 ]?.item;
85
88
  if ( addedItem ) {
86
- trackInteractionCreated( elementId, addedItem );
89
+ newlyCreatedIdsRef.current.add( extractString( addedItem.value.interaction_id ) );
87
90
  }
88
91
  }
89
92
  },
90
- [ interactions, handleUpdateInteractions, elementId ]
93
+ [ interactions, handleUpdateInteractions ]
91
94
  );
92
95
 
93
96
  const handleInteractionChange = useCallback(
@@ -138,7 +141,14 @@ export function InteractionsList( props: InteractionListProps ) {
138
141
  );
139
142
  syncGridOverlay( trigger, start, end, relativeTo );
140
143
  },
141
- onPopoverClose: () => dispatchScrollInteraction( null ),
144
+ onPopoverClose: ( value: InteractionItemPropValue ) => {
145
+ dispatchScrollInteraction( null );
146
+ const id = extractString( value.value.interaction_id );
147
+ if ( newlyCreatedIdsRef.current.has( id ) ) {
148
+ newlyCreatedIdsRef.current.delete( id );
149
+ trackInteractionCreated( elementId, value );
150
+ }
151
+ },
142
152
  actions: ( value: InteractionItemPropValue ) => (
143
153
  <Tooltip key="preview" placement="top" title={ __( 'Preview', 'elementor' ) }>
144
154
  <IconButton
@@ -7,8 +7,6 @@ import { InteractionsProvider, useInteractionsContext } from '../contexts/intera
7
7
  import { PopupStateProvider } from '../contexts/popup-state-context';
8
8
  import { useElementInteractions } from '../hooks/use-element-interactions';
9
9
  import type { ElementInteractions } from '../types';
10
- import { createDefaultInteractionItem } from '../utils/prop-value-utils';
11
- import { trackInteractionCreated } from '../utils/tracking';
12
10
  import { EmptyState } from './empty-state';
13
11
  import { InteractionsList } from './interactions-list';
14
12
 
@@ -35,7 +33,6 @@ function InteractionsTabContent( { elementId }: { elementId: string } ) {
35
33
  <EmptyState
36
34
  onCreateInteraction={ () => {
37
35
  firstInteractionState[ 1 ]( true );
38
- trackInteractionCreated( elementId, createDefaultInteractionItem() );
39
36
  } }
40
37
  />
41
38
  ) }