@adobe/aio-commerce-lib-app 2.2.0 → 2.3.0-alpha-20261203134759

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/bin/cli.mjs +22 -1
  3. package/dist/cjs/actions/app-config/index.cjs +8 -8
  4. package/dist/cjs/actions/app-config/index.d.cts +2 -2
  5. package/dist/cjs/actions/association/index.cjs +4 -4
  6. package/dist/cjs/actions/config/index.cjs +19 -8
  7. package/dist/cjs/actions/config/index.d.cts +1 -1
  8. package/dist/cjs/actions/installation/index.cjs +39 -15
  9. package/dist/cjs/actions/installation/index.d.cts +3 -3
  10. package/dist/cjs/actions/scope-tree/index.cjs +6 -6
  11. package/dist/cjs/{app-B3bAEor-.d.cts → app-Cb6-5mKk.d.cts} +637 -45
  12. package/dist/cjs/config/index.browser.d.cts +1 -1
  13. package/dist/cjs/config/index.node.cjs +11 -7
  14. package/dist/cjs/config/index.node.d.cts +150 -14
  15. package/dist/cjs/{define-eBMdGAq6.d.cts → define-Dk0uzfO9.d.cts} +1 -1
  16. package/dist/cjs/{commands → deprecated/commands}/index.cjs +1828 -864
  17. package/dist/cjs/{environment-CW6M76gS.cjs → environment-CaV1hi2-.cjs} +1 -1
  18. package/dist/cjs/{index-BEeludy0.d.cts → index-Cmxlkzpm.d.cts} +2 -2
  19. package/dist/cjs/index.cjs +3 -3
  20. package/dist/cjs/index.d.cts +1 -1
  21. package/dist/cjs/index.node-QXhLROom.cjs +117 -0
  22. package/dist/cjs/{logging-Emi7P923.cjs → logging-r-r2bUWO.cjs} +1 -1
  23. package/dist/cjs/management/index.cjs +1 -1
  24. package/dist/cjs/management/index.d.cts +1 -1
  25. package/dist/cjs/{management-5Et1mEUp.cjs → management-BX9sUQw-.cjs} +123 -108
  26. package/dist/cjs/{openapi-DghfuM8S.cjs → openapi-BaKoO7GY.cjs} +177 -26
  27. package/dist/cjs/{index.node-9bfp79rs.cjs → parser-XcHKOYKN.cjs} +46 -16
  28. package/dist/cjs/project/index.cjs +637 -0
  29. package/dist/cjs/project/index.d.cts +212 -0
  30. package/dist/cjs/{rolldown-runtime-CoOt0iuZ.cjs → rolldown-runtime-BKfnhsn2.cjs} +4 -4
  31. package/dist/cjs/{schemas-B6ITl1bG.cjs → schemas-B-jCi6Oz.cjs} +1 -1
  32. package/dist/cjs/{utils-CoR_PBHz.cjs → utils-CuzJBLgo.cjs} +2 -2
  33. package/dist/cjs/{utils-DSS0XlXq.cjs → utils-bwFwJcPW.cjs} +1 -1
  34. package/dist/cjs/{validate-BC3rnRLc.cjs → validate-BumkVjJy.cjs} +22 -6
  35. package/dist/cjs/{version-5MonNzl5.cjs → version-Bczstmvz.cjs} +3 -3
  36. package/dist/{es/webhooks-DgaLfP36.d.mts → cjs/webhooks-BBuoVWq_.d.cts} +382 -43
  37. package/dist/cjs/{webhooks-ZPh2gVb3.cjs → webhooks-VZTBeI8L.cjs} +84 -23
  38. package/dist/es/actions/app-config/index.d.mts +2 -2
  39. package/dist/es/actions/app-config/index.mjs +6 -6
  40. package/dist/es/actions/association/index.mjs +3 -3
  41. package/dist/es/actions/config/index.d.mts +2 -2
  42. package/dist/es/actions/config/index.mjs +19 -8
  43. package/dist/es/actions/installation/index.d.mts +4 -4
  44. package/dist/es/actions/installation/index.mjs +38 -14
  45. package/dist/es/actions/scope-tree/index.mjs +5 -5
  46. package/dist/es/{app-B3bAEor-.d.mts → app-Cb6-5mKk.d.mts} +637 -45
  47. package/dist/es/config/index.browser.d.mts +1 -1
  48. package/dist/es/config/index.node.d.mts +151 -15
  49. package/dist/es/config/index.node.mjs +5 -4
  50. package/dist/es/{define-BdXyLAwb.d.mts → define-D7EjSr-Z.d.mts} +1 -1
  51. package/dist/es/{commands → deprecated/commands}/index.mjs +1773 -807
  52. package/dist/es/{environment-DUhU0_9z.mjs → environment-B1JJFHZw.mjs} +1 -1
  53. package/dist/es/{index-DE2KVXfH.d.mts → index-BkqV8WU_.d.mts} +4 -4
  54. package/dist/es/{index-DUJtT78x.d.mts → index-U7CXicoW.d.mts} +1 -1
  55. package/dist/es/index.d.mts +2 -2
  56. package/dist/es/index.mjs +3 -3
  57. package/dist/es/index.node-DipCrOq_.mjs +112 -0
  58. package/dist/es/management/index.d.mts +1 -1
  59. package/dist/es/management/index.mjs +1 -1
  60. package/dist/es/{management-BAQ64OyR.mjs → management-DSu69_ub.mjs} +128 -113
  61. package/dist/es/{openapi-BvPVTUMt.mjs → openapi-ChihLuvm.mjs} +177 -26
  62. package/dist/es/{index.node-CURztkP5.mjs → parser-DdhiGXVf.mjs} +33 -15
  63. package/dist/es/project/index.d.mts +212 -0
  64. package/dist/es/project/index.mjs +636 -0
  65. package/dist/es/{utils-DB8HaSj0.mjs → utils-Bg_LIAGV.mjs} +2 -2
  66. package/dist/es/{validate-xS9Dc-4m.mjs → validate-CYWj7Nzp.mjs} +10 -6
  67. package/dist/es/{version-BWgrh_QM.mjs → version-CVSRkbJP.mjs} +1 -1
  68. package/dist/es/{webhooks-HBe_DEKA.mjs → webhooks-Ba-OdU8e.mjs} +76 -21
  69. package/dist/{cjs/webhooks-DNLuuv9_.d.cts → es/webhooks-Deujdgcm.d.mts} +382 -43
  70. package/package.json +29 -24
  71. /package/dist/cjs/{commands → deprecated/commands}/index.d.cts +0 -0
  72. /package/dist/cjs/{commands → deprecated/commands}/templates/typescript/webpack-config.cjs +0 -0
  73. /package/dist/cjs/{commands → project}/templates/admin-ui/tsconfig.json +0 -0
  74. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/.babelrc +0 -0
  75. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/index.css +0 -0
  76. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/index.html +0 -0
  77. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/app.jsx +0 -0
  78. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/components/welcome.jsx +0 -0
  79. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/pages/main-page.jsx +0 -0
  80. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src-template.d.ts +0 -0
  81. /package/dist/cjs/{commands → project}/templates/app-management/app-config.js.template +0 -0
  82. /package/dist/cjs/{commands → project}/templates/app-management/association.js.template +0 -0
  83. /package/dist/cjs/{commands → project}/templates/app-management/custom-scripts.js.template +0 -0
  84. /package/dist/cjs/{commands → project}/templates/app-management/installation.js.template +0 -0
  85. /package/dist/cjs/{commands → project}/templates/business-configuration/config.js.template +0 -0
  86. /package/dist/cjs/{commands → project}/templates/business-configuration/scope-tree.js.template +0 -0
  87. /package/dist/es/{commands → deprecated/commands}/index.d.mts +0 -0
  88. /package/dist/es/{commands → deprecated/commands}/templates/typescript/webpack-config.cjs +0 -0
  89. /package/dist/es/{commands → project}/templates/admin-ui/tsconfig.json +0 -0
  90. /package/dist/es/{commands → project}/templates/admin-ui/web-src/.babelrc +0 -0
  91. /package/dist/es/{commands → project}/templates/admin-ui/web-src/index.css +0 -0
  92. /package/dist/es/{commands → project}/templates/admin-ui/web-src/index.html +0 -0
  93. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/app.jsx +0 -0
  94. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/components/welcome.jsx +0 -0
  95. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/pages/main-page.jsx +0 -0
  96. /package/dist/es/{commands → project}/templates/admin-ui/web-src-template.d.ts +0 -0
  97. /package/dist/es/{commands → project}/templates/app-management/app-config.js.template +0 -0
  98. /package/dist/es/{commands → project}/templates/app-management/association.js.template +0 -0
  99. /package/dist/es/{commands → project}/templates/app-management/custom-scripts.js.template +0 -0
  100. /package/dist/es/{commands → project}/templates/app-management/installation.js.template +0 -0
  101. /package/dist/es/{commands → project}/templates/business-configuration/config.js.template +0 -0
  102. /package/dist/es/{commands → project}/templates/business-configuration/scope-tree.js.template +0 -0
