@go1/go1-embedding-react-sdk 0.0.37 → 0.0.39
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 +4 -3
- package/dist/README.md +4 -3
- package/dist/common/types.d.ts +5 -1
- package/dist/go1-embedding-react-sdk/src/index.js +13 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ interface FeatureAttributeCommon {
|
|
|
88
88
|
shouldSuppressPreview?: boolean;
|
|
89
89
|
experience?: 'manager' | 'learner';
|
|
90
90
|
shouldShowGo1FeedbackButton?: boolean;
|
|
91
|
+
shouldShowSaveToPlaylistButton?: boolean;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
/**
|
|
@@ -158,7 +159,6 @@ export type FeatureType =
|
|
|
158
159
|
export interface InitOptions {
|
|
159
160
|
/** Mandatory identifier for the embedded feature */
|
|
160
161
|
feature: FeatureType;
|
|
161
|
-
// eslint-disable-next-line max-len
|
|
162
162
|
/** Optional element id to search for, and use as the parent for the Go1 content view (use either this or `iframeParentElement`, not both) */
|
|
163
163
|
iframeParentId?: string;
|
|
164
164
|
/** Optional element to use as the parent for the Go1 content view (use either this or `iframeParentId`, not both) */
|
|
@@ -169,15 +169,16 @@ export interface InitOptions {
|
|
|
169
169
|
portalURL?: string;
|
|
170
170
|
/** Optional function that is invoked when the Go1 content view emits a message */
|
|
171
171
|
onGo1MessageReceived?: OnGo1MessageReceived;
|
|
172
|
-
// eslint-disable-next-line max-len
|
|
173
172
|
/** Optional end user information that can enhance the context and provide a better experience. No PII is needed, please do not send any. */
|
|
174
173
|
additionalUserInfo?: AdditionalUserInfo;
|
|
175
174
|
/** Optional UI configuration */
|
|
176
175
|
themeInformation?: ThemeInformation;
|
|
177
176
|
/** Optional token that is used to pre-authorize the user without them needing to log in */
|
|
178
177
|
oneTimeToken?: string;
|
|
179
|
-
/** Optional Id that let us know users are coming from
|
|
178
|
+
/** Optional Id that let us know which integration system users are coming from (will be required in the future)*/
|
|
180
179
|
integrationSystemId?: string;
|
|
180
|
+
/** Optional Id that let us know which integration system users are coming from, if using an intermediary system to embed */
|
|
181
|
+
presentingIntegrationSystemId?: string;
|
|
181
182
|
}
|
|
182
183
|
```
|
|
183
184
|
|
package/dist/README.md
CHANGED
|
@@ -88,6 +88,7 @@ interface FeatureAttributeCommon {
|
|
|
88
88
|
shouldSuppressPreview?: boolean;
|
|
89
89
|
experience?: 'manager' | 'learner';
|
|
90
90
|
shouldShowGo1FeedbackButton?: boolean;
|
|
91
|
+
shouldShowSaveToPlaylistButton?: boolean;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
/**
|
|
@@ -158,7 +159,6 @@ export type FeatureType =
|
|
|
158
159
|
export interface InitOptions {
|
|
159
160
|
/** Mandatory identifier for the embedded feature */
|
|
160
161
|
feature: FeatureType;
|
|
161
|
-
// eslint-disable-next-line max-len
|
|
162
162
|
/** Optional element id to search for, and use as the parent for the Go1 content view (use either this or `iframeParentElement`, not both) */
|
|
163
163
|
iframeParentId?: string;
|
|
164
164
|
/** Optional element to use as the parent for the Go1 content view (use either this or `iframeParentId`, not both) */
|
|
@@ -169,15 +169,16 @@ export interface InitOptions {
|
|
|
169
169
|
portalURL?: string;
|
|
170
170
|
/** Optional function that is invoked when the Go1 content view emits a message */
|
|
171
171
|
onGo1MessageReceived?: OnGo1MessageReceived;
|
|
172
|
-
// eslint-disable-next-line max-len
|
|
173
172
|
/** Optional end user information that can enhance the context and provide a better experience. No PII is needed, please do not send any. */
|
|
174
173
|
additionalUserInfo?: AdditionalUserInfo;
|
|
175
174
|
/** Optional UI configuration */
|
|
176
175
|
themeInformation?: ThemeInformation;
|
|
177
176
|
/** Optional token that is used to pre-authorize the user without them needing to log in */
|
|
178
177
|
oneTimeToken?: string;
|
|
179
|
-
/** Optional Id that let us know users are coming from
|
|
178
|
+
/** Optional Id that let us know which integration system users are coming from (will be required in the future)*/
|
|
180
179
|
integrationSystemId?: string;
|
|
180
|
+
/** Optional Id that let us know which integration system users are coming from, if using an intermediary system to embed */
|
|
181
|
+
presentingIntegrationSystemId?: string;
|
|
181
182
|
}
|
|
182
183
|
```
|
|
183
184
|
|
package/dist/common/types.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ export interface AdditionalInfoMessage {
|
|
|
7
7
|
additionalUserInfo?: AdditionalUserInfo;
|
|
8
8
|
featureAttributes?: FeatureAttributes;
|
|
9
9
|
themeInformation?: ThemeInformation;
|
|
10
|
+
integrationSystemId?: string;
|
|
11
|
+
presentingIntegrationSystemId?: string;
|
|
10
12
|
}
|
|
11
13
|
export interface ThemeInformation {
|
|
12
14
|
accent: string;
|
|
13
15
|
}
|
|
14
|
-
export type Go1MessageType = 'preview_start_content' | 'preview_close' | 'preview_add_content_success' | 'preview_add_content_failure' | 'preview_remove_content_success' | 'preview_remove_content_failure' | 'parent_show_preview' | 'set_additional_embedding_data' | 'go1_app_initialised' | 'ott_required' | 'search_result_selected' | 'search_filter_toggle' | 'search_redirected' | 'pass_ott' | 'logout' | 'sync_content';
|
|
16
|
+
export type Go1MessageType = 'preview_start_content' | 'preview_close' | 'preview_add_content_success' | 'preview_add_content_failure' | 'preview_remove_content_success' | 'preview_remove_content_failure' | 'parent_show_preview' | 'set_additional_embedding_data' | 'go1_app_initialised' | 'ott_required' | 'search_result_selected' | 'search_filter_toggle' | 'search_redirected' | 'pass_ott' | 'logout' | 'sync_content' | 'open_save_to_playlist_modal';
|
|
15
17
|
export interface Go1Message {
|
|
16
18
|
type: Go1MessageType;
|
|
17
19
|
payload?: any;
|
|
@@ -20,6 +22,7 @@ export interface FeatureAttributeCommon {
|
|
|
20
22
|
shouldSuppressPreview?: boolean;
|
|
21
23
|
experience?: 'manager' | 'learner';
|
|
22
24
|
shouldShowGo1FeedbackButton?: boolean;
|
|
25
|
+
shouldShowSaveToPlaylistButton?: boolean;
|
|
23
26
|
}
|
|
24
27
|
interface FeatureAttributesPreviewCommon extends FeatureAttributeCommon {
|
|
25
28
|
startWith1Player?: boolean;
|
|
@@ -73,5 +76,6 @@ export interface InitOptions {
|
|
|
73
76
|
themeInformation?: ThemeInformation;
|
|
74
77
|
oneTimeToken?: string;
|
|
75
78
|
integrationSystemId?: string;
|
|
79
|
+
presentingIntegrationSystemId?: string;
|
|
76
80
|
}
|
|
77
81
|
export {};
|
|
@@ -6,7 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const constants_1 = require("../../common/constants");
|
|
7
7
|
const params_1 = require("../../common/params");
|
|
8
8
|
function useGo1ContentView(props) {
|
|
9
|
-
const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, integrationSystemId, env = 'production', } = props;
|
|
9
|
+
const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, integrationSystemId, presentingIntegrationSystemId, env = 'production', } = props;
|
|
10
10
|
const iframeRef = (0, react_1.useRef)(null);
|
|
11
11
|
let url = 'https://embedding.go1.com';
|
|
12
12
|
if (env === 'staging') {
|
|
@@ -26,12 +26,9 @@ function useGo1ContentView(props) {
|
|
|
26
26
|
if (oneTimeToken) {
|
|
27
27
|
(0, params_1.addOneTimeToken)(iframeURL, oneTimeToken);
|
|
28
28
|
}
|
|
29
|
-
if (integrationSystemId) {
|
|
30
|
-
iframeURL.searchParams.append('integration_system_id', integrationSystemId);
|
|
31
|
-
}
|
|
32
29
|
const iframeID = `go1-iframe-${feature}`;
|
|
33
30
|
return { iframeURL, iframeID };
|
|
34
|
-
}, [url, feature, portalURL, oneTimeToken,
|
|
31
|
+
}, [url, feature, portalURL, oneTimeToken, env]);
|
|
35
32
|
const eventListenerInstance = (0, react_1.useCallback)((event) => {
|
|
36
33
|
const { _type, ...rest } = event.data;
|
|
37
34
|
if (_type === constants_1.GO1_MESSAGE) {
|
|
@@ -40,6 +37,8 @@ function useGo1ContentView(props) {
|
|
|
40
37
|
additionalUserInfo,
|
|
41
38
|
themeInformation,
|
|
42
39
|
featureAttributes,
|
|
40
|
+
integrationSystemId,
|
|
41
|
+
presentingIntegrationSystemId,
|
|
43
42
|
};
|
|
44
43
|
sendMessageToGo1({
|
|
45
44
|
type: 'set_additional_embedding_data',
|
|
@@ -52,7 +51,15 @@ function useGo1ContentView(props) {
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
}, [
|
|
54
|
+
}, [
|
|
55
|
+
additionalUserInfo,
|
|
56
|
+
themeInformation,
|
|
57
|
+
featureAttributes,
|
|
58
|
+
integrationSystemId,
|
|
59
|
+
presentingIntegrationSystemId,
|
|
60
|
+
sendMessageToGo1,
|
|
61
|
+
onGo1MessageReceived,
|
|
62
|
+
]);
|
|
56
63
|
(0, react_1.useEffect)(() => {
|
|
57
64
|
window.addEventListener('message', eventListenerInstance);
|
|
58
65
|
return () => {
|