2.5.1 • Published 5 months ago

@zanichelli/idp-login-topbar v2.5.1

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
5 months ago

IDP Login Component

Overview


Release Notes {#changelog}

v2.5.1

  • Updated @zanichelli/zanichelli-appswitcher dependency to version 3.0.3. Apps for university users are also managed in this version.

v2.4.2

  • fix z-link css class due to @zanichelli/albe-web-components dependency upgrade

v2.4.1

  • Updated @zanichelli/zanichelli-appswitcher dependency to version 2.0.3. This version includes zanichelli-apps-section component.
  • Updated @zanichelli/albe-web-components dependency to version >=17.0.0

v2.3.0

  • Added notificationsEnabled prop to show notifications button - default true

v2.1.0

  • Set googleLogin prop default to true
  • Added xapiInfo optional prop to enable XAPI tracking events - see docs for more details

v2.0.4

  • Updated @zanichelli/albe-web-components dependency to version >=14.3.0

v2.0.0

  • Added googleLogin prop for Google login

v1.4.21

  • Updated @zanichelli/zanichelli-appswitcher dependency to version ^1.1.3
  • Added tooltip to appswitcher button

v1.4.20

  • Updated css variables

v1.4.19

  • Added iss to LoginSuccess and UserLoaded events

v1.4.18

  • Updated @zanichelli/zanichelli-appswitcher dependency to version ^1.1.3
  • Updated @zanichelli/albe-web-components dependency to version ^9.0.0
  • Improved accessibility

v1.4.14

  • Added getUserInfo method
  • Added teachingGroups to LoginSuccess and UserLoaded events

v1.4.13

  • Updated @zanichelli/albe-web-components dependency to version ^7.1.1
  • Improved accessibility

v1.4.0

  • Introduces the zanichelli-appswitcher component. IMPORTANT: in order to use this component, you need at least version 6.5.1 of albe-web-components. To setup your idp-login component to show the appswitcher, you'll need to:
    • to show the appswitcher icon, add the attribute show-app-switcher and set it to true
    • to define the host that will identify your website, add the attribute current-host and set it to your host (eg. "my.zanichelli.it")

v1.3.0

  • New IdpLoginInline component

v1.2.0

  • Added regBackUrl prop for signUp url

v1.1.0

  • Updated @zanichelli/albe-web-components dependency to version ^4.0.2 || ^5 || ^6

v1.0.10

  • Updated "Attiva opera" URL
  • Fixed font import console error

v1.0.9

  • Fixed invalid myZanichelli URL used by showMyzLink

v1.0.8

  • Added showMyzLink prop - non braking change, default set to false

v1.0.6

  • Updated @zanichelli/albe-web-components dependency to version ^4

v1.0.5

  • Added userLoadedFail event

Installation {#installation}

Download the package running this command:

yarn add @zanichelli/idp-login-topbar

or import with jsDelivr or Unpkg in your html:

// using jsDelivr
<script type="module" src="https://cdn.jsdelivr.net/npm/@zanichelli/idp-login-topbar/dist/wc/idp-login-topbar/idp-login-topbar.esm.js"></script>

// using unpkg
<script type="module" src="https://unpkg.com/@zanichelli/idp-login-topbar"></script>

Albe Web Components dependency

This component requires Albe Web Components Library. You can install Albe via NPM

yarn add @zanichelli/albe-web-components

or include it in your app with script tag:

// using jsDelivr
<script type="module" src="https://cdn.jsdelivr.net/npm/@zanichelli/albe-web-components/dist/web-components-library/web-components-library.esm.js"></script>

// using unpkg
<script type="module" src="https://unpkg.com/@zanichelli/albe-web-components/dist/web-components-library/web-components-library.esm.js"></script>

You need to include stylesheet too:

// using jsDelivr
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@zanichelli/albe-web-components/www/build/web-components-library.css" />

// using unpkg
<link type="text/css" rel="stylesheet" href="https://unpkg.com/@zanichelli/albe-web-components/www/build/web-components-library.css" />

Usage {#usage}

Usage custom element

import { defineCustomElements as defineAlbeComponents, applyPolyfills } from '@zanichelli/albe-web-components/loader';
import { defineCustomElements as defineIdpTopbar } from '@zanichelli/idp-login-topbar/dist/wc/loader';

applyPolyfills().then(() => {
  defineAlbeComponents(window);
  defineIdpTopbar(window);
});

return <idp-login></idp-login>;

Usage React Bindings

import { IdpLogin } from '@zanichelli/idp-login-topbar/dist/react';

return <IdpLogin />;

Please refer to component documentation to see properties and events list

Components {#components}

Topbar with modal login form {#idp-login}

Custom element: <idp-login /> React binding: <IdpLogin />

Properties

Refer to section Enums and Types for "type" column details.

PropertyAttributeDescriptionTypeDefault
actionItemsaction-itemscustom actions menu list optionalMenuItem[] \| string[]
contentMaxWidthcontent-max-widthmaximum width of topbar contentnumberundefined
currentHostcurrent-hostcurrent host - enables handling last visited apps in appswitcherstringwindow.location.host
envenvenv: dev, test, prodenvType.dev \| envType.prod \| envType.testenvType.test
fixedModalfixed-modalfix the modal to open state optionalbooleanfalse
googleLogingoogle-logindisplay google login buttonbooleantrue
logologoshow MyZanichelli logobooleantrue
menuItemsmenu-itemscustom dropdown menu items list optionalMenuItem[] \| string[]
modalOpenmodal-openmodal state trigger optionalbooleanfalse
regBackUrlreg-back-urlback Url for registration step optionalstringundefined
showAppSwitchershow-app-switcheradd app-switcherbooleantrue
showMyzLinkshow-myz-linkshow myZanichelli linkbooleanfalse
themethemetheme variant, default 'dark'ThemeVariant.DARK \| ThemeVariant.LIGHTThemeVariant.DARK
xapiInfoxapi-infoinfo to send xapi tracking eventsstring \| { environment: "prod" \| "test"; platform: string; homepage: string; lrsCredentials: { username: string; password: string; }; }undefined
zainoDigitaleTargetUrlzaino-digitale-target-urlredirect url after ZD login optionalstringundefined
Events
EventDescriptionType
loginFailedemitted on login failCustomEvent<IdpException>
loginSuccessemitted on login successCustomEvent<{ token: string; teachingGroups?: TeachingGroup[]; }>
logoutFailedemitted on logout failCustomEvent<any>
logoutSuccessemitted on logout successCustomEvent<{ json: string; }>
userLoadedemitted when user data has loadedCustomEvent<{ e: User; teachingGroups?: TeachingGroup[]; }>
userLoadedFailemitted when user data loading has failed (user is not logged)CustomEvent<{ statusCode: number; }>
Methods
getUserInfo() => Promise<undefined | null | UserLoaded>

return current user data

Returns

Type: Promise<UserLoaded>

logout() => Promise<void>

logout current user

Returns

Type: Promise<void>

Inline login form {#idp-login-inline}

Custom element: <idp-login-inline /> React binding: <IdpLoginInline />

Properties

Refer to section Enums and Types for "type" column details.

PropertyAttributeDescriptionTypeDefault
envenvenv: dev, test, prodenvType.dev \| envType.prod \| envType.testenvType.test
googleLogingoogle-logindisplay google login buttonbooleantrue
regBackUrlreg-back-urlback Url for registration stepstringundefined
signupButtonsignup-buttondisplay signup buttonbooleantrue
xapiInfoxapi-infoinfo to send xapi tracking eventsstring \| { environment: "prod" \| "test"; platform: string; homepage: string; lrsCredentials: { username: string; password: string; }; }undefined
zainoDigitaleTargetUrlzaino-digitale-target-urlredirect url after ZD loginstringundefined
Events
EventDescriptionType
loginFailedemitted on login failCustomEvent<IdpException>
loginSuccessemitted on login successCustomEvent<{ token: string; teachingGroups?: TeachingGroup[]; }>

Enums and Types {#enums}

enum envType {
  dev = 'dev',
  test = 'test',
  prod = 'prod',
}

enum ThemeVariant {
  DARK = "dark",
  LIGHT = "light",
}

type MenuItem = {
  id: string;
  label: string;
  link?: string;
  icon?: string;
  target?: string;
  subMenu?: MenuItem[];
}

type LoginSuccess = {
  token: string;
}

type LogoutSuccess = {
  json: string;
}

type UserLoaded = {
  e: User;
  teachingGroups?: TeachingGroup[];
};

type TeachingGroup = {
  id: number;
  code: string;
  descr: string;
};

type User = {
  id: number;
  email: string;
  username: string;
  surname: string;
  name: string;
  myz: MyzUserData;
  roles: UserRole[];
  is_employee: boolean;
  is_myzanichelli: boolean;
  is_verified: boolean;
  last_activity_at: string;
  created_at: string;
  updated_at: string;
  attributes: [];
  iss: string;
};

type MyzUserData = {
  id: number;
  isConfirmed: boolean;
  isApproved: boolean;
  isAuthorizedByParent: boolean;
};

type XapiInfo = {
  environment: 'test' | 'prod';
  platform: string;
  homepage: string;
  lrsCredentials: {
    username: string;
    password: string;
  };
};

Support {#support}

if you encounter CORS issues, make sure Zanichelli IDP allows requests from your Origin

2.5.1-RC

5 months ago

2.5.1

5 months ago

2.5.1-RC2

5 months ago

2.5.0

5 months ago

2.4.4-RC4

5 months ago

2.4.4-RC2

5 months ago

2.4.4-RC1

5 months ago

2.4.3

6 months ago

2.4.2

7 months ago

2.4.1

7 months ago

2.4.1-RC

7 months ago

2.4.1-RC-1

7 months ago

2.4.1-RC-2

7 months ago

2.4.0

7 months ago

2.3.1-RC14

7 months ago

2.3.1-RC15

7 months ago

2.3.1-RC13

7 months ago

2.3.1-RC12

7 months ago

2.3.1-RC11

8 months ago

2.3.1-RC10

8 months ago

2.3.1-RC9

8 months ago

2.3.1-RC3

8 months ago

2.3.1-RC8

8 months ago

2.3.1-RC7

8 months ago

2.3.1-RC6

8 months ago

2.3.1-RC5

8 months ago

2.3.1-RC4

8 months ago

2.3.1-RC2

9 months ago

2.3.0

11 months ago

2.3.1-rc

10 months ago

2.2.0-RC1

11 months ago

2.2.0-RC3

11 months ago

2.2.0-RC2

11 months ago

2.2.0-beta.1

11 months ago

2.2.5-RC

11 months ago

2.2.0-alpha.2

11 months ago

2.2.0-alpha.1

11 months ago

2.2.3-RC

12 months ago

2.2.4-RC

12 months ago

2.2.1-RC

1 year ago

2.2.2-RC

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.4

1 year ago

2.1.0-RC2

1 year ago

2.1.0-RC1

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

2.0.0-RC11

1 year ago

1.4.21

1 year ago

2.0.0-RC10

1 year ago

2.0.0-RC9

1 year ago

1.4.20

1 year ago

2.0.0-RC8

2 years ago

1.4.19

2 years ago

1.4.18

2 years ago

2.0.0-RC1

2 years ago

2.0.0-RC2

2 years ago

2.0.0-RC3

2 years ago

2.0.0-RC4

2 years ago

2.0.0-RC5

2 years ago

2.0.0-RC6

2 years ago

2.0.0-RC7

2 years ago

1.4.17

2 years ago

1.4.14-rc

2 years ago

1.4.16-RC2

2 years ago

1.4.16-RC1

2 years ago

1.4.14-RC5

2 years ago

1.4.14-RC4

2 years ago

1.4.14-RC3

2 years ago

1.4.14-RC2

2 years ago

1.4.13

2 years ago

1.4.15

2 years ago

1.4.14

2 years ago

1.4.16

2 years ago

1.4.13-RC-adv

2 years ago

1.2.0

3 years ago

1.4.6-RC8

2 years ago

1.0.5-rc.2

3 years ago

1.4.6-RC7

2 years ago

1.4.6-RC6

2 years ago

1.0.5-rc.1

3 years ago

1.4.4-RC1

3 years ago

1.1.0

3 years ago

1.4.6-rc-2

2 years ago

1.4.6-rc-3

2 years ago

1.4.6-rc-4

2 years ago

1.4.6-rc-5

2 years ago

1.4.4-rc

3 years ago

1.1.0-RC2

3 years ago

1.1.0-RC3

3 years ago

1.1.0-RC1

3 years ago

1.4.11

2 years ago

1.4.10

2 years ago

1.4.12

2 years ago

1.4.6

2 years ago

1.0.9

3 years ago

1.4.5-rc

2 years ago

1.4.4

3 years ago

1.0.8

3 years ago

1.4.3

3 years ago

1.0.7

3 years ago

1.4.2

3 years ago

1.0.6

3 years ago

1.4.1

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.3.0-RC1

3 years ago

1.3.0-RC2

3 years ago

1.4.12-rc1

2 years ago

1.5.0-RC1

2 years ago

1.5.0-RC3

2 years ago

1.5.0-RC2

2 years ago

1.4.10-RC

2 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0-a1

3 years ago

1.2.0-a2

3 years ago

1.4.6-rc

2 years ago

1.5.0-RC4

2 years ago

1.3.0-peerTest

3 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.0.10

3 years ago

1.0.2

3 years ago

0.0.13-rc

4 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.3

3 years ago

1.0.3-zte-4472

3 years ago

0.0.13-rc5

4 years ago

0.0.13-rc4

4 years ago

0.0.13-rc6

4 years ago

0.0.13-rc1

4 years ago

0.0.13-rc2

4 years ago

0.0.14-rc5

4 years ago

0.0.14-rc4

4 years ago

0.0.14-rc3

4 years ago

0.0.14-rc2

4 years ago

0.0.14-rc1

4 years ago

0.0.15-rc7

4 years ago

0.0.15-rc6

4 years ago

0.0.15-rc1

4 years ago

0.0.15-rc3

4 years ago

0.0.15-rc2

4 years ago

0.0.15-rc5

4 years ago

0.0.15-rc4

4 years ago

0.0.15

3 years ago

0.0.16-rc

3 years ago

1.0.2-rc3

3 years ago

1.0.2-rc2

3 years ago

0.0.11

4 years ago

1.0.2-rc1

3 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.10

4 years ago

0.0.9-rc1

4 years ago

0.0.8-rc2

4 years ago

0.0.8-rc1

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.8-alpha

4 years ago

0.0.6-rc1

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5-oauth

4 years ago

0.0.5-rc1

4 years ago

0.0.5-rc

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago