# README

## spartacus-mock

This project offers you the possibility, to mock the API (OCC) Endpoints of your Composable-Storefront ([Spartacus](https://github.com/SAP/spartacus)). It uses the Mock Service Worker (MSW) [library](https://mswjs.io/) to mock the API calls.

* [Getting Started](#getting-started)
* [Versions](#versions)
* [Motivation](#motivation)
* [Feature Scope](#feature-scope)
* [Documentation](#documentation)

## Getting started

You want to get started quickly? Follow the steps of the [Getting Started](/spartacus-mock/getting-started.md) section.

## Versions

This project is tested to work with the listed angular versions and the listed Spartacus Versions in this table.

| Angular          |  Spartacus | msw | spartacus-mock |
| ---------------- | :--------: | :-: | :------------: |
| >=21.0.0 <22.0.0 | 221121.7.x | 2.x |       6.x      |
| >=19.0.0 <20.0.0 |   2211.x   | 2.x |       5.x      |
| >=17.0.0 <18.0.0 |   2211.x   | 2.x |       4.x      |
| >=15.0.0 <16.0.0 |    6.x.x   | 2.x |       3.x      |
| >=15.0.0 <16.0.0 |    6.x.x   | 1.x |       2.x      |
| >=14.0.0 <15.0.0 |    5.x.x   | 1.x |       1.x      |

It is possible that it works with other versions, but not tested.

## Motivation

When building Frontend application for SAP Commerce (former hybris), it was always a little bit annoying, as the frontend engineers needed to run hybris on their local machines. Additionally, one needed to wait until new features where built by the backend to be able to build the frontend for it.

In the new world of composable storefront (former spartacus), it already got easier as it is now possible to use a remote environment as backend. The problem of features not being ready yet or not being deployed to the remote environment still exists.

Spartacus-mock tries to solve both problems since you don't need to wait anymore, until

* "...that dev system is ready"
* "...that feature has been merged & deployed by the backend"
* "...that page / component has been added in Smartedit by the backend"

It comes with the mock-data for the standard electronics store.

You can then define your own custom mock-data tailored to your custom spartacus project. Adding new pages and components in no time helps you, developing your actual feature, without waiting until the Backend has finished or the hassle of running a local hybris ;-).

## Feature Scope

Spartacus-Mock currently offers mock-data for the following spartacus features / pages for the default electronics store:

* Home Page
* Content Page
* Product Categories
* Product Search
* Product Detail
* Cart
* Checkout
* My Account (except Order Returns)

See [Roadmap](https://valantic.gitbook.io/spartacus-mock/roadmap) for more information about the planned features.

## Documentation

* [Getting Started](/spartacus-mock/getting-started.md)
* [Examples](/spartacus-mock/examples.md)
* [API Reference](/spartacus-mock/api-reference.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://valantic.gitbook.io/spartacus-mock/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
