react-native-tpstreams 1.1.4 → 1.1.5
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 +3 -2
- package/TPStreamsRNPlayerView.podspec +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerView.kt +6 -0
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerViewManager.kt +5 -0
- package/ios/TPStreamsRNPlayerView.swift +2 -0
- package/ios/TPStreamsRNPlayerViewManager.m +1 -0
- package/lib/module/TPStreamsLiveChat.js +133 -0
- package/lib/module/TPStreamsLiveChat.js.map +1 -0
- package/lib/module/TPStreamsPlayer.js +2 -0
- package/lib/module/TPStreamsPlayer.js.map +1 -1
- package/lib/module/TPStreamsPlayerViewNativeComponent.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/TPStreamsLiveChatTypes.js +29 -0
- package/lib/module/types/TPStreamsLiveChatTypes.js.map +1 -0
- package/lib/module/utils/constants.js +28 -0
- package/lib/module/utils/constants.js.map +1 -0
- package/lib/module/utils/liveChatHtmlGenerator.js +131 -0
- package/lib/module/utils/liveChatHtmlGenerator.js.map +1 -0
- package/lib/typescript/src/TPStreamsLiveChat.d.ts +5 -0
- package/lib/typescript/src/TPStreamsLiveChat.d.ts.map +1 -0
- package/lib/typescript/src/TPStreamsPlayer.d.ts +1 -0
- package/lib/typescript/src/TPStreamsPlayer.d.ts.map +1 -1
- package/lib/typescript/src/TPStreamsPlayerViewNativeComponent.d.ts +1 -0
- package/lib/typescript/src/TPStreamsPlayerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/TPStreamsLiveChatTypes.d.ts +77 -0
- package/lib/typescript/src/types/TPStreamsLiveChatTypes.d.ts.map +1 -0
- package/lib/typescript/src/utils/constants.d.ts +20 -0
- package/lib/typescript/src/utils/constants.d.ts.map +1 -0
- package/lib/typescript/src/utils/liveChatHtmlGenerator.d.ts +6 -0
- package/lib/typescript/src/utils/liveChatHtmlGenerator.d.ts.map +1 -0
- package/package.json +4 -1
- package/src/TPStreamsLiveChat.tsx +189 -0
- package/src/TPStreamsPlayer.tsx +3 -0
- package/src/TPStreamsPlayerViewNativeComponent.ts +1 -0
- package/src/index.tsx +9 -0
- package/src/types/TPStreamsLiveChatTypes.ts +99 -0
- package/src/utils/constants.ts +28 -0
- package/src/utils/liveChatHtmlGenerator.ts +142 -0
package/README.md
CHANGED
|
@@ -43,11 +43,12 @@ import { TPStreamsPlayerView } from "react-native-tpstreams";
|
|
|
43
43
|
|------|------|----------|-------------|
|
|
44
44
|
| `videoId` | `string` | Yes | Video ID to play |
|
|
45
45
|
| `accessToken` | `string` | Yes | Access token for the video |
|
|
46
|
-
| `startAt` | `number` | No | Start position in seconds (default: 0) |
|
|
47
46
|
| `shouldAutoPlay` | `boolean` | No | Auto-play on load (default: true) |
|
|
48
|
-
| `
|
|
47
|
+
| `startAt` | `number` | No | Start position in seconds (default: 0) |
|
|
49
48
|
| `enableDownload` | `boolean` | No | Enable download functionality (default: false) |
|
|
50
49
|
| `offlineLicenseExpireTime` | `number` | No | License expiration in seconds (default: 15 days) |
|
|
50
|
+
| `showDefaultCaptions` | `boolean` | No | Show captions if available (default: false) |
|
|
51
|
+
| `startInFullscreen` | `boolean` | No | Start the player in fullscreen mode (default: false) |
|
|
51
52
|
| `downloadMetadata` | `object` | No | Custom metadata for downloads |
|
|
52
53
|
|
|
53
54
|
### Player Methods
|
|
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
|
|
|
21
21
|
'DEFINES_MODULE' => 'YES',
|
|
22
22
|
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES'
|
|
23
23
|
}
|
|
24
|
-
s.dependency "TPStreamsSDK" , "1.2.
|
|
24
|
+
s.dependency "TPStreamsSDK" , "1.2.16"
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
# Ensure the module is not built as a framework to avoid bridging header conflicts
|
|
@@ -30,6 +30,7 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
30
30
|
private var shouldAutoPlay: Boolean = true
|
|
31
31
|
private var startAt: Long = 0
|
|
32
32
|
private var showDefaultCaptions: Boolean = false
|
|
33
|
+
private var startInFullscreen: Boolean = false
|
|
33
34
|
private var enableDownload: Boolean = false
|
|
34
35
|
private var downloadMetadata: Map<String, Any>? = null
|
|
35
36
|
private var offlineLicenseExpireTime: Long = DEFAULT_OFFLINE_LICENSE_EXPIRE_TIME
|
|
@@ -84,6 +85,10 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
84
85
|
this.showDefaultCaptions = showDefaultCaptions
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
fun setStartInFullscreen(startInFullscreen: Boolean) {
|
|
89
|
+
this.startInFullscreen = startInFullscreen
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
fun setEnableDownload(enableDownload: Boolean) {
|
|
88
93
|
this.enableDownload = enableDownload
|
|
89
94
|
}
|
|
@@ -117,6 +122,7 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
117
122
|
startAt,
|
|
118
123
|
enableDownload,
|
|
119
124
|
showDefaultCaptions,
|
|
125
|
+
startInFullscreen,
|
|
120
126
|
downloadMetadata?.mapValues { it.value.toString() },
|
|
121
127
|
offlineLicenseExpireTime
|
|
122
128
|
)
|
|
@@ -79,6 +79,11 @@ class TPStreamsRNPlayerViewManager : SimpleViewManager<TPStreamsRNPlayerView>(),
|
|
|
79
79
|
view.setShowDefaultCaptions(showDefaultCaptions)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
@ReactProp(name = "startInFullscreen")
|
|
83
|
+
override fun setStartInFullscreen(view: TPStreamsRNPlayerView, startInFullscreen: Boolean) {
|
|
84
|
+
view.setStartInFullscreen(startInFullscreen)
|
|
85
|
+
}
|
|
86
|
+
|
|
82
87
|
@ReactProp(name = "enableDownload")
|
|
83
88
|
override fun setEnableDownload(view: TPStreamsRNPlayerView, enableDownload: Boolean) {
|
|
84
89
|
view.setEnableDownload(enableDownload)
|
|
@@ -46,6 +46,7 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
46
46
|
set { _offlineLicenseExpireTime = TPStreamsRNPlayerView.sanitizeLicenseDuration(newValue) }
|
|
47
47
|
}
|
|
48
48
|
@objc var showDefaultCaptions: Bool = false
|
|
49
|
+
@objc var startInFullscreen: Bool = false
|
|
49
50
|
@objc var downloadMetadata: NSString?
|
|
50
51
|
|
|
51
52
|
@objc var onCurrentPosition: RCTDirectEventBlock?
|
|
@@ -192,6 +193,7 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
192
193
|
.setprogressBarThumbColor(.systemBlue)
|
|
193
194
|
.setwatchedProgressTrackColor(.systemBlue)
|
|
194
195
|
.setDownloadMetadata(metadataDict)
|
|
196
|
+
.setStartInFullscreen(startInFullscreen)
|
|
195
197
|
|
|
196
198
|
configBuilder.setLicenseDurationSeconds(offlineLicenseExpireTime)
|
|
197
199
|
|
|
@@ -10,6 +10,7 @@ RCT_EXPORT_VIEW_PROPERTY(startAt, double)
|
|
|
10
10
|
RCT_EXPORT_VIEW_PROPERTY(enableDownload, BOOL)
|
|
11
11
|
RCT_EXPORT_VIEW_PROPERTY(offlineLicenseExpireTime, double)
|
|
12
12
|
RCT_EXPORT_VIEW_PROPERTY(showDefaultCaptions, BOOL)
|
|
13
|
+
RCT_EXPORT_VIEW_PROPERTY(startInFullscreen, BOOL)
|
|
13
14
|
RCT_EXPORT_VIEW_PROPERTY(downloadMetadata, NSString)
|
|
14
15
|
|
|
15
16
|
// Event props
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useRef, useImperativeHandle, useState, useCallback, useMemo } from 'react';
|
|
4
|
+
import { View, ActivityIndicator, StyleSheet } from 'react-native';
|
|
5
|
+
import { WebView } from 'react-native-webview';
|
|
6
|
+
import { isChatMessage } from "./types/TPStreamsLiveChatTypes.js";
|
|
7
|
+
import { generateChatHTML } from "./utils/liveChatHtmlGenerator.js";
|
|
8
|
+
import { CHAT_SDK_CONSTANTS, ChatMessageType } from "./utils/constants.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const TPStreamsLiveChat = /*#__PURE__*/forwardRef((props, ref) => {
|
|
11
|
+
const {
|
|
12
|
+
username,
|
|
13
|
+
roomId,
|
|
14
|
+
title,
|
|
15
|
+
colors,
|
|
16
|
+
typography,
|
|
17
|
+
customCSS,
|
|
18
|
+
style,
|
|
19
|
+
onChatReady,
|
|
20
|
+
onChatError,
|
|
21
|
+
onMessageReceived
|
|
22
|
+
} = props;
|
|
23
|
+
const webViewRef = useRef(null);
|
|
24
|
+
const [status, setStatus] = useState('loading');
|
|
25
|
+
const htmlContent = useMemo(() => generateChatHTML({
|
|
26
|
+
username,
|
|
27
|
+
roomId,
|
|
28
|
+
title,
|
|
29
|
+
colors,
|
|
30
|
+
typography,
|
|
31
|
+
customCSS
|
|
32
|
+
}), [username, roomId, title, colors, typography, customCSS]);
|
|
33
|
+
const handleMessage = useCallback(event => {
|
|
34
|
+
try {
|
|
35
|
+
const {
|
|
36
|
+
type,
|
|
37
|
+
message
|
|
38
|
+
} = JSON.parse(event.nativeEvent.data);
|
|
39
|
+
switch (type) {
|
|
40
|
+
case ChatMessageType.READY:
|
|
41
|
+
setStatus('ready');
|
|
42
|
+
onChatReady?.();
|
|
43
|
+
break;
|
|
44
|
+
case ChatMessageType.ERROR:
|
|
45
|
+
setStatus('error');
|
|
46
|
+
onChatError?.(message || 'SDK initialization failed');
|
|
47
|
+
break;
|
|
48
|
+
case ChatMessageType.MESSAGE:
|
|
49
|
+
if (isChatMessage(message)) {
|
|
50
|
+
onMessageReceived?.(message);
|
|
51
|
+
} else {
|
|
52
|
+
console.warn('[TPStreamsLiveChat] Received invalid message format:', message);
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
case ChatMessageType.DEBUG:
|
|
56
|
+
console.debug('[TPStreamsLiveChat] WebView:', message);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
console.error('[TPStreamsLiveChat] Failed to parse message:', err);
|
|
61
|
+
}
|
|
62
|
+
}, [onChatReady, onChatError, onMessageReceived]);
|
|
63
|
+
const handleWebViewError = useCallback(syntheticEvent => {
|
|
64
|
+
const {
|
|
65
|
+
nativeEvent
|
|
66
|
+
} = syntheticEvent;
|
|
67
|
+
setStatus('error');
|
|
68
|
+
onChatError?.(nativeEvent.description || 'WebView failed to load');
|
|
69
|
+
}, [onChatError]);
|
|
70
|
+
useImperativeHandle(ref, () => ({
|
|
71
|
+
reload: () => {
|
|
72
|
+
setStatus('loading');
|
|
73
|
+
webViewRef.current?.reload();
|
|
74
|
+
},
|
|
75
|
+
injectCSS: css => {
|
|
76
|
+
const script = `
|
|
77
|
+
(function() {
|
|
78
|
+
const style = document.createElement('style');
|
|
79
|
+
style.textContent = ${JSON.stringify(css)};
|
|
80
|
+
document.head.appendChild(style);
|
|
81
|
+
})();
|
|
82
|
+
`;
|
|
83
|
+
webViewRef.current?.injectJavaScript(script);
|
|
84
|
+
}
|
|
85
|
+
}), []);
|
|
86
|
+
const renderLoading = () => status === 'loading' && /*#__PURE__*/_jsx(View, {
|
|
87
|
+
style: [styles.overlay, {
|
|
88
|
+
backgroundColor: colors?.background || CHAT_SDK_CONSTANTS.DEFAULT_BACKGROUND_COLOR
|
|
89
|
+
}],
|
|
90
|
+
children: /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
91
|
+
size: "large",
|
|
92
|
+
color: colors?.primary || CHAT_SDK_CONSTANTS.DEFAULT_PRIMARY_COLOR
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
96
|
+
style: [styles.container, style],
|
|
97
|
+
children: [/*#__PURE__*/_jsx(WebView, {
|
|
98
|
+
ref: webViewRef,
|
|
99
|
+
source: {
|
|
100
|
+
html: htmlContent,
|
|
101
|
+
baseUrl: CHAT_SDK_CONSTANTS.BASE_URL
|
|
102
|
+
},
|
|
103
|
+
originWhitelist: [CHAT_SDK_CONSTANTS.BASE_URL],
|
|
104
|
+
javaScriptEnabled: true,
|
|
105
|
+
domStorageEnabled: true,
|
|
106
|
+
onMessage: handleMessage,
|
|
107
|
+
onError: handleWebViewError,
|
|
108
|
+
style: styles.webview,
|
|
109
|
+
allowsInlineMediaPlayback: true,
|
|
110
|
+
mediaPlaybackRequiresUserAction: false,
|
|
111
|
+
scrollEnabled: false
|
|
112
|
+
}, `${colors?.background}-${typography?.fontFamily}`), renderLoading()]
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
TPStreamsLiveChat.displayName = 'TPStreamsLiveChat';
|
|
116
|
+
const styles = StyleSheet.create({
|
|
117
|
+
container: {
|
|
118
|
+
flex: 1,
|
|
119
|
+
overflow: 'hidden'
|
|
120
|
+
},
|
|
121
|
+
webview: {
|
|
122
|
+
flex: 1,
|
|
123
|
+
backgroundColor: 'transparent'
|
|
124
|
+
},
|
|
125
|
+
overlay: {
|
|
126
|
+
...StyleSheet.absoluteFillObject,
|
|
127
|
+
justifyContent: 'center',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
zIndex: 10
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
export default TPStreamsLiveChat;
|
|
133
|
+
//# sourceMappingURL=TPStreamsLiveChat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useRef","useImperativeHandle","useState","useCallback","useMemo","View","ActivityIndicator","StyleSheet","WebView","isChatMessage","generateChatHTML","CHAT_SDK_CONSTANTS","ChatMessageType","jsx","_jsx","jsxs","_jsxs","TPStreamsLiveChat","props","ref","username","roomId","title","colors","typography","customCSS","style","onChatReady","onChatError","onMessageReceived","webViewRef","status","setStatus","htmlContent","handleMessage","event","type","message","JSON","parse","nativeEvent","data","READY","ERROR","MESSAGE","console","warn","DEBUG","debug","err","error","handleWebViewError","syntheticEvent","description","reload","current","injectCSS","css","script","stringify","injectJavaScript","renderLoading","styles","overlay","backgroundColor","background","DEFAULT_BACKGROUND_COLOR","children","size","color","primary","DEFAULT_PRIMARY_COLOR","container","source","html","baseUrl","BASE_URL","originWhitelist","javaScriptEnabled","domStorageEnabled","onMessage","onError","webview","allowsInlineMediaPlayback","mediaPlaybackRequiresUserAction","scrollEnabled","fontFamily","displayName","create","flex","overflow","absoluteFillObject","justifyContent","alignItems","zIndex"],"sourceRoot":"../../src","sources":["TPStreamsLiveChat.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,mBAAmB,EACnBC,QAAQ,EACRC,WAAW,EACXC,OAAO,QACF,OAAO;AACd,SACEC,IAAI,EACJC,iBAAiB,EACjBC,UAAU,QAEL,cAAc;AACrB,SAASC,OAAO,QAAkC,sBAAsB;AAMxE,SAASC,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,sBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExE,MAAMC,iBAAiB,gBAAGlB,UAAU,CAGlC,CAACmB,KAAK,EAAEC,GAAG,KAAK;EAChB,MAAM;IACJC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC,MAAM;IACNC,UAAU;IACVC,SAAS;IACTC,KAAK;IACLC,WAAW;IACXC,WAAW;IACXC;EACF,CAAC,GAAGX,KAAK;EAET,MAAMY,UAAU,GAAG9B,MAAM,CAAU,IAAI,CAAC;EACxC,MAAM,CAAC+B,MAAM,EAAEC,SAAS,CAAC,GAAG9B,QAAQ,CACl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AAClE,kBAAkB,CAACiE,QAAQ,CAAE;MAC/CE,iBAAiB,EAAE,IAAK;MACxBC,iBAAiB,EAAE,IAAK;MACxBC,SAAS,EAAE9C,aAAc;MACzB+C,OAAO,EAAE9B,kBAAmB;MAC5BzB,KAAK,EAAEoC,MAAM,CAACoB,OAAQ;MACtBC,yBAAyB,EAAE,IAAK;MAChCC,+BAA+B,EAAE,KAAM;MACvCC,aAAa,EAAE;IAAM,GAdhB,GAAG9D,MAAM,EAAE0C,UAAU,IAAIzC,UAAU,EAAE8D,UAAU,EAerD,CAAC,EACDzB,aAAa,CAAC,CAAC;EAAA,CACZ,CAAC;AAEX,CAAC,CAAC;AAEF5C,iBAAiB,CAACsE,WAAW,GAAG,mBAAmB;AAEnD,MAAMzB,MAAM,GAAGvD,UAAU,CAACiF,MAAM,CAAC;EAC/BhB,SAAS,EAAE;IACTiB,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDR,OAAO,EAAE;IACPO,IAAI,EAAE,CAAC;IACPzB,eAAe,EAAE;EACnB,CAAC;EACDD,OAAO,EAAE;IACP,GAAGxD,UAAU,CAACoF,kBAAkB;IAChCC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAe7E,iBAAiB","ignoreList":[]}
|
|
@@ -25,6 +25,7 @@ const TPStreamsPlayerView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25
25
|
enableDownload,
|
|
26
26
|
offlineLicenseExpireTime,
|
|
27
27
|
showDefaultCaptions,
|
|
28
|
+
startInFullscreen,
|
|
28
29
|
downloadMetadata,
|
|
29
30
|
style,
|
|
30
31
|
onPlayerStateChanged,
|
|
@@ -164,6 +165,7 @@ const TPStreamsPlayerView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
164
165
|
startAt,
|
|
165
166
|
enableDownload,
|
|
166
167
|
showDefaultCaptions,
|
|
168
|
+
startInFullscreen,
|
|
167
169
|
downloadMetadata: downloadMetadata ? JSON.stringify(downloadMetadata) : undefined,
|
|
168
170
|
offlineLicenseExpireTime,
|
|
169
171
|
style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","useCallback","TPStreamsPlayerNative","Commands","jsx","_jsx","nextInstanceId","TPStreamsPlayerView","props","ref","videoId","accessToken","shouldAutoPlay","startAt","enableDownload","offlineLicenseExpireTime","showDefaultCaptions","downloadMetadata","style","onPlayerStateChanged","onIsPlayingChanged","onPlaybackSpeedChanged","onIsLoadingChanged","onError","onAccessTokenExpired","restProps","nativeRef","instanceId","promiseMap","onCurrentPosition","event","key","current","handler","resolve","nativeEvent","position","onDuration","duration","onIsPlaying","isPlaying","onPlaybackSpeed","speed","handlePlayerStateChanged","playbackState","handleIsPlayingChanged","handlePlaybackSpeedChanged","handleIsLoadingChanged","isLoading","handleError","message","code","details","Object","entries","forEach","reject","Error","handleAccessTokenExpired","expiredVideoId","newToken","setNewAccessToken","console","error","createPromiseMethod","command","eventKey","Promise","setTimeout","play","pause","seekTo","positionMs","setPlaybackSpeed","getCurrentPosition","getDuration","getPlaybackSpeed","nativeProps","JSON","stringify","undefined"],"sourceRoot":"../../src","sources":["TPStreamsPlayer.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAC5E,OAAOC,qBAAqB,IAC1BC,QAAQ,QACH,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAO9C;AACA,IAAIC,cAAc,GAAG,CAAC;;AAEtB;;AAQA;;AAYA;;
|
|
1
|
+
{"version":3,"names":["forwardRef","useImperativeHandle","useRef","useCallback","TPStreamsPlayerNative","Commands","jsx","_jsx","nextInstanceId","TPStreamsPlayerView","props","ref","videoId","accessToken","shouldAutoPlay","startAt","enableDownload","offlineLicenseExpireTime","showDefaultCaptions","startInFullscreen","downloadMetadata","style","onPlayerStateChanged","onIsPlayingChanged","onPlaybackSpeedChanged","onIsLoadingChanged","onError","onAccessTokenExpired","restProps","nativeRef","instanceId","promiseMap","onCurrentPosition","event","key","current","handler","resolve","nativeEvent","position","onDuration","duration","onIsPlaying","isPlaying","onPlaybackSpeed","speed","handlePlayerStateChanged","playbackState","handleIsPlayingChanged","handlePlaybackSpeedChanged","handleIsLoadingChanged","isLoading","handleError","message","code","details","Object","entries","forEach","reject","Error","handleAccessTokenExpired","expiredVideoId","newToken","setNewAccessToken","console","error","createPromiseMethod","command","eventKey","Promise","setTimeout","play","pause","seekTo","positionMs","setPlaybackSpeed","getCurrentPosition","getDuration","getPlaybackSpeed","nativeProps","JSON","stringify","undefined"],"sourceRoot":"../../src","sources":["TPStreamsPlayer.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAC5E,OAAOC,qBAAqB,IAC1BC,QAAQ,QACH,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAO9C;AACA,IAAIC,cAAc,GAAG,CAAC;;AAEtB;;AAQA;;AAYA;;AA0BA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,gBAAGT,UAAU,CAGpC,CAACU,KAAK,EAAEC,GAAG,KAAK;EAChB,MAAM;IACJC,OAAO;IACPC,WAAW;IACXC,cAAc;IACdC,OAAO;IACPC,cAAc;IACdC,wBAAwB;IACxBC,mBAAmB;IACnBC,iBAAiB;IACjBC,gBAAgB;IAChBC,KAAK;IACLC,oBAAoB;IACpBC,kBAAkB;IAClBC,sBAAsB;IACtBC,kBAAkB;IAClBC,OAAO;IACPC,oBAAoB;IACpB,GAAGC;EACL,CAAC,GAAGlB,KAAK;EAET,MAAMmB,SAAS,GAAG3B,MAAM,CAAC,IAAI,CAAC;EAC9B,MAAM4B,UAAU,GAAG5B,MAAM,CAASM,cAAc,EAAE,CAAC;EACnD,MAAMuB,UAAU,GAAG7B,MAAM,CAAa,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ACnBC,iBAAiB;IACjBC,gBAAgB,EAAEA,gBAAgB,GAC9B6D,IAAI,CAACC,SAAS,CAAC9D,gBAAgB,CAAC,GAChC+D,SAAS;IACblE,wBAAwB;IACxBI,KAAK;IACLW,iBAAiB;IACjBQ,UAAU;IACVE,WAAW;IACXE,eAAe;IACftB,oBAAoB,EAAEwB,wBAAwB;IAC9CvB,kBAAkB,EAAEyB,sBAAsB;IAC1CxB,sBAAsB,EAAEyB,0BAA0B;IAClDxB,kBAAkB,EAAEyB,sBAAsB;IAC1CxB,OAAO,EAAE0B,WAAW;IACpBzB,oBAAoB,EAAEkC;EACxB,CAAC;EAED,oBAAOtD,IAAA,CAACH,qBAAqB;IAAA,GAAK4E,WAAW;IAAErE,GAAG,EAAEkB;EAAU,CAAE,CAAC;AACnE,CAAC,CAAC;AAEF,eAAepB,mBAAmB","ignoreList":[]}
|
|
@@ -23,6 +23,7 @@ export interface NativeProps extends ViewProps {
|
|
|
23
23
|
enableDownload?: boolean;
|
|
24
24
|
offlineLicenseExpireTime?: Double;
|
|
25
25
|
showDefaultCaptions?: boolean;
|
|
26
|
+
startInFullscreen?: boolean;
|
|
26
27
|
downloadMetadata?: string;
|
|
27
28
|
|
|
28
29
|
// Event props for receiving data from native methods
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","onDownloadStateChanged","TPStreamsModule","TPStreams","initialize","organizationId"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C;AACA,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,sCAAsC;AACvF,cAAc,sCAAsC;;AAEpD;AACA,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,sBAAmB;AAGlE,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,yBAAyB,EACzBC,sBAAsB,QAKjB,wBAAqB;AAE5B,MAAMC,eAAe,GAAGhB,aAAa,CAACiB,SAAS;AAE/C,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAGC,cAAsB,IAAW;IAC5CH,eAAe,CAACE,UAAU,CAACC,cAAc,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeModules","default","TPStreamsPlayerNative","TPStreamsPlayerView","pauseDownload","resumeDownload","removeDownload","isDownloaded","isDownloading","isPaused","getDownloadStatus","getAllDownloads","addDownloadProgressListener","removeDownloadProgressListener","onDownloadProgressChanged","onDownloadStateChanged","TPStreamsModule","TPStreams","initialize","organizationId","TPStreamsLiveChat"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C;AACA,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,sCAAsC;AACvF,cAAc,sCAAsC;;AAEpD;AACA,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,sBAAmB;AAGlE,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,yBAAyB,EACzBC,sBAAsB,QAKjB,wBAAqB;AAE5B,MAAMC,eAAe,GAAGhB,aAAa,CAACiB,SAAS;AAE/C,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAGC,cAAsB,IAAW;IAC5CH,eAAe,CAACE,UAAU,CAACC,cAAc,CAAC;EAC5C;AACF,CAAC;AAED,SAASlB,OAAO,IAAImB,iBAAiB,QAAQ,wBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Color configuration for the chat interface
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Chat message structure
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for ChatMessage
|
|
13
|
+
*/
|
|
14
|
+
export function isChatMessage(data) {
|
|
15
|
+
return data && typeof data.id === 'string' && typeof data.username === 'string' && typeof data.message === 'string' && typeof data.timestamp === 'number';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Typography configuration for the chat interface
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Props for TPStreamsLiveChat component
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Ref methods exposed by TPStreamsLiveChat component
|
|
28
|
+
*/
|
|
29
|
+
//# sourceMappingURL=TPStreamsLiveChatTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isChatMessage","data","id","username","message","timestamp"],"sourceRoot":"../../../src","sources":["types/TPStreamsLiveChatTypes.ts"],"mappings":";;AAEA;AACA;AACA;;AAcA;AACA;AACA;;AAQA;AACA;AACA;AACA,OAAO,SAASA,aAAaA,CAACC,IAAS,EAAuB;EAC5D,OACEA,IAAI,IACJ,OAAOA,IAAI,CAACC,EAAE,KAAK,QAAQ,IAC3B,OAAOD,IAAI,CAACE,QAAQ,KAAK,QAAQ,IACjC,OAAOF,IAAI,CAACG,OAAO,KAAK,QAAQ,IAChC,OAAOH,IAAI,CAACI,SAAS,KAAK,QAAQ;AAEtC;;AAEA;AACA;AACA;;AAYA;AACA;AACA;;AAiCA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* URLs for the Live Chat SDK assets and base configuration
|
|
5
|
+
*/
|
|
6
|
+
export const CHAT_SDK_CONSTANTS = {
|
|
7
|
+
// The domain where the chat is hosted/associated
|
|
8
|
+
BASE_URL: 'https://media.testpress.in',
|
|
9
|
+
// CDN path for the CSS styles
|
|
10
|
+
STYLES_URL: 'https://media.testpress.in/static/live_chat/live_chat.css',
|
|
11
|
+
// CDN path for the UMD build of the SDK
|
|
12
|
+
SDK_SCRIPT_URL: 'https://media.testpress.in/static/live_chat/live_chat.umd.cjs',
|
|
13
|
+
// Default values
|
|
14
|
+
DEFAULT_PRIMARY_COLOR: '#007AFF',
|
|
15
|
+
DEFAULT_BACKGROUND_COLOR: '#FFFFFF'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Message types for communication between WebView and React Native
|
|
20
|
+
*/
|
|
21
|
+
export let ChatMessageType = /*#__PURE__*/function (ChatMessageType) {
|
|
22
|
+
ChatMessageType["READY"] = "ready";
|
|
23
|
+
ChatMessageType["ERROR"] = "error";
|
|
24
|
+
ChatMessageType["MESSAGE"] = "message";
|
|
25
|
+
ChatMessageType["DEBUG"] = "debug";
|
|
26
|
+
return ChatMessageType;
|
|
27
|
+
}({});
|
|
28
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CHAT_SDK_CONSTANTS","BASE_URL","STYLES_URL","SDK_SCRIPT_URL","DEFAULT_PRIMARY_COLOR","DEFAULT_BACKGROUND_COLOR","ChatMessageType"],"sourceRoot":"../../../src","sources":["utils/constants.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,MAAMA,kBAAkB,GAAG;EAChC;EACAC,QAAQ,EAAE,4BAA4B;EAEtC;EACAC,UAAU,EAAE,2DAA2D;EAEvE;EACAC,cAAc,EACZ,+DAA+D;EAEjE;EACAC,qBAAqB,EAAE,SAAS;EAChCC,wBAAwB,EAAE;AAC5B,CAAC;;AAED;AACA;AACA;AACA,WAAYC,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { CHAT_SDK_CONSTANTS, ChatMessageType } from "./constants.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generates the complete HTML content for the chat WebView
|
|
7
|
+
*/
|
|
8
|
+
export function generateChatHTML(props) {
|
|
9
|
+
const {
|
|
10
|
+
username,
|
|
11
|
+
roomId,
|
|
12
|
+
title
|
|
13
|
+
} = props;
|
|
14
|
+
const styles = generateStylesAndScripts(props);
|
|
15
|
+
return `
|
|
16
|
+
<!DOCTYPE html>
|
|
17
|
+
<html lang="en" style="height: 100%; margin: 0;">
|
|
18
|
+
<head>
|
|
19
|
+
<meta charset="UTF-8">
|
|
20
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
21
|
+
<link rel="stylesheet" href="${CHAT_SDK_CONSTANTS.STYLES_URL}">
|
|
22
|
+
${styles.css}
|
|
23
|
+
</head>
|
|
24
|
+
<body style="height: 100%; margin: 0; overflow: hidden;">
|
|
25
|
+
<div id="app" style="height: 100%;"></div>
|
|
26
|
+
<script src="${CHAT_SDK_CONSTANTS.SDK_SCRIPT_URL}"></script>
|
|
27
|
+
<script>
|
|
28
|
+
(function() {
|
|
29
|
+
const config = {
|
|
30
|
+
username: ${JSON.stringify(username)},
|
|
31
|
+
roomId: ${JSON.stringify(roomId)},
|
|
32
|
+
title: ${JSON.stringify(title)}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function postToNative(type, message = null) {
|
|
36
|
+
if (window.ReactNativeWebView) {
|
|
37
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ type, message }));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
new TPStreamsChat.load(document.querySelector("#app"), config);
|
|
43
|
+
postToNative('${ChatMessageType.READY}');
|
|
44
|
+
} catch (error) {
|
|
45
|
+
postToNative('${ChatMessageType.ERROR}', error.message || 'Failed to initialize chat');
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
</script>
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Combines all CSS generation logic
|
|
56
|
+
*/
|
|
57
|
+
function generateStylesAndScripts(props) {
|
|
58
|
+
const {
|
|
59
|
+
colors,
|
|
60
|
+
typography,
|
|
61
|
+
customCSS
|
|
62
|
+
} = props;
|
|
63
|
+
const rules = [];
|
|
64
|
+
if (typography) rules.push(getTypographyCSS(typography));
|
|
65
|
+
if (colors) rules.push(getColorCSS(colors));
|
|
66
|
+
if (customCSS) rules.push(customCSS);
|
|
67
|
+
return {
|
|
68
|
+
css: `<style>${rules.join('\n\n')}</style>`
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generate color-related CSS using functional approach
|
|
74
|
+
*/
|
|
75
|
+
function getColorCSS(colors) {
|
|
76
|
+
const rules = [];
|
|
77
|
+
if (colors.primary) {
|
|
78
|
+
rules.push(`
|
|
79
|
+
button, [class*="bg-blue-"], [class*="bg-indigo-"], [class*="primary"] {
|
|
80
|
+
background-color: ${colors.primary} !important;
|
|
81
|
+
color: white !important;
|
|
82
|
+
}
|
|
83
|
+
.text-blue-600, .text-indigo-600, [class*="text-blue-"]:not([class*="bg-"]), [class*="text-indigo-"]:not([class*="bg-"]) {
|
|
84
|
+
color: ${colors.primary} !important;
|
|
85
|
+
}
|
|
86
|
+
[class*="bg-blue-"] *, [class*="bg-indigo-"] *, [class*="primary"] * {
|
|
87
|
+
color: white !important;
|
|
88
|
+
}
|
|
89
|
+
`);
|
|
90
|
+
}
|
|
91
|
+
if (colors.background) {
|
|
92
|
+
rules.push(`
|
|
93
|
+
body, #app, .chat-container, [class*="bg-white"], [class*="bg-gray-50"], [class*="bg-slate-"] {
|
|
94
|
+
background-color: ${colors.background} !important;
|
|
95
|
+
}
|
|
96
|
+
`);
|
|
97
|
+
}
|
|
98
|
+
if (colors.text) {
|
|
99
|
+
rules.push(`
|
|
100
|
+
body, p, input, textarea,
|
|
101
|
+
div:not([class*="bg-blue-"]):not([class*="bg-indigo-"]):not([class*="primary"]),
|
|
102
|
+
span:not([class*="bg-blue-"]):not([class*="bg-indigo-"]):not([class*="primary"]) {
|
|
103
|
+
color: ${colors.text} !important;
|
|
104
|
+
}
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
if (colors.inputBackground) {
|
|
108
|
+
rules.push(`
|
|
109
|
+
textarea, input[type="text"], [class*="bg-gray-"], [class*="bg-slate-"] {
|
|
110
|
+
background-color: ${colors.inputBackground} !important;
|
|
111
|
+
}
|
|
112
|
+
`);
|
|
113
|
+
}
|
|
114
|
+
if (colors.border) {
|
|
115
|
+
rules.push(`
|
|
116
|
+
[class*="border"], [class*="divide-"] > * {
|
|
117
|
+
border-color: ${colors.border} !important;
|
|
118
|
+
}
|
|
119
|
+
`);
|
|
120
|
+
}
|
|
121
|
+
return rules.join('\n');
|
|
122
|
+
}
|
|
123
|
+
function getTypographyCSS(typography) {
|
|
124
|
+
const styles = [];
|
|
125
|
+
if (typography.fontSize) styles.push(`font-size: ${typography.fontSize}px !important;`);
|
|
126
|
+
if (typography.fontFamily) styles.push(`font-family: ${typography.fontFamily} !important;`);
|
|
127
|
+
if (typography.fontWeight) styles.push(`font-weight: ${typography.fontWeight} !important;`);
|
|
128
|
+
if (typography.lineHeight) styles.push(`line-height: ${typography.lineHeight} !important;`);
|
|
129
|
+
return styles.length > 0 ? `body, button, input, textarea, div, span, p { ${styles.join(' ')} }` : '';
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=liveChatHtmlGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CHAT_SDK_CONSTANTS","ChatMessageType","generateChatHTML","props","username","roomId","title","styles","generateStylesAndScripts","STYLES_URL","css","SDK_SCRIPT_URL","JSON","stringify","READY","ERROR","colors","typography","customCSS","rules","push","getTypographyCSS","getColorCSS","join","primary","background","text","inputBackground","border","fontSize","fontFamily","fontWeight","lineHeight","length"],"sourceRoot":"../../../src","sources":["utils/liveChatHtmlGenerator.ts"],"mappings":";;AAKA,SAASA,kBAAkB,EAAEC,eAAe,QAAQ,gBAAa;;AAEjE;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,KAA6B,EAAU;EACtE,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGH,KAAK;EACzC,MAAMI,MAAM,GAAGC,wBAAwB,CAACL,KAAK,CAAC;EAE9C,OAAO;AACT;AACA;AACA;AACA;AACA;AACA,uCAAuCH,kBAAkB,CAACS,UAAU;AACpE,UAAUF,MAAM,CAACG,GAAG;AACpB;AACA;AACA;AACA,uBAAuBV,kBAAkB,CAACW,cAAc;AACxD;AACA;AACA;AACA,0BAA0BC,IAAI,CAACC,SAAS,CAACT,QAAQ,CAAC;AAClD,wBAAwBQ,IAAI,CAACC,SAAS,CAACR,MAAM,CAAC;AAC9C,uBAAuBO,IAAI,CAACC,SAAS,CAACP,KAAK,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8BL,eAAe,CAACa,KAAK;AACnD;AACA,8BAA8Bb,eAAe,CAACc,KAAK;AACnD;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,SAASP,wBAAwBA,CAACL,KAA6B,EAAE;EAC/D,MAAM;IAAEa,MAAM;IAAEC,UAAU;IAAEC;EAAU,CAAC,GAAGf,KAAK;EAC/C,MAAMgB,KAAe,GAAG,EAAE;EAE1B,IAAIF,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AACJ,UAA0B,EAAU;EAC5D,MAAMV,MAAgB,GAAG,EAAE;EAC3B,IAAIU,UAAU,CAACY,QAAQ,EACrBtB,MAAM,CAACa,IAAI,CAAC,cAAcH,UAAU,CAACY,QAAQ,gBAAgB,CAAC;EAChE,IAAIZ,UAAU,CAACa,UAAU,EACvBvB,MAAM,CAACa,IAAI,CAAC,gBAAgBH,UAAU,CAACa,UAAU,cAAc,CAAC;EAClE,IAAIb,UAAU,CAACc,UAAU,EACvBxB,MAAM,CAACa,IAAI,CAAC,gBAAgBH,UAAU,CAACc,UAAU,cAAc,CAAC;EAClE,IAAId,UAAU,CAACe,UAAU,EACvBzB,MAAM,CAACa,IAAI,CAAC,gBAAgBH,UAAU,CAACe,UAAU,cAAc,CAAC;EAElE,OAAOzB,MAAM,CAAC0B,MAAM,GAAG,CAAC,GACpB,iDAAiD1B,MAAM,CAACgB,IAAI,CAAC,GAAG,CAAC,IAAI,GACrE,EAAE;AACR","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TPStreamsLiveChatProps, TPStreamsLiveChatRef } from './types/TPStreamsLiveChatTypes';
|
|
3
|
+
declare const TPStreamsLiveChat: import("react").ForwardRefExoticComponent<TPStreamsLiveChatProps & import("react").RefAttributes<TPStreamsLiveChatRef>>;
|
|
4
|
+
export default TPStreamsLiveChat;
|
|
5
|
+
//# sourceMappingURL=TPStreamsLiveChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TPStreamsLiveChat.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsLiveChat.tsx"],"names":[],"mappings":";AAgBA,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAKxC,QAAA,MAAM,iBAAiB,yHA+IrB,CAAC;AAqBH,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TPStre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C;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IAC1C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;IACX,oBAAoB,CAAC,EAAE,CACrB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,KACjC,IAAI,CAAC;CACX;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,qHA2MvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
|
@@ -17,6 +17,7 @@ export interface NativeProps extends ViewProps {
|
|
|
17
17
|
enableDownload?: boolean;
|
|
18
18
|
offlineLicenseExpireTime?: Double;
|
|
19
19
|
showDefaultCaptions?: boolean;
|
|
20
|
+
startInFullscreen?: boolean;
|
|
20
21
|
downloadMetadata?: string;
|
|
21
22
|
onCurrentPosition?: DirectEventHandler<{
|
|
22
23
|
position: Double;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TPStreamsPlayerViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsPlayerViewNativeComponent.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO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AC,WAAW,CAAC,CAAC,KAClD,IAAI,CAAC;IACV,WAAW,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7E,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAC3E,gBAAgB,EAAE,CAChB,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAClD,IAAI,CAAC;IACV,iBAAiB,EAAE,CACjB,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACrD,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;CACX;AAED,eAAO,MAAM,QAAQ,6BAYnB,CAAC;;AAEH,wBAA4E"}
|
|
@@ -6,4 +6,6 @@ export { pauseDownload, resumeDownload, removeDownload, isDownloaded, isDownload
|
|
|
6
6
|
export declare const TPStreams: {
|
|
7
7
|
initialize: (organizationId: string) => void;
|
|
8
8
|
};
|
|
9
|
+
export { default as TPStreamsLiveChat } from './TPStreamsLiveChat';
|
|
10
|
+
export type { TPStreamsLiveChatProps, TPStreamsLiveChatRef, ChatColors, ChatTypography, ChatMessage, } from './types/TPStreamsLiveChatTypes';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,cAAc,sCAAsC,CAAC;AAGrD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,8BAA8B,EAC9B,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,SAAS;iCACS,MAAM,KAAG,IAAI;CAG3C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,cAAc,sCAAsC,CAAC;AAGrD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,8BAA8B,EAC9B,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,SAAS;iCACS,MAAM,KAAG,IAAI;CAG3C,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,WAAW,GACZ,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Color configuration for the chat interface
|
|
4
|
+
*/
|
|
5
|
+
export interface ChatColors {
|
|
6
|
+
/** Primary brand color (buttons, links, accents) */
|
|
7
|
+
primary?: string;
|
|
8
|
+
/** Chat background color */
|
|
9
|
+
background?: string;
|
|
10
|
+
/** Default text color */
|
|
11
|
+
text?: string;
|
|
12
|
+
/** Input field background color */
|
|
13
|
+
inputBackground?: string;
|
|
14
|
+
/** Border and divider color */
|
|
15
|
+
border?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Chat message structure
|
|
19
|
+
*/
|
|
20
|
+
export interface ChatMessage {
|
|
21
|
+
id: string;
|
|
22
|
+
username: string;
|
|
23
|
+
message: string;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Type guard for ChatMessage
|
|
28
|
+
*/
|
|
29
|
+
export declare function isChatMessage(data: any): data is ChatMessage;
|
|
30
|
+
/**
|
|
31
|
+
* Typography configuration for the chat interface
|
|
32
|
+
*/
|
|
33
|
+
export interface ChatTypography {
|
|
34
|
+
/** Base font size in pixels */
|
|
35
|
+
fontSize?: number;
|
|
36
|
+
/** Font family (e.g., 'Inter, sans-serif') */
|
|
37
|
+
fontFamily?: string;
|
|
38
|
+
/** Font weight (e.g., '400', 'bold', 600) */
|
|
39
|
+
fontWeight?: string | number;
|
|
40
|
+
/** Line height multiplier */
|
|
41
|
+
lineHeight?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Props for TPStreamsLiveChat component
|
|
45
|
+
*/
|
|
46
|
+
export interface TPStreamsLiveChatProps {
|
|
47
|
+
/** Username of the current user */
|
|
48
|
+
username: string;
|
|
49
|
+
/** Room ID for the chat (obtained from live stream details) */
|
|
50
|
+
roomId: string;
|
|
51
|
+
/** Title displayed in the chat header */
|
|
52
|
+
title: string;
|
|
53
|
+
/** Color scheme configuration */
|
|
54
|
+
colors?: ChatColors;
|
|
55
|
+
/** Typography configuration */
|
|
56
|
+
typography?: ChatTypography;
|
|
57
|
+
/** Custom CSS to inject (for advanced users) */
|
|
58
|
+
customCSS?: string;
|
|
59
|
+
/** Container style */
|
|
60
|
+
style?: ViewStyle;
|
|
61
|
+
/** Called when chat is successfully loaded and ready */
|
|
62
|
+
onChatReady?: () => void;
|
|
63
|
+
/** Called when an error occurs */
|
|
64
|
+
onChatError?: (error: string) => void;
|
|
65
|
+
/** Called when a new message is received */
|
|
66
|
+
onMessageReceived?: (message: ChatMessage) => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Ref methods exposed by TPStreamsLiveChat component
|
|
70
|
+
*/
|
|
71
|
+
export interface TPStreamsLiveChatRef {
|
|
72
|
+
/** Reload the chat interface */
|
|
73
|
+
reload: () => void;
|
|
74
|
+
/** Inject custom CSS dynamically */
|
|
75
|
+
injectCSS?: (css: string) => void;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=TPStreamsLiveChatTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TPStreamsLiveChatTypes.d.ts","sourceRoot":"","sources":["../../../../src/types/TPStreamsLiveChatTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,I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|
|
5
|
+
BASE_URL: string;
|
|
6
|
+
STYLES_URL: string;
|
|
7
|
+
SDK_SCRIPT_URL: string;
|
|
8
|
+
DEFAULT_PRIMARY_COLOR: string;
|
|
9
|
+
DEFAULT_BACKGROUND_COLOR: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Message types for communication between WebView and React Native
|
|
13
|
+
*/
|
|
14
|
+
export declare enum ChatMessageType {
|
|
15
|
+
READY = "ready",
|
|
16
|
+
ERROR = "error",
|
|
17
|
+
MESSAGE = "message",
|
|
18
|
+
DEBUG = "debug"
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAc9B,CAAC;AAEF;;GAEG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TPStreamsLiveChatProps } from '../types/TPStreamsLiveChatTypes';
|
|
2
|
+
/**
|
|
3
|
+
* Generates the complete HTML content for the chat WebView
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateChatHTML(props: TPStreamsLiveChatProps): string;
|
|
6
|
+
//# sourceMappingURL=liveChatHtmlGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveChatHtmlGenerator.d.ts","sourceRoot":"","sources":["../../../../src/utils/liveChatHtmlGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,iCAAiC,CAAC;AAGzC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAyCtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpstreams",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Video component for TPStreams",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
"turbo": "^1.10.7",
|
|
86
86
|
"typescript": "5.4.5"
|
|
87
87
|
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"react-native-webview": "^13.16.0"
|
|
90
|
+
},
|
|
88
91
|
"peerDependencies": {
|
|
89
92
|
"react": "*",
|
|
90
93
|
"react-native": "*"
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
useRef,
|
|
4
|
+
useImperativeHandle,
|
|
5
|
+
useState,
|
|
6
|
+
useCallback,
|
|
7
|
+
useMemo,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import {
|
|
10
|
+
View,
|
|
11
|
+
ActivityIndicator,
|
|
12
|
+
StyleSheet,
|
|
13
|
+
type NativeSyntheticEvent,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import { WebView, type WebViewMessageEvent } from 'react-native-webview';
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
TPStreamsLiveChatProps,
|
|
19
|
+
TPStreamsLiveChatRef,
|
|
20
|
+
} from './types/TPStreamsLiveChatTypes';
|
|
21
|
+
import { isChatMessage } from './types/TPStreamsLiveChatTypes';
|
|
22
|
+
import { generateChatHTML } from './utils/liveChatHtmlGenerator';
|
|
23
|
+
import { CHAT_SDK_CONSTANTS, ChatMessageType } from './utils/constants';
|
|
24
|
+
|
|
25
|
+
const TPStreamsLiveChat = forwardRef<
|
|
26
|
+
TPStreamsLiveChatRef,
|
|
27
|
+
TPStreamsLiveChatProps
|
|
28
|
+
>((props, ref) => {
|
|
29
|
+
const {
|
|
30
|
+
username,
|
|
31
|
+
roomId,
|
|
32
|
+
title,
|
|
33
|
+
colors,
|
|
34
|
+
typography,
|
|
35
|
+
customCSS,
|
|
36
|
+
style,
|
|
37
|
+
onChatReady,
|
|
38
|
+
onChatError,
|
|
39
|
+
onMessageReceived,
|
|
40
|
+
} = props;
|
|
41
|
+
|
|
42
|
+
const webViewRef = useRef<WebView>(null);
|
|
43
|
+
const [status, setStatus] = useState<'loading' | 'ready' | 'error'>(
|
|
44
|
+
'loading'
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const htmlContent = useMemo(
|
|
48
|
+
() =>
|
|
49
|
+
generateChatHTML({
|
|
50
|
+
username,
|
|
51
|
+
roomId,
|
|
52
|
+
title,
|
|
53
|
+
colors,
|
|
54
|
+
typography,
|
|
55
|
+
customCSS,
|
|
56
|
+
}),
|
|
57
|
+
[username, roomId, title, colors, typography, customCSS]
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const handleMessage = useCallback(
|
|
61
|
+
(event: WebViewMessageEvent) => {
|
|
62
|
+
try {
|
|
63
|
+
const { type, message } = JSON.parse(event.nativeEvent.data);
|
|
64
|
+
|
|
65
|
+
switch (type) {
|
|
66
|
+
case ChatMessageType.READY:
|
|
67
|
+
setStatus('ready');
|
|
68
|
+
onChatReady?.();
|
|
69
|
+
break;
|
|
70
|
+
|
|
71
|
+
case ChatMessageType.ERROR:
|
|
72
|
+
setStatus('error');
|
|
73
|
+
onChatError?.(message || 'SDK initialization failed');
|
|
74
|
+
break;
|
|
75
|
+
|
|
76
|
+
case ChatMessageType.MESSAGE:
|
|
77
|
+
if (isChatMessage(message)) {
|
|
78
|
+
onMessageReceived?.(message);
|
|
79
|
+
} else {
|
|
80
|
+
console.warn(
|
|
81
|
+
'[TPStreamsLiveChat] Received invalid message format:',
|
|
82
|
+
message
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
|
|
87
|
+
case ChatMessageType.DEBUG:
|
|
88
|
+
console.debug('[TPStreamsLiveChat] WebView:', message);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
} catch (err) {
|
|
92
|
+
console.error('[TPStreamsLiveChat] Failed to parse message:', err);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
[onChatReady, onChatError, onMessageReceived]
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const handleWebViewError = useCallback(
|
|
99
|
+
(syntheticEvent: NativeSyntheticEvent<any>) => {
|
|
100
|
+
const { nativeEvent } = syntheticEvent;
|
|
101
|
+
setStatus('error');
|
|
102
|
+
onChatError?.(nativeEvent.description || 'WebView failed to load');
|
|
103
|
+
},
|
|
104
|
+
[onChatError]
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
useImperativeHandle(
|
|
108
|
+
ref,
|
|
109
|
+
() => ({
|
|
110
|
+
reload: () => {
|
|
111
|
+
setStatus('loading');
|
|
112
|
+
webViewRef.current?.reload();
|
|
113
|
+
},
|
|
114
|
+
injectCSS: (css: string) => {
|
|
115
|
+
const script = `
|
|
116
|
+
(function() {
|
|
117
|
+
const style = document.createElement('style');
|
|
118
|
+
style.textContent = ${JSON.stringify(css)};
|
|
119
|
+
document.head.appendChild(style);
|
|
120
|
+
})();
|
|
121
|
+
`;
|
|
122
|
+
webViewRef.current?.injectJavaScript(script);
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
[]
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const renderLoading = () =>
|
|
129
|
+
status === 'loading' && (
|
|
130
|
+
<View
|
|
131
|
+
style={[
|
|
132
|
+
styles.overlay,
|
|
133
|
+
{
|
|
134
|
+
backgroundColor:
|
|
135
|
+
colors?.background || CHAT_SDK_CONSTANTS.DEFAULT_BACKGROUND_COLOR,
|
|
136
|
+
},
|
|
137
|
+
]}
|
|
138
|
+
>
|
|
139
|
+
<ActivityIndicator
|
|
140
|
+
size="large"
|
|
141
|
+
color={colors?.primary || CHAT_SDK_CONSTANTS.DEFAULT_PRIMARY_COLOR}
|
|
142
|
+
/>
|
|
143
|
+
</View>
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<View style={[styles.container, style]}>
|
|
148
|
+
<WebView
|
|
149
|
+
key={`${colors?.background}-${typography?.fontFamily}`}
|
|
150
|
+
ref={webViewRef}
|
|
151
|
+
source={{
|
|
152
|
+
html: htmlContent,
|
|
153
|
+
baseUrl: CHAT_SDK_CONSTANTS.BASE_URL,
|
|
154
|
+
}}
|
|
155
|
+
originWhitelist={[CHAT_SDK_CONSTANTS.BASE_URL]}
|
|
156
|
+
javaScriptEnabled={true}
|
|
157
|
+
domStorageEnabled={true}
|
|
158
|
+
onMessage={handleMessage}
|
|
159
|
+
onError={handleWebViewError}
|
|
160
|
+
style={styles.webview}
|
|
161
|
+
allowsInlineMediaPlayback={true}
|
|
162
|
+
mediaPlaybackRequiresUserAction={false}
|
|
163
|
+
scrollEnabled={false}
|
|
164
|
+
/>
|
|
165
|
+
{renderLoading()}
|
|
166
|
+
</View>
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
TPStreamsLiveChat.displayName = 'TPStreamsLiveChat';
|
|
171
|
+
|
|
172
|
+
const styles = StyleSheet.create({
|
|
173
|
+
container: {
|
|
174
|
+
flex: 1,
|
|
175
|
+
overflow: 'hidden',
|
|
176
|
+
},
|
|
177
|
+
webview: {
|
|
178
|
+
flex: 1,
|
|
179
|
+
backgroundColor: 'transparent',
|
|
180
|
+
},
|
|
181
|
+
overlay: {
|
|
182
|
+
...StyleSheet.absoluteFillObject,
|
|
183
|
+
justifyContent: 'center',
|
|
184
|
+
alignItems: 'center',
|
|
185
|
+
zIndex: 10,
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
export default TPStreamsLiveChat;
|
package/src/TPStreamsPlayer.tsx
CHANGED
|
@@ -40,6 +40,7 @@ export interface TPStreamsPlayerProps extends ViewProps {
|
|
|
40
40
|
enableDownload?: boolean;
|
|
41
41
|
offlineLicenseExpireTime?: number;
|
|
42
42
|
showDefaultCaptions?: boolean;
|
|
43
|
+
startInFullscreen?: boolean;
|
|
43
44
|
downloadMetadata?: { [key: string]: any };
|
|
44
45
|
onPlayerStateChanged?: (state: number) => void;
|
|
45
46
|
onIsPlayingChanged?: (isPlaying: boolean) => void;
|
|
@@ -72,6 +73,7 @@ const TPStreamsPlayerView = forwardRef<
|
|
|
72
73
|
enableDownload,
|
|
73
74
|
offlineLicenseExpireTime,
|
|
74
75
|
showDefaultCaptions,
|
|
76
|
+
startInFullscreen,
|
|
75
77
|
downloadMetadata,
|
|
76
78
|
style,
|
|
77
79
|
onPlayerStateChanged,
|
|
@@ -243,6 +245,7 @@ const TPStreamsPlayerView = forwardRef<
|
|
|
243
245
|
startAt,
|
|
244
246
|
enableDownload,
|
|
245
247
|
showDefaultCaptions,
|
|
248
|
+
startInFullscreen,
|
|
246
249
|
downloadMetadata: downloadMetadata
|
|
247
250
|
? JSON.stringify(downloadMetadata)
|
|
248
251
|
: undefined,
|
|
@@ -23,6 +23,7 @@ export interface NativeProps extends ViewProps {
|
|
|
23
23
|
enableDownload?: boolean;
|
|
24
24
|
offlineLicenseExpireTime?: Double;
|
|
25
25
|
showDefaultCaptions?: boolean;
|
|
26
|
+
startInFullscreen?: boolean;
|
|
26
27
|
downloadMetadata?: string;
|
|
27
28
|
|
|
28
29
|
// Event props for receiving data from native methods
|
package/src/index.tsx
CHANGED
|
@@ -33,3 +33,12 @@ export const TPStreams = {
|
|
|
33
33
|
TPStreamsModule.initialize(organizationId);
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
|
+
|
|
37
|
+
export { default as TPStreamsLiveChat } from './TPStreamsLiveChat';
|
|
38
|
+
export type {
|
|
39
|
+
TPStreamsLiveChatProps,
|
|
40
|
+
TPStreamsLiveChatRef,
|
|
41
|
+
ChatColors,
|
|
42
|
+
ChatTypography,
|
|
43
|
+
ChatMessage,
|
|
44
|
+
} from './types/TPStreamsLiveChatTypes';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Color configuration for the chat interface
|
|
5
|
+
*/
|
|
6
|
+
export interface ChatColors {
|
|
7
|
+
/** Primary brand color (buttons, links, accents) */
|
|
8
|
+
primary?: string;
|
|
9
|
+
/** Chat background color */
|
|
10
|
+
background?: string;
|
|
11
|
+
/** Default text color */
|
|
12
|
+
text?: string;
|
|
13
|
+
/** Input field background color */
|
|
14
|
+
inputBackground?: string;
|
|
15
|
+
/** Border and divider color */
|
|
16
|
+
border?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Chat message structure
|
|
21
|
+
*/
|
|
22
|
+
export interface ChatMessage {
|
|
23
|
+
id: string;
|
|
24
|
+
username: string;
|
|
25
|
+
message: string;
|
|
26
|
+
timestamp: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Type guard for ChatMessage
|
|
31
|
+
*/
|
|
32
|
+
export function isChatMessage(data: any): data is ChatMessage {
|
|
33
|
+
return (
|
|
34
|
+
data &&
|
|
35
|
+
typeof data.id === 'string' &&
|
|
36
|
+
typeof data.username === 'string' &&
|
|
37
|
+
typeof data.message === 'string' &&
|
|
38
|
+
typeof data.timestamp === 'number'
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Typography configuration for the chat interface
|
|
44
|
+
*/
|
|
45
|
+
export interface ChatTypography {
|
|
46
|
+
/** Base font size in pixels */
|
|
47
|
+
fontSize?: number;
|
|
48
|
+
/** Font family (e.g., 'Inter, sans-serif') */
|
|
49
|
+
fontFamily?: string;
|
|
50
|
+
/** Font weight (e.g., '400', 'bold', 600) */
|
|
51
|
+
fontWeight?: string | number;
|
|
52
|
+
/** Line height multiplier */
|
|
53
|
+
lineHeight?: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Props for TPStreamsLiveChat component
|
|
58
|
+
*/
|
|
59
|
+
export interface TPStreamsLiveChatProps {
|
|
60
|
+
// Required configuration
|
|
61
|
+
/** Username of the current user */
|
|
62
|
+
username: string;
|
|
63
|
+
/** Room ID for the chat (obtained from live stream details) */
|
|
64
|
+
roomId: string;
|
|
65
|
+
/** Title displayed in the chat header */
|
|
66
|
+
title: string;
|
|
67
|
+
|
|
68
|
+
// Optional styling configuration
|
|
69
|
+
/** Color scheme configuration */
|
|
70
|
+
colors?: ChatColors;
|
|
71
|
+
/** Typography configuration */
|
|
72
|
+
typography?: ChatTypography;
|
|
73
|
+
|
|
74
|
+
// Advanced customization
|
|
75
|
+
/** Custom CSS to inject (for advanced users) */
|
|
76
|
+
customCSS?: string;
|
|
77
|
+
|
|
78
|
+
// Standard React Native props
|
|
79
|
+
/** Container style */
|
|
80
|
+
style?: ViewStyle;
|
|
81
|
+
|
|
82
|
+
// Event callbacks
|
|
83
|
+
/** Called when chat is successfully loaded and ready */
|
|
84
|
+
onChatReady?: () => void;
|
|
85
|
+
/** Called when an error occurs */
|
|
86
|
+
onChatError?: (error: string) => void;
|
|
87
|
+
/** Called when a new message is received */
|
|
88
|
+
onMessageReceived?: (message: ChatMessage) => void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Ref methods exposed by TPStreamsLiveChat component
|
|
93
|
+
*/
|
|
94
|
+
export interface TPStreamsLiveChatRef {
|
|
95
|
+
/** Reload the chat interface */
|
|
96
|
+
reload: () => void;
|
|
97
|
+
/** Inject custom CSS dynamically */
|
|
98
|
+
injectCSS?: (css: string) => void;
|
|
99
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URLs for the Live Chat SDK assets and base configuration
|
|
3
|
+
*/
|
|
4
|
+
export const CHAT_SDK_CONSTANTS = {
|
|
5
|
+
// The domain where the chat is hosted/associated
|
|
6
|
+
BASE_URL: 'https://media.testpress.in',
|
|
7
|
+
|
|
8
|
+
// CDN path for the CSS styles
|
|
9
|
+
STYLES_URL: 'https://media.testpress.in/static/live_chat/live_chat.css',
|
|
10
|
+
|
|
11
|
+
// CDN path for the UMD build of the SDK
|
|
12
|
+
SDK_SCRIPT_URL:
|
|
13
|
+
'https://media.testpress.in/static/live_chat/live_chat.umd.cjs',
|
|
14
|
+
|
|
15
|
+
// Default values
|
|
16
|
+
DEFAULT_PRIMARY_COLOR: '#007AFF',
|
|
17
|
+
DEFAULT_BACKGROUND_COLOR: '#FFFFFF',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Message types for communication between WebView and React Native
|
|
22
|
+
*/
|
|
23
|
+
export enum ChatMessageType {
|
|
24
|
+
READY = 'ready',
|
|
25
|
+
ERROR = 'error',
|
|
26
|
+
MESSAGE = 'message',
|
|
27
|
+
DEBUG = 'debug',
|
|
28
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
TPStreamsLiveChatProps,
|
|
3
|
+
ChatColors,
|
|
4
|
+
ChatTypography,
|
|
5
|
+
} from '../types/TPStreamsLiveChatTypes';
|
|
6
|
+
import { CHAT_SDK_CONSTANTS, ChatMessageType } from './constants';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generates the complete HTML content for the chat WebView
|
|
10
|
+
*/
|
|
11
|
+
export function generateChatHTML(props: TPStreamsLiveChatProps): string {
|
|
12
|
+
const { username, roomId, title } = props;
|
|
13
|
+
const styles = generateStylesAndScripts(props);
|
|
14
|
+
|
|
15
|
+
return `
|
|
16
|
+
<!DOCTYPE html>
|
|
17
|
+
<html lang="en" style="height: 100%; margin: 0;">
|
|
18
|
+
<head>
|
|
19
|
+
<meta charset="UTF-8">
|
|
20
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
21
|
+
<link rel="stylesheet" href="${CHAT_SDK_CONSTANTS.STYLES_URL}">
|
|
22
|
+
${styles.css}
|
|
23
|
+
</head>
|
|
24
|
+
<body style="height: 100%; margin: 0; overflow: hidden;">
|
|
25
|
+
<div id="app" style="height: 100%;"></div>
|
|
26
|
+
<script src="${CHAT_SDK_CONSTANTS.SDK_SCRIPT_URL}"></script>
|
|
27
|
+
<script>
|
|
28
|
+
(function() {
|
|
29
|
+
const config = {
|
|
30
|
+
username: ${JSON.stringify(username)},
|
|
31
|
+
roomId: ${JSON.stringify(roomId)},
|
|
32
|
+
title: ${JSON.stringify(title)}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function postToNative(type, message = null) {
|
|
36
|
+
if (window.ReactNativeWebView) {
|
|
37
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ type, message }));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
new TPStreamsChat.load(document.querySelector("#app"), config);
|
|
43
|
+
postToNative('${ChatMessageType.READY}');
|
|
44
|
+
} catch (error) {
|
|
45
|
+
postToNative('${ChatMessageType.ERROR}', error.message || 'Failed to initialize chat');
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
</script>
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Combines all CSS generation logic
|
|
56
|
+
*/
|
|
57
|
+
function generateStylesAndScripts(props: TPStreamsLiveChatProps) {
|
|
58
|
+
const { colors, typography, customCSS } = props;
|
|
59
|
+
const rules: string[] = [];
|
|
60
|
+
|
|
61
|
+
if (typography) rules.push(getTypographyCSS(typography));
|
|
62
|
+
if (colors) rules.push(getColorCSS(colors));
|
|
63
|
+
if (customCSS) rules.push(customCSS);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
css: `<style>${rules.join('\n\n')}</style>`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Generate color-related CSS using functional approach
|
|
72
|
+
*/
|
|
73
|
+
function getColorCSS(colors: ChatColors): string {
|
|
74
|
+
const rules: string[] = [];
|
|
75
|
+
|
|
76
|
+
if (colors.primary) {
|
|
77
|
+
rules.push(`
|
|
78
|
+
button, [class*="bg-blue-"], [class*="bg-indigo-"], [class*="primary"] {
|
|
79
|
+
background-color: ${colors.primary} !important;
|
|
80
|
+
color: white !important;
|
|
81
|
+
}
|
|
82
|
+
.text-blue-600, .text-indigo-600, [class*="text-blue-"]:not([class*="bg-"]), [class*="text-indigo-"]:not([class*="bg-"]) {
|
|
83
|
+
color: ${colors.primary} !important;
|
|
84
|
+
}
|
|
85
|
+
[class*="bg-blue-"] *, [class*="bg-indigo-"] *, [class*="primary"] * {
|
|
86
|
+
color: white !important;
|
|
87
|
+
}
|
|
88
|
+
`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (colors.background) {
|
|
92
|
+
rules.push(`
|
|
93
|
+
body, #app, .chat-container, [class*="bg-white"], [class*="bg-gray-50"], [class*="bg-slate-"] {
|
|
94
|
+
background-color: ${colors.background} !important;
|
|
95
|
+
}
|
|
96
|
+
`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (colors.text) {
|
|
100
|
+
rules.push(`
|
|
101
|
+
body, p, input, textarea,
|
|
102
|
+
div:not([class*="bg-blue-"]):not([class*="bg-indigo-"]):not([class*="primary"]),
|
|
103
|
+
span:not([class*="bg-blue-"]):not([class*="bg-indigo-"]):not([class*="primary"]) {
|
|
104
|
+
color: ${colors.text} !important;
|
|
105
|
+
}
|
|
106
|
+
`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (colors.inputBackground) {
|
|
110
|
+
rules.push(`
|
|
111
|
+
textarea, input[type="text"], [class*="bg-gray-"], [class*="bg-slate-"] {
|
|
112
|
+
background-color: ${colors.inputBackground} !important;
|
|
113
|
+
}
|
|
114
|
+
`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (colors.border) {
|
|
118
|
+
rules.push(`
|
|
119
|
+
[class*="border"], [class*="divide-"] > * {
|
|
120
|
+
border-color: ${colors.border} !important;
|
|
121
|
+
}
|
|
122
|
+
`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return rules.join('\n');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function getTypographyCSS(typography: ChatTypography): string {
|
|
129
|
+
const styles: string[] = [];
|
|
130
|
+
if (typography.fontSize)
|
|
131
|
+
styles.push(`font-size: ${typography.fontSize}px !important;`);
|
|
132
|
+
if (typography.fontFamily)
|
|
133
|
+
styles.push(`font-family: ${typography.fontFamily} !important;`);
|
|
134
|
+
if (typography.fontWeight)
|
|
135
|
+
styles.push(`font-weight: ${typography.fontWeight} !important;`);
|
|
136
|
+
if (typography.lineHeight)
|
|
137
|
+
styles.push(`line-height: ${typography.lineHeight} !important;`);
|
|
138
|
+
|
|
139
|
+
return styles.length > 0
|
|
140
|
+
? `body, button, input, textarea, div, span, p { ${styles.join(' ')} }`
|
|
141
|
+
: '';
|
|
142
|
+
}
|