@topconsultnpm/sdkui-react 6.21.0-dev2.32 → 6.21.0-dev2.33

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.
@@ -31,6 +31,14 @@ export declare const cultureIDsDataSource: {
31
31
  value: CultureIDs;
32
32
  display: string;
33
33
  }[];
34
+ export interface ITMLoginDefaultValues {
35
+ endpoint: string;
36
+ archiveId?: string;
37
+ authenticationMode?: AuthenticationModes;
38
+ username?: string;
39
+ behalfUsername?: string;
40
+ domain?: string;
41
+ }
34
42
  interface ITMLoginFormProps {
35
43
  isConnector?: boolean;
36
44
  sdInput?: SessionDescriptor;
@@ -39,6 +47,7 @@ interface ITMLoginFormProps {
39
47
  onLogged: (tmSession: ITopMediaSession) => void;
40
48
  onChangeLanguage?: (e: CultureIDs) => void;
41
49
  cultureID?: CultureIDs;
50
+ defaultLoginValues?: ITMLoginDefaultValues;
42
51
  }
43
52
  declare const TMLoginForm: React.FunctionComponent<ITMLoginFormProps>;
44
53
  export default TMLoginForm;
@@ -106,6 +106,7 @@ const TMLoginForm = (props) => {
106
106
  const passwordRef = useRef(null);
107
107
  const usernameOnBehalfOfRef = useRef(null);
108
108
  const passwordOnBehalfOfRRef = useRef(null);
109
+ const defaultLoginAppliedRef = useRef(false);
109
110
  const [loginStep, setLoginStep] = useState(1);
110
111
  const [tmServer, setTmServer] = useState();
111
112
  const [tmSession, setTmSession] = useState();
@@ -201,6 +202,23 @@ const TMLoginForm = (props) => {
201
202
  setUsername(props.sdInput.userName);
202
203
  }
203
204
  }, []);
205
+ useEffect(() => {
206
+ if (!props.defaultLoginValues)
207
+ return;
208
+ const matchingEndpoint = props.endpoints.find(ep => ep.URL === props.defaultLoginValues.endpoint);
209
+ if (!matchingEndpoint)
210
+ return;
211
+ setEndpoint(matchingEndpoint);
212
+ if (props.defaultLoginValues.archiveId)
213
+ setManualArchiveID(props.defaultLoginValues.archiveId);
214
+ setAuthMode(props.defaultLoginValues.authenticationMode ?? AuthenticationModes.TopMedia);
215
+ if (props.defaultLoginValues.username)
216
+ setUsername(props.defaultLoginValues.username);
217
+ if (props.defaultLoginValues.domain)
218
+ setAuthDomain(props.defaultLoginValues.domain);
219
+ if (props.defaultLoginValues.behalfUsername)
220
+ setUsernameOnBehalf(props.defaultLoginValues.behalfUsername);
221
+ }, [props.defaultLoginValues, props.endpoints]);
204
222
  useEffect(() => {
205
223
  if (!hasSingleOption)
206
224
  return;
@@ -216,6 +234,9 @@ const TMLoginForm = (props) => {
216
234
  setDcmtArchive(undefined);
217
235
  }, [isSuccess]);
218
236
  useEffect(() => {
237
+ // Skip default endpoint
238
+ if (props.defaultLoginValues && props.endpoints.some(ep => ep.URL === props.defaultLoginValues.endpoint))
239
+ return;
219
240
  let preferredRapidAccess = localRa?.find(ar => ar.preferred === true);
220
241
  if (preferredRapidAccess) {
221
242
  handleRapidAccessSelection(preferredRapidAccess);
@@ -240,6 +261,29 @@ const TMLoginForm = (props) => {
240
261
  useEffect(() => {
241
262
  getArchivesAsync();
242
263
  }, [tmSession]);
264
+ // Default values and step management
265
+ useEffect(() => {
266
+ if (!props.defaultLoginValues || !props.defaultLoginValues.archiveId || defaultLoginAppliedRef.current || !tmSession || !tmSession.TopMediaServer?.BaseAddress)
267
+ return;
268
+ defaultLoginAppliedRef.current = true;
269
+ const archiveId = props.defaultLoginValues.archiveId;
270
+ const validateAndAdvance = async () => {
271
+ try {
272
+ TMSpinner.show({ description: '' });
273
+ const archiveEngine = tmSession.NewArchiveEngine();
274
+ const result = await archiveEngine.RetrieveAsync(archiveId);
275
+ setDcmtArchive(result);
276
+ setLoginStep(2);
277
+ }
278
+ catch (e) {
279
+ TMExceptionBoxManager.show({ exception: e });
280
+ }
281
+ finally {
282
+ TMSpinner.hide();
283
+ }
284
+ };
285
+ validateAndAdvance();
286
+ }, [tmSession, props.defaultLoginValues]);
243
287
  useEffect(() => {
244
288
  if (!saveLoginEnable || !dcmtArchive)
245
289
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev2.32",
3
+ "version": "6.21.0-dev2.33",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",