react-native-tpstreams 1.1.3 → 1.1.4-dev.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/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerDelegate.java +87 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerInterface.java +34 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.cpp +107 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h +81 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.cpp +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.h +34 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.cpp +16 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.h +29 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI-generated.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI.h +19 -0
- package/android/gradle.properties +1 -1
- package/lib/module/TPStreamsLiveChat.js +133 -0
- package/lib/module/TPStreamsLiveChat.js.map +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/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/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
|
@@ -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,CAClC,SACF,CAAC;EAED,MAAM+B,WAAW,GAAG7B,OAAO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AAiB,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":[]}
|
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,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zB;AAEA,SAASF,gBAAgBA,CAACJ,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,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
/// <reference types="react-native/types/modules/Codegen" />
|
|
3
|
+
/// <reference types="react-native/types/modules/Codegen" />
|
|
3
4
|
import type { ViewProps } from 'react-native';
|
|
4
5
|
import type { Double, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
5
6
|
import type { HostComponent } from 'react-native';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TPStreamsPlayerViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/TPStreamsPlayerViewNativeComponent.ts"],"names":[],"mappings":"
|
|
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,KAAK,EACV,MAAM,EACN,KAAK,EACL,KAAK,EACN,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAGpF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,iBAAiB,CAAC,EAAE,kBAAkB,CAAC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CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACrD,KAAK,EAAE,KAAK,KACT,IAAI,CAAC;IACV,kBAAkB,EAAE,CAClB,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,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,CAA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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,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K,IAAI,CAAC;CACnC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URLs for the Live Chat SDK assets and base configuration
|
|
3
|
+
*/
|
|
4
|
+
export declare const CHAT_SDK_CONSTANTS: {
|
|
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.4-dev.0",
|
|
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": "*"
|