@labdigital/commercetools-mock 2.16.0 → 2.17.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.
- package/README.md +9 -9
- package/dist/index.cjs +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/cart.ts +12 -0
- package/src/repositories/shopping-list.ts +2 -1
- package/src/services/cart.test.ts +50 -0
- package/src/services/shopping-list.test.ts +18 -1
package/README.md
CHANGED
|
@@ -79,7 +79,15 @@ describe('A module', () => {
|
|
|
79
79
|
|
|
80
80
|
## Contributing
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
This codebases use [@changesets](https://github.com/changesets/changesets) for release and version management
|
|
83
|
+
|
|
84
|
+
- Create a feature branch with new features / fixes (see [Adding a new service](#adding-a-service))
|
|
85
|
+
- When your code changes are complete, add a changeset file to your feature branch using `pnpm changeset`
|
|
86
|
+
- Create a PR to request your changes to be merged to main
|
|
87
|
+
- After your PR is merged, GitHub actions will create a release PR or add your changeset to an existing release PR
|
|
88
|
+
- When the release is ready merge the release branch. A new version will be released
|
|
89
|
+
|
|
90
|
+
### Adding a new service {#adding-a-service}
|
|
83
91
|
|
|
84
92
|
Implement the following:
|
|
85
93
|
|
|
@@ -88,11 +96,3 @@ Implement the following:
|
|
|
88
96
|
- Add new service to src/ctMock.ts ctMock.\_services
|
|
89
97
|
- Add new service to src/storage.ts InMemoryStorage
|
|
90
98
|
- Adjust src/types.ts RepositoryMap and possibly serviceTypes
|
|
91
|
-
|
|
92
|
-
### Releasing
|
|
93
|
-
|
|
94
|
-
This codebases use [@changesets](https://github.com/changesets/changesets) for release and version management
|
|
95
|
-
|
|
96
|
-
- Create a new changeset using `pnpm changeset`
|
|
97
|
-
- Push the changes to the `main` branch.
|
|
98
|
-
- GitHub actions will create a release PR. When the release is ready merge the release branch
|
package/dist/index.cjs
CHANGED
|
@@ -2603,6 +2603,12 @@ var CartRepository = class extends AbstractResourceRepository {
|
|
|
2603
2603
|
};
|
|
2604
2604
|
}
|
|
2605
2605
|
},
|
|
2606
|
+
setDirectDiscounts: (context, resource, { discounts }) => {
|
|
2607
|
+
resource.directDiscounts = discounts.map((discount) => ({
|
|
2608
|
+
...discount,
|
|
2609
|
+
id: (0, import_uuid4.v4)()
|
|
2610
|
+
}));
|
|
2611
|
+
},
|
|
2606
2612
|
setLocale: (context, resource, { locale }) => {
|
|
2607
2613
|
resource.locale = locale;
|
|
2608
2614
|
},
|
|
@@ -6290,7 +6296,7 @@ var ShoppingListRepository = class extends AbstractResourceRepository {
|
|
|
6290
6296
|
this._storage
|
|
6291
6297
|
)
|
|
6292
6298
|
};
|
|
6293
|
-
if (variantId) {
|
|
6299
|
+
if (productId && variantId) {
|
|
6294
6300
|
return lineItem;
|
|
6295
6301
|
}
|
|
6296
6302
|
if (sku) {
|
|
@@ -6309,6 +6315,7 @@ var ShoppingListRepository = class extends AbstractResourceRepository {
|
|
|
6309
6315
|
];
|
|
6310
6316
|
const variantId2 = allVariants.find((e) => e.sku === sku)?.id;
|
|
6311
6317
|
lineItem.variantId = variantId2;
|
|
6318
|
+
lineItem.productId = product.id;
|
|
6312
6319
|
return lineItem;
|
|
6313
6320
|
}
|
|
6314
6321
|
if (productId) {
|