Commit c6cb4523 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

Use solidify lib

parent df60d2f8
......@@ -57,6 +57,17 @@ N.B: Check and adapt accordingly your urls in case your context path is differen
`npm install`
## Install Solidify Lib
Pull the project Solidify-Frontend.
Do a `npm install` on the project `solidify-frontend`.
Do a `ng build` on the project `solidify-frontend`.
This command should generate in `dist` folder a folder called `solidify-frontend`.
Copy and paste this folder on the `node_modules` folder of `DLCM-Portal` project.
Do a `npm install` (should finish on error)
Your app is ready to start using the latest version of solidify-frontend lib.
NB : This is a temporary solution before using Nexus !
## Development server
Run `npm start` for a dev server. Navigate to `http://localhost:4200/`.
......@@ -119,10 +130,10 @@ You can also use mixin to define some behavior depending of size
### Types of components :
#### Concept
With solidify, we introduce a new convention of component :
- Views : Component routable. Can communicate with the store (dispatch actions and retrieve datas from store)
- Routables : Component routable. Can communicate with the store (dispatch actions and retrieve datas from store)
- Containers : Component non routable. Can communicate with the store (dispatch actions and retrieve datas from store)
- Components : Dumb component (just input / output, no connection with store)
- Dialog : Component embedded in a material modal. Can communicate with the store (dispatch actions and retrieve datas from store)
- Presentationals : Dumb component (just input / output, no connection with store)
- Dialogs : Component embedded in a material modal. Can communicate with the store (dispatch actions and retrieve datas from store)
#### Generation
You can use solidify schematics project to generate this types of component.
......@@ -130,9 +141,11 @@ Please refer to the `README.md` of the project `DLCM-Solidify-Tools/solidify-sch
You can use the command `npm run install-solidify-schematics` to install the `.tgz` file (the folder `DLCM-Solidify-Tools` should be a sibling folder of the current folder).
As reminder, the shortcut to generate this new type of components are :
ng g @schematics/solidify:view my-view
ng g @schematics/solidify:view
ng g @schematics/solidify:routable my-routable
ng g @schematics/solidify:routable
ng g @schematics/solidify:container my-container
ng g @schematics/solidify:container
ng g @schematics/solidify:presentational my-presentational
ng g @schematics/solidify:presentational
ng g @schematics/solidify:dialog my-dialog
ng g @schematics/solidify:dialog
......@@ -1025,9 +1025,9 @@
}
},
"@openapitools/openapi-generator-cli": {
"version": "0.0.14-4.0.0",
"resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-0.0.14-4.0.0.tgz",
"integrity": "sha512-7Qm8Fd7SLU7GrGk0kvQTmPbQ+FZ4vJfBHDGCrLvhMmsuhCcvHUXEd6Mxse4XY++c5Ah9iBrC1S63nZkyOp4AMw==",
"version": "0.0.16-4.0.0",
"resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-0.0.16-4.0.0.tgz",
"integrity": "sha512-UAmi8f+S+qeIQhd6z8c+Rjd6KnSQJkla5JLi8Uotr6GV3D0mPolZymTlfBDcYq+ZcZ3m2aAcRzkpjF9Bk3Hz8g==",
"dev": true
},
"@schematics/angular": {
......@@ -1480,7 +1480,6 @@
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
"dev": true,
"optional": true,
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
......@@ -2754,8 +2753,7 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
"dev": true,
"optional": true
"dev": true
},
"constant-case": {
"version": "2.0.0",
......@@ -3184,8 +3182,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
"dev": true,
"optional": true
"dev": true
},
"depd": {
"version": "1.1.2",
......@@ -4362,8 +4359,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
......@@ -4384,14 +4380,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -4406,20 +4400,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -4536,8 +4527,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
......@@ -4549,7 +4539,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -4564,7 +4553,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -4572,14 +4560,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -4598,7 +4584,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -4679,8 +4664,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
......@@ -4692,7 +4676,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -4778,8 +4761,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -4815,7 +4797,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -4835,7 +4816,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -4879,14 +4859,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},
......@@ -4895,7 +4873,6 @@
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz",
"integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"inherits": "~2.0.0",
......@@ -4908,7 +4885,6 @@
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"dev": true,
"optional": true,
"requires": {
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
......@@ -4946,8 +4922,7 @@
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
"integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=",
"dev": true,
"optional": true
"dev": true
},
"get-stream": {
"version": "3.0.0",
......@@ -5172,8 +5147,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
"dev": true,
"optional": true
"dev": true
},
"has-value": {
"version": "1.0.0",
......@@ -6600,7 +6574,6 @@
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"parse-json": "^2.2.0",
......@@ -6613,8 +6586,7 @@
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true,
"optional": true
"dev": true
}
}
},
......@@ -6907,8 +6879,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
"integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
"dev": true,
"optional": true
"dev": true
},
"map-visit": {
"version": "1.0.0",
......@@ -7551,7 +7522,6 @@
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
"dev": true,
"optional": true,
"requires": {
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
......@@ -8745,7 +8715,6 @@
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
"dev": true,
"optional": true,
"requires": {
"load-json-file": "^1.0.0",
"normalize-package-data": "^2.3.2",
......@@ -8757,7 +8726,6 @@
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"pify": "^2.0.0",
......@@ -8768,8 +8736,7 @@
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true,
"optional": true
"dev": true
}
}
},
......@@ -8778,7 +8745,6 @@
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
"dev": true,
"optional": true,
"requires": {
"find-up": "^1.0.0",
"read-pkg": "^1.0.0"
......@@ -8789,7 +8755,6 @@
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
"dev": true,
"optional": true,
"requires": {
"path-exists": "^2.0.0",
"pinkie-promise": "^2.0.0"
......@@ -8800,7 +8765,6 @@
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
"dev": true,
"optional": true,
"requires": {
"pinkie-promise": "^2.0.0"
}
......@@ -11530,7 +11494,6 @@
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
"dev": true,
"optional": true,
"requires": {
"string-width": "^1.0.2 || 2"
}
......
......@@ -41,7 +41,7 @@
"@ngxs/logger-plugin": "3.4.3",
"@ngxs/router-plugin": "3.4.3",
"@ngxs/store": "3.4.3",
"change-case": "^3.1.0",
"change-case": "3.1.0",
"core-js": "2.5.4",
"decimal.js": "10.2.0",
"flexboxgrid-sass": "8.0.5",
......@@ -53,7 +53,8 @@
"primeng": "7.1.3",
"rxjs": "6.3.3",
"tslib": "1.9.0",
"zone.js": "0.8.26"
"zone.js": "0.8.26",
"solidify-frontend": "0.0.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.13.0",
......
......@@ -3,8 +3,8 @@ import {RouterModule, Routes} from "@angular/router";
import {LoginPresentational} from "@app/components/presentationals/login/login.presentational";
import {PageNotFoundPresentational} from "@app/components/presentationals/page-not-found/page-not-found.presentational";
import {AuthGuardService} from "@app/shared/guards/auth-guard.service";
import {TRANSLATE} from "@app/core/utils/translate.util";
import {AppRoutesEnum} from "@app/shared/enums/routes.enum";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......
import {DOCUMENT} from "@angular/common";
import {Component, Inject, Renderer2} from "@angular/core";
import {Router, RouterStateSnapshot} from "@angular/router";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {LanguagesEnum} from "@app/shared/enums/languages.enum";
import {RoutesEnum, urlSeparator} from "@app/shared/enums/routes.enum";
import {StateEnum} from "@app/shared/enums/state.enum";
import {ThemeEnum} from "@app/shared/enums/theme.enum";
import {StateModel} from "@app/shared/models/state.model";
import {LocalStateModel} from "@app/shared/models/localStateModel";
import {ChangeAppLanguage, ChangeAppTheme, InitApplication, Logout} from "@app/stores/app.action";
import {TranslateService} from "@ngx-translate/core";
import {Navigate} from "@ngxs/router-plugin";
import {Select, Store} from "@ngxs/store";
import {Observable} from "rxjs";
import {tap} from "rxjs/internal/operators/tap";
import {OAuth2Service} from "solidify-frontend";
import {environment} from "../environments/environment";
import {LocalStateEnum} from "./shared/enums/localStateEnum";
@Component({
selector: "dlcm-root",
......@@ -27,11 +27,11 @@ export class AppComponent extends SharedAbstractPresentational {
currentModule: string;
logo: string;
@Select((state: StateModel) => state[StateEnum.router].state) urlStateObs: Observable<RouterStateSnapshot>;
@Select((state: StateModel) => state[StateEnum.application].appLanguage) appLanguageObs: Observable<LanguagesEnum>;
@Select((state: StateModel) => state[StateEnum.application].isLoggedIn) isLoggedObs: Observable<boolean>;
@Select((state: StateModel) => state[StateEnum.application].isApplicationInitialized) isApplicationInitializedObs: Observable<boolean>;
@Select((state: StateModel) => state[StateEnum.application].theme) themeObs: Observable<ThemeEnum>;
@Select((state: LocalStateModel) => state[LocalStateEnum.router].state) urlStateObs: Observable<RouterStateSnapshot>;
@Select((state: LocalStateModel) => state[LocalStateEnum.application].appLanguage) appLanguageObs: Observable<LanguagesEnum>;
@Select((state: LocalStateModel) => state[LocalStateEnum.application].isLoggedIn) isLoggedObs: Observable<boolean>;
@Select((state: LocalStateModel) => state[LocalStateEnum.application].isApplicationInitialized) isApplicationInitializedObs: Observable<boolean>;
@Select((state: LocalStateModel) => state[LocalStateEnum.application].theme) themeObs: Observable<ThemeEnum>;
constructor(private store: Store,
private oauthService: OAuth2Service,
......
import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule} from "@angular/common/http";
import {APP_INITIALIZER, ErrorHandler, NgModule} from "@angular/core";
import {MatPaginatorIntl} from "@angular/material";
import {MatPaginatorIntl, MatSnackBar} from "@angular/material";
import {BrowserModule} from "@angular/platform-browser";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {AppRoutingModule} from "@app/app-routing.module";
import {MainToolbarMobilePresentational} from "@app/components/presentationals/main-toolbar/main-toolbar-mobile/main-toolbar-mobile.presentational";
import {ThemeSelectorPresentational} from "@app/components/presentationals/theme-selector/theme-selector.presentational";
import {OAuthStorage} from "@app/core/auth/types";
import {AppConfigService} from "@app/core/config/app-config.service";
import {OAuth2Interceptor} from "@app/core/http/oauth2-interceptor.service";
import {CustomMatPaginatorIntlService} from "@app/core/services/custom-mat-paginator-intl.service";
import {GlobalErrorsHandlerService} from "@app/core/services/global-errors-handler.service";
import {ApiModule} from "@app/generated-api/api.module";
import {SharedModule} from "@app/shared/shared.module";
import {AppState} from "@app/stores/app.state";
......@@ -20,7 +15,8 @@ import {NgxsReduxDevtoolsPluginModule} from "@ngxs/devtools-plugin";
import {NgxsLoggerPluginModule} from "@ngxs/logger-plugin";
import {NgxsRouterPluginModule} from "@ngxs/router-plugin";
import {NgxsModule} from "@ngxs/store";
import {ENVIRONMENT, environment} from "../environments/environment";
import {AppConfigService, ENVIRONMENT, GlobalErrorsHandlerService, OAuth2Interceptor, OAuthStorage, SNACK_BAR} from "solidify-frontend";
import {environment} from "../environments/environment";
import {AppComponent} from "./app.component";
import {FooterPresentational} from "./components/presentationals/footer/footer.presentational";
import {HomePresentational} from "./components/presentationals/home/home.presentational";
......@@ -28,6 +24,7 @@ import {LanguageSelectorPresentational} from "./components/presentationals/langu
import {LoginPresentational} from "./components/presentationals/login/login.presentational";
import {MainToolbarDesktopPresentational} from "./components/presentationals/main-toolbar/main-toolbar-desktop/main-toolbar-desktop.presentational";
import {PageNotFoundPresentational} from "./components/presentationals/page-not-found/page-not-found.presentational";
import {CustomMatPaginatorIntlService} from "./shared/services/custom-mat-paginator-intl.service";
const components = [
AppComponent,
......@@ -99,7 +96,7 @@ export function createDefaultStorage(): Storage | null {
providers: [
{
provide: ENVIRONMENT,
useValue: environment
useValue: environment,
},
{
provide: APP_INITIALIZER,
......@@ -124,6 +121,10 @@ export function createDefaultStorage(): Storage | null {
provide: ErrorHandler,
useClass: GlobalErrorsHandlerService,
},
{
provide: SNACK_BAR,
useClass: MatSnackBar,
},
],
bootstrap: [AppComponent],
})
......
import {ChangeDetectionStrategy, Component, OnInit} from "@angular/core";
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
@Component({
......
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {OAuth2Service} from "solidify-frontend";
@Component({
selector: "dlcm-home-search-routable",
......
import {ChangeDetectionStrategy, Component, Input, Output} from "@angular/core";
import {ObservableUtil} from "@app/core/utils/observable.util";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {LanguagesEnum} from "@app/shared/enums/languages.enum";
import {BehaviorSubject, Observable} from "rxjs";
import {ObservableUtil} from "solidify-frontend";
@Component({
selector: "dlcm-language-selector",
......
import {ChangeDetectionStrategy, Component, OnInit} from "@angular/core";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {OAuth2Service} from "solidify-frontend";
@Component({
selector: "dlcm-login",
......
import {Input, Output} from "@angular/core";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {ObservableUtil} from "@app/core/utils/observable.util";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {LanguagesEnum} from "@app/shared/enums/languages.enum";
import {RoutesEnum} from "@app/shared/enums/routes.enum";
import {ThemeEnum} from "@app/shared/enums/theme.enum";
import {BehaviorSubject, Observable} from "rxjs";
import {environment} from "../../../../../environments/environment";
import {ObservableUtil, OAuth2Service} from "solidify-frontend";
export abstract class AbstractMainToolbarPresentational extends SharedAbstractPresentational {
@Input()
......
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {AbstractMainToolbarPresentational} from "@app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {OAuth2Service} from "solidify-frontend";
@Component({
selector: "dlcm-main-toolbar-desktop",
......
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {AbstractMainToolbarPresentational} from "@app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational";
import {OAuth2Service} from "@app/core/auth/oauth2.service";
import {OAuth2Service} from "solidify-frontend";
@Component({
selector: "dlcm-main-toolbar-mobile",
......
import {ChangeDetectionStrategy, Component, Input, Output, ViewEncapsulation} from "@angular/core";
import {ObservableUtil} from "@app/core/utils/observable.util";
import {StringUtil} from "@app/core/utils/string.util";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {ThemeEnum} from "@app/shared/enums/theme.enum";
import {BehaviorSubject, Observable} from "rxjs";
import {environment} from "../../../../environments/environment";
import {StringUtil, ObservableUtil} from "solidify-frontend";
@Component({
selector: "dlcm-theme-selector",
......
// see: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_.22Unicode_Problem.22
export function b64DecodeUnicode(str: string): string {
const base64 = str.replace(/\-/g, "+").replace(/\_/g, "/");
return decodeURIComponent(
atob(base64)
.split("")
// tslint:disable-next-line:only-arrow-functions
.map((c: string) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2))
.join("")
);
}
import {HttpParameterCodec} from "@angular/common/http";
/**
* This custom encoder allows charactes like +, % and / to be used in passwords
*/
export class WebHttpUrlEncodingCodec implements HttpParameterCodec {
encodeKey(k: string): string {
return encodeURIComponent(k);
}
encodeValue(v: string): string {
return encodeURIComponent(v);
}
decodeKey(k: string): string {