@adobe/aio-commerce-lib-admin-ui 1.3.0-beta-20261105172845 → 1.3.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/README.md +1 -1
  3. package/dist/cjs/api/index.cjs +2 -2
  4. package/dist/cjs/api/index.d.cts +1 -0
  5. package/dist/cjs/credit-memo-view-buttons/index.cjs +4 -4
  6. package/dist/cjs/credit-memo-view-buttons/index.d.cts +6 -0
  7. package/dist/cjs/grid-columns/index.cjs +3 -3
  8. package/dist/cjs/grid-columns/index.d.cts +9 -0
  9. package/dist/cjs/invoice-view-buttons/index.cjs +4 -4
  10. package/dist/cjs/invoice-view-buttons/index.d.cts +6 -0
  11. package/dist/cjs/mass-actions/index.cjs +3 -3
  12. package/dist/cjs/mass-actions/index.d.cts +10 -0
  13. package/dist/cjs/menu/index.d.cts +9 -0
  14. package/dist/cjs/order-view-buttons/index.cjs +4 -4
  15. package/dist/cjs/order-view-buttons/index.d.cts +9 -0
  16. package/dist/cjs/rma-view-buttons/index.cjs +90 -0
  17. package/dist/cjs/rma-view-buttons/index.d.cts +76 -0
  18. package/dist/cjs/{rolldown-runtime-DREAZOkv.cjs → rolldown-runtime-DdowHpbl.cjs} +4 -4
  19. package/dist/cjs/{schemas-C-tIBLog.cjs → schemas-CkbEkj5k.cjs} +1 -1
  20. package/dist/cjs/{utils-D5meZ8l8.cjs → utils-Dz_BZgfW.cjs} +1 -1
  21. package/dist/cjs/{view-button-request-DdtipbWD.cjs → view-button-request-BymT_z5j.cjs} +1 -1
  22. package/dist/cjs/web/index.cjs +27 -1
  23. package/dist/cjs/web/index.d.cts +22 -1
  24. package/dist/es/api/index.d.mts +1 -0
  25. package/dist/es/api/index.mjs +4 -4
  26. package/dist/es/credit-memo-view-buttons/index.d.mts +6 -0
  27. package/dist/es/grid-columns/index.d.mts +9 -0
  28. package/dist/es/invoice-view-buttons/index.d.mts +6 -0
  29. package/dist/es/mass-actions/index.d.mts +10 -0
  30. package/dist/es/menu/index.d.mts +9 -0
  31. package/dist/es/order-view-buttons/index.d.mts +9 -0
  32. package/dist/es/rma-view-buttons/index.d.mts +76 -0
  33. package/dist/es/rma-view-buttons/index.mjs +83 -0
  34. package/dist/es/web/index.d.mts +22 -1
  35. package/dist/es/web/index.mjs +26 -1
  36. package/package.json +16 -6
package/CHANGELOG.md CHANGED
@@ -1,18 +1,25 @@
1
1
  # @adobe/aio-commerce-lib-admin-ui
2
2
 
3
- ## 1.3.0-beta-20261105172845
3
+ ## 1.3.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
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
8
 
