@adobe/aio-commerce-lib-app 2.1.0 → 2.2.0-alpha-20261110204456
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.
- package/CHANGELOG.md +23 -0
- package/dist/cjs/actions/app-config/index.cjs +5 -5
- package/dist/cjs/actions/app-config/index.d.cts +2 -2
- package/dist/cjs/actions/association/index.cjs +2 -2
- package/dist/cjs/actions/config/index.cjs +2 -2
- package/dist/cjs/actions/config/index.d.cts +2 -2
- package/dist/cjs/actions/installation/index.cjs +61 -21
- package/dist/cjs/actions/installation/index.d.cts +4 -3
- package/dist/cjs/actions/scope-tree/index.cjs +2 -2
- package/dist/cjs/{app-Ch19CR6g.d.cts → app-D57Rhsqg.d.cts} +326 -0
- package/dist/cjs/commands/index.cjs +27 -12
- package/dist/cjs/config/index.browser.d.cts +2 -1
- package/dist/cjs/config/index.node.cjs +3 -3
- package/dist/cjs/config/index.node.d.cts +94 -6
- package/dist/{es/define-C95h_wa0.d.mts → cjs/define-b00_dBkO.d.cts} +1 -1
- package/dist/cjs/{index-D-Qn-irL.d.cts → index-8TD-noge.d.cts} +316 -316
- package/dist/cjs/{index-DWEigxhy.d.cts → index-vAue-u_y.d.cts} +1 -4
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +8 -8
- package/dist/cjs/{index.node-CxdwPrOg.cjs → index.node-CcH8PCzC.cjs} +1 -1
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +6 -1
- package/dist/cjs/{management-C_JQpgVB.cjs → management-Bed2BGcZ.cjs} +18 -6
- package/dist/cjs/{openapi-DFoMdZzI.cjs → openapi-CFqaMxUV.cjs} +426 -45
- package/dist/cjs/types-DslZGym8.d.cts +23 -0
- package/dist/cjs/{utils-B_Ypb2xF.cjs → utils-gONsOMjJ.cjs} +17 -2
- package/dist/cjs/{validate-B0rOILvG.cjs → validate-DAw7Pxp3.cjs} +1 -1
- package/dist/cjs/{router-DpB8wpR2.cjs → version-D750nyuB.cjs} +77 -19
- package/dist/{es/webhooks-C9vMZZDZ.d.mts → cjs/webhooks-C0NksFmg.d.cts} +266 -10
- package/dist/cjs/{webhooks-TvDm57xt.cjs → webhooks-EVlO8rxi.cjs} +53 -12
- package/dist/es/actions/app-config/index.d.mts +2 -2
- package/dist/es/actions/app-config/index.mjs +5 -5
- package/dist/es/actions/association/index.mjs +2 -2
- package/dist/es/actions/config/index.d.mts +1 -1
- package/dist/es/actions/config/index.mjs +2 -2
- package/dist/es/actions/installation/index.d.mts +4 -3
- package/dist/es/actions/installation/index.mjs +62 -22
- package/dist/es/actions/scope-tree/index.mjs +2 -2
- package/dist/es/{app-Ch19CR6g.d.mts → app-D57Rhsqg.d.mts} +326 -0
- package/dist/es/commands/index.mjs +27 -12
- package/dist/es/config/index.browser.d.mts +2 -1
- package/dist/es/config/index.node.d.mts +93 -4
- package/dist/es/config/index.node.mjs +3 -3
- package/dist/{cjs/define-C12IwNNN.d.cts → es/define-BZUvvjcZ.d.mts} +1 -1
- package/dist/es/{index-VgCNSlLP.d.mts → index-C_bP0dOM.d.mts} +2 -2
- package/dist/es/{index-CgsSXApi.d.mts → index-DUJtT78x.d.mts} +2 -2
- package/dist/es/index.d.mts +8 -8
- package/dist/es/index.mjs +1 -1
- package/dist/es/{index.node-C8EXBW94.mjs → index.node-ClvSfs5w.mjs} +1 -1
- package/dist/es/management/index.d.mts +6 -1
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-DKDR7-fX.mjs → management-DzRJV-AP.mjs} +18 -6
- package/dist/es/{openapi-E_1RFhAr.mjs → openapi-BUIws500.mjs} +426 -45
- package/dist/es/types-DslZGym8.d.mts +23 -0
- package/dist/es/{utils-SOtVo2VW.mjs → utils-D81SFSIR.mjs} +17 -2
- package/dist/es/{validate-CiJIjyOr.mjs → validate-BszbuhiE.mjs} +1 -1
- package/dist/es/{router-C23GIyGQ.mjs → version-DYwRSDcV.mjs} +71 -20
- package/dist/es/{webhooks-CfrYeMy_.mjs → webhooks-DRPXVMMo.mjs} +48 -13
- package/dist/{cjs/webhooks-Buu1d7AB.d.cts → es/webhooks-DvBYapZN.d.mts} +266 -10
- package/package.json +4 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { CommerceEnv } from "@adobe/aio-commerce-lib-core/commerce";
|
|
16
|
+
/** The Commerce instance data an app is associated with. */
|
|
17
|
+
type AssociatedCommerceData = {
|
|
18
|
+
/** Commerce API base URL. */
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
/** Deployment type of the Commerce instance. */
|
|
21
|
+
env: CommerceEnv;
|
|
22
|
+
};
|
|
23
|
+
export { AssociatedCommerceData as t };
|
|
@@ -319,14 +319,29 @@ function makeWorkspaceConfig(context) {
|
|
|
319
319
|
} };
|
|
320
320
|
}
|
|
321
321
|
const PROVIDER_WORKSPACE_PATH = /^\/events\/[^/]+\/[^/]+\/(?<workspace>[^/]+)\/providers\//u;
|
|
322
|
+
const LINK_BASE_URL = "https://placeholder.invalid";
|
|
323
|
+
/** The pathname of a relative or absolute href, or null when the href cannot be parsed. */
|
|
324
|
+
function getLinkPathname(href) {
|
|
325
|
+
try {
|
|
326
|
+
const { pathname } = new URL(href, LINK_BASE_URL);
|
|
327
|
+
return pathname;
|
|
328
|
+
} catch {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
322
332
|
/**
|
|
323
333
|
* The workspace id of an I/O provider, read from its `rel:update` link
|
|
324
|
-
* (`/events/{org}/{project}/{workspace}/providers/{id}`). Null when the
|
|
334
|
+
* (`/events/{org}/{project}/{workspace}/providers/{id}`), relative or absolute. Null when the
|
|
335
|
+
* provider has no such link or the link has another shape.
|
|
325
336
|
*
|
|
326
337
|
* @param links - The HAL links of the provider.
|
|
327
338
|
*/
|
|
328
339
|
function getProviderWorkspaceId(links) {
|
|
329
|
-
|
|
340
|
+
const href = links?.["rel:update"]?.href;
|
|
341
|
+
if (typeof href !== "string") return null;
|
|
342
|
+
const pathname = getLinkPathname(href);
|
|
343
|
+
if (pathname === null) return null;
|
|
344
|
+
return pathname.match(PROVIDER_WORKSPACE_PATH)?.groups?.workspace ?? null;
|
|
330
345
|
}
|
|
331
346
|
/**
|
|
332
347
|
* Retrieves the current existing data and returns it in a normalized way.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { a as hasCustomInstallationSteps,
|
|
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-DRPXVMMo.mjs";
|
|
16
16
|
import { t as alphaNumericOrHyphenSchema } from "./schemas-DYMNbFdX.mjs";
|
|
17
17
|
import { RecordedSchemaBusinessConfig, SchemaBusinessConfig } from "@adobe/aio-commerce-lib-config";
|
|
18
18
|
import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import { badRequest, internalServerError, methodNotAllowed, notFound } from "@adobe/aio-commerce-lib-core/responses";
|
|
16
16
|
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
17
17
|
import { parse } from "regexparam";
|
|
18
|
+
import libConfigPkg from "@adobe/aio-commerce-lib-config/package.json" with { type: "json" };
|
|
18
19
|
|
|
19
20
|
// ../../packages-private/common-utils/source/actions/http/middleware/logger.ts
|
|
20
21
|
/**
|
|
@@ -157,6 +158,36 @@ function parseQueryParams(queryString, fallbackParams) {
|
|
|
157
158
|
var HttpActionRouter = class HttpActionRouter {
|
|
158
159
|
routes = [];
|
|
159
160
|
contextBuilders = [];
|
|
161
|
+
defaultHeaders;
|
|
162
|
+
/**
|
|
163
|
+
* @param options - Router options.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const router = new HttpActionRouter({ headers: { "x-content-type-options": "nosniff" } });
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
constructor(options = {}) {
|
|
171
|
+
this.defaultHeaders = { ...options.headers };
|
|
172
|
+
}
|
|
173
|
+
/** Adds the default headers to a response. Headers already on the response win. */
|
|
174
|
+
withDefaultHeaders(response) {
|
|
175
|
+
const defaults = Object.entries(this.defaultHeaders);
|
|
176
|
+
if (defaults.length === 0) return response;
|
|
177
|
+
const headers = { ...(response.type === "error" ? response.error : response).headers };
|
|
178
|
+
const present = new Set(Object.keys(headers).map((k) => k.toLowerCase()));
|
|
179
|
+
for (const [name, value] of defaults) if (!present.has(name.toLowerCase())) headers[name] = value;
|
|
180
|
+
return response.type === "error" ? {
|
|
181
|
+
...response,
|
|
182
|
+
error: {
|
|
183
|
+
...response.error,
|
|
184
|
+
headers
|
|
185
|
+
}
|
|
186
|
+
} : {
|
|
187
|
+
...response,
|
|
188
|
+
headers
|
|
189
|
+
};
|
|
190
|
+
}
|
|
160
191
|
/**
|
|
161
192
|
* Internal method to add a route to the router.
|
|
162
193
|
*/
|
|
@@ -388,26 +419,46 @@ var HttpActionRouter = class HttpActionRouter {
|
|
|
388
419
|
* ```
|
|
389
420
|
*/
|
|
390
421
|
handler() {
|
|
391
|
-
return async (args) =>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if (
|
|
408
|
-
return
|
|
409
|
-
}
|
|
422
|
+
return async (args) => this.withDefaultHeaders(await this.dispatch(args));
|
|
423
|
+
}
|
|
424
|
+
/** Matches the request to a route and runs it. */
|
|
425
|
+
async dispatch(args) {
|
|
426
|
+
const method = (args.__ow_method ?? "get").toUpperCase();
|
|
427
|
+
const rawPath = args.__ow_path ?? "/";
|
|
428
|
+
const path = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
|
429
|
+
const headers = args.__ow_headers ?? {};
|
|
430
|
+
const body = parseRequestBody(args.__ow_body, args);
|
|
431
|
+
const query = parseQueryParams(args.__ow_query, args);
|
|
432
|
+
const context = await this.buildContext(args);
|
|
433
|
+
const matchedMethods = [];
|
|
434
|
+
for (const route of this.routes) {
|
|
435
|
+
const match = route.pattern.exec(path);
|
|
436
|
+
if (!match) continue;
|
|
437
|
+
matchedMethods.push(route.method);
|
|
438
|
+
if (route.method !== method) continue;
|
|
439
|
+
return await HttpActionRouter.handleRoute(route, match, body, query, headers, method, path, context);
|
|
440
|
+
}
|
|
441
|
+
if (matchedMethods.length > 0) return methodNotAllowed(`Method ${method} not allowed`);
|
|
442
|
+
return notFound(`No route matches ${path}`);
|
|
410
443
|
}
|
|
411
444
|
};
|
|
412
445
|
|
|
413
|
-
|
|
446
|
+
// source/actions/version.ts
|
|
447
|
+
/**
|
|
448
|
+
* Name of the response header that carries the versions of the SDK libraries the app-management
|
|
449
|
+
* endpoints were built with. These are not the app's own version.
|
|
450
|
+
*/
|
|
451
|
+
const SDK_LIB_VERSIONS_HEADER = "x-ac-sdk-lib-versions";
|
|
452
|
+
const UNKNOWN_VERSION = "unknown";
|
|
453
|
+
/**
|
|
454
|
+
* Value of {@link SDK_LIB_VERSIONS_HEADER}, an RFC 8941 dictionary with string values, e.g.
|
|
455
|
+
* `lib-app="2.2.0", lib-config="1.4.1"`. TSDown and Vitest replace `__PKG_VERSION__` for
|
|
456
|
+
* `lib-app`, which is "unknown" when the variable is not defined. `lib-config` is the version
|
|
457
|
+
* in the `package.json` of the copy of lib-config that lib-app loads, which the app's bundler
|
|
458
|
+
* resolves when it builds the action.
|
|
459
|
+
*/
|
|
460
|
+
const SDK_LIB_VERSIONS = [["lib-app", "2.2.0-alpha-20261110204456"], ["lib-config", libConfigPkg.version ?? UNKNOWN_VERSION]].map(([name, version]) => `${name}="${version}"`).join(", ");
|
|
461
|
+
/** Headers every app-management router adds to its responses. */
|
|
462
|
+
const SDK_LIB_VERSIONS_HEADERS = { [SDK_LIB_VERSIONS_HEADER]: SDK_LIB_VERSIONS };
|
|
463
|
+
|
|
464
|
+
export { HttpActionRouter as n, logger as r, SDK_LIB_VERSIONS_HEADERS as t };
|
|
@@ -105,7 +105,7 @@ const ViewButtonLevelSchema = v.picklist([
|
|
|
105
105
|
0,
|
|
106
106
|
1
|
|
107
107
|
]);
|
|
108
|
-
const
|
|
108
|
+
const ViewButtonViewSchema = v.strictObject({
|
|
109
109
|
aclProtected: v.optional(v.boolean()),
|
|
110
110
|
confirm: v.optional(ConfirmSchema),
|
|
111
111
|
description: v.optional(nonEmptyStringValueSchema("view button description")),
|
|
@@ -117,7 +117,8 @@ const OrderViewButtonSchema = v.variant("type", [v.strictObject({
|
|
|
117
117
|
sandboxPermissions: v.optional(SandboxPermissionsSchema),
|
|
118
118
|
sortOrder: v.optional(positiveNumberValueSchema("sortOrder")),
|
|
119
119
|
type: v.literal("view")
|
|
120
|
-
})
|
|
120
|
+
});
|
|
121
|
+
const ViewButtonWorkerSchema = v.strictObject({
|
|
121
122
|
aclProtected: v.optional(v.boolean()),
|
|
122
123
|
confirm: v.optional(ConfirmSchema),
|
|
123
124
|
description: v.optional(nonEmptyStringValueSchema("view button description")),
|
|
@@ -129,7 +130,16 @@ const OrderViewButtonSchema = v.variant("type", [v.strictObject({
|
|
|
129
130
|
sortOrder: v.optional(positiveNumberValueSchema("sortOrder")),
|
|
130
131
|
timeout: v.optional(positiveNumberValueSchema("timeout")),
|
|
131
132
|
type: v.literal("worker")
|
|
132
|
-
})
|
|
133
|
+
});
|
|
134
|
+
const OrderViewButtonSchema = v.variant("type", [ViewButtonViewSchema, ViewButtonWorkerSchema]);
|
|
135
|
+
const InvoiceViewButtonSchema = v.variant("type", [v.strictObject({
|
|
136
|
+
...ViewButtonViewSchema.entries,
|
|
137
|
+
title: v.optional(nonEmptyStringValueSchema("view button page title"))
|
|
138
|
+
}), ViewButtonWorkerSchema]);
|
|
139
|
+
const CreditMemoViewButtonSchema = v.variant("type", [v.strictObject({
|
|
140
|
+
...ViewButtonViewSchema.entries,
|
|
141
|
+
title: v.optional(nonEmptyStringValueSchema("view button page title"))
|
|
142
|
+
}), ViewButtonWorkerSchema]);
|
|
133
143
|
const MassActionsSchema = v.pipe(v.array(MassActionSchema), v.check((items) => hasUniqueSanitizedIds(items), "Mass action ids must be unique after Commerce id sanitization."));
|
|
134
144
|
const AdminUiOrderSchema = v.object({
|
|
135
145
|
gridColumns: v.optional(GridColumnsSchema),
|
|
@@ -140,6 +150,14 @@ const AdminUiGridAndMassActionEntitySchema = v.object({
|
|
|
140
150
|
gridColumns: v.optional(GridColumnsSchema),
|
|
141
151
|
massActions: v.optional(MassActionsSchema)
|
|
142
152
|
});
|
|
153
|
+
const AdminUiInvoiceSchema = v.object({
|
|
154
|
+
gridColumns: v.optional(GridColumnsSchema),
|
|
155
|
+
viewButtons: v.optional(v.pipe(v.array(InvoiceViewButtonSchema), v.check((items) => hasUniqueSanitizedIds(items), "Invoice view button ids must be unique after Commerce id sanitization.")))
|
|
156
|
+
});
|
|
157
|
+
const AdminUiCreditMemoSchema = v.object({
|
|
158
|
+
gridColumns: v.optional(GridColumnsSchema),
|
|
159
|
+
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.")))
|
|
160
|
+
});
|
|
143
161
|
const AdminUiGridOnlyEntitySchema = v.object({ gridColumns: v.optional(GridColumnsSchema) });
|
|
144
162
|
const MenuIdSchema = v.pipe(nonEmptyStringValueSchema("menu ID"), v.regex(/^[A-Za-z0-9_/:]+$/u, "Menu ID may contain only letters, digits, \"/\", \":\", and \"_\""));
|
|
145
163
|
const MenuSchema = v.object({
|
|
@@ -156,6 +174,14 @@ const MenuSchema = v.object({
|
|
|
156
174
|
parentMenu: v.optional(v.picklist(COMMERCE_MENUS, "parentMenu must be a known Commerce Admin menu ID")),
|
|
157
175
|
sandboxPermissions: v.optional(SandboxPermissionsSchema)
|
|
158
176
|
});
|
|
177
|
+
const NATIVE_UI_REPLACED_PAGE_TARGETS = ["order.create", "return.create"];
|
|
178
|
+
const NativeUiReplacedPageSchema = v.strictObject({
|
|
179
|
+
path: nonEmptyStringValueSchema("replaced page path"),
|
|
180
|
+
sandboxPermissions: v.optional(SandboxPermissionsSchema),
|
|
181
|
+
target: v.picklist(NATIVE_UI_REPLACED_PAGE_TARGETS, `Invalid native UI replaced page target. Accepted values are: ${NATIVE_UI_REPLACED_PAGE_TARGETS.join(", ")}`),
|
|
182
|
+
title: nonEmptyStringValueSchema("replaced page title")
|
|
183
|
+
});
|
|
184
|
+
const NativeUiSchema = v.object({ replacedPages: v.pipe(v.array(NativeUiReplacedPageSchema), v.check((pages) => new Set(pages.map((page) => page.target)).size === pages.length, "Native UI replaced page targets must be unique.")) });
|
|
159
185
|
const AclResourceIdSchema = v.pipe(nonEmptyStringValueSchema("acl resource ID"), v.regex(/^[a-z0-9_]+$/u, "ACL resource ID may contain only lowercase letters, digits, and \"_\""));
|
|
160
186
|
const ACL_LABEL_MIN_LENGTH = 3;
|
|
161
187
|
const ACL_LABEL_MAX_LENGTH = 50;
|
|
@@ -192,14 +218,15 @@ const AdminUiAclSchema = v.pipe(v.array(AclResourceEntrySchema), v.minLength(1,
|
|
|
192
218
|
}, "Custom ACL resource ids must stay unique after Commerce derivation: a top-level resource id must not equal a group's \"<group>_<child>\" combination."));
|
|
193
219
|
/**
|
|
194
220
|
* Schema for the `adminUi` config section.
|
|
195
|
-
* Supports grid column extensions, mass actions, order view buttons, menu, and custom ACL resources on `commerce/backend-ui/2`.
|
|
221
|
+
* Supports grid column extensions, mass actions, order, invoice, and credit memo view buttons, menu, native UI replaced pages, and custom ACL resources on `commerce/backend-ui/2`.
|
|
196
222
|
*/
|
|
197
223
|
const AdminUiSchema = v.object({
|
|
198
224
|
acl: v.optional(AdminUiAclSchema),
|
|
199
|
-
creditMemo: v.optional(
|
|
225
|
+
creditMemo: v.optional(AdminUiCreditMemoSchema),
|
|
200
226
|
customer: v.optional(AdminUiGridAndMassActionEntitySchema),
|
|
201
|
-
invoice: v.optional(
|
|
227
|
+
invoice: v.optional(AdminUiInvoiceSchema),
|
|
202
228
|
menu: v.optional(MenuSchema),
|
|
229
|
+
nativeUi: v.optional(NativeUiSchema),
|
|
203
230
|
newsletter: v.optional(AdminUiGridOnlyEntitySchema),
|
|
204
231
|
order: v.optional(AdminUiOrderSchema),
|
|
205
232
|
product: v.optional(AdminUiGridAndMassActionEntitySchema),
|
|
@@ -224,22 +251,30 @@ const ADMIN_UI_MASS_ACTION_ENTITIES = [
|
|
|
224
251
|
"product",
|
|
225
252
|
"customer"
|
|
226
253
|
];
|
|
254
|
+
/** Entities that support view buttons, in a stable order. */
|
|
255
|
+
const ADMIN_UI_VIEW_BUTTON_ENTITIES = [
|
|
256
|
+
"order",
|
|
257
|
+
"invoice",
|
|
258
|
+
"creditMemo"
|
|
259
|
+
];
|
|
227
260
|
/**
|
|
228
261
|
* Check whether the config declares an Admin UI component that requires the
|
|
229
262
|
* `commerce/backend-ui/2` extension point — a menu, grid columns, mass actions,
|
|
230
|
-
* or
|
|
231
|
-
* Commerce through the `extensibility/1`
|
|
232
|
-
* so an acl-only config needs no
|
|
263
|
+
* view buttons, or native UI replaced pages. Custom ACL resources are
|
|
264
|
+
* deliberately excluded: they reach Commerce through the `extensibility/1`
|
|
265
|
+
* app-config payload, not backend-ui/2, so an acl-only config needs no
|
|
266
|
+
* backend-ui/2 registration.
|
|
233
267
|
*/
|
|
234
268
|
function hasBackendUiV2Components(config) {
|
|
235
269
|
const { adminUi } = config;
|
|
236
270
|
if (!adminUi) return false;
|
|
237
|
-
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.creditMemo?.gridColumns || adminUi.shipment?.gridColumns || adminUi.newsletter?.gridColumns);
|
|
271
|
+
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.shipment?.gridColumns || adminUi.nativeUi?.replacedPages?.length || adminUi.newsletter?.gridColumns);
|
|
238
272
|
}
|
|
239
273
|
/**
|
|
240
274
|
* Check whether the config declares at least one Admin UI component (menu, grid
|
|
241
|
-
* columns, mass actions, view buttons,
|
|
242
|
-
* treated as absent — it
|
|
275
|
+
* columns, mass actions, view buttons, native UI replaced pages, or custom ACL
|
|
276
|
+
* resources). A component-less `adminUi` block is treated as absent — it
|
|
277
|
+
* registers nothing.
|
|
243
278
|
*/
|
|
244
279
|
function hasAdminUi(config) {
|
|
245
280
|
return hasBackendUiV2Components(config) || Boolean(config.adminUi?.acl?.length);
|
|
@@ -543,4 +578,4 @@ function hasWebhooks(config) {
|
|
|
543
578
|
return Array.isArray(config?.webhooks) && config.webhooks.length > 0;
|
|
544
579
|
}
|
|
545
580
|
|
|
546
|
-
export { hasCustomInstallationSteps as a, hasEventing as c, ADMIN_UI_MASS_ACTION_ENTITIES as d,
|
|
581
|
+
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 };
|