# Onboarding POS ## SAP Description (single application package): Basically the SAP is a web application, that aggregate a set of one responsibility packages and link them with 2 ways: - Sap share some ExternalsData through a **react context** with the classic top to bottom react strategi.. - And an **Event Bus** is used to allow packages to communicate with the SAP. ( Also shared through the context) For a better visualization please take a look to the **[Technical Schema](https://docs.google.com/presentation/d/1I4XcPgdMWScUBbRgbv1gEuw6AZWFDUOounLuEnEs78E/edit#slide=id.g50c98a14ca_0_36)** And for more details check the **[Full documentation](https://docs.google.com/presentation/d/1I4XcPgdMWScUBbRgbv1gEuw6AZWFDUOounLuEnEs78E/edit#slide=id.p)**: ### Stack It's mainly built with `react`, `redux`, `redux-saga` `typescript`. #### For more details: Check the convention doc about **[stack and architecture](https://direction-technique.pages.gitlab.wynd.eu/docs/pos%C3%A9idon/pos-packages/)** ### SAP Feature Basically Each SAP represent a sell's channel, made with some logic blocks that called **packages** that represent a feature such as: - Authentification - Cashdesk - Article details - Article search ... And an SAP aggregates all these logical packages to match a channel: - Cash register - Self Checkout - And others in the future ... ___ ## API All our SAP communicates with an API, which is fill in a `.env` file at the application folder's root. ### @wynd/sdk-api We communicate to the api with a self made client that's called `@wynd/sdk-api`. This client is used by all our js application. It regroup a set of **Accessor** that match all api endpoints. Accessors themself regroup a set of **CRUD methods** (and sometime specific one). - It's stored in a separate repository: [https://gitlab.wynd.eu/wynd-product/sdk/api-js](https://gitlab.wynd.eu/wynd-product/sdk/api-js). - For more details take a look at The [README.MD](https://gitlab.wynd.eu/wynd-product/sdk/api-js#wyndsdk-api) - And see the [Examples](https://gitlab.wynd.eu/wynd-product/sdk/api-js/tree/develop/examples). ### Your api documentation: http://API-URL/documentation/api ℹ️ If it's not the case ask to your lead developer / Technical manager. ### What should i do if my endpoint is not or approximately taken in charge ?: You should simply contribute to **@wynd/sdk-api**. ## Packages ### Mono repository: All our packages and applications are stored in a mono-repository: [https://gitlab.wynd.eu/wynd-product/pos/core-packages/monorepo](https://gitlab.wynd.eu/wynd-product/pos/core-packages/monorepo). #### How to use it ? Everything is write in the [README](https://gitlab.wynd.eu/wynd-product/pos/core-packages/monorepo/blob/develop/README.md). - ℹ️ You should start by the [Getting started ](https://gitlab.wynd.eu/wynd-product/pos/core-packages/monorepo#getting-started-implementation-bosap) . - ℹ️ You have [All scripts](https://gitlab.wynd.eu/wynd-product/pos/core-packages/monorepo#for-developers) available on the monotrepository. - ℹ️ Feel free to ask questions about your Slack Channel: **#cashing-tech**. ___ ### Intrinsic Dependencies All intrinsic dependencies are stored in a separate on a **Mono repository common** : [https://gitlab.wynd.eu/wynd-product/pos/pos-common](https://gitlab.wynd.eu/wynd-product/pos/pos-common) **Available common dependencies:** - UI Component : This library is a subset of **[Material UI](https://material-ui.com/)**. - Icon Component: This just some svg converted in component libraries - And others in the future ... #### Storybook: This repository build **storybooks** for those libraries: - [UI Component](https://wynd-product.pages.gitlab.wynd.eu/pos/core-components/storybook/?path=/story/accordion--default) - [Icon Component](https://wynd-product.pages.gitlab.wynd.eu/pos/icon-components/storybook/?path=/story/icons-iconalertbell--default) ### Deploy: On each merge on develop, pipelines launch auto publish job that deploy a dev-version. ## Package implementation: First be sure to have made all the getting started step. ### Creation: **⚠ Be careful before starting be sure to have [npx](https://github.com/zkat/npx#readme) globally installed**. How it write in the [README](https://gitlab.wynd.eu/wynd-product/pos/core-packages/monorepo/blob/develop/README.md#create-a-new-package): - We should start to make a `yarn create:package`. - Then follow the questions flow. - Be careful to the question `Are you in a mono repository architecture ? ` Say yes. - At the question `Do you want examples in your pos package ?` you can say yes if you want to have some example of routes, saga, reducers, for begin. - Then your package have been created in `/packages`. ### Usage in sap: The second step is to plugin it in your **SAP**. For that just follow those steps: - First run a build watch of your fresh package : `yarn build:watch --scope @wynd-pos/my-package`. (To build your package in dev mode) - Add it in your SAP package.json. - Go to add it in `/apps/pos-sap-sco-retail/src/config/index.ts`. It regroup all the loaded packages. ```ts export const config: ISAPConfig = { modules: [ ... { import: import('@wynd-pos/my-package'), } ], }; ``` - Go to type external data with those of the package in: `/apps/pos-sap-sco-retail/src/models/InterfaceExternalData.ts` - Then run `yarn start:sap-sco-retail`. Informations: - ℹ️ The SAP provide the possibility to override the default config provided by your package defined here: `/packages/my-package/src/config/config.ts` with `/apps/pos-sap-sco-retail/src/dataBridge/externalData.ts`. It can be useful to share some packages between two sap but with a different configurations. It's up to you. ___ ## Merge requests ### Review: Each morning, from 10 am to 11 am [(Paris Time zone)](https://www.google.com/search?q=Paris+Time+zone&oq=Paris+Time+zone&aqs=chrome..69i57.359j0j1&sourceid=chrome&ie=UTF-8), you have to do the review of **[All front chapter](https://gitlab.wynd.eu/groups/wynd-product/-/merge_requests?scope=all&utf8=%E2%9C%93&state=opened&label_name[]=Front)** ### My merge requests #### How do i submit it ? Follow this [gitlab convention](https://wyndcustomers.atlassian.net/wiki/spaces/wyndtech/pages/744129198/POS+Gitlab). #### How do i name my branchs ? Follow this [gitlab convention](https://wyndcustomers.atlassian.net/wiki/spaces/wyndtech/pages/744129198/POS+Gitlab). #### How it's merge ? Everybody is responsible of there merge requests, so you have to merge it. But you must have a number of upvote specified by your **Technical manager**.