@adobe/aio-commerce-lib-app 1.1.0 → 1.2.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 (40) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/actions/app-config.cjs +1 -1
  3. package/dist/cjs/actions/app-config.d.cts +3 -3
  4. package/dist/cjs/actions/config.cjs +1 -1
  5. package/dist/cjs/actions/config.d.cts +2 -2
  6. package/dist/cjs/actions/installation.cjs +1 -1
  7. package/dist/cjs/actions/installation.d.cts +4 -4
  8. package/dist/cjs/actions/scope-tree.d.cts +3 -3
  9. package/dist/cjs/{app-lymFcs59.d.cts → app-DcQMhW2N.d.cts} +13 -1
  10. package/dist/cjs/commands/index.cjs +3 -3
  11. package/dist/cjs/config/index.cjs +3 -3
  12. package/dist/cjs/config/index.d.cts +39 -3
  13. package/dist/cjs/{config-YEeaEqzi.cjs → config-BppBKCFj.cjs} +1 -1
  14. package/dist/{es/index-D33OCH0D.d.mts → cjs/index-DZxladgt.d.cts} +23 -8
  15. package/dist/cjs/management/index.cjs +1 -1
  16. package/dist/cjs/management/index.d.cts +1 -1
  17. package/dist/cjs/{management-PZtLe4Ji.cjs → management-iLQubQ7K.cjs} +93 -20
  18. package/dist/cjs/{validate-CwwYD8aC.cjs → validate-CeUCT_7k.cjs} +7 -3
  19. package/dist/cjs/{webhooks-CbZpv9y_.cjs → webhooks-CLtDxwMa.cjs} +33 -0
  20. package/dist/es/actions/app-config.d.mts +3 -3
  21. package/dist/es/actions/app-config.mjs +1 -1
  22. package/dist/es/actions/config.d.mts +2 -2
  23. package/dist/es/actions/config.mjs +2 -2
  24. package/dist/es/actions/installation.d.mts +4 -4
  25. package/dist/es/actions/installation.mjs +2 -2
  26. package/dist/es/actions/scope-tree.d.mts +3 -3
  27. package/dist/es/actions/scope-tree.mjs +1 -1
  28. package/dist/es/{app-Ct7Y0NP8.d.mts → app-DJr-mN9d.d.mts} +13 -1
  29. package/dist/es/commands/index.mjs +3 -3
  30. package/dist/es/config/index.d.mts +39 -3
  31. package/dist/es/config/index.mjs +3 -3
  32. package/dist/es/{config-BbrkH0Xt.mjs → config-BohwKkQS.mjs} +1 -1
  33. package/dist/{cjs/index-DRhLtRrX.d.cts → es/index-BmYXe7kp.d.mts} +23 -8
  34. package/dist/es/management/index.d.mts +1 -1
  35. package/dist/es/management/index.mjs +1 -1
  36. package/dist/es/{management-CIoVWirU.mjs → management-DSexEPTW.mjs} +93 -20
  37. package/dist/es/{validate-qRpfubPo.mjs → validate-CqJdGzyZ.mjs} +8 -4
  38. package/dist/es/{webhooks-NgM6k3_r.mjs → webhooks-CYo-pqbR.mjs} +23 -2
  39. package/package.json +4 -3
  40. /package/dist/es/{schemas-BvPxQwgQ.mjs → schemas-CVXHgUhv.mjs} +0 -0
@@ -16,6 +16,27 @@ const require_schemas = require('./schemas-nkIxa8sL.cjs');
16
16
  let valibot = require("valibot");
17
17
  valibot = require_schemas.__toESM(valibot);
18
18
 
19
+ //#region source/config/schema/admin-ui-sdk.ts
20
+ /**
21
+ * Schema for the Admin UI SDK registration parameters (for the `adminUiSdk.registration` config section).
22
+ * @see https://developer.adobe.com/commerce/extensibility/admin-ui-sdk/extension-points/ for more details.
23
+ */
24
+ const AdminUiSdkRegistrationSchema = valibot.object({ menuItems: valibot.array(valibot.object({
25
+ id: valibot.string(),
26
+ title: valibot.optional(valibot.string()),
27
+ parent: valibot.optional(valibot.string()),
28
+ sortOrder: valibot.optional(valibot.number()),
29
+ sandbox: valibot.optional(valibot.string()),
30
+ isSection: valibot.optional(valibot.boolean())
31
+ })) });
32
+ /** Schema for Admin UI SDK configuration. */
33
+ const AdminUiSdkSchema = valibot.object({ registration: AdminUiSdkRegistrationSchema });
34
+ /** Check if config has Admin UI SDK registration configuration. */
35
+ function hasAdminUiSdk(config) {
36
+ return config.adminUiSdk !== void 0 && config.adminUiSdk.registration !== void 0;
37
+ }
38
+
39
+ //#endregion
19
40
  //#region source/config/schema/eventing.ts
20
41
  const MAX_DESCRIPTION_LENGTH$1 = 255;
21
42
  const MAX_LABEL_LENGTH = 100;
@@ -291,6 +312,12 @@ function hasWebhooks(config) {
291
312
  }
292
313
 
293
314
  //#endregion
