@flexsmb54/react-native-widget 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.
- package/LICENSE +21 -0
- package/README.md +10 -6
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -1
- package/src/version.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Flex54
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @flexsmb54/react-native-widget
|
|
2
2
|
|
|
3
3
|
The Flex54 chat widget for React Native. It shows the hosted Flex54 widget in a WebView. It has no native code of its own, so it runs in Expo Go.
|
|
4
4
|
|
|
@@ -7,13 +7,13 @@ The Flex54 chat widget for React Native. It shows the hosted Flex54 widget in a
|
|
|
7
7
|
Expo:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npx expo install @
|
|
10
|
+
npx expo install @flexsmb54/react-native-widget react-native-webview react-native-safe-area-context
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Bare React Native:
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
npm install @
|
|
16
|
+
npm install @flexsmb54/react-native-widget react-native-webview react-native-safe-area-context
|
|
17
17
|
cd ios && pod install
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@ Peer dependencies: `react >= 18`, `react-native >= 0.72`, `react-native-webview
|
|
|
24
24
|
Render `<Flex54Widget>` **exactly once, as the last child of your root component**, so it draws above the rest of the app. It shows a chat button and, when opened, a full-screen chat. Touches anywhere else go to your app as usual.
|
|
25
25
|
|
|
26
26
|
```tsx
|
|
27
|
-
import { Flex54Widget } from '@
|
|
27
|
+
import { Flex54Widget } from '@flexsmb54/react-native-widget';
|
|
28
28
|
|
|
29
29
|
export default function App() {
|
|
30
30
|
return (
|
|
@@ -60,7 +60,7 @@ Set `widgetId` and `environment` once, when the widget mounts. Changing them on
|
|
|
60
60
|
Control the mounted widget from anywhere in your app:
|
|
61
61
|
|
|
62
62
|
```ts
|
|
63
|
-
import { Flex54 } from '@
|
|
63
|
+
import { Flex54 } from '@flexsmb54/react-native-widget';
|
|
64
64
|
|
|
65
65
|
Flex54.open(); // show the chat
|
|
66
66
|
Flex54.close(); // hide the chat
|
|
@@ -142,7 +142,7 @@ Expo, in `app.json` (then rebuild the app; Expo Go already has these):
|
|
|
142
142
|
|
|
143
143
|
## How it works
|
|
144
144
|
|
|
145
|
-
`<Flex54Widget>` draws a chat button and, the first time the chat opens, a full-screen WebView that loads the hosted Flex54 widget with `host=native`. The page and the SDK talk through two small JSON envelopes. The widget posts `ready`, `opened` and `closed` events, and the SDK injects `open`, `close`, `toggle` and `reset` commands. The SDK re-syncs on every `ready` instead of replaying queued commands. Closing hides the surface and tells the widget to close, which unmounts the chat window and disconnects it, so nothing is billed while the chat is hidden. Links that leave the widget's origin open in the system browser. If the WebView's web process dies, the SDK reloads it. A page loaded more than 12 hours ago is reloaded when the chat next opens, so its session doesn't go stale.
|
|
145
|
+
`<Flex54Widget>` draws a chat button and, the first time the chat opens, a full-screen WebView that loads the hosted Flex54 widget with `host=native`. The page and the SDK talk through two small JSON envelopes. The widget posts `ready`, `opened` and `closed` events, and the SDK injects `open`, `close`, `toggle` and `reset` commands. The SDK re-syncs on every `ready` instead of replaying queued commands. Closing hides the surface and tells the widget to close, which unmounts the chat window and disconnects it, so nothing is billed while the chat is hidden. Links that leave the widget's origin open in the system browser. If the WebView's web process dies, the SDK reloads it. A page loaded more than 12 hours ago is reloaded when the chat next opens, so its session doesn't go stale.
|
|
146
146
|
|
|
147
147
|
## Troubleshooting
|
|
148
148
|
|
|
@@ -154,3 +154,7 @@ Expo, in `app.json` (then rebuild the app; Expo Go already has these):
|
|
|
154
154
|
- **The microphone doesn't work.** Add the permissions above and rebuild the app. `Info.plist` and manifest changes need a native rebuild.
|
|
155
155
|
- **The keyboard covers the message box on Android.** Keyboard behaviour on Android 15 and later with edge-to-edge display is still being verified, and `android:windowSoftInputMode="adjustResize"` may not be enough there. If the keyboard covers the message box, please report it with the device, Android version and React Native version.
|
|
156
156
|
- **Android back.** While the chat is open, back closes it. Otherwise back goes to your app as usual.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.1";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexsmb54/react-native-widget",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Flex54 chat widget for React Native (WebView based, no native code)",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"main": "lib/index.js",
|
|
6
7
|
"types": "lib/index.d.ts",
|
|
7
8
|
"react-native": "src/index.ts",
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '0.1.
|
|
1
|
+
export const SDK_VERSION = '0.1.1';
|