@adobe/aio-commerce-lib-admin-ui 1.1.0-beta-20260820174436 → 1.2.0-beta-20260930143021
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 -1
- package/dist/cjs/acl-resource-id-Bha1pOIk.d.cts +85 -0
- package/dist/cjs/acl-resource-id-nCj_Kne2.cjs +141 -0
- package/dist/cjs/api/index.cjs +4 -2
- package/dist/cjs/api/index.d.cts +10 -10
- package/dist/cjs/grid-columns/index.cjs +7 -7
- package/dist/cjs/grid-columns/index.d.cts +14 -10
- package/dist/cjs/mass-actions/index.cjs +3 -7
- package/dist/cjs/mass-actions/index.d.cts +10 -10
- package/dist/cjs/menu/index.cjs +1 -1
- package/dist/cjs/menu/index.d.cts +13 -14
- package/dist/cjs/order-view-buttons/index.cjs +1 -1
- package/dist/cjs/order-view-buttons/index.d.cts +6 -6
- package/dist/cjs/web/index.cjs +4 -4
- package/dist/cjs/web/index.d.cts +8 -8
- package/dist/es/acl-resource-id-Bha1pOIk.d.mts +85 -0
- package/dist/es/acl-resource-id-CHw95qd2.mjs +112 -0
- package/dist/es/api/index.d.mts +10 -10
- package/dist/es/api/index.mjs +2 -2
- package/dist/es/grid-columns/index.d.mts +14 -10
- package/dist/es/grid-columns/index.mjs +7 -7
- package/dist/es/mass-actions/index.d.mts +10 -10
- package/dist/es/mass-actions/index.mjs +3 -7
- package/dist/es/menu/index.d.mts +13 -14
- package/dist/es/menu/index.mjs +1 -1
- package/dist/es/order-view-buttons/index.d.mts +6 -6
- package/dist/es/order-view-buttons/index.mjs +1 -1
- package/dist/es/web/index.d.mts +8 -8
- package/dist/es/web/index.mjs +1 -1
- package/package.json +12 -12
- package/dist/cjs/acl-resource-id-DBlYU0DE.d.cts +0 -39
- package/dist/cjs/acl-resource-id-R52pR3gG.cjs +0 -68
- package/dist/es/acl-resource-id-DBlYU0DE.d.mts +0 -39
- package/dist/es/acl-resource-id-pryVxI_c.mjs +0 -57
|
@@ -37,7 +37,7 @@ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/res
|
|
|
37
37
|
* @returns The full Commerce ACL resource id for the view-button leaf node, or an empty string
|
|
38
38
|
* when `metadataId` is blank.
|
|
39
39
|
*/
|
|
40
|
-
declare function getOrderViewButtonAclResourceId(metadataId: string, buttonId: string): string;
|
|
40
|
+
export declare function getOrderViewButtonAclResourceId(metadataId: string, buttonId: string): string;
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region source/order-view-buttons/schema.d.ts
|
|
43
43
|
/**
|
|
@@ -47,7 +47,7 @@ declare function getOrderViewButtonAclResourceId(metadataId: string, buttonId: s
|
|
|
47
47
|
* handler serve multiple buttons by branching on it. `orderId` is the
|
|
48
48
|
* single order currently being viewed.
|
|
49
49
|
*/
|
|
50
|
-
declare const OrderViewButtonRequestSchema: v.ObjectSchema<{
|
|
50
|
+
export declare const OrderViewButtonRequestSchema: v.ObjectSchema<{
|
|
51
51
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
52
52
|
readonly orderId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
53
53
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
@@ -81,7 +81,7 @@ type OrderViewButtonErrorBody = {
|
|
|
81
81
|
* }
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
84
|
-
declare function parseOrderViewButtonRequest(input: unknown): OrderViewButtonRequest;
|
|
84
|
+
export declare function parseOrderViewButtonRequest(input: unknown): OrderViewButtonRequest;
|
|
85
85
|
/**
|
|
86
86
|
* Builds an HTTP 200 success response for an order view button handler.
|
|
87
87
|
*
|
|
@@ -93,7 +93,7 @@ declare function parseOrderViewButtonRequest(input: unknown): OrderViewButtonReq
|
|
|
93
93
|
* return okOrderViewButtonResponse();
|
|
94
94
|
* ```
|
|
95
95
|
*/
|
|
96
|
-
declare function okOrderViewButtonResponse(): SuccessResponse<OrderViewButtonSuccessBody>;
|
|
96
|
+
export declare function okOrderViewButtonResponse(): SuccessResponse<OrderViewButtonSuccessBody>;
|
|
97
97
|
/**
|
|
98
98
|
* Builds an error response for a worker order view button handler with the given HTTP status code.
|
|
99
99
|
*
|
|
@@ -107,6 +107,6 @@ declare function okOrderViewButtonResponse(): SuccessResponse<OrderViewButtonSuc
|
|
|
107
107
|
* return orderViewButtonErrorResponse(500, "Could not reach inventory service");
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
110
|
-
declare function orderViewButtonErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<OrderViewButtonErrorBody>;
|
|
110
|
+
export declare function orderViewButtonErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<OrderViewButtonErrorBody>;
|
|
111
111
|
//#endregion
|
|
112
|
-
export {
|
|
112
|
+
export type { OrderViewButtonErrorBody, OrderViewButtonRequest, OrderViewButtonSuccessBody };
|
package/dist/cjs/web/index.cjs
CHANGED
|
@@ -18,8 +18,8 @@ let react = require("react");
|
|
|
18
18
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
19
19
|
let _adobe_exc_app = require("@adobe/exc-app");
|
|
20
20
|
_adobe_exc_app = require_rolldown_runtime.__toESM(_adobe_exc_app, 1);
|
|
21
|
-
let
|
|
22
|
-
|
|
21
|
+
let _adobe_exc_app_page = require("@adobe/exc-app/page");
|
|
22
|
+
_adobe_exc_app_page = require_rolldown_runtime.__toESM(_adobe_exc_app_page, 1);
|
|
23
23
|
let _tanstack_react_router = require("@tanstack/react-router");
|
|
24
24
|
let react_dom_client = require("react-dom/client");
|
|
25
25
|
let _adobe_uix_guest = require("@adobe/uix-guest");
|
|
@@ -860,10 +860,10 @@ function createExtensionApp({ menu, metadata, routes = [], root: customRoot }) {
|
|
|
860
860
|
(0, _adobe_exc_app.init)(() => {
|
|
861
861
|
const runtime = (0, _adobe_exc_app.default)();
|
|
862
862
|
const { promise, resolve } = Promise.withResolvers();
|
|
863
|
-
|
|
863
|
+
_adobe_exc_app_page.default.title = document.title;
|
|
864
864
|
runtime.on("ready", (configuration) => {
|
|
865
865
|
resolve(configuration ?? runtime.lastConfigurationPayload);
|
|
866
|
-
|
|
866
|
+
_adobe_exc_app_page.default.done().catch(() => {
|
|
867
867
|
console.warn("Failed to mark page as done in Experience Cloud Shell.");
|
|
868
868
|
});
|
|
869
869
|
});
|
package/dist/cjs/web/index.d.cts
CHANGED
|
@@ -50,7 +50,7 @@ type ActionsResult<T extends ActionMap, E = Error> = {
|
|
|
50
50
|
*
|
|
51
51
|
* Returns an error when no host provides credentials.
|
|
52
52
|
*/
|
|
53
|
-
declare function useIms(): Result<ImsContext>;
|
|
53
|
+
export declare function useIms(): Result<ImsContext>;
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region source/web/react/commerce/types.d.ts
|
|
56
56
|
/** The guest connection that shares the context between the extension and the Admin UI host. */
|
|
@@ -106,7 +106,7 @@ type OrderViewButtonContext = {
|
|
|
106
106
|
* }
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
|
-
declare function useSharedContext(): Result<SharedContext>;
|
|
109
|
+
export declare function useSharedContext(): Result<SharedContext>;
|
|
110
110
|
//#endregion
|
|
111
111
|
//#region source/web/react/commerce/hooks/use-commerce.d.ts
|
|
112
112
|
type CommerceData = {
|
|
@@ -119,7 +119,7 @@ type CommerceData = {
|
|
|
119
119
|
* Returns an error when used outside a Commerce Admin UI frame, when the host does not expose the
|
|
120
120
|
* Commerce integration API, or when resolving the host fails.
|
|
121
121
|
*/
|
|
122
|
-
declare function useCommerce(): Result<CommerceData>;
|
|
122
|
+
export declare function useCommerce(): Result<CommerceData>;
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region source/web/react/commerce/hooks/use-extension-context.d.ts
|
|
125
125
|
/**
|
|
@@ -129,14 +129,14 @@ declare function useCommerce(): Result<CommerceData>;
|
|
|
129
129
|
* Returns an error outside the Commerce shared context, or when the mass-action selection is
|
|
130
130
|
* missing, empty, or contains a non-string row ID.
|
|
131
131
|
*/
|
|
132
|
-
declare function useMassActionContext(): Result<MassActionContext>;
|
|
132
|
+
export declare function useMassActionContext(): Result<MassActionContext>;
|
|
133
133
|
/**
|
|
134
134
|
* Returns the context for an order view-button extension point: the order ID the button was
|
|
135
135
|
* triggered from.
|
|
136
136
|
*
|
|
137
137
|
* Returns an error when no order ID is present in the page URL.
|
|
138
138
|
*/
|
|
139
|
-
declare function useOrderViewButtonContext(): Result<OrderViewButtonContext>;
|
|
139
|
+
export declare function useOrderViewButtonContext(): Result<OrderViewButtonContext>;
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region source/web/react/commerce/hooks/use-host-connection.d.ts
|
|
142
142
|
/**
|
|
@@ -153,7 +153,7 @@ declare function useOrderViewButtonContext(): Result<OrderViewButtonContext>;
|
|
|
153
153
|
* }
|
|
154
154
|
* ```
|
|
155
155
|
*/
|
|
156
|
-
declare function useHostConnection(): ActionsResult<HostConnection>;
|
|
156
|
+
export declare function useHostConnection(): ActionsResult<HostConnection>;
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region source/web/react/routing/types.d.ts
|
|
159
159
|
declare module "@react-spectrum/s2/Provider" {
|
|
@@ -208,6 +208,6 @@ type CreateExtensionAppOptions = {
|
|
|
208
208
|
* });
|
|
209
209
|
* ```
|
|
210
210
|
*/
|
|
211
|
-
declare function createExtensionApp({ menu, metadata, routes, root: customRoot }: CreateExtensionAppOptions): void;
|
|
211
|
+
export declare function createExtensionApp({ menu, metadata, routes, root: customRoot }: CreateExtensionAppOptions): void;
|
|
212
212
|
//#endregion
|
|
213
|
-
export {
|
|
213
|
+
export type { CreateExtensionAppOptions, ExtensionRoute, HostConnection, ImsContext, MassActionContext, OrderViewButtonContext, SharedContext };
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
//#region source/api/lib/acl-resource-id.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Sanitizes a single ACL id segment: trims whitespace, lowercases, and replaces every
|
|
18
|
+
* character outside [a-z0-9_] with an underscore. This mirrors the Commerce module's own
|
|
19
|
+
* per-segment normalization — the same step applied when building any ACL resource id from a
|
|
20
|
+
* config id.
|
|
21
|
+
*/
|
|
22
|
+
declare function sanitizeSegment(segment: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Derives the deterministic Commerce ACL resource id for an app from its metadata id.
|
|
25
|
+
*
|
|
26
|
+
* The id is assembled as {@link PREFIX} + sanitized `metadataId`, where sanitization trims
|
|
27
|
+
* whitespace, lowercases, and replaces every character outside `[a-z0-9_]` with `_`.
|
|
28
|
+
* `"Magento_CommerceBackendUix::adminuisdk_app_"` is that fixed constant prefix — not a
|
|
29
|
+
* placeholder — so the example below is fully reproducible from the given argument:
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```
|
|
33
|
+
* getAclResourceId("approval-dashboard-app")
|
|
34
|
+
* // PREFIX + sanitize("approval-dashboard-app")
|
|
35
|
+
* // "Magento_CommerceBackendUix::adminuisdk_app_" + "approval_dashboard_app"
|
|
36
|
+
* // → "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app"
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
|
|
40
|
+
* @returns The full Commerce ACL resource id, or an empty string when `metadataId` is blank.
|
|
41
|
+
*/
|
|
42
|
+
declare function getAclResourceId(metadataId: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Derives the deterministic Commerce ACL resource id for a custom (standalone) ACL resource
|
|
45
|
+
* declared under `adminUi.acl`. Mirrors the Commerce `AclResourceIdGenerator` `acl` token exactly.
|
|
46
|
+
*
|
|
47
|
+
* With only `resourceId`, returns the id of a top-level resource or a group node; with `childId`,
|
|
48
|
+
* returns the id of a leaf inside that group. Each segment is sanitized independently (trim,
|
|
49
|
+
* lowercase, non-`[a-z0-9_]` → `_`).
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```
|
|
53
|
+
* getCustomAclResourceId("my-app", "approve_refunds")
|
|
54
|
+
* // → "Magento_CommerceBackendUix::adminuisdk_app_my_app_acl_approve_refunds"
|
|
55
|
+
* getCustomAclResourceId("my-app", "reports", "export")
|
|
56
|
+
* // → "Magento_CommerceBackendUix::adminuisdk_app_my_app_acl_reports_export"
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param metadataId - The application's `metadata.id` value.
|
|
60
|
+
* @param resourceId - The top-level resource or group `id` from `adminUi.acl`.
|
|
61
|
+
* @param childId - Optional child leaf `id` when addressing a resource inside a group.
|
|
62
|
+
* @returns The full Commerce ACL resource id, or an empty string when `metadataId` is blank.
|
|
63
|
+
*/
|
|
64
|
+
declare function getCustomAclResourceId(metadataId: string, resourceId: string, childId?: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Commerce entities an Admin UI component can attach to, using the same spelling Commerce
|
|
67
|
+
* sends in the wire-contract `gridType` field. Credit memo grids send `"creditmemo"` on the
|
|
68
|
+
* wire — not `"creditMemo"` — even though the corresponding config key (`adminUi.creditMemo`)
|
|
69
|
+
* is camelCase.
|
|
70
|
+
*
|
|
71
|
+
* Single source of truth for the entity vocabulary: `GridTypeSchema` derives its picklist from it.
|
|
72
|
+
*/
|
|
73
|
+
declare const ADMIN_UI_GRID_ENTITIES: readonly ["order", "product", "customer", "invoice", "creditmemo", "shipment", "newsletter"];
|
|
74
|
+
/** Commerce entity an Admin UI component is attached to. */
|
|
75
|
+
type AdminUiEntity = (typeof ADMIN_UI_GRID_ENTITIES)[number];
|
|
76
|
+
/**
|
|
77
|
+
* Entities that support mass actions — a subset of `ADMIN_UI_GRID_ENTITIES`. Mass actions, unlike
|
|
78
|
+
* grid columns, are not available on the invoice, credit memo, or shipment grids.
|
|
79
|
+
* `MassActionGridTypeSchema` derives its picklist from it.
|
|
80
|
+
*/
|
|
81
|
+
declare const MASS_ACTION_ENTITIES: readonly ["order", "product", "customer", "newsletter"];
|
|
82
|
+
/** Commerce entity a mass action is attached to. */
|
|
83
|
+
type MassActionEntity = (typeof MASS_ACTION_ENTITIES)[number];
|
|
84
|
+
//#endregion
|
|
85
|
+
export { sanitizeSegment as a, getCustomAclResourceId as i, MassActionEntity as n, getAclResourceId as r, AdminUiEntity as t };
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
//#region source/api/lib/acl-resource-id.ts
|
|
16
|
+
/**
|
|
17
|
+
* Fixed, constant prefix that every Admin UI SDK ACL resource id starts with.
|
|
18
|
+
* It is owned by Commerce and is a stable part of the cross-repo id contract.
|
|
19
|
+
*
|
|
20
|
+
* @internal Exported for use by domain ACL helpers only — not part of the public API.
|
|
21
|
+
*/
|
|
22
|
+
const PREFIX = "Magento_CommerceBackendUix::adminuisdk_app_";
|
|
23
|
+
/**
|
|
24
|
+
* Sanitizes a single ACL id segment: trims whitespace, lowercases, and replaces every
|
|
25
|
+
* character outside [a-z0-9_] with an underscore. This mirrors the Commerce module's own
|
|
26
|
+
* per-segment normalization — the same step applied when building any ACL resource id from a
|
|
27
|
+
* config id.
|
|
28
|
+
*/
|
|
29
|
+
function sanitizeSegment(segment) {
|
|
30
|
+
return segment.trim().toLowerCase().replace(/[^a-z0-9_]/g, "_");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Derives the deterministic Commerce ACL resource id for an app from its metadata id.
|
|
34
|
+
*
|
|
35
|
+
* The id is assembled as {@link PREFIX} + sanitized `metadataId`, where sanitization trims
|
|
36
|
+
* whitespace, lowercases, and replaces every character outside `[a-z0-9_]` with `_`.
|
|
37
|
+
* `"Magento_CommerceBackendUix::adminuisdk_app_"` is that fixed constant prefix — not a
|
|
38
|
+
* placeholder — so the example below is fully reproducible from the given argument:
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```
|
|
42
|
+
* getAclResourceId("approval-dashboard-app")
|
|
43
|
+
* // PREFIX + sanitize("approval-dashboard-app")
|
|
44
|
+
* // "Magento_CommerceBackendUix::adminuisdk_app_" + "approval_dashboard_app"
|
|
45
|
+
* // → "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app"
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
|
|
49
|
+
* @returns The full Commerce ACL resource id, or an empty string when `metadataId` is blank.
|
|
50
|
+
*/
|
|
51
|
+
function getAclResourceId(metadataId) {
|
|
52
|
+
if (metadataId.trim() === "") return "";
|
|
53
|
+
return `${PREFIX}${sanitizeSegment(metadataId)}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Derives the deterministic Commerce ACL resource id for a custom (standalone) ACL resource
|
|
57
|
+
* declared under `adminUi.acl`. Mirrors the Commerce `AclResourceIdGenerator` `acl` token exactly.
|
|
58
|
+
*
|
|
59
|
+
* With only `resourceId`, returns the id of a top-level resource or a group node; with `childId`,
|
|
60
|
+
* returns the id of a leaf inside that group. Each segment is sanitized independently (trim,
|
|
61
|
+
* lowercase, non-`[a-z0-9_]` → `_`).
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```
|
|
65
|
+
* getCustomAclResourceId("my-app", "approve_refunds")
|
|
66
|
+
* // → "Magento_CommerceBackendUix::adminuisdk_app_my_app_acl_approve_refunds"
|
|
67
|
+
* getCustomAclResourceId("my-app", "reports", "export")
|
|
68
|
+
* // → "Magento_CommerceBackendUix::adminuisdk_app_my_app_acl_reports_export"
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @param metadataId - The application's `metadata.id` value.
|
|
72
|
+
* @param resourceId - The top-level resource or group `id` from `adminUi.acl`.
|
|
73
|
+
* @param childId - Optional child leaf `id` when addressing a resource inside a group.
|
|
74
|
+
* @returns The full Commerce ACL resource id, or an empty string when `metadataId` is blank.
|
|
75
|
+
*/
|
|
76
|
+
function getCustomAclResourceId(metadataId, resourceId, childId) {
|
|
77
|
+
const appRoot = getAclResourceId(metadataId);
|
|
78
|
+
if (appRoot === "") return "";
|
|
79
|
+
const base = `${appRoot}_acl_${sanitizeSegment(resourceId)}`;
|
|
80
|
+
return childId === void 0 ? base : `${base}_${sanitizeSegment(childId)}`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Commerce entities an Admin UI component can attach to, using the same spelling Commerce
|
|
84
|
+
* sends in the wire-contract `gridType` field. Credit memo grids send `"creditmemo"` on the
|
|
85
|
+
* wire — not `"creditMemo"` — even though the corresponding config key (`adminUi.creditMemo`)
|
|
86
|
+
* is camelCase.
|
|
87
|
+
*
|
|
88
|
+
* Single source of truth for the entity vocabulary: `GridTypeSchema` derives its picklist from it.
|
|
89
|
+
*/
|
|
90
|
+
const ADMIN_UI_GRID_ENTITIES = [
|
|
91
|
+
"order",
|
|
92
|
+
"product",
|
|
93
|
+
"customer",
|
|
94
|
+
"invoice",
|
|
95
|
+
"creditmemo",
|
|
96
|
+
"shipment",
|
|
97
|
+
"newsletter"
|
|
98
|
+
];
|
|
99
|
+
/**
|
|
100
|
+
* Entities that support mass actions — a subset of `ADMIN_UI_GRID_ENTITIES`. Mass actions, unlike
|
|
101
|
+
* grid columns, are not available on the invoice, credit memo, or shipment grids.
|
|
102
|
+
* `MassActionGridTypeSchema` derives its picklist from it.
|
|
103
|
+
*/
|
|
104
|
+
const MASS_ACTION_ENTITIES = [
|
|
105
|
+
"order",
|
|
106
|
+
"product",
|
|
107
|
+
"customer",
|
|
108
|
+
"newsletter"
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
export { sanitizeSegment as a, getCustomAclResourceId as i, MASS_ACTION_ENTITIES as n, getAclResourceId as r, ADMIN_UI_GRID_ENTITIES as t };
|
package/dist/es/api/index.d.mts
CHANGED
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { a as sanitizeSegment, i as getCustomAclResourceId, r as getAclResourceId, t as AdminUiEntity } from "../acl-resource-id-Bha1pOIk.mjs";
|
|
16
16
|
import { CommerceSdkErrorBase, CommerceSdkErrorOptions } from "@adobe/aio-commerce-lib-core/error";
|
|
17
17
|
import { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
18
18
|
import * as v from "valibot";
|
|
19
19
|
//#region source/errors.d.ts
|
|
20
20
|
/** Base error for Admin UI SDK permission helper failures. */
|
|
21
|
-
declare class AdminUiPermissionError extends CommerceSdkErrorBase {}
|
|
21
|
+
export declare class AdminUiPermissionError extends CommerceSdkErrorBase {}
|
|
22
22
|
/** Options for {@link AdminUiPermissionDeniedError}. */
|
|
23
|
-
type AdminUiPermissionDeniedErrorOptions = CommerceSdkErrorOptions;
|
|
23
|
+
export type AdminUiPermissionDeniedErrorOptions = CommerceSdkErrorOptions;
|
|
24
24
|
/** Error thrown when the current user is denied access to an Admin UI SDK ACL resource. */
|
|
25
|
-
declare class AdminUiPermissionDeniedError extends AdminUiPermissionError {
|
|
25
|
+
export declare class AdminUiPermissionDeniedError extends AdminUiPermissionError {
|
|
26
26
|
readonly resource: string;
|
|
27
27
|
constructor(resource: string, options?: AdminUiPermissionDeniedErrorOptions);
|
|
28
28
|
}
|
|
@@ -33,7 +33,7 @@ declare class AdminUiPermissionDeniedError extends AdminUiPermissionError {
|
|
|
33
33
|
*
|
|
34
34
|
* @param params - The parameters to build the Commerce HTTP client.
|
|
35
35
|
*/
|
|
36
|
-
declare function createAdminUiApiClient(params: CommerceHttpClientParams): import("@adobe/aio-commerce-lib-api").ApiClientRecord<AdobeCommerceHttpClient, {
|
|
36
|
+
export declare function createAdminUiApiClient(params: CommerceHttpClientParams): import("@adobe/aio-commerce-lib-api").ApiClientRecord<AdobeCommerceHttpClient, {
|
|
37
37
|
registerExtension(httpClient: AdobeCommerceHttpClient, params: ExtensionRegistrationParams, fetchOptions?: import("ky").Options): Promise<RegisterExtensionResponse>;
|
|
38
38
|
unregisterExtension(httpClient: AdobeCommerceHttpClient, params: UnregisterExtensionParams, fetchOptions?: import("ky").Options): Promise<void>;
|
|
39
39
|
refreshExtension(httpClient: AdobeCommerceHttpClient, params: RefreshExtensionParams, fetchOptions?: import("ky").Options): Promise<void>;
|
|
@@ -43,11 +43,11 @@ declare function createAdminUiApiClient(params: CommerceHttpClientParams): impor
|
|
|
43
43
|
* An API client for the Admin UI API with all operations.
|
|
44
44
|
* @see {@link createAdminUiApiClient}
|
|
45
45
|
*/
|
|
46
|
-
type AdminUiApiClient = ReturnType<typeof createAdminUiApiClient>;
|
|
46
|
+
export type AdminUiApiClient = ReturnType<typeof createAdminUiApiClient>;
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region source/api/lib/permission-client.d.ts
|
|
49
49
|
/** Options used to create an Admin UI SDK permission client. */
|
|
50
|
-
type AdminUiPermissionClientOptions = {
|
|
50
|
+
export type AdminUiPermissionClientOptions = {
|
|
51
51
|
/** The application's `metadata.id` value. When provided, `check()` and `require()` can be called with no resource argument. */
|
|
52
52
|
appId?: string;
|
|
53
53
|
/**
|
|
@@ -62,7 +62,7 @@ type AdminUiPermissionClientOptions = {
|
|
|
62
62
|
httpClient: AdobeCommerceHttpClient;
|
|
63
63
|
};
|
|
64
64
|
/** Client for checking the current user's Admin UI SDK resource permissions. */
|
|
65
|
-
type AdminUiPermissionClient = {
|
|
65
|
+
export type AdminUiPermissionClient = {
|
|
66
66
|
/**
|
|
67
67
|
* Checks whether the current user has the given ACL resource granted.
|
|
68
68
|
*
|
|
@@ -95,7 +95,7 @@ type AdminUiPermissionClient = {
|
|
|
95
95
|
* @param options - Client configuration; see {@link AdminUiPermissionClientOptions}.
|
|
96
96
|
* @returns An {@link AdminUiPermissionClient} for checking and requiring ACL resources.
|
|
97
97
|
*/
|
|
98
|
-
declare function getAdminUiPermissionClient(options: AdminUiPermissionClientOptions): AdminUiPermissionClient;
|
|
98
|
+
export declare function getAdminUiPermissionClient(options: AdminUiPermissionClientOptions): AdminUiPermissionClient;
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region source/api/extensions/schema.d.ts
|
|
101
101
|
/** Parameters for POST /V1/adminuisdk/extension. */
|
|
@@ -133,4 +133,4 @@ declare const permissionCheckResponseSchema: v.ObjectSchema<{
|
|
|
133
133
|
/** Parsed Admin UI SDK permission check response. */
|
|
134
134
|
type PermissionCheckResponse = v.InferOutput<typeof permissionCheckResponseSchema>;
|
|
135
135
|
//#endregion
|
|
136
|
-
export {
|
|
136
|
+
export { type AdminUiEntity, type ExtensionRegistrationParams, type ExtensionRegistrationParamsSchema, type PermissionCheckResponse, type RefreshExtensionParams, type RefreshExtensionParamsSchema, type RegisterExtensionResponse, type UnregisterExtensionParams, type UnregisterExtensionParamsSchema, getAclResourceId, getCustomAclResourceId, type permissionCheckResponseSchema, sanitizeSegment };
|
package/dist/es/api/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { a as sanitizeSegment, i as getCustomAclResourceId, r as getAclResourceId } from "../acl-resource-id-CHw95qd2.mjs";
|
|
16
16
|
import { t as parseOrThrow } from "../utils-COPGW1HO.mjs";
|
|
17
17
|
import { CommerceSdkErrorBase } from "@adobe/aio-commerce-lib-core/error";
|
|
18
18
|
import { AdobeCommerceHttpClient, ApiClient } from "@adobe/aio-commerce-lib-api";
|
|
@@ -284,4 +284,4 @@ function getAdminUiPermissionClient(options) {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
//#endregion
|
|
287
|
-
export { AdminUiPermissionDeniedError, AdminUiPermissionError, createAdminUiApiClient, getAclResourceId, getAdminUiPermissionClient };
|
|
287
|
+
export { AdminUiPermissionDeniedError, AdminUiPermissionError, createAdminUiApiClient, getAclResourceId, getAdminUiPermissionClient, getCustomAclResourceId, sanitizeSegment };
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { t as AdminUiEntity } from "../acl-resource-id-
|
|
15
|
+
import { t as AdminUiEntity } from "../acl-resource-id-Bha1pOIk.mjs";
|
|
16
16
|
import * as v from "valibot";
|
|
17
17
|
import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
|
|
18
18
|
//#region source/grid-columns/acl-resource-id.d.ts
|
|
@@ -34,20 +34,24 @@ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/res
|
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
36
|
* @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
|
|
37
|
-
* @param entity - The grid's Commerce entity (`"order"`, `"product"`,
|
|
37
|
+
* @param entity - The grid's Commerce entity (`"order"`, `"product"`, `"customer"`, `"invoice"`,
|
|
38
|
+
* `"creditmemo"`, `"shipment"`, or `"newsletter"`).
|
|
38
39
|
* @param columnId - The column's `id` value from `adminUi.<entity>.gridColumns.columns[].id`.
|
|
39
40
|
* @returns The full Commerce ACL resource id for the grid-column leaf node, or an empty string
|
|
40
41
|
* when `metadataId` is blank.
|
|
41
42
|
*/
|
|
42
|
-
declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiEntity, columnId: string): string;
|
|
43
|
+
export declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiEntity, columnId: string): string;
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region source/grid-columns/requests/schema.d.ts
|
|
45
46
|
/**
|
|
46
47
|
* Grid identifier sent by Commerce on the `commerce/backend-ui/2` wire contract.
|
|
47
48
|
*
|
|
49
|
+
* Credit memo grids send `"creditmemo"` — not `"creditMemo"` — even though the corresponding
|
|
50
|
+
* config key (`adminUi.creditMemo`) is camelCase; see the Commerce module's `CustomColumn::GRID_MAP`.
|
|
51
|
+
*
|
|
48
52
|
* @see {@link https://github.com/magento-commerce/adobe-commerce-backend-uix Magento module reference}
|
|
49
53
|
*/
|
|
50
|
-
declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
54
|
+
export declare const GridTypeSchema: v.PicklistSchema<readonly ["order", "product", "customer", "invoice", "creditmemo", "shipment", "newsletter"], undefined>;
|
|
51
55
|
/**
|
|
52
56
|
* Schema for the JSON body Commerce POSTs to a grid column handler.
|
|
53
57
|
*
|
|
@@ -55,8 +59,8 @@ declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"],
|
|
|
55
59
|
* per request). The upper bound is the Commerce side's contract and is not
|
|
56
60
|
* enforced here.
|
|
57
61
|
*/
|
|
58
|
-
declare const GridRequestSchema: v.ObjectSchema<{
|
|
59
|
-
readonly gridType: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
62
|
+
export declare const GridRequestSchema: v.ObjectSchema<{
|
|
63
|
+
readonly gridType: v.PicklistSchema<readonly ["order", "product", "customer", "invoice", "creditmemo", "shipment", "newsletter"], undefined>;
|
|
60
64
|
readonly ids: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, undefined>, v.MinLengthAction<string[], 1, "The value of \"ids\" must contain at least one entry">]>;
|
|
61
65
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
62
66
|
}, undefined>;
|
|
@@ -83,7 +87,7 @@ type GridRequest = v.InferOutput<typeof GridRequestSchema>;
|
|
|
83
87
|
* }
|
|
84
88
|
* ```
|
|
85
89
|
*/
|
|
86
|
-
declare function parseGridRequest(input: unknown): GridRequest;
|
|
90
|
+
export declare function parseGridRequest(input: unknown): GridRequest;
|
|
87
91
|
//#endregion
|
|
88
92
|
//#region source/grid-columns/responses/types.d.ts
|
|
89
93
|
/** Cell values returned for a single row, keyed by `id`. */
|
|
@@ -126,7 +130,7 @@ type GridErrorBody = {
|
|
|
126
130
|
* );
|
|
127
131
|
* ```
|
|
128
132
|
*/
|
|
129
|
-
declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRow): SuccessResponse<GridSuccessBody>;
|
|
133
|
+
export declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRow): SuccessResponse<GridSuccessBody>;
|
|
130
134
|
/**
|
|
131
135
|
* Builds an error response for a grid column handler with the given HTTP status code.
|
|
132
136
|
*
|
|
@@ -140,6 +144,6 @@ declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRo
|
|
|
140
144
|
* return errorGridResponse(500, "Could not reach inventory service");
|
|
141
145
|
* ```
|
|
142
146
|
*/
|
|
143
|
-
declare function errorGridResponse(statusCode: number, errorMessage: string): ErrorResponse<GridErrorBody>;
|
|
147
|
+
export declare function errorGridResponse(statusCode: number, errorMessage: string): ErrorResponse<GridErrorBody>;
|
|
144
148
|
//#endregion
|
|
145
|
-
export {
|
|
149
|
+
export type { AdminUiEntity, GridErrorBody, GridRequest, GridRow, GridSuccessBody, GridType };
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { a as sanitizeSegment, r as getAclResourceId, t as ADMIN_UI_GRID_ENTITIES } from "../acl-resource-id-CHw95qd2.mjs";
|
|
16
16
|
import { t as nonEmptyStringValueSchema } from "../schemas-BFT8ys8P.mjs";
|
|
17
17
|
import { t as parseOrThrow } from "../utils-COPGW1HO.mjs";
|
|
18
18
|
import * as v from "valibot";
|
|
@@ -37,7 +37,8 @@ import { buildErrorResponse, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
39
|
* @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
|
|
40
|
-
* @param entity - The grid's Commerce entity (`"order"`, `"product"`,
|
|
40
|
+
* @param entity - The grid's Commerce entity (`"order"`, `"product"`, `"customer"`, `"invoice"`,
|
|
41
|
+
* `"creditmemo"`, `"shipment"`, or `"newsletter"`).
|
|
41
42
|
* @param columnId - The column's `id` value from `adminUi.<entity>.gridColumns.columns[].id`.
|
|
42
43
|
* @returns The full Commerce ACL resource id for the grid-column leaf node, or an empty string
|
|
43
44
|
* when `metadataId` is blank.
|
|
@@ -53,13 +54,12 @@ function getGridColumnAclResourceId(metadataId, entity, columnId) {
|
|
|
53
54
|
/**
|
|
54
55
|
* Grid identifier sent by Commerce on the `commerce/backend-ui/2` wire contract.
|
|
55
56
|
*
|
|
57
|
+
* Credit memo grids send `"creditmemo"` — not `"creditMemo"` — even though the corresponding
|
|
58
|
+
* config key (`adminUi.creditMemo`) is camelCase; see the Commerce module's `CustomColumn::GRID_MAP`.
|
|
59
|
+
*
|
|
56
60
|
* @see {@link https://github.com/magento-commerce/adobe-commerce-backend-uix Magento module reference}
|
|
57
61
|
*/
|
|
58
|
-
const GridTypeSchema = v.picklist(
|
|
59
|
-
"order",
|
|
60
|
-
"product",
|
|
61
|
-
"customer"
|
|
62
|
-
]);
|
|
62
|
+
const GridTypeSchema = v.picklist(ADMIN_UI_GRID_ENTITIES);
|
|
63
63
|
/**
|
|
64
64
|
* Schema for the JSON body Commerce POSTs to a grid column handler.
|
|
65
65
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { t as AdminUiEntity } from "../acl-resource-id-
|
|
15
|
+
import { n as MassActionEntity, t as AdminUiEntity } from "../acl-resource-id-Bha1pOIk.mjs";
|
|
16
16
|
import * as v from "valibot";
|
|
17
17
|
import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
|
|
18
18
|
//#region source/mass-actions/acl-resource-id.d.ts
|
|
@@ -34,19 +34,19 @@ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/res
|
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
36
|
* @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
|
|
37
|
-
* @param entity - The grid's Commerce entity (`"order"`, `"product"`, or `"
|
|
37
|
+
* @param entity - The grid's Commerce entity (`"order"`, `"product"`, `"customer"`, or `"newsletter"`).
|
|
38
38
|
* @param actionId - The action's `id` value from `adminUi.<entity>.massActions[].id`.
|
|
39
39
|
* @returns The full Commerce ACL resource id for the mass-action leaf node, or an empty string
|
|
40
40
|
* when `metadataId` is blank.
|
|
41
41
|
*/
|
|
42
|
-
declare function getMassActionAclResourceId(metadataId: string, entity:
|
|
42
|
+
export declare function getMassActionAclResourceId(metadataId: string, entity: MassActionEntity, actionId: string): string;
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region source/mass-actions/worker/schema.d.ts
|
|
45
45
|
/**
|
|
46
46
|
* Grid identifier sent by Commerce on the `commerce/backend-ui/2` wire contract
|
|
47
47
|
* for worker mass actions.
|
|
48
48
|
*/
|
|
49
|
-
declare const MassActionGridTypeSchema: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
49
|
+
export declare const MassActionGridTypeSchema: v.PicklistSchema<readonly ["order", "product", "customer", "newsletter"], undefined>;
|
|
50
50
|
/**
|
|
51
51
|
* Schema for the JSON body Commerce POSTs to a worker mass action handler.
|
|
52
52
|
*
|
|
@@ -54,8 +54,8 @@ declare const MassActionGridTypeSchema: v.PicklistSchema<["order", "product", "c
|
|
|
54
54
|
* IDs per request). The upper bound is the Commerce side's contract and is not
|
|
55
55
|
* enforced here.
|
|
56
56
|
*/
|
|
57
|
-
declare const MassActionRequestSchema: v.ObjectSchema<{
|
|
58
|
-
readonly gridType: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
57
|
+
export declare const MassActionRequestSchema: v.ObjectSchema<{
|
|
58
|
+
readonly gridType: v.PicklistSchema<readonly ["order", "product", "customer", "newsletter"], undefined>;
|
|
59
59
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
60
60
|
readonly selectedIds: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, undefined>, v.MinLengthAction<string[], 1, "The value of \"selectedIds\" must contain at least one entry">]>;
|
|
61
61
|
}, undefined>;
|
|
@@ -88,7 +88,7 @@ type MassActionErrorBody = {
|
|
|
88
88
|
* }
|
|
89
89
|
* ```
|
|
90
90
|
*/
|
|
91
|
-
declare function parseMassActionRequest(input: unknown): MassActionRequest;
|
|
91
|
+
export declare function parseMassActionRequest(input: unknown): MassActionRequest;
|
|
92
92
|
/**
|
|
93
93
|
* Builds an HTTP 200 success response for a worker mass action.
|
|
94
94
|
*
|
|
@@ -101,7 +101,7 @@ declare function parseMassActionRequest(input: unknown): MassActionRequest;
|
|
|
101
101
|
* return okMassActionResponse({ exported: selectedIds.length });
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
|
-
declare function okMassActionResponse(body?: MassActionResponseBody): SuccessResponse<MassActionResponseBody>;
|
|
104
|
+
export declare function okMassActionResponse(body?: MassActionResponseBody): SuccessResponse<MassActionResponseBody>;
|
|
105
105
|
/**
|
|
106
106
|
* Builds an error response for a worker mass action with the given HTTP status code.
|
|
107
107
|
*
|
|
@@ -113,6 +113,6 @@ declare function okMassActionResponse(body?: MassActionResponseBody): SuccessRes
|
|
|
113
113
|
* return massActionErrorResponse(422, "Request entity is unprocessable");
|
|
114
114
|
* ```
|
|
115
115
|
*/
|
|
116
|
-
declare function massActionErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<MassActionErrorBody>;
|
|
116
|
+
export declare function massActionErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<MassActionErrorBody>;
|
|
117
117
|
//#endregion
|
|
118
|
-
export {
|
|
118
|
+
export type { AdminUiEntity, MassActionEntity, MassActionErrorBody, MassActionGridType, MassActionRequest, MassActionResponseBody };
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { a as sanitizeSegment, n as MASS_ACTION_ENTITIES, r as getAclResourceId } from "../acl-resource-id-CHw95qd2.mjs";
|
|
16
16
|
import { t as nonEmptyStringValueSchema } from "../schemas-BFT8ys8P.mjs";
|
|
17
17
|
import { t as parseOrThrow } from "../utils-COPGW1HO.mjs";
|
|
18
18
|
import * as v from "valibot";
|
|
@@ -37,7 +37,7 @@ import { buildErrorResponse, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
39
|
* @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
|
|
40
|
-
* @param entity - The grid's Commerce entity (`"order"`, `"product"`, or `"
|
|
40
|
+
* @param entity - The grid's Commerce entity (`"order"`, `"product"`, `"customer"`, or `"newsletter"`).
|
|
41
41
|
* @param actionId - The action's `id` value from `adminUi.<entity>.massActions[].id`.
|
|
42
42
|
* @returns The full Commerce ACL resource id for the mass-action leaf node, or an empty string
|
|
43
43
|
* when `metadataId` is blank.
|
|
@@ -54,11 +54,7 @@ function getMassActionAclResourceId(metadataId, entity, actionId) {
|
|
|
54
54
|
* Grid identifier sent by Commerce on the `commerce/backend-ui/2` wire contract
|
|
55
55
|
* for worker mass actions.
|
|
56
56
|
*/
|
|
57
|
-
const MassActionGridTypeSchema = v.picklist(
|
|
58
|
-
"order",
|
|
59
|
-
"product",
|
|
60
|
-
"customer"
|
|
61
|
-
]);
|
|
57
|
+
const MassActionGridTypeSchema = v.picklist(MASS_ACTION_ENTITIES);
|
|
62
58
|
/**
|
|
63
59
|
* Schema for the JSON body Commerce POSTs to a worker mass action handler.
|
|
64
60
|
*
|