@nakedcreativity/membrs-angular-helper 0.0.21 → 0.0.23

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.
Files changed (33) hide show
  1. package/esm2020/lib/auth.interceptor.mjs +25 -0
  2. package/esm2020/lib/config.interface.mjs +2 -0
  3. package/esm2020/lib/config.service.mjs +7 -0
  4. package/esm2020/lib/membrs.module.mjs +146 -0
  5. package/esm2020/lib/membrs.service.mjs +101 -0
  6. package/esm2020/lib/router.config.mjs +19 -0
  7. package/esm2020/lib/token.mjs +5 -0
  8. package/esm2020/nakedcreativity-membrs-angular-helper.mjs +5 -0
  9. package/esm2020/public-api.mjs +5 -0
  10. package/fesm2015/nakedcreativity-membrs-angular-helper.mjs +297 -0
  11. package/fesm2015/nakedcreativity-membrs-angular-helper.mjs.map +1 -0
  12. package/{fesm2015/nakedcreativity-membrs-angular-helper.js → fesm2020/nakedcreativity-membrs-angular-helper.mjs} +85 -49
  13. package/fesm2020/nakedcreativity-membrs-angular-helper.mjs.map +1 -0
  14. package/lib/auth.interceptor.d.ts +3 -0
  15. package/lib/membrs.module.d.ts +7 -0
  16. package/lib/membrs.service.d.ts +3 -0
  17. package/nakedcreativity-membrs-angular-helper.d.ts +1 -2
  18. package/package.json +24 -12
  19. package/bundles/nakedcreativity-membrs-angular-helper.umd.js +0 -296
  20. package/bundles/nakedcreativity-membrs-angular-helper.umd.js.map +0 -1
  21. package/bundles/nakedcreativity-membrs-angular-helper.umd.min.js +0 -2
  22. package/bundles/nakedcreativity-membrs-angular-helper.umd.min.js.map +0 -1
  23. package/esm2015/lib/auth.interceptor.js +0 -22
  24. package/esm2015/lib/config.interface.js +0 -1
  25. package/esm2015/lib/config.service.js +0 -7
  26. package/esm2015/lib/membrs.module.js +0 -114
  27. package/esm2015/lib/membrs.service.js +0 -102
  28. package/esm2015/lib/router.config.js +0 -19
  29. package/esm2015/lib/token.js +0 -5
  30. package/esm2015/nakedcreativity-membrs-angular-helper.js +0 -6
  31. package/esm2015/public-api.js +0 -5
  32. package/fesm2015/nakedcreativity-membrs-angular-helper.js.map +0 -1
  33. package/nakedcreativity-membrs-angular-helper.metadata.json +0 -1
