@oryksa/react-native 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,24 +1,37 @@
1
- # Changelog
2
-
3
- ## 1.1.1
4
-
5
- - Voice screen: the words the person says are never shown on screen. While the AI thinks it shows "I'm listening" / "One moment..." in the interface language; the AI's answer still shows as text. Same behaviour as the ORYKSA apps, web and extensions.
6
-
7
- ## 1.1.0
8
-
9
- * Copy button under each reply of the AI (copies the text, shows a check for a moment), as in the ORYKSA apps and extension. Uses `@react-native-clipboard/clipboard` when installed (optional peer dependency).
10
- * Voice: a voice screen with the photo of the AI ("I'm listening" / her answer, Mute, Close) opened from the microphone in the chat. The same behaviour as the ORYKSA app: the microphone stays open while she speaks and only a human voice cuts her off (typing, TV, birds and her own echo do not); she stops on the word and the text stays in the chat; the second before the cut is kept; 700 ms of silence closes a sentence (15 s at most); a whisper gets a whispered, shorter answer; her voice is the one chosen in ORYKSA and, if it fails, the text is shown without a robot voice.
11
- * The voice engine is the ORYKSA app engine (`Vad`), with the same audio tests on real recordings.
12
- * `appContext`: tell the AI which screen of your app the customer is on (product, cart, booking) so it answers about it.
13
- * The client gets `tts`, `transcribe` and `voiceStats`; `send` accepts `voice`, `whisper`, `appContext` and returns `speech` (the short spoken version).
14
- * The agent includes `photo` (the AI photo from Your AI), `voice` and `language`.
15
- * Bold text (`**`) in the chat bubbles.
16
- * The SDK serves the customers of the business only: it is never an interface for the owner.
17
- * Voice uses an audio adapter: by default `react-native-live-audio-stream`, `react-native-sound` and `react-native-fs` (optional peer dependencies); Expo or other stacks can pass their own. Without them the chat works and the microphone is hidden.
18
-
19
- ## 1.0.0
20
-
21
- * First release.
22
- * `OryksaClient`: in-app client with short-lived session tokens (agent, send, sendAndWait, messages), refreshes the token when it expires.
23
- * `OryksaChatButton`, `OryksaChatModal` and `OryksaChat`: ready chat with the look of the ORYKSA website chat, name and photo of the AI from the ORYKSA account, in English, Portuguese (Portugal and Brazil) and Spanish.
24
- * No native code, works in Expo Go. TypeScript types included.
1
+ # Changelog
2
+
3
+ ## 1.1.3
4
+
5
+ - **Links you can tap, with an Open button.** The links of her replies were plain text. They can now be tapped in the chat (web and e-mail, underlined, in the accent colour on her bubbles and white on the customer's), and each web link (3 at most) gets a card under the reply with the picture and the title of the page and an **Open** button. Titles and pictures come from `client.linkPreview(url)` (new `GET /v1/client/link-preview`, kept in memory, never throws), only for the pages of the business's own site (its website chat domains); other links show the address.
6
+ - `onLink: (url) => boolean` on `OryksaChatButton`, `OryksaChat`, `OryksaChatModal` and `OryksaVoiceScreen` lets your app open its own screens (return true) instead of the system (`Linking.openURL`).
7
+ - **The voice screen shows what she says**, the short spoken version, without the addresses (7 lines at most), with the same cards under it; tapping Open closes the voice screen, then opens the link. `OryksaVoiceController.lastSpoken`; `say()` now also sets `lastReply` and `lastSpoken`.
8
+ - New exports: `OryksaLinkCard`, `linksIn`, `withoutLinks`, `openLink` (and the types `OryksaLinkHandler`, `OryksaLinkPreview`). Tests: `test/links.test.js`; the README links code is type-checked by CI (`test/readme/readme-links.tsx`).
9
+ - **Attach a photo, take one or send a document.** The chat input has an attach button (on by default, `attachments={false}` hides it on `OryksaChat`, `OryksaChatModal` and `OryksaChatButton`): the photo library, the camera (not on the web) or a document (PDF, Word, text, CSV and pictures, up to 8 MB). Photos come made smaller to 1600 pixels, JPEG 80%, up to 2 MB, and go as `image_base64` / `image_mime`; documents go as `file_base64` / `file_name` / `file_mime` on `POST /v1/client/chat`. The customer's bubble shows the photo, or the document icon and its name; a file that is too large or cannot be read shows a short note. The pickers come from two new optional peer dependencies your app installs, `react-native-image-picker` (library and camera) and `@react-native-documents/picker` (documents); each choice shows only when its library is installed, and `picker` takes your own adapter (Expo). `send(message, { image, file })`, `createDefaultPicker`, `photoAttachment`, `documentAttachment`, `MAX_PHOTO_BYTES`, `MAX_FILE_BYTES`. Tests: `test/attach.test.js`; the README attach code is type-checked (`test/readme/readme-attach.tsx`).
10
+
11
+ ## 1.1.2
12
+
13
+ - Documentation only, no change in the SDK behaviour: README in English, Portuguese, Spanish and French, with real screenshots of the SDK components (CI, React Native for Web, ORYKSA test account), an animated overview of the ORYKSA SDKs and a *Colours and theme* section. The README theme code is type-checked by CI (`test/readme`).
14
+ - The YouTube link of the author section is now https://www.youtube.com/@ORYKSA.
15
+
16
+ ## 1.1.1
17
+
18
+ - Voice screen: the words the person says are never shown on screen. While the AI thinks it shows "I'm listening" / "One moment..." in the interface language; the AI's answer still shows as text. Same behaviour as the ORYKSA apps, web and extensions.
19
+
20
+ ## 1.1.0
21
+
22
+ * Copy button under each reply of the AI (copies the text, shows a check for a moment), as in the ORYKSA apps and extension. Uses `@react-native-clipboard/clipboard` when installed (optional peer dependency).
23
+ * Voice: a voice screen with the photo of the AI ("I'm listening" / her answer, Mute, Close) opened from the microphone in the chat. The same behaviour as the ORYKSA app: the microphone stays open while she speaks and only a human voice cuts her off (typing, TV, birds and her own echo do not); she stops on the word and the text stays in the chat; the second before the cut is kept; 700 ms of silence closes a sentence (15 s at most); a whisper gets a whispered, shorter answer; her voice is the one chosen in ORYKSA and, if it fails, the text is shown without a robot voice.
24
+ * The voice engine is the ORYKSA app engine (`Vad`), with the same audio tests on real recordings.
25
+ * `appContext`: tell the AI which screen of your app the customer is on (product, cart, booking) so it answers about it.
26
+ * The client gets `tts`, `transcribe` and `voiceStats`; `send` accepts `voice`, `whisper`, `appContext` and returns `speech` (the short spoken version).
27
+ * The agent includes `photo` (the AI photo from Your AI), `voice` and `language`.
28
+ * Bold text (`**`) in the chat bubbles.
29
+ * The SDK serves the customers of the business only: it is never an interface for the owner.
30
+ * Voice uses an audio adapter: by default `react-native-live-audio-stream`, `react-native-sound` and `react-native-fs` (optional peer dependencies); Expo or other stacks can pass their own. Without them the chat works and the microphone is hidden.
31
+
32
+ ## 1.0.0
33
+
34
+ * First release.
35
+ * `OryksaClient`: in-app client with short-lived session tokens (agent, send, sendAndWait, messages), refreshes the token when it expires.
36
+ * `OryksaChatButton`, `OryksaChatModal` and `OryksaChat`: ready chat with the look of the ORYKSA website chat, name and photo of the AI from the ORYKSA account, in English, Portuguese (Portugal and Brazil) and Spanish.
37
+ * No native code, works in Expo Go. TypeScript types included.
package/README.es.md ADDED
@@ -0,0 +1,161 @@
1
+ <p align="center"><img src="https://app.oryksa.com/static/oryksa_logo.png" width="300" alt="ORYKSA"></p>
2
+
3
+ # @oryksa/react-native
4
+
5
+ [![English](https://img.shields.io/badge/English-30363d?style=for-the-badge)](README.md) [![Português](https://img.shields.io/badge/Portugu%C3%AAs-30363d?style=for-the-badge)](README.pt.md) [![Español](https://img.shields.io/badge/Espa%C3%B1ol-0891b2?style=for-the-badge)](README.es.md) [![Français](https://img.shields.io/badge/Fran%C3%A7ais-30363d?style=for-the-badge)](README.fr.md)
6
+
7
+ <p align="center"><a href="https://developer.oryksa.com/es/sdks"><img src="https://developer.oryksa.com/assets/img/sdk/oryksa-sdks-es.gif" width="760" alt="SDKs de ORYKSA: el chat y la voz de la IA en iOS, Android, Flutter, React Native y la web"></a></p>
8
+
9
+ SDK oficial de React Native de **ORYKSA AI Employees**. Pon dentro de tu app iOS y Android (React Native o Expo) un empleado de IA que ya conoce tu negocio: un chat listo con el mismo aspecto que el chat de la web de ORYKSA, el nombre y la foto de tu IA desde tu cuenta ORYKSA, en inglés, portugués y español.
10
+
11
+ * Documentación: https://developer.oryksa.com/es/sdks
12
+ * API: `https://api.oryksa.com/v1`
13
+ * Sin código nativo: funciona en Expo Go.
14
+
15
+ ## Capturas de pantalla
16
+
17
+ <p align="center"><img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_product_en.png" width="230" alt="Product page with the chat button"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_chat_en.png" width="230" alt="Chat"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_theme_en.png" width="230" alt="Chat with the README theme"></p>
18
+
19
+ Los propios componentes del SDK, dibujados por el CI en Chrome a tamaño de móvil con React Native for Web y una cuenta de prueba de ORYKSA (`test/web/`). En el móvil el chat muestra también el micrófono, que necesita las bibliotecas de audio nativas. El chat verde usa el código de *Colores y tema*, más abajo.
20
+
21
+ ## Instalar
22
+
23
+ ```bash
24
+ npm install @oryksa/react-native
25
+ ```
26
+
27
+ ## Para qué sirve
28
+
29
+ El SDK pone el chat y la voz de ORYKSA dentro de tu app para atender a los **clientes de tu negocio**: preguntan, compran y reservan. La IA responde con tu Brain, tus productos y tus servicios, con el nombre, la foto y la voz que elegiste en *Tu IA*, y guarda leads, reservas y ventas en las Actividades de tu cuenta ORYKSA. **No** es una interfaz para el dueño: a través del SDK nadie cambia ajustes, lee las Actividades ni da órdenes a ORYKSA. Más información: https://help.oryksa.com/es/a/sdks-what-they-do
30
+
31
+ Las palabrotas que escribe el cliente aparecen con asteriscos en el chat (la misma lista de todos los chats de ORYKSA, cargada desde `https://app.oryksa.com/widget/profanity.json` y guardada 24 horas). Las respuestas de la IA ya vienen filtradas desde el servidor.
32
+
33
+ ## Voz y contexto de la app (1.1)
34
+
35
+ El chat muestra un micrófono cuando tu plan incluye voz. Abre la pantalla de voz con el mismo comportamiento que la app de ORYKSA: el micrófono sigue abierto mientras ella habla y solo una voz humana la interrumpe (el tecleo, la televisión y su propio eco no); se detiene en la palabra y el texto queda en el chat; a un susurro responde con un susurro; si su voz falla, se muestra el texto (nunca una voz robótica).
36
+
37
+ La voz necesita tres bibliotecas nativas (dependencias peer opcionales) y el permiso de micrófono (Android `RECORD_AUDIO`, iOS `NSMicrophoneUsageDescription`):
38
+
39
+ ```sh
40
+ npm install react-native-live-audio-stream react-native-sound react-native-fs
41
+ ```
42
+
43
+ Sin ellas, el chat funciona y el micrófono queda oculto. Con Expo u otra pila de audio: pasa tu propio adaptador `audio` (`startMic`, `stopMic`, `play`, `stopPlayback`).
44
+
45
+ Cada respuesta de la IA tiene un botón de copiar debajo. Usa `@react-native-clipboard/clipboard` cuando está instalado (dependencia peer opcional: `npm install @react-native-clipboard/clipboard`); las versiones antiguas de React Native usan el `Clipboard` integrado.
46
+
47
+ ```jsx
48
+ <OryksaChatButton client={client} lang="pt"
49
+ appContext={() => ({ screen: "product", title: "Sky Beginner Snowboard, 489.95" })} />
50
+ ```
51
+
52
+ ## Enlaces con botón Abrir (1.1.3)
53
+
54
+ Los enlaces que da la IA se pueden tocar en el chat (direcciones web y e-mails), y cada enlace web tiene una tarjeta debajo de su respuesta con la foto y el título de la página y un botón **Abrir** (las páginas de tu propio sitio, los dominios de tu chat web; otros sitios muestran la dirección). La pantalla de voz muestra lo que ella dice sin las direcciones, con las mismas tarjetas; tocar Abrir cierra la pantalla de voz. Pasa `onLink` para abrir tus propias pantallas, por ejemplo la página del producto: devuelve true cuando tu app lo abrió, false para que lo abra el sistema (`Linking.openURL`).
55
+
56
+ ```jsx
57
+ <OryksaChatButton client={client} lang="es"
58
+ onLink={(url) => {
59
+ const id = myProductIdOf(url); // tus rutas
60
+ if (!id) return false;
61
+ navigation.navigate("Product", { id });
62
+ return true;
63
+ }} />
64
+ ```
65
+
66
+ `onLink` también está en `OryksaChat`, `OryksaChatModal` y `OryksaVoiceScreen`.
67
+
68
+ ## Adjuntar una foto o un documento (1.1.3)
69
+
70
+ El chat tiene un botón de adjuntar (un clip, activado por defecto): una foto de la galería, una foto de la cámara o un documento (PDF, Word, texto, CSV, hasta 8 MB). La IA mira la foto (reducida a 1600 píxeles, JPEG 80%, hasta 2 MB) y lee el documento; la burbuja del cliente muestra la foto, o el icono del documento y su nombre. `attachments={false}` oculta el botón.
71
+
72
+ React Native no tiene selector propio, así que el SDK usa dos bibliotecas opcionales que tu app instala (dependencias peer opcionales, como las de la voz). Cada opción solo aparece cuando su biblioteca está; sin las dos, el botón se oculta:
73
+
74
+ ```sh
75
+ npm install react-native-image-picker @react-native-documents/picker
76
+ ```
77
+
78
+ * `react-native-image-picker`: galería y cámara. Info.plist de iOS: `NSPhotoLibraryUsageDescription` y `NSCameraUsageDescription`. Android: ningún permiso para la galería; para la cámara, `CAMERA` solo hace falta si tu app lo declara en su propio manifest (entonces concédelo antes de abrir la cámara).
79
+ * `@react-native-documents/picker`: documentos, en el selector de documentos del sistema (sin permiso). Los documentos se leen con `react-native-fs` cuando está instalado, si no con `fetch`.
80
+
81
+ ```jsx
82
+ <OryksaChatButton client={client} lang="es" attachments={false} /> {/* sin botón de adjuntar */}
83
+
84
+ // Expo u otra stack: tus propios selectores (si falta uno, se oculta esa opción)
85
+ const picker = {
86
+ pickPhoto: () => myPhotoPicker(), // { base64, mime } reducida (1600 px, JPEG 80%), o null
87
+ pickDocument: () => myDocumentPicker(), // { base64, name, mime }, o null
88
+ };
89
+ <OryksaChat client={client} picker={picker} />
90
+ ```
91
+
92
+ Sin la interfaz: `client.send("Aquí está el presupuesto", { file: { base64, name: "presupuesto.pdf", mime: "application/pdf" } })` (fotos: `{ image: { base64, mime } }`).
93
+
94
+ ## Cómo funciona (y por qué la clave está segura)
95
+
96
+ 1. Tu **servidor** guarda la clave secreta de la API (`oryk_live_...`, creada en developer.oryksa.com) y crea un **token de sesión** de corta duración para cada usuario que ha iniciado sesión, con `POST /v1/sessions` (con `@oryksa/sdk` en Node: `oryksa.createSession(...)`).
97
+ 2. Tu **app** recibe solo ese token de sesión (`oryk_cs_...`). La clave secreta nunca entra en la app.
98
+ 3. Cada respuesta de la IA cuenta como una interacción de tu plan ORYKSA, igual que en WhatsApp.
99
+
100
+ ## En la app
101
+
102
+ ```jsx
103
+ import { OryksaClient, OryksaChatButton } from "@oryksa/react-native";
104
+
105
+ const client = new OryksaClient({
106
+ getToken: async () => (await fetch("https://your-server.example/oryksa-token").then((r) => r.json())).token,
107
+ });
108
+
109
+ export default function App() {
110
+ return (
111
+ <View style={{ flex: 1 }}>
112
+ <MyScreens />
113
+ <OryksaChatButton client={client} lang="en" /> {/* en, pt, br, es */}
114
+ </View>
115
+ );
116
+ }
117
+ ```
118
+
119
+ Otras piezas:
120
+
121
+ * `<OryksaChatModal client={client} visible={open} onClose={() => setOpen(false)} />`: abre el chat desde tu propio botón.
122
+ * `<OryksaChat client={client} />`: el panel dentro de cualquier pantalla.
123
+ * `theme={{ accent: "#5B57E0" }}`: colores.
124
+ * Sin la interfaz: `await client.agent()`, `await client.sendAndWait("Are you open on Saturday?")`, `await client.messages()`.
125
+
126
+ ## Mantén la IA sincronizada con tu app
127
+
128
+ En tu servidor, con `@oryksa/sdk`:
129
+
130
+ ```js
131
+ await oryksa.learnApp({ name: "FitTrack", description: "...", screens: [...], faq: [...] });
132
+ ```
133
+
134
+ ## Errores
135
+
136
+ Las llamadas que fallan lanzan `OryksaError` con `status`, `code` (por ejemplo `interaction_limit_reached`, `rate_limited`, `plan_required`) y `message`.
137
+
138
+ ## Colores y tema
139
+
140
+ La prop `theme` recibe un objeto con hasta cinco colores en texto hexadecimal: `accent` (botones, burbujas del visitante, enlaces), `ink` (texto principal), `soft` (burbujas de la IA), `background` (panel) y `muted` (texto secundario). Las claves que faltan mantienen el valor por defecto, así que `{ accent: "#0E8A6B" }` basta. Funciona en `OryksaChatButton`, `OryksaChatModal` y `OryksaChat`, y los valores por defecto se exportan como `DEFAULT_THEME`.
141
+
142
+ ```jsx
143
+ const theme = { accent: "#0E8A6B" };
144
+
145
+ <OryksaChatButton client={client} lang="en" theme={theme} />
146
+ ```
147
+
148
+ No hay tema oscuro automático: para el modo oscuro, pasa tus propios colores oscuros.
149
+
150
+ ---
151
+
152
+ ## Sobre el autor
153
+
154
+ **Weslley Harakawa** - Fundador de ORYKSA AI. En Lisboa, Portugal. Especialidades: inteligencia artificial, desarrollo web y móvil, tokenización en blockchain. Formación: University of the People.
155
+
156
+ - LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
157
+ - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSA)
158
+
159
+ ---
160
+
161
+ MIT License · ORYKSA AI Employees · W8 Atlantic Unipessoal Lda
package/README.fr.md ADDED
@@ -0,0 +1,161 @@
1
+ <p align="center"><img src="https://app.oryksa.com/static/oryksa_logo.png" width="300" alt="ORYKSA"></p>
2
+
3
+ # @oryksa/react-native
4
+
5
+ [![English](https://img.shields.io/badge/English-30363d?style=for-the-badge)](README.md) [![Português](https://img.shields.io/badge/Portugu%C3%AAs-30363d?style=for-the-badge)](README.pt.md) [![Español](https://img.shields.io/badge/Espa%C3%B1ol-30363d?style=for-the-badge)](README.es.md) [![Français](https://img.shields.io/badge/Fran%C3%A7ais-0891b2?style=for-the-badge)](README.fr.md)
6
+
7
+ <p align="center"><a href="https://developer.oryksa.com/fr/sdks"><img src="https://developer.oryksa.com/assets/img/sdk/oryksa-sdks-fr.gif" width="760" alt="SDK ORYKSA : le chat et la voix de l'IA sur iOS, Android, Flutter, React Native et le web"></a></p>
8
+
9
+ SDK React Native officiel d'**ORYKSA AI Employees**. Mettez dans votre app iOS et Android (React Native ou Expo) un employé IA qui connaît déjà votre entreprise : un chat prêt à l'emploi identique au chat du site ORYKSA, le nom et la photo de votre IA issus de votre compte ORYKSA, en anglais, portugais et espagnol.
10
+
11
+ * Documentation : https://developer.oryksa.com/fr/sdks
12
+ * API : `https://api.oryksa.com/v1`
13
+ * Aucun code natif : fonctionne dans Expo Go.
14
+
15
+ ## Captures d'écran
16
+
17
+ <p align="center"><img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_product_en.png" width="230" alt="Product page with the chat button"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_chat_en.png" width="230" alt="Chat"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_theme_en.png" width="230" alt="Chat with the README theme"></p>
18
+
19
+ Les composants du SDK eux-mêmes, affichés par la CI dans Chrome au format téléphone avec React Native for Web et un compte de test ORYKSA (`test/web/`). Sur un téléphone, le chat affiche aussi le micro, qui nécessite les bibliothèques audio natives. Le chat vert utilise le code de *Couleurs et thème*, plus bas.
20
+
21
+ ## Installer
22
+
23
+ ```bash
24
+ npm install @oryksa/react-native
25
+ ```
26
+
27
+ ## À quoi il sert
28
+
29
+ Le SDK met le chat et la voix ORYKSA dans votre app pour servir les **clients de votre entreprise** : ils posent des questions, achètent et réservent. L'IA répond avec votre Brain, vos produits et vos services, avec le nom, la photo et la voix que vous avez choisis dans *Votre IA*, et enregistre les leads, réservations et ventes dans les Activités de votre compte ORYKSA. Ce n'est **pas** une interface pour le propriétaire : via le SDK, personne ne modifie les paramètres, ne lit les Activités ni ne donne d'ordres à ORYKSA. En savoir plus : https://help.oryksa.com/fr/a/sdks-what-they-do
30
+
31
+ Les gros mots que le client tape apparaissent sous forme d'astérisques dans le chat (la même liste que tous les chats ORYKSA, chargée depuis `https://app.oryksa.com/widget/profanity.json`, conservée 24 heures). Les réponses de l'IA arrivent déjà filtrées par le serveur.
32
+
33
+ ## Voix et contexte de l'app (1.1)
34
+
35
+ Le chat affiche un micro quand votre forfait inclut la voix. Il ouvre l'écran vocal avec le même comportement que l'app ORYKSA : le micro reste ouvert pendant qu'elle parle et seule une voix humaine l'interrompt (la frappe au clavier, la télévision et son propre écho ne l'interrompent pas) ; elle s'arrête sur le mot et le texte reste dans le chat ; à un chuchotement, elle répond en chuchotant ; si sa voix échoue, le texte est affiché (jamais une voix robotique).
36
+
37
+ La voix nécessite trois bibliothèques natives (dépendances peer optionnelles) et l'autorisation du micro (Android `RECORD_AUDIO`, iOS `NSMicrophoneUsageDescription`) :
38
+
39
+ ```sh
40
+ npm install react-native-live-audio-stream react-native-sound react-native-fs
41
+ ```
42
+
43
+ Sans elles, le chat fonctionne et le micro est masqué. Avec Expo ou une autre pile audio : passez votre propre adaptateur `audio` (`startMic`, `stopMic`, `play`, `stopPlayback`).
44
+
45
+ Chaque réponse de l'IA a un bouton copier en dessous. Il utilise `@react-native-clipboard/clipboard` s'il est installé (dépendance peer optionnelle : `npm install @react-native-clipboard/clipboard`) ; les versions plus anciennes de React Native utilisent le `Clipboard` intégré.
46
+
47
+ ```jsx
48
+ <OryksaChatButton client={client} lang="pt"
49
+ appContext={() => ({ screen: "product", title: "Sky Beginner Snowboard, 489.95" })} />
50
+ ```
51
+
52
+ ## Liens avec un bouton pour les ouvrir (1.1.3)
53
+
54
+ Les liens que donne l'IA se touchent dans le chat (adresses web et e-mails), et chaque lien web a une carte sous sa réponse avec la photo et le titre de la page et un bouton pour l'ouvrir (les pages de votre propre site, les domaines de votre chat web ; les autres sites montrent l'adresse). L'écran vocal montre ce qu'elle dit sans les adresses, avec les mêmes cartes ; toucher le bouton ferme l'écran vocal. Passez `onLink` pour ouvrir vos propres écrans, par exemple la page du produit : renvoyez true quand votre app l'a ouvert, false pour laisser le système l'ouvrir (`Linking.openURL`).
55
+
56
+ ```jsx
57
+ <OryksaChatButton client={client} lang="en"
58
+ onLink={(url) => {
59
+ const id = myProductIdOf(url); // vos routes
60
+ if (!id) return false;
61
+ navigation.navigate("Product", { id });
62
+ return true;
63
+ }} />
64
+ ```
65
+
66
+ `onLink` existe aussi sur `OryksaChat`, `OryksaChatModal` et `OryksaVoiceScreen`.
67
+
68
+ ## Joindre une photo ou un document (1.1.3)
69
+
70
+ Le chat a un bouton pour joindre (un trombone, activé par défaut) : une photo de la galerie, une photo de l'appareil photo ou un document (PDF, Word, texte, CSV, jusqu'à 8 Mo). L'IA regarde la photo (réduite à 1600 pixels, JPEG 80 %, jusqu'à 2 Mo) et lit le document ; la bulle du client montre la photo, ou l'icône du document et son nom. `attachments={false}` masque le bouton.
71
+
72
+ React Native n'a pas de sélecteur propre, donc le SDK utilise deux bibliothèques optionnelles que votre app installe (dépendances peer optionnelles, comme celles de la voix). Chaque option n'apparaît que lorsque sa bibliothèque est là ; sans les deux, le bouton est masqué :
73
+
74
+ ```sh
75
+ npm install react-native-image-picker @react-native-documents/picker
76
+ ```
77
+
78
+ * `react-native-image-picker` : galerie et appareil photo. Info.plist iOS : `NSPhotoLibraryUsageDescription` et `NSCameraUsageDescription`. Android : aucune autorisation pour la galerie ; pour l'appareil photo, `CAMERA` n'est nécessaire que si votre app la déclare dans son propre manifest (accordez-la alors avant d'ouvrir l'appareil photo).
79
+ * `@react-native-documents/picker` : documents, dans le sélecteur de documents du système (sans autorisation). Les documents sont lus avec `react-native-fs` quand il est installé, sinon avec `fetch`.
80
+
81
+ ```jsx
82
+ <OryksaChatButton client={client} lang="en" attachments={false} /> {/* sans bouton pour joindre */}
83
+
84
+ // Expo ou une autre stack : vos propres sélecteurs (s'il en manque un, ce choix est masqué)
85
+ const picker = {
86
+ pickPhoto: () => myPhotoPicker(), // { base64, mime } réduite (1600 px, JPEG 80 %), ou null
87
+ pickDocument: () => myDocumentPicker(), // { base64, name, mime }, ou null
88
+ };
89
+ <OryksaChat client={client} picker={picker} />
90
+ ```
91
+
92
+ Sans l'interface : `client.send("Voici le devis", { file: { base64, name: "devis.pdf", mime: "application/pdf" } })` (photos : `{ image: { base64, mime } }`).
93
+
94
+ ## Comment ça marche (et pourquoi la clé reste en sécurité)
95
+
96
+ 1. Votre **serveur** garde la clé API secrète (`oryk_live_...`, créée sur developer.oryksa.com) et crée un **jeton de session** de courte durée pour chaque utilisateur connecté avec `POST /v1/sessions` (avec `@oryksa/sdk` sur Node : `oryksa.createSession(...)`).
97
+ 2. Votre **app** ne reçoit que ce jeton de session (`oryk_cs_...`). La clé secrète n'entre jamais dans l'app.
98
+ 3. Chaque réponse de l'IA compte comme une interaction de votre forfait ORYKSA, comme sur WhatsApp.
99
+
100
+ ## Dans l'app
101
+
102
+ ```jsx
103
+ import { OryksaClient, OryksaChatButton } from "@oryksa/react-native";
104
+
105
+ const client = new OryksaClient({
106
+ getToken: async () => (await fetch("https://your-server.example/oryksa-token").then((r) => r.json())).token,
107
+ });
108
+
109
+ export default function App() {
110
+ return (
111
+ <View style={{ flex: 1 }}>
112
+ <MyScreens />
113
+ <OryksaChatButton client={client} lang="en" /> {/* en, pt, br, es */}
114
+ </View>
115
+ );
116
+ }
117
+ ```
118
+
119
+ Autres éléments :
120
+
121
+ * `<OryksaChatModal client={client} visible={open} onClose={() => setOpen(false)} />` : ouvrir le chat depuis votre propre bouton.
122
+ * `<OryksaChat client={client} />` : le panneau dans n'importe quel écran.
123
+ * `theme={{ accent: "#5B57E0" }}` : couleurs.
124
+ * Sans l'interface : `await client.agent()`, `await client.sendAndWait("Are you open on Saturday?")`, `await client.messages()`.
125
+
126
+ ## Garder l'IA synchronisée avec votre app
127
+
128
+ Sur votre serveur, avec `@oryksa/sdk` :
129
+
130
+ ```js
131
+ await oryksa.learnApp({ name: "FitTrack", description: "...", screens: [...], faq: [...] });
132
+ ```
133
+
134
+ ## Erreurs
135
+
136
+ Les appels qui échouent lèvent `OryksaError` avec `status`, `code` (par exemple `interaction_limit_reached`, `rate_limited`, `plan_required`) et `message`.
137
+
138
+ ## Couleurs et thème
139
+
140
+ La prop `theme` prend un objet avec jusqu'à cinq couleurs en texte hexadécimal : `accent` (boutons, bulles du visiteur, liens), `ink` (texte principal), `soft` (bulles de l'IA), `background` (panneau) et `muted` (texte secondaire). Les clés absentes gardent la valeur par défaut, donc `{ accent: "#0E8A6B" }` suffit. Cela fonctionne sur `OryksaChatButton`, `OryksaChatModal` et `OryksaChat`, et les valeurs par défaut sont exportées sous `DEFAULT_THEME`.
141
+
142
+ ```jsx
143
+ const theme = { accent: "#0E8A6B" };
144
+
145
+ <OryksaChatButton client={client} lang="en" theme={theme} />
146
+ ```
147
+
148
+ Il n'y a pas de thème sombre automatique : pour le mode sombre, passez vos propres couleurs sombres.
149
+
150
+ ---
151
+
152
+ ## À propos de l'auteur
153
+
154
+ **Weslley Harakawa** - Fondateur d'ORYKSA AI. À Lisbonne, Portugal. Spécialités : intelligence artificielle, développement web et mobile, tokenisation blockchain. Formation : University of the People.
155
+
156
+ - LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
157
+ - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSA)
158
+
159
+ ---
160
+
161
+ MIT License · ORYKSA AI Employees · W8 Atlantic Unipessoal Lda
package/README.md CHANGED
@@ -2,12 +2,22 @@
2
2
 
3
3
  # @oryksa/react-native
4
4
 
5
- Official React Native SDK for **ORYKSA AI Employees**. Put an AI employee that already knows your business inside your iOS and Android app (React Native or Expo): a ready chat with the same look as the ORYKSA website chat, the name and photo of your AI from your ORYKSA account, in English, Portuguese (Portugal and Brazil) and Spanish.
5
+ [![English](https://img.shields.io/badge/English-0891b2?style=for-the-badge)](README.md) [![Português](https://img.shields.io/badge/Portugu%C3%AAs-30363d?style=for-the-badge)](README.pt.md) [![Español](https://img.shields.io/badge/Espa%C3%B1ol-30363d?style=for-the-badge)](README.es.md) [![Français](https://img.shields.io/badge/Fran%C3%A7ais-30363d?style=for-the-badge)](README.fr.md)
6
+
7
+ <p align="center"><a href="https://developer.oryksa.com/en/sdks"><img src="https://developer.oryksa.com/assets/img/sdk/oryksa-sdks-en.gif" width="760" alt="ORYKSA SDKs: the AI chat and voice on iOS, Android, Flutter, React Native and the web"></a></p>
8
+
9
+ Official React Native SDK for **ORYKSA AI Employees**. Put an AI employee that already knows your business inside your iOS and Android app (React Native or Expo): a ready chat with the same look as the ORYKSA website chat, the name and photo of your AI from your ORYKSA account, in English, Portuguese and Spanish.
6
10
 
7
11
  * Docs: https://developer.oryksa.com/en/sdks
8
12
  * API: `https://api.oryksa.com/v1`
9
13
  * No native code: works in Expo Go.
10
14
 
15
+ ## Screenshots
16
+
17
+ <p align="center"><img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_product_en.png" width="230" alt="Product page with the chat button"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_chat_en.png" width="230" alt="Chat"> <img src="https://raw.githubusercontent.com/oryksa/oryksa-react-native/main/docs/screenshots/rn_theme_en.png" width="230" alt="Chat with the README theme"></p>
18
+
19
+ The SDK components themselves, rendered by CI in Chrome at phone size with React Native for Web and an ORYKSA test account (`test/web/`). On a phone the chat also shows the microphone, which needs the native audio libraries. The green chat uses the code of *Colours and theme* below.
20
+
11
21
  ## Install
12
22
 
13
23
  ```bash
@@ -39,6 +49,48 @@ Each reply of the AI has a copy button under it. It uses `@react-native-clipboar
39
49
  appContext={() => ({ screen: "product", title: "Sky Beginner Snowboard, 489.95" })} />
40
50
  ```
41
51
 
52
+ ## Links with an Open button (1.1.3)
53
+
54
+ The links the AI gives can be tapped in the chat (web addresses and e-mails), and each web link gets a card under her reply with the picture and title of the page and an **Open** button (the pages of your own site, the domains of your website chat; other sites show the address). The voice screen shows what she says without the addresses, with the same cards; tapping Open closes the voice screen. Pass `onLink` to open your own screens, for example your product page: return true when your app opened it, false to let the system open it (`Linking.openURL`).
55
+
56
+ ```jsx
57
+ <OryksaChatButton client={client} lang="en"
58
+ onLink={(url) => {
59
+ const id = myProductIdOf(url); // your routes
60
+ if (!id) return false;
61
+ navigation.navigate("Product", { id });
62
+ return true;
63
+ }} />
64
+ ```
65
+
66
+ `onLink` is also on `OryksaChat`, `OryksaChatModal` and `OryksaVoiceScreen`.
67
+
68
+ ## Attach a photo or a document (1.1.3)
69
+
70
+ The chat has an attach button (a paperclip, on by default): a photo from the library, a photo from the camera, or a document (PDF, Word, text, CSV, up to 8 MB). The AI looks at the photo (made smaller to 1600 pixels, JPEG 80%, up to 2 MB) and reads the document; the customer's bubble shows the photo, or the document icon and its name. `attachments={false}` hides the button.
71
+
72
+ React Native has no picker of its own, so the SDK uses two optional libraries your app installs (optional peer dependencies, like the voice libraries). Each choice shows only when its library is there; without both, the button is hidden:
73
+
74
+ ```sh
75
+ npm install react-native-image-picker @react-native-documents/picker
76
+ ```
77
+
78
+ * `react-native-image-picker`: photo library and camera. iOS Info.plist: `NSPhotoLibraryUsageDescription` and `NSCameraUsageDescription`. Android: no permission for the photo library; for the camera, `CAMERA` is needed only if your app declares it in its own manifest (then grant it before the camera opens).
79
+ * `@react-native-documents/picker`: documents, in the system document picker (no permission). Documents are read with `react-native-fs` when installed, else with `fetch`.
80
+
81
+ ```jsx
82
+ <OryksaChatButton client={client} lang="en" attachments={false} /> {/* no attach button */}
83
+
84
+ // Expo or another stack: your own pickers (a missing one hides that choice)
85
+ const picker = {
86
+ pickPhoto: () => myPhotoPicker(), // { base64, mime } made smaller (1600 px, JPEG 80%), or null
87
+ pickDocument: () => myDocumentPicker(), // { base64, name, mime }, or null
88
+ };
89
+ <OryksaChat client={client} picker={picker} />
90
+ ```
91
+
92
+ Without the UI: `client.send("Here is the quote", { file: { base64, name: "quote.pdf", mime: "application/pdf" } })` (photos: `{ image: { base64, mime } }`).
93
+
42
94
  ## How it works (and why the key stays safe)
43
95
 
44
96
  1. Your **server** keeps the secret API key (`oryk_live_...`, created at developer.oryksa.com) and creates a short-lived **session token** for each signed-in user with `POST /v1/sessions` (with `@oryksa/sdk` on Node: `oryksa.createSession(...)`).
@@ -83,40 +135,26 @@ await oryksa.learnApp({ name: "FitTrack", description: "...", screens: [...], fa
83
135
 
84
136
  Failed calls throw `OryksaError` with `status`, `code` (for example `interaction_limit_reached`, `rate_limited`, `plan_required`) and `message`.
85
137
 
86
- ---
138
+ ## Colours and theme
87
139
 
88
- ## Português (Portugal)
140
+ The `theme` prop takes an object with up to five colors as hex strings: `accent` (buttons, visitor bubbles, links), `ink` (main text), `soft` (AI bubbles), `background` (panel) and `muted` (secondary text). Missing keys keep the default, so `{ accent: "#0E8A6B" }` is enough. It works on `OryksaChatButton`, `OryksaChatModal` and `OryksaChat`, and the defaults are exported as `DEFAULT_THEME`.
89
141
 
90
- SDK oficial de React Native da **ORYKSA AI Employees**: põe na tua app iOS e Android um colaborador de IA que já conhece o teu negócio, com um chat pronto igual ao chat do site da ORYKSA, com o nome e a foto da tua IA.
91
-
92
- 1. O teu **servidor** guarda a chave secreta e cria um token de sessão para cada utilizador (`POST /v1/sessions`).
93
- 2. A **app** usa só esse token: `new OryksaClient({ getToken })` e `<OryksaChatButton client={client} lang="pt" />`.
94
- 3. Cada resposta da IA conta como uma interação do teu plano.
95
-
96
- ## Português (Brasil)
97
-
98
- SDK oficial de React Native da **ORYKSA AI Employees**: coloque no seu app iOS e Android um colaborador de IA que já conhece o seu negócio, com um chat pronto igual ao chat do site da ORYKSA, com o nome e a foto da sua IA.
99
-
100
- 1. Seu **servidor** guarda a chave secreta e cria um token de sessão para cada usuário (`POST /v1/sessions`).
101
- 2. O **app** usa só esse token: `new OryksaClient({ getToken })` e `<OryksaChatButton client={client} lang="br" />`.
102
- 3. Cada resposta da IA conta como uma interação do seu plano.
142
+ ```jsx
143
+ const theme = { accent: "#0E8A6B" };
103
144
 
104
- ## Español
145
+ <OryksaChatButton client={client} lang="en" theme={theme} />
146
+ ```
105
147
 
106
- SDK oficial de React Native de **ORYKSA AI Employees**: pon en tu app iOS y Android un empleado de IA que ya conoce tu negocio, con un chat listo igual al chat de la web de ORYKSA, con el nombre y la foto de tu IA.
148
+ There is no automatic dark theme: for dark mode, pass your own dark colors.
107
149
 
108
- 1. Tu **servidor** guarda la clave secreta y crea un token de sesión para cada usuario (`POST /v1/sessions`).
109
- 2. La **app** usa solo ese token: `new OryksaClient({ getToken })` y `<OryksaChatButton client={client} lang="es" />`.
110
- 3. Cada respuesta de la IA cuenta como una interacción de tu plan.
150
+ ---
111
151
 
112
152
  ## About the author
113
153
 
114
154
  **Weslley Harakawa** - Founder of ORYKSA AI. Based in Lisbon, Portugal. Specialties: artificial intelligence, web and mobile development, blockchain tokenization. Education: University of the People.
115
155
 
116
- - Website: https://harakawa.tech
117
156
  - LinkedIn: https://www.linkedin.com/in/weslleyharakawa/
118
- - Instagram: https://www.instagram.com/weslley.harakawa
119
- - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSAAI)
157
+ - ORYKSA AI Employees: https://oryksa.com (X: https://x.com/oryksa, Instagram: https://www.instagram.com/oryksaai, YouTube: https://www.youtube.com/@ORYKSA)
120
158
 
121
159
  ---
122
160