@go1/go1-embedding-react-sdk 0.0.1 → 0.0.3
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
|
}, []);
|
|
@@ -56,7 +56,7 @@ interface Go1Message {
|
|
|
56
56
|
|
|
57
57
|
interface ThemeInformation {
|
|
58
58
|
/** Hex string, starting with a #. Example #0437F2 */
|
|
59
|
-
|
|
59
|
+
accent: string;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -68,13 +68,13 @@ interface ThemeInformation {
|
|
|
68
68
|
* }
|
|
69
69
|
*/
|
|
70
70
|
interface FeatureAttributes {
|
|
71
|
-
[key: string]: number | string
|
|
71
|
+
[key: string]: number | string;
|
|
72
72
|
}
|
|
73
73
|
|
|
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
|
},
|
|
@@ -117,7 +117,7 @@ const options = useMemo<ContentViewProps>(() => {
|
|
|
117
117
|
goals: ['leadership', 'management']
|
|
118
118
|
},
|
|
119
119
|
themeInformation: {
|
|
120
|
-
|
|
120
|
+
accent: '#0437F2'
|
|
121
121
|
},
|
|
122
122
|
oneTimeToken: '907687a6e81a458190fe4c21f05ee689'
|
|
123
123
|
};
|
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
|
}, []);
|
|
@@ -56,7 +56,7 @@ interface Go1Message {
|
|
|
56
56
|
|
|
57
57
|
interface ThemeInformation {
|
|
58
58
|
/** Hex string, starting with a #. Example #0437F2 */
|
|
59
|
-
|
|
59
|
+
accent: string;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -68,13 +68,13 @@ interface ThemeInformation {
|
|
|
68
68
|
* }
|
|
69
69
|
*/
|
|
70
70
|
interface FeatureAttributes {
|
|
71
|
-
[key: string]: number | string
|
|
71
|
+
[key: string]: number | string;
|
|
72
72
|
}
|
|
73
73
|
|
|
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
|
},
|
|
@@ -117,7 +117,7 @@ const options = useMemo<ContentViewProps>(() => {
|
|
|
117
117
|
goals: ['leadership', 'management']
|
|
118
118
|
},
|
|
119
119
|
themeInformation: {
|
|
120
|
-
|
|
120
|
+
accent: '#0437F2'
|
|
121
121
|
},
|
|
122
122
|
oneTimeToken: '907687a6e81a458190fe4c21f05ee689'
|
|
123
123
|
};
|
package/dist/common/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface AdditionalInfoMessage {
|
|
|
8
8
|
themeInformation?: ThemeInformation;
|
|
9
9
|
}
|
|
10
10
|
export interface ThemeInformation {
|
|
11
|
-
|
|
11
|
+
accent: string;
|
|
12
12
|
}
|
|
13
13
|
export interface Go1Message {
|
|
14
14
|
type: string;
|
|
@@ -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.3",
|
|
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"
|