@go1/go1-embedding-react-sdk 0.7.0 → 0.9.1

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
@@ -68,9 +68,16 @@ export interface FeatureAttributeCommon {
68
68
  }
69
69
 
70
70
 
71
+ export type ThemeMode = 'light' | 'dark';
72
+
73
+ export interface ThemeModeInformation {
74
+ mode: ThemeMode;
75
+ }
76
+
71
77
  export interface ThemeInformation {
72
78
  /** Hex string, starting with a #. Example #0437F2 */
73
79
  accent: string;
80
+ mode?: ThemeMode;
74
81
  }
75
82
 
76
83
  export type Go1MessageType =
@@ -167,8 +174,6 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
167
174
  playlistId?: number; // If embedding my-playlists feature with playlistId, the app will initialise with the specified playlistId page.
168
175
  }
169
176
 
170
- export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {}
171
-
172
177
  export interface FeatureAttributesProspect {
173
178
  isProspectExperience?: boolean;
174
179
  }
@@ -194,7 +199,6 @@ export type FeatureAttributes =
194
199
  | FeatureAttributesLibrary
195
200
  | FeatureAttributesSearch
196
201
  | FeatureAttributesMyPlaylists
197
- | FeatureAttributesMyLearning
198
202
  | FeatureAttributesRecommendations;
199
203
 