@@ -12,11 +12,11 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { a as hasCustomInstallationSteps, i as hasCustomInstallation, l as hasExternalEvents, m as hasAdminUi, n as hasWebhooks, o as EventingSchema, p as AdminUiSchema, r as InstallationSchema, s as hasCommerceEvents, t as WebhooksSchema } from "./webhooks-HBe_DEKA.mjs";
16
- import { t as alphaNumericOrHyphenSchema } from "./schemas-DYMNbFdX.mjs";
17
- import { RecordedSchemaBusinessConfig, SchemaBusinessConfig } from "@adobe/aio-commerce-lib-config";
18
15
  import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
19
16
  import * as v from "valibot";
17
+ import { a as hasCustomInstallationSteps, i as hasCustomInstallation, l as hasExternalEvents, m as hasAdminUi, n as hasWebhooks, o as EventingSchema, p as AdminUiSchema, r as InstallationSchema, s as hasCommerceEvents, t as WebhooksSchema } from "./webhooks-Ba-OdU8e.mjs";
18
+ import { RecordedSchemaBusinessConfig, SchemaBusinessConfig } from "@adobe/aio-commerce-lib-config";
19
+ import { t as alphaNumericOrHyphenSchema } from "./schemas-DYMNbFdX.mjs";
20
20
 
