elementor/assets
Nami printz 9b3cf34022
Internal: Improve popup display rules [ED-24383] (#36158)
## PR Checklist
<!-- 
Please check if your PR fulfills the following requirements:
**Filling out the template is required.** Any pull request that does not
include enough information to be reviewed in a timely manner may be
closed at the maintainers' discretion.
 -->
- [ ] The commit message follows our guidelines:
https://github.com/elementor/elementor/blob/master/.github/CONTRIBUTING.md


## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x" with no
spaces eg: [x]. -->
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## Summary

This PR can be summarized in the following changelog entry:

*

## Description
An explanation of what is done in this PR

*

## Test instructions
This PR can be tested by following these steps:

*

## Quality assurance

- [ ] I have tested this code to the best of my abilities
- [ ] I have added unittests to verify the code works as intended
- [ ] Docs have been added / updated (for bug fixes / features)

Fixes #

<!--start_gitstream_placeholder-->
###  PR Description
## 1. Problem & Context

Centralizing widget promotion display logic into a unified event-driven
system instead of scattered dialog calls. Enables consistent UX across
atomic forms, locked widgets, and feature promotions while decoupling
trigger points from UI rendering.

## 2. What Changed (Where)

- **element.js**: Switched from `elementor.promotion.showDialog()` to
`widget-promotion:open` custom event; added event propagation stop and
variable extraction
- **behavior.js**: Refactored four control handlers to use shared
`dispatchPromotionEvent()` method instead of inline dialog configs
- **app-manager.js** (both modules): Extracted iframe event binding into
reusable `bindPreviewIframeEvents()` utility; unified mount logic via
generic `mountCard()` method
- **app.js**: Extracted placement/content resolution into pure
functions; added `WidgetPromotionCard` support with RTL-aware
positioning
- **widget-promotion-card.js**: New component for widget promotions with
optional "Free" chip for integrations

## 3. How It Works

Event flow: click handler → `dispatchPromotionEvent()` /
`widget-promotion:open` → `AppManager.attachWidgetPromotionListeners()`
→ `resolveWidgetPromotionData()` (normalizes widget types, falls back to
config) → `mountCard()` → `App` determines placement based on RTL/anchor
target → renders appropriate card component. Iframe listener cleanup on
unmount prevents memory leaks.

## 4. Risks

Minor: hardcoded offset `[-24, 8]` may misalign in edge layouts;
fallback CTA text generation relies on config shape matching (mitigated
by nullish coalescing). Widget type normalization via
lowercase/strip-delimiters could collide for similar names.

_Generated by LinearB AI and added by gitStream._
<sub>AI-generated content may contain inaccuracies. Please verify before
using.
💡 **Tip:** You can customize your AI Description using **Guidelines**
[Learn
how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub>
<!--end_gitstream_placeholder-->

---------

Co-authored-by: Nikita Murzin <mykytamu@elementor.com>
2026-06-13 01:58:50 +00:00
..
data Internal: The responsive css versions of the frontend.scss module files are not generated [ED-15797] (#29270) 2024-11-13 16:50:32 +02:00
dev Internal: Improve popup display rules [ED-24383] (#36158) 2026-06-13 01:58:50 +00:00
images Internal: Update popup logic [ED-24302] (#36079) 2026-06-04 10:10:42 +03:00
lib Internal: Add upgrade crown full icon to eicons [ED-24422] (#36126) 2026-06-08 16:00:07 +03:00
mask-shapes Tweak: Add new mask shapes [ED-19091] (#31004) 2025-05-04 12:18:45 -07:00
shapes Feat: Self Hosted Video Widget [ED-22136] (#34748) 2026-02-26 14:10:24 +02:00
svg-paths Feature/text path (#14280) 2021-03-18 18:30:06 +02:00