> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Package: cmsCompliance

# Namespace: complianceReviewRequestV1

# Webhook link: https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/compliance-review-request-bulk-review-approved.md

# Webhook Permissions Scopes IDs:
Enterprise CMS compliance flow : SCOPE.ENTERPRISE.CMS-COMPLIANCE-MANAGE

## Introduction

Triggered when a user approves one or more previously submitted compliance review requests.
Fires once per call, not once per data item.

---

## REST API

### Schema

```
Webhook: Compliance Review Request Bulk Review Approved
Description: Triggered when a user approves one or more previously submitted compliance review requests. Fires once per call, not once per data item.
Event body:
 - name: id | type: string | description: Unique event ID. Allows clients to ignore duplicate events.
 - name: entityFqdn | type: string | description: Fully qualified domain name of the entity associated with the event.
 - name: slug | type: string | description: Event name.
 - name: entityId | type: string | description: ID of the entity associated with the event.
 - name: eventTime | type: string (date-time) | description: Event timestamp.
 - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application such as GDPR.
 - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
 - name: actionEvent | type: object | description: Custom action event details.
    - name: body | type: BulkReviewApproved | description: The event body.
        - name: complianceReviewRequests | type: array<ComplianceReviewRequest> | description: Approved compliance review requests, in the same order as the call that approved them.  Each one is built from the data items as they stand in CMS at the moment the decision is made, not from the copy sent in the request. Their `requestReviewStatus` is therefore the value the items held before this call; the status this call wrote is in `statusUpdateResults`.
           - name: id | type: string | description: Compliance review request GUID. Matches the `_id` of the submitted data item.
           - name: action | type: ReviewAction | description: Publishing or unpublishing action the user requested for the data item.
               - enum:
               -     PUBLISH_DRAFT: Publish an item that currently exists only as a draft.
               -     PUBLISH_CHANGED: Publish a draft containing changes to an existing published item.
               -     UNPUBLISH_PUBLISHED: Unpublish an item that has no pending draft changes.
               -     PUBLISH_PUBLISHED: Submit an already-published item for review without content changes.
               -     UNPUBLISH_CHANGED: Unpublish an item that also has pending draft changes.
           - name: currentDataItem | type: DataItem | description: Published (live) version of the data item. Returned for every action except `PUBLISH_DRAFT`.
              - name: id | type: string | description: Data item GUID.  When an item is inserted into a collection, the item's GUID is automatically assigned a random value. You can optionally provide a custom GUID in `dataItem.id` when inserting the item. If you specify an GUID that already exists in the collection, the insertion will fail.
              - name: dataCollectionId | type: string | description: GUID of the collection this item belongs to.  This is the user-defined collection identifier set when the collection is created (for example, `EvalCustomers`), not a GUID.
              - name: data | type: object | description: Data item contents.  Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:  + `_id`: Item GUID. + `_createdDate`: Date and time the item was added to the collection. + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value. + `_owner`: GUID of the user who created the item. Can be modified with site owner permissions.
           - name: proposedDataItem | type: DataItem | description: Version of the data item proposed by the request. For `PUBLISH_PUBLISHED`, this is the same published item as `current_data_item`. Absent only for `UNPUBLISH_PUBLISHED`.
           - name: submittedAt | type: string | description: Date and time the action was submitted.
           - name: submittedByUserId | type: string | description: GUID of the user who submitted the action.
           - name: submittedByAccountId | type: string | description: GUID of the account the action was submitted under.
           - name: versionOnUnpublish | type: VersionOnUnpublish | description: Version to preserve as a draft after a changed item is unpublished. Returned only for `UNPUBLISH_CHANGED` when the caller provides a meaningful value.
               - enum:
               -     KEEP_LATEST_DRAFT_VERSION: Preserve the item's latest draft edits.
               -     KEEP_LIVE_PUBLISHED_VERSION: Preserve the item's current live version.
        - name: publishResult | type: BulkPublishDataItemDraftsResponse | description: Results of publishing the items whose action starts with `PUBLISH`, with 1 entry per item the call tried to publish. Each entry's `itemMetadata` reports whether that item was published, and its `itemMetadata.originalIndex` is the item's position in `complianceReviewRequests`.  Returned only when the call included at least 1 item whose action starts with `PUBLISH`.
           - name: results | type: array<BulkPublishDataItemDraftResult> | description: Per-item results, in the same order as `dataItemIds` in the request. Each entry includes success or error details and, when `returnEntity` is `true`, the published item.
              - name: itemMetadata | type: ItemMetadata | description: Per-item success or failure details. Use `originalIndex` to match this result to an GUID in the request's `dataItemIds` array.
                 - name: id | type: string | description: Item GUID. Does not appear if the item GUID is missing. For example, when item creation fails.
                 - name: originalIndex | type: integer | description: Original index of the item in the array specified in the request. Use this to match items in the request with those in the response.
                 - name: success | type: boolean | description: Whether the requested action was successful. When `false`, the `error` field is populated.
                 - name: error | type: ApplicationError | description: In case of failure, the error details.
                    - name: code | type: string | description: Error code.
                    - name: description | type: string | description: Description of the error.
                    - name: data | type: object | description: Data related to the error.
              - name: dataItem | type: DataItem | description: Published data item.  Returned only when `returnEntity` is `true` and this item was published successfully.
           - name: bulkActionMetadata | type: BulkActionMetadata | description: Total numbers of items that succeeded and failed.
              - name: totalSuccesses | type: integer | description: Number of items successfully processed.
              - name: totalFailures | type: integer | description: Number of items that couldn't be processed.
        - name: unpublishResult | type: BulkUnpublishDataItemsResponse | description: Results of unpublishing the items whose action starts with `UNPUBLISH`, with 1 entry per item the call tried to unpublish. Each entry's `itemMetadata` reports whether that item was unpublished, and its `itemMetadata.originalIndex` is the item's position in `complianceReviewRequests`.  Returned only when the call included at least 1 item whose action starts with `UNPUBLISH`.
           - name: results | type: array<BulkUnpublishDataItemsResult> | description: Per-item results, in the same order as `dataItemIds` in the request. Each entry includes success or error details and, when `returnEntity` is `true` and `copyToDraft` isn't `false`, the resulting draft.
              - name: itemMetadata | type: ItemMetadata | description: Per-item success or failure details. Use `originalIndex` to match this result to an GUID in the request's `dataItemIds` array.
              - name: dataItem | type: DataItem | description: Draft created from the unpublished data item.  Returned only when `returnEntity` is `true`, `copyToDraft` isn't `false`, and this item was unpublished successfully.
           - name: bulkActionMetadata | type: BulkActionMetadata | description: Total numbers of items that succeeded and failed.
        - name: statusUpdateResults | type: array<BulkUpdateDataItemsResponse> | description: Results of setting `requestReviewStatus` to `APPROVED`. Within each entry, `results` holds 1 entry per item, whose `itemMetadata` reports whether the status was set and whose `itemMetadata.originalIndex` is the item's position in `complianceReviewRequests`.  The status is set in one update per publishing direction, and there's 1 entry here per update, not per item. A call whose actions all start with `PUBLISH`, or all start with `UNPUBLISH`, therefore carries a single entry covering every item in it. A call that mixes the two carries 2 entries, the first covering its `PUBLISH_*` items and the second its `UNPUBLISH_*` items.  `PUBLISH_*` items are always covered, because their status is set before they're published. An `UNPUBLISH_*` item is covered only if it was unpublished successfully, so a call whose unpublishes all failed carries no second entry at all. This isn't a complete list of the items in the call: for any item missing from it, read `unpublishResult` to see why.
           - name: results | type: array<BulkDataItemResult> | description: Information about the updated items.
              - name: action | type: BulkActionType | description: Action attempted for the data item.
                   - enum: UNKNOWN_ACTION_TYPE, INSERT, UPDATE, DELETE, PATCH
              - name: itemMetadata | type: ItemMetadata | description: Item metadata.
              - name: dataItem | type: DataItem | description: Updated data item.  Returned if `returnEntity` is set to `true` and the action is successful.
           - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.

```