@@ -0,0 +1,297 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
3
+ import { JwtHelperService, JwtModule } from '@auth0/angular-jwt';
4
+ import { BehaviorSubject } from 'rxjs';
5
+ import * as i1 from '@angular/common/http';
6
+ import { HttpClientModule } from '@angular/common/http';
7
+ import { CommonModule } from '@angular/common';
8
+ import { Transition, UIRouter, UIRouterModule } from '@uirouter/angular';
9
+ import { finalize } from 'rxjs/operators';
10
+
11
+ /**
12
+ * This is not a real service, but it looks like it from the outside.
13
+ * It's just an InjectionTToken used to import the config object, provided from the outside
14
+ */
15
+ const MembrsConfigService = new InjectionToken("MembrsConfig");
16
+
17
+ const jwtService = new JwtHelperService();
18
+ class MembrsService {
19
+ constructor(http, config) {
20
+ this.http = http;
21
+ this.config = config;
22
+ this._lsKey = 'membrs';
23
+ this._loggedInObservable = new BehaviorSubject(false);
24
+ // console.log('membrs constructor')
25
+ // if the token exists in local storage, retrieve it back to the service
26
+ if (localStorage.getItem(this._lsKey)) {
27
+ this.token = localStorage.getItem(this._lsKey);
28
+ }
29
+ }
30
+ reissue(token) {
31
+ return new Promise((resolve, reject) => {
32
+ if (!token && !this._token) {
33
+ reject('NOT_LOGGED_IN');
34
+ }
35
+ if (token)
36
+ this.token = token;
37
+ // check stored token has not expired, or needs to be reissued soon
38
+ var reissueIn = this._decoded.exp - Math.floor(Date.now() / 1000);
39
+ // token has expired
40
+ if (reissueIn < 0) {
41
+ reject('NOT_LOGGED_IN');
42
+ }
43
+ // token expiring soon
44
+ if (reissueIn < 300) {
45
+ this.http.post(this.config.apiProtocol + this.config.api + '/token/' + this._token, {}).subscribe((response) => {
46
+ if (response.token) {
47
+ this.token = response.token;
48
+ this._loggedInObservable.next(true);
49
+ resolve(this._token);
50
+ }
51
+ else {
52
+ reject('NOT_LOGGED_IN');
53
+ }
54
+ }, error => {
55
+ reject('NOT_LOGGED_IN');
56
+ });
57
+ }
58
+ else {
59
+ this._loggedInObservable.next(true);
60
+ resolve(this._token);
61
+ }
62
+ });
63
+ }
64
+ set token(token) {
65
+ this._token = token;
66
+ localStorage.setItem(this._lsKey, token);
67
+ this._decoded = jwtService.decodeToken(this._token);
68
+ }
69
+ deleteToken() {
70
+ localStorage.removeItem(this._lsKey);
71
+ }
72
+ isLoggedIn() {
73
+ return this.token ? true : false;
74
+ }
75
+ get profile() {
76
+ return this._decoded;
77
+ }
78
+ get token() {
79
+ return this._token;
80
+ }
81
+ get admin() {
82
+ return this.profile.permission == 1;
83
+ }
84
+ get isLoggedInObservable() {
85
+ return this._loggedInObservable;
86
+ }
87
+ logout() {
88
+ return new Promise((resolve, reject) => {
89
+ this.http.delete(this.config.apiProtocol + this.config.api + '/token/' + this._token).subscribe((response) => {
90
+ this._token = null;
91
+ localStorage.removeItem(this._lsKey);
92
+ resolve(this.config.login);
93
+ //this.router.stateService.go('dashboard')
94
+ }, error => {
95
+ reject(error);
96
+ });
97
+ });
98
+ }
99
+ }
100
+ MembrsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsService, deps: [{ token: i1.HttpClient }, { token: MembrsConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
101
+ MembrsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsService, providedIn: 'root' });
102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsService, decorators: [{
103
+ type: Injectable,
104
+ args: [{
105
+ providedIn: 'root'
106
+ }]
107
+ }], ctorParameters: function () {
108
+ return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
109
+ type: Inject,
110
+ args: [MembrsConfigService]
111
+ }] }];
112
+ } });
113
+
114
+ function routerConfigFn(router, injector) {
115
+ const transitionService = router.transitionService;
116
+ const stateService = router.stateService;
117
+ const config = injector.get(MembrsConfigService);
118
+ const membrsService = injector.get(MembrsService);
119
+ stateService.defaultErrorHandler(function (error) {
120
+ console.log('Default error handler - Membrs Angular Helper');
121
+ console.log(error);
122
+ if (error.detail == 'NOT_LOGGED_IN') {
123
+ membrsService.deleteToken();
124
+ window.location.href = config.login;
125
+ }
126
+ if (error.detail == 'INSUFFICIENT_PERMISSIONS')
127
+ stateService.go(config.defaultState);
128
+ });
129
+ }
130
+
131
+ function retrieveToken() {
132
+ // console.log('retrieve from ls')
133
+ return localStorage.getItem('membrs');
134
+ }
135
+
136
+ const validateResolve = {
137
+ token: 'reissue',
138
+ deps: [Transition, UIRouter, MembrsService, MembrsConfigService],
139
+ resolveFn: validateResolveFn
140
+ };
141
+ const reissueResolve = {
142
+ token: 'reissue',
143
+ deps: [Transition, UIRouter, MembrsService, MembrsConfigService],
144
+ resolveFn: reissueResolveFn
145
+ };
146
+ const reissueState = {
147
+ name: 'reissue',
148
+ url: '/reissue?token',
149
+ views: {},
150
+ resolve: [
151
+ reissueResolve
152
+ ]
153
+ };
154
+ function reissueResolveFn(transition, router, membrsService, membrsConfig) {
155
+ //console.log(membrsService)
156
+ return new Promise((resolve, reject) => {
157
+ // console.log('reissue promise resolve')
158
+ // console.log(transition.params().token)
159
+ membrsService.reissue(transition.params().token).then((response) => {
160
+ //console.log('redirect to default state')
161
+ router.stateService.go(membrsConfig.defaultState, {}, { inherit: false });
162
+ reject();
163
+ }).catch(error => {
164
+ //console.log('error in reissue resolve')
165
+ //console.log(error)
166
+ //window.location.href = environment.login
167
+ reject(error);
168
+ });
169
+ });
170
+ }
171
+ function validateResolveFn(transition, router, membrsService, membrsConfig) {
172
+ //console.log(membrsService)
173
+ return new Promise((resolve, reject) => {
174
+ // console.log('validate promise resolve')
175
+ membrsService.reissue().then((response) => {
176
+ resolve(null);
177
+ }).catch(error => {
178
+ // console.log('error in validateResolveFn')
179
+ // console.log(error)
180
+ window.location.href = membrsConfig.login;
181
+ reject(error);
182
+ });
183
+ });
184
+ }
185
+ function jwtOptionsFactory(config) {
186
+ // console.log('jwt options factory')
187
+ // console.log(config)
188
+ return {
189
+ tokenGetter: () => {
190
+ console.log('token getter', localStorage.getItem('membrs'));
191
+ return localStorage.getItem('membrs');
192
+ },
193
+ allowedDomains: [config.api]
194
+ };
195
+ }
196
+ /** The top level state(s) */
197
+ const STATES = [
198
+ reissueState
199
+ ];
200
+ class MembrsModule {
201
+ static forRoot(config) {
202
+ const moduleProviders = UIRouterModule.forChild({
203
+ states: STATES,
204
+ config: routerConfigFn
205
+ }).providers;
206
+ moduleProviders.push(JwtModule.forRoot({
207
+ config: {
208
+ tokenGetter: retrieveToken,
209
+ allowedDomains: []
210
+ }
211
+ }).providers);
212
+ moduleProviders.push(MembrsService);
213
+ moduleProviders.push({ provide: MembrsConfigService, useValue: config });
214
+ return {
215
+ ngModule: MembrsModule,
216
+ providers: moduleProviders //[{provide: MembrsConfigService,useValue: config}]
217
+ };
218
+ }
219
+ }
220
+ MembrsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
221
+ MembrsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, imports: [CommonModule,
222
+ HttpClientModule,
223
+ JwtModule
224
+ // JwtModule.forRoot({
225
+ // config: {
226
+ // tokenGetter: retrieveToken
227
+ // }
228
+ // })
229
+ // UIRouterModule.forChild({
230
+ // states: STATES,
231
+ // config: routerConfigFn,
232
+ // }),
233
+ // JwtModule.forRoot({})
234
+ ] });
235
+ MembrsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, imports: [[
236
+ CommonModule,
237
+ HttpClientModule,
238
+ JwtModule
239
+ // JwtModule.forRoot({
240
+ // config: {
241
+ // tokenGetter: retrieveToken
242
+ // }
243
+ // })
244
+ // UIRouterModule.forChild({
245
+ // states: STATES,
246
+ // config: routerConfigFn,
247
+ // }),
248
+ // JwtModule.forRoot({})
249
+ ]] });
250
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, decorators: [{
251
+ type: NgModule,
252
+ args: [{
253
+ imports: [
254
+ CommonModule,
255
+ HttpClientModule,
256
+ JwtModule
257
+ // JwtModule.forRoot({
258
+ // config: {
259
+ // tokenGetter: retrieveToken
260
+ // }
261
+ // })
262
+ // UIRouterModule.forChild({
263
+ // states: STATES,
264
+ // config: routerConfigFn,
265
+ // }),
266
+ // JwtModule.forRoot({})
267
+ ]
268
+ }]
269
+ }] });
270
+
271
+ class TokenInterceptor {
272
+ constructor() { }
273
+ intercept(request, next) {
274
+ console.log('intercept request', localStorage.getItem('membrs'));
275
+ //this.busyService.busy()
276
+ request = request.clone({
277
+ setHeaders: {
278
+ Authorization: localStorage.getItem('membrs')
279
+ }
280
+ });
281
+ return next.handle(request).pipe(finalize(() => {
282
+ //this.busyService.finished()
283
+ }));
284
+ }
285
+ }
286
+ TokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TokenInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
287
+ TokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TokenInterceptor });
288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TokenInterceptor, decorators: [{
289
+ type: Injectable
290
+ }], ctorParameters: function () { return []; } });
291
+
292
+ /**
293
+ * Generated bundle index. Do not edit.
294
+ */
295
+
296
+ export { MembrsModule, MembrsService, STATES, TokenInterceptor, jwtOptionsFactory, reissueResolve, reissueResolveFn, reissueState, retrieveToken, validateResolve, validateResolveFn };
297
+ //# sourceMappingURL=nakedcreativity-membrs-angular-helper.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nakedcreativity-membrs-angular-helper.mjs","sources":["../../../projects/membrs/src/lib/config.service.ts","../../../projects/membrs/src/lib/membrs.service.ts","../../../projects/membrs/src/lib/router.config.ts","../../../projects/membrs/src/lib/token.ts","../../../projects/membrs/src/lib/membrs.module.ts","../../../projects/membrs/src/lib/auth.interceptor.ts","../../../projects/membrs/src/nakedcreativity-membrs-angular-helper.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { MembrsConfig } from './config.interface';\n\n/**\n * This is not a real service, but it looks like it from the outside.\n * It's just an InjectionTToken used to import the config object, provided from the outside\n */\nexport const MembrsConfigService = new InjectionToken<MembrsConfig>(\"MembrsConfig\");\n","import { Injectable, Inject } from '@angular/core';\nimport { JwtHelperService } from '@auth0/angular-jwt';\nimport { HttpClient } from '@angular/common/http'\nimport { MembrsConfigService } from './config.service'\nimport { MembrsConfig } from './config.interface';\nimport { BehaviorSubject } from 'rxjs';\nconst jwtService = new JwtHelperService()\n\n@Injectable({\n providedIn: 'root'\n})\n\n\nexport class MembrsService {\n\n _token: string;\n _decoded: any;\n _lsKey: string = 'membrs';\n _loggedInObservable: BehaviorSubject<Boolean> = new BehaviorSubject(false)\n\n constructor(private http: HttpClient, @Inject(MembrsConfigService) private config: MembrsConfig) {\n\n // console.log('membrs constructor')\n // if the token exists in local storage, retrieve it back to the service\n if(localStorage.getItem(this._lsKey)){\n this.token = localStorage.getItem(this._lsKey)\n }\n \n }\n\n reissue(token?:string){\n\n return new Promise((resolve, reject)=>{\n\n if(!token && !this._token){\n reject('NOT_LOGGED_IN')\n }\n\n if(token)\n this.token = token\n\n // check stored token has not expired, or needs to be reissued soon\n var reissueIn = this._decoded.exp - Math.floor(Date.now()/1000)\n\n // token has expired\n if(reissueIn < 0){\n reject('NOT_LOGGED_IN')\n }\n \n // token expiring soon\n if(reissueIn < 300){\n\n this.http.post(this.config.apiProtocol + this.config.api+'/token/'+this._token, {}).subscribe((response:any)=>{\n\n if(response.token){\n this.token = response.token\n this._loggedInObservable.next(true)\n resolve(this._token)\n }else {\n reject('NOT_LOGGED_IN')\n }\n \n }, error=>{\n reject('NOT_LOGGED_IN')\n })\n\n }else {\n this._loggedInObservable.next(true)\n resolve(this._token)\n }\n \n })\n \n }\n\n set token(token){\n this._token = token\n localStorage.setItem(this._lsKey, token)\n this._decoded = jwtService.decodeToken(this._token)\n }\n\n deleteToken(){\n localStorage.removeItem(this._lsKey)\n }\n\n isLoggedIn(){\n return this.token ? true : false\n }\n\n get profile(){\n return this._decoded\n }\n\n get token(){\n return this._token\n }\n\n get admin (){\n return this.profile.permission == 1\n }\n\n get isLoggedInObservable(){\n return this._loggedInObservable\n }\n \n logout(){\n return new Promise((resolve, reject)=>{\n this.http.delete(this.config.apiProtocol+this.config.api+'/token/'+this._token).subscribe((response:any)=>{\n this._token = null;\n localStorage.removeItem(this._lsKey)\n resolve(this.config.login)\n //this.router.stateService.go('dashboard')\n }, error=>{\n reject(error)\n })\n })\n \n }\n\n\n}\n","import { UIRouter } from '@uirouter/core';\nimport { MembrsConfigService } from './config.service'\nimport { MembrsConfig } from './config.interface';\nimport { Injector } from '@angular/core';\nimport { MembrsService } from './membrs.service';\n\nexport function routerConfigFn(router: UIRouter, injector: Injector) {\n\n const transitionService = router.transitionService;\n const stateService = router.stateService\n const config:MembrsConfig = injector.get(MembrsConfigService)\n const membrsService = injector.get(MembrsService)\n\n \tstateService.defaultErrorHandler(function(error) {\n\t\t \n\t\tconsole.log('Default error handler - Membrs Angular Helper')\n\t\tconsole.log(error)\n\t\t\t\n\t\tif(error.detail == 'NOT_LOGGED_IN'){\n\t\t\tmembrsService.deleteToken()\n\t\t\twindow.location.href = config.login;\n\t\t}\n\n\t\tif(error.detail == 'INSUFFICIENT_PERMISSIONS')\n\t\t\tstateService.go(config.defaultState)\n\n\t});\n\t\n}","export function retrieveToken() {\n // console.log('retrieve from ls')\n return localStorage.getItem('membrs');\n}","import { NgModule, ModuleWithProviders, Injector } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MembrsService } from './membrs.service';\nimport { JwtModule, JWT_OPTIONS } from \"@auth0/angular-jwt\";\nimport { HttpClientModule } from \"@angular/common/http\";\nimport { UIRouterModule } from '@uirouter/angular'\n\nimport { Ng2StateDeclaration } from '@uirouter/angular';\nimport { Transition, UIRouter } from '@uirouter/angular'\n\nimport { routerConfigFn } from './router.config';\nimport { MembrsConfig } from './config.interface';\nimport { MembrsConfigService } from './config.service';\nimport { retrieveToken } from './token';\n\nexport const validateResolve = {\n token: 'reissue',\n deps: [ Transition, UIRouter, MembrsService, MembrsConfigService ],\n resolveFn: validateResolveFn\n}\n\nexport const reissueResolve = {\n token: 'reissue',\n deps: [ Transition, UIRouter, MembrsService, MembrsConfigService ],\n resolveFn: reissueResolveFn\n}\n\nexport const reissueState:Ng2StateDeclaration = {\n\tname: 'reissue', \n\turl: '/reissue?token',\n\tviews: { },\n\tresolve: [\n reissueResolve\n\t]\n}\n\nexport function reissueResolveFn(transition, router, membrsService, membrsConfig:MembrsConfig) {\n \n //console.log(membrsService)\n return new Promise((resolve, reject) => {\n // console.log('reissue promise resolve')\n // console.log(transition.params().token)\n membrsService.reissue(transition.params().token).then((response)=>{\n //console.log('redirect to default state')\n router.stateService.go(membrsConfig.defaultState, {}, {inherit:false})\n reject()\n }).catch(error=>{\n //console.log('error in reissue resolve')\n //console.log(error)\n //window.location.href = environment.login\n reject(error)\n })\n\n\t})\n}\n\nexport function validateResolveFn(transition, router, membrsService, membrsConfig:MembrsConfig) {\n \n //console.log(membrsService)\n return new Promise((resolve, reject) => {\n // console.log('validate promise resolve')\n \n membrsService.reissue().then((response)=>{\n resolve(null)\n }).catch(error=>{\n // console.log('error in validateResolveFn')\n // console.log(error)\n window.location.href = membrsConfig.login\n reject(error)\n })\n\n})\n}\n\nexport function jwtOptionsFactory(config) {\n // console.log('jwt options factory')\n // console.log(config)\n return {\n tokenGetter: () => {\n console.log('token getter', localStorage.getItem('membrs'))\n return localStorage.getItem('membrs');\n },\n allowedDomains: [config.api]\n }\n}\n\n\n/** The top level state(s) */\nexport const STATES = [\n reissueState\n]\n\n\n@NgModule({\n imports: [\n CommonModule,\n HttpClientModule,\n JwtModule\n // JwtModule.forRoot({\n // config: {\n // tokenGetter: retrieveToken\n // }\n // })\n // UIRouterModule.forChild({\n // states: STATES,\n // config: routerConfigFn,\n // }),\n // JwtModule.forRoot({})\n ]\n})\n\n\n\nexport class MembrsModule { \n static forRoot(config: MembrsConfig): ModuleWithProviders<MembrsModule> {\n\n\n const moduleProviders = UIRouterModule.forChild({\n states: STATES,\n config: routerConfigFn\n }).providers\n\n moduleProviders.push(JwtModule.forRoot({\n config: {\n tokenGetter: retrieveToken,\n allowedDomains: []\n }\n }).providers)\n \n moduleProviders.push(MembrsService)\n moduleProviders.push({provide: MembrsConfigService,useValue: config});\n \n \n return {\n ngModule: MembrsModule, \n providers: moduleProviders //[{provide: MembrsConfigService,useValue: config}]\n };\n \n }\n\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpRequest,\n HttpHandler,\n HttpEvent,\n HttpInterceptor\n} from '@angular/common/http';\nimport { Observable } from 'rxjs';\n//import { NgBusyService } from '@nakedcreativity/ng-busy';\nimport { finalize } from 'rxjs/operators';\n\n\n@Injectable()\nexport class TokenInterceptor implements HttpInterceptor {\n constructor() {}\n intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n \n console.log('intercept request', localStorage.getItem('membrs'))\n //this.busyService.busy()\n request = request.clone({\n setHeaders: {\n Authorization: localStorage.getItem('membrs')\n }\n });\n return next.handle(request).pipe(finalize(()=>{\n //this.busyService.finished()\n }));\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAGA;;;;AAIO,MAAM,mBAAmB,GAAG,IAAI,c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kBApBxB,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,YAAY;wBACZ,gBAAgB;wBAChB,SAAS;;;;;;;;;;;qBAWV;iBACF;;;MChGY,gBAAgB;IAC3B,iBAAgB;IAChB,SAAS,CAAC,OAAyB,EAAE,IAAiB;QAEpD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;;QAEhE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;YACtB,UAAU,EAAE;gBACV,aAAa,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC;aAC9C;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;;SAEzC,CAAC,CAAC,CAAC;KACL;;6GAdU,gBAAgB;iHAAhB,gBAAgB;2FAAhB,gBAAgB;kBAD5B,UAAU;;;ACZX;;;;;;"}
@@ -1,7 +1,9 @@
1
- import { InjectionToken, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, NgModule } from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
2
3
  import { JwtHelperService, JwtModule } from '@auth0/angular-jwt';
