> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.

# Migrating to v1.37

> Update your code to use the new unified activity navigation API and improved camera configuration, and check the smaller behavior changes in v1.37

> **Note**
>
> **Note:** The deprecated APIs below continue to work. They won't be removed until a future major version (v2.0+).
> A few behaviors changed on purpose; check [Other changes](#other-changes) before you upgrade.

## Overview

v1.37 rebuilds the uploader's internals on Lit, with signals for state. No tag, option, event or CSS variable was
removed or renamed, and deprecated APIs keep working until v2. A few behaviors you may rely on changed, and some
undocumented internals were removed; see [Other changes](#other-changes) and [Removed internals](#removed-internals).

v1.37 deprecates `setCurrentActivity()` and `setModalState()` in favor of the new
`navigate()`. The camera options `enableVideoRecording` and `defaultCameraMode`
have been deprecated since v1.13 in favor of `cameraModes`:

| Old                                                   | New                                          | Status                                                       |
| ----------------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------ |
| `setCurrentActivity()` + `setModalState()` Deprecated | `navigate()` New                             | [Path 1: Activity navigation](#path-1-activity-navigation)   |
| `enableVideoRecording` Deprecated                     | `cameraModes`                                | [Path 2: Camera configuration](#path-2-camera-configuration) |
| `defaultCameraMode` Deprecated                        | `cameraModes`                                | [Path 2: Camera configuration](#path-2-camera-configuration) |
| Plugin label as any string Deprecated                 | An l10n key, or text asserted as `PlainText` | [Path 3: Plugin labels](#path-3-plugin-labels)               |
| `multipartMaxAttempts` Deprecated                     | Nothing: the option has no effect            | [Path 4: Multipart attempts](#path-4-multipart-attempts)     |

## Other changes \[#other-changes]

These behaviors changed in v1.37. Check them if your code depends on them.

### Navigation and API

* **`historyBack()` returns to the previous activity.** It goes back to the activity shown before the current one,
  whichever it was, and opens it with the params it was shown with, for example the same external source. v1.36
  went back only to the start screen or the upload list. The built-in Back buttons do the same. See
  [`historyBack()`](/docs/file-uploader/api/#history-back).
* **`activity-change` on modal close.** When the modal closes,
  [`activity-change`](/docs/file-uploader/events/#activity-change) now fires, with `{ activity: null }` when no
  activity is left showing. A handler that reads `e.detail.activity` should accept `null`.
* **`getOutputItem()` throws for a removed file,** also inside a `file-removed` handler: use the entry the event
  carries instead. v1.36 returned it with the `removed` status until it was cleaned up. It also throws for an
  internal ID from another uploader. See [`getOutputItem()`](/docs/file-uploader/api/#output-file-entry).
* **`addFileFromUuid()` throws `Invalid UUID`** right away, and adds nothing, when the value isn't a file UUID: an
  empty string, a UUID with CDN operations, or a CDN URL. v1.36 added the file, which then failed to upload. Add a
  CDN URL with [`addFileFromCdnUrl()`](/docs/file-uploader/api/#add-file-from-cdn-url).
* **`uploadAll()` takes files that are still being validated.** They upload once their validation passes. v1.36
  skipped them, so a call right after adding files could upload nothing.

### Events

* **`common-upload-start` fires once, when the first file is uploading,** so its state is `uploading`, or `failed`
  when the list already holds a file with an error. It used to fire a moment earlier, with every file still `idle`,
  and sometimes twice. See
  [`common-upload-start`](/docs/file-uploader/events/#common-upload-start).
* **`common-upload-failed` waits for the rest of the list, and does not repeat for the same failures.** It fires once
  nothing is still uploading or being validated, so a file that fails while others upload is reported when the last of
  them finishes. It fires again only when something new fails, and its payload still lists every failed file. v1.36
  fired it as soon as a failure appeared, and again when validators ran again. See
  [`common-upload-failed`](/docs/file-uploader/events/#common-upload-failed).
* **`file-upload-failed` fires once per failure.** v1.36 fired it again each time validators ran again and found the
  same errors. See [`file-upload-failed`](/docs/file-uploader/events/#file-upload-failed).
* **`modal-open` and `modal-close` on screen changes.** `setCurrentActivity()` or `historyBack()` while the modal is
  open now fire [`modal-open`](/docs/file-uploader/events/#modal-open) for the new activity and `modal-close` for
  the previous one, as the uploader's own screen changes do. v1.36 did not fire both on that path.
* **Wider event payload types.** The TypeScript types now match what the events carry: `file-added` can be `idle`
  or `success`, `file-url-changed` and `common-upload-progress` can be any status, and an `idle` or `uploading`
  entry can have a `uuid` and `cdnUrl`. Code that relied on the narrower types may need a status check.
* **Reading an `OutputCollectionState` later.** `progress`, `errors`, `group` and `totalCount` are now read when the
  state is created, so a late read of them returns what the event carried, without a warning. The file entries and
  the fields derived from them are filled on the first read; reading them first in a later task logs a warning, as
  any late read did in v1.36, with new wording. A new warning covers combining a field read at creation with entries
  read after it changed, and reading the entries after the uploader was removed throws. Keep `state.snapshot()` (new)
  or `{...state}` to read it later. See
  [Reading the state](/docs/file-uploader/api/#reading-output-collection-state).

### Rendering and styling

* **The upload list renders only the visible rows.** A long list keeps only the `uc-file-item` elements in view,
  plus a few around them, in the DOM. Tests or scripts that count or query `uc-file-item` see only those, and CSS
  such as `uc-file-item:last-of-type` matches the last rendered row. Read the files from
  [`getOutputCollectionState()`](/docs/file-uploader/api/#output-collection-state) instead.
* **An inline uploader with a set height scrolls its file list inside that height.** v1.36 grew the element to fit
  every file. An inline uploader without a set height still grows with its files.
* **The image editor renders its icons as `uc-editor-icon`,** where it used `uc-icon`. Update CSS that targets
  `uc-icon` inside `uc-cloud-image-editor`. Inside the uploader, editor icons still follow
  [`iconHrefResolver`](/docs/file-uploader/styling/#icons) and plugin icons. The standalone editor bundle
  (`uc-cloud-image-editor.min.js`) no longer defines `uc-icon` or exports `Icon`; it exports `EditorIcon`.
* **Accessibility roles and names.** `<uc-modal>` no longer sets `aria-modal` on its host and names its dialog
  after the built-in activity it shows. `uc-file-item` rows are named groups instead of separate live regions. The
  dynamic button's menu puts `menuitem` on the focusable button, and the inline toolbar uses plain buttons. The
  camera's icon-only buttons have names, and the microphone toggle has `aria-pressed`. Tests that find elements by
  role or name may need updating.
* **Console warnings and errors** start with `[uc]`, then the `ctx-name` when the message comes from an uploader,
  and the area that logged them, for example `[uc][my-uploader][secure-uploads]`. Update any log filter that
  matches the start of a message.

### Localization

* **New locale keys.** The camera uses seven: `camera-not-found` and `camera-unavailable` (shown instead of "Camera
  access denied" when there is no camera or it's in use), `camera-microphone-denied`, and the button names
  `a11y-camera-microphone`, `a11y-camera-stop-recording`, `a11y-camera-play` and `a11y-camera-pause`. The image
  editor uses eight: `network-error` and `retry` for its network error screen, which is now translated, and
  `a11y-editor-crop-resize`, `a11y-editor-crop-area` and the four `a11y-editor-crop-corner-*` keys for the crop box.
  Every bundled locale has them; a custom locale without them shows the English text. See [How to update existing localization](/docs/file-uploader/localization/#how-to-update-existing-localization).

### TypeScript

* **Types are checked under `moduleResolution: "bundler"`.** The published declarations are tested the way
  bundler-based projects read them. Under `node16` or `nodenext` they compile with `skipLibCheck: true`, as v1.36's
  did; types that come from `@uploadcare/cdn-url` resolve to `any` there.
* **Looser signatures.** `defineLocale()` accepts a partial definition and the keys declared in
  `CustomLocaleDefinition`; missing keys fall back to English. `navigate()` and `setCurrentActivity()` accept no
  params for an activity whose params are all optional. A plugin activity's `render` may return nothing.

### Bundle size

* **npm:** an app that bundles the whole package grows by about 7 KB gzip (107.5 to 114.3 KB, measured with
  esbuild; brotli 89.3 to 96.1 KB).
* **CDN:** `file-uploader.min.js` and the `uc-file-uploader-*.min.js` bundles grow by about 10 KB gzip (103.1 to
  112.9 KB; brotli 86.1 to 95.2 KB), `file-uploader.iife.min.js` by 5.2 KB (107.7 to 112.9 KB;
  brotli 90.0 to 95.2 KB),
  `uc-cloud-image-editor.min.js` by 4.6 KB (49.1 to 53.7 KB) and `uc-img.min.js` by 0.7 KB (8.8 to 9.5 KB).

## Removed internals \[#removed-internals]

These were never documented. Code that used them needs updating:

* The exports `UploaderBlock`, `ActivityBlock`, `SolutionBlock`, `Block`, `BaseComponent`, `Data`, `ModalEvents`
  and `ModalId`.
* Block members. Only `<uc-upload-ctx-provider>` has `getAPI()`, `api` and `uploadCollection`; other blocks, such
  as `<uc-form-input>`, `<uc-simple-btn>` and `<uc-upload-list>`, no longer have them. No block has `cfg`,
  `historyBack()`, `initActivity`, `doneActivity`, `getOutputData()` or the static `extSrcList` and `sourceTypes`
  any more, and `activityType` and the static `activities` remain only on activity blocks such as
  `<uc-upload-list>`. Call the [API](/docs/file-uploader/api/) from `uc-upload-ctx-provider.getAPI()`, set options on
  `<uc-config>`, and use the `UploadSource` and `ExternalUploadSource` exports for source names.
* `getAPI().destroy()`. Remove the uploader's elements from the page instead; the uploader cleans up after itself.
* The previous state layer (`this.$`, `sub()`, `*`-prefixed state keys) in subclasses of the uploader's blocks and
  the image editor's. The editor's state is now typed fields on its controller.

> **Note**
>
> **Note:** `@uploadcare/react-uploader` depends on an exact version of `@uploadcare/file-uploader` and ships its own
> copy of the uploader's CSS. React users get v1.37 with the next `@uploadcare/react-uploader` release; don't
> override its `@uploadcare/file-uploader` version to get it sooner.

---

## Path 1: Activity navigation \[#path-1-activity-navigation]

### Replace `setCurrentActivity()` + `setModalState()`

The old pattern required two separate method calls with manual modal state management.

**Before:**

```ts
api.setCurrentActivity('url')
api.setModalState(true)  // Must explicitly open modal
```

**After:**

```ts
api.navigate('url')  // Modal opens automatically
```

The modal is now managed implicitly. To close it, use `navigate(null)`.
[`historyBack()`](/docs/file-uploader/api/#history-back) goes back to the previous activity, and closes the modal
when there is none. It now returns to the previous activity, whichever it was, not only the start screen and the upload list; see
[Other changes](#other-changes).

```ts
api.navigate('url')   // Open activity
api.navigate(null)    // Close modal
```

On the inline uploader, which has no modal, `navigate()` switches the screen it shows, as `setCurrentActivity()`
did, and `navigate(null)` resets it to its start screen.

### Replace `setModalState()` alone \[#replace-setmodalstate-alone]

If you only use `setModalState()` for manual control:

**Before:**

```ts
api.setModalState(true)   // open
api.setModalState(false)  // close
```

**After:**

```ts
api.navigate('start-from')  // open with activity
api.navigate(null)          // close
```

`setModalState(true)` opens the modal on the activity set earlier with `setCurrentActivity()`, so pass that
activity to `navigate()` if it isn't `start-from`. On the inline uploader `setModalState(true)` does nothing:
delete the call rather than replace it. `setModalState(false)` and `navigate(null)` do the same on every solution:
they close the modal, and reset the inline uploader to its start screen.

---

## Path 2: Camera configuration \[#path-2-camera-configuration]

### Replace `enableVideoRecording` + `defaultCameraMode`

The old pattern used two separate config options.

**Before:**

```html
<uc-config
  enable-video-recording="true"
  default-camera-mode="video"
></uc-config>
```

**After:**

```html
<uc-config camera-modes="video, photo"></uc-config>
```

The first mode in `cameraModes` is the one the camera opens in, so list the mode
you set in `defaultCameraMode` first. To keep the camera photo-only, as
`enableVideoRecording="false"` did, set `camera-modes="photo"`.

---

## Path 3: Plugin labels \[#path-3-plugin-labels]

A source, activity or file action `label` is an l10n key or text shown as written. Any string still compiles, so a
misspelled key compiles too and is shown as written. Declare your own keys by augmenting `CustomLocaleDefinition`,
and assert text as `PlainText`. A future major version will accept only those.

**Before:**

```ts
pluginApi.registry.registerSource({ id: 'my-source', label: 'My source', onSelect })
```

**After:**

```ts
import type { PlainText } from '@uploadcare/file-uploader'

pluginApi.registry.registerSource({ id: 'my-source', label: 'My source' as PlainText, onSelect })
```

See [Labels](/docs/file-uploader/plugins/extension-points/#labels) for declaring keys.

---

## Path 4: Multipart attempts \[#path-4-multipart-attempts]

[`multipartMaxAttempts`](/docs/file-uploader/options/#multipart-max-attempts) has no effect. Setting it to a
non-default value logs a deprecation warning once. Remove it from your configuration:

```html
<!-- Before -->
<uc-config multipart-max-attempts="5"></uc-config>

<!-- After -->
<uc-config></uc-config>
```

---

## Deprecation timeline

| Feature                    | Deprecated | Will be removed |
| -------------------------- | ---------- | --------------- |
| setCurrentActivity()       | v1.37      | v2.0 (future)   |
| setModalState()            | v1.37      | v2.0 (future)   |
| enableVideoRecording       | v1.13      | v2.0 (future)   |
| defaultCameraMode          | v1.13      | v2.0 (future)   |
| Plugin label as any string | v1.37      | v2.0 (future)   |
| multipartMaxAttempts       | v1.37      | v2.0 (future)   |

---

## Auto-migration with AI

> **Best for**
>
> Codebases with 10+ occurrences across multiple files. Claude can understand context and handle edge cases automatically.

Copy the prompt below and paste it into Claude (or another LLM). It will analyze your code and provide migration suggestions.

````markdown
# Uploadcare File Uploader v1.36 → v1.37 Intelligent Migration

## Core Patterns (Context-Aware)

### Pattern 1: Sequential Activity + Modal Control

**Mechanical match:**
```
api.setCurrentActivity('url')
api.setModalState(true)
```
→ `api.navigate('url')`

**Smarter handling:**

1. **If on same line or adjacent:** Direct replacement works
2. **If separated by logic:** May indicate conditional modal opening
   - Check if there's a condition before setModalState(true)
   - If conditional, ask: "Should modal always open when activity changes?"
   - If not, may need custom handler to preserve condition
3. **If in different functions:** Check call graph
   - If user activity always opens modal, safe to merge
   - If sometimes open/close modal after activity change, needs review
4. **If activity is dynamic:** Extract to variable
   ```ts
   const activity = determineActivity(user)
   api.navigate(activity)  // instead of setCurrentActivity(activity); setModalState(true)
   ```

### Pattern 2: Isolated setModalState

**Mechanical match:**
- `setModalState(true)` → `navigate(???)` (unknown activity type)
- `setModalState(false)` → `navigate(null)`

**Smarter handling:**

1. **For setModalState(true):**
   - Trace backward in the same function: What activity was last set?
   - If no setCurrentActivity in same function, check parent scope
   - Suggest: "Infer activity from context? Or use navigate('start-from')?
   - Mark for manual review if activity is ambiguous
   - On the inline uploader (`uc-file-uploader-inline`), setModalState(true) does nothing: remove it, don't replace it

2. **For setModalState(false):**
   - Safe to replace with navigate(null): both close the modal and clear the activity, and both reset the inline
     uploader to its start screen
   - Don't replace it with historyBack(): that goes back one activity, and closes only when there's none

3. **Async pattern detection:**
   ```ts
   // RISKY: These are separated by async operation
   api.setCurrentActivity('upload-list')
   await uploadFile()
   api.setModalState(true)
   ```
   - Current code: Don't merge — modal open is intentional after upload
   - Suggest: Wrap in navigate() or use event-based reopening

### Pattern 3: Camera Configuration

**Before:**
```html
enable-video-recording="true" default-camera-mode="photo"
default-camera-mode="video" enable-video-recording="false"
```

The options can appear as `<uc-config>` attributes (`enable-video-recording`, `default-camera-mode`), in either
order, or as camelCase properties in JS and JSX (`enableVideoRecording`, `defaultCameraMode`). Each maps to the
same `cameraModes` value.

**Smarter handling:**

1. **Check logical consistency:**
   - If enableVideoRecording=false but defaultCameraMode=video → conflict
   - Ask whether video should be available: `cameraModes="photo"` keeps the old result, `cameraModes="video, photo"` enables both
   - If `cameraModes` is already set, merge into it instead of replacing it

2. **Detect single mode intent:**
   ```html
   enableVideoRecording="false" defaultCameraMode="photo"
   ```
   - Intent: Only photo mode
   - Migrate to: `cameraModes="photo"` (not photo,video)

3. **Default mode preservation:**
   - defaultCameraMode only picks the mode the camera opens in
   - Migrate it by listing that mode first: `defaultCameraMode="video"` → `cameraModes="video, photo"`

### Pattern 4: Plugin Labels (TypeScript)

A `label` passed to `registerSource`, `registerActivity` or `registerFileAction` that is plain text, not an l10n
key → assert it as `PlainText`: `'My source' as PlainText`, with
`import type { PlainText } from '@uploadcare/file-uploader'`. A label that is an l10n key stays as is.

### Pattern 5: multipartMaxAttempts

The `multipart-max-attempts` attribute or the `multipartMaxAttempts` property → remove it. The option has no effect.

## Behavior Changes to Flag (No Automatic Rewrite)

These are not deprecations: the code still compiles and may behave differently. Don't rewrite them. List each
match for manual review, with the reason:

- `getOutputItem()` called for a file that may be removed, including inside a `file-removed` handler: it now
  throws. Use the entry the event carries.
- `addFileFromUuid()` with a value that may not be a bare file UUID (a CDN URL, a UUID with operations, an empty
  string): it now throws `Invalid UUID`. Use `addFileFromCdnUrl()` for a CDN URL.
- `activity-change` handlers that read `e.detail.activity` without accepting `null`: it can be `null` when the
  modal closes.
- `common-upload-start`, `common-upload-failed` and `file-upload-failed` handlers that count calls or depend on
  when they fire: each now fires once, and the first two later than before.
- `modal-open` and `modal-close` handlers: they now also fire when `setCurrentActivity()` or `historyBack()`
  changes the screen of an open modal.
- `historyBack()` used to return to the start screen or the upload list: it now returns to whichever activity was
  shown before.
- `uploadAll()` called while files are still being validated: it now uploads them once validation passes.
- Code, tests or CSS that count or select `uc-file-item` elements (only the visible rows are rendered), or that
  select `uc-icon` inside `uc-cloud-image-editor` (now `uc-editor-icon`).
- Undocumented internals: the exports `UploaderBlock`, `ActivityBlock`, `SolutionBlock`, `Block`, `BaseComponent`,
  `Data`, `ModalEvents`, `ModalId`; `getAPI()`, `api`, `cfg` or `uploadCollection` read from a block other than
  `uc-upload-ctx-provider`; `getAPI().destroy()`; `this.$` and `sub()` in subclasses.

Full list: https://uploadcare.com/docs/file-uploader/migration-to-1.37.0/#other-changes

## Edge Cases to Detect & Handle

### 1. Conditional Modal Opening
```ts
if (hasFiles) {
  api.setCurrentActivity('url')
  api.setModalState(true)
}
```
✓ Safe: Merge to `if (hasFiles) api.navigate('url')`

### 2. Modal Opened from Multiple Activities
```ts
if (type === 'url') {
  api.setCurrentActivity('url')
} else if (type === 'camera') {
  api.setCurrentActivity('camera')
}
api.setModalState(true)  // Always opened after, regardless of activity
```
✓ Suggest: Pull navigate() call to eliminate duplication
```ts
const activity = type === 'url' ? 'url' : 'camera'
api.navigate(activity)
```

### 3. Modal Reopened Inside Event Handler
```ts
api.on('file-added', () => {
  if (someCondition) {
    api.setModalState(true)  // Reopen after file added
  }
})
```
⚠ Needs review: Use navigate('start-from') or navigate('url')?
Suggest: "What activity should reopen after the file-added event?"

### 4. Custom Plugin Activities
```ts
api.setCurrentActivity('my-custom-plugin')
api.setModalState(true)
```
✓ Safe: Merge to `api.navigate('my-custom-plugin')`
All activity types work with navigate()

### 5. Activity Not Set Before Modal Open
```ts
const openModal = () => api.setModalState(true)

// Called from multiple places with different activities set first
api.setCurrentActivity('url')
openModal()

// vs

api.setCurrentActivity('camera')
openModal()
```
⚠ Flag for review: openModal() doesn't know which activity to use
Suggest: Pass activity as parameter: `const openModal = (activity) => api.navigate(activity)`

## Detection Algorithm

1. **Find all setCurrentActivity() calls** — list line numbers + activity type
2. **Find all setModalState() calls** — list line numbers + argument (true/false)
3. **Group by proximity:**
   - Same block/function: adjacent = safe merge
   - Same function, separated by logic: needs review
   - Different functions: trace call graph
4. **Detect async separation:** Is there await/async between them?
5. **Detect conditionals:** Is one inside if/while/for but not the other?
6. **Suggest refactoring:**
   - Extract repeated setModalState() patterns
   - Consolidate activity selection logic
   - Add helper functions if needed

## Output Format

For each migration instance, provide:

**Confidence Level:** [HIGH/MEDIUM/LOW]
**Pattern:** [1–5, or "behavior change"]
**Location:** File:line
**Current Code:**
```ts
// Full context (5-10 lines)
```
**Migrated Code:**
```ts
// New version
```
**Notes:**
- Why this migration is safe/risky
- Any required manual review
- Suggested test cases

## File Types to Process

- .ts / .tsx (TypeScript/React)
- .js / .jsx (JavaScript)
- .html (HTML templates)
- .vue (Vue templates)
- .svelte (Svelte)

## Your Code

[PASTE YOUR CODE HERE]

## Task

1. Scan for every deprecation pattern above (1–5)
2. Group by context (same function, same block, async separation, etc.)
3. For each group:
   - Assign confidence level (HIGH = safe, MEDIUM = review needed, LOW = risky)
   - Suggest migration with full context
   - Highlight edge cases
   - Recommend test cases
4. At the end, suggest refactoring opportunities:
   - Consolidate duplicated modal logic
   - Extract helper functions
   - Add type safety (if TypeScript)
5. Provide a refactored version of the whole file if substantial changes
6. List every match from "Behavior Changes to Flag", with its location and what to check
````

### How the prompt works

The prompt:

* **Understands context.** It detects if `setModalState()` is conditional or async.
* **Finds edge cases.** It alerts you to modal logic spread across functions.
* **Suggests refactoring.** It consolidates repeated patterns.
* **Assigns confidence:** HIGH (safe), MEDIUM (review) or LOW (risky).
* **Provides test cases.** It tells you what to verify.
* **Flags behavior changes.** It lists the code that [Other changes](#other-changes) may affect.

### Examples

**Example 1: Safe merge (HIGH confidence)**

```ts
// Before
const openUrlInput = () => {
  api.setCurrentActivity('url')
  api.setModalState(true)
}

// After (Claude suggests this)
const openUrlInput = () => {
  api.navigate('url')
}
```

**Example 2: Needs review (MEDIUM confidence)**

```ts
// Before
async function handleUpload(files) {
  api.setCurrentActivity('upload-list')
  await processFiles(files)
  api.setModalState(true)  // Reopens after processing
}

// Claude asks: "Should modal stay closed during processing, then reopen?"
// If yes: Use a file-upload-success event listener instead
// If no: Move setModalState(true) earlier
```

**Example 3: Refactoring opportunity (MEDIUM confidence)**

```ts
// Before (repeated pattern)
if (type === 'url') {
  api.setCurrentActivity('url')
} else if (type === 'camera') {
  api.setCurrentActivity('camera')
} else if (type === 'upload-list') {
  api.setCurrentActivity('upload-list')
}
api.setModalState(true)

// Claude suggests this refactoring:
api.navigate(type)
```

**Example 4: Risky pattern (LOW confidence)**

```ts
// Before
const openModal = () => api.setModalState(true)  // Which activity?

// Later, in three different places:
api.setCurrentActivity('url')
openModal()

api.setCurrentActivity('camera')
openModal()

// Claude flags: "openModal() doesn't know current activity"
// Suggests: Pass activity as parameter
const navigate = (activity) => api.navigate(activity)
```

### When to use the prompt

Use the prompt when:

* You have complex async patterns
* Modal logic spans multiple files/functions
* You want refactoring suggestions
* You're unsure if a change is safe

---

## Verification checklist

After migration, verify everything works:

* [ ] Search for `setCurrentActivity` — should return 0 results
* [ ] Search for `setModalState` — should return 0 results
* [ ] Search for `enableVideoRecording` — should return 0 results
* [ ] Search for `defaultCameraMode` — should return 0 results
* [ ] Search for `multipartMaxAttempts` and `multipart-max-attempts` — should return 0 results
* [ ] Plugin labels that are plain text are asserted as `PlainText`
* [ ] Go through [Other changes](#other-changes) and [Removed internals](#removed-internals), and check each item
  your code depends on
* [ ] Run your test suite — all tests pass
* [ ] Test activity navigation in browser — modals open/close correctly
* [ ] Test camera modes — photo and video modes work
* [ ] Deploy and monitor — no errors in production

---

## Questions?

Refer to the [full API docs](/docs/file-uploader/api/) for complete documentation on all methods and options.