diff --git a/README.md b/README.md index 073ec34..63a491e 100644 --- a/README.md +++ b/README.md @@ -1,253 +1,119 @@ -# Escalated for React Native - -[![Tests](https://github.com/escalated-dev/escalated-react-native/actions/workflows/run-tests.yml/badge.svg)](https://github.com/escalated-dev/escalated-react-native/actions/workflows/run-tests.yml) -[![React Native](https://img.shields.io/badge/react--native-0.73+-61DAFB?logo=react&logoColor=white)](https://reactnative.dev/) -[![TypeScript](https://img.shields.io/badge/typescript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Views](https://hits.sh/github.com/escalated-dev/escalated-react-native.svg?style=flat&label=views&color=007ec6)](https://hits.sh/github.com/escalated-dev/escalated-react-native/) - -A full-featured, embeddable support ticket UI for React Native apps. Drop it into any React Native project — get a complete customer-facing helpdesk with ticket management, knowledge base, guest access, and SLA tracking. Connects to the Escalated REST API. - -> **[escalated.dev](https://escalated.dev)** — Learn more, view demos, and compare Cloud vs Self-Hosted options. - -**One provider, full support experience.** Wrap your app with `EscalatedProvider`, point it at your API, and every screen is ready — login, tickets, knowledge base, guest access. Customize colors, auth behavior, and locale with a single config object. TypeScript throughout. +

+ Escalated +

+ +

Escalated for React Native

+ +

+ Add a customer support area to your React Native app.
+ Tickets, a knowledge base and guest tickets, talking to your Escalated backend's REST API. +

+ +

+ Website · + Docs · + Cloud · + Releases +

+ +
+ +## What it does + + + + + + +
+

Every support screen, ready to navigate

+ Ticket list, ticket detail with replies and SLA timers, new ticket with attachments, and knowledge base screens, with pre-built React Navigation stacks. +
+

Fits your app instead of fighting it

+ One provider holds your colours, radius, locale and dark mode, and auth hooks let you plug in the sign-in you already have. +
## Features -- **Ticket management** — Create, view, filter, and reply to support tickets with file attachments -- **Knowledge base** — Searchable article list for self-service support -- **Guest tickets** — Anonymous ticket submission without requiring authentication -- **SLA tracking** — Real-time SLA countdown timers on ticket detail views -- **Satisfaction ratings** — Post-resolution CSAT ratings with star display -- **Auth hooks** — Override login, logout, register, and token retrieval to integrate with your existing auth -- **React Query** — Data fetching, caching, and synchronization out of the box -- **Navigation helpers** — Pre-built tab, auth, and guest navigation stacks for React Navigation -- **Dark mode** — Full dark and light theme support with `ThemeProvider` and `useTheme` hook -- **i18n** — Localized in 4 languages (English, Spanish, French, German) -- **TypeScript** — Full type definitions for every screen, component, hook, and config option -- **Configurable** — API base URL, auth hooks, primary color, border radius, dark mode, default locale + + + + + + + + + + + +
-## Requirements +**Tickets** +- Create, view, filter and reply +- File attachments on tickets and replies +- SLA countdown timers on ticket detail -- React Native 0.72+ -- React 18+ -- Node.js 18+ -- A running Escalated backend (Laravel, Rails, Django, AdonisJS, or WordPress) + -## Quick Start +**Self-service** +- Searchable knowledge base +- Post-resolution CSAT star ratings +- Guest tickets without an account -Install the package: + -```bash -npm install @escalated-dev/escalated-react-native -``` +**Auth and data** +- Override login, logout, register and token +- React Query fetching and caching -Install peer dependencies: +
-```bash -npm install @react-navigation/native @react-navigation/native-stack @react-navigation/bottom-tabs react-native-screens react-native-safe-area-context -``` +**Navigation** +- Pre-built tab, auth and guest stacks +- Drops into React Navigation -Wrap your app with `EscalatedProvider`: + -```tsx -import { EscalatedProvider, TicketListScreen } from '@escalated-dev/escalated-react-native'; +**Look and language** +- Dark and light themes with `useTheme` +- English, Spanish, French, German +- Configurable colour, radius, locale and API URL - - - {/* Wire screens into your navigation */} - - -``` + -That's it — your app now has a full support ticket UI. - -## Configuration - -The `EscalatedProvider` config prop accepts the following options: - -```tsx - - {children} - -``` +**TypeScript** +- Types for every screen, component and hook +- Typed config options -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `apiBaseUrl` | `string` | required | Base URL for the Escalated REST API | -| `authHooks` | `EscalatedAuthHooks` | `undefined` | Custom auth hook overrides | -| `primaryColor` | `string` | `'#4F46E5'` | Primary action color for buttons and accents | -| `borderRadius` | `number` | `8` | Border radius for cards, inputs, and buttons | -| `darkMode` | `boolean` | `false` | Enable dark theme | -| `defaultLocale` | `string` | `'en'` | Default locale code (`en`, `es`, `fr`, `de`) | - -## Available Screens - -| Screen | Description | -|--------|-------------| -| `LoginScreen` | Email/password login form | -| `RegisterScreen` | New account registration | -| `TicketListScreen` | Paginated ticket list with status filters | -| `TicketCardScreen` | Individual ticket card view | -| `TicketFilterScreen` | Advanced ticket filter controls | -| `CreateTicketScreen` | New ticket form with file attachments | -| `TicketDetailScreen` | Full ticket thread with replies and metadata | -| `KBListScreen` | Knowledge base article listing | -| `KBArticleScreen` | Single article view | -| `GuestCreateScreen` | Anonymous ticket submission | -| `GuestTicketScreen` | Guest ticket view via token | -| `SettingsScreen` | User preferences and locale selection | - -## Available Components - -| Component | Description | -|-----------|-------------| -| `StatusBadge` | Ticket status indicator | -| `PriorityBadge` | Priority level indicator | -| `SlaTimer` | SLA countdown display | -| `AttachmentList` | File attachment display | -| `FilePicker` | File selection for attachments | -| `SatisfactionRating` | Star rating display and input | -| `ReplyThread` | Chronological message thread | -| `ReplyComposer` | Reply text input with attachments | -| `EmptyState` | Placeholder for empty lists | -| `LoadingSkeleton` | Skeleton loading placeholder | - -## Navigation Helpers - -Escalated provides pre-built navigation stacks for React Navigation: - -```tsx -import { - createEscalatedTabs, - createAuthStack, - createGuestStack, -} from '@escalated-dev/escalated-react-native'; - -// Full tabbed experience (Tickets, Knowledge Base, Settings) -const EscalatedTabs = createEscalatedTabs(); - -// Auth screens only (Login, Register) -const AuthStack = createAuthStack(); - -// Guest screens only (GuestCreate, GuestTicket) -const GuestStack = createGuestStack(); -``` +
-Wire them into your existing navigation tree: +

