---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [cli](../index.md) / B2COperationLifecycleHook

# Type Alias: B2COperationLifecycleHook

> **B2COperationLifecycleHook** = `Hook`\<`"b2c:operation-lifecycle"`\>

Defined in: [packages/b2c-tooling-sdk/src/cli/lifecycle.ts:208](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/lifecycle.ts#L208)

Hook type for `b2c:operation-lifecycle`.

Implement this hook in your oclif plugin to receive B2C operation lifecycle events
for jobs, deployments, and other B2C Commerce operations.

## Plugin Registration

Register the hook in your plugin's package.json:

```json
{
  "oclif": {
    "hooks": {
      "b2c:operation-lifecycle": "./dist/hooks/operation-lifecycle.js"
    }
  }
}
```

## Example

```typescript
import type { B2COperationLifecycleHook } from '@salesforce/b2c-tooling-sdk/cli';

const hook: B2COperationLifecycleHook = async function(options) {
  return {
    providers: [{
      name: 'my-audit-provider',
      async beforeOperation(context) {
        // Access context.instance for API calls
        // Log or check policies before operation
      },
      async afterOperation(context, result) {
        // Log results, send notifications, etc.
      },
    }],
  };
};

export default hook;
```