---

## JavaScript SDK

### Schema

```
Webhook: onComplianceReviewRequestBulkReviewApproved
Description: Triggered when a user approves one or more previously submitted compliance review requests. Fires once per call, not once per data item.
Payload: ComplianceReviewRequestBulkReviewApprovedEnvelope
  - name: data | type: BulkReviewApproved | description: none
     - name: complianceReviewRequests | type: array<ComplianceReviewRequest> | description: Approved compliance review requests, in the same order as the call that approved them.  Each one is built from the data items as they stand in CMS at the moment the decision is made, not from the copy sent in the request. Their `requestReviewStatus` is therefore the value the items held before this call; the status this call wrote is in `statusUpdateResults`.
        - name: _id | type: string | description: Compliance review request GUID. Matches the `_id` of the submitted data item.
        - name: action | type: ReviewAction | description: Publishing or unpublishing action the user requested for the data item.
             - enum:
             -     PUBLISH_DRAFT: Publish an item that currently exists only as a draft.
             -     PUBLISH_CHANGED: Publish a draft containing changes to an existing published item.
             -     UNPUBLISH_PUBLISHED: Unpublish an item that has no pending draft changes.
             -     PUBLISH_PUBLISHED: Submit an already-published item for review without content changes.
             -     UNPUBLISH_CHANGED: Unpublish an item that also has pending draft changes.
        - name: currentDataItem | type: DataItem | description: Published (live) version of the data item. Returned for every action except `PUBLISH_DRAFT`.
           - name: _id | type: string | description: Data item GUID.  When an item is inserted into a collection, the item's GUID is automatically assigned a random value. You can optionally provide a custom GUID in `dataItem.id` when inserting the item. If you specify an GUID that already exists in the collection, the insertion will fail.
           - name: dataCollectionId | type: string | description: GUID of the collection this item belongs to.  This is the user-defined collection identifier set when the collection is created (for example, `EvalCustomers`), not a GUID.
           - name: data | type: object | description: Data item contents.  Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:  + `_id`: Item GUID. + `_createdDate`: Date and time the item was added to the collection. + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value. + `_owner`: GUID of the user who created the item. Can be modified with site owner permissions.
        - name: proposedDataItem | type: DataItem | description: Version of the data item proposed by the request. For `PUBLISH_PUBLISHED`, this is the same published item as `current_data_item`. Absent only for `UNPUBLISH_PUBLISHED`.
        - name: submittedAt | type: Date | description: Date and time the action was submitted.
        - name: submittedByUserId | type: string | description: GUID of the user who submitted the action.
        - name: submittedByAccountId | type: string | description: GUID of the account the action was submitted under.
        - name: versionOnUnpublish | type: VersionOnUnpublish | description: Version to preserve as a draft after a changed item is unpublished. Returned only for `UNPUBLISH_CHANGED` when the caller provides a meaningful value.
             - enum:
             -     KEEP_LATEST_DRAFT_VERSION: Preserve the item's latest draft edits.
             -     KEEP_LIVE_PUBLISHED_VERSION: Preserve the item's current live version.
     - name: publishResult | type: BulkPublishDataItemDraftsResponse | description: Results of publishing the items whose action starts with `PUBLISH`, with 1 entry per item the call tried to publish. Each entry's `itemMetadata` reports whether that item was published, and its `itemMetadata.originalIndex` is the item's position in `complianceReviewRequests`.  Returned only when the call included at least 1 item whose action starts with `PUBLISH`.
        - name: results | type: array<BulkPublishDataItemDraftResult> | description: Per-item results, in the same order as `dataItemIds` in the request. Each entry includes success or error details and, when `returnEntity` is `true`, the published item.
           - name: itemMetadata | type: ItemMetadata | description: Per-item success or failure details. Use `originalIndex` to match this result to an GUID in the request's `dataItemIds` array.
              - name: _id | type: string | description: Item GUID. Does not appear if the item GUID is missing. For example, when item creation fails.
              - name: originalIndex | type: integer | description: Original index of the item in the array specified in the request. Use this to match items in the request with those in the response.
              - name: success | type: boolean | description: Whether the requested action was successful. When `false`, the `error` field is populated.
              - name: error | type: ApplicationError | description: In case of failure, the error details.
                 - name: code | type: string | description: Error code.
                 - name: description | type: string | description: Description of the error.
                 - name: data | type: object | description: Data related to the error.
           - name: dataItem | type: DataItem | description: Published data item.  Returned only when `returnEntity` is `true` and this item was published successfully.
        - name: bulkActionMetadata | type: BulkActionMetadata | description: Total numbers of items that succeeded and failed.
           - name: totalSuccesses | type: integer | description: Number of items successfully processed.
           - name: totalFailures | type: integer | description: Number of items that couldn't be processed.
     - name: unpublishResult | type: BulkUnpublishDataItemsResponse | description: Results of unpublishing the items whose action starts with `UNPUBLISH`, with 1 entry per item the call tried to unpublish. Each entry's `itemMetadata` reports whether that item was unpublished, and its `itemMetadata.originalIndex` is the item's position in `complianceReviewRequests`.  Returned only when the call included at least 1 item whose action starts with `UNPUBLISH`.
        - name: results | type: array<BulkUnpublishDataItemsResult> | description: Per-item results, in the same order as `dataItemIds` in the request. Each entry includes success or error details and, when `returnEntity` is `true` and `copyToDraft` isn't `false`, the resulting draft.
           - name: itemMetadata | type: ItemMetadata | description: Per-item success or failure details. Use `originalIndex` to match this result to an GUID in the request's `dataItemIds` array.
           - name: dataItem | type: DataItem | description: Draft created from the unpublished data item.  Returned only when `returnEntity` is `true`, `copyToDraft` isn't `false`, and this item was unpublished successfully.
        - name: bulkActionMetadata | type: BulkActionMetadata | description: Total numbers of items that succeeded and failed.
     - name: statusUpdateResults | type: array<BulkUpdateDataItemsResponse> | description: Results of setting `requestReviewStatus` to `APPROVED`. Within each entry, `results` holds 1 entry per item, whose `itemMetadata` reports whether the status was set and whose `itemMetadata.originalIndex` is the item's position in `complianceReviewRequests`.  The status is set in one update per publishing direction, and there's 1 entry here per update, not per item. A call whose actions all start with `PUBLISH`, or all start with `UNPUBLISH`, therefore carries a single entry covering every item in it. A call that mixes the two carries 2 entries, the first covering its `PUBLISH_*` items and the second its `UNPUBLISH_*` items.  `PUBLISH_*` items are always covered, because their status is set before they're published. An `UNPUBLISH_*` item is covered only if it was unpublished successfully, so a call whose unpublishes all failed carries no second entry at all. This isn't a complete list of the items in the call: for any item missing from it, read `unpublishResult` to see why.
        - name: results | type: array<BulkDataItemResult> | description: Information about the updated items.
           - name: action | type: BulkActionType | description: Action attempted for the data item.
                 - enum: UNKNOWN_ACTION_TYPE, INSERT, UPDATE, DELETE, PATCH
           - name: itemMetadata | type: ItemMetadata | description: Item metadata.
           - name: dataItem | type: DataItem | description: Updated data item.  Returned if `returnEntity` is set to `true` and the action is successful.
        - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.
  - name: metadata | type: EventMetadata | description: none
     - name: instanceId | type: string | description: App instance GUID.
     - name: eventType | type: string | description: Event type.
     - name: identity | type: IdentificationData | description: The identification type and identity data.
        - ONE-OF:
           - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
           - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
           - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
           - name: appId | type: string | description: GUID of an app.
        - name: identityType | type: WebhookIdentityType | description: 
             - enum: UNKNOWN, ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
     - name: accountInfo | type: AccountInfo | description: Details related to the account
        - name: accountId | type: string | description: GUID of the Wix account associated with the event.
        - name: parentAccountId | type: string | description: GUID of the parent Wix account. Only included when accountId belongs to a child account.
        - name: siteId | type: string | description: GUID of the Wix site associated with the event. Only included when the event is tied to a specific site.
     - name: _id | type: string | description: Event GUID. With this GUID you can easily spot duplicated events and ignore them.
     - name: entityFqdn | type: string | description: Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
     - name: slug | type: string | description: Event action name, placed at the top level to make it easier for users to dispatch messages. For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
     - name: entityId | type: string | description: GUID of the entity associated with the event.
     - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`.
     - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
     - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
     - name: entityEventSequence | type: string | description: A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.

```

### Examples


```javascript
import { enterpriseCmsCompliance } from '@wix/enterprise-cms-compliance';

enterpriseCmsCompliance.onComplianceReviewRequestBulkReviewApproved((event) => {
    // handle your event here
});
```


```javascript
import { createClient, AppStrategy } from '@wix/sdk';
import { enterpriseCmsCompliance } from '@wix/enterprise-cms-compliance';

const wixClient = createClient({
  auth: AppStrategy({
    appId: 'MY-APP-ID',
    publicKey: 'YOUR_APP_PUBLIC_KEY',
  }),
  modules: {
      enterpriseCmsCompliance,
    },
});

wixClient.enterpriseCmsCompliance.onComplianceReviewRequestBulkReviewApproved((event) => {
    // handle your event here
});
```

---