@adobe/aio-commerce-lib-admin-ui 0.1.0 → 0.2.0-beta-20260714082406

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 (40) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/acl-resource-id-DBlYU0DE.d.cts +39 -0
  4. package/dist/cjs/acl-resource-id-D_hCU1Qg.cjs +69 -0
  5. package/dist/cjs/api/index.cjs +252 -0
  6. package/dist/cjs/api/index.d.cts +126 -0
  7. package/dist/cjs/grid-columns/index.cjs +151 -0
  8. package/dist/cjs/grid-columns/index.d.cts +146 -0
  9. package/dist/cjs/mass-actions/index.cjs +188 -0
  10. package/dist/cjs/mass-actions/index.d.cts +160 -0
  11. package/dist/cjs/menu/index.cjs +91 -0
  12. package/dist/cjs/menu/index.d.cts +63 -0
  13. package/dist/cjs/order-view-buttons/index.cjs +126 -0
  14. package/dist/cjs/order-view-buttons/index.d.cts +113 -0
  15. package/dist/cjs/rolldown-runtime-Cx6hovH8.cjs +67 -0
  16. package/dist/cjs/schemas-Ce10uBzN.cjs +41 -0
  17. package/dist/cjs/utils-B59fjd_w.cjs +39 -0
  18. package/dist/cjs/web/index.cjs +830 -0
  19. package/dist/cjs/web/index.d.cts +192 -0
  20. package/dist/es/acl-resource-id-DBlYU0DE.d.mts +39 -0
  21. package/dist/es/acl-resource-id-pryVxI_c.mjs +57 -0
  22. package/dist/es/api/index.d.mts +126 -0
  23. package/dist/es/api/index.mjs +262 -0
  24. package/dist/es/grid-columns/index.d.mts +146 -0
  25. package/dist/es/grid-columns/index.mjs +143 -0
  26. package/dist/es/mass-actions/index.d.mts +160 -0
  27. package/dist/es/mass-actions/index.mjs +178 -0
  28. package/dist/es/menu/index.d.mts +63 -0
  29. package/dist/es/menu/index.mjs +80 -0
  30. package/dist/es/order-view-buttons/index.d.mts +113 -0
  31. package/dist/es/order-view-buttons/index.mjs +119 -0
  32. package/dist/es/schemas-BFT8ys8P.mjs +34 -0
  33. package/dist/es/utils-COPGW1HO.mjs +32 -0
  34. package/dist/es/web/index.d.mts +192 -0
  35. package/dist/es/web/index.mjs +819 -0
  36. package/package.json +87 -10
  37. package/dist/cjs/index.cjs +0 -139
  38. package/dist/cjs/index.d.cts +0 -56
  39. package/dist/es/index.d.mts +0 -56
  40. package/dist/es/index.mjs +0 -114
