> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suprsend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migration guide from v1

> Guide for migrating from v1 and v2 to v3 of the SuprSend Web SDK.

# Migrating to v4 from v3

This migration is pretty simple.

* Pagination related meta data keys have been changed in InApp Feed.

```javascript v4 theme={"system"}
pageInfo = {
  total: 0,
  pageSize: DEFAULT_PAGE_SIZE,
  hasMore: false, // this key is added in v4
};
```

```javascript v3 theme={"system"}
pageInfo = {
  total: 0,
  currentPage: 0, // this key is removed in v4
  totalPages: 0, // this key is removed in v4
  pageSize: DEFAULT_PAGE_SIZE,
};
```

# Migrating to v3 from v2

This migration is pretty simple. This version also supports InApp Feed support.

* SuprSend class export has been changed from default export to named export.

```javascript v3 theme={"system"}
import { SuprSend } from "@suprsend/web-sdk";
```

```javascript v2 theme={"system"}
import SuprSend from "@suprsend/web-sdk";
```

# Migrating to v2 from v1

Migrating from v1 to v2 has breaking changes, as we have made some architectural level changes. Refer the v1 SDK [documentation](/docs/integrate-javascript-sdk) . Following are changes in detail:

### Authentication changes

In v1, workspace key and workspace secret are used to authenticate requests made to SuprSend which is not so secure.

In v2 we have changed authentication to use public API Key and Signed User Token.

```javascript v2 theme={"system"}
const suprSendClient = new SuprSend(publicApiKey);

suprSendClient.idenitfy(distinctId, userToken);
```

```javascript v1 theme={"system"}
suprsend.init(workspace_key, workspace_secret);
```

<br />

### Initializing SDK

v1 used `init` method to initialize SDK and suprsend instance was provided by SDK itself.

In v2 we have provided `SuprSend` class and its clients responsibility to export the class instance and use it in other places to call library methods.

```javascript v2 theme={"system"}
export const suprSendClient = new SuprSend(publicApiKey);

suprSendClient.track("test");
```

```Text v1 theme={"system"}
suprsend.init(workspace_key, workspace_secret);

suprsend.track("test")
```

<br />

### Synchronous methods

In v1 all methods used to be asynchronous and have returned void. In background SDK used to batch requests and make API calls.

In v2 we have made all requests synchronous so you could access response of API immediately depending of status of API call. Almost all methods including preference methods return response type of [API Response](https://docs.suprsend.com/docs/integrate-javascript-sdk#response-structure).

```javascript v2 theme={"system"}
const trackResponse = await suprSendClient.track("test");

console.log(trackResponse.status); // success or error
```

```javascript v1 theme={"system"}
const resp = suprsend.track("test"); // resp will be null
```

<br />

### Renamed methods and arguments to camelCase

In v1, all library methods and method parameters are in snake\_case which has been changed to camelCase in v2.

```javascript v2 theme={"system"}
// examples
suprSendClient.user.addEmail();
suprSendClient.user.preferences.getPreferences({ tenantId: "test" });
```

```javascript v1 theme={"system"}
// examples
suprsend.user.add_email();
suprsend.user.preferences.get_preferences({ tenant_id: "test" });
```

<br />

### Removed `purchase_made` method

In v2 `purchase_made`method has been removed. If you are using this method in v1 you can directly call track method with event type: `$purchase_made`.

```javascript v2 theme={"system"}
suprSendClient.track("$purchase_made", { item: "ps5" });
```

```javascript v1 theme={"system"}
suprsend.purchase_made({ item: "ps5" });
```

<br />

### Removed `set_super_properties`

In v2 `set_super_properties` method has been removed. If you are using this method in v1 you could directly pass all these super properties as individual event properties.

<br />

After migrating please test all library methods to see if they everything is working properly. If you face any issue in migration process please reach out to us on our [slack community](https://join.slack.com/t/suprsendcommunity/shared_invite/zt-3932rw936-XNWY1RC8bsffh4if4ZyoXQ) or drop an email to us on [support@suprsend.com](mailto:support@suprsend.com)
