> For the complete documentation index, see [llms.txt](https://legacy-docs.usesmileid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacy-docs.usesmileid.com/integration-options/web-mobile-web/javascript-sdk-beta/migration.md).

# Migration

This guide walks you through upgrading from the deprecated v1 SDK to v2.

***

## 1. Installation

Refer to the full install instructions:

* New SDK v2: [Installation](/integration-options/web-mobile-web/javascript-sdk-beta/installation.md)
* Deprecated v1: [Deprecated Installation](/integration-options/web-mobile-web/javascript-sdk-beta/deprecated/installation.md)

### npm

```bash
npm install @smileid/web-components@<version>
```

```js
import "@smileid/web-components/smart-camera-web";
```

### Script tag

Pin to v2.0.0:

```html
<script src="https://cdn.smileidentity.com/js/v2.0.0/smart-camera-web.js"></script>
```

Or auto-update within v2:

```html
<script src="https://cdn.smileidentity.com/js/v2/smart-camera-web.js"></script>
```

***

## 2. What’s Changed

1. **Initialization**
   * v1 event listener `imagesComputed` is removed.
   * v2 uses `smart-camera-web.publish` for events.
2. **Event Payload**
   * The event detail for `smart-camera-web.publish` is still the same as `imagesComputed`

***

## 3. Receiving Callbacks

Listen for the same `smart-camera-web.publish` event:

```html
<smart-camera-web></smart-camera-web>
<script>
  const app = document.querySelector("smart-camera-web");

  app.addEventListener("smart-camera-web.publish", async (e) => {
    // e.detail partners your existing server payload
    console.log("Captured data:", e.detail);
    // send to your backend...
  });
</script>
```

## 4. New features

v2 is fully modular. You can compose your own flow—selfie only, ID document only, or any combination/order you prefer. See [usage](/integration-options/web-mobile-web/javascript-sdk-beta/usage.md) for more examples

## 5. Document auto-capture (next major version)

A new document auto-capture engine is available. In the current major version it is **opt-in**, and **the next major version will enable it by default**.

To adopt it early and test ahead of the upgrade:

* **Web component:** add the `auto-capture-enabled="true"` attribute.
* **Hosted SmileIdentity widget:** set `auto_capture_enabled: true` in the config.

Once enabled, use the `auto-capture` attribute (`auto_capture` option in the hosted widget) to choose the mode — `autoCapture`, `autoCaptureOnly`, or `manualCaptureOnly` — and `auto-capture-timeout` / `auto_capture_timeout` to tune the manual-capture fallback delay.

See the [Document auto-capture](/integration-options/web-mobile-web/javascript-sdk-beta/usage.md#document-auto-capture) section in Usage for full details.

## 6. Next Steps

* Review the v2 [Installation](/integration-options/web-mobile-web/javascript-sdk-beta/installation.md)
* Explore more v2 examples in [Usage](/integration-options/web-mobile-web/javascript-sdk-beta/usage.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://legacy-docs.usesmileid.com/integration-options/web-mobile-web/javascript-sdk-beta/migration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
