# @commercetools-frontend-extensions/unpublish-products-modal

A package for unpublishing products in the Merchant Center.

> This library takes into account that you are building a Merchant Center Applications which documentation you can find [here](https://docs.commercetools.com/custom-applications/).
> The components follow the same principles of the [UIKit](https://github.com/commercetools/ui-kit) components.

## Getting started

```bash
$ npm install --save @commercetools-frontend-extensions/unpublish-products-modal

// or

$ yarn add @commercetools-frontend-extensions/unpublish-products-modal
```

## Description

Unpublish products modal is an internal component used to unpublish products from CSV files. It uses [Importer services](https://github.com/commercetools/commercetools-importer) to create async import jobs.

## Usage

```JSX
import UnpublishProductsModal from '@commercetools-frontend-extensions/unpublish-products-modal';

<UnpublishProductsModal
  isOpen={true}
  onClose={() => {}}
/>
```

## Properties

| Props                                        | Type                                                    |                       Required                       | Default | Description    |
| -------------------------------------------- | ------------------------------------------------------- | :--------------------------------------------------: | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `isOpen`                                     | `boolean`                                               |                                     ✅                  |  | Controls whether the unpublish products modal is open or closed                                                                                                                   |      
| `onClose`                                    | `function`                                              |                                                      |         | A callback function triggered when the modal is requested to close (either by clicking on the overlay, clicking the close button or pressing `ESC`).                                                                                                                                                                                              |                                                                                                                                                                                                   |

## Releasing

This package uses [`changesets`](https://github.com/atlassian/changesets) in order to do releases to NPM.

In case you want to publish a new version with the latest changes you need to:

1. Add a changeset with `pnpm changeset` and select `@commercetools-frontend-extensions/unpublish-products-modal` as the modified package.
2. Some options would be appear in order to do the release:
   - `patch`: use this release for fixes or small changes
   - `minor`: use this release for depenency upgrades or medium changes
   - `major`: use this release for breaking changes
3. After selecting the option you will need to add a comment for the release notes. We recommend to use the same format as for the commits.
   - e.g: `feat(utils): add utils for dates`
4. Push the `changeset` to your branch and GitHub actions will detect that the PR contains changes that affect the published library.
5. After the PR gets merged, another PR will be created called `Version Packages` which is the one that will be detected, again by GitHub Actions, to do a release to NPM.
6. Make sure that everything is correct and then merge `Version Packages` PR.
7. Wait until the new version is available in NPM and then deploy the custom in CircleCI.

### Canary releases

Canary releases are automatically published to the distribution channel via CI following a successful build and merge to the **main** branch.

## i18n

The repo is configured with an integration with Transifex. The process for i18n is the same as the Merchant Center uses.

`pnpm i18n:build` for adding the new keys to transifex.

Once the PR gets merged to `main` transifex will receive a notification with new keys that need to be translated (that's why is important that `description` and `defaultMessage` are descriptive enough).

Whenever the translators finish translations and mark them as done, the repo will receive a PR (per language) for adding translated messages.

Once we review that translated keys are correct and add a `changeset` we can merge the PR. (Don't forget to deploy the custom app)
