@volorio/react-native-chat 0.2.0

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/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @volorio/react-native-chat
2
+
3
+ React Native chat helpers for Volorio rooms.
4
+
5
+ ```bash
6
+ npm install @volorio/react-native-chat
7
+ ```
8
+
9
+ ```ts
10
+ import { VolorioReactNativeChatClient } from "@volorio/react-native-chat";
11
+
12
+ const chat = new VolorioReactNativeChatClient(room);
13
+ await chat.sendMessage({ conversationId: "lobby", senderId: "user_001", text: "hello" });
14
+ ```
@@ -0,0 +1,12 @@
1
+ import type { VolorioReactNativeRoomClient } from "@volorio/react-native";
2
+ export interface VolorioReactNativeChatMessage {
3
+ conversationId: string;
4
+ senderId: string;
5
+ text: string;
6
+ clientMessageId?: string;
7
+ }
8
+ export declare class VolorioReactNativeChatClient {
9
+ private readonly room;
10
+ constructor(room: Pick<VolorioReactNativeRoomClient, "sendMessage">);
11
+ sendMessage(message: VolorioReactNativeChatMessage): Promise<void>;
12
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VolorioReactNativeChatClient = void 0;
4
+ class VolorioReactNativeChatClient {
5
+ room;
6
+ constructor(room) {
7
+ this.room = room;
8
+ }
9
+ async sendMessage(message) {
10
+ await this.room.sendMessage(JSON.stringify({
11
+ type: "volorio.rn.chat.message",
12
+ channel: `chat:${message.conversationId}`,
13
+ payload: message,
14
+ sentAt: new Date().toISOString(),
15
+ }));
16
+ }
17
+ }
18
+ exports.VolorioReactNativeChatClient = VolorioReactNativeChatClient;
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AASA,MAAa,4BAA4B;IACV;IAA7B,YAA6B,IAAuD;QAAvD,SAAI,GAAJ,IAAI,CAAmD;IAAG,CAAC;IAExF,KAAK,CAAC,WAAW,CAAC,OAAsC;QACtD,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC;YACzC,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,QAAQ,OAAO,CAAC,cAAc,EAAE;YACzC,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACjC,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AAXD,oEAWC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@volorio/react-native-chat",
3
+ "version": "0.2.0",
4
+ "private": false,
5
+ "description": "Volorio React Native chat helpers built on Volorio native room messaging.",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/src/index.d.ts",
11
+ "default": "./dist/src/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/src",
16
+ "README.md"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "registry": "https://registry.npmjs.org/"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc -p tsconfig.build.json",
24
+ "test": "pnpm build",
25
+ "pack:local": "pnpm build && npm pack --pack-destination dist"
26
+ },
27
+ "dependencies": {
28
+ "@volorio/react-native": "^0.2.0"
29
+ }
30
+ }