@@ -0,0 +1,91 @@
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_acl_resource_id = require('../acl-resource-id-D_hCU1Qg.cjs');
17
+
18
+ //#region source/menu/acl-resource-id.ts
19
+ /**
20
+ * Derives the deterministic Commerce ACL resource id for a specific menu item.
21
+ *
22
+ * The id is assembled as: `getAclResourceId(metadataId)` + `"_menu_"` + sanitized `menuId`.
23
+ * Each segment is sanitized independently (trimmed, lowercased, non-`[a-z0-9_]` → `_`).
24
+ * `"Magento_CommerceBackendUix::adminuisdk_app_"` in the example is the fixed constant prefix
25
+ * (not a placeholder), and `"_menu_"` is the literal keyword separator for this component:
26
+ *
27
+ * @example
28
+ * ```
29
+ * getMenuAclResourceId("approval-dashboard-app", "approval_dashboard")
30
+ * // getAclResourceId("approval-dashboard-app") + "_menu_" + sanitize("approval_dashboard")
31
+ * // "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app" + "_menu_" + "approval_dashboard"
32
+ * // → "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app_menu_approval_dashboard"
33
+ * ```
34
+ *
35
+ * @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
36
+ * @param menuId - The menu item's `id` value from `adminUi.menu.id` (e.g. `"approval_dashboard"`).
37
+ * @returns The full Commerce ACL resource id for the menu leaf node, or an empty string
38
+ * when `metadataId` is blank.
39
+ */
40
+ function getMenuAclResourceId(metadataId, menuId) {
41
+ const appRoot = require_acl_resource_id.getAclResourceId(metadataId);
42
+ if (appRoot === "") return "";
43
+ return `${appRoot}_menu_${require_acl_resource_id.sanitizeSegment(menuId)}`;
44
+ }
45
+
46
+ //#endregion
47
+ //#region source/menu/paths.ts
48
+ /** Menu ID for "Catalog" in the Adobe Commerce admin */
49
+ const MENU_CATALOG = "catalog";
50
+ /** Menu ID for "Customers" in the Adobe Commerce admin */
51
+ const MENU_CUSTOMERS = "customers";
52
+ /** Menu ID for "Marketing" in the Adobe Commerce admin */
53
+ const MENU_MARKETING = "marketing";
54
+ /** Menu ID for "Content" in the Adobe Commerce admin */
55
+ const MENU_CONTENT = "content";
56
+ /** Menu ID for "Reports" in the Adobe Commerce admin */
57
+ const MENU_REPORTS = "reports";
58
+ /** Menu ID for "Sales" in the Adobe Commerce admin */
59
+ const MENU_SALES = "sales";
60
+ /** Menu ID for "Stores" in the Adobe Commerce admin */
61
+ const MENU_STORES = "stores";
62
+ /** Menu ID for "System" in the Adobe Commerce admin */
63
+ const MENU_SYSTEM = "system";
64
+ /** All Commerce Admin menus available for app attachment. */
65
+ const COMMERCE_MENUS = [
66
+ MENU_SALES,
67
+ MENU_CATALOG,
68
+ MENU_CUSTOMERS,
69
+ MENU_MARKETING,
70
+ MENU_CONTENT,
71
+ MENU_REPORTS,
72
+ MENU_STORES,
73
+ MENU_SYSTEM
74
+ ];
75
+ /** Returns true if the given string is a known Commerce Admin menu ID. */
76
+ function isCommerceMenu(menu) {
77
+ return COMMERCE_MENUS.includes(menu);
78
+ }
79
+
80
+ //#endregion
81
+ exports.COMMERCE_MENUS = COMMERCE_MENUS;
82
+ exports.MENU_CATALOG = MENU_CATALOG;
83
+ exports.MENU_CONTENT = MENU_CONTENT;
84
+ exports.MENU_CUSTOMERS = MENU_CUSTOMERS;
85
+ exports.MENU_MARKETING = MENU_MARKETING;
86
+ exports.MENU_REPORTS = MENU_REPORTS;
87
+ exports.MENU_SALES = MENU_SALES;
88
+ exports.MENU_STORES = MENU_STORES;
89
+ exports.MENU_SYSTEM = MENU_SYSTEM;
90
+ exports.getMenuAclResourceId = getMenuAclResourceId;
91
+ exports.isCommerceMenu = isCommerceMenu;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ //#region source/menu/acl-resource-id.d.ts
16
+ /**
17
+ * Derives the deterministic Commerce ACL resource id for a specific menu item.
18
+ *
19
+ * The id is assembled as: `getAclResourceId(metadataId)` + `"_menu_"` + sanitized `menuId`.
20
+ * Each segment is sanitized independently (trimmed, lowercased, non-`[a-z0-9_]` → `_`).
21
+ * `"Magento_CommerceBackendUix::adminuisdk_app_"` in the example is the fixed constant prefix
22
+ * (not a placeholder), and `"_menu_"` is the literal keyword separator for this component:
23
+ *
24
+ * @example
25
+ * ```
26
+ * getMenuAclResourceId("approval-dashboard-app", "approval_dashboard")
27
+ * // getAclResourceId("approval-dashboard-app") + "_menu_" + sanitize("approval_dashboard")
28
+ * // "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app" + "_menu_" + "approval_dashboard"
29
+ * // → "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app_menu_approval_dashboard"
30
+ * ```
31
+ *
32
+ * @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
33
+ * @param menuId - The menu item's `id` value from `adminUi.menu.id` (e.g. `"approval_dashboard"`).
34
+ * @returns The full Commerce ACL resource id for the menu leaf node, or an empty string
35
+ * when `metadataId` is blank.
36
+ */
37
+ declare function getMenuAclResourceId(metadataId: string, menuId: string): string;
38
+ //#endregion
39
+ //#region source/menu/paths.d.ts
40
+ /** Menu ID for "Catalog" in the Adobe Commerce admin */
41
+ declare const MENU_CATALOG = "catalog";
42
+ /** Menu ID for "Customers" in the Adobe Commerce admin */
43
+ declare const MENU_CUSTOMERS = "customers";
44
+ /** Menu ID for "Marketing" in the Adobe Commerce admin */
45
+ declare const MENU_MARKETING = "marketing";
46
+ /** Menu ID for "Content" in the Adobe Commerce admin */
47
+ declare const MENU_CONTENT = "content";
48
+ /** Menu ID for "Reports" in the Adobe Commerce admin */
49
+ declare const MENU_REPORTS = "reports";
50
+ /** Menu ID for "Sales" in the Adobe Commerce admin */
51
+ declare const MENU_SALES = "sales";
52
+ /** Menu ID for "Stores" in the Adobe Commerce admin */
53
+ declare const MENU_STORES = "stores";
54
+ /** Menu ID for "System" in the Adobe Commerce admin */
55
+ declare const MENU_SYSTEM = "system";
56
+ /** All Commerce Admin menus available for app attachment. */
57
+ declare const COMMERCE_MENUS: readonly ["sales", "catalog", "customers", "marketing", "content", "reports", "stores", "system"];
58
+ /** A union type of all known supported Commerce Admin menu IDs. */
59
+ type CommerceMenu = (typeof COMMERCE_MENUS)[number];
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 };
@@ -0,0 +1,126 @@
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-Cx6hovH8.cjs');
17
+ const require_acl_resource_id = require('../acl-resource-id-D_hCU1Qg.cjs');
18
+ const require_schemas = require('../schemas-Ce10uBzN.cjs');
19
+ const require_utils = require('../utils-B59fjd_w.cjs');
20
+ let valibot = require("valibot");
21
+ valibot = require_rolldown_runtime.__toESM(valibot, 1);
22
+ let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
23
+
24
+ //#region source/order-view-buttons/acl-resource-id.ts
25
+ /**
26
+ * Derives the deterministic Commerce ACL resource id for an order view button.
27
+ *
28
+ * View buttons exist only on the order entity, so no entity discriminator is needed.
29
+ * The id is assembled as: `getAclResourceId(metadataId)` + `"_order_viewbuttons_"` +
30
+ * sanitized `buttonId`. The `buttonId` is sanitized (trimmed, lowercased, non-`[a-z0-9_]` → `_`).
31
+ * `"Magento_CommerceBackendUix::adminuisdk_app_"` in the example is the fixed constant prefix
32
+ * (not a placeholder), and `"_order_viewbuttons_"` is the literal keyword separator for this component:
33
+ *
34
+ * @example
35
+ * ```
36
+ * getOrderViewButtonAclResourceId("approval-dashboard-app", "approve-order")
37
+ * // getAclResourceId("approval-dashboard-app") + "_order_viewbuttons_" + sanitize("approve-order")
38
+ * // "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app" + "_order_viewbuttons_" + "approve_order"
39
+ * // → "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app_order_viewbuttons_approve_order"
40
+ * ```
41
+ *
42
+ * @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
43
+ * @param buttonId - The button's `id` value from `adminUi.order.viewButtons[].id`.
44
+ * @returns The full Commerce ACL resource id for the view-button leaf node, or an empty string
45
+ * when `metadataId` is blank.
46
+ */
47
+ function getOrderViewButtonAclResourceId(metadataId, buttonId) {
48
+ const appRoot = require_acl_resource_id.getAclResourceId(metadataId);
49
+ if (appRoot === "") return "";
50
+ return `${appRoot}_order_viewbuttons_${require_acl_resource_id.sanitizeSegment(buttonId)}`;
51
+ }
52
+
53
+ //#endregion
54
+ //#region source/order-view-buttons/schema.ts
55
+ /**
56
+ * Schema for the JSON body Commerce POSTs to an order view button handler.
57
+ *
58
+ * `id` identifies the specific button that was clicked, letting a single
59
+ * handler serve multiple buttons by branching on it. `orderId` is the
60
+ * single order currently being viewed.
61
+ */
62
+ const OrderViewButtonRequestSchema = valibot.object({
63
+ id: require_schemas.nonEmptyStringValueSchema("id"),
64
+ orderId: require_schemas.nonEmptyStringValueSchema("orderId"),
65
+ requestId: require_schemas.nonEmptyStringValueSchema("requestId")
66
+ });
67
+
68
+ //#endregion
69
+ //#region source/order-view-buttons/presets.ts
70
+ /**
71
+ * Parses and validates the JSON body Commerce POSTs to an order view button handler.
72
+ *
73
+ * Throws a `CommerceSdkValidationError` if the input is malformed.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * import { parseOrderViewButtonRequest } from "@adobe/aio-commerce-lib-admin-ui/order-view-buttons";
78
+ *
79
+ * export async function main(params: unknown) {
80
+ * const { requestId, id, orderId } = parseOrderViewButtonRequest(params);
81
+ * // id identifies which button was clicked
82
+ * // orderId is the order currently being viewed
83
+ * // ...
84
+ * }
85
+ * ```
86
+ */
87
+ function parseOrderViewButtonRequest(input) {
88
+ return require_utils.parseOrThrow(OrderViewButtonRequestSchema, input, "Invalid order view button request");
89
+ }
90
+ /**
91
+ * Builds an HTTP 200 success response for an order view button handler.
92
+ *
93
+ * Commerce renders `notifications.success` from the registration as the
94
+ * toast body when present, and a default success toast otherwise.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * return okOrderViewButtonResponse();
99
+ * ```
100
+ */
101
+ function okOrderViewButtonResponse() {
102
+ return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: {} });
103
+ }
104
+ /**
105
+ * Builds an error response for a worker order view button handler with the given HTTP status code.
106
+ *
107
+ * Commerce uses the HTTP status code to distinguish success from failure.
108
+ *
109
+ * @param statusCode - The HTTP status code to return.
110
+ * @param errorMessage - Error message included in the response body as `{ message }`.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * return orderViewButtonErrorResponse(500, "Could not reach inventory service");
115
+ * ```
116
+ */
117
+ function orderViewButtonErrorResponse(statusCode, errorMessage) {
118
+ return (0, _adobe_aio_commerce_lib_core_responses.buildErrorResponse)(statusCode, { body: { message: errorMessage } });
119
+ }
120
+
121
+ //#endregion
122
+ exports.OrderViewButtonRequestSchema = OrderViewButtonRequestSchema;
123
+ exports.getOrderViewButtonAclResourceId = getOrderViewButtonAclResourceId;
124
+ exports.okOrderViewButtonResponse = okOrderViewButtonResponse;
125
+ exports.orderViewButtonErrorResponse = orderViewButtonErrorResponse;
126
+ exports.parseOrderViewButtonRequest = parseOrderViewButtonRequest;
@@ -0,0 +1,113 @@
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 * as v from "valibot";
16
+ import { ErrorResponse, SuccessResponse } from "@adobe/aio-commerce-lib-core/responses";
17
+
18
+ //#region source/order-view-buttons/acl-resource-id.d.ts
19
+ /**
20
+ * Derives the deterministic Commerce ACL resource id for an order view button.
21
+ *
22
+ * View buttons exist only on the order entity, so no entity discriminator is needed.
23
+ * The id is assembled as: `getAclResourceId(metadataId)` + `"_order_viewbuttons_"` +
24
+ * sanitized `buttonId`. The `buttonId` is sanitized (trimmed, lowercased, non-`[a-z0-9_]` → `_`).
25
+ * `"Magento_CommerceBackendUix::adminuisdk_app_"` in the example is the fixed constant prefix
26
+ * (not a placeholder), and `"_order_viewbuttons_"` is the literal keyword separator for this component:
27
+ *
28
+ * @example
29
+ * ```
30
+ * getOrderViewButtonAclResourceId("approval-dashboard-app", "approve-order")
31
+ * // getAclResourceId("approval-dashboard-app") + "_order_viewbuttons_" + sanitize("approve-order")
32
+ * // "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app" + "_order_viewbuttons_" + "approve_order"
33
+ * // → "Magento_CommerceBackendUix::adminuisdk_app_approval_dashboard_app_order_viewbuttons_approve_order"
34
+ * ```
35
+ *
36
+ * @param metadataId - The application's `metadata.id` value (e.g. `"approval-dashboard-app"`).
37
+ * @param buttonId - The button's `id` value from `adminUi.order.viewButtons[].id`.
38
+ * @returns The full Commerce ACL resource id for the view-button leaf node, or an empty string
39
+ * when `metadataId` is blank.
40
+ */
41
+ declare function getOrderViewButtonAclResourceId(metadataId: string, buttonId: string): string;
42
+ //#endregion
43
+ //#region source/order-view-buttons/schema.d.ts
44
+ /**
45
+ * Schema for the JSON body Commerce POSTs to an order view button handler.
46
+ *
47
+ * `id` identifies the specific button that was clicked, letting a single
48
+ * handler serve multiple buttons by branching on it. `orderId` is the
49
+ * single order currently being viewed.
50
+ */
51
+ declare const OrderViewButtonRequestSchema: v.ObjectSchema<{
52
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
53
+ readonly orderId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
54
+ readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
55
+ }, undefined>;
56
+ //#endregion
57
+ //#region source/order-view-buttons/types.d.ts
58
+ /** Parsed request body sent by Commerce to an order view button handler. */
59
+ type OrderViewButtonRequest = v.InferOutput<typeof OrderViewButtonRequestSchema>;
60
+ /** Success body returned to Commerce — an empty object signals success. */
61
+ type OrderViewButtonSuccessBody = Record<string, never>;
62
+ /** Failure body returned to Commerce when a worker order view button handler fails. */
63
+ type OrderViewButtonErrorBody = {
64
+ message: string;
65
+ };
66
+ //#endregion
67
+ //#region source/order-view-buttons/presets.d.ts
68
+ /**
69
+ * Parses and validates the JSON body Commerce POSTs to an order view button handler.
70
+ *
71
+ * Throws a `CommerceSdkValidationError` if the input is malformed.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { parseOrderViewButtonRequest } from "@adobe/aio-commerce-lib-admin-ui/order-view-buttons";
76
+ *
77
+ * export async function main(params: unknown) {
78
+ * const { requestId, id, orderId } = parseOrderViewButtonRequest(params);
79
+ * // id identifies which button was clicked
80
+ * // orderId is the order currently being viewed
81
+ * // ...
82
+ * }
83
+ * ```
84
+ */
85
+ declare function parseOrderViewButtonRequest(input: unknown): OrderViewButtonRequest;
86
+ /**
87
+ * Builds an HTTP 200 success response for an order view button handler.
88
+ *
89
+ * Commerce renders `notifications.success` from the registration as the
90
+ * toast body when present, and a default success toast otherwise.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * return okOrderViewButtonResponse();
95
+ * ```
96
+ */
97
+ declare function okOrderViewButtonResponse(): SuccessResponse<OrderViewButtonSuccessBody>;
98
+ /**
99
+ * Builds an error response for a worker order view button handler with the given HTTP status code.
100
+ *
101
+ * Commerce uses the HTTP status code to distinguish success from failure.
102
+ *
103
+ * @param statusCode - The HTTP status code to return.
104
+ * @param errorMessage - Error message included in the response body as `{ message }`.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * return orderViewButtonErrorResponse(500, "Could not reach inventory service");
109
+ * ```
110
+ */
111
+ declare function orderViewButtonErrorResponse(statusCode: number, errorMessage: string): ErrorResponse<OrderViewButtonErrorBody>;
112
+ //#endregion
113
+ export { type OrderViewButtonErrorBody, type OrderViewButtonRequest, OrderViewButtonRequestSchema, type OrderViewButtonSuccessBody, getOrderViewButtonAclResourceId, okOrderViewButtonResponse, orderViewButtonErrorResponse, parseOrderViewButtonRequest };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ //#region \0rolldown/runtime.js
16
+ var __create = Object.create;
17
+ var __defProp = Object.defineProperty;
18
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
19
+ var __getOwnPropNames = Object.getOwnPropertyNames;
20
+ var __getProtoOf = Object.getPrototypeOf;
21
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
22
+ var __exportAll = (all, no_symbols) => {
23
+ let target = {};
24
+ for (var name in all) {
25
+ __defProp(target, name, {
26
+ get: all[name],
27
+ enumerable: true
28
+ });
29
+ }
30
+ if (!no_symbols) {
31
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
32
+ }
33
+ return target;
34
+ };
35
+ var __copyProps = (to, from, except, desc) => {
36
+ if (from && typeof from === "object" || typeof from === "function") {
37
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
38
+ key = keys[i];
39
+ if (!__hasOwnProp.call(to, key) && key !== except) {
40
+ __defProp(to, key, {
41
+ get: ((k) => from[k]).bind(null, key),
42
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
43
+ });
44
+ }
45
+ }
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
50
+ value: mod,
51
+ enumerable: true
52
+ }) : target, mod));
53
+
54
+ //#endregion
55
+
56
+ Object.defineProperty(exports, '__exportAll', {
57
+ enumerable: true,
58
+ get: function () {
59
+ return __exportAll;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, '__toESM', {
63
+ enumerable: true,
64
+ get: function () {
65
+ return __toESM;
66
+ }
67
+ });
@@ -0,0 +1,41 @@
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-Cx6hovH8.cjs');
16
+ let valibot = require("valibot");
17
+ valibot = require_rolldown_runtime.__toESM(valibot, 1);
18
+
19
+ //#region ../../packages-private/common-utils/source/valibot/schemas.ts
20
+ /**
21
+ * A schema for a string value.
22
+ * @param name The name of the field this schema refers to.
23
+ */
24
+ function stringValueSchema(name) {
25
+ return valibot.string(`Expected a string value for '${name}'`);
26
+ }
27
+ /**
28
+ * A schema for a non-empty string value.
29
+ * @param name The name of the field this schema refers to.
30
+ */
31
+ function nonEmptyStringValueSchema(name) {
32
+ return valibot.pipe(stringValueSchema(name), valibot.nonEmpty(`The value of "${name}" must not be empty`));
33
+ }
34
+
35
+ //#endregion
36
+ Object.defineProperty(exports, 'nonEmptyStringValueSchema', {
37
+ enumerable: true,
38
+ get: function () {
39
+ return nonEmptyStringValueSchema;
40
+ }
41
+ });
@@ -0,0 +1,39 @@
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-Cx6hovH8.cjs');
16
+ let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
17
+ let valibot = require("valibot");
18
+ valibot = require_rolldown_runtime.__toESM(valibot, 1);
19
+
20
+ //#region ../../packages-private/common-utils/source/valibot/utils.ts
21
+ /**
22
+ * Parses the input using the provided schema and throws a {@link CommerceSdkValidationError} error if the input is invalid.
23
+ * @param schema - The schema to use for parsing.
24
+ * @param input - The input to parse.
25
+ * @param message - Optional custom error message for the validation error.
26
+ */
27
+ function parseOrThrow(schema, input, message) {
28
+ const result = valibot.safeParse(schema, input);
29
+ if (!result.success) throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(message ?? "Invalid input", { issues: result.issues });
30
+ return result.output;
31
+ }
32
+
33
+ //#endregion
34
+ Object.defineProperty(exports, 'parseOrThrow', {
35
+ enumerable: true,
36
+ get: function () {
37
+ return parseOrThrow;
38
+ }
39
+ });