2.3.6 • Published 6 days ago

@annalib/anna-cognito-lib v2.3.6

Weekly downloads
-
License
-
Repository
-
Last release
6 days ago

AnnaCognitoLib

How to use the library in the consuming project ?

  1. Install the package from npm npm install @annalib/anna-cognito-lib (if not working use with --force flag).
  2. After installing the Library, you need to install it's peer dependancies. You can find the peer-dependecies in package.json file of library. Install all the peer depedencies with respective version number mentioned. this is important step otherwise library will throw error. ex: npm install ngx-toastr@13.2.1
  3. Also make sure to Install the Roboto font locally in assets folder of your consuming project.

If using the library locally (library from your system locally not npm),then in angular json file you have to set preserveSymlinks: true.

Adding Configuration

  1. import the AnnaCognitoLibModule module and pass the configuration to root AnnaCognitoLibModule.forRoot(appGenericConfig)
  2. configuration const should be:
       cognito : {
         userPoolId: "",
         clientId: "",
       },
       loginPageLogoImgUrl: ""
     } ```
  3. Keep the logo image in consuming project and provide the path for loginPageLogoImgUrl. ex: "assets/images/Anna-Logo.png" Note: for better loading of logo image, provide logo image in minified format.

Adding new custom function implemetation for any service file.

  1. Background Understanding - when we want to provide custom implemenetation - We write the custom implementation in a service file of consuming project and that is injected in the library. Injection is taken care by library itself. You just need to provide the definition and implementation of new function added.
  2. Ex: let's say we want to add a new function `onSuccessfulAuthenticatingUser() this function is called from library when user is succesfully authenticated and logged in. (Note: this function is already present in lib).
  3. Then In library add the new function declaration onSuccessfulAuthenticatingUser() in interface file IAuthService of auth-service.token.ts file.
  4. In consuming project, for onSuccessfulAuthenticatingUser() provide the implementation in the service file say AuthService of auth.service.ts.
  5. Then In consuming project, app.module.ts file add following in providers array. { provide: AUTH_SERVICE_TOKEN, useExisting: AuthService } i.e. your consuming project's existing AuthService will be injected in Library's auth-service file with the help of AUTH_SERVICE_TOKEN.
  6. Now you're good to go!

List of function implementation we need to provide in consuming project.

  1. onSuccessfulAuthenticatingUser() - provide the implementation of what happens when user is succefully logged in. (any API call or routing you need to provide).
  2. isUsernameAvailable() - in thie implementation call an backend API to find out if username is already present in Database or not. format of response should be {"isUsernameAvailable":true}. This is used in forgot-password page before calling forgot-password cognito sdk call, we need to check thorough backend db if the username is actually available.
  3. isLoggingIn - set this variable to false. this will stop the spinner on top on button. use case: after successful login i.e. when we are done with all API call we need to call post succesfull calling or when we have routed to home page.

How to make changes in library and build it

  1. Make the changes and Run ng build anna-cognito-lib to build the project.
  2. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build anna-cognito-lib, go to the dist folder cd dist/anna-cognito-lib and run npm publish.

2.3.6

6 days ago

2.3.5

6 days ago

2.2.50

14 days ago

2.2.49

21 days ago

2.3.4

1 month ago

2.3.3

1 month ago

2.2.48

1 month ago

2.2.46

1 month ago

2.2.47

1 month ago

2.3.2

1 month ago

2.2.44

1 month ago

2.2.45

1 month ago

2.2.43

2 months ago

2.3.0

2 months ago

2.3.1

2 months ago

2.2.42

2 months ago

2.2.41

2 months ago

2.2.40

2 months ago

2.2.39

2 months ago

2.2.38

2 months ago

2.2.37

2 months ago

2.2.35

3 months ago

2.2.36

3 months ago

2.2.34

3 months ago

2.2.33

3 months ago

2.2.32

3 months ago

2.2.31

3 months ago

2.2.30

3 months ago

2.2.28

3 months ago

2.2.27

3 months ago

2.2.26

3 months ago

2.2.24

3 months ago

2.2.25

3 months ago

2.2.22

3 months ago

2.2.21

3 months ago

2.2.20

3 months ago

2.2.18

3 months ago

2.2.15

3 months ago

2.2.16

3 months ago

2.2.14

3 months ago

2.2.19

3 months ago

2.2.13

3 months ago

2.2.11

3 months ago

2.2.12

3 months ago

2.2.10

4 months ago

2.2.7

4 months ago

2.2.6

4 months ago

2.2.9

4 months ago

2.2.8

4 months ago

2.2.5

4 months ago

2.1.3

4 months ago

2.1.2

4 months ago

2.2.1

4 months ago

2.2.0

4 months ago

2.2.2

4 months ago

2.2.4

4 months ago

2.1.1

4 months ago

2.1.0

4 months ago

2.0.12

4 months ago

2.0.11

4 months ago

2.0.10

5 months ago

2.0.9

5 months ago

2.0.8

5 months ago

2.0.7

5 months ago

2.0.6

5 months ago

2.0.5

5 months ago

2.0.4

6 months ago

1.4.6

6 months ago

2.0.3

6 months ago

2.0.2

6 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.4.9

6 months ago

1.4.8

6 months ago

1.4.7

6 months ago

1.4.5

6 months ago

1.4.4

7 months ago

1.2.0

9 months ago

1.4.3

7 months ago

1.4.2

7 months ago

1.4.1

8 months ago

1.4.0

9 months ago

1.3.4

9 months ago

1.3.3

9 months ago

1.1.5

10 months ago

1.3.2

9 months ago

1.1.4

10 months ago

1.3.1

9 months ago

1.1.3

10 months ago

1.3.0

9 months ago

1.1.2

10 months ago

1.0.6

11 months ago

1.1.1

11 months ago

1.1.0

12 months ago

1.0.5

12 months ago

1.0.4

1 year ago

1.0.3

1 year ago

0.6.10

1 year ago

0.6.11

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.6.9

1 year ago

0.6.8

1 year ago

0.6.7

1 year ago

0.6.6

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.5

1 year ago

0.5.6

1 year ago

0.6.4

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.4

1 year ago

0.4.5

1 year ago

0.5.3

2 years ago

0.5.5

1 year ago

0.5.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.3.0

2 years ago

0.2.7

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.4.1

2 years ago

0.3.2

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.4.2

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago