@go1/go1-embedding-react-sdk 0.6.0 → 0.9.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/README.md +33 -2
- package/dist/CHANGELOG.md +18 -0
- package/dist/README.md +33 -2
- package/dist/common/params.d.ts +3 -0
- package/dist/common/params.js +15 -0
- package/dist/common/types.d.ts +21 -5
- package/dist/common/types.js +5 -3
- package/dist/go1-embedding-react-sdk/src/index.js +46 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -58,13 +58,26 @@ export interface FeatureAttributeCommon {
|
|
|
58
58
|
shouldSuppressBookmark?: boolean;
|
|
59
59
|
shouldSuppressPlaylistAdministration?: boolean;
|
|
60
60
|
shouldSuppressShareLink?: boolean;
|
|
61
|
+
shouldSuppressLibrary?: boolean;
|
|
62
|
+
shouldSuppressPlaylist?: boolean;
|
|
63
|
+
shouldSuppressCopyRightFooter?: boolean;
|
|
64
|
+
shouldSuppressPlay?: boolean;
|
|
65
|
+
shouldSuppressExport?: boolean;
|
|
61
66
|
contentScope?: 'subscription' | 'library';
|
|
67
|
+
shouldSuppressEndorsement?: boolean;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
|
|
71
|
+
export type ThemeMode = 'light' | 'dark';
|
|
72
|
+
|
|
73
|
+
export interface ThemeModeInformation {
|
|
74
|
+
mode: ThemeMode;
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
export interface ThemeInformation {
|
|
66
78
|
/** Hex string, starting with a #. Example #0437F2 */
|
|
67
79
|
accent: string;
|
|
80
|
+
mode?: ThemeMode;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
export type Go1MessageType =
|
|
@@ -104,7 +117,13 @@ export interface FeatureAttributeCommon {
|
|
|
104
117
|
shouldSuppressBookmark?: boolean;
|
|
105
118
|
shouldSuppressPlaylistAdministration?: boolean;
|
|
106
119
|
shouldSuppressShareLink?: boolean;
|
|
120
|
+
shouldSuppressLibrary?: boolean;
|
|
121
|
+
shouldSuppressPlaylist?: boolean;
|
|
122
|
+
shouldSuppressCopyRightFooter?: boolean;
|
|
123
|
+
shouldSuppressPlay?: boolean;
|
|
124
|
+
shouldSuppressExport?: boolean;
|
|
107
125
|
contentScope?: 'subscription' | 'library';
|
|
126
|
+
shouldSuppressEndorsement?: boolean;
|
|
108
127
|
}
|
|
109
128
|
|
|
110
129
|
/**
|
|
@@ -155,7 +174,10 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
|
|
|
155
174
|
playlistId?: number; // If embedding my-playlists feature with playlistId, the app will initialise with the specified playlistId page.
|
|
156
175
|
}
|
|
157
176
|
|
|
158
|
-
export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {
|
|
177
|
+
export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {
|
|
178
|
+
contentId?: number; // If the embedding my-learning feature includes a content id, the app will initialize with the specified content page.
|
|
179
|
+
selectingTab?: 'saved' | 'in-progress' | 'assigned' | 'completed';
|
|
180
|
+
}
|
|
159
181
|
|
|
160
182
|
export interface FeatureAttributesProspect {
|
|
161
183
|
isProspectExperience?: boolean;
|
|
@@ -191,6 +213,7 @@ export interface AdditionalUserInfo {
|
|
|
191
213
|
|
|
192
214
|
export type FeatureType =
|
|
193
215
|
| 'ai-chat'
|
|
216
|
+
/** @deprecated Use 'admin-curation' instead. */
|
|
194
217
|
| 'content-hub'
|
|
195
218
|
| 'preview'
|
|
196
219
|
| 'search'
|
|
@@ -212,7 +235,7 @@ export interface InitOptions {
|
|
|
212
235
|
/** Optional end user information that can enhance the context and provide a better experience. No PII is needed, please do not send any. */
|
|
213
236
|
additionalUserInfo?: AdditionalUserInfo;
|
|
214
237
|
/** Optional UI configuration */
|
|
215
|
-
themeInformation?: ThemeInformation;
|
|
238
|
+
themeInformation?: ThemeInformation | ThemeModeInformation;
|
|
216
239
|
/** Optional one time token that is used to pre-authorize the user without them needing to log in */
|
|
217
240
|
oneTimeToken?: string;
|
|
218
241
|
/** Optional OAuth token that is used to pre-authorize the user without them needing to log in */
|
|
@@ -221,9 +244,15 @@ export interface InitOptions {
|
|
|
221
244
|
integrationSystemId?: string;
|
|
222
245
|
/** Optional Id that let us know which integration system users are coming from, if using an intermediary system to embed */
|
|
223
246
|
presentingIntegrationSystemId?: string;
|
|
247
|
+
/** Optional flag to control JWT persistence in browser storage, if false, JWT will not be stored in localStorage, sessionStorage, or cookies */
|
|
248
|
+
persistJWT?: boolean;
|
|
224
249
|
}
|
|
225
250
|
```
|
|
226
251
|
|
|
252
|
+
`content-hub` is deprecated and will be removed in a future major release. Use
|
|
253
|
+
`admin-curation` for new integrations. Existing `content-hub` requests are
|
|
254
|
+
redirected server-side to `admin-curation` during the deprecation window.
|
|
255
|
+
|
|
227
256
|
## Function: `useGo1ContentView`
|
|
228
257
|
|
|
229
258
|
A react hook that will return
|
|
@@ -253,12 +282,14 @@ const options = useMemo<ContentViewProps>(() => {
|
|
|
253
282
|
featureAttributes: {
|
|
254
283
|
shouldSuppressShareLink: true,
|
|
255
284
|
},
|
|
285
|
+
persistJWT: false,
|
|
256
286
|
onGo1MessageReceived,
|
|
257
287
|
additionalUserInfo: {
|
|
258
288
|
jobTitle: 'Sales development representative',
|
|
259
289
|
},
|
|
260
290
|
themeInformation: {
|
|
261
291
|
accent: '#0437F2',
|
|
292
|
+
mode: 'dark',
|
|
262
293
|
},
|
|
263
294
|
oneTimeToken: '907687a6e81a458190fe4c21f05ee689',
|
|
264
295
|
integrationSystemId: 'int_nI7rPykBRm0C',
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @go1/go1-embedding-react-sdk
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Deprecate the content-hub feature in favour of admin-curation.
|
|
8
|
+
|
|
9
|
+
## 0.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Allow embedded apps to receive light or dark mode via themeInformation.mode
|
|
14
|
+
|
|
15
|
+
## 0.7.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- Add shouldSuppressExport feature attribute
|
|
20
|
+
|
|
3
21
|
## 0.6.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/README.md
CHANGED
|
@@ -58,13 +58,26 @@ export interface FeatureAttributeCommon {
|
|
|
58
58
|
shouldSuppressBookmark?: boolean;
|
|
59
59
|
shouldSuppressPlaylistAdministration?: boolean;
|
|
60
60
|
shouldSuppressShareLink?: boolean;
|
|
61
|
+
shouldSuppressLibrary?: boolean;
|
|
62
|
+
shouldSuppressPlaylist?: boolean;
|
|
63
|
+
shouldSuppressCopyRightFooter?: boolean;
|
|
64
|
+
shouldSuppressPlay?: boolean;
|
|
65
|
+
shouldSuppressExport?: boolean;
|
|
61
66
|
contentScope?: 'subscription' | 'library';
|
|
67
|
+
shouldSuppressEndorsement?: boolean;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
|
|
71
|
+
export type ThemeMode = 'light' | 'dark';
|
|
72
|
+
|
|
73
|
+
export interface ThemeModeInformation {
|
|
74
|
+
mode: ThemeMode;
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
export interface ThemeInformation {
|
|
66
78
|
/** Hex string, starting with a #. Example #0437F2 */
|
|
67
79
|
accent: string;
|
|
80
|
+
mode?: ThemeMode;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
export type Go1MessageType =
|
|
@@ -104,7 +117,13 @@ export interface FeatureAttributeCommon {
|
|
|
104
117
|
shouldSuppressBookmark?: boolean;
|
|
105
118
|
shouldSuppressPlaylistAdministration?: boolean;
|
|
106
119
|
shouldSuppressShareLink?: boolean;
|
|
120
|
+
shouldSuppressLibrary?: boolean;
|
|
121
|
+
shouldSuppressPlaylist?: boolean;
|
|
122
|
+
shouldSuppressCopyRightFooter?: boolean;
|
|
123
|
+
shouldSuppressPlay?: boolean;
|
|
124
|
+
shouldSuppressExport?: boolean;
|
|
107
125
|
contentScope?: 'subscription' | 'library';
|
|
126
|
+
shouldSuppressEndorsement?: boolean;
|
|
108
127
|
}
|
|
109
128
|
|
|
110
129
|
/**
|
|
@@ -155,7 +174,10 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
|
|
|
155
174
|
playlistId?: number; // If embedding my-playlists feature with playlistId, the app will initialise with the specified playlistId page.
|
|
156
175
|
}
|
|
157
176
|
|
|
158
|
-
export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {
|
|
177
|
+
export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {
|
|
178
|
+
contentId?: number; // If the embedding my-learning feature includes a content id, the app will initialize with the specified content page.
|
|
179
|
+
selectingTab?: 'saved' | 'in-progress' | 'assigned' | 'completed';
|
|
180
|
+
}
|
|
159
181
|
|
|
160
182
|
export interface FeatureAttributesProspect {
|
|
161
183
|
isProspectExperience?: boolean;
|
|
@@ -191,6 +213,7 @@ export interface AdditionalUserInfo {
|
|
|
191
213
|
|
|
192
214
|
export type FeatureType =
|
|
193
215
|
| 'ai-chat'
|
|
216
|
+
/** @deprecated Use 'admin-curation' instead. */
|
|
194
217
|
| 'content-hub'
|
|
195
218
|
| 'preview'
|
|
196
219
|
| 'search'
|
|
@@ -212,7 +235,7 @@ export interface InitOptions {
|
|
|
212
235
|
/** Optional end user information that can enhance the context and provide a better experience. No PII is needed, please do not send any. */
|
|
213
236
|
additionalUserInfo?: AdditionalUserInfo;
|
|
214
237
|
/** Optional UI configuration */
|
|
215
|
-
themeInformation?: ThemeInformation;
|
|
238
|
+
themeInformation?: ThemeInformation | ThemeModeInformation;
|
|
216
239
|
/** Optional one time token that is used to pre-authorize the user without them needing to log in */
|
|
217
240
|
oneTimeToken?: string;
|
|
218
241
|
/** Optional OAuth token that is used to pre-authorize the user without them needing to log in */
|
|
@@ -221,9 +244,15 @@ export interface InitOptions {
|
|
|
221
244
|
integrationSystemId?: string;
|
|
222
245
|
/** Optional Id that let us know which integration system users are coming from, if using an intermediary system to embed */
|
|
223
246
|
presentingIntegrationSystemId?: string;
|
|
247
|
+
/** Optional flag to control JWT persistence in browser storage, if false, JWT will not be stored in localStorage, sessionStorage, or cookies */
|
|
248
|
+
persistJWT?: boolean;
|
|
224
249
|
}
|
|
225
250
|
```
|
|
226
251
|
|
|
252
|
+
`content-hub` is deprecated and will be removed in a future major release. Use
|
|
253
|
+
`admin-curation` for new integrations. Existing `content-hub` requests are
|
|
254
|
+
redirected server-side to `admin-curation` during the deprecation window.
|
|
255
|
+
|
|
227
256
|
## Function: `useGo1ContentView`
|
|
228
257
|
|
|
229
258
|
A react hook that will return
|
|
@@ -253,12 +282,14 @@ const options = useMemo<ContentViewProps>(() => {
|
|
|
253
282
|
featureAttributes: {
|
|
254
283
|
shouldSuppressShareLink: true,
|
|
255
284
|
},
|
|
285
|
+
persistJWT: false,
|
|
256
286
|
onGo1MessageReceived,
|
|
257
287
|
additionalUserInfo: {
|
|
258
288
|
jobTitle: 'Sales development representative',
|
|
259
289
|
},
|
|
260
290
|
themeInformation: {
|
|
261
291
|
accent: '#0437F2',
|
|
292
|
+
mode: 'dark',
|
|
262
293
|
},
|
|
263
294
|
oneTimeToken: '907687a6e81a458190fe4c21f05ee689',
|
|
264
295
|
integrationSystemId: 'int_nI7rPykBRm0C',
|
package/dist/common/params.d.ts
CHANGED
|
@@ -2,5 +2,8 @@ import { FeatureType } from './types';
|
|
|
2
2
|
export declare function addPortalURL(url: URL, portalURL: string, env?: 'staging' | 'production'): void;
|
|
3
3
|
export declare function addOneTimeToken(url: URL, oneTimeToken: string): void;
|
|
4
4
|
export declare function addForceReauth(url: URL): void;
|
|
5
|
+
export declare function addPersistJWT(url: URL, persistJWT: boolean): void;
|
|
5
6
|
export declare function isValidOTT(oneTimeToken: string): boolean;
|
|
6
7
|
export declare function isValidFeature(feature: FeatureType): boolean;
|
|
8
|
+
export declare const DEPRECATED_FEATURES: Readonly<Partial<Record<FeatureType, FeatureType>>>;
|
|
9
|
+
export declare function warnIfDeprecatedFeature(feature: FeatureType): void;
|
package/dist/common/params.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEPRECATED_FEATURES = void 0;
|
|
3
4
|
exports.addPortalURL = addPortalURL;
|
|
4
5
|
exports.addOneTimeToken = addOneTimeToken;
|
|
5
6
|
exports.addForceReauth = addForceReauth;
|
|
7
|
+
exports.addPersistJWT = addPersistJWT;
|
|
6
8
|
exports.isValidOTT = isValidOTT;
|
|
7
9
|
exports.isValidFeature = isValidFeature;
|
|
10
|
+
exports.warnIfDeprecatedFeature = warnIfDeprecatedFeature;
|
|
8
11
|
const types_1 = require("./types");
|
|
9
12
|
function addPortalURL(url, portalURL, env = 'production') {
|
|
10
13
|
let validPortalURL = /^(?=.{1,255}$)([a-zA-Z0-9-]+\.)+mygo1\.com$/;
|
|
@@ -29,6 +32,9 @@ function addOneTimeToken(url, oneTimeToken) {
|
|
|
29
32
|
function addForceReauth(url) {
|
|
30
33
|
url.searchParams.append('force_reauth', 'true');
|
|
31
34
|
}
|
|
35
|
+
function addPersistJWT(url, persistJWT) {
|
|
36
|
+
url.searchParams.append('persist_jwt', persistJWT.toString());
|
|
37
|
+
}
|
|
32
38
|
function isValidOTT(oneTimeToken) {
|
|
33
39
|
const validOTT = /^[A-Za-z0-9]+$/;
|
|
34
40
|
return validOTT.test(oneTimeToken);
|
|
@@ -36,3 +42,12 @@ function isValidOTT(oneTimeToken) {
|
|
|
36
42
|
function isValidFeature(feature) {
|
|
37
43
|
return types_1.features.includes(feature);
|
|
38
44
|
}
|
|
45
|
+
exports.DEPRECATED_FEATURES = {
|
|
46
|
+
'content-hub': 'admin-curation',
|
|
47
|
+
};
|
|
48
|
+
function warnIfDeprecatedFeature(feature) {
|
|
49
|
+
const replacement = exports.DEPRECATED_FEATURES[feature];
|
|
50
|
+
if (!replacement)
|
|
51
|
+
return;
|
|
52
|
+
console.warn(`[go1-embedding-sdk] The "${feature}" feature is deprecated and will be removed in a future major release. Use "${replacement}" instead.`);
|
|
53
|
+
}
|
package/dist/common/types.d.ts
CHANGED
|
@@ -7,19 +7,26 @@ export interface AdditionalInfoMessage {
|
|
|
7
7
|
feature: FeatureType;
|
|
8
8
|
additionalUserInfo?: AdditionalUserInfo;
|
|
9
9
|
featureAttributes?: FeatureAttributes;
|
|
10
|
-
themeInformation?:
|
|
10
|
+
themeInformation?: ThemeInformationPayload;
|
|
11
11
|
integrationSystemId?: string;
|
|
12
12
|
presentingIntegrationSystemId?: string;
|
|
13
13
|
experience?: FeatureAttributes['experience'];
|
|
14
14
|
disableFSOuterScript?: boolean;
|
|
15
15
|
}
|
|
16
|
+
export type ThemeMode = 'light' | 'dark';
|
|
17
|
+
export interface ThemeModeInformation {
|
|
18
|
+
mode: ThemeMode;
|
|
19
|
+
}
|
|
16
20
|
export interface ThemeInformation {
|
|
17
21
|
accent: string;
|
|
22
|
+
mode?: ThemeMode;
|
|
18
23
|
}
|
|
19
24
|
export interface ThemeInformationElysium {
|
|
20
25
|
brandColor: string;
|
|
26
|
+
mode?: ThemeMode;
|
|
21
27
|
}
|
|
22
|
-
export type
|
|
28
|
+
export type ThemeInformationPayload = ThemeInformation | ThemeInformationElysium | ThemeModeInformation;
|
|
29
|
+
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' | 'set_access_token' | 'logout' | 'sync_content' | 'open_save_to_playlist_modal' | 'update_experience' | 'inter_feature_navigation' | 'side_drawer_open' | 'side_drawer_close' | 'play_content' | 'go1pay_custom_data' | 'bulk_upload_content' | 'bulk_upload_metadata' | 'bulk_retirement_request' | 'bulk_upload_close' | 'contact_go1_navigation' | 'library_content_added';
|
|
23
30
|
interface Go1MessageUpdateExperience {
|
|
24
31
|
type: 'update_experience';
|
|
25
32
|
payload: {
|
|
@@ -39,8 +46,15 @@ export interface FeatureAttributeCommon {
|
|
|
39
46
|
shouldSuppressBookmark?: boolean;
|
|
40
47
|
shouldSuppressPlaylistAdministration?: boolean;
|
|
41
48
|
shouldSuppressShareLink?: boolean;
|
|
49
|
+
shouldSuppressLibrary?: boolean;
|
|
50
|
+
shouldSuppressPlaylist?: boolean;
|
|
51
|
+
shouldSuppressCopyRightFooter?: boolean;
|
|
52
|
+
shouldSuppressPlay?: boolean;
|
|
53
|
+
shouldSuppressExport?: boolean;
|
|
42
54
|
experience?: ExternalExperience;
|
|
43
55
|
contentScope?: 'subscription' | 'library';
|
|
56
|
+
shouldSuppressEndorsement?: boolean;
|
|
57
|
+
shouldSuppressAssign?: boolean;
|
|
44
58
|
}
|
|
45
59
|
interface FeatureAttributesPreviewCommon extends FeatureAttributeCommon {
|
|
46
60
|
startWith1Player?: boolean;
|
|
@@ -90,6 +104,7 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
|
|
|
90
104
|
playlistId?: number;
|
|
91
105
|
}
|
|
92
106
|
export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {
|
|
107
|
+
contentId?: number;
|
|
93
108
|
selectingTab?: 'saved' | 'in-progress' | 'assigned' | 'completed';
|
|
94
109
|
}
|
|
95
110
|
export interface FeatureAttributesProspect {
|
|
@@ -110,8 +125,8 @@ export type FeatureAttributes = FeatureAttributesAIChat | FeatureAttributesPrevi
|
|
|
110
125
|
export interface AdditionalUserInfo {
|
|
111
126
|
jobTitle: string;
|
|
112
127
|
}
|
|
113
|
-
export declare const features: readonly ["auth-clients", "go1-learn/library", "go1-learn/my-learning", "go1-learn/search", "
|
|
114
|
-
export type FeatureType = (typeof features)[number];
|
|
128
|
+
export declare const features: readonly ["activity-feed", "ai-chat", "admin-curation", "auth-clients", "auth-clients-public", "go1-learn/library", "go1-learn/my-learning", "go1-learn/search", "go1-learn/search-categories", "bulk-upload", "content-hub", "content-retirement", "content-status", "library", "my-learning", "my-playlists", "partner-sales", "preview", "recommendations", "search", "wallet"];
|
|
129
|
+
export type FeatureType = Exclude<(typeof features)[number], 'content-hub'> | 'content-hub';
|
|
115
130
|
export interface InitOptions {
|
|
116
131
|
feature: FeatureType;
|
|
117
132
|
iframeParentId?: string;
|
|
@@ -120,12 +135,13 @@ export interface InitOptions {
|
|
|
120
135
|
portalURL?: string;
|
|
121
136
|
onGo1MessageReceived?: OnGo1MessageReceived;
|
|
122
137
|
additionalUserInfo?: AdditionalUserInfo;
|
|
123
|
-
themeInformation?:
|
|
138
|
+
themeInformation?: ThemeInformationPayload;
|
|
124
139
|
oneTimeToken?: string;
|
|
125
140
|
accessToken?: string;
|
|
126
141
|
integrationSystemId?: string;
|
|
127
142
|
presentingIntegrationSystemId?: string;
|
|
128
143
|
previewHost?: string;
|
|
129
144
|
disableFSOuterScript?: boolean;
|
|
145
|
+
persistJWT?: boolean;
|
|
130
146
|
}
|
|
131
147
|
export {};
|
package/dist/common/types.js
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.features = void 0;
|
|
4
4
|
exports.features = [
|
|
5
|
+
'activity-feed',
|
|
6
|
+
'ai-chat',
|
|
7
|
+
'admin-curation',
|
|
5
8
|
'auth-clients',
|
|
9
|
+
'auth-clients-public',
|
|
6
10
|
'go1-learn/library',
|
|
7
11
|
'go1-learn/my-learning',
|
|
8
12
|
'go1-learn/search',
|
|
9
|
-
'
|
|
10
|
-
'activity-feed',
|
|
11
|
-
'ai-chat',
|
|
13
|
+
'go1-learn/search-categories',
|
|
12
14
|
'bulk-upload',
|
|
13
15
|
'content-hub',
|
|
14
16
|
'content-retirement',
|
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.useGo1ContentView = useGo1ContentView;
|
|
4
|
-
const React = require("react");
|
|
37
|
+
const React = __importStar(require("react"));
|
|
5
38
|
const react_1 = require("react");
|
|
6
39
|
const constants_1 = require("../../common/constants");
|
|
7
40
|
const params_1 = require("../../common/params");
|
|
8
41
|
function useGo1ContentView(props) {
|
|
9
|
-
const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, integrationSystemId, presentingIntegrationSystemId, env = 'production', previewHost, disableFSOuterScript, accessToken, } = props;
|
|
42
|
+
const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, integrationSystemId, presentingIntegrationSystemId, env = 'production', previewHost, disableFSOuterScript, accessToken, persistJWT, } = props;
|
|
10
43
|
const iframeRef = (0, react_1.useRef)(null);
|
|
44
|
+
const warnedDeprecatedFeaturesRef = (0, react_1.useRef)(new Set());
|
|
11
45
|
let url = 'https://embedding.go1.com';
|
|
12
46
|
if (previewHost) {
|
|
13
47
|
url = previewHost;
|
|
@@ -18,6 +52,12 @@ function useGo1ContentView(props) {
|
|
|
18
52
|
if (!(0, params_1.isValidFeature)(feature)) {
|
|
19
53
|
throw new Error('Unsupported feature');
|
|
20
54
|
}
|
|
55
|
+
(0, react_1.useEffect)(() => {
|
|
56
|
+
if (warnedDeprecatedFeaturesRef.current.has(feature))
|
|
57
|
+
return;
|
|
58
|
+
(0, params_1.warnIfDeprecatedFeature)(feature);
|
|
59
|
+
warnedDeprecatedFeaturesRef.current.add(feature);
|
|
60
|
+
}, [feature]);
|
|
21
61
|
const sendMessageToGo1 = (0, react_1.useCallback)((message) => {
|
|
22
62
|
iframeRef.current?.contentWindow?.postMessage(message, url);
|
|
23
63
|
}, [url]);
|
|
@@ -32,9 +72,12 @@ function useGo1ContentView(props) {
|
|
|
32
72
|
if (accessToken) {
|
|
33
73
|
(0, params_1.addForceReauth)(iframeURL);
|
|
34
74
|
}
|
|
75
|
+
if (persistJWT !== undefined) {
|
|
76
|
+
(0, params_1.addPersistJWT)(iframeURL, persistJWT);
|
|
77
|
+
}
|
|
35
78
|
const iframeID = `go1-iframe-${feature}`;
|
|
36
79
|
return { iframeURL, iframeID };
|
|
37
|
-
}, [url, feature, portalURL, oneTimeToken, env, accessToken]);
|
|
80
|
+
}, [url, feature, portalURL, oneTimeToken, env, accessToken, persistJWT]);
|
|
38
81
|
const eventListenerInstance = (0, react_1.useCallback)((event) => {
|
|
39
82
|
const { _type, ...rest } = event.data;
|
|
40
83
|
if (_type === constants_1.GO1_MESSAGE) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@go1/go1-embedding-react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
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": [
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"@testing-library/jest-dom": "5.17.0",
|
|
21
21
|
"@testing-library/react": "14.0.0",
|
|
22
22
|
"@testing-library/user-event": "14.5.2",
|
|
23
|
-
"jest": "
|
|
23
|
+
"jest": "~29.7",
|
|
24
24
|
"react": "18.2.0",
|
|
25
|
-
"react-dom": "
|
|
26
|
-
"ts-jest": "^29.
|
|
27
|
-
"typescript": "
|
|
25
|
+
"react-dom": "18.2.0",
|
|
26
|
+
"ts-jest": "^29.4.4",
|
|
27
|
+
"typescript": "~5.9.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=16.8"
|