Skip to content
20 changes: 20 additions & 0 deletions WORKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ Changed `:root { color-scheme: light dark; }` → `color-scheme: light;` and `.d

## 2026-07-09

### nx/blocks/secure-org — migrate secure-org block to nx2

Added `'secure-org'` to `NX_BLOCKS` in `nx2/scripts/nx.js`. Block stays in `nx/blocks/secure-org/` per migration convention.

Import updates in `secure-org.js`:
- Dropped `getConfig` from nexter.js; icon URLs built via `new URL('../../public/icons/...', import.meta.url).href` (icons live only in nx1)
- `../../utils/ims.js` `loadIms` → `../../../nx2/utils/ims.js`
- `../../utils/styles.js` default `getStyle` → `{ loadStyle }` from `../../../nx2/utils/utils.js`
- `../../utils/svg.js` `getSvg` → default `loadIcons` from `../../../nx2/utils/svg.js`

Import updates in `utils.js`:
- `../../public/utils/constants.js` (DA_ORIGIN) → `../../../nx2/public/utils/constants.js`
- `../../utils/daFetch.js` (daFetch) → `../../../nx2/utils/api.js`; call site updated from positional `daFetch(url, opts)` to destructured `daFetch({ url, opts })`

CSS variables in `secure-org.css`:
- `--grid-container-width` → `--se-grid-container-width` with nx1 fallback
- `--spacing-800` → `--s2-spacing-800` with nx1 fallback

Verified live at `/apps/sandbox?nx=local` — block renders correctly (nx-path input, orange warning alert with AlertDiamond icon), no console errors.

### nx/blocks/bulk — migrate bulk operations block to nx2

Added `'bulk'` to `NX_BLOCKS` in `nx2/scripts/nx.js`. Block stays in `nx/blocks/bulk/` per migration convention.
Expand Down
8 changes: 2 additions & 6 deletions nx/blocks/secure-org/secure-org.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
:host {
display: block;
max-width: var(--grid-container-width);
margin: var(--spacing-800) auto var(--spacing-800) auto;

> svg {
display: none;
}
max-width: var(--se-grid-container-width, var(--grid-container-width));
margin: var(--s2-spacing-800, var(--spacing-800)) auto var(--s2-spacing-800, var(--spacing-800)) auto;

nx-path {
display: block;
Expand Down
29 changes: 9 additions & 20 deletions nx/blocks/secure-org/secure-org.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
import { html, LitElement, nothing } from 'da-lit';
import { getConfig } from '../../scripts/nexter.js';
import { loadIms } from '../../utils/ims.js';
import getStyle from '../../utils/styles.js';
import { getSvg } from '../../utils/svg.js';
import { loadIms } from '../../../nx2/utils/ims.js';
import { loadStyle } from '../../../nx2/utils/utils.js';
import { loadConfig, saveConfig } from './utils.js';

import '../../public/sl/components.js';
import '../shared/path/path.js';

const { nxBase: nx } = getConfig();

const ICONS = [
`${nx}/public/icons/S2_Icon_InfoCircle_20_N.svg`,
`${nx}/public/icons/S2_Icon_AlertDiamond_20_N.svg`,
`${nx}/public/icons/S2_Icon_CheckmarkCircle_20_N.svg`,
];

const EL_NAME = 'nx-secure-org';

const styles = await getStyle(import.meta.url);
const icons = await getSvg({ paths: ICONS });
const styles = await loadStyle(import.meta.url);

class SecureOrg extends LitElement {
static properties = {
Expand All @@ -35,7 +24,6 @@ class SecureOrg extends LitElement {
connectedCallback() {
super.connectedCallback();
this.shadowRoot.adoptedStyleSheets = [styles];
this.shadowRoot.append(...icons);
this.resetDefaults();
}

Expand Down Expand Up @@ -100,14 +88,15 @@ class SecureOrg extends LitElement {
if (!this._alert) return nothing;

const type2icon = {
info: 'InfoCircle',
warning: 'AlertDiamond',
success: 'CheckmarkCircle',
info: 'infocircle',
warning: 'alertdiamond',
success: 'checkmarkcircle',
};
const type = this._alert.type || 'info';

return html`
<div class="nx-alert ${this._alert.type || 'info'}">
<svg class="icon"><use href="#S2_Icon_${type2icon[this._alert.type || 'info']}_20_N"/></svg>
<div class="nx-alert ${type}">
<svg class="icon" viewBox="0 0 20 20" aria-hidden="true"><use href="/img/icons/s2-icon-${type2icon[type]}-20-n.svg#icon"/></svg>
<p>${this._alert.message}</p>
</div>
`;
Expand Down
6 changes: 3 additions & 3 deletions nx/blocks/secure-org/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DA_ORIGIN } from '../../public/utils/constants.js';
import { daFetch } from '../../utils/daFetch.js';
import { DA_ORIGIN } from '../../../nx2/public/utils/constants.js';
import { daFetch } from '../../../nx2/utils/api.js';

const DEF_CONFIG = `{
"data": {
Expand Down Expand Up @@ -39,7 +39,7 @@ async function fetchConfig(org, body) {
let opts;
if (body) opts = { method: 'POST', body };

return daFetch(`${DA_ORIGIN}/config/${org}/`, opts);
return daFetch({ url: `${DA_ORIGIN}/config/${org}/`, opts });
}

export async function loadConfig(org) {
Expand Down
2 changes: 1 addition & 1 deletion nx2/scripts/nx.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const LOG = async (ex, el) => (await import('../utils/error.js')).default(ex, el);

const NX_BLOCKS = new Set(['importer', 'site-apps', 'hero', 'card', 'section-metadata', 'schema-editor', 'media-library', 'form', 'bulk', 'tree', 'permissions', 'snapshot-admin']);
const NX_BLOCKS = new Set(['importer', 'site-apps', 'hero', 'card', 'section-metadata', 'schema-editor', 'media-library', 'form', 'secure-org', 'bulk', 'tree', 'permissions', 'snapshot-admin']);

const EW_ORIGINS = {
dev: 'http://localhost:3001',
Expand Down
Loading