200
204
  export interface AdditionalUserInfo {
@@ -203,6 +207,7 @@ export interface AdditionalUserInfo {
203
207
 
204
208
  export type FeatureType =
205
209
  | 'ai-chat'
210
+ /** @deprecated Use 'admin-curation' instead. */
206
211
  | 'content-hub'
207
212
  | 'preview'
208
213
  | 'search'
@@ -224,7 +229,7 @@ export interface InitOptions {
224
229
  /** Optional end user information that can enhance the context and provide a better experience. No PII is needed, please do not send any. */
225
230
  additionalUserInfo?: AdditionalUserInfo;
226
231
  /** Optional UI configuration */
227
- themeInformation?: ThemeInformation;
232
+ themeInformation?: ThemeInformation | ThemeModeInformation;
228
233
  /** Optional one time token that is used to pre-authorize the user without them needing to log in */
229
234
  oneTimeToken?: string;
230
235
  /** Optional OAuth token that is used to pre-authorize the user without them needing to log in */
@@ -238,6 +243,10 @@ export interface InitOptions {
238
243
  }
239
244
  ```
240
245
 
246
+ `content-hub` is deprecated and will be removed in a future major release. Use
247
+ `admin-curation` for new integrations. Existing `content-hub` requests are
248
+ redirected server-side to `admin-curation` during the deprecation window.
249
+
241
250
  ## Function: `useGo1ContentView`
242
251
 
243
252
  A react hook that will return
@@ -274,6 +283,7 @@ const options = useMemo<ContentViewProps>(() => {
274
283
  },
275
284
  themeInformation: {
276
285
  accent: '#0437F2',
286
+ mode: 'dark',
277
287
  },
278
288
  oneTimeToken: '907687a6e81a458190fe4c21f05ee689',
279
289
  integrationSystemId: 'int_nI7rPykBRm0C',
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @go1/go1-embedding-react-sdk
2
2
 
3
+ ## 0.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Update the SDK documentation to remove the legacy standalone My Learning attributes
8
+
9
+ ## 0.9.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Deprecate the content-hub feature in favour of admin-curation.
14
+
15
+ ## 0.8.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Allow embedded apps to receive light or dark mode via themeInformation.mode
20
+
3
21
  ## 0.7.0
4
22
 
5
23
  ### Minor Changes
package/dist/README.md CHANGED
@@ -68,9 +68,16 @@ export interface FeatureAttributeCommon {
68
68
  }
69
69
 
70
70
 
71
+ export type ThemeMode = 'light' | 'dark';
72
+
73
+ export interface ThemeModeInformation {
74
+ mode: ThemeMode;
75
+ }
76
+
71
77
  export interface ThemeInformation {
72
78
  /** Hex string, starting with a #. Example #0437F2 */
73
79
  accent: string;
80
+ mode?: ThemeMode;
74
81
  }
75
82
 
76
83
  export type Go1MessageType =
@@ -167,8 +174,6 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
167
174
  playlistId?: number; // If embedding my-playlists feature with playlistId, the app will initialise with the specified playlistId page.
168
175
  }
169
176
 
170
- export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {}
171
-
172
177
  export interface FeatureAttributesProspect {
173
178
  isProspectExperience?: boolean;
174
179
  }
@@ -194,7 +199,6 @@ export type FeatureAttributes =
194
199
  | FeatureAttributesLibrary
195
200
  | FeatureAttributesSearch
196
201
  | FeatureAttributesMyPlaylists
197
- | FeatureAttributesMyLearning
198
202
  | FeatureAttributesRecommendations;
199
203
 
200
204
  export interface AdditionalUserInfo {
@@ -203,6 +207,7 @@ export interface AdditionalUserInfo {
203
207
 
204
208
  export type FeatureType =
205
209
  | 'ai-chat'
210
+ /** @deprecated Use 'admin-curation' instead. */
206
211
  | 'content-hub'
207
212
  | 'preview'
208
213
  | 'search'
@@ -224,7 +229,7 @@ export interface InitOptions {
224
229
  /** Optional end user information that can enhance the context and provide a better experience. No PII is needed, please do not send any. */
225
230
  additionalUserInfo?: AdditionalUserInfo;
226
231
  /** Optional UI configuration */
227
- themeInformation?: ThemeInformation;
232
+ themeInformation?: ThemeInformation | ThemeModeInformation;
228
233
  /** Optional one time token that is used to pre-authorize the user without them needing to log in */
229
234
  oneTimeToken?: string;
230
235
  /** Optional OAuth token that is used to pre-authorize the user without them needing to log in */
@@ -238,6 +243,10 @@ export interface InitOptions {
238
243
  }
239
244
  ```
240
245
 
246
+ `content-hub` is deprecated and will be removed in a future major release. Use
247
+ `admin-curation` for new integrations. Existing `content-hub` requests are
248
+ redirected server-side to `admin-curation` during the deprecation window.
249
+
241
250
  ## Function: `useGo1ContentView`
242
251
 
243
252
  A react hook that will return
@@ -274,6 +283,7 @@ const options = useMemo<ContentViewProps>(() => {
274
283
  },
275
284
  themeInformation: {
276
285
  accent: '#0437F2',
286
+ mode: 'dark',
277
287
  },
278
288
  oneTimeToken: '907687a6e81a458190fe4c21f05ee689',
279
289
  integrationSystemId: 'int_nI7rPykBRm0C',
@@ -5,3 +5,5 @@ export declare function addForceReauth(url: URL): void;
5
5
  export declare function addPersistJWT(url: URL, persistJWT: boolean): void;
6
6
  export declare function isValidOTT(oneTimeToken: string): boolean;
7
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;
@@ -1,11 +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;
6
7
  exports.addPersistJWT = addPersistJWT;
7
8
  exports.isValidOTT = isValidOTT;
8
9
  exports.isValidFeature = isValidFeature;
10
+ exports.warnIfDeprecatedFeature = warnIfDeprecatedFeature;
9
11
  const types_1 = require("./types");
10
12
  function addPortalURL(url, portalURL, env = 'production') {
11
13
  let validPortalURL = /^(?=.{1,255}$)([a-zA-Z0-9-]+\.)+mygo1\.com$/;
@@ -40,3 +42,12 @@ function isValidOTT(oneTimeToken) {
40
42
  function isValidFeature(feature) {
41
43
  return types_1.features.includes(feature);
42
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
+ }
@@ -7,19 +7,26 @@ export interface AdditionalInfoMessage {
7
7
  feature: FeatureType;
8
8
  additionalUserInfo?: AdditionalUserInfo;
9
9
  featureAttributes?: FeatureAttributes;
10
- themeInformation?: ThemeInformation | ThemeInformationElysium;
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 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_upload_close' | 'contact_go1_navigation' | 'library_content_added';
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: {
@@ -47,6 +54,7 @@ export interface FeatureAttributeCommon {
47
54
  experience?: ExternalExperience;
48
55
  contentScope?: 'subscription' | 'library';
49
56
  shouldSuppressEndorsement?: boolean;
57
+ shouldSuppressAssign?: boolean;
50
58
  }
51
59
  interface FeatureAttributesPreviewCommon extends FeatureAttributeCommon {
52
60
  startWith1Player?: boolean;
@@ -96,6 +104,7 @@ export interface FeatureAttributesMyPlaylists extends FeatureAttributesPreviewCo
96
104
  playlistId?: number;
97
105
  }
98
106
  export interface FeatureAttributesMyLearning extends FeatureAttributeCommon {
107
+ contentId?: number;
99
108
  selectingTab?: 'saved' | 'in-progress' | 'assigned' | 'completed';
100
109
  }
101
110
  export interface FeatureAttributesProspect {
@@ -116,8 +125,8 @@ export type FeatureAttributes = FeatureAttributesAIChat | FeatureAttributesPrevi
116
125
  export interface AdditionalUserInfo {
117
126
  jobTitle: string;
118
127
  }
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"];
120
- 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-playlists", "partner-sales", "preview", "recommendations", "search", "wallet"];
129
+ export type FeatureType = Exclude<(typeof features)[number], 'content-hub'> | 'content-hub';
121
130
  export interface InitOptions {
122
131
  feature: FeatureType;
123
132
  iframeParentId?: string;
@@ -126,7 +135,7 @@ export interface InitOptions {
126
135
  portalURL?: string;
127
136
  onGo1MessageReceived?: OnGo1MessageReceived;
128
137
  additionalUserInfo?: AdditionalUserInfo;
129
- themeInformation?: ThemeInformation;
138
+ themeInformation?: ThemeInformationPayload;
130
139
  oneTimeToken?: string;
131
140
  accessToken?: string;
132
141
  integrationSystemId?: string;
@@ -2,19 +2,20 @@
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
- 'admin-curation',
10
- 'activity-feed',
11
- 'ai-chat',
13
+ 'go1-learn/search-categories',
12
14
  'bulk-upload',
13
15
  'content-hub',
14
16
  'content-retirement',
15
17
  'content-status',
16
18
  'library',
17
- 'my-learning',
18
19
  'my-playlists',
19
20
  'partner-sales',
20
21
  'preview',
@@ -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
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]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go1/go1-embedding-react-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.9.1",
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": "^29.6.2",
23
+ "jest": "~29.7",
24
24
  "react": "18.2.0",
25
- "react-dom": "^18.2.0",
26
- "ts-jest": "^29.1.1",
27
- "typescript": "^5.8.3"
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"