21
21
  // source/config/schema/business-configuration.ts
22
22
  /**
@@ -40,6 +40,8 @@ const MAX_DESCRIPTION_LENGTH = 255;
40
40
  const MAX_DISPLAY_NAME_LENGTH = 50;
41
41
  const NUMERIC_IDENTIFIER = "(0|[1-9]\\d*)";
42
42
  const SEMVER_REGEX = new RegExp(`^${NUMERIC_IDENTIFIER}\\.${NUMERIC_IDENTIFIER}\\.${NUMERIC_IDENTIFIER}$`, "u");
43
+ /** The `metadata.upgradeMode` of an app config that does not set one. */
44
+ const DEFAULT_UPGRADE_MODE = "manual";
43
45
  function nonEmptyString(fieldName) {
44
46
  return v.pipe(v.string(`Expected a string for the ${fieldName}`), v.nonEmpty(`The ${fieldName} must not be empty`));
45
47
  }
@@ -48,7 +50,7 @@ const MetadataSchema = v.object({
48
50
  description: v.pipe(nonEmptyString("metadata description"), v.maxLength(MAX_DESCRIPTION_LENGTH, `The metadata description must not be longer than ${MAX_DESCRIPTION_LENGTH} characters`)),
49
51
  displayName: v.pipe(nonEmptyString("application display name"), v.maxLength(MAX_DISPLAY_NAME_LENGTH, `The application display name must not be longer than ${MAX_DISPLAY_NAME_LENGTH} characters`)),
50
52
  id: v.pipe(alphaNumericOrHyphenSchema("application id (metadata.id)"), v.maxLength(MAX_ID_LENGTH, `The application id must not be longer than ${MAX_ID_LENGTH} characters`)),
51
- upgradeMode: v.optional(v.picklist(["auto", "manual"]), "manual"),
53
+ upgradeMode: v.optional(v.picklist(["auto", "manual"]), DEFAULT_UPGRADE_MODE),
52
54
  version: v.pipe(nonEmptyString("version"), v.regex(SEMVER_REGEX, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')"))
53
55
  });
54
56
  /**
@@ -73,6 +75,8 @@ const CommerceAppConfigSchemas = {
73
75
  metadata: MetadataSchema,
74
76
  webhooks: WebhooksSchema
75
77
  };
78
+ /** Every domain of the commerce app config. */
79
+ const COMMERCE_APP_CONFIG_DOMAINS = Object.keys(CommerceAppConfigSchemas);
76
80
  /**
77
81
  * Get the config domains that are present in the config.
78
82
  * @param config - The configuration to check.
@@ -147,7 +151,7 @@ function requiresInstallation(config) {
147
151
  }
148
152
 
149
153
  // source/config/lib/validate.ts
150
- const commerceAppConfigDomainsSchema = v.picklist(Object.keys(CommerceAppConfigSchemas));
154
+ const commerceAppConfigDomainsSchema = v.picklist(COMMERCE_APP_CONFIG_DOMAINS);
151
155
  /**
152
156
  * Validates a complete commerce app configuration object against the schema.
153
157
  *
@@ -231,4 +235,4 @@ function validateCommerceAppConfigDomain(config, domain) {
231
235
  return validatedConfig.output;
232
236
  }
233
237
 
234
- export { CommerceAppConfigSchemas as a, hasMetadata as c, requiresInstallationFromDomains as i, hasBusinessConfig as l, validateCommerceAppConfigDomain as n, getConfigDomains as o, requiresInstallation as r, hasConfigDomain as s, validateCommerceAppConfig as t, hasBusinessConfigSchema as u };
238
+ export { COMMERCE_APP_CONFIG_DOMAINS as a, hasConfigDomain as c, hasBusinessConfig as d, hasBusinessConfigSchema as f, requiresInstallationFromDomains as i, DEFAULT_UPGRADE_MODE as l, validateCommerceAppConfigDomain as n, CommerceAppConfigSchemas as o, requiresInstallation as r, getConfigDomains as s, validateCommerceAppConfig as t, hasMetadata as u };
@@ -457,7 +457,7 @@ const UNKNOWN_VERSION = "unknown";
457
457
  * in the `package.json` of the copy of lib-config that lib-app loads, which the app's bundler
458
458
  * resolves when it builds the action.
459
459
  */
460
- const SDK_LIB_VERSIONS = [["lib-app", "2.2.0"], ["lib-config", libConfigPkg.version ?? UNKNOWN_VERSION]].map(([name, version]) => `${name}="${version}"`).join(", ");
460
+ const SDK_LIB_VERSIONS = [["lib-app", "2.3.0-alpha-20261203134759"], ["lib-config", libConfigPkg.version ?? UNKNOWN_VERSION]].map(([name, version]) => `${name}="${version}"`).join(", ");
461
461
  /** Headers every app-management router adds to its responses. */
462
462
  const SDK_LIB_VERSIONS_HEADERS = { [SDK_LIB_VERSIONS_HEADER]: SDK_LIB_VERSIONS };
463
463
 
@@ -33,9 +33,23 @@ const SANDBOX_PERMISSION_VALUES = [
33
33
  "allow-modals",
34
34
  "allow-popups"
35
35
  ];
36
- const SandboxPermissionsSchema = v.pipe(v.array(v.picklist(SANDBOX_PERMISSION_VALUES, `Invalid sandbox permission. Accepted values are: ${SANDBOX_PERMISSION_VALUES.join(", ")}`)), v.minLength(1, "sandboxPermissions must contain at least one permission when it's defined"), v.check((permissions) => {
37
- return new Set(permissions).size === permissions.length;
38
- }, "Duplicate permissions are not allowed in sandboxPermissions"));
36
+ const ALLOW_PERMISSION_VALUES = ["autoplay", "microphone"];
37
+ /**
38
+ * Builds a schema for a non-empty, duplicate-free list of iframe permissions.
39
+ * @param field - The config field name, used in error messages.
40
+ * @param kind - The permission kind, used in error messages (e.g. `sandbox`).
41
+ * @param values - The accepted permission values.
42
+ */
43
+ function permissionListSchema(field, kind, values) {
44
+ return v.pipe(v.array(v.picklist(values, `Invalid ${kind} permission. Accepted values are: ${values.join(", ")}`)), v.minLength(1, `${field} must contain at least one permission when it's defined`), v.check((permissions) => new Set(permissions).size === permissions.length, `Duplicate permissions are not allowed in ${field}`));
45
+ }
46
+ const SandboxPermissionsSchema = permissionListSchema("sandboxPermissions", "sandbox", SANDBOX_PERMISSION_VALUES);
47
+ const AllowPermissionsSchema = permissionListSchema("allow", "iframe allow", ALLOW_PERMISSION_VALUES);
48
+ /** Optional iframe permission fields shared by every iframe-based entry. */
49
+ const iframePermissionEntries = {
50
+ allow: v.optional(AllowPermissionsSchema),
51
+ sandboxPermissions: v.optional(SandboxPermissionsSchema)
52
+ };
39
53
  const NotificationsSchema = v.object({
40
54
  error: v.optional(nonEmptyStringValueSchema("error notification")),
41
55
  success: v.optional(nonEmptyStringValueSchema("success notification"))
@@ -70,6 +84,28 @@ const GridColumnsSchema = v.object({
70
84
  label: nonEmptyStringValueSchema("grid columns label"),
71
85
  runtimeAction: nonEmptyStringValueSchema("runtime action")
72
86
  });
87
+ const INVALID_ATTRIBUTE_CODE_PATTERN = /[^A-Za-z0-9_]/u;
88
+ const CustomAttributeFilterSchema = v.variant("type", [v.strictObject({ type: v.literal("boolean") }), v.strictObject({
89
+ conditions: v.pipe(v.array(v.picklist([
90
+ "eq",
91
+ "neq",
92
+ "contains"
93
+ ])), v.minLength(1, "Text filters require at least one condition")),
94
+ type: v.literal("text")
95
+ })]);
96
+ const CustomAttributeGridColumnSchema = v.strictObject({
97
+ aclProtected: v.optional(v.boolean()),
98
+ align: ColumnAlignSchema,
99
+ attribute_code: v.pipe(nonEmptyStringValueSchema("custom attribute code"), v.maxLength(255, "Custom attribute codes must not exceed 255 characters"), v.check((code) => !INVALID_ATTRIBUTE_CODE_PATTERN.test(code), "Custom attribute codes may contain only ASCII letters, digits, and \"_\"")),
100
+ filter: v.optional(CustomAttributeFilterSchema),
101
+ id: v.pipe(nonEmptyStringValueSchema("column ID"), v.check((id) => id.trim().length > 0, "Column IDs must not be blank")),
102
+ label: v.pipe(nonEmptyStringValueSchema("column label"), v.check((label) => label.trim().length > 0, "Column labels must not be blank"))
103
+ });
104
+ const CustomAttributeGridColumnsSchema = v.strictObject({
105
+ columns: v.pipe(v.array(CustomAttributeGridColumnSchema), v.minLength(1, "At least one custom-attribute grid column is required"), v.check((items) => hasUniqueSanitizedIds(items), "Grid column ids must be unique after Commerce id sanitization.")),
106
+ description: v.optional(nonEmptyStringValueSchema("custom-attribute grid columns description")),
107
+ label: v.optional(nonEmptyStringValueSchema("custom-attribute grid columns label"))
108
+ });
73
109
  /** Fields shared by both mass-action variants. `description` is flat — no `installation` nesting. */
74
110
  const massActionCommonEntries = {
75
111
  aclProtected: v.optional(v.boolean()),
@@ -84,8 +120,8 @@ const massActionCommonEntries = {
84
120
  /** `type: "view"` mass action — renders an iframe at `path`. */
85
121
  const ViewMassActionSchema = v.strictObject({
86
122
  ...massActionCommonEntries,
123
+ ...iframePermissionEntries,
87
124
  path: nonEmptyStringValueSchema("mass action path"),
88
- sandboxPermissions: v.optional(SandboxPermissionsSchema),
89
125
  type: v.literal("view")
90
126
  });
91
127
  /** `type: "worker"` mass action — invokes a workerProcess runtime action. */
@@ -106,6 +142,7 @@ const ViewButtonLevelSchema = v.picklist([
106
142
  1
107
143
  ]);
108
144
  const ViewButtonViewSchema = v.strictObject({
145
+ ...iframePermissionEntries,
109
146
  aclProtected: v.optional(v.boolean()),
110
147
  confirm: v.optional(ConfirmSchema),
111
148
  description: v.optional(nonEmptyStringValueSchema("view button description")),
@@ -114,7 +151,6 @@ const ViewButtonViewSchema = v.strictObject({
114
151
  level: v.optional(ViewButtonLevelSchema),
115
152
  notifications: v.optional(NotificationsSchema),
116
153
  path: nonEmptyStringValueSchema("view button path"),
117
- sandboxPermissions: v.optional(SandboxPermissionsSchema),
118
154
  sortOrder: v.optional(positiveNumberValueSchema("sortOrder")),
119
155
  type: v.literal("view")
120
156
  });
@@ -153,14 +189,16 @@ const AdminUiInvoiceSchema = v.object({
153
189
  gridColumns: v.optional(GridColumnsSchema),
154
190
  viewButtons: v.optional(v.pipe(v.array(InvoiceViewButtonSchema), v.check((items) => hasUniqueSanitizedIds(items), "Invoice view button ids must be unique after Commerce id sanitization.")))
155
191
  });
156
- const AdminUiCreditMemoSchema = v.object({
192
+ const AdminUiCreditMemoSchema = v.pipe(v.object({
193
+ customAttributeGridColumns: v.optional(CustomAttributeGridColumnsSchema),
157
194
  gridColumns: v.optional(GridColumnsSchema),
158
195
  viewButtons: v.optional(v.pipe(v.array(CreditMemoViewButtonSchema), v.check((items) => hasUniqueSanitizedIds(items), "Credit memo view button ids must be unique after Commerce id sanitization.")))
159
- });
196
+ }), v.forward(v.check(({ customAttributeGridColumns, gridColumns }) => !customAttributeGridColumns || hasUniqueSanitizedIds([...gridColumns?.columns ?? [], ...customAttributeGridColumns.columns]), "Runtime and custom-attribute grid column ids must be unique after Commerce id sanitization."), ["customAttributeGridColumns", "columns"]));
160
197
  const AdminUiRmaSchema = v.object({ viewButtons: v.optional(v.pipe(v.array(RmaViewButtonSchema), v.check((items) => hasUniqueSanitizedIds(items), "Return view button ids must be unique after Commerce id sanitization."))) });
161
198
  const AdminUiGridOnlyEntitySchema = v.object({ gridColumns: v.optional(GridColumnsSchema) });
162
199
  const MenuIdSchema = v.pipe(nonEmptyStringValueSchema("menu ID"), v.regex(/^[A-Za-z0-9_/:]+$/u, "Menu ID may contain only letters, digits, \"/\", \":\", and \"_\""));
163
200
  const MenuSchema = v.object({
201
+ ...iframePermissionEntries,
164
202
  /**
165
203
  * When `true`, Commerce auto-generates a per-app ACL resource id from `metadata.id`
166
204
  * and injects it into the Adobe Commerce User Roles permission tree, allowing role-based
@@ -171,13 +209,12 @@ const MenuSchema = v.object({
171
209
  id: MenuIdSchema,
172
210
  label: nonEmptyStringValueSchema("menu label"),
173
211
  pageTitle: v.optional(nonEmptyStringValueSchema("menu page title")),
174
- parentMenu: v.optional(v.picklist(COMMERCE_MENUS, "parentMenu must be a known Commerce Admin menu ID")),
175
- sandboxPermissions: v.optional(SandboxPermissionsSchema)
212
+ parentMenu: v.optional(v.picklist(COMMERCE_MENUS, "parentMenu must be a known Commerce Admin menu ID"))
176
213
  });
177
214
  const NATIVE_UI_REPLACED_PAGE_TARGETS = ["order.create", "return.create"];
178
215
  const NativeUiReplacedPageSchema = v.strictObject({
216
+ ...iframePermissionEntries,
179
217
  path: nonEmptyStringValueSchema("replaced page path"),
180
- sandboxPermissions: v.optional(SandboxPermissionsSchema),
181
218
  target: v.picklist(NATIVE_UI_REPLACED_PAGE_TARGETS, `Invalid native UI replaced page target. Accepted values are: ${NATIVE_UI_REPLACED_PAGE_TARGETS.join(", ")}`),
182
219
  title: nonEmptyStringValueSchema("replaced page title")
183
220
  });
@@ -217,8 +254,8 @@ const AdminUiAclSchema = v.pipe(v.array(AclResourceEntrySchema), v.minLength(1,
217
254
  return new Set(ids).size === ids.length;
218
255
  }, "Custom ACL resource ids must stay unique after Commerce derivation: a top-level resource id must not equal a group's \"<group>_<child>\" combination."));
219
256
  /**
220
- * Schema for the `adminUi` config section.
221
- * Supports grid column extensions, mass actions, order, invoice, credit memo, and return view buttons, menu, native UI replaced pages, and custom ACL resources on `commerce/backend-ui/2`.
257
+ * Schema for Admin UI components, including Credit Memo custom-attribute columns.
258
+ * Custom-attribute columns and custom ACL resources require no backend-ui/2 workers or views.
222
259
  */
223
260
  const AdminUiSchema = v.object({
224
261
  acl: v.optional(AdminUiAclSchema),
@@ -264,8 +301,8 @@ const ADMIN_UI_VIEW_BUTTON_ENTITIES = [
264
301
  * `commerce/backend-ui/2` extension point — a menu, grid columns, mass actions,
265
302
  * view buttons, or native UI replaced pages. Custom ACL resources are
266
303
  * deliberately excluded: they reach Commerce through the `extensibility/1`
267
- * app-config payload, not backend-ui/2, so an acl-only config needs no
268
- * backend-ui/2 registration.
304
+ * app-config payload, not backend-ui/2. Custom-attribute grid columns also need
305
+ * no backend-ui/2 registration because Commerce reads their values locally.
269
306
  */
270
307
  function hasBackendUiV2Components(config) {
271
308
  const { adminUi } = config;
@@ -273,13 +310,31 @@ function hasBackendUiV2Components(config) {
273
310
  return Boolean(adminUi.menu || adminUi.order?.gridColumns || adminUi.order?.massActions?.length || adminUi.order?.viewButtons?.length || adminUi.product?.gridColumns || adminUi.product?.massActions?.length || adminUi.customer?.gridColumns || adminUi.customer?.massActions?.length || adminUi.invoice?.gridColumns || adminUi.invoice?.viewButtons?.length || adminUi.creditMemo?.gridColumns || adminUi.creditMemo?.viewButtons?.length || adminUi.rma?.viewButtons?.length || adminUi.shipment?.gridColumns || adminUi.nativeUi?.replacedPages?.length || adminUi.newsletter?.gridColumns);
274
311
  }
275
312
  /**
313
+ * Whether the Admin UI config needs a web view: a menu, a replaced native page, or a view-type
314
+ * button or mass action.
315
+ */
316
+ function hasAdminUiView(adminUi) {
317
+ if (adminUi.menu !== void 0 || (adminUi.nativeUi?.replacedPages.length ?? 0) > 0) return true;
318
+ return [...ADMIN_UI_VIEW_BUTTON_ENTITIES.flatMap((key) => adminUi[key]?.viewButtons ?? []), ...ADMIN_UI_MASS_ACTION_ENTITIES.flatMap((key) => adminUi[key]?.massActions ?? [])].some((entry) => entry.type === "view");
319
+ }
320
+ /**
276
321
  * Check whether the config declares at least one Admin UI component (menu, grid
277
- * columns, mass actions, view buttons, native UI replaced pages, or custom ACL
278
- * resources). A component-less `adminUi` block is treated as absent — it
279
- * registers nothing.
322
+ * columns, custom-attribute columns, mass actions, view buttons, native UI
323
+ * replaced pages, or custom ACL resources). A component-less `adminUi` block
324
+ * is treated as absent — it registers nothing.
280
325
  */
281
326
  function hasAdminUi(config) {
282
- return hasBackendUiV2Components(config) || Boolean(config.adminUi?.acl?.length);
327
+ return hasBackendUiV2Components(config) || Boolean(config.adminUi?.acl?.length || config.adminUi?.creditMemo?.customAttributeGridColumns);
328
+ }
329
+
330
+ // source/config/schema/runtime-action.ts
331
+ const RUNTIME_ACTION_REFERENCE_REGEX = /^\w(?:[\w@ .-]*[\w@.-])?\/\w(?:[\w@ .-]*[\w@.-])?$/u;
332
+ /**
333
+ * Schema for a runtime action reference in the format `<package>/<action>`.
334
+ * @param name - The name of the field, used in error messages.
335
+ */
336
+ function runtimeActionReferenceSchema(name) {
337
+ return v.pipe(nonEmptyStringValueSchema(name), v.regex(RUNTIME_ACTION_REFERENCE_REGEX, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")"));
283
338
  }
284
339
 
285
340
  // source/config/schema/eventing.ts
@@ -361,7 +416,7 @@ const BaseEventSchema = v.object({
361
416
  description: v.pipe(nonEmptyStringValueSchema("event description"), ioEventsTextSchema("Event description"), v.maxLength(MAX_DESCRIPTION_LENGTH$1, `The event description must not be longer than ${MAX_DESCRIPTION_LENGTH$1} characters`)),
362
417
  env: v.optional(CommerceEnvArraySchema),
363
418
  label: v.pipe(nonEmptyStringValueSchema("event label"), ioEventsTextSchema("Event label"), v.maxLength(MAX_LABEL_LENGTH, `The event label must not be longer than ${MAX_LABEL_LENGTH} characters`)),
364
- runtimeActions: v.array(v.pipe(nonEmptyStringValueSchema("runtime action"), v.regex(/^[a-zA-Z0-9-]+\/[a-zA-Z0-9-]+$/u, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")")), "Expected an array of runtime actions in the format <package>/<action>")
419
+ runtimeActions: v.array(runtimeActionReferenceSchema("runtime action"), "Expected an array of runtime actions in the format <package>/<action>")
365
420
  });
366
421
  /**
367
422
  * Schema for rule operator values.
@@ -560,7 +615,7 @@ const WebhookEntryBaseSchema = v.object({
560
615
  const WebhookEntryWithRuntimeActionSchema = v.object({
561
616
  ...WebhookEntryBaseSchema.entries,
562
617
  requireAdobeAuth: v.optional(booleanValueSchema("requireAdobeAuth")),
563
- runtimeAction: nonEmptyStringValueSchema("runtimeAction"),
618
+ runtimeAction: runtimeActionReferenceSchema("runtimeAction"),
564
619
  webhook: WebhookDefinitionBaseSchema
565
620
  });
566
621
  /** Schema for a webhook entry that provides an explicit URL. */
@@ -580,4 +635,4 @@ function hasWebhooks(config) {
580
635
  return Array.isArray(config?.webhooks) && config.webhooks.length > 0;
581
636
  }
582
637
 
583
- export { hasCustomInstallationSteps as a, hasEventing as c, ADMIN_UI_MASS_ACTION_ENTITIES as d, ADMIN_UI_VIEW_BUTTON_ENTITIES as f, hasBackendUiV2Components as h, hasCustomInstallation as i, hasExternalEvents as l, hasAdminUi as m, hasWebhooks as n, EventingSchema as o, AdminUiSchema as p, InstallationSchema as r, hasCommerceEvents as s, WebhooksSchema as t, ADMIN_UI_GRID_COLUMN_ENTITIES as u };
638
+ export { hasCustomInstallationSteps as a, hasEventing as c, ADMIN_UI_MASS_ACTION_ENTITIES as d, ADMIN_UI_VIEW_BUTTON_ENTITIES as f, hasBackendUiV2Components as g, hasAdminUiView as h, hasCustomInstallation as i, hasExternalEvents as l, hasAdminUi as m, hasWebhooks as n, EventingSchema as o, AdminUiSchema as p, InstallationSchema as r, hasCommerceEvents as s, WebhooksSchema as t, ADMIN_UI_GRID_COLUMN_ENTITIES as u };