9
+ - [#802](https://github.com/adobe/aio-commerce-sdk/pull/802) [`a03c546`](https://github.com/adobe/aio-commerce-sdk/commit/a03c546f8b6a54c8c1aa1352d89b6a0efef00d9e) Thanks [@aminakhyat](https://github.com/aminakhyat)! - Add the `rma-view-buttons` entrypoint with worker request/response and ACL helpers for return (RMA) view buttons, and the `useRmaViewButtonContext` hook in `./web`.
10
+
9
11
  - [#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
12
 
11
13
  - [#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
14
 
15
+ - [#770](https://github.com/adobe/aio-commerce-sdk/pull/770) [`9b6e61c`](https://github.com/adobe/aio-commerce-sdk/commit/9b6e61ceed9c45ae415c37b401272f09d4c75759) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Add support for Node.js 26.
16
+
13
17
  ### Patch Changes
14
18
 
15
19
  - [#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`.
20
+ - Updated dependencies [[`9b6e61c`](https://github.com/adobe/aio-commerce-sdk/commit/9b6e61ceed9c45ae415c37b401272f09d4c75759)]:
21
+ - @adobe/aio-commerce-lib-api@1.5.0
22
+ - @adobe/aio-commerce-lib-core@1.4.0
16
23
 
17
24
  ## 1.2.0
18
25
 
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, invoice, and credit memo 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, credit memo, and return view buttons), and browser-side helpers for Admin UI iframe extensions.
4
4
 
5
5
  ## Installation
6
6
 
@@ -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-DREAZOkv.cjs");
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-D5meZ8l8.cjs");
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");
@@ -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";
@@ -13,11 +13,11 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../rolldown-runtime-DREAZOkv.cjs");
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-D5meZ8l8.cjs");
19
- const require_view_button_request = require("../view-button-request-DdtipbWD.cjs");
20
- const require_schemas = require("../schemas-C-tIBLog.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
21
  let valibot = require("valibot");
22
22
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
23
23
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
@@ -12,6 +12,12 @@
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 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
+ */
15
21
  import * as v from "valibot";
16
22
  import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
17
23
  /**
@@ -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-DREAZOkv.cjs");
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-D5meZ8l8.cjs");
19
- const require_schemas = require("../schemas-C-tIBLog.cjs");
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";
@@ -13,11 +13,11 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../rolldown-runtime-DREAZOkv.cjs");
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-D5meZ8l8.cjs");
19
- const require_view_button_request = require("../view-button-request-DdtipbWD.cjs");
20
- const require_schemas = require("../schemas-C-tIBLog.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
21
  let valibot = require("valibot");
22
22
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
23
23
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
@@ -12,6 +12,12 @@
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 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
+ */
15
21
  import * as v from "valibot";
16
22
  import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
17
23
  /**
@@ -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-DREAZOkv.cjs");
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-D5meZ8l8.cjs");
19
- const require_schemas = require("../schemas-C-tIBLog.cjs");
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,11 +13,11 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../rolldown-runtime-DREAZOkv.cjs");
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-D5meZ8l8.cjs");
19
- const require_view_button_request = require("../view-button-request-DdtipbWD.cjs");
20
- const require_schemas = require("../schemas-C-tIBLog.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
21
  let valibot = require("valibot");
22
22
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
23
23
  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 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
  /**
@@ -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/rma-view-buttons/acl-resource-id.ts
26
+ /**
27
+ * Derives the Commerce ACL resource ID for a return 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.rma.viewButtons[].id` value.
32
+ * @returns The return view-button leaf ID, or an empty string when `metadataId` is blank.
33
+ * @example
34
+ * ```ts
35
+ * getRmaViewButtonAclResourceId("returns-app", "approve-return");
36
+ * // "Magento_CommerceBackendUix::adminuisdk_app_returns_app_rma_viewbuttons_approve_return"
37
+ * ```
38
+ */
39
+ function getRmaViewButtonAclResourceId(metadataId, buttonId) {
40
+ const appRoot = require_acl_resource_id.getAclResourceId(metadataId);
41
+ if (appRoot === "") return "";
42
+ return `${appRoot}_rma_viewbuttons_${require_acl_resource_id.sanitizeSegment(buttonId)}`;
43
+ }
44
+
45
+ // source/rma-view-buttons/schema.ts
46
+ /**
47
+ * Schema for a return view-button worker request.
48
+ * `id` identifies the clicked button; `rmaId` identifies the return being viewed.
49
+ * All three fields must be non-empty strings.
50
+ */
51
+ const RmaViewButtonRequestSchema = valibot.object({
52
+ id: require_schemas.nonEmptyStringValueSchema("id"),
53
+ requestId: require_schemas.nonEmptyStringValueSchema("requestId"),
54
+ rmaId: require_schemas.nonEmptyStringValueSchema("rmaId")
55
+ });
56
+
57
+ // source/rma-view-buttons/presets.ts
58
+ /**
59
+ * Parses a return view-button worker request.
60
+ * Throws `CommerceSdkValidationError` when the input is malformed.
61
+ * @example
62
+ * ```ts
63
+ * const { requestId, id, rmaId } = parseRmaViewButtonRequest(params);
64
+ * ```
65
+ */
66
+ function parseRmaViewButtonRequest(input) {
67
+ return require_utils.parseOrThrow(RmaViewButtonRequestSchema, require_view_button_request.normalizeViewButtonWorkerParams(input), "Invalid return view button request");
68
+ }
69
+ /** Builds an HTTP 200 response with an empty body for a return view-button worker. */
70
+ function okRmaViewButtonResponse() {
71
+ return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: {} });
72
+ }
73
+ /**
74
+ * Builds an error response for a return 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 rmaViewButtonErrorResponse(500, "Could not approve the return");
80
+ * ```
81
+ */
82
+ function rmaViewButtonErrorResponse(statusCode, errorMessage) {
83
+ return (0, _adobe_aio_commerce_lib_core_responses.buildErrorResponse)(statusCode, { body: { message: errorMessage } });
84
+ }
85
+
86
+ exports.RmaViewButtonRequestSchema = RmaViewButtonRequestSchema;
87
+ exports.getRmaViewButtonAclResourceId = getRmaViewButtonAclResourceId;
88
+ exports.okRmaViewButtonResponse = okRmaViewButtonResponse;
89
+ exports.parseRmaViewButtonRequest = parseRmaViewButtonRequest;
90
+ exports.rmaViewButtonErrorResponse = rmaViewButtonErrorResponse;
@@ -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 rma-view-buttons entrypoint. */
16
+ /**
17
+ * Request parsing, response builders, and ACL resource IDs for `commerce/backend-ui/2`
18
+ * return view buttons registered under `adminUi.rma.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 return 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.rma.viewButtons[].id` value.
29
+ * @returns The return view-button leaf ID, or an empty string when `metadataId` is blank.
30
+ * @example
31
+ * ```ts
32
+ * getRmaViewButtonAclResourceId("returns-app", "approve-return");
33
+ * // "Magento_CommerceBackendUix::adminuisdk_app_returns_app_rma_viewbuttons_approve_return"
34
+ * ```
35
+ */
36
+ export declare function getRmaViewButtonAclResourceId(metadataId: string, buttonId: string): string;
37
+ /**
38
+ * Schema for a return view-button worker request.
39
+ * `id` identifies the clicked button; `rmaId` identifies the return being viewed.
40
+ * All three fields must be non-empty strings.
41
+ */
42
+ export declare const RmaViewButtonRequestSchema: 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 requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
45
+ readonly rmaId: 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 return view-button worker. */
48
+ type RmaViewButtonRequest = v.InferOutput<typeof RmaViewButtonRequestSchema>;
49
+ /** Empty success body returned by a return view-button worker. */
50
+ type RmaViewButtonSuccessBody = Record<string, never>;
51
+ /** Error body returned by a return view-button worker. */
52
+ type RmaViewButtonErrorBody = {
53
+ message: string;
54
+ };
55
+ /**
56
+ * Parses a return view-button worker request.
57
+ * Throws `CommerceSdkValidationError` when the input is malformed.
58
+ * @example
59
+ * ```ts
60
+ * const { requestId, id, rmaId } = parseRmaViewButtonRequest(params);
61
+ * ```
62
+ */
63
+ export declare function parseRmaViewButtonRequest(input: unknown): RmaViewButtonRequest;
64
+ /** Builds an HTTP 200 response with an empty body for a return view-button worker. */
65
+ export declare function okRmaViewButtonResponse(): SuccessResponse<RmaViewButtonSuccessBody>;
66
+ /**
67
+ * Builds an error response for a return 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 rmaViewButtonErrorResponse(500, "Could not approve the return");
73
+ * ```
74
+ */
75
+ export declare function rmaViewButtonErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<RmaViewButtonErrorBody>;
76
+ export type { RmaViewButtonErrorBody, RmaViewButtonRequest, RmaViewButtonSuccessBody };
@@ -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, no_symbols) => {
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 (!no_symbols) {
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-DREAZOkv.cjs");
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-DREAZOkv.cjs");
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);
@@ -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-DREAZOkv.cjs");
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
  let _adobe_aio_commerce_lib_core_headers = require("@adobe/aio-commerce-lib-core/headers");
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../rolldown-runtime-DREAZOkv.cjs");
16
+ const require_rolldown_runtime = require("../rolldown-runtime-DdowHpbl.cjs");
17
17
  let valibot = require("valibot");
18
18
  let react = require("react");
19
19
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -54,6 +54,13 @@ function parseInvoiceId(href) {
54
54
  function parseCreditMemoId(href) {
55
55
  return parseViewButtonId(href, "creditMemoId");
56
56
  }
57
+ /**
58
+ * Extracts the return (RMA) ID from the given absolute URL.
59
+ * @param href - The URL to read the return ID from (typically `window.location.href`).
60
+ */
61
+ function parseRmaId(href) {
62
+ return parseViewButtonId(href, "rmaId");
63
+ }
57
64
  /** Reads a view-button identifier from the URL search parameters or hash-route query. */
58
65
  function parseViewButtonId(href, key) {
59
66
  const urlObj = new URL(href);
@@ -377,6 +384,24 @@ function useCreditMemoViewButtonContext() {
377
384
  return ok({ creditMemoId });
378
385
  }, []);
379
386
  }
387
+ /**
388
+ * Returns the return (RMA) ID for a return view-button extension point.
389
+ * Reads `rmaId` from the page URL search parameters or hash-route query.
390
+ * Returns an error when the return ID is missing or blank.
391
+ * @example
392
+ * ```tsx
393
+ * const { data, error } = useRmaViewButtonContext();
394
+ * if (error) throw error;
395
+ * return <span>{data.rmaId}</span>;
396
+ * ```
397
+ */
398
+ function useRmaViewButtonContext() {
399
+ return (0, react.useMemo)(() => {
400
+ const rmaId = parseRmaId(globalThis.location.href);
401
+ if (rmaId === null || rmaId.trim() === "") return error("Could not find a return ID. Is this frame running as a return view-button extension point?");
402
+ return ok({ rmaId });
403
+ }, []);
404
+ }
380
405
 
381
406
  // source/web/react/commerce/hooks/use-host-connection.ts
382
407
  /**
@@ -949,5 +974,6 @@ exports.useIms = useIms;
949
974
  exports.useInvoiceViewButtonContext = useInvoiceViewButtonContext;
950
975
  exports.useMassActionContext = useMassActionContext;
951
976
  exports.useOrderViewButtonContext = useOrderViewButtonContext;
977
+ exports.useRmaViewButtonContext = useRmaViewButtonContext;
952
978
  exports.useSharedContext = useSharedContext;
953
979
  exports.useStoreContext = useStoreContext;
@@ -12,6 +12,11 @@
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 web entrypoint. */
16
+ /**
17
+ * Browser helpers for mounting `commerce/backend-ui/2` iframe apps.
18
+ * @packageDocumentation
19
+ */
15
20
  import { ReactNode } from "react";
16
21
  import { attach } from "@adobe/uix-guest";
17
22
  import { NavigateOptions, ToOptions } from "@tanstack/react-router";
@@ -94,6 +99,10 @@ type InvoiceViewButtonContext = {
94
99
  type CreditMemoViewButtonContext = {
95
100
  creditMemoId: string;
96
101
  };
102
+ /** The context shared with return (RMA) view-button extension points. */
103
+ type RmaViewButtonContext = {
104
+ rmaId: string;
105
+ };
97
106
  /**
98
107
  * Returns the current Commerce shared context. The guest connection is already established by
99
108
  * the time this can be called (see {@link SharedContextProvider}).
@@ -180,6 +189,18 @@ export declare function useInvoiceViewButtonContext(): Result<InvoiceViewButtonC
180
189
  * ```
181
190
  */
182
191
  export declare function useCreditMemoViewButtonContext(): Result<CreditMemoViewButtonContext>;
192
+ /**
193
+ * Returns the return (RMA) ID for a return view-button extension point.
194
+ * Reads `rmaId` from the page URL search parameters or hash-route query.
195
+ * Returns an error when the return ID is missing or blank.
196
+ * @example
197
+ * ```tsx
198
+ * const { data, error } = useRmaViewButtonContext();
199
+ * if (error) throw error;
200
+ * return <span>{data.rmaId}</span>;
201
+ * ```
202
+ */
203
+ export declare function useRmaViewButtonContext(): Result<RmaViewButtonContext>;
183
204
  /**
184
205
  * Returns typed helpers for interacting with the Commerce Admin host.
185
206
  *
@@ -246,4 +267,4 @@ type CreateExtensionAppOptions = {
246
267
  * ```
247
268
  */
248
269
  export declare function createExtensionApp({ menu, metadata, routes, root: customRoot }: CreateExtensionAppOptions): void;
249
- export type { CreateExtensionAppOptions, CreditMemoViewButtonContext, CustomerContext, ExtensionRoute, HostConnection, ImsContext, InvoiceViewButtonContext, MassActionContext, OrderViewButtonContext, SharedContext, StoreContext };
270
+ export type { CreateExtensionAppOptions, CreditMemoViewButtonContext, CustomerContext, ExtensionRoute, HostConnection, ImsContext, InvoiceViewButtonContext, MassActionContext, OrderViewButtonContext, RmaViewButtonContext, SharedContext, StoreContext };
@@ -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.mjs";
16
17
  import { CommerceSdkErrorBase, CommerceSdkErrorOptions } from "@adobe/aio-commerce-lib-core/error";
17
18
  import { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
@@ -21,18 +21,18 @@ import { HTTPError } from "ky";
21
21
 
22
22
  // \0rolldown/runtime.js
23
23
  var __defProp = Object.defineProperty;
24
- var __exportAll = (all, no_symbols) => {
25
- let target = {};
24
+ var __exportAll = (all, flags) => {
25
+ let target = Object.setPrototypeOf({}, null);
26
26
  for (var name in all) {
27
27
  __defProp(target, name, {
28
28
  get: all[name],
29
29
  enumerable: true
30
30
  });
31
31
  }
32
- if (!no_symbols) {
32
+ if (!(flags & 1)) {
33
33
  __defProp(target, Symbol.toStringTag, { value: "Module" });
34
34
  }
35
- return target;
35
+ return flags & 2 ? target : Object.preventExtensions(target);
36
36
  };
37
37
 
38
38
  // source/errors.ts
@@ -12,6 +12,12 @@
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 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
+ */
15
21
  import * as v from "valibot";
16
22
  import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
17
23
  /**
@@ -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.mjs";
16
25
  import * as v from "valibot";
17
26
  import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
@@ -12,6 +12,12 @@
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 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
+ */
15
21
  import * as v from "valibot";
16
22
  import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
17
23
  /**
@@ -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.mjs";
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
  *
@@ -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 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
  /**
@@ -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 rma-view-buttons entrypoint. */
16
+ /**
17
+ * Request parsing, response builders, and ACL resource IDs for `commerce/backend-ui/2`
18
+ * return view buttons registered under `adminUi.rma.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 return 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.rma.viewButtons[].id` value.
29
+ * @returns The return view-button leaf ID, or an empty string when `metadataId` is blank.
30
+ * @example
31
+ * ```ts
32
+ * getRmaViewButtonAclResourceId("returns-app", "approve-return");
33
+ * // "Magento_CommerceBackendUix::adminuisdk_app_returns_app_rma_viewbuttons_approve_return"
34
+ * ```
35
+ */
36
+ export declare function getRmaViewButtonAclResourceId(metadataId: string, buttonId: string): string;
37
+ /**
38
+ * Schema for a return view-button worker request.
39
+ * `id` identifies the clicked button; `rmaId` identifies the return being viewed.
40
+ * All three fields must be non-empty strings.
41
+ */
42
+ export declare const RmaViewButtonRequestSchema: 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 requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
45
+ readonly rmaId: 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 return view-button worker. */
48
+ type RmaViewButtonRequest = v.InferOutput<typeof RmaViewButtonRequestSchema>;
49
+ /** Empty success body returned by a return view-button worker. */
50
+ type RmaViewButtonSuccessBody = Record<string, never>;
51
+ /** Error body returned by a return view-button worker. */
52
+ type RmaViewButtonErrorBody = {
53
+ message: string;
54
+ };
55
+ /**
56
+ * Parses a return view-button worker request.
57
+ * Throws `CommerceSdkValidationError` when the input is malformed.
58
+ * @example
59
+ * ```ts
60
+ * const { requestId, id, rmaId } = parseRmaViewButtonRequest(params);
61
+ * ```
62
+ */
63
+ export declare function parseRmaViewButtonRequest(input: unknown): RmaViewButtonRequest;
64
+ /** Builds an HTTP 200 response with an empty body for a return view-button worker. */
65
+ export declare function okRmaViewButtonResponse(): SuccessResponse<RmaViewButtonSuccessBody>;
66
+ /**
67
+ * Builds an error response for a return 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 rmaViewButtonErrorResponse(500, "Could not approve the return");
73
+ * ```
74
+ */
75
+ export declare function rmaViewButtonErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<RmaViewButtonErrorBody>;
76
+ export type { RmaViewButtonErrorBody, RmaViewButtonRequest, RmaViewButtonSuccessBody };
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { a as sanitizeSegment, r as getAclResourceId } from "../acl-resource-id-C4Is2i_h.mjs";
16
+ import { t as parseOrThrow } from "../utils-G-EDWmew.mjs";
17
+ import { t as normalizeViewButtonWorkerParams } from "../view-button-request-Cu7Qz7jY.mjs";
18
+ import { t as nonEmptyStringValueSchema } from "../schemas-Dftlsf98.mjs";
19
+ import * as v from "valibot";
20
+ import { buildErrorResponse, ok } from "@adobe/aio-commerce-lib-core/responses";
21
+
22
+ // source/rma-view-buttons/acl-resource-id.ts
23
+ /**
24
+ * Derives the Commerce ACL resource ID for a return 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.rma.viewButtons[].id` value.
29
+ * @returns The return view-button leaf ID, or an empty string when `metadataId` is blank.
30
+ * @example
31
+ * ```ts
32
+ * getRmaViewButtonAclResourceId("returns-app", "approve-return");
33
+ * // "Magento_CommerceBackendUix::adminuisdk_app_returns_app_rma_viewbuttons_approve_return"
34
+ * ```
35
+ */
36
+ function getRmaViewButtonAclResourceId(metadataId, buttonId) {
37
+ const appRoot = getAclResourceId(metadataId);
38
+ if (appRoot === "") return "";
39
+ return `${appRoot}_rma_viewbuttons_${sanitizeSegment(buttonId)}`;
40
+ }
41
+
42
+ // source/rma-view-buttons/schema.ts
43
+ /**
44
+ * Schema for a return view-button worker request.
45
+ * `id` identifies the clicked button; `rmaId` identifies the return being viewed.
46
+ * All three fields must be non-empty strings.
47
+ */
48
+ const RmaViewButtonRequestSchema = v.object({
49
+ id: nonEmptyStringValueSchema("id"),
50
+ requestId: nonEmptyStringValueSchema("requestId"),
51
+ rmaId: nonEmptyStringValueSchema("rmaId")
52
+ });
53
+
54
+ // source/rma-view-buttons/presets.ts
55
+ /**
56
+ * Parses a return view-button worker request.
57
+ * Throws `CommerceSdkValidationError` when the input is malformed.
58
+ * @example
59
+ * ```ts
60
+ * const { requestId, id, rmaId } = parseRmaViewButtonRequest(params);
61
+ * ```
62
+ */
63
+ function parseRmaViewButtonRequest(input) {
64
+ return parseOrThrow(RmaViewButtonRequestSchema, normalizeViewButtonWorkerParams(input), "Invalid return view button request");
65
+ }
66
+ /** Builds an HTTP 200 response with an empty body for a return view-button worker. */
67
+ function okRmaViewButtonResponse() {
68
+ return ok({ body: {} });
69
+ }
70
+ /**
71
+ * Builds an error response for a return view-button worker.
72
+ * @param statusCode - The HTTP status code to return.
73
+ * @param errorMessage - The message included in the response body.
74
+ * @example
75
+ * ```ts
76
+ * return rmaViewButtonErrorResponse(500, "Could not approve the return");
77
+ * ```
78
+ */
79
+ function rmaViewButtonErrorResponse(statusCode, errorMessage) {
80
+ return buildErrorResponse(statusCode, { body: { message: errorMessage } });
81
+ }
82
+
83
+ export { RmaViewButtonRequestSchema, getRmaViewButtonAclResourceId, okRmaViewButtonResponse, parseRmaViewButtonRequest, rmaViewButtonErrorResponse };
@@ -12,6 +12,11 @@
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 web entrypoint. */
16
+ /**
17
+ * Browser helpers for mounting `commerce/backend-ui/2` iframe apps.
18
+ * @packageDocumentation
19
+ */
15
20
  import { ReactNode } from "react";
16
21
  import { NavigateOptions, ToOptions } from "@tanstack/react-router";
17
22
  import { attach } from "@adobe/uix-guest";
@@ -94,6 +99,10 @@ type InvoiceViewButtonContext = {
94
99
  type CreditMemoViewButtonContext = {
95
100
  creditMemoId: string;
96
101
  };
102
+ /** The context shared with return (RMA) view-button extension points. */
103
+ type RmaViewButtonContext = {
104
+ rmaId: string;
105
+ };
97
106
  /**
98
107
  * Returns the current Commerce shared context. The guest connection is already established by
99
108
  * the time this can be called (see {@link SharedContextProvider}).
@@ -180,6 +189,18 @@ export declare function useInvoiceViewButtonContext(): Result<InvoiceViewButtonC
180
189
  * ```
181
190
  */
182
191
  export declare function useCreditMemoViewButtonContext(): Result<CreditMemoViewButtonContext>;
192
+ /**
193
+ * Returns the return (RMA) ID for a return view-button extension point.
194
+ * Reads `rmaId` from the page URL search parameters or hash-route query.
195
+ * Returns an error when the return ID is missing or blank.
196
+ * @example
197
+ * ```tsx
198
+ * const { data, error } = useRmaViewButtonContext();
199
+ * if (error) throw error;
200
+ * return <span>{data.rmaId}</span>;
201
+ * ```
202
+ */
203
+ export declare function useRmaViewButtonContext(): Result<RmaViewButtonContext>;
183
204
  /**
184
205
  * Returns typed helpers for interacting with the Commerce Admin host.
185
206
  *
@@ -246,4 +267,4 @@ type CreateExtensionAppOptions = {
246
267
  * ```
247
268
  */
248
269
  export declare function createExtensionApp({ menu, metadata, routes, root: customRoot }: CreateExtensionAppOptions): void;
249
- export type { CreateExtensionAppOptions, CreditMemoViewButtonContext, CustomerContext, ExtensionRoute, HostConnection, ImsContext, InvoiceViewButtonContext, MassActionContext, OrderViewButtonContext, SharedContext, StoreContext };
270
+ export type { CreateExtensionAppOptions, CreditMemoViewButtonContext, CustomerContext, ExtensionRoute, HostConnection, ImsContext, InvoiceViewButtonContext, MassActionContext, OrderViewButtonContext, RmaViewButtonContext, SharedContext, StoreContext };
@@ -49,6 +49,13 @@ function parseInvoiceId(href) {
49
49
  function parseCreditMemoId(href) {
50
50
  return parseViewButtonId(href, "creditMemoId");
51
51
  }
52
+ /**
53
+ * Extracts the return (RMA) ID from the given absolute URL.
54
+ * @param href - The URL to read the return ID from (typically `window.location.href`).
55
+ */
56
+ function parseRmaId(href) {
57
+ return parseViewButtonId(href, "rmaId");
58
+ }
52
59
  /** Reads a view-button identifier from the URL search parameters or hash-route query. */
53
60
  function parseViewButtonId(href, key) {
54
61
  const urlObj = new URL(href);
@@ -372,6 +379,24 @@ function useCreditMemoViewButtonContext() {
372
379
  return ok({ creditMemoId });
373
380
  }, []);
374
381
  }
382
+ /**
383
+ * Returns the return (RMA) ID for a return view-button extension point.
384
+ * Reads `rmaId` from the page URL search parameters or hash-route query.
385
+ * Returns an error when the return ID is missing or blank.
386
+ * @example
387
+ * ```tsx
388
+ * const { data, error } = useRmaViewButtonContext();
389
+ * if (error) throw error;
390
+ * return <span>{data.rmaId}</span>;
391
+ * ```
392
+ */
393
+ function useRmaViewButtonContext() {
394
+ return useMemo(() => {
395
+ const rmaId = parseRmaId(globalThis.location.href);
396
+ if (rmaId === null || rmaId.trim() === "") return error("Could not find a return ID. Is this frame running as a return view-button extension point?");
397
+ return ok({ rmaId });
398
+ }, []);
399
+ }
375
400
 
376
401
  // source/web/react/commerce/hooks/use-host-connection.ts
377
402
  /**
@@ -935,4 +960,4 @@ function createExtensionApp({ menu, metadata, routes = [], root: customRoot }) {
935
960
  }
936
961
  }
937
962
 
938
- export { createExtensionApp, useCommerce, useCreditMemoViewButtonContext, useCustomerContext, useHostConnection, useIms, useInvoiceViewButtonContext, useMassActionContext, useOrderViewButtonContext, useSharedContext, useStoreContext };
963
+ export { createExtensionApp, useCommerce, useCreditMemoViewButtonContext, useCustomerContext, useHostConnection, useIms, useInvoiceViewButtonContext, useMassActionContext, useOrderViewButtonContext, useRmaViewButtonContext, useSharedContext, useStoreContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aio-commerce-lib-admin-ui",
3
- "version": "1.3.0-beta-20261105172845",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "description": "A library to interact with the Adobe Commerce Admin UI SDK API",
6
6
  "keywords": [
@@ -102,6 +102,16 @@
102
102
  "default": "./dist/cjs/order-view-buttons/index.cjs"
103
103
  }
104
104
  },
105
+ "./rma-view-buttons": {
106
+ "import": {
107
+ "types": "./dist/es/rma-view-buttons/index.d.mts",
108
+ "default": "./dist/es/rma-view-buttons/index.mjs"
109
+ },
110
+ "require": {
111
+ "types": "./dist/cjs/rma-view-buttons/index.d.cts",
112
+ "default": "./dist/cjs/rma-view-buttons/index.cjs"
113
+ }
114
+ },
105
115
  "./web": {
106
116
  "browser": {
107
117
  "types": "./dist/es/web/index.d.mts",
@@ -121,8 +131,8 @@
121
131
  "README.md"
122
132
  ],
123
133
  "dependencies": {
124
- "@adobe/aio-commerce-lib-api": "1.4.1",
125
- "@adobe/aio-commerce-lib-core": "1.3.0",
134
+ "@adobe/aio-commerce-lib-api": "1.5.0",
135
+ "@adobe/aio-commerce-lib-core": "1.4.0",
126
136
  "@adobe/exc-app": "^1.4.20",
127
137
  "@adobe/uix-guest": "^1.0.3",
128
138
  "@tanstack/react-router": "^1.170.15",
@@ -131,12 +141,12 @@
131
141
  "valibot": "^1.1.0"
132
142
  },
133
143
  "devDependencies": {
134
- "@aio-commerce-sdk/common-utils": "0.2.7",
144
+ "@aio-commerce-sdk/common-utils": "0.3.0",
135
145
  "@aio-commerce-sdk/config-tsdown": "1.0.1",
136
146
  "@aio-commerce-sdk/config-typedoc": "1.0.0",
137
147
  "@aio-commerce-sdk/config-typescript": "1.0.0",
138
148
  "@aio-commerce-sdk/config-vitest": "1.0.0",
139
- "@aio-commerce-sdk/scripts": "0.1.1",
149
+ "@aio-commerce-sdk/scripts": "0.2.0",
140
150
  "@react-spectrum/s2": "^1.5.1",
141
151
  "@types/react": "^19.2.17",
142
152
  "@types/react-dom": "^19.2.3",
@@ -161,7 +171,7 @@
161
171
  }
162
172
  },
163
173
  "engines": {
164
- "node": ">=22 <=24"
174
+ "node": ">=22 <=26"
165
175
  },
166
176
  "publishConfig": {
167
177
  "access": "public",