From 28bca80473015efaae94e918f4c998f6ddd06629 Mon Sep 17 00:00:00 2001 From: Thomas De Meyer Date: Fri, 23 Aug 2024 09:07:05 +0200 Subject: [PATCH 1/2] feat(project): added project mutations for business units (#207) --- .changeset/hip-ants-shave.md | 5 +++++ src/repositories/project.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .changeset/hip-ants-shave.md diff --git a/.changeset/hip-ants-shave.md b/.changeset/hip-ants-shave.md new file mode 100644 index 00000000..c1287f8a --- /dev/null +++ b/.changeset/hip-ants-shave.md @@ -0,0 +1,5 @@ +--- +"@labdigital/commercetools-mock": patch +--- + +Added additional options to project settings diff --git a/src/repositories/project.ts b/src/repositories/project.ts index 3afa36ff..d193f89b 100644 --- a/src/repositories/project.ts +++ b/src/repositories/project.ts @@ -1,5 +1,6 @@ import type { Project, + ProjectChangeBusinessUnitStatusOnCreationAction, ProjectChangeCartsConfigurationAction, ProjectChangeCountriesAction, ProjectChangeCountryTaxRateFallbackEnabledAction, @@ -13,6 +14,7 @@ import type { ProjectSetShippingRateInputTypeAction, ProjectUpdateAction, } from "@commercetools/platform-sdk"; +import { ProjectSetBusinessUnitAssociateRoleOnCreationAction } from "@commercetools/platform-sdk/dist/declarations/src/generated/models/project"; import { maskSecretValue } from "../lib/masking"; import { AbstractStorage } from "../storage/abstract"; import type { Writable } from "../types"; @@ -111,6 +113,20 @@ class ProjectUpdateHandler messagesConfiguration.deleteDaysAfterCreation; } + changeMyBusinessUnitStatusOnCreation( + context: RepositoryContext, + resource: Writable, + { status }: ProjectChangeBusinessUnitStatusOnCreationAction, + ) { + if (resource.businessUnits === undefined) { + resource.businessUnits = { + myBusinessUnitStatusOnCreation: "Inactive", + }; + } + + resource.businessUnits.myBusinessUnitStatusOnCreation = status; + } + changeName( context: RepositoryContext, resource: Writable, @@ -153,6 +169,24 @@ class ProjectUpdateHandler resource.externalOAuth = externalOAuth; } + setMyBusinessUnitAssociateRoleOnCreation( + context: RepositoryContext, + resource: Writable, + { associateRole }: ProjectSetBusinessUnitAssociateRoleOnCreationAction, + ) { + if (resource.businessUnits === undefined) { + resource.businessUnits = { + //Default status, so we set it here also + myBusinessUnitStatusOnCreation: "Inactive", + }; + } + + resource.businessUnits.myBusinessUnitAssociateRoleOnCreation = { + typeId: associateRole.typeId, + key: associateRole.key ?? "unknown", + }; + } + setShippingRateInputType( context: RepositoryContext, resource: Writable, From a4a76cc97474357425a54fea3bfaed269abcd31f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:38:04 +0200 Subject: [PATCH 2/2] Release new version (#208) This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @labdigital/commercetools-mock@2.29.1 ### Patch Changes - [#207](https://github.com/labd/commercetools-node-mock/pull/207) [`28bca80`](https://github.com/labd/commercetools-node-mock/commit/28bca80473015efaae94e918f4c998f6ddd06629) Thanks [@demeyerthom](https://github.com/demeyerthom)! - Added additional options to project settings Co-authored-by: github-actions[bot] --- .changeset/hip-ants-shave.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/hip-ants-shave.md diff --git a/.changeset/hip-ants-shave.md b/.changeset/hip-ants-shave.md deleted file mode 100644 index c1287f8a..00000000 --- a/.changeset/hip-ants-shave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@labdigital/commercetools-mock": patch ---- - -Added additional options to project settings diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c854e96..1be6ba02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## 2.23.1 +## 2.29.1 + +### Patch Changes + +- [#207](https://github.com/labd/commercetools-node-mock/pull/207) [`28bca80`](https://github.com/labd/commercetools-node-mock/commit/28bca80473015efaae94e918f4c998f6ddd06629) Thanks [@demeyerthom](https://github.com/demeyerthom)! - Added additional options to project settings + ## 2.29.0 ### Minor Changes diff --git a/package.json b/package.json index 8ec338fb..57d93554 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@labdigital/commercetools-mock", - "version": "2.29.0", + "version": "2.29.1", "license": "MIT", "author": "Michael van Tellingen", "type": "module",