@aiaiai-pt/design-system 0.44.0 → 0.44.1

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.
@@ -479,6 +479,16 @@
479
479
  return Object.values(fileUploads).flatMap((list) => list.map((f) => f.key));
480
480
  }
481
481
 
482
+ /** #629 follow-up — the same keys ATTRIBUTED to the param each was
483
+ * uploaded against, so consumers never have to guess positionally. */
484
+ function attachmentsByParam(): Record<string, string[]> {
485
+ const out: Record<string, string[]> = {};
486
+ for (const [paramKey, list] of Object.entries(fileUploads)) {
487
+ if (list.length) out[paramKey] = list.map((f) => f.key);
488
+ }
489
+ return out;
490
+ }
491
+
482
492
  function buildPayload(): Record<string, unknown> {
483
493
  return buildActionPayload({
484
494
  action: renderedAction ?? null,
@@ -487,6 +497,7 @@
487
497
  sourceSchema: sourceSchema(),
488
498
  rawValues: visibleValueBag(),
489
499
  attachmentKeys: allAttachmentKeys(),
500
+ attachmentsByParam: attachmentsByParam(),
490
501
  schemaVersion: schema?.schema_version ?? null,
491
502
  mode,
492
503
  }) as unknown as Record<string, unknown>;
@@ -662,8 +673,10 @@
662
673
  aria-required={ariaRequired}
663
674
  />
664
675
  {/if}
665
- {#if mode === "public-submit"}
666
- <!-- Citizen-facing: just a quiet required hint, no operator type debug. -->
676
+ {#if isSubmitMode}
677
+ <!-- EXECUTE surfaces (citizen public-submit AND staff admin-execute,
678
+ #629 follow-up): just a quiet required hint — the "Required / type"
679
+ line is operator DEBUG chrome, preview modes only. -->
667
680
  {#if parameter.required}<p class="field-meta">Required</p>{/if}
668
681
  {:else}
669
682
  <p class="field-meta">
@@ -675,8 +688,12 @@
675
688
  <div class="renderer" data-testid={`action-form-renderer-${mode}`} data-layout={resolvedLayout.key}>
676
689
  <!-- Wizard pagination (#105 P6): the ServiceFlow shell owns the step
677
690
  heading, so the renderer's own action-title header is suppressed when a
678
- section is active to avoid a duplicate heading per step. -->
679
- {#if activeSectionKey == null}
691
+ section is active to avoid a duplicate heading per step.
692
+ admin-execute (#629 follow-up): the HOST container (drawer/modal) owns
693
+ the action heading — the renderer's header would duplicate it, and the
694
+ "Placement preview" eyebrow + placement Badge are authoring chrome that
695
+ has no meaning on an execute surface. -->
696
+ {#if activeSectionKey == null && mode !== "admin-execute"}
680
697
  <div class="renderer-header">
681
698
  <div>
682
699
  <!-- The placement-preview eyebrow + surface badge are operator chrome —
@@ -43,12 +43,20 @@ export interface BuildArgs {
43
43
  * attachment contract: a TOP-LEVEL `attachment_keys` sibling, never part
44
44
  * of raw_values (the form schema doesn't validate file params). */
45
45
  attachmentKeys?: string[];
46
+ /** #629 follow-up — the SAME storage keys, attributed to the file param
47
+ * each was uploaded against (`{param_key: [keys]}`). Additive: consumers
48
+ * that only read the flat `attachment_keys` are unaffected; consumers
49
+ * that must map keys back to parameters (the staff execute adapter) read
50
+ * this instead of guessing positionally. */
51
+ attachmentsByParam?: Record<string, string[]>;
46
52
  schemaVersion: string | null;
47
53
  mode: RendererMode;
48
54
  }
49
55
  export interface ActionPayload {
50
56
  /** Uploaded file storage keys (file-typed params) — absent when none. */
51
57
  attachment_keys?: string[];
58
+ /** Per-param attribution of the same keys — absent when none. */
59
+ attachments_by_param?: Record<string, string[]>;
52
60
  source: string;
53
61
  action: {
54
62
  id: string | null;
@@ -46,6 +46,12 @@ export interface BuildArgs {
46
46
  * attachment contract: a TOP-LEVEL `attachment_keys` sibling, never part
47
47
  * of raw_values (the form schema doesn't validate file params). */
48
48
  attachmentKeys?: string[];
49
+ /** #629 follow-up — the SAME storage keys, attributed to the file param
50
+ * each was uploaded against (`{param_key: [keys]}`). Additive: consumers
51
+ * that only read the flat `attachment_keys` are unaffected; consumers
52
+ * that must map keys back to parameters (the staff execute adapter) read
53
+ * this instead of guessing positionally. */
54
+ attachmentsByParam?: Record<string, string[]>;
49
55
  schemaVersion: string | null;
50
56
  mode: RendererMode;
51
57
  }
@@ -53,6 +59,8 @@ export interface BuildArgs {
53
59
  export interface ActionPayload {
54
60
  /** Uploaded file storage keys (file-typed params) — absent when none. */
55
61
  attachment_keys?: string[];
62
+ /** Per-param attribution of the same keys — absent when none. */
63
+ attachments_by_param?: Record<string, string[]>;
56
64
  source: string;
57
65
  action: {
58
66
  id: string | null;
@@ -108,7 +116,7 @@ function pickScope(targetConfig: Record<string, unknown>): Record<string, unknow
108
116
  }
109
117
 
110
118
  export function buildActionPayload(args: BuildArgs): ActionPayload {
111
- const { action, placement, targetConfig, sourceSchema, rawValues, schemaVersion, mode, attachmentKeys } = args;
119
+ const { action, placement, targetConfig, sourceSchema, rawValues, schemaVersion, mode, attachmentKeys, attachmentsByParam } = args;
112
120
 
113
121
  const sourceFromSchema = nullableString(sourceSchema.source);
114
122
  const targetModel =
@@ -152,6 +160,9 @@ export function buildActionPayload(args: BuildArgs): ActionPayload {
152
160
  ...(attachmentKeys && attachmentKeys.length > 0
153
161
  ? { attachment_keys: attachmentKeys }
154
162
  : {}),
163
+ ...(attachmentsByParam && Object.keys(attachmentsByParam).length > 0
164
+ ? { attachments_by_param: attachmentsByParam }
165
+ : {}),
155
166
  };
156
167
  }
157
168
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiaiai-pt/design-system",
3
- "version": "0.44.0",
3
+ "version": "0.44.1",
4
4
  "description": "Design system tokens and Svelte components for aiaiai products",
5
5
  "license": "MIT",
6
6
  "type": "module",