---
title: "ViolationService | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/ViolationService-1/"
---

# ViolationService

> [`ViolationService`](#violationservice)

## Classes

### ViolationService

#### Constructors

##### Constructor

```ts
new ViolationService(
   violations, 
   eventManager, 
   productHandler): ViolationService;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `violations` | [`Violation`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#abstract-violation)[] |
| `eventManager` | [`EventManager`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/EventManager.md#eventmanager) |
| `productHandler` | [`ProductHandler`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/ProductHandler.md#producthandler) |

###### Returns

#### Methods

##### addItemViolationStateChanged()

```ts
addItemViolationStateChanged(listener): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `listener` | (`value`) => `void` |

###### Returns

`void`

##### dispose()

```ts
dispose(): void;
```

###### Returns

`void`

##### extend()

```ts
extend(violations): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `violations` | [`Violation`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#abstract-violation)[] |

###### Returns

`void`

##### getItemInfo()

```ts
getItemInfo(item, forceUpdate?): ITotalViolationInfo;
```

###### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `item` | `Item` | `undefined` |
| `forceUpdate` | `boolean` | `false` |

###### Returns

[`ITotalViolationInfo`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#itotalviolationinfo)

##### getViolationInfoByType()

```ts
getViolationInfoByType(violationClass, item): IViolationInfo<{
}>;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `violationClass` | (...`args`) => [`Violation`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#abstract-violation) |
| `item` | `Item` |

###### Returns

[`IViolationInfo`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#iviolationinfo)\<\{
\}\>

##### removeItemViolationStateChanged()

```ts
removeItemViolationStateChanged(listener): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `listener` | (`value`) => `void` |

###### Returns

`void`

## Interfaces

### IItemViolationInfo

#### Extends

- [`ITotalViolationInfo`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#itotalviolationinfo)

#### Properties

##### data?

```ts
optional data?: object;
```

###### Index Signature

```ts
[key: string]: IViolationData
```

###### Inherited from

[`ITotalViolationInfo`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#itotalviolationinfo).[`data`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#data)

##### item

```ts
item: Item;
```

##### messages?

```ts
optional messages?: string[];
```

###### Inherited from

[`ITotalViolationInfo`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#itotalviolationinfo).[`messages`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#messages)

##### state

```ts
state: ViolationState;
```

###### Inherited from

[`ITotalViolationInfo`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#itotalviolationinfo).[`state`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms/Violation.md#state)

***

### IItemViolationStateChangedEventArgs

#### Properties

##### new

```ts
new: IItemViolationInfo;
```

##### old

```ts
old: IItemViolationInfo;
```
