Skip to content

refactor: source ewFlags from nx2#1041

Open
kozmaadrian wants to merge 2 commits into
mainfrom
rewflags
Open

refactor: source ewFlags from nx2#1041
kozmaadrian wants to merge 2 commits into
mainfrom
rewflags

Conversation

@kozmaadrian

Copy link
Copy Markdown
Contributor

What

Removes the local blocks/shared/ewFlags.js and sources EW flags from nx2 instead
(adobe/da-nx#), via a new getNx2EwFlags() loader in scripts/utils.js
(mirrors getNx2Api).

Why

The flag logic is common to Nexter consumers, so it lives in nx2 now. Keeping a
duplicate copy here would drift.

Changes

  • scripts/utils.js: add getNx2EwFlags().
  • canvas/utils/panel.js, canvas/utils/view.js: take the flags loader as an
    injected dependency (defaults to nx2), so the consumers stay unit-testable
    without the nx2 runtime.
  • browse/da-browse, canvas/ew-canvas-header: load isEWEnabled /
    isEwChatDisabled from nx2.
  • Deletes blocks/shared/ewFlags.js and its test.

Notes

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aem-code-sync

aem-code-sync Bot commented Jun 24, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@kozmaadrian kozmaadrian mentioned this pull request Jun 24, 2026
10 tasks
}

export async function readConfiguredToolPanelView({ org, site }) {
export async function readConfiguredToolPanelView({ org, site }, getEWFlags = loadEWFlags) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used dependency injection so panel.js/view.js stay unit-testable without standing up the nx2 runtime, tests pass a fake flags loader while production defaults to the real nx2 one. This avoids keeping a copy of the flag fetching logic in a fixture, which didn't feel right for me, since it duplicates code that already lives (and is tested) in nx2 and would drift over time.

Comment thread blocks/browse/da-browse/da-browse.js Outdated
import { getFirstSheet, fetchDaConfigs } from '../../shared/utils.js';
import { isEWEnabled } from '../../shared/ewFlags.js';
import { getNx, sanitizePathParts } from '../../../scripts/utils.js';
import { getNx, sanitizePathParts, getNx2EwFlags } from '../../../scripts/utils.js';

@sharanyavinod sharanyavinod Jun 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just call it getNxEWFlags, skip the versioning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants