@maebgch/rcs-emulator 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +70 -78
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,7 +10,7 @@ Reusable, production-ready emulator UI for RCS Business Messaging (RBM). Ships a
10
10
  - Ships typed helpers and guards (`validateConversationFlow`, `useJsonFetch`, RBM schema types)
11
11
  - Bundled CSS (`dist/style.css`) generated from Tailwind classes—no Tailwind setup required in consumer apps
12
12
 
13
- ## Install
13
+ ## Installation
14
14
 
15
15
  ### From npm (once published)
16
16
 
@@ -24,23 +24,25 @@ yarn add @maebgch/rcs-emulator
24
24
 
25
25
  ### Local install (for development/testing)
26
26
 
27
- 1. Build and pack the library:
27
+ If you want to test the package locally before it's published or use a local development version:
28
28
 
29
- ```bash
30
- npm install
31
- npm run build:lib
32
- npm pack # produces maebgch-rcs-emulator-0.1.0.tgz
33
- ```
29
+ 1. **Build and pack the library:**
34
30
 
35
- 2. In your consuming project:
31
+ ```bash
32
+ npm install
33
+ npm run build:lib
34
+ npm pack # produces maebgch-rcs-emulator-0.1.0.tgz
35
+ ```
36
36
 
37
- ```bash
38
- npm install ../path/to/maebgch-rcs-emulator-0.1.0.tgz
39
- # or
40
- pnpm add file:../path/to/maebgch-rcs-emulator-0.1.0.tgz
41
- ```
37
+ 2. **In your consuming project:**
38
+
39
+ ```bash
40
+ npm install ../path/to/maebgch-rcs-emulator-0.1.0.tgz
41
+ # or
42
+ pnpm add file:../path/to/maebgch-rcs-emulator-0.1.0.tgz
43
+ ```
42
44
 
43
- ## Quick start
45
+ ## Quick Start
44
46
 
45
47
  ```tsx
46
48
  import {
@@ -106,7 +108,9 @@ export default function App() {
106
108
  }
107
109
  ```
108
110
 
109
- ## Props (public API)
111
+ ## API Reference
112
+
113
+ ### Props
110
114
 
111
115
  - `messages?: RbmConversationFlow` – Inline RBM JSON (provide this OR `jsonUrl`)
112
116
  - `jsonUrl?: string` – Remote RBM JSON to fetch
@@ -119,84 +123,72 @@ export default function App() {
119
123
  - `showSuggestions?: boolean` – Toggle suggestion chips
120
124
  - `showLockScreen?: boolean` – Start on lock screen preview
121
125
 
122
- ### Callback payload
126
+ ### Callback Payload
123
127
 
124
128
  `UserReplyPayload` includes `{ type: "reply" | "action", postbackData, displayText, actionData?, timestamp }`. WebView actions surface `actionData: { type: "webview", url, viewMode, description? }`.
125
129
 
126
- ## Additional exports
127
-
128
- - Helpers: `validateConversationFlow`, `getFirstMessagePreview`
129
- - Hooks: `useJsonFetch`
130
- - RBM types & guards: `RbmConversationFlow`, `RbmMessage`, `isSuggestedReply`, `isSuggestedAction`, `isWebViewAction`, `getWebViewConfig`
131
- - Standalone component: `WebViewRenderer`
132
-
133
- ## RBM JSON shape
130
+ ### Additional Exports
134
131
 
135
- - Use `RbmConversationFlow` (see `src/components/RcsEmulator/types/rbm.types.ts`) as the schema.
136
- - A ready-made sample lives at `public/test.json`.
137
- - Each node supports text, rich cards, carousels, suggestions, and optional branching via `nextMessageIds`.
132
+ - **Helpers:** `validateConversationFlow`, `getFirstMessagePreview`
133
+ - **Hooks:** `useJsonFetch`
134
+ - **RBM types & guards:** `RbmConversationFlow`, `RbmMessage`, `isSuggestedReply`, `isSuggestedAction`, `isWebViewAction`, `getWebViewConfig`
135
+ - **Standalone component:** `WebViewRenderer`
138
136
 
139
- ## Building the library (for publish/testing)
140
-
141
- ```bash
142
- npm install
143
- npm run build:lib
144
- ```
137
+ ## RBM JSON Schema
145
138
 
146
- Outputs to `dist/`:
139
+ - Use `RbmConversationFlow` type as the schema reference
140
+ - Each node supports text, rich cards, carousels, suggestions, and optional branching via `nextMessageIds`
141
+ - See TypeScript types in `src/components/RcsEmulator/types/rbm.types.ts` for full schema
147
142
 
148
- - `rcs-emulator.es.js` (ESM), `rcs-emulator.cjs.js` (CJS)
149
- - `style.css` (bundled Tailwind output)
150
- - `types/index.d.ts` (TypeScript declarations)
143
+ ## Usage Examples
151
144
 
152
- ## Using from another project
145
+ ### Basic Usage
153
146
 
154
- 1. Install the package (published or packed tarball).
155
- 2. Import component + styles in your app entry or component file:
156
- - `import "@maebgch/rcs-emulator/style.css";`
157
- - `import { RcsEmulator } from "@maebgch/rcs-emulator";`
158
- 3. Pass an RBM JSON payload or `jsonUrl`, and handle `onUserReply`.
159
-
160
- ## Developing the demo app locally
161
-
162
- - `npm run dev` – run the playground app
163
- - `npm run build` – build the playground app
164
- - `npm run lint` – lint the repo
165
-
166
- ## Publishing to npm
167
-
168
- 1. **Ensure you're logged in to npm:**
147
+ ```tsx
148
+ import { RcsEmulator } from "@maebgch/rcs-emulator";
149
+ import "@maebgch/rcs-emulator/style.css";
169
150
 
170
- ```bash
171
- npm login
172
- npm whoami
173
- ```
151
+ function App() {
152
+ return (
153
+ <RcsEmulator
154
+ jsonUrl="https://example.com/conversation.json"
155
+ onUserReply={(payload) => console.log(payload)}
156
+ />
157
+ );
158
+ }
159
+ ```
174
160
 
175
- 2. **Build the library:**
161
+ ### With Custom Theme and Device
176
162
 
177
- ```bash
178
- npm run build:lib
179
- ```
163
+ ```tsx
164
+ <RcsEmulator
165
+ messages={conversationFlow}
166
+ onUserReply={handleReply}
167
+ theme="dark"
168
+ device="ios"
169
+ width={414}
170
+ height={896}
171
+ />
172
+ ```
180
173
 
181
- 3. **Test the package locally (optional):**
174
+ ### With Business Branding
182
175
 
183
- ```bash
184
- npm pack
185
- # This creates a .tgz file you can test in another project
186
- ```
176
+ ```tsx
177
+ <RcsEmulator
178
+ messages={conversationFlow}
179
+ onUserReply={handleReply}
180
+ businessInfo={{
181
+ name: "My Business",
182
+ logo: "https://example.com/logo.png",
183
+ brandColor: "#FF5733",
184
+ }}
185
+ />
186
+ ```
187
187
 
188
- 4. **Publish to npm:**
188
+ ## License
189
189
 
190
- ```bash
191
- npm publish --access public
192
- ```
190
+ MIT
193
191
 
194
- Note: Use `--access public` for scoped packages like `@maebgchdev/rcs-emulator`
192
+ ## Contributing
195
193
 
196
- 5. **Version management (after publishing):**
197
- ```bash
198
- npm version patch # for bug fixes (0.1.0 -> 0.1.1)
199
- npm version minor # for new features (0.1.0 -> 0.2.0)
200
- npm version major # for breaking changes (0.1.0 -> 1.0.0)
201
- npm publish --access public
202
- ```
194
+ See [DEVELOPMENT.md](./DEVELOPMENT.md) for development setup and contribution guidelines.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maebgch/rcs-emulator",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A production-ready React component library for emulating RCS Business Messaging (RBM) device UI",
5
5
  "type": "module",
6
6
  "main": "dist/rcs-emulator.cjs.js",