2.2.0 • Published 6 years ago

fp-ng-components v2.2.0

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
6 years ago

fast-pack-app-components

Available modules

  • FpAutoFocusModule
  • FpAlertModule
  • FpLoadingModule
  • FpProductNumberModule
  • FpAuthModule - use forRoot
  • FpEventModule - use forRoot
  • FpLocalStorageModule - use forRoot
  • FpNewRelicModule - use forRoot

The forRoot functions take the following variables:

FpLocalStorageModule.forRoot(prefix: string)

FpAuthModule.forRoot({
  userServiceAPI: string,
  parentURL: string,
  serviceName: string
})

FpEventModule.forRoot({
  eventServiceAPI: string,
  warehouseCode: string
})

FpNewRelicModule.forRoot({
  serviceName: string,
  appVersion: string
})

Inter Module Dependencies

The following modules use the modules in the 'Includes' column optionally. | Module | Includes | |--|--| |FpAuthModule| FpNewRelicModule, FpLoadingModule, FpAlertModule | |FpLoadingModeule | FpAlertModule |

Available Services

  • FpAlertService
  • FpAuthService
  • FpEventService
  • FpLoadingService
  • FpLocalStorageService
  • FpNewRelicService

Others

  • FpAuthGuard
  • fpAutoFocus
  • fpProductNumber
  • FpUserModel
  • FpRoleModel

Notes

To use the FpAlertService you have to add "../node_modules/ngx-toastr/toastr.css" to the styles section of angular-cli.json

FpAlertService

FunctionInputExplination
successmessage: string, options?: IndividualConfigDisplay success message.
errormessage: string, options?: IndividualConfigDisplay error message.
infomessage: string, options?: IndividualConfigDisplay info message.
warnmessage: string, options?: IndividualConfigDisplay warning message.
handleErrorerror: HttpErrorResponse | TimeoutError | anyThis is for handling most common errors that would get thrown from angular HttpErrors, and thrown errors.
clearN/AClears all notifications from page.
IndividualConfigInterfaceSee https://github.com/scttcper/ngx-toastr/blob/master/src/lib/toastr/toastr-config.ts for documentation.

FpAuthGuard

Only implements the canActivate function. In order to use the FpAuthGuard data.allowedRoles must exist in the Router module.

FpAuthService

FunctionInputExplination
isAuthenticatedN/ACalls the user service to check the bearer token saved inside the cookie.
hasRequiredRolerequiredRoles: string | string[]Checks the user for the roles passed in.

This has a user. That user is UserModel, and is the currently logged in user. If you need to get anything about the currently logged in user use this attribuite. The authInterceptor that will be added automatically and add the bearer token to all API calls.

fpAutoFocus

Make any input auto focus by adding the fpAutoFocus attribute to the input tag.

To not let people click outside of the input field do the following: <input [fpAutoFocus]="true">

FpEventService

FunctionInputExplination
createEventname: string, eventData?: anyThis will send any data to the event service.

FpLoadingService

FunctionInputExplination
startLoadingtimeoutDuration: number = 30 * 1000Overlay the loading screen. timeoutDuration is in seconds.
stopLoadingN/ARemove the overlay.
isLoadingN/ATest whether the overlay is set.
loadingHeartbeattimeoutDuration: number = 10 * 1000Keep the overlay running and place new timer. timeoutDuration is in seconds.

FpLocalStorageService

FunctionInputExplination
getkey: string, defaultItem: any = null)Returns a JSON object from the localStorage. Default is what is returned when there is nothing in localStorage.
setkey: string, value: anySet localStorage value.
removekey: stringRemove the key from localStorage.
clearRemove everything from localStorage set by this service.

FpNewRelicService

FunctionInputExplination
setUserUuiduuid: stringSet the user uuid before doing anything. This makes sure that New Relic will have the user for every error reported.
  • By including the FpNewRelicModule it will overwrite the standard Angular error handler with the new Relic error handler. Errors will be sent to New Relic.

FpVersionCheckerService

FunctionInputExplination
checkAppVersionconfig: objectStart listening for version change by checking package.json file by polling the file remotely.

fpProductNumber

Name of the pipe fpProductNumber

This pipe will take a upc and turn it into a more recognizable string by removing the check digit and showing only the last few characters. It aslo will handle a bad UPC or no UPC.

FpUserModel

AttributeTypeExplanation
uuidstringThe users database id.
rolesFpRoleModel[]The roles owned by the user.
emailstringUsers email.
firstNamestringUsers first name.
lastNamestringUsers last name.
usernamestringUsers username.
barcodeLoginbooleanWhether the user is allowed to log into the system with a barcode or not.
passwordstringUsers Password.
createdAtDateDate role was created.
updatedAtDateLast update time.
hasRole(roleSlug: string)=>{boolean}Pass in the role you want to check the user for. It will return true if the user has the role.

FpRoleModel

AttributeTypeExplanation
slugstringThe name of the role.
roleNamestringThe human readable role name.
createdAtDateDate role was created.
updatedAtDateLast update time.
updatedBystringWho updated the role last.
2.2.0

6 years ago

2.1.5

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

2.1.4

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

1.0.8

7 years ago

2.0.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago