@adobe/aio-commerce-lib-admin-ui 1.1.0-beta-20260820174436 → 1.1.0
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 +10 -1
- package/dist/cjs/{acl-resource-id-DBlYU0DE.d.cts → acl-resource-id-B1UPaYNV.d.cts} +30 -1
- package/dist/cjs/{acl-resource-id-R52pR3gG.cjs → acl-resource-id-BHCq3fxA.cjs} +36 -3
- package/dist/cjs/api/index.cjs +4 -2
- package/dist/cjs/api/index.d.cts +10 -10
- package/dist/cjs/grid-columns/index.cjs +1 -1
- package/dist/cjs/grid-columns/index.d.cts +8 -8
- package/dist/cjs/mass-actions/index.cjs +1 -1
- package/dist/cjs/mass-actions/index.d.cts +8 -8
- 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-DBlYU0DE.d.mts → acl-resource-id-B1UPaYNV.d.mts} +30 -1
- package/dist/es/{acl-resource-id-pryVxI_c.mjs → acl-resource-id-CIxfW36q.mjs} +31 -4
- 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 +8 -8
- package/dist/es/grid-columns/index.mjs +1 -1
- package/dist/es/mass-actions/index.d.mts +8 -8
- package/dist/es/mass-actions/index.mjs +1 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-admin-ui
|
|
2
2
|
|
|
3
|
-
## 1.1.0
|
|
3
|
+
## 1.1.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- [#626](https://github.com/adobe/aio-commerce-sdk/pull/626) [`f012ae0`](https://github.com/adobe/aio-commerce-sdk/commit/f012ae0d8eaac5cac314a62de3902fca842bd936) Thanks [@vinayrao2000](https://github.com/vinayrao2000)! - Add a `refreshExtension` client operation that re-syncs an Admin UI extension's registrations via the dedicated refresh endpoint, with its `RefreshExtensionParams` type and schema.
|
|
8
8
|
|
|
9
|
+
- [#653](https://github.com/adobe/aio-commerce-sdk/pull/653) [`c04983d`](https://github.com/adobe/aio-commerce-sdk/commit/c04983dfe04926094ab810c070598d5609004a61) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Export `sanitizeSegment`, which normalizes an id the same way Commerce does when generating ACL resource ids.
|
|
10
|
+
|
|
11
|
+
- [#653](https://github.com/adobe/aio-commerce-sdk/pull/653) [`c04983d`](https://github.com/adobe/aio-commerce-sdk/commit/c04983dfe04926094ab810c070598d5609004a61) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Add `getCustomAclResourceId` to derive the deterministic Commerce ACL resource id for a custom `adminUi.acl` resource, checkable at runtime with the permission client.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`1837df1`](https://github.com/adobe/aio-commerce-sdk/commit/1837df107bd2b8d2211f77438a07b6e7ee0af03e)]:
|
|
16
|
+
- @adobe/aio-commerce-lib-api@1.4.0
|
|
17
|
+
|
|
9
18
|
## 1.0.1
|
|
10
19
|
|
|
11
20
|
### Patch Changes
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
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;
|
|
16
23
|
/**
|
|
17
24
|
* Derives the deterministic Commerce ACL resource id for an app from its metadata id.
|
|
18
25
|
*
|
|
@@ -33,7 +40,29 @@
|
|
|
33
40
|
* @returns The full Commerce ACL resource id, or an empty string when `metadataId` is blank.
|
|
34
41
|
*/
|
|
35
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;
|
|
36
65
|
/** Commerce entity an Admin UI component is attached to. */
|
|
37
66
|
type AdminUiEntity = "order" | "product" | "customer";
|
|
38
67
|
//#endregion
|
|
39
|
-
export { getAclResourceId as n, AdminUiEntity as t };
|
|
68
|
+
export { sanitizeSegment as i, getAclResourceId as n, getCustomAclResourceId as r, AdminUiEntity as t };
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
const PREFIX = "Magento_CommerceBackendUix::adminuisdk_app_";
|
|
23
23
|
/**
|
|
24
24
|
* Sanitizes a single ACL id segment: trims whitespace, lowercases, and replaces every
|
|
25
|
-
* character outside [a-z0-9_] with an underscore.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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
28
|
*/
|
|
29
29
|
function sanitizeSegment(segment) {
|
|
30
30
|
return segment.trim().toLowerCase().replace(/[^a-z0-9_]/g, "_");
|
|
@@ -52,6 +52,33 @@ function getAclResourceId(metadataId) {
|
|
|
52
52
|
if (metadataId.trim() === "") return "";
|
|
53
53
|
return `${PREFIX}${sanitizeSegment(metadataId)}`;
|
|
54
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
|
+
}
|
|
55
82
|
|
|
56
83
|
//#endregion
|
|
57
84
|
Object.defineProperty(exports, 'getAclResourceId', {
|
|
@@ -60,6 +87,12 @@ Object.defineProperty(exports, 'getAclResourceId', {
|
|
|
60
87
|
return getAclResourceId;
|
|
61
88
|
}
|
|
62
89
|
});
|
|
90
|
+
Object.defineProperty(exports, 'getCustomAclResourceId', {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return getCustomAclResourceId;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
63
96
|
Object.defineProperty(exports, 'sanitizeSegment', {
|
|
64
97
|
enumerable: true,
|
|
65
98
|
get: function () {
|
package/dist/cjs/api/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require('../rolldown-runtime-Bf2WWRga.cjs');
|
|
17
|
-
const require_acl_resource_id = require('../acl-resource-id-
|
|
17
|
+
const require_acl_resource_id = require('../acl-resource-id-BHCq3fxA.cjs');
|
|
18
18
|
const require_utils = require('../utils-CiBhSMw4.cjs');
|
|
19
19
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
20
20
|
let _adobe_aio_commerce_lib_api = require("@adobe/aio-commerce-lib-api");
|
|
@@ -274,4 +274,6 @@ exports.AdminUiPermissionDeniedError = AdminUiPermissionDeniedError;
|
|
|
274
274
|
exports.AdminUiPermissionError = AdminUiPermissionError;
|
|
275
275
|
exports.createAdminUiApiClient = createAdminUiApiClient;
|
|
276
276
|
exports.getAclResourceId = require_acl_resource_id.getAclResourceId;
|
|
277
|
-
exports.getAdminUiPermissionClient = getAdminUiPermissionClient;
|
|
277
|
+
exports.getAdminUiPermissionClient = getAdminUiPermissionClient;
|
|
278
|
+
exports.getCustomAclResourceId = require_acl_resource_id.getCustomAclResourceId;
|
|
279
|
+
exports.sanitizeSegment = require_acl_resource_id.sanitizeSegment;
|
package/dist/cjs/api/index.d.cts
CHANGED
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as getAclResourceId, t as AdminUiEntity } from "../acl-resource-id-
|
|
15
|
+
import { i as sanitizeSegment, n as getAclResourceId, r as getCustomAclResourceId, t as AdminUiEntity } from "../acl-resource-id-B1UPaYNV.cjs";
|
|
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 };
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require('../rolldown-runtime-Bf2WWRga.cjs');
|
|
17
|
-
const require_acl_resource_id = require('../acl-resource-id-
|
|
17
|
+
const require_acl_resource_id = require('../acl-resource-id-BHCq3fxA.cjs');
|
|
18
18
|
const require_schemas = require('../schemas-DRhCF0TF.cjs');
|
|
19
19
|
const require_utils = require('../utils-CiBhSMw4.cjs');
|
|
20
20
|
let valibot = require("valibot");
|
|
@@ -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-B1UPaYNV.cjs";
|
|
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
|
|
@@ -39,7 +39,7 @@ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/res
|
|
|
39
39
|
* @returns The full Commerce ACL resource id for the grid-column leaf node, or an empty string
|
|
40
40
|
* when `metadataId` is blank.
|
|
41
41
|
*/
|
|
42
|
-
declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiEntity, columnId: string): string;
|
|
42
|
+
export declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiEntity, columnId: string): string;
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region source/grid-columns/requests/schema.d.ts
|
|
45
45
|
/**
|
|
@@ -47,7 +47,7 @@ declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiE
|
|
|
47
47
|
*
|
|
48
48
|
* @see {@link https://github.com/magento-commerce/adobe-commerce-backend-uix Magento module reference}
|
|
49
49
|
*/
|
|
50
|
-
declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
50
|
+
export declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
51
51
|
/**
|
|
52
52
|
* Schema for the JSON body Commerce POSTs to a grid column handler.
|
|
53
53
|
*
|
|
@@ -55,7 +55,7 @@ declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"],
|
|
|
55
55
|
* per request). The upper bound is the Commerce side's contract and is not
|
|
56
56
|
* enforced here.
|
|
57
57
|
*/
|
|
58
|
-
declare const GridRequestSchema: v.ObjectSchema<{
|
|
58
|
+
export declare const GridRequestSchema: v.ObjectSchema<{
|
|
59
59
|
readonly gridType: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
60
60
|
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
61
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
@@ -83,7 +83,7 @@ type GridRequest = v.InferOutput<typeof GridRequestSchema>;
|
|
|
83
83
|
* }
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
declare function parseGridRequest(input: unknown): GridRequest;
|
|
86
|
+
export declare function parseGridRequest(input: unknown): GridRequest;
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region source/grid-columns/responses/types.d.ts
|
|
89
89
|
/** Cell values returned for a single row, keyed by `id`. */
|
|
@@ -126,7 +126,7 @@ type GridErrorBody = {
|
|
|
126
126
|
* );
|
|
127
127
|
* ```
|
|
128
128
|
*/
|
|
129
|
-
declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRow): SuccessResponse<GridSuccessBody>;
|
|
129
|
+
export declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRow): SuccessResponse<GridSuccessBody>;
|
|
130
130
|
/**
|
|
131
131
|
* Builds an error response for a grid column handler with the given HTTP status code.
|
|
132
132
|
*
|
|
@@ -140,6 +140,6 @@ declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRo
|
|
|
140
140
|
* return errorGridResponse(500, "Could not reach inventory service");
|
|
141
141
|
* ```
|
|
142
142
|
*/
|
|
143
|
-
declare function errorGridResponse(statusCode: number, errorMessage: string): ErrorResponse<GridErrorBody>;
|
|
143
|
+
export declare function errorGridResponse(statusCode: number, errorMessage: string): ErrorResponse<GridErrorBody>;
|
|
144
144
|
//#endregion
|
|
145
|
-
export {
|
|
145
|
+
export type { AdminUiEntity, GridErrorBody, GridRequest, GridRow, GridSuccessBody, GridType };
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require('../rolldown-runtime-Bf2WWRga.cjs');
|
|
17
|
-
const require_acl_resource_id = require('../acl-resource-id-
|
|
17
|
+
const require_acl_resource_id = require('../acl-resource-id-BHCq3fxA.cjs');
|
|
18
18
|
const require_schemas = require('../schemas-DRhCF0TF.cjs');
|
|
19
19
|
const require_utils = require('../utils-CiBhSMw4.cjs');
|
|
20
20
|
let valibot = require("valibot");
|
|
@@ -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-B1UPaYNV.cjs";
|
|
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
|
|
@@ -39,14 +39,14 @@ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/res
|
|
|
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: AdminUiEntity, actionId: string): string;
|
|
42
|
+
export declare function getMassActionAclResourceId(metadataId: string, entity: AdminUiEntity, 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<["order", "product", "customer"], undefined>;
|
|
50
50
|
/**
|
|
51
51
|
* Schema for the JSON body Commerce POSTs to a worker mass action handler.
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@ 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<{
|
|
57
|
+
export declare const MassActionRequestSchema: v.ObjectSchema<{
|
|
58
58
|
readonly gridType: v.PicklistSchema<["order", "product", "customer"], 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">]>;
|
|
@@ -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, MassActionErrorBody, MassActionGridType, MassActionRequest, MassActionResponseBody };
|
package/dist/cjs/menu/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_acl_resource_id = require('../acl-resource-id-
|
|
16
|
+
const require_acl_resource_id = require('../acl-resource-id-BHCq3fxA.cjs');
|
|
17
17
|
|
|
18
18
|
//#region source/menu/acl-resource-id.ts
|
|
19
19
|
/**
|
|
@@ -34,30 +34,29 @@
|
|
|
34
34
|
* @returns The full Commerce ACL resource id for the menu leaf node, or an empty string
|
|
35
35
|
* when `metadataId` is blank.
|
|
36
36
|
*/
|
|
37
|
-
declare function getMenuAclResourceId(metadataId: string, menuId: string): string;
|
|
37
|
+
export declare function getMenuAclResourceId(metadataId: string, menuId: string): string;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region source/menu/paths.d.ts
|
|
40
40
|
/** Menu ID for "Catalog" in the Adobe Commerce admin */
|
|
41
|
-
declare const MENU_CATALOG = "catalog";
|
|
41
|
+
export declare const MENU_CATALOG = "catalog";
|
|
42
42
|
/** Menu ID for "Customers" in the Adobe Commerce admin */
|
|
43
|
-
declare const MENU_CUSTOMERS = "customers";
|
|
43
|
+
export declare const MENU_CUSTOMERS = "customers";
|
|
44
44
|
/** Menu ID for "Marketing" in the Adobe Commerce admin */
|
|
45
|
-
declare const MENU_MARKETING = "marketing";
|
|
45
|
+
export declare const MENU_MARKETING = "marketing";
|
|
46
46
|
/** Menu ID for "Content" in the Adobe Commerce admin */
|
|
47
|
-
declare const MENU_CONTENT = "content";
|
|
47
|
+
export declare const MENU_CONTENT = "content";
|
|
48
48
|
/** Menu ID for "Reports" in the Adobe Commerce admin */
|
|
49
|
-
declare const MENU_REPORTS = "reports";
|
|
49
|
+
export declare const MENU_REPORTS = "reports";
|
|
50
50
|
/** Menu ID for "Sales" in the Adobe Commerce admin */
|
|
51
|
-
declare const MENU_SALES = "sales";
|
|
51
|
+
export declare const MENU_SALES = "sales";
|
|
52
52
|
/** Menu ID for "Stores" in the Adobe Commerce admin */
|
|
53
|
-
declare const MENU_STORES = "stores";
|
|
53
|
+
export declare const MENU_STORES = "stores";
|
|
54
54
|
/** Menu ID for "System" in the Adobe Commerce admin */
|
|
55
|
-
declare const MENU_SYSTEM = "system";
|
|
55
|
+
export declare const MENU_SYSTEM = "system";
|
|
56
56
|
/** All Commerce Admin menus available for app attachment. */
|
|
57
|
-
declare const COMMERCE_MENUS: readonly ["sales", "catalog", "customers", "marketing", "content", "reports", "stores", "system"];
|
|
57
|
+
export declare const COMMERCE_MENUS: readonly ["sales", "catalog", "customers", "marketing", "content", "reports", "stores", "system"];
|
|
58
58
|
/** A union type of all known supported Commerce Admin menu IDs. */
|
|
59
|
-
type CommerceMenu = (typeof COMMERCE_MENUS)[number];
|
|
59
|
+
export type CommerceMenu = (typeof COMMERCE_MENUS)[number];
|
|
60
60
|
/** Returns true if the given string is a known Commerce Admin menu ID. */
|
|
61
|
-
declare function isCommerceMenu(menu: string): menu is CommerceMenu;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { COMMERCE_MENUS, CommerceMenu, MENU_CATALOG, MENU_CONTENT, MENU_CUSTOMERS, MENU_MARKETING, MENU_REPORTS, MENU_SALES, MENU_STORES, MENU_SYSTEM, getMenuAclResourceId, isCommerceMenu };
|
|
61
|
+
export declare function isCommerceMenu(menu: string): menu is CommerceMenu;
|
|
62
|
+
//#endregion
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require('../rolldown-runtime-Bf2WWRga.cjs');
|
|
17
|
-
const require_acl_resource_id = require('../acl-resource-id-
|
|
17
|
+
const require_acl_resource_id = require('../acl-resource-id-BHCq3fxA.cjs');
|
|
18
18
|
const require_schemas = require('../schemas-DRhCF0TF.cjs');
|
|
19
19
|
const require_utils = require('../utils-CiBhSMw4.cjs');
|
|
20
20
|
let valibot = require("valibot");
|
|
@@ -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 };
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
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;
|
|
16
23
|
/**
|
|
17
24
|
* Derives the deterministic Commerce ACL resource id for an app from its metadata id.
|
|
18
25
|
*
|
|
@@ -33,7 +40,29 @@
|
|
|
33
40
|
* @returns The full Commerce ACL resource id, or an empty string when `metadataId` is blank.
|
|
34
41
|
*/
|
|
35
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;
|
|
36
65
|
/** Commerce entity an Admin UI component is attached to. */
|
|
37
66
|
type AdminUiEntity = "order" | "product" | "customer";
|
|
38
67
|
//#endregion
|
|
39
|
-
export { getAclResourceId as n, AdminUiEntity as t };
|
|
68
|
+
export { sanitizeSegment as i, getAclResourceId as n, getCustomAclResourceId as r, AdminUiEntity as t };
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
const PREFIX = "Magento_CommerceBackendUix::adminuisdk_app_";
|
|
23
23
|
/**
|
|
24
24
|
* Sanitizes a single ACL id segment: trims whitespace, lowercases, and replaces every
|
|
25
|
-
* character outside [a-z0-9_] with an underscore.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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
28
|
*/
|
|
29
29
|
function sanitizeSegment(segment) {
|
|
30
30
|
return segment.trim().toLowerCase().replace(/[^a-z0-9_]/g, "_");
|
|
@@ -52,6 +52,33 @@ function getAclResourceId(metadataId) {
|
|
|
52
52
|
if (metadataId.trim() === "") return "";
|
|
53
53
|
return `${PREFIX}${sanitizeSegment(metadataId)}`;
|
|
54
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
|
+
}
|
|
55
82
|
|
|
56
83
|
//#endregion
|
|
57
|
-
export {
|
|
84
|
+
export { getCustomAclResourceId as n, sanitizeSegment as r, getAclResourceId 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 { n as getAclResourceId, t as AdminUiEntity } from "../acl-resource-id-
|
|
15
|
+
import { i as sanitizeSegment, n as getAclResourceId, r as getCustomAclResourceId, t as AdminUiEntity } from "../acl-resource-id-B1UPaYNV.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 { t as getAclResourceId } from "../acl-resource-id-
|
|
15
|
+
import { n as getCustomAclResourceId, r as sanitizeSegment, t as getAclResourceId } from "../acl-resource-id-CIxfW36q.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-B1UPaYNV.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
|
|
@@ -39,7 +39,7 @@ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/res
|
|
|
39
39
|
* @returns The full Commerce ACL resource id for the grid-column leaf node, or an empty string
|
|
40
40
|
* when `metadataId` is blank.
|
|
41
41
|
*/
|
|
42
|
-
declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiEntity, columnId: string): string;
|
|
42
|
+
export declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiEntity, columnId: string): string;
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region source/grid-columns/requests/schema.d.ts
|
|
45
45
|
/**
|
|
@@ -47,7 +47,7 @@ declare function getGridColumnAclResourceId(metadataId: string, entity: AdminUiE
|
|
|
47
47
|
*
|
|
48
48
|
* @see {@link https://github.com/magento-commerce/adobe-commerce-backend-uix Magento module reference}
|
|
49
49
|
*/
|
|
50
|
-
declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
50
|
+
export declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
51
51
|
/**
|
|
52
52
|
* Schema for the JSON body Commerce POSTs to a grid column handler.
|
|
53
53
|
*
|
|
@@ -55,7 +55,7 @@ declare const GridTypeSchema: v.PicklistSchema<["order", "product", "customer"],
|
|
|
55
55
|
* per request). The upper bound is the Commerce side's contract and is not
|
|
56
56
|
* enforced here.
|
|
57
57
|
*/
|
|
58
|
-
declare const GridRequestSchema: v.ObjectSchema<{
|
|
58
|
+
export declare const GridRequestSchema: v.ObjectSchema<{
|
|
59
59
|
readonly gridType: v.PicklistSchema<["order", "product", "customer"], undefined>;
|
|
60
60
|
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
61
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
@@ -83,7 +83,7 @@ type GridRequest = v.InferOutput<typeof GridRequestSchema>;
|
|
|
83
83
|
* }
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
declare function parseGridRequest(input: unknown): GridRequest;
|
|
86
|
+
export declare function parseGridRequest(input: unknown): GridRequest;
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region source/grid-columns/responses/types.d.ts
|
|
89
89
|
/** Cell values returned for a single row, keyed by `id`. */
|
|
@@ -126,7 +126,7 @@ type GridErrorBody = {
|
|
|
126
126
|
* );
|
|
127
127
|
* ```
|
|
128
128
|
*/
|
|
129
|
-
declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRow): SuccessResponse<GridSuccessBody>;
|
|
129
|
+
export declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRow): SuccessResponse<GridSuccessBody>;
|
|
130
130
|
/**
|
|
131
131
|
* Builds an error response for a grid column handler with the given HTTP status code.
|
|
132
132
|
*
|
|
@@ -140,6 +140,6 @@ declare function okGridResponse(data: Record<string, GridRow>, defaults?: GridRo
|
|
|
140
140
|
* return errorGridResponse(500, "Could not reach inventory service");
|
|
141
141
|
* ```
|
|
142
142
|
*/
|
|
143
|
-
declare function errorGridResponse(statusCode: number, errorMessage: string): ErrorResponse<GridErrorBody>;
|
|
143
|
+
export declare function errorGridResponse(statusCode: number, errorMessage: string): ErrorResponse<GridErrorBody>;
|
|
144
144
|
//#endregion
|
|
145
|
-
export {
|
|
145
|
+
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 { r as sanitizeSegment, t as getAclResourceId } from "../acl-resource-id-CIxfW36q.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";
|
|
@@ -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-B1UPaYNV.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
|
|
@@ -39,14 +39,14 @@ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/res
|
|
|
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: AdminUiEntity, actionId: string): string;
|
|
42
|
+
export declare function getMassActionAclResourceId(metadataId: string, entity: AdminUiEntity, 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<["order", "product", "customer"], undefined>;
|
|
50
50
|
/**
|
|
51
51
|
* Schema for the JSON body Commerce POSTs to a worker mass action handler.
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@ 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<{
|
|
57
|
+
export declare const MassActionRequestSchema: v.ObjectSchema<{
|
|
58
58
|
readonly gridType: v.PicklistSchema<["order", "product", "customer"], 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">]>;
|
|
@@ -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, 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 { r as sanitizeSegment, t as getAclResourceId } from "../acl-resource-id-CIxfW36q.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";
|
package/dist/es/menu/index.d.mts
CHANGED
|
@@ -34,30 +34,29 @@
|
|
|
34
34
|
* @returns The full Commerce ACL resource id for the menu leaf node, or an empty string
|
|
35
35
|
* when `metadataId` is blank.
|
|
36
36
|
*/
|
|
37
|
-
declare function getMenuAclResourceId(metadataId: string, menuId: string): string;
|
|
37
|
+
export declare function getMenuAclResourceId(metadataId: string, menuId: string): string;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region source/menu/paths.d.ts
|
|
40
40
|
/** Menu ID for "Catalog" in the Adobe Commerce admin */
|
|
41
|
-
declare const MENU_CATALOG = "catalog";
|
|
41
|
+
export declare const MENU_CATALOG = "catalog";
|
|
42
42
|
/** Menu ID for "Customers" in the Adobe Commerce admin */
|
|
43
|
-
declare const MENU_CUSTOMERS = "customers";
|
|
43
|
+
export declare const MENU_CUSTOMERS = "customers";
|
|
44
44
|
/** Menu ID for "Marketing" in the Adobe Commerce admin */
|
|
45
|
-
declare const MENU_MARKETING = "marketing";
|
|
45
|
+
export declare const MENU_MARKETING = "marketing";
|
|
46
46
|
/** Menu ID for "Content" in the Adobe Commerce admin */
|
|
47
|
-
declare const MENU_CONTENT = "content";
|
|
47
|
+
export declare const MENU_CONTENT = "content";
|
|
48
48
|
/** Menu ID for "Reports" in the Adobe Commerce admin */
|
|
49
|
-
declare const MENU_REPORTS = "reports";
|
|
49
|
+
export declare const MENU_REPORTS = "reports";
|
|
50
50
|
/** Menu ID for "Sales" in the Adobe Commerce admin */
|
|
51
|
-
declare const MENU_SALES = "sales";
|
|
51
|
+
export declare const MENU_SALES = "sales";
|
|
52
52
|
/** Menu ID for "Stores" in the Adobe Commerce admin */
|
|
53
|
-
declare const MENU_STORES = "stores";
|
|
53
|
+
export declare const MENU_STORES = "stores";
|
|
54
54
|
/** Menu ID for "System" in the Adobe Commerce admin */
|
|
55
|
-
declare const MENU_SYSTEM = "system";
|
|
55
|
+
export declare const MENU_SYSTEM = "system";
|
|
56
56
|
/** All Commerce Admin menus available for app attachment. */
|
|
57
|
-
declare const COMMERCE_MENUS: readonly ["sales", "catalog", "customers", "marketing", "content", "reports", "stores", "system"];
|
|
57
|
+
export declare const COMMERCE_MENUS: readonly ["sales", "catalog", "customers", "marketing", "content", "reports", "stores", "system"];
|
|
58
58
|
/** A union type of all known supported Commerce Admin menu IDs. */
|
|
59
|
-
type CommerceMenu = (typeof COMMERCE_MENUS)[number];
|
|
59
|
+
export type CommerceMenu = (typeof COMMERCE_MENUS)[number];
|
|
60
60
|
/** Returns true if the given string is a known Commerce Admin menu ID. */
|
|
61
|
-
declare function isCommerceMenu(menu: string): menu is CommerceMenu;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { COMMERCE_MENUS, CommerceMenu, MENU_CATALOG, MENU_CONTENT, MENU_CUSTOMERS, MENU_MARKETING, MENU_REPORTS, MENU_SALES, MENU_STORES, MENU_SYSTEM, getMenuAclResourceId, isCommerceMenu };
|
|
61
|
+
export declare function isCommerceMenu(menu: string): menu is CommerceMenu;
|
|
62
|
+
//#endregion
|
package/dist/es/menu/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { r as sanitizeSegment, t as getAclResourceId } from "../acl-resource-id-CIxfW36q.mjs";
|
|
16
16
|
|
|
17
17
|
//#region source/menu/acl-resource-id.ts
|
|
18
18
|
/**
|
|
@@ -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 };
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { r as sanitizeSegment, t as getAclResourceId } from "../acl-resource-id-CIxfW36q.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";
|
package/dist/es/web/index.d.mts
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 };
|
package/dist/es/web/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { StrictMode, Suspense, createContext, use, useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
16
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
import Runtime, { init } from "@adobe/exc-app";
|
|
18
|
-
import page from "@adobe/exc-app/page
|
|
18
|
+
import page from "@adobe/exc-app/page";
|
|
19
19
|
import { Outlet, RouterProvider, createHashHistory, createRootRoute, createRoute, createRouter, useCanGoBack, useRouter, useRouterState } from "@tanstack/react-router";
|
|
20
20
|
import { createRoot } from "react-dom/client";
|
|
21
21
|
import { attach, register } from "@adobe/uix-guest";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-commerce-lib-admin-ui",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A library to interact with the Adobe Commerce Admin UI SDK API",
|
|
6
6
|
"keywords": [
|
|
@@ -101,29 +101,29 @@
|
|
|
101
101
|
"README.md"
|
|
102
102
|
],
|
|
103
103
|
"dependencies": {
|
|
104
|
+
"@adobe/aio-commerce-lib-api": "1.4.0",
|
|
105
|
+
"@adobe/aio-commerce-lib-core": "1.2.0",
|
|
104
106
|
"@adobe/exc-app": "^1.4.20",
|
|
105
107
|
"@adobe/uix-guest": "^1.0.3",
|
|
106
108
|
"@tanstack/react-router": "^1.170.15",
|
|
107
109
|
"ky": "^1.9.0",
|
|
108
110
|
"react-error-boundary": "^6.1.2",
|
|
109
|
-
"valibot": "^1.1.0"
|
|
110
|
-
"@adobe/aio-commerce-lib-api": "1.3.1",
|
|
111
|
-
"@adobe/aio-commerce-lib-core": "1.2.0"
|
|
111
|
+
"valibot": "^1.1.0"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
|
-
"@
|
|
115
|
-
"@types/react": "^19.2.17",
|
|
116
|
-
"@types/react-dom": "^19.2.3",
|
|
117
|
-
"react": "^19.2.7",
|
|
118
|
-
"react-dom": "^19.2.7",
|
|
119
|
-
"typescript": "^6.0.0",
|
|
114
|
+
"@aio-commerce-sdk/common-utils": "0.2.6",
|
|
120
115
|
"@aio-commerce-sdk/config-tsdown": "1.0.1",
|
|
121
116
|
"@aio-commerce-sdk/config-typedoc": "1.0.0",
|
|
122
|
-
"@aio-commerce-sdk/common-utils": "0.2.6",
|
|
123
117
|
"@aio-commerce-sdk/config-typescript": "1.0.0",
|
|
124
118
|
"@aio-commerce-sdk/config-vitest": "1.0.0",
|
|
125
119
|
"@aio-commerce-sdk/scripting-utils": "0.3.5",
|
|
126
|
-
"@aio-commerce-sdk/scripts": "0.1.1"
|
|
120
|
+
"@aio-commerce-sdk/scripts": "0.1.1",
|
|
121
|
+
"@react-spectrum/s2": "^1.5.1",
|
|
122
|
+
"@types/react": "^19.2.17",
|
|
123
|
+
"@types/react-dom": "^19.2.3",
|
|
124
|
+
"react": "^19.2.7",
|
|
125
|
+
"react-dom": "^19.2.7",
|
|
126
|
+
"typescript": "^6.0.0"
|
|
127
127
|
},
|
|
128
128
|
"peerDependencies": {
|
|
129
129
|
"@react-spectrum/s2": "^1.5.1",
|