@go1/go1-embedding-react-sdk 0.0.1 → 0.0.2
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
CHANGED
|
@@ -24,8 +24,8 @@ export function YourHostingComponent() {
|
|
|
24
24
|
|
|
25
25
|
const options = useMemo<ContentViewProps>(() => {
|
|
26
26
|
return {
|
|
27
|
-
feature: '
|
|
28
|
-
|
|
27
|
+
feature: 'ai-chat',
|
|
28
|
+
portalURL: 'learning-incorporated-usa.mygo1.com',
|
|
29
29
|
onGo1MessageReceived,
|
|
30
30
|
};
|
|
31
31
|
}, []);
|
|
@@ -74,7 +74,7 @@ interface FeatureAttributes {
|
|
|
74
74
|
interface InitOptions {
|
|
75
75
|
feature: string; // 'ai-chat' | 'explore' | 'preview';
|
|
76
76
|
featureAttributes?: FeatureAttributes; // optional
|
|
77
|
-
|
|
77
|
+
portalURL?: string; //optional
|
|
78
78
|
onGo1MessageReceived?: OnGo1MessageReceived; //optional
|
|
79
79
|
additionalUserInfo?: any; //optional
|
|
80
80
|
themeInformation?: ThemeInformation; //optional
|
|
@@ -107,7 +107,7 @@ const onGo1MessageReceived = useCallback(message => {
|
|
|
107
107
|
const options = useMemo<ContentViewProps>(() => {
|
|
108
108
|
return {
|
|
109
109
|
feature: 'ai-chat',
|
|
110
|
-
|
|
110
|
+
portalURL: 'learning-incorporated-usa.mygo1.com',
|
|
111
111
|
featureAttributes: {
|
|
112
112
|
id: 32973,
|
|
113
113
|
},
|
package/dist/README.md
CHANGED
|
@@ -24,8 +24,8 @@ export function YourHostingComponent() {
|
|
|
24
24
|
|
|
25
25
|
const options = useMemo<ContentViewProps>(() => {
|
|
26
26
|
return {
|
|
27
|
-
feature: '
|
|
28
|
-
|
|
27
|
+
feature: 'ai-chat',
|
|
28
|
+
portalURL: 'learning-incorporated-usa.mygo1.com',
|
|
29
29
|
onGo1MessageReceived,
|
|
30
30
|
};
|
|
31
31
|
}, []);
|
|
@@ -74,7 +74,7 @@ interface FeatureAttributes {
|
|
|
74
74
|
interface InitOptions {
|
|
75
75
|
feature: string; // 'ai-chat' | 'explore' | 'preview';
|
|
76
76
|
featureAttributes?: FeatureAttributes; // optional
|
|
77
|
-
|
|
77
|
+
portalURL?: string; //optional
|
|
78
78
|
onGo1MessageReceived?: OnGo1MessageReceived; //optional
|
|
79
79
|
additionalUserInfo?: any; //optional
|
|
80
80
|
themeInformation?: ThemeInformation; //optional
|
|
@@ -107,7 +107,7 @@ const onGo1MessageReceived = useCallback(message => {
|
|
|
107
107
|
const options = useMemo<ContentViewProps>(() => {
|
|
108
108
|
return {
|
|
109
109
|
feature: 'ai-chat',
|
|
110
|
-
|
|
110
|
+
portalURL: 'learning-incorporated-usa.mygo1.com',
|
|
111
111
|
featureAttributes: {
|
|
112
112
|
id: 32973,
|
|
113
113
|
},
|
package/dist/common/types.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface InitOptions {
|
|
|
21
21
|
feature: string;
|
|
22
22
|
iframeParentId: string;
|
|
23
23
|
featureAttributes?: FeatureAttributes;
|
|
24
|
-
|
|
24
|
+
portalURL?: string;
|
|
25
25
|
onGo1MessageReceived?: OnGo1MessageReceived;
|
|
26
26
|
additionalUserInfo?: any;
|
|
27
27
|
themeInformation?: ThemeInformation;
|
|
@@ -5,7 +5,7 @@ const React = require("react");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const constants_1 = require("../../common/constants");
|
|
7
7
|
function useGo1ContentView(props) {
|
|
8
|
-
const { feature, featureAttributes,
|
|
8
|
+
const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, baseURL, } = props;
|
|
9
9
|
const iframeRef = (0, react_1.useRef)(null);
|
|
10
10
|
const url = baseURL || 'https://embedding.go1.com';
|
|
11
11
|
let { iframeURL, iframeID } = (0, react_1.useMemo)(() => {
|
|
@@ -20,15 +20,15 @@ function useGo1ContentView(props) {
|
|
|
20
20
|
iframeURL.searchParams.append(key, `${value}`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
if (
|
|
24
|
-
iframeURL.searchParams.append('
|
|
23
|
+
if (portalURL) {
|
|
24
|
+
iframeURL.searchParams.append('portal_url', portalURL);
|
|
25
25
|
}
|
|
26
26
|
if (oneTimeToken) {
|
|
27
|
-
iframeURL.searchParams.append('
|
|
27
|
+
iframeURL.searchParams.append('one_time_token', oneTimeToken);
|
|
28
28
|
}
|
|
29
29
|
const iframeID = `go1-iframe-${feature}`;
|
|
30
30
|
return { iframeURL, iframeID };
|
|
31
|
-
}, [url, feature, oneTimeToken,
|
|
31
|
+
}, [url, feature, oneTimeToken, portalURL, featureAttributes]);
|
|
32
32
|
const sendMessageToGo1 = (0, react_1.useCallback)((message) => {
|
|
33
33
|
iframeRef.current?.contentWindow?.postMessage(message, url);
|
|
34
34
|
}, [url]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@go1/go1-embedding-react-sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "A React library to embed
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "A React library to embed Go1 content into your website.",
|
|
5
5
|
"main": "dist/go1-embedding-react-sdk/src/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|