3
- import { HttpClient, HttpClientModule } from '@angular/common/http';
4
4
  import { BehaviorSubject } from 'rxjs';
5
+ import * as i1 from '@angular/common/http';
6
+ import { HttpClientModule } from '@angular/common/http';
5
7
  import { CommonModule } from '@angular/common';
6
8
  import { Transition, UIRouter, UIRouterModule } from '@uirouter/angular';
7
9
  import { finalize } from 'rxjs/operators';
@@ -19,7 +21,7 @@ class MembrsService {
19
21
  this.config = config;
20
22
  this._lsKey = 'membrs';
21
23
  this._loggedInObservable = new BehaviorSubject(false);
22
- console.log('membrs constructor');
24
+ // console.log('membrs constructor')
23
25
  // if the token exists in local storage, retrieve it back to the service
24
26
  if (localStorage.getItem(this._lsKey)) {
25
27
  this.token = localStorage.getItem(this._lsKey);
@@ -95,16 +97,17 @@ class MembrsService {
95
97
  });
96
98
  }
97
99
  }
98
- MembrsService.ɵprov = ɵɵdefineInjectable({ factory: function MembrsService_Factory() { return new MembrsService(ɵɵinject(HttpClient), ɵɵinject(MembrsConfigService)); }, token: MembrsService, providedIn: "root" });
99
- MembrsService.decorators = [
100
- { type: Injectable, args: [{
101
- providedIn: 'root'
102
- },] }
103
- ];
104
- MembrsService.ctorParameters = () => [
105
- { type: HttpClient },
106
- { type: undefined, decorators: [{ type: Inject, args: [MembrsConfigService,] }] }
107
- ];
100
+ MembrsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsService, deps: [{ token: i1.HttpClient }, { token: MembrsConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
101
+ MembrsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsService, providedIn: 'root' });
102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsService, decorators: [{
103
+ type: Injectable,
104
+ args: [{
105
+ providedIn: 'root'
106
+ }]
107
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
108
+ type: Inject,
109
+ args: [MembrsConfigService]
110
+ }] }]; } });
108
111
 
