Files
atomic-design-poc/apps/ssp/src/app/showcase/pii.section.ts
T
ehoandClaude Sonnet 5 43dc3210cd refactor: move libs/shared/src/ui/ into atoms/molecules/organisms (RD-27)
The folder now equals the layer, as CLAUDE.md decision 2 requires. 33
directories move by git mv (25 flat, plus upload/'s 8 subfolders split
across all three layers). 28 distinct @shared/ui/* specifiers rewrite
across 73 files, longest-first. Five relative imports inside upload/
become @shared/ui aliases because their sibling now lives in a
different layer; two stay relative because both ends stay in the same
layer. Four .mdx docs get their seven broken story imports fixed;
atomic-design.mdx's page-shell import is untouched, because layout/
does not move.

No component, template, story title, or layer-tag comment changes.
That is RD-28's job.

Verified against the ticket's acceptance commands: the 26 flat
directories become exactly 3 layer folders with the counts the ticket
names, only three @shared/ui/* prefixes remain (atoms, molecules,
organisms), the .mdx import count holds at 7, and the relative-import
count inside ui/ drops from 7 to 2 as decision 4 requires. The
@shared/ui/ occurrence count moves from 200 to 205: decision 4
mandates turning 5 of those 7 relative imports into @shared/ui/*
aliases, which decision 3's "200 before, 200 after" check does not
account for. The 5-occurrence gap is exactly the 5 conversions decision
4 names, not a lost or duplicated specifier.

npm run ci --full passes: lint, typecheck, dep:check, format, tokens,
seam, both apps' + both libraries' tests, both apps' localized build,
audit, backend tests, all three generated-artifact drift checks, and
both Storybook instances' build + axe-core a11y suite (67+45 suites,
198+112 tests, all green).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-05 08:14:10 +02:00

103 lines
3.9 KiB
TypeScript

import { Component, computed, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HeadingComponent } from '@shared/ui/atoms/heading/heading.component';
import { TextInputComponent } from '@shared/ui/atoms/text-input/text-input.component';
import { MaskedValueComponent } from '@shared/ui/atoms/masked-value/masked-value.component';
import { parseBsn } from '@shared/kernel/bsn';
import { maskBsn } from '@shared/kernel/pii';
import { ConceptCardComponent } from './concept-card.component';
import { SNIPPETS } from './snippets.generated';
import { highlightTs } from './highlight-ts';
/** Section 6: PII — masking and parsing. A BSN (Dutch citizen service number) is
special-category personal data (GDPR art. 9): masked by default, revealed only after
a logged action; "parse, don't validate" on the most sensitive field — a pure function
enforces the checksum. Composition-only. The ok/err result nests its own
`<app-concept-card>` for its label, for the same reason section 2 does. */
@Component({
selector: 'app-concepts-pii-section',
imports: [
FormsModule,
HeadingComponent,
TextInputComponent,
MaskedValueComponent,
ConceptCardComponent,
],
template: `
<section class="app-section">
<app-heading [level]="2">6 · PII — maskeren & parsen</app-heading>
<p class="app-lead">
Een BSN is bijzondere persoonsgegevens (AVG art. 9). Dataminimalisatie: standaard gemaskeerd
tonen, alleen tonen na een vastgelegde handeling; en"parse, don't validate" op het
gevoeligste veld — een pure functie die de <em>elfproef</em> afdwingt.
</p>
<div class="app-cols">
<app-concept-card
variant="good"
tag="Maskeren — atom"
[code]="code['mask']"
[src]="src['mask']"
>
<p>
BSN:
<app-masked-value
[value]="bsnShown()"
[canReveal]="true"
revealLabel="Toon BSN"
(reveal)="bsnRevealed.set(true)"
/>
</p>
<p class="app-note">
Standaard gemaskeerd; het echte tonen is step-up-geverifieerd én vastgelegd (zie het
behandelscherm). De atom bevat de maskeer-detectie — geen los <code>*</code>-gesnuffel
bij elke gebruiker.
</p>
</app-concept-card>
<app-concept-card
tag="Parse (elfproef) → Result"
[code]="code['parseBsn']"
[src]="src['parseBsn']"
>
<app-text-input
inputId="bsn"
[ngModel]="bsnRaw()"
(ngModelChange)="bsnRaw.set($event)"
name="bsn"
placeholder="Typ een BSN, bijv. 123456782"
/>
@let b = bsnParsed();
@if (bsnRaw()) {
<div animate.enter="app-item-enter">
<app-concept-card [variant]="b.ok ? 'good' : 'bad'" [tag]="b.ok ? 'ok' : 'err'">
@if (b.ok) {
<pre class="app-code">Bsn ="{{ b.value }}"</pre>
} @else {
<pre class="app-code">{{ b.error }}</pre>
}
</app-concept-card>
</div>
}
</app-concept-card>
</div>
</section>
`,
})
export class PiiSection {
// Masked-by-default value that reveals locally (the real reveal is step-up-gated +
// audited elsewhere); plus a live elfproef parse mirroring the postcode demo.
demoBsn = '123456782';
bsnRevealed = signal(false);
bsnShown = computed(() => (this.bsnRevealed() ? this.demoBsn : maskBsn(this.demoBsn)));
bsnRaw = signal('');
bsnParsed = computed(() => parseBsn(this.bsnRaw()));
protected readonly code: Record<string, string> = {
mask: highlightTs(SNIPPETS['mask']),
parseBsn: highlightTs(SNIPPETS['parseBsn']),
};
protected readonly src: Record<string, string> = {
mask: 'shared/kernel/pii.ts',
parseBsn: 'shared/kernel/bsn.ts',
};
}