@adobe/aio-commerce-lib-admin-ui 1.2.0 → 1.3.0-alpha-20261110204456
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/cjs/api/index.cjs +2 -2
- package/dist/cjs/api/index.d.cts +1 -0
- package/dist/cjs/credit-memo-view-buttons/index.cjs +90 -0
- package/dist/cjs/credit-memo-view-buttons/index.d.cts +76 -0
- package/dist/cjs/grid-columns/index.cjs +3 -3
- package/dist/cjs/grid-columns/index.d.cts +9 -0
- package/dist/cjs/invoice-view-buttons/index.cjs +90 -0
- package/dist/cjs/invoice-view-buttons/index.d.cts +76 -0
- package/dist/cjs/mass-actions/index.cjs +3 -3
- package/dist/cjs/mass-actions/index.d.cts +10 -0
- package/dist/cjs/menu/index.d.cts +9 -0
- package/dist/cjs/order-view-buttons/index.cjs +6 -5
- package/dist/cjs/order-view-buttons/index.d.cts +10 -1
- package/dist/cjs/{rolldown-runtime-DREAZOkv.cjs → rolldown-runtime-DdowHpbl.cjs} +4 -4
- package/dist/cjs/{schemas-C-tIBLog.cjs → schemas-CkbEkj5k.cjs} +1 -1
- package/dist/cjs/{utils-D5meZ8l8.cjs → utils-Dz_BZgfW.cjs} +1 -1
- package/dist/cjs/view-button-request-BymT_z5j.cjs +46 -0
- package/dist/cjs/web/index.cjs +95 -3
- package/dist/cjs/web/index.d.cts +63 -2
- package/dist/es/api/index.d.mts +1 -0
- package/dist/es/api/index.mjs +4 -4
- package/dist/es/credit-memo-view-buttons/index.d.mts +76 -0
- package/dist/es/credit-memo-view-buttons/index.mjs +83 -0
- package/dist/es/grid-columns/index.d.mts +9 -0
- package/dist/es/invoice-view-buttons/index.d.mts +76 -0
- package/dist/es/invoice-view-buttons/index.mjs +83 -0
- package/dist/es/mass-actions/index.d.mts +10 -0
- package/dist/es/menu/index.d.mts +9 -0
- package/dist/es/order-view-buttons/index.d.mts +10 -1
- package/dist/es/order-view-buttons/index.mjs +3 -2
- package/dist/es/view-button-request-Cu7Qz7jY.mjs +39 -0
- package/dist/es/web/index.d.mts +63 -2
- package/dist/es/web/index.mjs +90 -2
- package/package.json +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-admin-ui
|
|
2
2
|
|
|
3
|
+
## 1.3.0-alpha-20261110204456
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#776](https://github.com/adobe/aio-commerce-sdk/pull/776) [`32988bb`](https://github.com/adobe/aio-commerce-sdk/commit/32988bbda397d9a34f788aee721f4dca9abc362a) Thanks [@aminakhyat](https://github.com/aminakhyat)! - Add the `credit-memo-view-buttons` entrypoint with worker request/response and ACL helpers, and the `useCreditMemoViewButtonContext` hook in `./web`.
|
|
8
|
+
|
|
9
|
+
- [#732](https://github.com/adobe/aio-commerce-sdk/pull/732) [`f124cf4`](https://github.com/adobe/aio-commerce-sdk/commit/f124cf49208d930ca0f151e948a7597317365697) Thanks [@asalloum5](https://github.com/asalloum5)! - Add invoice view-button runtime request/response and ACL helpers, plus a React hook for invoice iframe context.
|
|
10
|
+
|
|
11
|
+
- [#746](https://github.com/adobe/aio-commerce-sdk/pull/746) [`ca065be`](https://github.com/adobe/aio-commerce-sdk/commit/ca065bec387cf90ce21309420851bef408ca194e) Thanks [@asalloum5](https://github.com/asalloum5)! - Add the `useCustomerContext` and `useStoreContext` React hooks to independently read customer and store identifiers from Commerce shared context in native UI replacement pages, with guaranteed string identifiers on success, preserved leading zeros in string IDs, and errors for missing or invalid values.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#776](https://github.com/adobe/aio-commerce-sdk/pull/776) [`32988bb`](https://github.com/adobe/aio-commerce-sdk/commit/32988bbda397d9a34f788aee721f4dca9abc362a) Thanks [@aminakhyat](https://github.com/aminakhyat)! - Fix the order, invoice and credit memo view button request parsers rejecting real Commerce requests: map the `buttonId` body field to `id` and the `X-Request-ID` header to `requestId`.
|
|
16
|
+
|
|
3
17
|
## 1.2.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@adobe/aio-commerce-lib-admin-ui`
|
|
2
2
|
|
|
3
|
-
This package provides utilities for interacting with the Adobe Commerce Admin UI SDK API, the extension points (grid columns, mass actions, menu, order view buttons), and browser-side helpers for Admin UI iframe extensions.
|
|
3
|
+
This package provides utilities for interacting with the Adobe Commerce Admin UI SDK API, the extension points (grid columns, mass actions, menu, order, invoice, and credit memo view buttons), and browser-side helpers for Admin UI iframe extensions.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/dist/cjs/api/index.cjs
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-DdowHpbl.cjs");
|
|
17
17
|
const require_acl_resource_id = require("../acl-resource-id-Bjpse1tR.cjs");
|
|
18
|
-
const require_utils = require("../utils-
|
|
18
|
+
const require_utils = require("../utils-Dz_BZgfW.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");
|
|
21
21
|
let valibot = require("valibot");
|
package/dist/cjs/api/index.d.cts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
/** biome-ignore-all lint/performance/noBarrelFile: This is the `@adobe/aio-commerce-lib-admin-ui/api` entrypoint. */
|
|
15
16
|
import { a as sanitizeSegment, i as getCustomAclResourceId, r as getAclResourceId, t as AdminUiEntity } from "../acl-resource-id-CXVgxUmB.cjs";
|
|
16
17
|
import { CommerceSdkErrorBase, CommerceSdkErrorOptions } from "@adobe/aio-commerce-lib-core/error";
|
|
17
18
|
import { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-DdowHpbl.cjs");
|
|
17
|
+
const require_acl_resource_id = require("../acl-resource-id-Bjpse1tR.cjs");
|
|
18
|
+
const require_utils = require("../utils-Dz_BZgfW.cjs");
|
|
19
|
+
const require_view_button_request = require("../view-button-request-BymT_z5j.cjs");
|
|
20
|
+
const require_schemas = require("../schemas-CkbEkj5k.cjs");
|
|
21
|
+
let valibot = require("valibot");
|
|
22
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
23
|
+
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
24
|
+
|
|
25
|
+
// source/credit-memo-view-buttons/acl-resource-id.ts
|
|
26
|
+
/**
|
|
27
|
+
* Derives the Commerce ACL resource ID for a credit memo view button.
|
|
28
|
+
* App and button IDs are trimmed, lowercased, and sanitized independently.
|
|
29
|
+
*
|
|
30
|
+
* @param metadataId - The application's `metadata.id` value.
|
|
31
|
+
* @param buttonId - The button's `adminUi.creditMemo.viewButtons[].id` value.
|
|
32
|
+
* @returns The credit memo view-button leaf ID, or an empty string when `metadataId` is blank.
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* getCreditMemoViewButtonAclResourceId("refund-app", "refund-offline");
|
|
36
|
+
* // "Magento_CommerceBackendUix::adminuisdk_app_refund_app_creditmemo_viewbuttons_refund_offline"
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function getCreditMemoViewButtonAclResourceId(metadataId, buttonId) {
|
|
40
|
+
const appRoot = require_acl_resource_id.getAclResourceId(metadataId);
|
|
41
|
+
if (appRoot === "") return "";
|
|
42
|
+
return `${appRoot}_creditmemo_viewbuttons_${require_acl_resource_id.sanitizeSegment(buttonId)}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// source/credit-memo-view-buttons/schema.ts
|
|
46
|
+
/**
|
|
47
|
+
* Schema for a credit memo view-button worker request.
|
|
48
|
+
* `id` identifies the clicked button; `creditMemoId` identifies the credit memo being viewed.
|
|
49
|
+
* All three fields must be non-empty strings.
|
|
50
|
+
*/
|
|
51
|
+
const CreditMemoViewButtonRequestSchema = valibot.object({
|
|
52
|
+
creditMemoId: require_schemas.nonEmptyStringValueSchema("creditMemoId"),
|
|
53
|
+
id: require_schemas.nonEmptyStringValueSchema("id"),
|
|
54
|
+
requestId: require_schemas.nonEmptyStringValueSchema("requestId")
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// source/credit-memo-view-buttons/presets.ts
|
|
58
|
+
/**
|
|
59
|
+
* Parses a credit memo view-button worker request.
|
|
60
|
+
* Throws `CommerceSdkValidationError` when the input is malformed.
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const { requestId, id, creditMemoId } = parseCreditMemoViewButtonRequest(params);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
function parseCreditMemoViewButtonRequest(input) {
|
|
67
|
+
return require_utils.parseOrThrow(CreditMemoViewButtonRequestSchema, require_view_button_request.normalizeViewButtonWorkerParams(input), "Invalid credit memo view button request");
|
|
68
|
+
}
|
|
69
|
+
/** Builds an HTTP 200 response with an empty body for a credit memo view-button worker. */
|
|
70
|
+
function okCreditMemoViewButtonResponse() {
|
|
71
|
+
return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: {} });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Builds an error response for a credit memo view-button worker.
|
|
75
|
+
* @param statusCode - The HTTP status code to return.
|
|
76
|
+
* @param errorMessage - The message included in the response body.
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* return creditMemoViewButtonErrorResponse(500, "Could not refund the credit memo");
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
function creditMemoViewButtonErrorResponse(statusCode, errorMessage) {
|
|
83
|
+
return (0, _adobe_aio_commerce_lib_core_responses.buildErrorResponse)(statusCode, { body: { message: errorMessage } });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
exports.CreditMemoViewButtonRequestSchema = CreditMemoViewButtonRequestSchema;
|
|
87
|
+
exports.creditMemoViewButtonErrorResponse = creditMemoViewButtonErrorResponse;
|
|
88
|
+
exports.getCreditMemoViewButtonAclResourceId = getCreditMemoViewButtonAclResourceId;
|
|
89
|
+
exports.okCreditMemoViewButtonResponse = okCreditMemoViewButtonResponse;
|
|
90
|
+
exports.parseCreditMemoViewButtonRequest = parseCreditMemoViewButtonRequest;
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
/** biome-ignore-all lint/performance/noBarrelFile: This is the public API for the credit-memo-view-buttons entrypoint. */
|
|
16
|
+
/**
|
|
17
|
+
* Request parsing, response builders, and ACL resource IDs for `commerce/backend-ui/2`
|
|
18
|
+
* credit memo view buttons registered under `adminUi.creditMemo.viewButtons`.
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import * as v from "valibot";
|
|
22
|
+
import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
|
|
23
|
+
/**
|
|
24
|
+
* Derives the Commerce ACL resource ID for a credit memo view button.
|
|
25
|
+
* App and button IDs are trimmed, lowercased, and sanitized independently.
|
|
26
|
+
*
|
|
27
|
+
* @param metadataId - The application's `metadata.id` value.
|
|
28
|
+
* @param buttonId - The button's `adminUi.creditMemo.viewButtons[].id` value.
|
|
29
|
+
* @returns The credit memo view-button leaf ID, or an empty string when `metadataId` is blank.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* getCreditMemoViewButtonAclResourceId("refund-app", "refund-offline");
|
|
33
|
+
* // "Magento_CommerceBackendUix::adminuisdk_app_refund_app_creditmemo_viewbuttons_refund_offline"
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function getCreditMemoViewButtonAclResourceId(metadataId: string, buttonId: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Schema for a credit memo view-button worker request.
|
|
39
|
+
* `id` identifies the clicked button; `creditMemoId` identifies the credit memo being viewed.
|
|
40
|
+
* All three fields must be non-empty strings.
|
|
41
|
+
*/
|
|
42
|
+
export declare const CreditMemoViewButtonRequestSchema: v.ObjectSchema<{
|
|
43
|
+
readonly creditMemoId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
44
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
45
|
+
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
46
|
+
}, undefined>;
|
|
47
|
+
/** Parsed request body for a credit memo view-button worker. */
|
|
48
|
+
type CreditMemoViewButtonRequest = v.InferOutput<typeof CreditMemoViewButtonRequestSchema>;
|
|
49
|
+
/** Empty success body returned by a credit memo view-button worker. */
|
|
50
|
+
type CreditMemoViewButtonSuccessBody = Record<string, never>;
|
|
51
|
+
/** Error body returned by a credit memo view-button worker. */
|
|
52
|
+
type CreditMemoViewButtonErrorBody = {
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Parses a credit memo view-button worker request.
|
|
57
|
+
* Throws `CommerceSdkValidationError` when the input is malformed.
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const { requestId, id, creditMemoId } = parseCreditMemoViewButtonRequest(params);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function parseCreditMemoViewButtonRequest(input: unknown): CreditMemoViewButtonRequest;
|
|
64
|
+
/** Builds an HTTP 200 response with an empty body for a credit memo view-button worker. */
|
|
65
|
+
export declare function okCreditMemoViewButtonResponse(): SuccessResponse<CreditMemoViewButtonSuccessBody>;
|
|
66
|
+
/**
|
|
67
|
+
* Builds an error response for a credit memo view-button worker.
|
|
68
|
+
* @param statusCode - The HTTP status code to return.
|
|
69
|
+
* @param errorMessage - The message included in the response body.
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* return creditMemoViewButtonErrorResponse(500, "Could not refund the credit memo");
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function creditMemoViewButtonErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<CreditMemoViewButtonErrorBody>;
|
|
76
|
+
export type { CreditMemoViewButtonErrorBody, CreditMemoViewButtonRequest, CreditMemoViewButtonSuccessBody };
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-DdowHpbl.cjs");
|
|
17
17
|
const require_acl_resource_id = require("../acl-resource-id-Bjpse1tR.cjs");
|
|
18
|
-
const require_utils = require("../utils-
|
|
19
|
-
const require_schemas = require("../schemas-
|
|
18
|
+
const require_utils = require("../utils-Dz_BZgfW.cjs");
|
|
19
|
+
const require_schemas = require("../schemas-CkbEkj5k.cjs");
|
|
20
20
|
let valibot = require("valibot");
|
|
21
21
|
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
22
22
|
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
/** biome-ignore-all lint/performance/noBarrelFile: This is the public API for the grid-columns entrypoint. */
|
|
16
|
+
/**
|
|
17
|
+
* Builders for the `commerce/backend-ui/2` grid column wire contract.
|
|
18
|
+
*
|
|
19
|
+
* Provides request parsing and response envelope construction for runtime
|
|
20
|
+
* actions registered under `adminUi.<grid>.gridColumns.runtimeAction`.
|
|
21
|
+
*
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
15
24
|
import { t as AdminUiEntity } from "../acl-resource-id-CXVgxUmB.cjs";
|
|
16
25
|
import * as v from "valibot";
|
|
17
26
|
import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-DdowHpbl.cjs");
|
|
17
|
+
const require_acl_resource_id = require("../acl-resource-id-Bjpse1tR.cjs");
|
|
18
|
+
const require_utils = require("../utils-Dz_BZgfW.cjs");
|
|
19
|
+
const require_view_button_request = require("../view-button-request-BymT_z5j.cjs");
|
|
20
|
+
const require_schemas = require("../schemas-CkbEkj5k.cjs");
|
|
21
|
+
let valibot = require("valibot");
|
|
22
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
23
|
+
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
24
|
+
|
|
25
|
+
// source/invoice-view-buttons/acl-resource-id.ts
|
|
26
|
+
/**
|
|
27
|
+
* Derives the Commerce ACL resource ID for an invoice view button.
|
|
28
|
+
* App and button IDs are trimmed, lowercased, and sanitized independently.
|
|
29
|
+
*
|
|
30
|
+
* @param metadataId - The application's `metadata.id` value.
|
|
31
|
+
* @param buttonId - The button's `adminUi.invoice.viewButtons[].id` value.
|
|
32
|
+
* @returns The invoice view-button leaf ID, or an empty string when `metadataId` is blank.
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* getInvoiceViewButtonAclResourceId("billing-app", "export-invoice");
|
|
36
|
+
* // "Magento_CommerceBackendUix::adminuisdk_app_billing_app_invoice_viewbuttons_export_invoice"
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function getInvoiceViewButtonAclResourceId(metadataId, buttonId) {
|
|
40
|
+
const appRoot = require_acl_resource_id.getAclResourceId(metadataId);
|
|
41
|
+
if (appRoot === "") return "";
|
|
42
|
+
return `${appRoot}_invoice_viewbuttons_${require_acl_resource_id.sanitizeSegment(buttonId)}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// source/invoice-view-buttons/schema.ts
|
|
46
|
+
/**
|
|
47
|
+
* Schema for an invoice view-button worker request.
|
|
48
|
+
* `id` identifies the clicked button; `invoiceId` identifies the invoice being viewed.
|
|
49
|
+
* All three fields must be non-empty strings.
|
|
50
|
+
*/
|
|
51
|
+
const InvoiceViewButtonRequestSchema = valibot.object({
|
|
52
|
+
id: require_schemas.nonEmptyStringValueSchema("id"),
|
|
53
|
+
invoiceId: require_schemas.nonEmptyStringValueSchema("invoiceId"),
|
|
54
|
+
requestId: require_schemas.nonEmptyStringValueSchema("requestId")
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// source/invoice-view-buttons/presets.ts
|
|
58
|
+
/**
|
|
59
|
+
* Parses an invoice view-button worker request.
|
|
60
|
+
* Throws `CommerceSdkValidationError` when the input is malformed.
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const { requestId, id, invoiceId } = parseInvoiceViewButtonRequest(params);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
function parseInvoiceViewButtonRequest(input) {
|
|
67
|
+
return require_utils.parseOrThrow(InvoiceViewButtonRequestSchema, require_view_button_request.normalizeViewButtonWorkerParams(input), "Invalid invoice view button request");
|
|
68
|
+
}
|
|
69
|
+
/** Builds an HTTP 200 response with an empty body for an invoice view-button worker. */
|
|
70
|
+
function okInvoiceViewButtonResponse() {
|
|
71
|
+
return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: {} });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Builds an error response for an invoice view-button worker.
|
|
75
|
+
* @param statusCode - The HTTP status code to return.
|
|
76
|
+
* @param errorMessage - The message included in the response body.
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* return invoiceViewButtonErrorResponse(500, "Could not export the invoice");
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
function invoiceViewButtonErrorResponse(statusCode, errorMessage) {
|
|
83
|
+
return (0, _adobe_aio_commerce_lib_core_responses.buildErrorResponse)(statusCode, { body: { message: errorMessage } });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
exports.InvoiceViewButtonRequestSchema = InvoiceViewButtonRequestSchema;
|
|
87
|
+
exports.getInvoiceViewButtonAclResourceId = getInvoiceViewButtonAclResourceId;
|
|
88
|
+
exports.invoiceViewButtonErrorResponse = invoiceViewButtonErrorResponse;
|
|
89
|
+
exports.okInvoiceViewButtonResponse = okInvoiceViewButtonResponse;
|
|
90
|
+
exports.parseInvoiceViewButtonRequest = parseInvoiceViewButtonRequest;
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
/** biome-ignore-all lint/performance/noBarrelFile: This is the public API for the invoice-view-buttons entrypoint. */
|
|
16
|
+
/**
|
|
17
|
+
* Request parsing, response builders, and ACL resource IDs for `commerce/backend-ui/2`
|
|
18
|
+
* invoice view buttons registered under `adminUi.invoice.viewButtons`.
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import * as v from "valibot";
|
|
22
|
+
import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
|
|
23
|
+
/**
|
|
24
|
+
* Derives the Commerce ACL resource ID for an invoice view button.
|
|
25
|
+
* App and button IDs are trimmed, lowercased, and sanitized independently.
|
|
26
|
+
*
|
|
27
|
+
* @param metadataId - The application's `metadata.id` value.
|
|
28
|
+
* @param buttonId - The button's `adminUi.invoice.viewButtons[].id` value.
|
|
29
|
+
* @returns The invoice view-button leaf ID, or an empty string when `metadataId` is blank.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* getInvoiceViewButtonAclResourceId("billing-app", "export-invoice");
|
|
33
|
+
* // "Magento_CommerceBackendUix::adminuisdk_app_billing_app_invoice_viewbuttons_export_invoice"
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function getInvoiceViewButtonAclResourceId(metadataId: string, buttonId: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Schema for an invoice view-button worker request.
|
|
39
|
+
* `id` identifies the clicked button; `invoiceId` identifies the invoice being viewed.
|
|
40
|
+
* All three fields must be non-empty strings.
|
|
41
|
+
*/
|
|
42
|
+
export declare const InvoiceViewButtonRequestSchema: v.ObjectSchema<{
|
|
43
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
44
|
+
readonly invoiceId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
45
|
+
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
46
|
+
}, undefined>;
|
|
47
|
+
/** Parsed request body for an invoice view-button worker. */
|
|
48
|
+
type InvoiceViewButtonRequest = v.InferOutput<typeof InvoiceViewButtonRequestSchema>;
|
|
49
|
+
/** Empty success body returned by an invoice view-button worker. */
|
|
50
|
+
type InvoiceViewButtonSuccessBody = Record<string, never>;
|
|
51
|
+
/** Error body returned by an invoice view-button worker. */
|
|
52
|
+
type InvoiceViewButtonErrorBody = {
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Parses an invoice view-button worker request.
|
|
57
|
+
* Throws `CommerceSdkValidationError` when the input is malformed.
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const { requestId, id, invoiceId } = parseInvoiceViewButtonRequest(params);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function parseInvoiceViewButtonRequest(input: unknown): InvoiceViewButtonRequest;
|
|
64
|
+
/** Builds an HTTP 200 response with an empty body for an invoice view-button worker. */
|
|
65
|
+
export declare function okInvoiceViewButtonResponse(): SuccessResponse<InvoiceViewButtonSuccessBody>;
|
|
66
|
+
/**
|
|
67
|
+
* Builds an error response for an invoice view-button worker.
|
|
68
|
+
* @param statusCode - The HTTP status code to return.
|
|
69
|
+
* @param errorMessage - The message included in the response body.
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* return invoiceViewButtonErrorResponse(500, "Could not export the invoice");
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function invoiceViewButtonErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<InvoiceViewButtonErrorBody>;
|
|
76
|
+
export type { InvoiceViewButtonErrorBody, InvoiceViewButtonRequest, InvoiceViewButtonSuccessBody };
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-DdowHpbl.cjs");
|
|
17
17
|
const require_acl_resource_id = require("../acl-resource-id-Bjpse1tR.cjs");
|
|
18
|
-
const require_utils = require("../utils-
|
|
19
|
-
const require_schemas = require("../schemas-
|
|
18
|
+
const require_utils = require("../utils-Dz_BZgfW.cjs");
|
|
19
|
+
const require_schemas = require("../schemas-CkbEkj5k.cjs");
|
|
20
20
|
let valibot = require("valibot");
|
|
21
21
|
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
22
22
|
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
/** biome-ignore-all lint/performance/noBarrelFile: This is the public API for the mass-actions entrypoint. */
|
|
16
|
+
/**
|
|
17
|
+
* Builders for the `commerce/backend-ui/2` mass action wire contract.
|
|
18
|
+
*
|
|
19
|
+
* - **Worker actions**: request parsing and response envelope construction for
|
|
20
|
+
* runtime actions registered under `adminUi.<entity>.massActions` with
|
|
21
|
+
* `type: "worker"`.
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
15
25
|
import { n as MassActionEntity, t as AdminUiEntity } from "../acl-resource-id-CXVgxUmB.cjs";
|
|
16
26
|
import * as v from "valibot";
|
|
17
27
|
import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
/** biome-ignore-all lint/performance/noBarrelFile: This is the public API for the menu entrypoint. */
|
|
16
|
+
/**
|
|
17
|
+
* Helpers and constants for working with the Adobe Commerce admin menu.
|
|
18
|
+
*
|
|
19
|
+
* Provides named constants for many menu IDs in the Adobe Commerce Admin,
|
|
20
|
+
* as well as type guards for distinguishing menu IDs at runtime.
|
|
21
|
+
*
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
15
24
|
/**
|
|
16
25
|
* Derives the deterministic Commerce ACL resource id for a specific menu item.
|
|
17
26
|
*
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-DdowHpbl.cjs");
|
|
17
17
|
const require_acl_resource_id = require("../acl-resource-id-Bjpse1tR.cjs");
|
|
18
|
-
const require_utils = require("../utils-
|
|
19
|
-
const
|
|
18
|
+
const require_utils = require("../utils-Dz_BZgfW.cjs");
|
|
19
|
+
const require_view_button_request = require("../view-button-request-BymT_z5j.cjs");
|
|
20
|
+
const require_schemas = require("../schemas-CkbEkj5k.cjs");
|
|
20
21
|
let valibot = require("valibot");
|
|
21
22
|
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
22
23
|
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
@@ -25,7 +26,7 @@ let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-co
|
|
|
25
26
|
/**
|
|
26
27
|
* Derives the deterministic Commerce ACL resource id for an order view button.
|
|
27
28
|
*
|
|
28
|
-
*
|
|
29
|
+
* This helper is scoped to the order entity, so no entity discriminator is needed.
|
|
29
30
|
* The id is assembled as: `getAclResourceId(metadataId)` + `"_order_viewbuttons_"` +
|
|
30
31
|
* sanitized `buttonId`. The `buttonId` is sanitized (trimmed, lowercased, non-`[a-z0-9_]` → `_`).
|
|
31
32
|
* `"Magento_CommerceBackendUix::adminuisdk_app_"` in the example is the fixed constant prefix
|
|
@@ -83,7 +84,7 @@ const OrderViewButtonRequestSchema = valibot.object({
|
|
|
83
84
|
* ```
|
|
84
85
|
*/
|
|
85
86
|
function parseOrderViewButtonRequest(input) {
|
|
86
|
-
return require_utils.parseOrThrow(OrderViewButtonRequestSchema, input, "Invalid order view button request");
|
|
87
|
+
return require_utils.parseOrThrow(OrderViewButtonRequestSchema, require_view_button_request.normalizeViewButtonWorkerParams(input), "Invalid order view button request");
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
90
|
* Builds an HTTP 200 success response for an order view button handler.
|
|
@@ -12,12 +12,21 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
/** biome-ignore-all lint/performance/noBarrelFile: This is the public API for the order-view-buttons entrypoint. */
|
|
16
|
+
/**
|
|
17
|
+
* Builders for the `commerce/backend-ui/2` order view button wire contract.
|
|
18
|
+
*
|
|
19
|
+
* Provides request parsing and response envelope construction for runtime
|
|
20
|
+
* actions registered under `adminUi.order.viewButtons[].runtimeAction`.
|
|
21
|
+
*
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
15
24
|
import * as v from "valibot";
|
|
16
25
|
import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
|
|
17
26
|
/**
|
|
18
27
|
* Derives the deterministic Commerce ACL resource id for an order view button.
|
|
19
28
|
*
|
|
20
|
-
*
|
|
29
|
+
* This helper is scoped to the order entity, so no entity discriminator is needed.
|
|
21
30
|
* The id is assembled as: `getAclResourceId(metadataId)` + `"_order_viewbuttons_"` +
|
|
22
31
|
* sanitized `buttonId`. The `buttonId` is sanitized (trimmed, lowercased, non-`[a-z0-9_]` → `_`).
|
|
23
32
|
* `"Magento_CommerceBackendUix::adminuisdk_app_"` in the example is the fixed constant prefix
|
|
@@ -19,18 +19,18 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
19
19
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
20
20
|
var __getProtoOf = Object.getPrototypeOf;
|
|
21
21
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
|
-
var __exportAll = (all,
|
|
23
|
-
let target = {};
|
|
22
|
+
var __exportAll = (all, flags) => {
|
|
23
|
+
let target = Object.setPrototypeOf({}, null);
|
|
24
24
|
for (var name in all) {
|
|
25
25
|
__defProp(target, name, {
|
|
26
26
|
get: all[name],
|
|
27
27
|
enumerable: true
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
if (!
|
|
30
|
+
if (!(flags & 1)) {
|
|
31
31
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
32
32
|
}
|
|
33
|
-
return target;
|
|
33
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
34
34
|
};
|
|
35
35
|
var __copyProps = (to, from, except, desc) => {
|
|
36
36
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
15
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DdowHpbl.cjs");
|
|
16
16
|
let valibot = require("valibot");
|
|
17
17
|
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
15
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DdowHpbl.cjs");
|
|
16
16
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
17
17
|
let valibot = require("valibot");
|
|
18
18
|
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DdowHpbl.cjs");
|
|
16
|
+
let valibot = require("valibot");
|
|
17
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
18
|
+
let _adobe_aio_commerce_lib_core_headers = require("@adobe/aio-commerce-lib-core/headers");
|
|
19
|
+
|
|
20
|
+
// source/lib/view-button-request.ts
|
|
21
|
+
const REQUEST_ID_HEADER = "x-request-id";
|
|
22
|
+
const RuntimeParamsSchema = valibot.record(valibot.string(), valibot.unknown());
|
|
23
|
+
/**
|
|
24
|
+
* Maps the params Commerce sends to a view-button worker onto the documented request shape.
|
|
25
|
+
*
|
|
26
|
+
* Commerce POSTs `{ <entityId>, buttonId }` and sends the request ID in the `X-Request-ID`
|
|
27
|
+
* header, which App Builder exposes in `__ow_headers`. Explicit `id` and `requestId` params
|
|
28
|
+
* take precedence so direct calls with the documented shape keep working. Inputs that are not
|
|
29
|
+
* runtime params are returned as-is so the entity schema reports the validation error.
|
|
30
|
+
*/
|
|
31
|
+
function normalizeViewButtonWorkerParams(input) {
|
|
32
|
+
if (!valibot.is(RuntimeParamsSchema, input)) return input;
|
|
33
|
+
const headers = input.__ow_headers === void 0 ? {} : (0, _adobe_aio_commerce_lib_core_headers.getHeadersFromParams)(input);
|
|
34
|
+
return {
|
|
35
|
+
...input,
|
|
36
|
+
id: input.id ?? input.buttonId,
|
|
37
|
+
requestId: input.requestId ?? (0, _adobe_aio_commerce_lib_core_headers.getHeader)(headers, REQUEST_ID_HEADER)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
Object.defineProperty(exports, "normalizeViewButtonWorkerParams", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return normalizeViewButtonWorkerParams;
|
|
45
|
+
}
|
|
46
|
+
});
|