109
112
  function routerConfigFn(router, injector) {
110
113
  const transitionService = router.transitionService;
@@ -124,7 +127,7 @@ function routerConfigFn(router, injector) {
124
127
  }
125
128
 
126
129
  function retrieveToken() {
127
- console.log('retrieve from ls');
130
+ // console.log('retrieve from ls')
128
131
  return localStorage.getItem('membrs');
129
132
  }
130
133
 
@@ -149,15 +152,15 @@ const reissueState = {
149
152
  function reissueResolveFn(transition, router, membrsService, membrsConfig) {
150
153
  //console.log(membrsService)
151
154
  return new Promise((resolve, reject) => {
152
- console.log('reissue promise resolve');
153
- console.log(transition.params().token);
155
+ // console.log('reissue promise resolve')
156
+ // console.log(transition.params().token)
154
157
  membrsService.reissue(transition.params().token).then((response) => {
155
- console.log('redirect to default state');
158
+ //console.log('redirect to default state')
156
159
  router.stateService.go(membrsConfig.defaultState, {}, { inherit: false });
157
160
  reject();
158
161
  }).catch(error => {
159
- console.log('error in reissue resolve');
160
- console.log(error);
162
+ //console.log('error in reissue resolve')
163
+ //console.log(error)
161
164
  //window.location.href = environment.login
162
165
  reject(error);
163
166
  });
@@ -166,20 +169,20 @@ function reissueResolveFn(transition, router, membrsService, membrsConfig) {
166
169
  function validateResolveFn(transition, router, membrsService, membrsConfig) {
167
170
  //console.log(membrsService)
168
171
  return new Promise((resolve, reject) => {
169
- console.log('validate promise resolve');
172
+ // console.log('validate promise resolve')
170
173
  membrsService.reissue().then((response) => {
171
174
  resolve(null);
172
175
  }).catch(error => {
173
- console.log('error in validateResolveFn');
174
- console.log(error);
176
+ // console.log('error in validateResolveFn')
177
+ // console.log(error)
175
178
  window.location.href = membrsConfig.login;
176
179
  reject(error);
177
180
  });
178
181
  });
179
182
  }
180
183
  function jwtOptionsFactory(config) {
181
- console.log('jwt options factory');
182
- console.log(config);
184
+ // console.log('jwt options factory')
185
+ // console.log(config)
183
186
  return {
184
187
  tokenGetter: () => {
185
188
  console.log('token getter', localStorage.getItem('membrs'));
@@ -212,29 +215,61 @@ class MembrsModule {
212
215
  };
213
216
  }
214
217
  }
215
- MembrsModule.decorators = [
216
- { type: NgModule, args: [{
217
- imports: [
218
- CommonModule,
219
- HttpClientModule,
220
- JwtModule
221
- // JwtModule.forRoot({
222
- // config: {
223
- // tokenGetter: retrieveToken
224
- // }
225
- // })
226
- // UIRouterModule.forChild({
227
- // states: STATES,
228
- // config: routerConfigFn,
229
- // }),
230
- // JwtModule.forRoot({})
231
- ]
232
- },] }
233
- ];
218
+ MembrsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
219
+ MembrsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, imports: [CommonModule,
220
+ HttpClientModule,
221
+ JwtModule
222
+ // JwtModule.forRoot({
223
+ // config: {
224
+ // tokenGetter: retrieveToken
225
+ // }
226
+ // })
227
+ // UIRouterModule.forChild({
228
+ // states: STATES,
229
+ // config: routerConfigFn,
230
+ // }),
231
+ // JwtModule.forRoot({})
232
+ ] });
233
+ MembrsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, imports: [[
234
+ CommonModule,
235
+ HttpClientModule,
236
+ JwtModule
237
+ // JwtModule.forRoot({
238
+ // config: {
239
+ // tokenGetter: retrieveToken
240
+ // }
241
+ // })
242
+ // UIRouterModule.forChild({
243
+ // states: STATES,
244
+ // config: routerConfigFn,
245
+ // }),
246
+ // JwtModule.forRoot({})
247
+ ]] });
248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MembrsModule, decorators: [{
249
+ type: NgModule,
250
+ args: [{
251
+ imports: [
252
+ CommonModule,
253
+ HttpClientModule,
254
+ JwtModule
255
+ // JwtModule.forRoot({
256
+ // config: {
257
+ // tokenGetter: retrieveToken
258
+ // }
259
+ // })
260
+ // UIRouterModule.forChild({
261
+ // states: STATES,
262
+ // config: routerConfigFn,
263
+ // }),
264
+ // JwtModule.forRoot({})
265
+ ]
266
+ }]
267
+ }] });
234
268
 
235
269
  class TokenInterceptor {
236
270
  constructor() { }
237
271
  intercept(request, next) {
272
+ console.log('intercept request', localStorage.getItem('membrs'));
238
273
  //this.busyService.busy()
239
274
  request = request.clone({
240
275
  setHeaders: {
@@ -246,14 +281,15 @@ class TokenInterceptor {
246
281
  }));
247
282
  }
248
283
  }
249
- TokenInterceptor.decorators = [
250
- { type: Injectable }
251
- ];
252
- TokenInterceptor.ctorParameters = () => [];
284
+ TokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TokenInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
285
+ TokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TokenInterceptor });
286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: TokenInterceptor, decorators: [{
287
+ type: Injectable
288
+ }], ctorParameters: function () { return []; } });
253
289
 
254
290
  /**
255
291
  * Generated bundle index. Do not edit.
256
292
  */
257
293
 
258
- export { MembrsModule, MembrsService, STATES, TokenInterceptor, jwtOptionsFactory, reissueResolve, reissueResolveFn, reissueState, retrieveToken, validateResolve, validateResolveFn, MembrsConfigService as ɵa };
259
- //# sourceMappingURL=nakedcreativity-membrs-angular-helper.js.map
294
+ export { MembrsModule, MembrsService, STATES, TokenInterceptor, jwtOptionsFactory, reissueResolve, reissueResolveFn, reissueState, retrieveToken, validateResolve, validateResolveFn };
295
+ //# sourceMappingURL=nakedcreativity-membrs-angular-helper.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nakedcreativity-membrs-angular-helper.mjs","sources":["../../../projects/membrs/src/lib/config.service.ts","../../../projects/membrs/src/lib/membrs.service.ts","../../../projects/membrs/src/lib/router.config.ts","../../../projects/membrs/src/lib/token.ts","../../../projects/membrs/src/lib/membrs.module.ts","../../../projects/membrs/src/lib/auth.interceptor.ts","../../../projects/membrs/src/nakedcreativity-membrs-angular-helper.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { MembrsConfig } from './config.interface';\n\n/**\n * This is not a real service, but it looks like it from the outside.\n * It's just an InjectionTToken used to import the config object, provided from the outside\n */\nexport const MembrsConfigService = new InjectionToken<MembrsConfig>(\"MembrsConfig\");\n","import { Injectable, Inject } from '@angular/core';\nimport { JwtHelperService } from '@auth0/angular-jwt';\nimport { HttpClient } from '@angular/common/http'\nimport { MembrsConfigService } from './config.service'\nimport { MembrsConfig } from './config.interface';\nimport { BehaviorSubject } from 'rxjs';\nconst jwtService = new JwtHelperService()\n\n@Injectable({\n providedIn: 'root'\n})\n\n\nexport class MembrsService {\n\n _token: string;\n _decoded: any;\n _lsKey: string = 'membrs';\n _loggedInObservable: BehaviorSubject<Boolean> = new BehaviorSubject(false)\n\n constructor(private http: HttpClient, @Inject(MembrsConfigService) private config: MembrsConfig) {\n\n // console.log('membrs constructor')\n // if the token exists in local storage, retrieve it back to the service\n if(localStorage.getItem(this._lsKey)){\n this.token = localStorage.getItem(this._lsKey)\n }\n \n }\n\n reissue(token?:string){\n\n return new Promise((resolve, reject)=>{\n\n if(!token && !this._token){\n reject('NOT_LOGGED_IN')\n }\n\n if(token)\n this.token = token\n\n // check stored token has not expired, or needs to be reissued soon\n var reissueIn = this._decoded.exp - Math.floor(Date.now()/1000)\n\n // token has expired\n if(reissueIn < 0){\n reject('NOT_LOGGED_IN')\n }\n \n // token expiring soon\n if(reissueIn < 300){\n\n this.http.post(this.config.apiProtocol + this.config.api+'/token/'+this._token, {}).subscribe((response:any)=>{\n\n if(response.token){\n this.token = response.token\n this._loggedInObservable.next(true)\n resolve(this._token)\n }else {\n reject('NOT_LOGGED_IN')\n }\n \n }, error=>{\n reject('NOT_LOGGED_IN')\n })\n\n }else {\n this._loggedInObservable.next(true)\n resolve(this._token)\n }\n \n })\n \n }\n\n set token(token){\n this._token = token\n localStorage.setItem(this._lsKey, token)\n this._decoded = jwtService.decodeToken(this._token)\n }\n\n deleteToken(){\n localStorage.removeItem(this._lsKey)\n }\n\n isLoggedIn(){\n return this.token ? true : false\n }\n\n get profile(){\n return this._decoded\n }\n\n get token(){\n return this._token\n }\n\n get admin (){\n return this.profile.permission == 1\n }\n\n get isLoggedInObservable(){\n return this._loggedInObservable\n }\n \n logout(){\n return new Promise((resolve, reject)=>{\n this.http.delete(this.config.apiProtocol+this.config.api+'/token/'+this._token).subscribe((response:any)=>{\n this._token = null;\n localStorage.removeItem(this._lsKey)\n resolve(this.config.login)\n //this.router.stateService.go('dashboard')\n }, error=>{\n reject(error)\n })\n })\n \n }\n\n\n}\n","import { UIRouter } from '@uirouter/core';\nimport { MembrsConfigService } from './config.service'\nimport { MembrsConfig } from './config.interface';\nimport { Injector } from '@angular/core';\nimport { MembrsService } from './membrs.service';\n\nexport function routerConfigFn(router: UIRouter, injector: Injector) {\n\n const transitionService = router.transitionService;\n const stateService = router.stateService\n const config:MembrsConfig = injector.get(MembrsConfigService)\n const membrsService = injector.get(MembrsService)\n\n \tstateService.defaultErrorHandler(function(error) {\n\t\t \n\t\tconsole.log('Default error handler - Membrs Angular Helper')\n\t\tconsole.log(error)\n\t\t\t\n\t\tif(error.detail == 'NOT_LOGGED_IN'){\n\t\t\tmembrsService.deleteToken()\n\t\t\twindow.location.href = config.login;\n\t\t}\n\n\t\tif(error.detail == 'INSUFFICIENT_PERMISSIONS')\n\t\t\tstateService.go(config.defaultState)\n\n\t});\n\t\n}","export function retrieveToken() {\n // console.log('retrieve from ls')\n return localStorage.getItem('membrs');\n}","import { NgModule, ModuleWithProviders, Injector } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MembrsService } from './membrs.service';\nimport { JwtModule, JWT_OPTIONS } from \"@auth0/angular-jwt\";\nimport { HttpClientModule } from \"@angular/common/http\";\nimport { UIRouterModule } from '@uirouter/angular'\n\nimport { Ng2StateDeclaration } from '@uirouter/angular';\nimport { Transition, UIRouter } from '@uirouter/angular'\n\nimport { routerConfigFn } from './router.config';\nimport { MembrsConfig } from './config.interface';\nimport { MembrsConfigService } from './config.service';\nimport { retrieveToken } from './token';\n\nexport const validateResolve = {\n token: 'reissue',\n deps: [ Transition, UIRouter, MembrsService, MembrsConfigService ],\n resolveFn: validateResolveFn\n}\n\nexport const reissueResolve = {\n token: 'reissue',\n deps: [ Transition, UIRouter, MembrsService, MembrsConfigService ],\n resolveFn: reissueResolveFn\n}\n\nexport const reissueState:Ng2StateDeclaration = {\n\tname: 'reissue', \n\turl: '/reissue?token',\n\tviews: { },\n\tresolve: [\n reissueResolve\n\t]\n}\n\nexport function reissueResolveFn(transition, router, membrsService, membrsConfig:MembrsConfig) {\n \n //console.log(membrsService)\n return new Promise((resolve, reject) => {\n // console.log('reissue promise resolve')\n // console.log(transition.params().token)\n membrsService.reissue(transition.params().token).then((response)=>{\n //console.log('redirect to default state')\n router.stateService.go(membrsConfig.defaultState, {}, {inherit:false})\n reject()\n }).catch(error=>{\n //console.log('error in reissue resolve')\n //console.log(error)\n //window.location.href = environment.login\n reject(error)\n })\n\n\t})\n}\n\nexport function validateResolveFn(transition, router, membrsService, membrsConfig:MembrsConfig) {\n \n //console.log(membrsService)\n return new Promise((resolve, reject) => {\n // console.log('validate promise resolve')\n \n membrsService.reissue().then((response)=>{\n resolve(null)\n }).catch(error=>{\n // console.log('error in validateResolveFn')\n // console.log(error)\n window.location.href = membrsConfig.login\n reject(error)\n })\n\n})\n}\n\nexport function jwtOptionsFactory(config) {\n // console.log('jwt options factory')\n // console.log(config)\n return {\n tokenGetter: () => {\n console.log('token getter', localStorage.getItem('membrs'))\n return localStorage.getItem('membrs');\n },\n allowedDomains: [config.api]\n }\n}\n\n\n/** The top level state(s) */\nexport const STATES = [\n reissueState\n]\n\n\n@NgModule({\n imports: [\n CommonModule,\n HttpClientModule,\n JwtModule\n // JwtModule.forRoot({\n // config: {\n // tokenGetter: retrieveToken\n // }\n // })\n // UIRouterModule.forChild({\n // states: STATES,\n // config: routerConfigFn,\n // }),\n // JwtModule.forRoot({})\n ]\n})\n\n\n\nexport class MembrsModule { \n static forRoot(config: MembrsConfig): ModuleWithProviders<MembrsModule> {\n\n\n const moduleProviders = UIRouterModule.forChild({\n states: STATES,\n config: routerConfigFn\n }).providers\n\n moduleProviders.push(JwtModule.forRoot({\n config: {\n tokenGetter: retrieveToken,\n allowedDomains: []\n }\n }).providers)\n \n moduleProviders.push(MembrsService)\n moduleProviders.push({provide: MembrsConfigService,useValue: config});\n \n \n return {\n ngModule: MembrsModule, \n providers: moduleProviders //[{provide: MembrsConfigService,useValue: config}]\n };\n \n }\n\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpRequest,\n HttpHandler,\n HttpEvent,\n HttpInterceptor\n} from '@angular/common/http';\nimport { Observable } from 'rxjs';\n//import { NgBusyService } from '@nakedcreativity/ng-busy';\nimport { finalize } from 'rxjs/operators';\n\n\n@Injectable()\nexport class TokenInterceptor implements HttpInterceptor {\n constructor() {}\n intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n \n console.log('intercept request', localStorage.getItem('membrs'))\n //this.busyService.busy()\n request = request.clone({\n setHeaders: {\n Authorization: localStorage.getItem('membrs')\n }\n });\n return next.handle(request).pipe(finalize(()=>{\n //this.busyService.finished()\n }));\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAGA;;;;AAIO,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAAe,cAAc,CAAC;;ACDnF,MAAM,UAAU,GAAG,IAAI,gBAAgB,EAAE,CAAA;MAO5B,aAAa;IAOxB,YAAoB,IAAgB,EAAuC,MAAoB;QAA3E,SAAI,GAAJ,IAAI,CAAY;QAAuC,WAAM,GAAN,MAAM,CAAc;QAH/F,WAAM,GAAW,QAAQ,CAAC;QAC1B,wBAAmB,GAA6B,IAAI,eAAe,CAAC,KAAK,CAAC,CAAA;;;QAMxE,IAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC;YACnC,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;SAC/C;KAEF;IAED,OAAO,CAAC,KAAa;QAEnB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM;YAEjC,IAAG,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,EAAC;gBACxB,MAA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;;;"}
@@ -1,6 +1,9 @@
1
1
  import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
