@go1/go1-embedding-react-sdk 0.5.0 → 0.7.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 CHANGED
@@ -51,12 +51,23 @@ export type SendMessageToGo1 = (message: Go1Message) => void;
51
51
 
52
52
  export type IframesMap = { [key: string]: HTMLIFrameElement };
53
53
 
54
- export interface AdditionalInfoMessage {
55
- additionalUserInfo?: AdditionalUserInfo;
56
- featureAttributes?: FeatureAttributes;
57
- themeInformation?: ThemeInformation;
54
+ export interface FeatureAttributeCommon {
55
+ shouldSuppressPreview?: boolean;
56
+ shouldSuppressOpeningPlayer?: boolean;
57
+ shouldShowSelectWelcomeModal?: boolean;
58
+ shouldSuppressBookmark?: boolean;
59
+ shouldSuppressPlaylistAdministration?: boolean;
60
+ shouldSuppressShareLink?: boolean;
61
+ shouldSuppressLibrary?: boolean;
62
+ shouldSuppressPlaylist?: boolean;
63
+ shouldSuppressCopyRightFooter?: boolean;
64
+ shouldSuppressPlay?: boolean;
65
+ shouldSuppressExport?: boolean;
66
+ contentScope?: 'subscription' | 'library';
67
+ shouldSuppressEndorsement?: boolean;
58
68
  }
59
69
 
70
+
60
71
  export interface ThemeInformation {
61
72
  /** Hex string, starting with a #. Example #0437F2 */
62
73
  accent: string;
@@ -84,19 +95,28 @@ export type Go1MessageType =
84
95
  | 'swap_out_open'
85
96
  | 'swap_out_close'
86
97
  | 'play_content'
87
- | 'go1pay_custom_data';
98
+ | 'library_content_added';
88
99
 
89
100
  export interface Go1Message {
90
101
  type: Go1MessageType;
91
102
  payload?: any;
92
103
  }
93
104
 
94
- export type Experience = 'manager' | 'learner' | 'role-aware'
95
105
 
96
- interface FeatureAttributeCommon {
106
+ export interface FeatureAttributeCommon {
97
107
  shouldSuppressPreview?: boolean;
98
- experience?: Experience; // Defaults to `manager`
108
+ shouldSuppressOpeningPlayer?: boolean;
109
+ shouldShowSelectWelcomeModal?: boolean;
110
+ shouldSuppressBookmark?: boolean;
111
+ shouldSuppressPlaylistAdministration?: boolean;
112
+ shouldSuppressShareLink?: boolean;
113
+ shouldSuppressLibrary?: boolean;
114
+ shouldSuppressPlaylist?: boolean;
115
+ shouldSuppressCopyRightFooter?: boolean;
116
+ shouldSuppressPlay?: boolean;
117
+ shouldSuppressExport?: boolean;
99
118
  contentScope?: 'subscription' | 'library';
119
+ shouldSuppressEndorsement?: boolean;
100
120
  }
101
121
 
102
122
  /**
@@ -130,11 +150,6 @@ export interface FeatureAttributesWallet extends FeatureAttributeCommon {
130
150
  oneClickBuyUrl?: string;
131
151
  }
132
152
 
133
- export interface FeatureAttributesLearnerSearch extends FeatureAttributeCommon {
134
- isGo1MobileApp?: boolean;
135
- experience?: 'learner';
136
- }
137
-
138
153
  export interface FeatureAttributesLibrary extends FeatureAttributeCommon, FeatureAttributesRetirement {
139
154
  libraryEmptyStateDescription?: string;
140
155
  shouldShowLibraryTabs?: boolean;
@@ -154,7 +169,13 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
154
169
 
155
170
  export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {}
156
171
 
157
- export interface FeatureAttributesGo1LearnSearch extends FeatureAttributeCommon {
172
+ export interface FeatureAttributesProspect {
173
+ isProspectExperience?: boolean;
174
+ }
175
+
176
+ export interface FeatureAttributesGo1LearnSearch
177
+ extends FeatureAttributeCommon,
178
+ FeatureAttributesProspect {
158
179
  searchTerm?: string; // If the embedding search feature includes a search term, the app will initialize with the pre-filled search term.
159
180
  searchProvider?: string; // If the embedding search feature includes a search provider, the app will initialize with the pre-filled search provider.
160
181
  }
@@ -184,13 +205,8 @@ export type FeatureType =
184
205
  | 'ai-chat'
185
206
  | 'content-hub'
186
207
  | 'preview'
187
- | 'library'
188
208
  | 'search'
189
- | 'wallet'
190
- | 'content-retirement'
191
- | 'my-playlists'
192
- | 'activity-feed'
193
- | 'my-learning';
209
+ | 'admin-curation';
194
210
 
195
211
  export interface InitOptions {
196
212
  /** Mandatory identifier for the embedded feature */
@@ -209,12 +225,16 @@ export interface InitOptions {
209
225
  additionalUserInfo?: AdditionalUserInfo;
210
226
  /** Optional UI configuration */
211
227
  themeInformation?: ThemeInformation;
212
- /** Optional token that is used to pre-authorize the user without them needing to log in */
228
+ /** Optional one time token that is used to pre-authorize the user without them needing to log in */
213
229
  oneTimeToken?: string;
230
+ /** Optional OAuth token that is used to pre-authorize the user without them needing to log in */
231
+ accessToken?: string;
214
232
  /** Optional Id that let us know which integration system users are coming from (will be required in the future)*/
215
233
  integrationSystemId?: string;
216
234
  /** Optional Id that let us know which integration system users are coming from, if using an intermediary system to embed */
217
235
  presentingIntegrationSystemId?: string;
236
+ /** Optional flag to control JWT persistence in browser storage, if false, JWT will not be stored in localStorage, sessionStorage, or cookies */
237
+ persistJWT?: boolean;
218
238
  }
219
239
  ```
220
240
 
@@ -245,8 +265,9 @@ const options = useMemo<ContentViewProps>(() => {
245
265
  feature: 'ai-chat',
246
266
  portalURL: 'learning-incorporated-usa.mygo1.com',
247
267
  featureAttributes: {
248
- experience: 'manager',
268
+ shouldSuppressShareLink: true,
249
269
  },
270
+ persistJWT: false,
250
271
  onGo1MessageReceived,
251
272
  additionalUserInfo: {
252
273
  jobTitle: 'Sales development representative',
@@ -268,7 +289,7 @@ const { sendMessageToGo1, ContentView } = useGo1ContentView(options);
268
289
 
269
290
  Send a message to the Go1 content view. Useful to control the user experience when an event starts on your website and the Go1 content view needs to be aware of it (and potentially perform other actions - this is `feature` dependent.)
270
291
 
271
- A currently supported message is `update_experience`, this will update the experience Feature Attribute. An example of its usage is below.
292
+ An example of its usage is below.
272
293
 
273
294
  ```typescript
274
295
  function sendMessageToGo1(message: Go1Message): void;
@@ -278,8 +299,8 @@ function sendMessageToGo1(message: Go1Message): void;
278
299
 
279
300
  ```typescript
280
301
  const message = {
281
- type: 'update_experience',
282
- payload: { experience: 'learner' },
302
+ type: 'logout',
303
+ payload: {},
283
304
  };
284
305
  sendMessageToGo1(message);
285
306
  ```
@@ -317,7 +338,8 @@ Item has been added to the library
317
338
  {
318
339
  "type": "library_content_added",
319
340
  "payload": {
320
- "id": "3510462"
341
+ "id": "3510462",
342
+ "type": "lo"
321
343
  }
322
344
  }
323
345
  ```
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @go1/go1-embedding-react-sdk
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add shouldSuppressExport feature attribute
8
+
9
+ ## 0.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - - Adding isProspectExperience to featureAttributes. Allowing partners to use the Prospect experience
14
+
3
15
  ## 0.5.0
4
16
 
5
17
  ### Minor Changes
package/dist/README.md CHANGED
@@ -51,12 +51,23 @@ export type SendMessageToGo1 = (message: Go1Message) => void;
51
51
 
52
52
  export type IframesMap = { [key: string]: HTMLIFrameElement };
53
53
 
54
- export interface AdditionalInfoMessage {
55
- additionalUserInfo?: AdditionalUserInfo;
56
- featureAttributes?: FeatureAttributes;
57
- themeInformation?: ThemeInformation;
54
+ export interface FeatureAttributeCommon {
55
+ shouldSuppressPreview?: boolean;
56
+ shouldSuppressOpeningPlayer?: boolean;
57
+ shouldShowSelectWelcomeModal?: boolean;
58
+ shouldSuppressBookmark?: boolean;
59
+ shouldSuppressPlaylistAdministration?: boolean;
60
+ shouldSuppressShareLink?: boolean;
61
+ shouldSuppressLibrary?: boolean;
62
+ shouldSuppressPlaylist?: boolean;
63
+ shouldSuppressCopyRightFooter?: boolean;
64
+ shouldSuppressPlay?: boolean;
65
+ shouldSuppressExport?: boolean;
66
+ contentScope?: 'subscription' | 'library';
67
+ shouldSuppressEndorsement?: boolean;
58
68
  }
59
69
 
70
+
60
71
  export interface ThemeInformation {
61
72
  /** Hex string, starting with a #. Example #0437F2 */
62
73
  accent: string;
@@ -84,19 +95,28 @@ export type Go1MessageType =
84
95
  | 'swap_out_open'
85
96
  | 'swap_out_close'
86
97
  | 'play_content'
87
- | 'go1pay_custom_data';
98
+ | 'library_content_added';
88
99
 
89
100
  export interface Go1Message {
90
101
  type: Go1MessageType;
91
102
  payload?: any;
92
103
  }
93
104
 
94
- export type Experience = 'manager' | 'learner' | 'role-aware'
95
105
 
96
- interface FeatureAttributeCommon {
106
+ export interface FeatureAttributeCommon {
97
107
  shouldSuppressPreview?: boolean;
98
- experience?: Experience; // Defaults to `manager`
108
+ shouldSuppressOpeningPlayer?: boolean;
109
+ shouldShowSelectWelcomeModal?: boolean;
110
+ shouldSuppressBookmark?: boolean;
111
+ shouldSuppressPlaylistAdministration?: boolean;
112
+ shouldSuppressShareLink?: boolean;
113
+ shouldSuppressLibrary?: boolean;
114
+ shouldSuppressPlaylist?: boolean;
115
+ shouldSuppressCopyRightFooter?: boolean;
116
+ shouldSuppressPlay?: boolean;
117
+ shouldSuppressExport?: boolean;
99
118
  contentScope?: 'subscription' | 'library';
119
+ shouldSuppressEndorsement?: boolean;
100
120
  }
101
121
 
102
122
  /**
@@ -130,11 +150,6 @@ export interface FeatureAttributesWallet extends FeatureAttributeCommon {
130
150
  oneClickBuyUrl?: string;
131
151
  }
132
152
 
133
- export interface FeatureAttributesLearnerSearch extends FeatureAttributeCommon {
134
- isGo1MobileApp?: boolean;
135
- experience?: 'learner';
136
- }
137
-
138
153
  export interface FeatureAttributesLibrary extends FeatureAttributeCommon, FeatureAttributesRetirement {
139
154
  libraryEmptyStateDescription?: string;
140
155
  shouldShowLibraryTabs?: boolean;
@@ -154,7 +169,13 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
154
169
 
155
170
  export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {}
156
171
 
157
- export interface FeatureAttributesGo1LearnSearch extends FeatureAttributeCommon {
172
+ export interface FeatureAttributesProspect {
173
+ isProspectExperience?: boolean;
174
+ }
175
+
176
+ export interface FeatureAttributesGo1LearnSearch
177
+ extends FeatureAttributeCommon,
178
+ FeatureAttributesProspect {
158
179
  searchTerm?: string; // If the embedding search feature includes a search term, the app will initialize with the pre-filled search term.
159
180
  searchProvider?: string; // If the embedding search feature includes a search provider, the app will initialize with the pre-filled search provider.
160
181
  }
@@ -184,13 +205,8 @@ export type FeatureType =
184
205
  | 'ai-chat'
185
206
  | 'content-hub'
186
207
  | 'preview'
187
- | 'library'
188
208
  | 'search'
189
- | 'wallet'
190
- | 'content-retirement'
191
- | 'my-playlists'
192
- | 'activity-feed'
193
- | 'my-learning';
209
+ | 'admin-curation';
194
210
 
195
211
  export interface InitOptions {
196
212
  /** Mandatory identifier for the embedded feature */
@@ -209,12 +225,16 @@ export interface InitOptions {
209
225
  additionalUserInfo?: AdditionalUserInfo;
210
226
  /** Optional UI configuration */
211
227
  themeInformation?: ThemeInformation;
212
- /** Optional token that is used to pre-authorize the user without them needing to log in */
228
+ /** Optional one time token that is used to pre-authorize the user without them needing to log in */
213
229
  oneTimeToken?: string;
230
+ /** Optional OAuth token that is used to pre-authorize the user without them needing to log in */
231
+ accessToken?: string;
214
232
  /** Optional Id that let us know which integration system users are coming from (will be required in the future)*/
215
233
  integrationSystemId?: string;
216
234
  /** Optional Id that let us know which integration system users are coming from, if using an intermediary system to embed */
217
235
  presentingIntegrationSystemId?: string;
236
+ /** Optional flag to control JWT persistence in browser storage, if false, JWT will not be stored in localStorage, sessionStorage, or cookies */
237
+ persistJWT?: boolean;
218
238
  }
219
239
  ```
220
240
 
@@ -245,8 +265,9 @@ const options = useMemo<ContentViewProps>(() => {
245
265
  feature: 'ai-chat',
246
266
  portalURL: 'learning-incorporated-usa.mygo1.com',
247
267
  featureAttributes: {
248
- experience: 'manager',
268
+ shouldSuppressShareLink: true,
249
269
  },
270
+ persistJWT: false,
250
271
  onGo1MessageReceived,
251
272
  additionalUserInfo: {
252
273
  jobTitle: 'Sales development representative',
@@ -268,7 +289,7 @@ const { sendMessageToGo1, ContentView } = useGo1ContentView(options);
268
289
 
269
290
  Send a message to the Go1 content view. Useful to control the user experience when an event starts on your website and the Go1 content view needs to be aware of it (and potentially perform other actions - this is `feature` dependent.)
270
291
 
271
- A currently supported message is `update_experience`, this will update the experience Feature Attribute. An example of its usage is below.
292
+ An example of its usage is below.
272
293
 
273
294
  ```typescript
274
295
  function sendMessageToGo1(message: Go1Message): void;
@@ -278,8 +299,8 @@ function sendMessageToGo1(message: Go1Message): void;
278
299
 
279
300
  ```typescript
280
301
  const message = {
281
- type: 'update_experience',
282
- payload: { experience: 'learner' },
302
+ type: 'logout',
303
+ payload: {},
283
304
  };
284
305
  sendMessageToGo1(message);
285
306
  ```
@@ -317,7 +338,8 @@ Item has been added to the library
317
338
  {
318
339
  "type": "library_content_added",
319
340
  "payload": {
320
- "id": "3510462"
341
+ "id": "3510462",
342
+ "type": "lo"
321
343
  }
322
344
  }
323
345
  ```
@@ -2,5 +2,6 @@ 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;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addPortalURL = addPortalURL;
4
4
  exports.addOneTimeToken = addOneTimeToken;
5
5
  exports.addForceReauth = addForceReauth;
6
+ exports.addPersistJWT = addPersistJWT;
6
7
  exports.isValidOTT = isValidOTT;
7
8
  exports.isValidFeature = isValidFeature;
8
9
  const types_1 = require("./types");
@@ -29,6 +30,9 @@ function addOneTimeToken(url, oneTimeToken) {
29
30
  function addForceReauth(url) {
30
31
  url.searchParams.append('force_reauth', 'true');
31
32
  }
33
+ function addPersistJWT(url, persistJWT) {
34
+ url.searchParams.append('persist_jwt', persistJWT.toString());
35
+ }
32
36
  function isValidOTT(oneTimeToken) {
33
37
  const validOTT = /^[A-Za-z0-9]+$/;
34
38
  return validOTT.test(oneTimeToken);
@@ -38,8 +38,15 @@ export interface FeatureAttributeCommon {
38
38
  shouldShowSelectWelcomeModal?: boolean;
39
39
  shouldSuppressBookmark?: boolean;
40
40
  shouldSuppressPlaylistAdministration?: boolean;
41
+ shouldSuppressShareLink?: boolean;
42
+ shouldSuppressLibrary?: boolean;
43
+ shouldSuppressPlaylist?: boolean;
44
+ shouldSuppressCopyRightFooter?: boolean;
45
+ shouldSuppressPlay?: boolean;
46
+ shouldSuppressExport?: boolean;
41
47
  experience?: ExternalExperience;
42
48
  contentScope?: 'subscription' | 'library';
49
+ shouldSuppressEndorsement?: boolean;
43
50
  }
44
51
  interface FeatureAttributesPreviewCommon extends FeatureAttributeCommon {
45
52
  startWith1Player?: boolean;
@@ -91,7 +98,10 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
91
98
  export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {
92
99
  selectingTab?: 'saved' | 'in-progress' | 'assigned' | 'completed';
93
100
  }
94
- export interface FeatureAttributesGo1LearnSearch extends FeatureAttributeCommon {
101
+ export interface FeatureAttributesProspect {
102
+ isProspectExperience?: boolean;
103
+ }
104
+ export interface FeatureAttributesGo1LearnSearch extends FeatureAttributeCommon, FeatureAttributesProspect {
95
105
  searchTerm?: string;
96
106
  searchProvider?: string;
97
107
  }
@@ -106,7 +116,7 @@ export type FeatureAttributes = FeatureAttributesAIChat | FeatureAttributesPrevi
106
116
  export interface AdditionalUserInfo {
107
117
  jobTitle: string;
108
118
  }
109
- export declare const features: readonly ["auth-clients", "go1-learn/learner-content", "go1-learn/library", "go1-learn/my-learning", "go1-learn/search", "insights", "activity-feed", "ai-chat", "bulk-upload", "content-hub", "content-retirement", "content-status", "home", "library", "my-learning", "my-playlists", "partner-sales", "preview", "recommendations", "search", "wallet"];
119
+ export declare const features: readonly ["auth-clients", "go1-learn/library", "go1-learn/my-learning", "go1-learn/search", "admin-curation", "activity-feed", "ai-chat", "bulk-upload", "content-hub", "content-retirement", "content-status", "library", "my-learning", "my-playlists", "partner-sales", "preview", "recommendations", "search", "wallet"];
110
120
  export type FeatureType = (typeof features)[number];
111
121
  export interface InitOptions {
112
122
  feature: FeatureType;
@@ -123,5 +133,6 @@ export interface InitOptions {
123
133
  presentingIntegrationSystemId?: string;
124
134
  previewHost?: string;
125
135
  disableFSOuterScript?: boolean;
136
+ persistJWT?: boolean;
126
137
  }
127
138
  export {};
@@ -3,18 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.features = void 0;
4
4
  exports.features = [
5
5
  'auth-clients',
6
- 'go1-learn/learner-content',
7
6
  'go1-learn/library',
8
7
  'go1-learn/my-learning',
9
8
  'go1-learn/search',
10
- 'insights',
9
+ 'admin-curation',
11
10
  'activity-feed',
12
11
  'ai-chat',
13
12
  'bulk-upload',
14
13
  'content-hub',
15
14
  'content-retirement',
16
15
  'content-status',
17
- 'home',
18
16
  'library',
19
17
  'my-learning',
20
18
  'my-playlists',
@@ -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, presentingIntegrationSystemId, env = 'production', previewHost, disableFSOuterScript, accessToken, } = props;
9
+ const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, integrationSystemId, presentingIntegrationSystemId, env = 'production', previewHost, disableFSOuterScript, accessToken, persistJWT, } = props;
10
10
  const iframeRef = (0, react_1.useRef)(null);
11
11
  let url = 'https://embedding.go1.com';
12
12
  if (previewHost) {
@@ -32,9 +32,12 @@ function useGo1ContentView(props) {
32
32
  if (accessToken) {
33
33
  (0, params_1.addForceReauth)(iframeURL);
34
34
  }
35
+ if (persistJWT !== undefined) {
36
+ (0, params_1.addPersistJWT)(iframeURL, persistJWT);
37
+ }
35
38
  const iframeID = `go1-iframe-${feature}`;
36
39
  return { iframeURL, iframeID };
37
- }, [url, feature, portalURL, oneTimeToken, env, accessToken]);
40
+ }, [url, feature, portalURL, oneTimeToken, env, accessToken, persistJWT]);
38
41
  const eventListenerInstance = (0, react_1.useCallback)((event) => {
39
42
  const { _type, ...rest } = event.data;
40
43
  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.5.0",
3
+ "version": "0.7.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": [
@@ -15,9 +15,6 @@
15
15
  "@go1/go1-embedding-js-sdk",
16
16
  "Go1"
17
17
  ],
18
- "scripts": {
19
- "test": "jest"
20
- },
21
18
  "license": "ISC",
22
19
  "devDependencies": {
23
20
  "@testing-library/jest-dom": "5.17.0",
@@ -31,5 +28,8 @@
31
28
  },
32
29
  "peerDependencies": {
33
30
  "react": ">=16.8"
31
+ },
32
+ "scripts": {
33
+ "test": "jest"
34
34
  }
35
- }
35
+ }