npm package: @proprioo/salatim
Description: Proprioo component library
Author: Tech Proprioo
Latest version: 37.0.9

# Salatim

Salatim is our component library, made with 🥑 and ❤️.

Please have a look at its storybook for each component.

## How to dev ?

- create a branch from `main`
- make changes and sane commits (atomic, descriptive)
- push changes and create a PR on GitHub
- once complete, merge it to `main` using "Rebase and merge" strategy

## How to release a new version?

The final "production" release of salatim is managed through npmjs.com – https://www.npmjs.com/package/@proprioo/salatim

To publish a new version of salatim, you need to:

- checkout the `main` branch
- make sure everything is up to date with `git pull origin main`
- [optional by now] update the `CHANGELOG.md` file according to the changes you made since the last release
- create either a **patch**, **minor** or **major** release depending on the changes you made using npm
  - i.e. `npm version patch` for a patch release
  - i.e. `npm version minor` for a minor release
  - i.e. `npm version major` for a major release
- push the commit and the tag created by the previous command using `git push origin main --tags`
- go to GitHub and create a new release from the tag you just pushed

**WARNING**: the GitHub workflow to push the package to npmjs.com is currently untested, make sure to verify the
package is correctly published on npmjs.com after the release.

## **OUTDATED, TO BE CHECKED** Backport a fix

If you have to backport something to an old version of salatim :

1. go to the old version's branch (for example: `v15` before the rebranding)
2. add your commit(s), and don't forget to bump the version in `package.json` and `CHANGELOG.md` (if you fix something
   and the previous version was `15.2.3`, bump to `15.2.4`)
3. push the branch, don't forget it!
4. run `npm run clean && npm run build` locally to make the package ready to be published
5. run `npm publish --access=public --non-interactive --tag 15.2.4` locally. **Don't forget the `--tag` argument to
   prevent overriding the latest version.**

You can then bump your project with this new version of salatim. ;)

## Update phone metadata

We cannot accept every phone numbers in the application, mainly due to some optimization (Metadata JSON is a big file).
When an error is triggered on AppSales (`Failed to parse phone number +XXXX`), we need to update the phone Metadata to
accept it.

1. Find the country calling code, to do so:
   1. Go to [Phone.tsx](./packages/phone//src/phoneInput/PhoneInput.tsx), change `PhoneInput` import to
      `'react-phone-number-input'` and remove metadata attribute in JSX (like this we're accepting every possible phone
      numbers)
   2. Start locally Storybook and copy / paste your troublesome phone number to find the country calling code.
2. Go to [CountryCode.org](https://countrycode.org/) and find your country calling code.
3. Use the 2 digit ISO found to update the script [generate-phone-metadata](./package.json), then run this script (
   Metadata will be automatically generated).
4. We also need to update the Phone component to accept this new option, go
   to [constants](./packages/phone/src/phoneInput/constants.ts) and add this 2 digit ISO in both constants.
5. Do not forget to rollback your changes in `PhoneInput.tsx`, then update Changelog.md and package.json version and
   you're up to go.