2
2
  import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
3
4
  export declare class TokenInterceptor implements HttpInterceptor {
4
5
  constructor();
5
6
  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<TokenInterceptor, never>;
8
+ static ɵprov: i0.ɵɵInjectableDeclaration<TokenInterceptor>;
6
9
  }
@@ -3,6 +3,10 @@ import { MembrsService } from './membrs.service';
3
3
  import { Ng2StateDeclaration } from '@uirouter/angular';
4
4
  import { Transition, UIRouter } from '@uirouter/angular';
5
5
  import { MembrsConfig } from './config.interface';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "@angular/common";
8
+ import * as i2 from "@angular/common/http";
9
+ import * as i3 from "@auth0/angular-jwt";
6
10
  export declare const validateResolve: {
7
11
  token: string;
8
12
  deps: (import("@angular/core").InjectionToken<MembrsConfig> | typeof MembrsService | typeof Transition | typeof UIRouter)[];
@@ -24,4 +28,7 @@ export declare function jwtOptionsFactory(config: any): {
24
28
  export declare const STATES: Ng2StateDeclaration[];
25
29
  export declare class MembrsModule {
26
30
  static forRoot(config: MembrsConfig): ModuleWithProviders<MembrsModule>;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<MembrsModule, never>;
32
+ static ɵmod: i0.ɵɵNgModuleDeclaration<MembrsModule, never, [typeof i1.CommonModule, typeof i2.HttpClientModule, typeof i3.JwtModule], never>;
33
+ static ɵinj: i0.ɵɵInjectorDeclaration<MembrsModule>;
27
34
  }
@@ -1,6 +1,7 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { MembrsConfig } from './config.interface';
3
3
  import { BehaviorSubject } from 'rxjs';
4
+ import * as i0 from "@angular/core";
4
5
  export declare class MembrsService {
5
6
  private http;
6
7
  private config;
@@ -18,4 +19,6 @@ export declare class MembrsService {
18
19
  get admin(): boolean;
19
20
  get isLoggedInObservable(): BehaviorSubject<Boolean>;
20
21
  logout(): Promise<unknown>;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<MembrsService, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<MembrsService>;
21
24
  }
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@nakedcreativity/membrs-angular-helper" />
4
5
  export * from './public-api';
5
- export { MembrsConfig as ɵb } from './lib/config.interface';
6
- export { MembrsConfigService as ɵa } from './lib/config.service';