# Migration Guide

## Kivo Inventory - Compatibility & Migration Guide

This document lists every custom modification made on top of ox\_inventory. When updating to a newer version of ox\_inventory, follow this guide to re-apply all changes.

> **Current base version:** ox\_inventory 2.44.1

***

### 1. Client-Side NUI Callbacks

**File:** `client.lua` (bottom of file, lines \~1604-1666)

Five custom `RegisterNUICallback` blocks must be appended to `client.lua`:

| Callback             | Bridge Export Called                              | Returns                                                               |
| -------------------- | ------------------------------------------------- | --------------------------------------------------------------------- |
| `getBalances`        | `exports['kivo-inv-bridge']:GetPlayerBalances()`  | `{ cash: number, bank: number }` (fallback: `{ cash = 0, bank = 0 }`) |
| `getPlayerInfo`      | `exports['kivo-inv-bridge']:GetPlayerInfo()`      | `{ name: string, id: string }` (fallback: `false`)                    |
| `getAvatar`          | `exports['kivo-inv-bridge']:GetPlayerAvatar()`    | `string` URL (fallback: `nil`)                                        |
| `requestAuth`        | `exports['kivo-inv-bridge']:GenerateAuthToken()`  | `AuthToken` table (fallback: `nil`)                                   |
| `getInventoryConfig` | `exports['kivo-inv-bridge']:GetInventoryConfig()` | `{ useContextMenu: boolean }` (fallback: `{ useContextMenu = true }`) |

All five check `GetResourceState('kivo-inv-bridge') == 'started'` and wrap the export call in `pcall` for safety.

***

### 2. Built Web UI

The `web/build/` folder contains the pre-compiled UI with all custom components baked in. When migrating:

* Replace the stock ox\_inventory `web/build/` folder with ours entirely
* Do **not** mix files from stock and custom builds — replace the whole folder
* If ox\_inventory updates its web build process or dependencies, the source must be rebuilt from our repo

***

### 3. Authentication

The `kivo-inv-bridge` provides authentication for licensed clients. The `requestAuth` NUI callback handles this — make sure it is included when migrating.

{% hint style="warning" %}
The bridge must be running and responding for the inventory to function. If it is missing or not started, the inventory will stop working.
{% endhint %}

***

### 5. Migration Checklist

{% stepper %}
{% step %}

### Back up your current files

Back up your current working ox\_inventory before starting.
{% endstep %}

{% step %}

### Append NUI callbacks

Append the five NUI callbacks (Section 1) to the bottom of the new `client.lua`.
{% endstep %}

{% step %}

### Replace web build

Replace `web/build/` entirely with our pre-built folder (Section 2).
{% endstep %}

{% step %}

### Ensure bridge order

Verify `kivo-inv-bridge` starts before `ox_inventory` in `server.cfg`.
{% endstep %}

{% step %}

### Test authentication

Test auth — confirm the inventory works with `kivo-inv-bridge` running after 1 hour+.
{% endstep %}
{% endstepper %}


---

# Agent Instructions: 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:

```
GET https://docs.kivostudios.net/scripts/kivo-inventory/migration-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