Every feature in detail

-```tsx - - - - - - - -``` +

+ React Native + TypeScript + React Query + React Navigation +

-## Auth Hooks - -Auth hooks let you override default authentication behavior to integrate with your app's existing auth system: - -```tsx - { - // Your custom login logic - return yourAuthToken; - }, - onLogout: async () => { - // Your custom logout logic - }, - onRegister: async (name, email, password) => { - // Your custom registration logic - return yourAuthToken; - }, - getToken: async () => { - // Return the current auth token - return await AsyncStorage.getItem('token'); - }, - }, - }} -> - {children} - -``` +## Quick start -When no auth hooks are provided, Escalated uses its built-in Axios HTTP client for token management. - -## Theme - -Escalated includes a `ThemeProvider` and `useTheme` hook for dark/light mode support: - -```tsx -import { useTheme } from '@escalated-dev/escalated-react-native'; - -function MyComponent() { - const { colors, darkMode, toggleDarkMode } = useTheme(); - - return ( - - Themed content - - ); -} +```bash +npm install @escalated-dev/escalated-react-native +npm install @react-navigation/native @react-navigation/native-stack @react-navigation/bottom-tabs react-native-screens react-native-safe-area-context ``` -Theme values (primary color, border radius, dark mode) are set via the `EscalatedProvider` config and accessible anywhere via `useTheme`. - -## Internationalization - -Escalated ships with translations for four languages: - -| Code | Language | -|------|----------| -| `en` | English | -| `es` | Spanish | -| `fr` | French | -| `de` | German | - -Set the default locale via `config.defaultLocale` or let users switch in the Settings screen. - -## Peer Dependencies - -| Package | Purpose | -|---------|---------| -| `react` | React core | -| `react-native` | React Native core | -| `@react-navigation/native` | Navigation container | -| `@react-navigation/native-stack` | Stack navigator | -| `@react-navigation/bottom-tabs` | Tab navigator | -| `react-native-screens` | Native screen primitives | -| `react-native-safe-area-context` | Safe area insets | +Then wrap your app in `EscalatedProvider` with your API base URL. The [installation guide](docs/installation.md) shows the full setup and every config option. -## Also Available For +## Learn more -| Framework | Package | Repository | -|-----------|---------|------------| -| Laravel | `escalated-dev/escalated-laravel` | [GitHub](https://github.com/escalated-dev/escalated-laravel) | -| Ruby on Rails | `escalated` (gem) | [GitHub](https://github.com/escalated-dev/escalated-rails) | -| Django | `escalated-django` | [GitHub](https://github.com/escalated-dev/escalated-django) | -| AdonisJS | `@escalated-dev/escalated-adonis` | [GitHub](https://github.com/escalated-dev/escalated-adonis) | -| WordPress | `escalated-wordpress` | [GitHub](https://github.com/escalated-dev/escalated-wordpress) | -| Vue UI | `@escalated-dev/escalated` | [GitHub](https://github.com/escalated-dev/escalated) | -| Flutter | `escalated` (Flutter) | [GitHub](https://github.com/escalated-dev/escalated-flutter) | -| React Native | `@escalated-dev/escalated-react-native` | [GitHub](https://github.com/escalated-dev/escalated-react-native) | +- [All features](docs/features.md) · [Installation and configuration](docs/installation.md) +- [Screens, components and navigation](docs/screens-and-components.md) · [Auth hooks](docs/auth-hooks.md) +- [Theming](docs/theming.md) · [Internationalization](docs/internationalization.md) +- [Escalated docs](https://escalated.dev/docs) -Same architecture, same REST API, same support experience — for every major framework. +Escalated is also available for [Flutter](https://github.com/escalated-dev/escalated-flutter), and as a web helpdesk for [Laravel](https://github.com/escalated-dev/escalated-laravel), [Rails](https://github.com/escalated-dev/escalated-rails), [Django](https://github.com/escalated-dev/escalated-django), [NestJS](https://github.com/escalated-dev/escalated-nestjs), [AdonisJS](https://github.com/escalated-dev/escalated-adonis), [Symfony](https://github.com/escalated-dev/escalated-symfony), [Phoenix](https://github.com/escalated-dev/escalated-phoenix), [Go](https://github.com/escalated-dev/escalated-go), [.NET](https://github.com/escalated-dev/escalated-dotnet), [Spring](https://github.com/escalated-dev/escalated-spring), [WordPress](https://github.com/escalated-dev/escalated-wordpress) and [Filament](https://github.com/escalated-dev/escalated-filament). ## License -MIT - Copyright (c) Escalated.dev. See [LICENSE](LICENSE). +MIT. Copyright (c) Escalated.dev. See [LICENSE](LICENSE). diff --git a/docs/auth-hooks.md b/docs/auth-hooks.md new file mode 100644 index 0000000..1d0480f --- /dev/null +++ b/docs/auth-hooks.md @@ -0,0 +1,34 @@ +# Auth hooks + +## Auth Hooks + +Auth hooks let you override default authentication behavior to integrate with your app's existing auth system: + +```tsx + { + // Your custom login logic + return yourAuthToken; + }, + onLogout: async () => { + // Your custom logout logic + }, + onRegister: async (name, email, password) => { + // Your custom registration logic + return yourAuthToken; + }, + getToken: async () => { + // Return the current auth token + return await AsyncStorage.getItem('token'); + }, + }, + }} +> + {children} + +``` + +When no auth hooks are provided, Escalated uses its built-in Axios HTTP client for token management. diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 0000000..cc4a00d --- /dev/null +++ b/docs/features.md @@ -0,0 +1,16 @@ +# Features + +## Features + +- **Ticket management** — Create, view, filter, and reply to support tickets with file attachments +- **Knowledge base** — Searchable article list for self-service support +- **Guest tickets** — Anonymous ticket submission without requiring authentication +- **SLA tracking** — Real-time SLA countdown timers on ticket detail views +- **Satisfaction ratings** — Post-resolution CSAT ratings with star display +- **Auth hooks** — Override login, logout, register, and token retrieval to integrate with your existing auth +- **React Query** — Data fetching, caching, and synchronization out of the box +- **Navigation helpers** — Pre-built tab, auth, and guest navigation stacks for React Navigation +- **Dark mode** — Full dark and light theme support with `ThemeProvider` and `useTheme` hook +- **i18n** — Localized in 4 languages (English, Spanish, French, German) +- **TypeScript** — Full type definitions for every screen, component, hook, and config option +- **Configurable** — API base URL, auth hooks, primary color, border radius, dark mode, default locale diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..9fa3b86 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,76 @@ +# Installation and configuration + +## Requirements + +- React Native 0.72+ +- React 18+ +- Node.js 18+ +- A running Escalated backend (Laravel, Rails, Django, AdonisJS, or WordPress) + +## Quick Start + +Install the package: + +```bash +npm install @escalated-dev/escalated-react-native +``` + +Install peer dependencies: + +```bash +npm install @react-navigation/native @react-navigation/native-stack @react-navigation/bottom-tabs react-native-screens react-native-safe-area-context +``` + +Wrap your app with `EscalatedProvider`: + +```tsx +import { EscalatedProvider, TicketListScreen } from '@escalated-dev/escalated-react-native'; + + + + {/* Wire screens into your navigation */} + + +``` + +That's it — your app now has a full support ticket UI. + +## Configuration + +The `EscalatedProvider` config prop accepts the following options: + +```tsx + + {children} + +``` + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `apiBaseUrl` | `string` | required | Base URL for the Escalated REST API | +| `authHooks` | `EscalatedAuthHooks` | `undefined` | Custom auth hook overrides | +| `primaryColor` | `string` | `'#4F46E5'` | Primary action color for buttons and accents | +| `borderRadius` | `number` | `8` | Border radius for cards, inputs, and buttons | +| `darkMode` | `boolean` | `false` | Enable dark theme | +| `defaultLocale` | `string` | `'en'` | Default locale code (`en`, `es`, `fr`, `de`) | + +## Peer Dependencies + +| Package | Purpose | +|---------|---------| +| `react` | React core | +| `react-native` | React Native core | +| `@react-navigation/native` | Navigation container | +| `@react-navigation/native-stack` | Stack navigator | +| `@react-navigation/bottom-tabs` | Tab navigator | +| `react-native-screens` | Native screen primitives | +| `react-native-safe-area-context` | Safe area insets | diff --git a/docs/internationalization.md b/docs/internationalization.md new file mode 100644 index 0000000..f0de48e --- /dev/null +++ b/docs/internationalization.md @@ -0,0 +1,14 @@ +# Internationalization + +## Internationalization + +Escalated ships with translations for four languages: + +| Code | Language | +|------|----------| +| `en` | English | +| `es` | Spanish | +| `fr` | French | +| `de` | German | + +Set the default locale via `config.defaultLocale` or let users switch in the Settings screen. diff --git a/docs/screens-and-components.md b/docs/screens-and-components.md new file mode 100644 index 0000000..ad5d9f3 --- /dev/null +++ b/docs/screens-and-components.md @@ -0,0 +1,66 @@ +# Screens, components and navigation + +## Available Screens + +| Screen | Description | +|--------|-------------| +| `LoginScreen` | Email/password login form | +| `RegisterScreen` | New account registration | +| `TicketListScreen` | Paginated ticket list with status filters | +| `TicketCardScreen` | Individual ticket card view | +| `TicketFilterScreen` | Advanced ticket filter controls | +| `CreateTicketScreen` | New ticket form with file attachments | +| `TicketDetailScreen` | Full ticket thread with replies and metadata | +| `KBListScreen` | Knowledge base article listing | +| `KBArticleScreen` | Single article view | +| `GuestCreateScreen` | Anonymous ticket submission | +| `GuestTicketScreen` | Guest ticket view via token | +| `SettingsScreen` | User preferences and locale selection | + +## Available Components + +| Component | Description | +|-----------|-------------| +| `StatusBadge` | Ticket status indicator | +| `PriorityBadge` | Priority level indicator | +| `SlaTimer` | SLA countdown display | +| `AttachmentList` | File attachment display | +| `FilePicker` | File selection for attachments | +| `SatisfactionRating` | Star rating display and input | +| `ReplyThread` | Chronological message thread | +| `ReplyComposer` | Reply text input with attachments | +| `EmptyState` | Placeholder for empty lists | +| `LoadingSkeleton` | Skeleton loading placeholder | + +## Navigation Helpers + +Escalated provides pre-built navigation stacks for React Navigation: + +```tsx +import { + createEscalatedTabs, + createAuthStack, + createGuestStack, +} from '@escalated-dev/escalated-react-native'; + +// Full tabbed experience (Tickets, Knowledge Base, Settings) +const EscalatedTabs = createEscalatedTabs(); + +// Auth screens only (Login, Register) +const AuthStack = createAuthStack(); + +// Guest screens only (GuestCreate, GuestTicket) +const GuestStack = createGuestStack(); +``` + +Wire them into your existing navigation tree: + +```tsx + + + + + + + +``` diff --git a/docs/theming.md b/docs/theming.md new file mode 100644 index 0000000..cfa3944 --- /dev/null +++ b/docs/theming.md @@ -0,0 +1,21 @@ +# Theming + +## Theme + +Escalated includes a `ThemeProvider` and `useTheme` hook for dark/light mode support: + +```tsx +import { useTheme } from '@escalated-dev/escalated-react-native'; + +function MyComponent() { + const { colors, darkMode, toggleDarkMode } = useTheme(); + + return ( + + Themed content + + ); +} +``` + +Theme values (primary color, border radius, dark mode) are set via the `EscalatedProvider` config and accessible anywhere via `useTheme`.