@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
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@adobe/aio-commerce-lib-admin-ui",
3
3
  "type": "module",
4
4
  "author": "Adobe Inc.",
5
- "version": "0.1.0",
5
+ "version": "0.2.0-beta-20260714082406",
6
6
  "private": false,
7
7
  "engines": {
8
8
  "node": ">=22 <=24"
@@ -34,19 +34,71 @@
34
34
  "exports": {
35
35
  "./api": {
36
36
  "import": {
37
- "types": "./dist/es/index.d.mts",
38
- "default": "./dist/es/index.mjs"
37
+ "types": "./dist/es/api/index.d.mts",
38
+ "default": "./dist/es/api/index.mjs"
39
39
  },
40
40
  "require": {
41
- "types": "./dist/cjs/index.d.cts",
42
- "default": "./dist/cjs/index.cjs"
41
+ "types": "./dist/cjs/api/index.d.cts",
42
+ "default": "./dist/cjs/api/index.cjs"
43
+ }
44
+ },
45
+ "./grid-columns": {
46
+ "import": {
47
+ "types": "./dist/es/grid-columns/index.d.mts",
48
+ "default": "./dist/es/grid-columns/index.mjs"
49
+ },
50
+ "require": {
51
+ "types": "./dist/cjs/grid-columns/index.d.cts",
52
+ "default": "./dist/cjs/grid-columns/index.cjs"
53
+ }
54
+ },
55
+ "./mass-actions": {
56
+ "import": {
57
+ "types": "./dist/es/mass-actions/index.d.mts",
58
+ "default": "./dist/es/mass-actions/index.mjs"
59
+ },
60
+ "require": {
61
+ "types": "./dist/cjs/mass-actions/index.d.cts",
62
+ "default": "./dist/cjs/mass-actions/index.cjs"
63
+ }
64
+ },
65
+ "./menu": {
66
+ "import": {
67
+ "types": "./dist/es/menu/index.d.mts",
68
+ "default": "./dist/es/menu/index.mjs"
69
+ },
70
+ "require": {
71
+ "types": "./dist/cjs/menu/index.d.cts",
72
+ "default": "./dist/cjs/menu/index.cjs"
73
+ }
74
+ },
75
+ "./order-view-buttons": {
76
+ "import": {
77
+ "types": "./dist/es/order-view-buttons/index.d.mts",
78
+ "default": "./dist/es/order-view-buttons/index.mjs"
79
+ },
80
+ "require": {
81
+ "types": "./dist/cjs/order-view-buttons/index.d.cts",
82
+ "default": "./dist/cjs/order-view-buttons/index.cjs"
83
+ }
84
+ },
85
+ "./web": {
86
+ "browser": {
87
+ "types": "./dist/es/web/index.d.mts",
88
+ "default": "./dist/es/web/index.mjs"
89
+ },
90
+ "import": {
91
+ "types": "./dist/es/web/index.d.mts",
92
+ "default": "./dist/es/web/index.mjs"
43
93
  }
44
94
  },
45
95
  "./package.json": "./package.json"
46
96
  },
47
97
  "imports": {
48
98
  "#*": "./source/*.ts",
49
- "#test/*": "./test/*.ts"
99
+ "#*.tsx": "./source/*.tsx",
100
+ "#test/*": "./test/*.ts",
101
+ "#test/*.tsx": "./test/*.tsx"
50
102
  },
51
103
  "files": [
52
104
  "dist",
@@ -55,19 +107,44 @@
55
107
  "README.md"
56
108
  ],
57
109
  "dependencies": {
110
+ "@adobe/exc-app": "^1.4.20",
111
+ "@adobe/uix-guest": "^1.0.3",
112
+ "@tanstack/react-router": "^1.170.15",
58
113
  "ky": "^1.9.0",
114
+ "react-error-boundary": "^6.1.2",
59
115
  "valibot": "^1.1.0",
60
- "@adobe/aio-commerce-lib-api": "1.2.1",
61
- "@adobe/aio-commerce-lib-core": "1.1.1"
116
+ "@adobe/aio-commerce-lib-api": "1.3.0-beta-20260714082406",
117
+ "@adobe/aio-commerce-lib-core": "1.2.0-beta-20260714082406"
118
+ },
119
+ "peerDependencies": {
120
+ "@react-spectrum/s2": "^1.5.1",
121
+ "react": "^19.2.7",
122
+ "react-dom": "^19.2.7"
123
+ },
124
+ "peerDependenciesMeta": {
125
+ "@react-spectrum/s2": {
126
+ "optional": true
127
+ },
128
+ "react": {
129
+ "optional": true
130
+ },
131
+ "react-dom": {
132
+ "optional": true
133
+ }
62
134
  },
63
135
  "devDependencies": {
136
+ "@react-spectrum/s2": "^1.5.1",
137
+ "@types/react": "^19.2.17",
138
+ "@types/react-dom": "^19.2.3",
139
+ "react": "^19.2.7",
140
+ "react-dom": "^19.2.7",
64
141
  "typescript": "^6.0.0",
65
- "@aio-commerce-sdk/common-utils": "0.2.5",
142
+ "@aio-commerce-sdk/common-utils": "0.2.6-beta-20260714082406",
66
143
  "@aio-commerce-sdk/config-tsdown": "1.0.1",
67
144
  "@aio-commerce-sdk/config-typedoc": "1.0.0",
68
145
  "@aio-commerce-sdk/config-typescript": "1.0.0",
69
146
  "@aio-commerce-sdk/config-vitest": "1.0.0",
70
- "@aio-commerce-sdk/scripting-utils": "0.3.3",
147
+ "@aio-commerce-sdk/scripting-utils": "0.3.4-beta-20260714082406",
71
148
  "@aio-commerce-sdk/scripts": "0.1.0"
72
149
  },
73
150
  "sideEffects": false,
@@ -1,139 +0,0 @@
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
- //#region \0rolldown/runtime.js
17
- var __create = Object.create;
18
- var __defProp = Object.defineProperty;
19
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
20
- var __getOwnPropNames = Object.getOwnPropertyNames;
21
- var __getProtoOf = Object.getPrototypeOf;
22
- var __hasOwnProp = Object.prototype.hasOwnProperty;
23
- var __exportAll = (all, no_symbols) => {
24
- let target = {};
25
- for (var name in all) {
26
- __defProp(target, name, {
27
- get: all[name],
28
- enumerable: true
29
- });
30
- }
31
- if (!no_symbols) {
32
- __defProp(target, Symbol.toStringTag, { value: "Module" });
33
- }
34
- return target;
35
- };
36
- var __copyProps = (to, from, except, desc) => {
37
- if (from && typeof from === "object" || typeof from === "function") {
38
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
39
- key = keys[i];
40
- if (!__hasOwnProp.call(to, key) && key !== except) {
41
- __defProp(to, key, {
42
- get: ((k) => from[k]).bind(null, key),
43
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
- });
45
- }
46
- }
47
- }
48
- return to;
49
- };
50
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
51
- value: mod,
52
- enumerable: true
53
- }) : target, mod));
54
-
55
- //#endregion
56
- let _adobe_aio_commerce_lib_api = require("@adobe/aio-commerce-lib-api");
57
- let valibot = require("valibot");
58
- valibot = __toESM(valibot, 1);
59
- let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
60
-
61
- //#region ../../packages-private/common-utils/source/valibot/utils.ts
62
- /**
63
- * Parses the input using the provided schema and throws a {@link CommerceSdkValidationError} error if the input is invalid.
64
- * @param schema - The schema to use for parsing.
65
- * @param input - The input to parse.
66
- * @param message - Optional custom error message for the validation error.
67
- */
68
- function parseOrThrow(schema, input, message) {
69
- const result = valibot.safeParse(schema, input);
70
- if (!result.success) throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(message ?? "Invalid input", { issues: result.issues });
71
- return result.output;
72
- }
73
-
74
- //#endregion
75
- //#region source/api/extensions/schema.ts
76
- /** Parameters for POST /V1/adminuisdk/extension. */
77
- const ExtensionRegistrationParamsSchema = valibot.object({
78
- extensionName: valibot.pipe(valibot.string(), valibot.minLength(1)),
79
- extensionTitle: valibot.pipe(valibot.string(), valibot.minLength(1)),
80
- extensionUrl: valibot.pipe(valibot.string(), valibot.url()),
81
- extensionWorkspace: valibot.pipe(valibot.string(), valibot.minLength(1))
82
- });
83
- /** Parameters for DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */
84
- const UnregisterExtensionParamsSchema = valibot.object({
85
- workspaceName: valibot.pipe(valibot.string(), valibot.minLength(1)),
86
- extensionName: valibot.pipe(valibot.string(), valibot.minLength(1))
87
- });
88
-
89
- //#endregion
90
- //#region source/api/extensions/endpoints.ts
91
- var endpoints_exports = /* @__PURE__ */ __exportAll({
92
- registerExtension: () => registerExtension,
93
- unregisterExtension: () => unregisterExtension
94
- });
95
- /**
96
- * Registers an Admin UI extension with Commerce via POST /V1/adminuisdk/extension.
97
- *
98
- * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
99
- * @param params - The extension registration parameters.
100
- * @param fetchOptions - Optional Ky fetch options.
101
- *
102
- * @throws A `CommerceSdkValidationError` if the parameters are invalid.
103
- * @throws An `HTTPError` if the status code is not 2XX.
104
- */
105
- async function registerExtension(httpClient, params, fetchOptions) {
106
- const extension = parseOrThrow(ExtensionRegistrationParamsSchema, params);
107
- return httpClient.post("adminuisdk/extension", {
108
- ...fetchOptions,
109
- json: { extension }
110
- }).json();
111
- }
112
- /**
113
- * Unregisters an Admin UI extension from Commerce via DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}.
114
- *
115
- * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
116
- * @param params - The workspace and extension names.
117
- * @param fetchOptions - Optional Ky fetch options.
118
- *
119
- * @throws A `CommerceSdkValidationError` if the parameters are invalid.
120
- * @throws An `HTTPError` if the status code is not 2XX.
121
- */
122
- async function unregisterExtension(httpClient, params, fetchOptions) {
123
- const { workspaceName, extensionName } = parseOrThrow(UnregisterExtensionParamsSchema, params);
124
- return httpClient.delete(`adminuisdk/extension/${workspaceName}/${extensionName}`, fetchOptions).then((_res) => {});
125
- }
126
-
127
- //#endregion
128
- //#region source/lib/api-client.ts
129
- /**
130
- * Creates a new API client for the Admin UI API with all available operations.
131
- *
132
- * @param params - The parameters to build the Commerce HTTP client.
133
- */
134
- function createAdminUiApiClient(params) {
135
- return _adobe_aio_commerce_lib_api.ApiClient.create(new _adobe_aio_commerce_lib_api.AdobeCommerceHttpClient(params), { ...endpoints_exports });
136
- }
137
-
138
- //#endregion
139
- exports.createAdminUiApiClient = createAdminUiApiClient;
@@ -1,56 +0,0 @@
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 { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
16
- import * as v from "valibot";
17
-
18
- //#region source/lib/api-client.d.ts
19
- /**
20
- * Creates a new API client for the Admin UI API with all available operations.
21
- *
22
- * @param params - The parameters to build the Commerce HTTP client.
23
- */
24
- declare function createAdminUiApiClient(params: CommerceHttpClientParams): import("@adobe/aio-commerce-lib-api").ApiClientRecord<AdobeCommerceHttpClient, {
25
- registerExtension(httpClient: AdobeCommerceHttpClient, params: ExtensionRegistrationParams, fetchOptions?: import("ky").Options): Promise<RegisterExtensionResponse>;
26
- unregisterExtension(httpClient: AdobeCommerceHttpClient, params: UnregisterExtensionParams, fetchOptions?: import("ky").Options): Promise<void>;
27
- }>;
28
- /**
29
- * An API client for the Admin UI API with all operations.
30
- * @see {@link createAdminUiApiClient}
31
- */
32
- type AdminUiApiClient = ReturnType<typeof createAdminUiApiClient>;
33
- //#endregion
34
- //#region source/api/extensions/schema.d.ts
35
- /** Parameters for POST /V1/adminuisdk/extension. */
36
- declare const ExtensionRegistrationParamsSchema: v.ObjectSchema<{
37
- readonly extensionName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
38
- readonly extensionTitle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
39
- readonly extensionUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>]>;
40
- readonly extensionWorkspace: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
41
- }, undefined>;
42
- /** Parameters for DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */
43
- declare const UnregisterExtensionParamsSchema: v.ObjectSchema<{
44
- readonly workspaceName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
45
- readonly extensionName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
46
- }, undefined>;
47
- /** The parameters accepted by POST /V1/adminuisdk/extension. */
48
- type ExtensionRegistrationParams = v.InferInput<typeof ExtensionRegistrationParamsSchema>;
49
- /** The parameters accepted by DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */
50
- type UnregisterExtensionParams = v.InferInput<typeof UnregisterExtensionParamsSchema>;
51
- /** The response returned by POST /V1/adminuisdk/extension. */
52
- type RegisterExtensionResponse = {
53
- extensionId: string;
54
- };
55
- //#endregion
56
- export { AdminUiApiClient, type ExtensionRegistrationParams, type ExtensionRegistrationParamsSchema, type RegisterExtensionResponse, type UnregisterExtensionParams, type UnregisterExtensionParamsSchema, createAdminUiApiClient };
@@ -1,56 +0,0 @@
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 { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
16
- import * as v from "valibot";
17
-
18
- //#region source/lib/api-client.d.ts
19
- /**
20
- * Creates a new API client for the Admin UI API with all available operations.
21
- *
22
- * @param params - The parameters to build the Commerce HTTP client.
23
- */
24
- declare function createAdminUiApiClient(params: CommerceHttpClientParams): import("@adobe/aio-commerce-lib-api").ApiClientRecord<AdobeCommerceHttpClient, {
25
- registerExtension(httpClient: AdobeCommerceHttpClient, params: ExtensionRegistrationParams, fetchOptions?: import("ky").Options): Promise<RegisterExtensionResponse>;
26
- unregisterExtension(httpClient: AdobeCommerceHttpClient, params: UnregisterExtensionParams, fetchOptions?: import("ky").Options): Promise<void>;
27
- }>;
28
- /**
29
- * An API client for the Admin UI API with all operations.
30
- * @see {@link createAdminUiApiClient}
31
- */
32
- type AdminUiApiClient = ReturnType<typeof createAdminUiApiClient>;
33
- //#endregion
34
- //#region source/api/extensions/schema.d.ts
35
- /** Parameters for POST /V1/adminuisdk/extension. */
36
- declare const ExtensionRegistrationParamsSchema: v.ObjectSchema<{
37
- readonly extensionName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
38
- readonly extensionTitle: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
39
- readonly extensionUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>]>;
40
- readonly extensionWorkspace: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
41
- }, undefined>;
42
- /** Parameters for DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */
43
- declare const UnregisterExtensionParamsSchema: v.ObjectSchema<{
44
- readonly workspaceName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
45
- readonly extensionName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
46
- }, undefined>;
47
- /** The parameters accepted by POST /V1/adminuisdk/extension. */
48
- type ExtensionRegistrationParams = v.InferInput<typeof ExtensionRegistrationParamsSchema>;
49
- /** The parameters accepted by DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */
50
- type UnregisterExtensionParams = v.InferInput<typeof UnregisterExtensionParamsSchema>;
51
- /** The response returned by POST /V1/adminuisdk/extension. */
52
- type RegisterExtensionResponse = {
53
- extensionId: string;
54
- };
55
- //#endregion
56
- export { AdminUiApiClient, type ExtensionRegistrationParams, type ExtensionRegistrationParamsSchema, type RegisterExtensionResponse, type UnregisterExtensionParams, type UnregisterExtensionParamsSchema, createAdminUiApiClient };
package/dist/es/index.mjs DELETED
@@ -1,114 +0,0 @@
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 { AdobeCommerceHttpClient, ApiClient } from "@adobe/aio-commerce-lib-api";
16
- import * as v from "valibot";
17
- import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
18
-
19
- //#region \0rolldown/runtime.js
20
- var __defProp = Object.defineProperty;
21
- var __exportAll = (all, no_symbols) => {
22
- let target = {};
23
- for (var name in all) {
24
- __defProp(target, name, {
25
- get: all[name],
26
- enumerable: true
27
- });
28
- }
29
- if (!no_symbols) {
30
- __defProp(target, Symbol.toStringTag, { value: "Module" });
31
- }
32
- return target;
33
- };
34
-
35
- //#endregion
36
- //#region ../../packages-private/common-utils/source/valibot/utils.ts
37
- /**
38
- * Parses the input using the provided schema and throws a {@link CommerceSdkValidationError} error if the input is invalid.
39
- * @param schema - The schema to use for parsing.
40
- * @param input - The input to parse.
41
- * @param message - Optional custom error message for the validation error.
42
- */
43
- function parseOrThrow(schema, input, message) {
44
- const result = v.safeParse(schema, input);
45
- if (!result.success) throw new CommerceSdkValidationError(message ?? "Invalid input", { issues: result.issues });
46
- return result.output;
47
- }
48
-
49
- //#endregion
50
- //#region source/api/extensions/schema.ts
51
- /** Parameters for POST /V1/adminuisdk/extension. */
52
- const ExtensionRegistrationParamsSchema = v.object({
53
- extensionName: v.pipe(v.string(), v.minLength(1)),
54
- extensionTitle: v.pipe(v.string(), v.minLength(1)),
55
- extensionUrl: v.pipe(v.string(), v.url()),
56
- extensionWorkspace: v.pipe(v.string(), v.minLength(1))
57
- });
58
- /** Parameters for DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */
59
- const UnregisterExtensionParamsSchema = v.object({
60
- workspaceName: v.pipe(v.string(), v.minLength(1)),
61
- extensionName: v.pipe(v.string(), v.minLength(1))
62
- });
63
-
64
- //#endregion
65
- //#region source/api/extensions/endpoints.ts
66
- var endpoints_exports = /* @__PURE__ */ __exportAll({
67
- registerExtension: () => registerExtension,
68
- unregisterExtension: () => unregisterExtension
69
- });
70
- /**
71
- * Registers an Admin UI extension with Commerce via POST /V1/adminuisdk/extension.
72
- *
73
- * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
74
- * @param params - The extension registration parameters.
75
- * @param fetchOptions - Optional Ky fetch options.
76
- *
77
- * @throws A `CommerceSdkValidationError` if the parameters are invalid.
78
- * @throws An `HTTPError` if the status code is not 2XX.
79
- */
80
- async function registerExtension(httpClient, params, fetchOptions) {
81
- const extension = parseOrThrow(ExtensionRegistrationParamsSchema, params);
82
- return httpClient.post("adminuisdk/extension", {
83
- ...fetchOptions,
84
- json: { extension }
85
- }).json();
86
- }
87
- /**
88
- * Unregisters an Admin UI extension from Commerce via DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}.
89
- *
90
- * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
91
- * @param params - The workspace and extension names.
92
- * @param fetchOptions - Optional Ky fetch options.
93
- *
94
- * @throws A `CommerceSdkValidationError` if the parameters are invalid.
95
- * @throws An `HTTPError` if the status code is not 2XX.
96
- */
97
- async function unregisterExtension(httpClient, params, fetchOptions) {
98
- const { workspaceName, extensionName } = parseOrThrow(UnregisterExtensionParamsSchema, params);
99
- return httpClient.delete(`adminuisdk/extension/${workspaceName}/${extensionName}`, fetchOptions).then((_res) => {});
100
- }
101
-
102
- //#endregion
103
- //#region source/lib/api-client.ts
104
- /**
105
- * Creates a new API client for the Admin UI API with all available operations.
106
- *
107
- * @param params - The parameters to build the Commerce HTTP client.
108
- */
109
- function createAdminUiApiClient(params) {
110
- return ApiClient.create(new AdobeCommerceHttpClient(params), { ...endpoints_exports });
111
- }
112
-
113
- //#endregion
114
- export { createAdminUiApiClient };