315
+ Object.defineProperty(exports, 'AdminUiSdkSchema', {
316
+ enumerable: true,
317
+ get: function () {
318
+ return AdminUiSdkSchema;
319
+ }
320
+ });
294
321
  Object.defineProperty(exports, 'EventingSchema', {
295
322
  enumerable: true,
296
323
  get: function () {
@@ -309,6 +336,12 @@ Object.defineProperty(exports, 'WebhooksSchema', {
309
336
  return WebhooksSchema;
310
337
  }
311
338
  });
339
+ Object.defineProperty(exports, 'hasAdminUiSdk', {
340
+ enumerable: true,
341
+ get: function () {
342
+ return hasAdminUiSdk;
343
+ }
344
+ });
312
345
  Object.defineProperty(exports, 'hasCommerceEvents', {
313
346
  enumerable: true,
314
347
  get: function () {
@@ -12,8 +12,8 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as CommerceAppConfigOutputModel } from "../app-Ct7Y0NP8.mjs";
16
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
15
+ import { n as CommerceAppConfigOutputModel } from "../app-DJr-mN9d.mjs";
16
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
17
17
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
18
18
 
19
19
  //#region source/actions/app-config.d.ts
@@ -24,6 +24,6 @@ type RuntimeActionFactoryArgs = {
24
24
  /** Factory to create the route handler for the `app-config` action. */
25
25
  declare const appConfigRuntimeAction: ({
26
26
  appConfig
27
- }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
27
+ }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
28
28
  //#endregion
29
29
  export { appConfigRuntimeAction };
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
16
- import { t as validateCommerceAppConfig } from "../validate-qRpfubPo.mjs";
16
+ import { t as validateCommerceAppConfig } from "../validate-CqJdGzyZ.mjs";
17
17
  import { ok } from "@adobe/aio-commerce-lib-core/responses";
18
18
 
19
19
  //#region source/actions/app-config.ts
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
15
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
16
16
  import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
17
17
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
18
18
 
@@ -24,6 +24,6 @@ type ConfigActionFactoryArgs = {
24
24
  /** Factory to create the route handler for the `config` action. */
25
25
  declare const configRuntimeAction: ({
26
26
  configSchema
27
- }: ConfigActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
27
+ }: ConfigActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
28
28
  //#endregion
29
29
  export { configRuntimeAction };
@@ -13,8 +13,8 @@
13
13
  */
14
14
 
15
15
  import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
16
- import { n as validateCommerceAppConfigDomain } from "../validate-qRpfubPo.mjs";
17
- import { r as nonEmptyStringValueSchema } from "../schemas-BvPxQwgQ.mjs";
16
+ import { n as validateCommerceAppConfigDomain } from "../validate-CqJdGzyZ.mjs";
17
+ import { r as nonEmptyStringValueSchema } from "../schemas-CVXHgUhv.mjs";
18
18
  import { ok } from "@adobe/aio-commerce-lib-core/responses";
19
19
  import * as v from "valibot";
20
20
  import { byScopeId, getConfiguration, initialize, setConfiguration } from "@adobe/aio-commerce-lib-config";
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as CommerceAppConfigOutputModel } from "../app-Ct7Y0NP8.mjs";
16
- import { V as InstallationContext } from "../index-D33OCH0D.mjs";
17
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
15
+ import { n as CommerceAppConfigOutputModel } from "../app-DJr-mN9d.mjs";
16
+ import { V as InstallationContext } from "../index-BmYXe7kp.mjs";
17
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
18
18
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
19
19
 
20
20
  //#region source/actions/installation.d.ts
@@ -28,6 +28,6 @@ type RuntimeActionFactoryArgs = {
28
28
  declare const installationRuntimeAction: ({
29
29
  appConfig,
30
30
  customScriptsLoader
31
- }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
31
+ }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
32
32
  //#endregion
33
33
  export { installationRuntimeAction };
@@ -13,8 +13,8 @@
13
13
  */
14
14
 
15
15
  import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
16
- import { r as nonEmptyStringValueSchema } from "../schemas-BvPxQwgQ.mjs";
17
- import { a as isCompletedState, c as isSucceededState, n as runInstallation, o as isFailedState, r as runValidation, s as isInProgressState, t as createInitialInstallationState } from "../management-CIoVWirU.mjs";
16
+ import { r as nonEmptyStringValueSchema } from "../schemas-CVXHgUhv.mjs";
17
+ import { a as isCompletedState, c as isSucceededState, n as runInstallation, o as isFailedState, r as runValidation, s as isInProgressState, t as createInitialInstallationState } from "../management-DSexEPTW.mjs";
18
18
  import { accepted, badRequest, conflict, internalServerError, noContent, ok } from "@adobe/aio-commerce-lib-core/responses";
19
19
  import * as v from "valibot";
20
20
  import { object, string } from "valibot";
@@ -12,11 +12,11 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
16
- import * as _adobe_aio_commerce_lib_core_params0 from "@adobe/aio-commerce-lib-core/params";
15
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
16
+ import * as _$_adobe_aio_commerce_lib_core_params0 from "@adobe/aio-commerce-lib-core/params";
17
17
 
18
18
  //#region source/actions/scope-tree.d.ts
19
19
  /** The handler method for the `scope-tree` action. */
20
- declare const scopeTreeRuntimeAction: (args: _adobe_aio_commerce_lib_core_params0.RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
20
+ declare const scopeTreeRuntimeAction: (args: _$_adobe_aio_commerce_lib_core_params0.RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
21
21
  //#endregion
22
22
  export { scopeTreeRuntimeAction };
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
16
- import { r as nonEmptyStringValueSchema } from "../schemas-BvPxQwgQ.mjs";
16
+ import { r as nonEmptyStringValueSchema } from "../schemas-CVXHgUhv.mjs";
17
17
  import { t as inspect } from "../logging-XIUXDK5T.mjs";
18
18
  import { internalServerError, nonAuthoritativeInformation, ok } from "@adobe/aio-commerce-lib-core/responses";
19
19
  import * as v from "valibot";
@@ -18,7 +18,7 @@ import * as v from "valibot";
18
18
  /** The schema used to validate the commerce app config file. */
19
19
  declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
20
20
  readonly metadata: v.ObjectSchema<{
21
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
21
+ readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 100, "The application id must not be longer than 100 characters">]>;
22
22
  readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
23
23
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
24
24
  readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')">]>;
@@ -171,6 +171,18 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
171
171
  }, undefined>, "Expected an array of external events">;
172
172
  }, undefined>, "Expected an array of external event sources">, undefined>;
173
173
  }, undefined>, undefined>;
174
+ readonly adminUiSdk: v.OptionalSchema<v.ObjectSchema<{
175
+ readonly registration: v.ObjectSchema<{
176
+ readonly menuItems: v.ArraySchema<v.ObjectSchema<{
177
+ readonly id: v.StringSchema<undefined>;
178
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
179
+ readonly parent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
180
+ readonly sortOrder: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
181
+ readonly sandbox: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
182
+ readonly isSection: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
183
+ }, undefined>, undefined>;
184
+ }, undefined>;
185
+ }, undefined>, undefined>;
174
186
  readonly installation: v.OptionalSchema<v.ObjectSchema<{
175
187
  readonly messages: v.OptionalSchema<v.ObjectSchema<{
176
188
  readonly preInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The preInstallation message must not be longer than 1000 characters">]>, undefined>;
@@ -13,9 +13,9 @@
13
13
  * governing permissions and limitations under the License.
14
14
  */
15
15
 
16
- import { c as hasBusinessConfigSchema, i as getConfigDomains, t as validateCommerceAppConfig } from "../validate-qRpfubPo.mjs";
17
- import { a as hasCustomInstallationSteps } from "../webhooks-NgM6k3_r.mjs";
18
- import { a as findNearestPackageJson, c as isESM, i as detectPackageManager, l as makeOutputDirFor, n as readCommerceAppConfig, o as getExecCommand, s as getProjectRootDirectory, t as parseCommerceAppConfig, u as readPackageJson } from "../config-BbrkH0Xt.mjs";
16
+ import { a as hasCustomInstallationSteps } from "../webhooks-CYo-pqbR.mjs";
17
+ import { c as hasBusinessConfigSchema, i as getConfigDomains, t as validateCommerceAppConfig } from "../validate-CqJdGzyZ.mjs";
18
+ import { a as findNearestPackageJson, c as isESM, i as detectPackageManager, l as makeOutputDirFor, n as readCommerceAppConfig, o as getExecCommand, s as getProjectRootDirectory, t as parseCommerceAppConfig, u as readPackageJson } from "../config-BohwKkQS.mjs";
19
19
  import { t as stringifyError } from "../error-DHlYzkbb.mjs";
20
20
  import { t as inspect } from "../logging-XIUXDK5T.mjs";
21
21
  import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as CommerceAppConfigOutputModel, t as CommerceAppConfig } from "../app-Ct7Y0NP8.mjs";
15
+ import { n as CommerceAppConfigOutputModel, t as CommerceAppConfig } from "../app-DJr-mN9d.mjs";
16
16
  import * as v from "valibot";
17
17
  import { Get, SetRequiredDeep } from "type-fest";
18
18
 
@@ -134,6 +134,18 @@ declare function defineConfig(config: CommerceAppConfig): {
134
134
  }[];
135
135
  }[] | undefined;
136
136
  } | undefined;
137
+ adminUiSdk?: {
138
+ registration: {
139
+ menuItems: {
140
+ id: string;
141
+ title?: string | undefined;
142
+ parent?: string | undefined;
143
+ sortOrder?: number | undefined;
144
+ sandbox?: string | undefined;
145
+ isSection?: boolean | undefined;
146
+ }[];
147
+ };
148
+ } | undefined;
137
149
  installation?: {
138
150
  messages?: {
139
151
  preInstallation?: string | undefined;
@@ -355,6 +367,18 @@ declare function parseCommerceAppConfig(cwd?: string): Promise<{
355
367
  }[];
356
368
  }[] | undefined;
357
369
  } | undefined;
370
+ adminUiSdk?: {
371
+ registration: {
372
+ menuItems: {
373
+ id: string;
374
+ title?: string | undefined;
375
+ parent?: string | undefined;
376
+ sortOrder?: number | undefined;
377
+ sandbox?: string | undefined;
378
+ isSection?: boolean | undefined;
379
+ }[];
380
+ };
381
+ } | undefined;
358
382
  installation?: {
359
383
  messages?: {
360
384
  preInstallation?: string | undefined;
@@ -440,7 +464,7 @@ declare function parseCommerceAppConfig(cwd?: string): Promise<{
440
464
  /** The individual validatable domains of the app config. */
441
465
  declare const CommerceAppConfigSchemas: {
442
466
  readonly metadata: v.ObjectSchema<{
443
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
467
+ readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 100, "The application id must not be longer than 100 characters">]>;
444
468
  readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
445
469
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
446
470
  readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')">]>;
@@ -888,6 +912,18 @@ declare const CommerceAppConfigSchemas: {
888
912
  readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step name must not be longer than 255 characters">]>;
889
913
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step description must not be longer than 255 characters">]>;
890
914
  }, undefined>, "Expected an array of custom installation steps">;
915
+ readonly adminUiSdk: v.ObjectSchema<{
916
+ readonly registration: v.ObjectSchema<{
917
+ readonly menuItems: v.ArraySchema<v.ObjectSchema<{
918
+ readonly id: v.StringSchema<undefined>;
919
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
920
+ readonly parent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
921
+ readonly sortOrder: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
922
+ readonly sandbox: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
923
+ readonly isSection: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
924
+ }, undefined>, undefined>;
925
+ }, undefined>;
926
+ }, undefined>;
891
927
  };
892
928
  /** Individual validatable domains of the commerce app config. */
893
929
  type CommerceAppConfigDomain = keyof typeof CommerceAppConfigSchemas;
@@ -1169,7 +1205,7 @@ declare function hasCustomInstallationSteps(config: CommerceAppConfigOutputModel
1169
1205
  //#region source/config/schema/metadata.d.ts
1170
1206
  /** The schema for the metadata of the application. */
1171
1207
  declare const MetadataSchema: v.ObjectSchema<{
1172
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
1208
+ readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 100, "The application id must not be longer than 100 characters">]>;
1173
1209
  readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
1174
1210
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
1175
1211
  readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')">]>;
@@ -12,8 +12,8 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { a as hasConfigDomain, c as hasBusinessConfigSchema, i as getConfigDomains, n as validateCommerceAppConfigDomain, o as hasMetadata, r as CommerceAppConfigSchemas, s as hasBusinessConfig, t as validateCommerceAppConfig } from "../validate-qRpfubPo.mjs";
16
- import { a as hasCustomInstallationSteps, c as hasEventing, i as hasCustomInstallation, l as hasExternalEvents, n as hasWebhooks, s as hasCommerceEvents } from "../webhooks-NgM6k3_r.mjs";
17
- import { d as defineConfig, n as readCommerceAppConfig, r as resolveCommerceAppConfig, t as parseCommerceAppConfig } from "../config-BbrkH0Xt.mjs";
15
+ import { a as hasCustomInstallationSteps, c as hasEventing, i as hasCustomInstallation, l as hasExternalEvents, n as hasWebhooks, s as hasCommerceEvents } from "../webhooks-CYo-pqbR.mjs";
16
+ import { a as hasConfigDomain, c as hasBusinessConfigSchema, i as getConfigDomains, n as validateCommerceAppConfigDomain, o as hasMetadata, r as CommerceAppConfigSchemas, s as hasBusinessConfig, t as validateCommerceAppConfig } from "../validate-CqJdGzyZ.mjs";
17
+ import { d as defineConfig, n as readCommerceAppConfig, r as resolveCommerceAppConfig, t as parseCommerceAppConfig } from "../config-BohwKkQS.mjs";
18
18
 
19
19
  export { CommerceAppConfigSchemas, defineConfig, getConfigDomains, hasBusinessConfig, hasBusinessConfigSchema, hasCommerceEvents, hasConfigDomain, hasCustomInstallation, hasCustomInstallationSteps, hasEventing, hasExternalEvents, hasMetadata, hasWebhooks, parseCommerceAppConfig, readCommerceAppConfig, resolveCommerceAppConfig, validateCommerceAppConfig, validateCommerceAppConfigDomain };
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { t as validateCommerceAppConfig } from "./validate-qRpfubPo.mjs";
15
+ import { t as validateCommerceAppConfig } from "./validate-CqJdGzyZ.mjs";
16
16
  import { t as stringifyError } from "./error-DHlYzkbb.mjs";
17
17
  import { dirname, join, parse } from "path";
18
18
  import { existsSync } from "fs";
@@ -12,10 +12,10 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as CommerceAppConfigOutputModel } from "./app-lymFcs59.cjs";
16
- import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
17
- import * as v from "valibot";
15
+ import { n as CommerceAppConfigOutputModel } from "./app-DJr-mN9d.mjs";
18
16
  import AioLogger from "@adobe/aio-lib-core-logging";
17
+ import * as v from "valibot";
18
+ import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
19
19
 
20
20
  //#region source/management/installation/schema.d.ts
21
21
  /** Schema for validating Adobe I/O app credentials required for installation. */
@@ -90,10 +90,10 @@ type LeafStep<TName extends string = string, TConfig extends CommerceAppConfigOu
90
90
  validate?: (config: TConfig, context: ValidationExecutionContext<TStepCtx>) => ValidationIssue[] | Promise<ValidationIssue[]>;
91
91
  };
92
92
  /** A branch step that contains children (no execution). */
93
- type BranchStep<TName extends string = string, TConfig extends CommerceAppConfigOutputModel = CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>> = StepBase<TName, TConfig> & {
93
+ type BranchStep<TName extends string = string, TConfig extends CommerceAppConfigOutputModel = CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TChildren extends AnyStep[] = AnyStep[]> = StepBase<TName, TConfig> & {
94
94
  type: "branch"; /** An optional factory function to setup shared context for the children steps. */
95
95
  context?: StepContextFactory<TStepCtx>; /** The children steps of this branch. */
96
- children: AnyStep[];
96
+ children: TChildren;
97
97
  /**
98
98
  * Optional pre-installation validation handler for the branch itself.
99
99
  * Called before children are validated. Returning an empty array means
@@ -121,7 +121,7 @@ declare function isBranchStep(step: AnyStep): step is BranchStep;
121
121
  /** Options for defining a leaf step. */
122
122
  type LeafStepOptions<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> = Omit<LeafStep<TName, TConfig, TStepCtx, TOutput>, "type">;
123
123
  /** Options for defining a branch step. */
124
- type BranchStepOptions<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>> = Omit<BranchStep<TName, TConfig, TStepCtx>, "type">;
124
+ type BranchStepOptions<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TChildren extends AnyStep[] = AnyStep[]> = Omit<BranchStep<TName, TConfig, TStepCtx, TChildren>, "type">;
125
125
  /**
126
126
  * Define a leaf step (executable, no children).
127
127
  *
@@ -137,7 +137,14 @@ type BranchStepOptions<TName extends string, TConfig extends CommerceAppConfigOu
137
137
  * });
138
138
  * ```
139
139
  */
140
- declare function defineLeafStep<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown>(options: LeafStepOptions<TName, TConfig, TStepCtx, TOutput>): LeafStep<TName, TConfig, TStepCtx, TOutput>;
140
+ declare function defineLeafStep<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown>(options: LeafStepOptions<TName, TConfig, TStepCtx, TOutput>): {
141
+ type: "leaf";
142
+ name: TName;
143
+ meta: StepMeta;
144
+ when: ((config: CommerceAppConfigOutputModel) => config is TConfig) | undefined;
145
+ run: (config: TConfig, context: ExecutionContext<TStepCtx>) => TOutput | Promise<TOutput>;
146
+ validate: ((config: TConfig, context: ValidationExecutionContext<TStepCtx>) => ValidationIssue[] | Promise<ValidationIssue[]>) | undefined;
147
+ };
141
148
  /**
142
149
  * Define a branch step (container with children, no runner).
143
150
  *
@@ -152,7 +159,15 @@ declare function defineLeafStep<TName extends string, TConfig extends CommerceAp
152
159
  * });
153
160
  * ```
154
161
  */
155
- declare function defineBranchStep<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>>(options: BranchStepOptions<TName, TConfig, TStepCtx>): BranchStep<TName, TConfig, TStepCtx>;
162
+ declare function defineBranchStep<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, const TChildren extends AnyStep[] = AnyStep[]>(options: BranchStepOptions<TName, TConfig, TStepCtx, TChildren>): {
163
+ type: "branch";
164
+ name: TName;
165
+ meta: StepMeta;
166
+ when: ((config: CommerceAppConfigOutputModel) => config is TConfig) | undefined;
167
+ context: StepContextFactory<TStepCtx> | undefined;
168
+ children: TChildren;
169
+ validate: ((config: TConfig, context: ValidationExecutionContext<TStepCtx>) => ValidationIssue[] | Promise<ValidationIssue[]>) | undefined;
170
+ };
156
171
  /** Infer the output type from a leaf step. */
157
172
  type InferStepOutput<TStep> = TStep extends LeafStep<infer _TName, infer _TConfig, infer _TStepCtx, infer TOutput> ? Awaited<TOutput> : never;
158
173
  //#endregion
@@ -12,5 +12,5 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { $ as isBranchStep, A as StepStatus, B as InferStepOutput, C as ExecutionStatus, D as InstallationError, E as InstallationData, F as isSucceededState, G as StepContextFactory, H as LeafStep, I as AnyStep, J as ValidationExecutionContext, K as StepMeta, L as BranchStep, M as isCompletedState, N as isFailedState, O as InstallationState, P as isInProgressState, Q as defineLeafStep, R as BranchStepOptions, S as StepSucceededEvent, T as InProgressInstallationState, U as LeafStepOptions, V as InstallationContext, W as Step, X as ValidationIssueSeverity, Y as ValidationIssue, Z as defineBranchStep, _ as executeWorkflow, a as runInstallation, b as StepFailedEvent, c as defineCustomInstallationStep, d as ValidationResult, et as isLeafStep, f as ValidationSummary, g as createInitialState, h as ExecuteWorkflowOptions, i as createInitialInstallationState, j as SucceededInstallationState, k as InstallationStatus, l as StepValidationResult, m as CreateInitialStateOptions, n as RunInstallationOptions, o as runValidation, p as validateStepTree, q as ValidationContext, r as RunValidationOptions, s as CustomInstallationStepHandler, t as CreateInitialInstallationStateOptions, u as ValidateStepTreeOptions, v as InstallationHooks, w as FailedInstallationState, x as StepStartedEvent, y as StepEvent, z as ExecutionContext } from "../index-D33OCH0D.mjs";
15
+ import { $ as isBranchStep, A as StepStatus, B as InferStepOutput, C as ExecutionStatus, D as InstallationError, E as InstallationData, F as isSucceededState, G as StepContextFactory, H as LeafStep, I as AnyStep, J as ValidationExecutionContext, K as StepMeta, L as BranchStep, M as isCompletedState, N as isFailedState, O as InstallationState, P as isInProgressState, Q as defineLeafStep, R as BranchStepOptions, S as StepSucceededEvent, T as InProgressInstallationState, U as LeafStepOptions, V as InstallationContext, W as Step, X as ValidationIssueSeverity, Y as ValidationIssue, Z as defineBranchStep, _ as executeWorkflow, a as runInstallation, b as StepFailedEvent, c as defineCustomInstallationStep, d as ValidationResult, et as isLeafStep, f as ValidationSummary, g as createInitialState, h as ExecuteWorkflowOptions, i as createInitialInstallationState, j as SucceededInstallationState, k as InstallationStatus, l as StepValidationResult, m as CreateInitialStateOptions, n as RunInstallationOptions, o as runValidation, p as validateStepTree, q as ValidationContext, r as RunValidationOptions, s as CustomInstallationStepHandler, t as CreateInitialInstallationStateOptions, u as ValidateStepTreeOptions, v as InstallationHooks, w as FailedInstallationState, x as StepStartedEvent, y as StepEvent, z as ExecutionContext } from "../index-BmYXe7kp.mjs";
16
16
  export { AnyStep, BranchStep, BranchStepOptions, CreateInitialInstallationStateOptions, CreateInitialStateOptions, CustomInstallationStepHandler, ExecuteWorkflowOptions, ExecutionContext, ExecutionStatus, FailedInstallationState, InProgressInstallationState, InferStepOutput, InstallationContext, InstallationData, InstallationError, InstallationHooks, InstallationState, InstallationStatus, LeafStep, LeafStepOptions, RunInstallationOptions, RunValidationOptions, Step, StepContextFactory, StepEvent, StepFailedEvent, StepMeta, StepStartedEvent, StepStatus, StepSucceededEvent, StepValidationResult, SucceededInstallationState, ValidateStepTreeOptions, ValidationContext, ValidationExecutionContext, ValidationIssue, ValidationIssueSeverity, ValidationResult, ValidationSummary, createInitialInstallationState, createInitialState, defineBranchStep, defineCustomInstallationStep, defineLeafStep, executeWorkflow, isBranchStep, isCompletedState, isFailedState, isInProgressState, isLeafStep, isSucceededState, runInstallation, runValidation, validateStepTree };
@@ -12,6 +12,6 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { a as isCompletedState, c as isSucceededState, i as defineCustomInstallationStep, n as runInstallation, o as isFailedState, r as runValidation, s as isInProgressState, t as createInitialInstallationState } from "../management-CIoVWirU.mjs";
15
+ import { a as isCompletedState, c as isSucceededState, i as defineCustomInstallationStep, n as runInstallation, o as isFailedState, r as runValidation, s as isInProgressState, t as createInitialInstallationState } from "../management-DSexEPTW.mjs";
16
16
 
17
17
  export { createInitialInstallationState, defineCustomInstallationStep, isCompletedState, isFailedState, isInProgressState, isSucceededState, runInstallation, runValidation };
@@ -12,12 +12,12 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { a as hasCustomInstallationSteps, c as hasEventing, l as hasExternalEvents, n as hasWebhooks, s as hasCommerceEvents } from "./webhooks-NgM6k3_r.mjs";
15
+ import { a as hasCustomInstallationSteps, c as hasEventing, d as hasAdminUiSdk, l as hasExternalEvents, n as hasWebhooks, s as hasCommerceEvents } from "./webhooks-CYo-pqbR.mjs";
16
16
  import { t as stringifyError } from "./error-DHlYzkbb.mjs";
17
17
  import { t as inspect } from "./logging-XIUXDK5T.mjs";
18
18
  import camelcase from "camelcase";
19
+ import { AdobeCommerceHttpClient, resolveCommerceHttpClientParams, resolveIoEventsHttpClientParams } from "@adobe/aio-commerce-lib-api";
19
20
  import { resolveAuthParams, resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
20
- import { resolveCommerceHttpClientParams, resolveIoEventsHttpClientParams } from "@adobe/aio-commerce-lib-api";
21
21
  import { createCustomCommerceEventsApiClient, createEventProvider, createEventSubscription, getAllEventProviders, getAllEventSubscriptions, updateEventingConfiguration } from "@adobe/aio-commerce-lib-events/commerce";
22
22
  import { createCustomAdobeIoEventsApiClient, createEventMetadataForProvider, createEventProvider as createEventProvider$1, createRegistration, getAllEventProviders as getAllEventProviders$1, getAllRegistrations } from "@adobe/aio-commerce-lib-events/io-events";
23
23
  import { createCustomCommerceWebhooksApiClient, getWebhookList, subscribeWebhook } from "@adobe/aio-commerce-lib-webhooks/api";
@@ -509,6 +509,62 @@ function defineCustomInstallationStep(handler) {
509
509
  return handler;
510
510
  }
511
511
 
512
+ //#endregion
513
+ //#region source/management/installation/admin-ui-sdk/helpers.ts
514
+ /**
515
+ * Registers the extension with Commerce via POST /V1/adminuisdk/extension.
516
+ *
517
+ * @param context - The execution context providing the Commerce HTTP client and logger.
518
+ * @returns The response from the Commerce API.
519
+ */
520
+ async function registerExtension(context) {
521
+ const { commerceClient, appData, logger } = context;
522
+ logger.info(`Registering Admin UI SDK extension: ${appData.projectName}`);
523
+ const response = await commerceClient.post("adminuisdk/extension", { json: { extension: {
524
+ extensionName: process.env.__OW_NAMESPACE,
525
+ extensionTitle: appData.projectTitle,
526
+ extensionUrl: `https://${process.env.__OW_NAMESPACE}.adobeio-static.net/index.html`,
527
+ extensionWorkspace: appData.workspaceName
528
+ } } }).json();
529
+ logger.info(`Admin UI SDK extension registered successfully: ${response.extensionId}`);
530
+ return response;
531
+ }
532
+
533
+ //#endregion
534
+ //#region source/management/installation/admin-ui-sdk/utils.ts
535
+ /** Creates the Admin UI SDK step context with a lazy-initialized Commerce HTTP client. */
536
+ const createAdminUiSdkStepContext = (installation) => {
537
+ const { params } = installation;
538
+ let commerceClient = null;
539
+ return { get commerceClient() {
540
+ if (commerceClient === null) commerceClient = new AdobeCommerceHttpClient(resolveCommerceHttpClientParams(params, { tryForwardAuthProvider: true }));
541
+ return commerceClient;
542
+ } };
543
+ };
544
+
545
+ //#endregion
546
+ //#region source/management/installation/admin-ui-sdk/branch.ts
547
+ /** Leaf step that calls POST /V1/adminuisdk/extension to register the extension. */
548
+ const registerExtensionStep = defineLeafStep({
549
+ name: "register-extension",
550
+ meta: {
551
+ label: "Register Extension",
552
+ description: "Registers the Admin UI SDK extension in Adobe Commerce"
553
+ },
554
+ run: (_, context) => registerExtension(context)
555
+ });
556
+ /** Branch step for setting up the Admin UI SDK extension registration. */
557
+ const adminUiSdkStep = defineBranchStep({
558
+ name: "admin-ui-sdk",
559
+ meta: {
560
+ label: "Admin UI SDK",
561
+ description: "Registers the extension with Adobe Commerce Admin UI SDK"
562
+ },
563
+ when: hasAdminUiSdk,
564
+ context: createAdminUiSdkStepContext,
565
+ children: [registerExtensionStep]
566
+ });
567
+
512
568
  //#endregion
513
569
  //#region source/management/installation/events/utils.ts
514
570
  const COMMERCE_PROVIDER_TYPE = "dx_commerce_events";
@@ -517,14 +573,20 @@ const PROVIDER_TYPE_TO_LABEL = {
517
573
  [COMMERCE_PROVIDER_TYPE]: "Commerce",
518
574
  [EXTERNAL_PROVIDER_TYPE]: "External"
519
575
  };
576
+ /** Max characters taken from `metadata.id` in the I/O Events provider `instance_id`. */
577
+ const METADATA_ID_MAX_LENGTH_FOR_INSTANCE_ID = 100;
520
578
  /**
521
- * Generates a unique instance ID for the given event provider within the context of the provided config.
579
+ * Generates a unique instance ID for I/O Events for this app deployment.
580
+ * Uses `{metadata.id (first 100 chars)}-{providerKeyOrSlug}-{workspaceId}` (lowercased).
581
+ *
522
582
  * @param metadata - The metadata of the application
523
- * @param provider - The event provider for which to generate the instance ID
583
+ * @param provider - The event provider (optional `key`, else label is slugified)
584
+ * @param workspaceId - Adobe I/O Developer Console workspace ID for this deployment
524
585
  */
525
- function generateInstanceId(metadata, provider) {
586
+ function generateInstanceId(metadata, provider, workspaceId) {
587
+ const appId = metadata.id.slice(0, METADATA_ID_MAX_LENGTH_FOR_INSTANCE_ID);
526
588
  const slugLabel = provider.label.toLowerCase().replace(/\s+/g, "-");
527
- return `${metadata.id}-${provider.key ?? slugLabel}`.toLowerCase();
589
+ return `${appId}-${provider.key ?? slugLabel}-${workspaceId}`.toLowerCase();
528
590
  }
529
591
  /**
530
592
  * Find an existing event provider by its instance ID.
@@ -543,7 +605,6 @@ function findExistingProviderMetadata(allMetadata, eventName) {
543
605
  return allMetadata.find((meta) => meta.event_code === eventName) ?? null;
544
606
  }
545
607
  /**
546
- <<<<<<< HEAD
547
608
  * Find existing event registrations by client ID and name.
548
609
  * @param allRegistrations - The list of all existing event registrations.
549
610
  * @param clientId - The client ID of the workspace where the registration was created.
@@ -574,7 +635,7 @@ function getIoEventCode(name, providerType) {
574
635
  * @param runtimeAction - The runtime action this registration points to.
575
636
  */
576
637
  function getRegistrationName(provider, runtimeAction) {
577
- const providerLabel = PROVIDER_TYPE_TO_LABEL[provider.provider_metadata] ?? "Unknown";
638
+ const providerLabel = PROVIDER_TYPE_TO_LABEL[provider.provider_metadata];
578
639
  const [packageName, actionName] = runtimeAction.split("/").map(kebabToTitleCase);
579
640
  return `${providerLabel} Event Registration: ${actionName} (${packageName})`;
580
641
  }
@@ -698,8 +759,11 @@ async function getCommerceEventingExistingData(context) {
698
759
  const { commerceEventsClient } = context;
699
760
  const existingProviders = await commerceEventsClient.getAllEventProviders();
700
761
  const existingSubscriptions = await commerceEventsClient.getAllEventSubscriptions();
762
+ const defaultProvider = existingProviders.find((provider) => !("id" in provider)) ?? null;
763
+ const isDefaultProviderConfigured = defaultProvider !== null;
701
764
  return {
702
- isDefaultWorkspaceConfigurationEmpty: existingProviders.some((provider) => !("id" in provider) && !provider.workspace_configuration?.trim()),
765
+ isDefaultProviderConfigured,
766
+ isDefaultWorkspaceConfigurationEmpty: isDefaultProviderConfigured ? !defaultProvider.workspace_configuration?.trim() : true,
703
767
  providers: existingProviders,
704
768
  subscriptions: new Map(existingSubscriptions.map((subscription) => [subscription.name, subscription]))
705
769
  };
@@ -860,22 +924,30 @@ async function createOrGetIoEventRegistration(params, registrations) {
860
924
  async function configureCommerceEventing(params, existingData) {
861
925
  const { context, config } = params;
862
926
  const { commerceEventsClient, logger } = context;
927
+ const { isDefaultProviderConfigured, isDefaultWorkspaceConfigurationEmpty } = existingData;
863
928
  logger.info("Starting configuration of the Commerce Eventing Module");
864
- let updateParams = {
865
- ...config,
866
- enabled: true
867
- };
868
- if (existingData.isDefaultWorkspaceConfigurationEmpty) {
869
- if (!config.workspace_configuration) {
929
+ if (isDefaultProviderConfigured && !isDefaultWorkspaceConfigurationEmpty) {
930
+ logger.info("Commerce Eventing Module is already configured, skipping configuration step.");
931
+ return;
932
+ }
933
+ const { workspace_configuration, ...configWithoutWorkspace } = config;
934
+ let updateParams = { enabled: true };
935
+ if (isDefaultWorkspaceConfigurationEmpty) {
936
+ if (!workspace_configuration) {
870
937
  const message = "Workspace configuration is required to enable Commerce Eventing when there is not an existing one.";
871
938
  logger.error(message);
872
939
  throw new Error(message);
873
940
  }
874
- logger.info("Default provider workspace configuration already present, it will not be overriden");
875
- const { workspace_configuration, ...rest } = updateParams;
876
- updateParams = rest;
941
+ updateParams.workspace_configuration = workspace_configuration;
942
+ logger.info("Adding workspace configuration to Commerce Eventing configuration as it has not been set up yet.");
943
+ }
944
+ if (!isDefaultProviderConfigured) {
945
+ logger.info("Default provider not configured, it will be created with the provided configuration.");
946
+ updateParams = {
947
+ ...updateParams,
948
+ ...configWithoutWorkspace
949
+ };
877
950
  }
878
- logger.info("Updating Commerce Eventing configuration with provided workspace configuration.");
879
951
  return commerceEventsClient.updateEventingConfiguration(updateParams).then((success) => {
880
952
  if (success) {
881
953
  logger.info("Commerce Eventing Module configured successfully.");
@@ -974,7 +1046,7 @@ async function createOrGetCommerceEventSubscription(params, existingData) {
974
1046
  async function onboardIoEvents(params, existingData) {
975
1047
  const { providersWithMetadata, registrations } = existingData;
976
1048
  const { context, metadata, provider, providerType, events } = params;
977
- const instanceId = generateInstanceId(metadata, provider);
1049
+ const instanceId = generateInstanceId(metadata, provider, context.appData.workspaceId);
978
1050
  const providerData = await createOrGetIoEventProvider({
979
1051
  context,
980
1052
  provider: {
@@ -1467,6 +1539,7 @@ function createDefaultChildSteps(config) {
1467
1539
  return [
1468
1540
  eventingStep,
1469
1541
  webhooksStep,
1542
+ adminUiSdkStep,
1470
1543
  createCustomInstallationStep(config)
1471
1544
  ];
1472
1545
  }