Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-feature-toggle

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-feature-toggle - npm Package Compare versions

Comparing version 10.1.0 to 11.0.0

esm2015/lib/ngx-feature-toggle-route-guard.router.js

122

bundles/ngx-feature-toggle.umd.js

@@ -253,11 +253,11 @@ (function (global, factory) {

FeatureToggleDirective.prototype.isOnCheck = function (featureToggle) {
var DEV_MODE = core.isDevMode();
if (typeof featureToggle === 'string' || Array.isArray(featureToggle)) {
return [].concat(featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
});
if (typeof featureToggle !== 'string' && !Array.isArray(featureToggle)) {
if (core.isDevMode()) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return false;
}
else if (DEV_MODE) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return [].concat(featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
});
};

@@ -332,11 +332,10 @@ FeatureToggleDirective.ctorParameters = function () { return [

var NgxFeatureToggleCanActivateGuard = /** @class */ (function () {
function NgxFeatureToggleCanActivateGuard(router) {
var NgxFeatureToggleRouteGuard = /** @class */ (function () {
function NgxFeatureToggleRouteGuard(router) {
this.router = router;
}
NgxFeatureToggleCanActivateGuard.prototype.isDevMode = function () {
NgxFeatureToggleRouteGuard.prototype.isDevMode = function () {
return core.isDevMode();
};
NgxFeatureToggleCanActivateGuard.prototype.canActivate = function (route) {
var DEV_MODE = this.isDevMode();
NgxFeatureToggleRouteGuard.prototype.isOnCheck = function (route) {
if (!route ||

@@ -346,43 +345,6 @@ !route.data ||

!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}
var hasAllTogglesOn = [].concat(route.data.featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
});
if (!hasAllTogglesOn && route.data.redirectTo) {
this.router.navigate([].concat(route.data.redirectTo));
}
return hasAllTogglesOn;
};
NgxFeatureToggleCanActivateGuard.ctorParameters = function () { return [
{ type: router.Router }
]; };
NgxFeatureToggleCanActivateGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateGuard_Factory() { return new NgxFeatureToggleCanActivateGuard(core.ɵɵinject(router.Router)); }, token: NgxFeatureToggleCanActivateGuard, providedIn: "root" });
NgxFeatureToggleCanActivateGuard = __decorate([
core.Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [router.Router])
], NgxFeatureToggleCanActivateGuard);
return NgxFeatureToggleCanActivateGuard;
}());
var NgxFeatureToggleCanActivateChildGuard = /** @class */ (function () {
function NgxFeatureToggleCanActivateChildGuard(router) {
this.router = router;
}
NgxFeatureToggleCanActivateChildGuard.prototype.isDevMode = function () {
return core.isDevMode();
};
NgxFeatureToggleCanActivateChildGuard.prototype.canActivateChild = function (route) {
var DEV_MODE = this.isDevMode();
if (!route ||
!route.data ||
(typeof route.data.featureToggle !== 'string' &&
!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
if (this.isDevMode()) {
console.error(
// tslint:disable-next-line: max-line-length
'`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
'`NgxFeatureToggleRouteGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}

@@ -399,48 +361,20 @@ return false;

};
NgxFeatureToggleCanActivateChildGuard.ctorParameters = function () { return [
{ type: router.Router }
]; };
NgxFeatureToggleCanActivateChildGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateChildGuard_Factory() { return new NgxFeatureToggleCanActivateChildGuard(core.ɵɵinject(router.Router)); }, token: NgxFeatureToggleCanActivateChildGuard, providedIn: "root" });
NgxFeatureToggleCanActivateChildGuard = __decorate([
core.Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [router.Router])
], NgxFeatureToggleCanActivateChildGuard);
return NgxFeatureToggleCanActivateChildGuard;
}());
var NgxFeatureToggleCanLoadGuard = /** @class */ (function () {
function NgxFeatureToggleCanLoadGuard(router) {
this.router = router;
}
NgxFeatureToggleCanLoadGuard.prototype.isDevMode = function () {
return core.isDevMode();
NgxFeatureToggleRouteGuard.prototype.canLoad = function (route) {
return this.isOnCheck(route);
};
NgxFeatureToggleCanLoadGuard.prototype.canLoad = function (route) {
var DEV_MODE = this.isDevMode();
if (!route ||
!route.data ||
(typeof route.data.featureToggle !== 'string' &&
!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}
var hasAllTogglesOn = [].concat(route.data.featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
});
if (!hasAllTogglesOn && route.data.redirectTo) {
this.router.navigate([].concat(route.data.redirectTo));
}
return hasAllTogglesOn;
NgxFeatureToggleRouteGuard.prototype.canActivateChild = function (route) {
return this.isOnCheck(route);
};
NgxFeatureToggleCanLoadGuard.ctorParameters = function () { return [
NgxFeatureToggleRouteGuard.prototype.canActivate = function (route) {
return this.isOnCheck(route);
};
NgxFeatureToggleRouteGuard.ctorParameters = function () { return [
{ type: router.Router }
]; };
NgxFeatureToggleCanLoadGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanLoadGuard_Factory() { return new NgxFeatureToggleCanLoadGuard(core.ɵɵinject(router.Router)); }, token: NgxFeatureToggleCanLoadGuard, providedIn: "root" });
NgxFeatureToggleCanLoadGuard = __decorate([
NgxFeatureToggleRouteGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxFeatureToggleRouteGuard_Factory() { return new NgxFeatureToggleRouteGuard(core.ɵɵinject(router.Router)); }, token: NgxFeatureToggleRouteGuard, providedIn: "root" });
NgxFeatureToggleRouteGuard = __decorate([
core.Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [router.Router])
], NgxFeatureToggleCanLoadGuard);
return NgxFeatureToggleCanLoadGuard;
], NgxFeatureToggleRouteGuard);
return NgxFeatureToggleRouteGuard;
}());

@@ -451,5 +385,3 @@

exports.FeatureToggleProviderComponent = FeatureToggleProviderComponent;
exports.NgxFeatureToggleCanActivateChildGuard = NgxFeatureToggleCanActivateChildGuard;
exports.NgxFeatureToggleCanActivateGuard = NgxFeatureToggleCanActivateGuard;
exports.NgxFeatureToggleCanLoadGuard = NgxFeatureToggleCanLoadGuard;
exports.NgxFeatureToggleRouteGuard = NgxFeatureToggleRouteGuard;

@@ -456,0 +388,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("feature-toggle-service"),require("@angular/common"),require("@angular/router")):"function"==typeof define&&define.amd?define("ngx-feature-toggle",["exports","@angular/core","feature-toggle-service","@angular/common","@angular/router"],t):t((e=e||self)["ngx-feature-toggle"]={},e.ng.core,e.FeatureToggleService,e.ng.common,e.ng.router)}(this,(function(e,t,r,o,n){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function a(e,t,r,o){var n,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var u=e.length-1;u>=0;u--)(n=e[u])&&(i=(a<3?n(i):a>3?n(t,r,i):n(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var u=function(){function e(e,t){this.templateRef=e,this.viewContainer=t,this.isOn=!1}return e.prototype.ngOnInit=function(){if(!this.featureToggle)throw new Error("Attribute `featureToggle` should not be null or empty");this.shouldRender()},e.prototype.ngDoCheck=function(){this.isOn!==this.isOnCheck(this.featureToggle)&&this.shouldRender()},e.prototype.shouldRender=function(){this.isOn=this.isOnCheck(this.featureToggle),this.isOn?this.viewContainer.createEmbeddedView(this.templateRef):this.viewContainer.clear()},e.prototype.isOnCheck=function(e){var o=t.isDevMode();if("string"==typeof e||Array.isArray(e))return[].concat(e).every((function(e){return"!"===e[0]?!r.isOn(e.replace("!","")):r.isOn(e)}));o&&console.error("`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.")},e.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},a([t.Input(),i("design:type",Object)],e.prototype,"featureToggle",void 0),e=a([t.Directive({selector:"[featureToggle]"}),i("design:paramtypes",[t.TemplateRef,t.ViewContainerRef])],e)}(),c=function(){function e(){this.features={},this.currentConfig={}}return e.prototype.ngOnInit=function(){if("object"!=typeof this.features)throw new Error("Attribute `features` should not be null or empty");this.setFeatureToggles()},e.prototype.ngDoCheck=function(){this.setFeatureToggles()},e.prototype.setFeatureToggles=function(){this.currentConfig!==this.features&&(this.currentConfig=Object.assign({},this.features),r.set(this.features))},a([t.Input(),i("design:type",Object)],e.prototype,"features",void 0),e=a([t.Component({selector:"feature-toggle-provider",template:"<ng-content></ng-content>"})],e)}(),s=function(){function e(){}return e=a([t.NgModule({declarations:[c,u],exports:[c,u],imports:[o.CommonModule]})],e)}(),g=function(){function e(e){this.router=e}return e.prototype.isDevMode=function(){return t.isDevMode()},e.prototype.canActivate=function(e){var t=this.isDevMode();if(!e||!e.data||"string"!=typeof e.data.featureToggle&&!Array.isArray(e.data.featureToggle))return t&&console.error("`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration."),!1;var o=[].concat(e.data.featureToggle).every((function(e){return"!"===e[0]?!r.isOn(e.replace("!","")):r.isOn(e)}));return!o&&e.data.redirectTo&&this.router.navigate([].concat(e.data.redirectTo)),o},e.ctorParameters=function(){return[{type:n.Router}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(n.Router))},token:e,providedIn:"root"}),e=a([t.Injectable({providedIn:"root"}),i("design:paramtypes",[n.Router])],e)}(),f=function(){function e(e){this.router=e}return e.prototype.isDevMode=function(){return t.isDevMode()},e.prototype.canActivateChild=function(e){var t=this.isDevMode();if(!e||!e.data||"string"!=typeof e.data.featureToggle&&!Array.isArray(e.data.featureToggle))return t&&console.error("`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration."),!1;var o=[].concat(e.data.featureToggle).every((function(e){return"!"===e[0]?!r.isOn(e.replace("!","")):r.isOn(e)}));return!o&&e.data.redirectTo&&this.router.navigate([].concat(e.data.redirectTo)),o},e.ctorParameters=function(){return[{type:n.Router}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(n.Router))},token:e,providedIn:"root"}),e=a([t.Injectable({providedIn:"root"}),i("design:paramtypes",[n.Router])],e)}(),d=function(){function e(e){this.router=e}return e.prototype.isDevMode=function(){return t.isDevMode()},e.prototype.canLoad=function(e){var t=this.isDevMode();if(!e||!e.data||"string"!=typeof e.data.featureToggle&&!Array.isArray(e.data.featureToggle))return t&&console.error("`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration."),!1;var o=[].concat(e.data.featureToggle).every((function(e){return"!"===e[0]?!r.isOn(e.replace("!","")):r.isOn(e)}));return!o&&e.data.redirectTo&&this.router.navigate([].concat(e.data.redirectTo)),o},e.ctorParameters=function(){return[{type:n.Router}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(n.Router))},token:e,providedIn:"root"}),e=a([t.Injectable({providedIn:"root"}),i("design:paramtypes",[n.Router])],e)}();e.FeatureToggleDirective=u,e.FeatureToggleModule=s,e.FeatureToggleProviderComponent=c,e.NgxFeatureToggleCanActivateChildGuard=f,e.NgxFeatureToggleCanActivateGuard=g,e.NgxFeatureToggleCanLoadGuard=d,Object.defineProperty(e,"__esModule",{value:!0})}));
***************************************************************************** */function i(e,t,r,o){var n,i=arguments.length,u=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(u=(i<3?n(u):i>3?n(t,r,u):n(t,r))||u);return i>3&&u&&Object.defineProperty(t,r,u),u}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var a=function(){function e(e,t){this.templateRef=e,this.viewContainer=t,this.isOn=!1}return e.prototype.ngOnInit=function(){if(!this.featureToggle)throw new Error("Attribute `featureToggle` should not be null or empty");this.shouldRender()},e.prototype.ngDoCheck=function(){this.isOn!==this.isOnCheck(this.featureToggle)&&this.shouldRender()},e.prototype.shouldRender=function(){this.isOn=this.isOnCheck(this.featureToggle),this.isOn?this.viewContainer.createEmbeddedView(this.templateRef):this.viewContainer.clear()},e.prototype.isOnCheck=function(e){return"string"==typeof e||Array.isArray(e)?[].concat(e).every((function(e){return"!"===e[0]?!r.isOn(e.replace("!","")):r.isOn(e)})):(t.isDevMode()&&console.error("`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value."),!1)},e.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef}]},i([t.Input(),u("design:type",Object)],e.prototype,"featureToggle",void 0),e=i([t.Directive({selector:"[featureToggle]"}),u("design:paramtypes",[t.TemplateRef,t.ViewContainerRef])],e)}(),s=function(){function e(){this.features={},this.currentConfig={}}return e.prototype.ngOnInit=function(){if("object"!=typeof this.features)throw new Error("Attribute `features` should not be null or empty");this.setFeatureToggles()},e.prototype.ngDoCheck=function(){this.setFeatureToggles()},e.prototype.setFeatureToggles=function(){this.currentConfig!==this.features&&(this.currentConfig=Object.assign({},this.features),r.set(this.features))},i([t.Input(),u("design:type",Object)],e.prototype,"features",void 0),e=i([t.Component({selector:"feature-toggle-provider",template:"<ng-content></ng-content>"})],e)}(),c=function(){function e(){}return e=i([t.NgModule({declarations:[s,a],exports:[s,a],imports:[o.CommonModule]})],e)}(),f=function(){function e(e){this.router=e}return e.prototype.isDevMode=function(){return t.isDevMode()},e.prototype.isOnCheck=function(e){if(!e||!e.data||"string"!=typeof e.data.featureToggle&&!Array.isArray(e.data.featureToggle))return this.isDevMode()&&console.error("`NgxFeatureToggleRouteGuard` need to receive `featureToggle` as data as an array or string in your route configuration."),!1;var t=[].concat(e.data.featureToggle).every((function(e){return"!"===e[0]?!r.isOn(e.replace("!","")):r.isOn(e)}));return!t&&e.data.redirectTo&&this.router.navigate([].concat(e.data.redirectTo)),t},e.prototype.canLoad=function(e){return this.isOnCheck(e)},e.prototype.canActivateChild=function(e){return this.isOnCheck(e)},e.prototype.canActivate=function(e){return this.isOnCheck(e)},e.ctorParameters=function(){return[{type:n.Router}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(n.Router))},token:e,providedIn:"root"}),e=i([t.Injectable({providedIn:"root"}),u("design:paramtypes",[n.Router])],e)}();e.FeatureToggleDirective=a,e.FeatureToggleModule=c,e.FeatureToggleProviderComponent=s,e.NgxFeatureToggleRouteGuard=f,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-feature-toggle.umd.min.js.map

@@ -10,2 +10,50 @@ # Change Log

## [11.0.0][] - 2021-05-08
### Added
- Adding `NgxFeatureToggleRouteGuard` route guard. This class can be used on the routes for the checks:
- `canLoad`
- `canActivateChild`
- `canActivate`
### Updated
- Removing other Route Guards in favor of `NgxFeatureToggleRouteGuard`. The replace should be a matter of find and replace the classes in your codebase.
E.G.:
```ts
...
export const routes: Routes = [
{
path: 'customer',
component: CustomerComponent,
// Before it was `NgxFeatureToggleCanALoadGuard`
canLoad: [NgxFeatureToggleRouteGuard],
// Before it was `NgxFeatureToggleCanActivateGuard`
canActivate: [NgxFeatureToggleRouteGuard],
// Before it was `NgxFeatureToggleCanActivateChildGuard`
canActivateChild: [NgxFeatureToggleRouteGuard],
data: {
featureToggle: ['enableCustomerPage'],
redirectTo: '/error',
},
children: [
{
path: ':id',
component: CustomerDetailComponent,
data: {
featureToggle: ['enableCustomerPage', '!enableChildrenNavigation'],
redirectTo: '/error',
},
},
],
},
...
];
...
```
## [10.1.0][] - 2021-05-07

@@ -489,5 +537,7 @@

[10.0.0]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v10.0.0
[unreleased]: https://github.com/willmendesneto/ngx-feature-toggle/compare/v10.1.0...HEAD
[10.1.0]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v10.1.0
[Unreleased]: https://github.com/willmendesneto/ngx-feature-toggle/compare/v10.1.0...HEAD
[10.1.0]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v10.1.0
[Unreleased]: https://github.com/willmendesneto/ngx-feature-toggle/compare/v11.0.0...HEAD
[11.0.0]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v11.0.0

@@ -31,9 +31,9 @@ import { __decorate, __metadata } from "tslib";

isOnCheck(featureToggle) {
const DEV_MODE = isDevMode();
if (typeof featureToggle === 'string' || Array.isArray(featureToggle)) {
return [].concat(featureToggle).every((toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
if (typeof featureToggle !== 'string' && !Array.isArray(featureToggle)) {
if (isDevMode()) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return false;
}
else if (DEV_MODE) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return [].concat(featureToggle).every((toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
}

@@ -58,2 +58,2 @@ };

export { FeatureToggleDirective };
//# sourceMappingUR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gJycpKSA6IGlzT24odG9nZ2xlKVxuICAgICk7XG4gIH1cbn1cbiJdfQ==

@@ -7,5 +7,3 @@ /*

export * from './lib/ngx-feature-toggle.module';
export * from './lib/ngx-feature-toggle-can-activate-guard.router';
export * from './lib/ngx-feature-toggle-can-activate-child-guard.router';
export * from './lib/ngx-feature-toggle-can-load-guard.router';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1mZWF0dXJlLXRvZ2dsZS8iLCJzb3VyY2VzIjpbInB1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLG9DQUFvQyxDQUFDO0FBQ25ELGNBQWMsNkNBQTZDLENBQUM7QUFDNUQsY0FBYyxpQ0FBaUMsQ0FBQztBQUNoRCxjQUFjLG9EQUFvRCxDQUFDO0FBQ25FLGNBQWMsMERBQTBELENBQUM7QUFDekUsY0FBYyxnREFBZ0QsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2Ygbmd4LWZlYXR1cmUtdG9nZ2xlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLmRpcmVjdGl2ZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtZmVhdHVyZS10b2dnbGUtcHJvdmlkZXIuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1mZWF0dXJlLXRvZ2dsZS5tb2R1bGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1hY3RpdmF0ZS1ndWFyZC5yb3V0ZXInO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1hY3RpdmF0ZS1jaGlsZC1ndWFyZC5yb3V0ZXInO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1sb2FkLWd1YXJkLnJvdXRlcic7XG4iXX0=
export * from './lib/ngx-feature-toggle-route-guard.router';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1mZWF0dXJlLXRvZ2dsZS8iLCJzb3VyY2VzIjpbInB1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLG9DQUFvQyxDQUFDO0FBQ25ELGNBQWMsNkNBQTZDLENBQUM7QUFDNUQsY0FBYyxpQ0FBaUMsQ0FBQztBQUNoRCxjQUFjLDZDQUE2QyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBuZ3gtZmVhdHVyZS10b2dnbGVcbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtZmVhdHVyZS10b2dnbGUuZGlyZWN0aXZlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1mZWF0dXJlLXRvZ2dsZS1wcm92aWRlci5jb21wb25lbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtZmVhdHVyZS10b2dnbGUtcm91dGUtZ3VhcmQucm91dGVyJztcbiJdfQ==

@@ -31,11 +31,11 @@ import { __decorate, __metadata } from "tslib";

FeatureToggleDirective.prototype.isOnCheck = function (featureToggle) {
var DEV_MODE = isDevMode();
if (typeof featureToggle === 'string' || Array.isArray(featureToggle)) {
return [].concat(featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
if (typeof featureToggle !== 'string' && !Array.isArray(featureToggle)) {
if (isDevMode()) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return false;
}
else if (DEV_MODE) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return [].concat(featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
};

@@ -61,2 +61,2 @@ FeatureToggleDirective.ctorParameters = function () { return [

export { FeatureToggleDirective };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWZlYXR1cmUtdG9nZ2xlLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1mZWF0dXJlLXRvZ2dsZS8iLCJzb3VyY2VzIjpbImxpYi9uZ3gtZmVhdHVyZS10b2dnbGUuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxPQUFPLEVBQ0wsU0FBUyxFQUNULEtBQUssRUFDTCxNQUFNLEVBQ04sV0FBVyxFQUNYLGdCQUFnQixFQUNoQixPQUFPLEVBQ1AsU0FBUyxHQUNWLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQU05QztJQUlFLGdDQUNVLFdBQTZCLEVBQzdCLGFBQStCO1FBRC9CLGdCQUFXLEdBQVgsV0FBVyxDQUFrQjtRQUM3QixrQkFBYSxHQUFiLGFBQWEsQ0FBa0I7UUFKakMsU0FBSSxHQUFHLEtBQUssQ0FBQztJQUtsQixDQUFDO0lBRUoseUNBQVEsR0FBUjtRQUNFLElBQUksQ0FBQyxJQUFJLENBQUMsYUFBYSxFQUFFO1lBQ3ZCLE1BQU0sSUFBSSxLQUFLLENBQUMsdURBQXVELENBQUMsQ0FBQztTQUMxRTtRQUNELElBQUksQ0FBQ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AgICAgICAgICdgTmd4RmVhdHVyZVRvZ2dsZWA6IGBmZWF0dXJlVG9nZ2xlYCBzaG91bGQgcmVjZWl2ZSBhbiBhcnJheSBvciBhbiBzdHJpbmcgYXMgYSB2YWx1ZS4nXG4gICAgICAgICk7XG4gICAgICB9XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuXG4gICAgcmV0dXJuIChbXS5jb25jYXQoZmVhdHVyZVRvZ2dsZSkgYXMgc3RyaW5nW10pLmV2ZXJ5KCh0b2dnbGUpID0+XG4gICAgICB0b2dnbGVbMF0gPT09ICchJyA/ICFpc09uKHRvZ2dsZS5yZXBsYWNlKCchJywgJycpKSA6IGlzT24odG9nZ2xlKVxuICAgICk7XG4gIH1cbn1cbiJdfQ==

@@ -7,5 +7,3 @@ /*

export * from './lib/ngx-feature-toggle.module';
export * from './lib/ngx-feature-toggle-can-activate-guard.router';
export * from './lib/ngx-feature-toggle-can-activate-child-guard.router';
export * from './lib/ngx-feature-toggle-can-load-guard.router';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1mZWF0dXJlLXRvZ2dsZS8iLCJzb3VyY2VzIjpbInB1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLG9DQUFvQyxDQUFDO0FBQ25ELGNBQWMsNkNBQTZDLENBQUM7QUFDNUQsY0FBYyxpQ0FBaUMsQ0FBQztBQUNoRCxjQUFjLG9EQUFvRCxDQUFDO0FBQ25FLGNBQWMsMERBQTBELENBQUM7QUFDekUsY0FBYyxnREFBZ0QsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2Ygbmd4LWZlYXR1cmUtdG9nZ2xlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd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wcm92aWRlci5jb21wb25lbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtZmVhdHVyZS10b2dnbGUtcm91dGUtZ3VhcmQucm91dGVyJztcbiJdfQ==

@@ -34,9 +34,9 @@ import { __decorate, __metadata } from 'tslib';

isOnCheck(featureToggle) {
const DEV_MODE = isDevMode();
if (typeof featureToggle === 'string' || Array.isArray(featureToggle)) {
return [].concat(featureToggle).every((toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
if (typeof featureToggle !== 'string' && !Array.isArray(featureToggle)) {
if (isDevMode()) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return false;
}
else if (DEV_MODE) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return [].concat(featureToggle).every((toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
}

@@ -106,3 +106,3 @@ };

let NgxFeatureToggleCanActivateGuard = class NgxFeatureToggleCanActivateGuard {
let NgxFeatureToggleRouteGuard = class NgxFeatureToggleRouteGuard {
constructor(router) {

@@ -114,4 +114,3 @@ this.router = router;

}
canActivate(route) {
const DEV_MODE = this.isDevMode();
isOnCheck(route) {
if (!route ||

@@ -121,40 +120,6 @@ !route.data ||

!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}
const hasAllTogglesOn = [].concat(route.data.featureToggle).every((toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
if (!hasAllTogglesOn && route.data.redirectTo) {
this.router.navigate([].concat(route.data.redirectTo));
}
return hasAllTogglesOn;
}
};
NgxFeatureToggleCanActivateGuard.ctorParameters = () => [
{ type: Router }
];
NgxFeatureToggleCanActivateGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateGuard_Factory() { return new NgxFeatureToggleCanActivateGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleCanActivateGuard, providedIn: "root" });
NgxFeatureToggleCanActivateGuard = __decorate([
Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [Router])
], NgxFeatureToggleCanActivateGuard);
let NgxFeatureToggleCanActivateChildGuard = class NgxFeatureToggleCanActivateChildGuard {
constructor(router) {
this.router = router;
}
isDevMode() {
return isDevMode();
}
canActivateChild(route) {
const DEV_MODE = this.isDevMode();
if (!route ||
!route.data ||
(typeof route.data.featureToggle !== 'string' &&
!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
if (this.isDevMode()) {
console.error(
// tslint:disable-next-line: max-line-length
'`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
'`NgxFeatureToggleRouteGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}

@@ -169,45 +134,20 @@ return false;

}
};
NgxFeatureToggleCanActivateChildGuard.ctorParameters = () => [
{ type: Router }
];
NgxFeatureToggleCanActivateChildGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateChildGuard_Factory() { return new NgxFeatureToggleCanActivateChildGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleCanActivateChildGuard, providedIn: "root" });
NgxFeatureToggleCanActivateChildGuard = __decorate([
Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [Router])
], NgxFeatureToggleCanActivateChildGuard);
let NgxFeatureToggleCanLoadGuard = class NgxFeatureToggleCanLoadGuard {
constructor(router) {
this.router = router;
canLoad(route) {
return this.isOnCheck(route);
}
isDevMode() {
return isDevMode();
canActivateChild(route) {
return this.isOnCheck(route);
}
canLoad(route) {
const DEV_MODE = this.isDevMode();
if (!route ||
!route.data ||
(typeof route.data.featureToggle !== 'string' &&
!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}
const hasAllTogglesOn = [].concat(route.data.featureToggle).every((toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
if (!hasAllTogglesOn && route.data.redirectTo) {
this.router.navigate([].concat(route.data.redirectTo));
}
return hasAllTogglesOn;
canActivate(route) {
return this.isOnCheck(route);
}
};
NgxFeatureToggleCanLoadGuard.ctorParameters = () => [
NgxFeatureToggleRouteGuard.ctorParameters = () => [
{ type: Router }
];
NgxFeatureToggleCanLoadGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanLoadGuard_Factory() { return new NgxFeatureToggleCanLoadGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleCanLoadGuard, providedIn: "root" });
NgxFeatureToggleCanLoadGuard = __decorate([
NgxFeatureToggleRouteGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleRouteGuard_Factory() { return new NgxFeatureToggleRouteGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleRouteGuard, providedIn: "root" });
NgxFeatureToggleRouteGuard = __decorate([
Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [Router])
], NgxFeatureToggleCanLoadGuard);
], NgxFeatureToggleRouteGuard);

@@ -222,3 +162,3 @@ /*

export { FeatureToggleDirective, FeatureToggleModule, FeatureToggleProviderComponent, NgxFeatureToggleCanActivateChildGuard, NgxFeatureToggleCanActivateGuard, NgxFeatureToggleCanLoadGuard };
export { FeatureToggleDirective, FeatureToggleModule, FeatureToggleProviderComponent, NgxFeatureToggleRouteGuard };
//# sourceMappingURL=ngx-feature-toggle.js.map

@@ -34,11 +34,11 @@ import { __decorate, __metadata } from 'tslib';

FeatureToggleDirective.prototype.isOnCheck = function (featureToggle) {
var DEV_MODE = isDevMode();
if (typeof featureToggle === 'string' || Array.isArray(featureToggle)) {
return [].concat(featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
if (typeof featureToggle !== 'string' && !Array.isArray(featureToggle)) {
if (isDevMode()) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return false;
}
else if (DEV_MODE) {
console.error('`NgxFeatureToggle`: `featureToggle` should receive an array or an string as a value.');
}
return [].concat(featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
};

@@ -113,11 +113,10 @@ FeatureToggleDirective.ctorParameters = function () { return [

var NgxFeatureToggleCanActivateGuard = /** @class */ (function () {
function NgxFeatureToggleCanActivateGuard(router) {
var NgxFeatureToggleRouteGuard = /** @class */ (function () {
function NgxFeatureToggleRouteGuard(router) {
this.router = router;
}
NgxFeatureToggleCanActivateGuard.prototype.isDevMode = function () {
NgxFeatureToggleRouteGuard.prototype.isDevMode = function () {
return isDevMode();
};
NgxFeatureToggleCanActivateGuard.prototype.canActivate = function (route) {
var DEV_MODE = this.isDevMode();
NgxFeatureToggleRouteGuard.prototype.isOnCheck = function (route) {
if (!route ||

@@ -127,43 +126,6 @@ !route.data ||

!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}
var hasAllTogglesOn = [].concat(route.data.featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
if (!hasAllTogglesOn && route.data.redirectTo) {
this.router.navigate([].concat(route.data.redirectTo));
}
return hasAllTogglesOn;
};
NgxFeatureToggleCanActivateGuard.ctorParameters = function () { return [
{ type: Router }
]; };
NgxFeatureToggleCanActivateGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateGuard_Factory() { return new NgxFeatureToggleCanActivateGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleCanActivateGuard, providedIn: "root" });
NgxFeatureToggleCanActivateGuard = __decorate([
Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [Router])
], NgxFeatureToggleCanActivateGuard);
return NgxFeatureToggleCanActivateGuard;
}());
var NgxFeatureToggleCanActivateChildGuard = /** @class */ (function () {
function NgxFeatureToggleCanActivateChildGuard(router) {
this.router = router;
}
NgxFeatureToggleCanActivateChildGuard.prototype.isDevMode = function () {
return isDevMode();
};
NgxFeatureToggleCanActivateChildGuard.prototype.canActivateChild = function (route) {
var DEV_MODE = this.isDevMode();
if (!route ||
!route.data ||
(typeof route.data.featureToggle !== 'string' &&
!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
if (this.isDevMode()) {
console.error(
// tslint:disable-next-line: max-line-length
'`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
'`NgxFeatureToggleRouteGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}

@@ -180,48 +142,20 @@ return false;

};
NgxFeatureToggleCanActivateChildGuard.ctorParameters = function () { return [
{ type: Router }
]; };
NgxFeatureToggleCanActivateChildGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateChildGuard_Factory() { return new NgxFeatureToggleCanActivateChildGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleCanActivateChildGuard, providedIn: "root" });
NgxFeatureToggleCanActivateChildGuard = __decorate([
Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [Router])
], NgxFeatureToggleCanActivateChildGuard);
return NgxFeatureToggleCanActivateChildGuard;
}());
var NgxFeatureToggleCanLoadGuard = /** @class */ (function () {
function NgxFeatureToggleCanLoadGuard(router) {
this.router = router;
}
NgxFeatureToggleCanLoadGuard.prototype.isDevMode = function () {
return isDevMode();
NgxFeatureToggleRouteGuard.prototype.canLoad = function (route) {
return this.isOnCheck(route);
};
NgxFeatureToggleCanLoadGuard.prototype.canLoad = function (route) {
var DEV_MODE = this.isDevMode();
if (!route ||
!route.data ||
(typeof route.data.featureToggle !== 'string' &&
!Array.isArray(route.data.featureToggle))) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}
var hasAllTogglesOn = [].concat(route.data.featureToggle).every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
if (!hasAllTogglesOn && route.data.redirectTo) {
this.router.navigate([].concat(route.data.redirectTo));
}
return hasAllTogglesOn;
NgxFeatureToggleRouteGuard.prototype.canActivateChild = function (route) {
return this.isOnCheck(route);
};
NgxFeatureToggleCanLoadGuard.ctorParameters = function () { return [
NgxFeatureToggleRouteGuard.prototype.canActivate = function (route) {
return this.isOnCheck(route);
};
NgxFeatureToggleRouteGuard.ctorParameters = function () { return [
{ type: Router }
]; };
NgxFeatureToggleCanLoadGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanLoadGuard_Factory() { return new NgxFeatureToggleCanLoadGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleCanLoadGuard, providedIn: "root" });
NgxFeatureToggleCanLoadGuard = __decorate([
NgxFeatureToggleRouteGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleRouteGuard_Factory() { return new NgxFeatureToggleRouteGuard(ɵɵinject(Router)); }, token: NgxFeatureToggleRouteGuard, providedIn: "root" });
NgxFeatureToggleRouteGuard = __decorate([
Injectable({ providedIn: 'root' }),
__metadata("design:paramtypes", [Router])
], NgxFeatureToggleCanLoadGuard);
return NgxFeatureToggleCanLoadGuard;
], NgxFeatureToggleRouteGuard);
return NgxFeatureToggleRouteGuard;
}());

@@ -237,3 +171,3 @@

export { FeatureToggleDirective, FeatureToggleModule, FeatureToggleProviderComponent, NgxFeatureToggleCanActivateChildGuard, NgxFeatureToggleCanActivateGuard, NgxFeatureToggleCanLoadGuard };
export { FeatureToggleDirective, FeatureToggleModule, FeatureToggleProviderComponent, NgxFeatureToggleRouteGuard };
//# sourceMappingURL=ngx-feature-toggle.js.map

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"FeatureToggleDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":12,"character":1},"arguments":[{"selector":"[featureToggle]"}]}],"members":{"featureToggle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":22,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"shouldRender":[{"__symbolic":"method"}],"isOnCheck":[{"__symbolic":"method"}]}},"FeatureToggleProviderComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":3,"character":1},"arguments":[{"selector":"feature-toggle-provider","template":"<ng-content></ng-content>"}]}],"members":{"features":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":8,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"setFeatureToggles":[{"__symbolic":"method"}]}},"FeatureToggleModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":5,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"FeatureToggleProviderComponent"},{"__symbolic":"reference","name":"FeatureToggleDirective"}],"exports":[{"__symbolic":"reference","name":"FeatureToggleProviderComponent"},{"__symbolic":"reference","name":"FeatureToggleDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":12}]}]}],"members":{}},"NgxFeatureToggleCanActivateGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":11,"character":30}]}],"isDevMode":[{"__symbolic":"method"}],"canActivate":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"NgxFeatureToggleCanActivateChildGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":11,"character":30}]}],"isDevMode":[{"__symbolic":"method"}],"canActivateChild":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"NgxFeatureToggleCanLoadGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":4,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":6,"character":30}]}],"isDevMode":[{"__symbolic":"method"}],"canLoad":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"FeatureToggleDirective":"./lib/ngx-feature-toggle.directive","FeatureToggleProviderComponent":"./lib/ngx-feature-toggle-provider.component","FeatureToggleModule":"./lib/ngx-feature-toggle.module","NgxFeatureToggleCanActivateGuard":"./lib/ngx-feature-toggle-can-activate-guard.router","NgxFeatureToggleCanActivateChildGuard":"./lib/ngx-feature-toggle-can-activate-child-guard.router","NgxFeatureToggleCanLoadGuard":"./lib/ngx-feature-toggle-can-load-guard.router"},"importAs":"ngx-feature-toggle"}
{"__symbolic":"module","version":4,"metadata":{"FeatureToggleDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":12,"character":1},"arguments":[{"selector":"[featureToggle]"}]}],"members":{"featureToggle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":22,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"shouldRender":[{"__symbolic":"method"}],"isOnCheck":[{"__symbolic":"method"}]}},"FeatureToggleProviderComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":3,"character":1},"arguments":[{"selector":"feature-toggle-provider","template":"<ng-content></ng-content>"}]}],"members":{"features":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":8,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"setFeatureToggles":[{"__symbolic":"method"}]}},"FeatureToggleModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":5,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"FeatureToggleProviderComponent"},{"__symbolic":"reference","name":"FeatureToggleDirective"}],"exports":[{"__symbolic":"reference","name":"FeatureToggleProviderComponent"},{"__symbolic":"reference","name":"FeatureToggleDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":12}]}]}],"members":{}},"NgxFeatureToggleRouteGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":14,"character":30}]}],"isDevMode":[{"__symbolic":"method"}],"isOnCheck":[{"__symbolic":"method"}],"canLoad":[{"__symbolic":"method"}],"canActivateChild":[{"__symbolic":"method"}],"canActivate":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"FeatureToggleDirective":"./lib/ngx-feature-toggle.directive","FeatureToggleProviderComponent":"./lib/ngx-feature-toggle-provider.component","FeatureToggleModule":"./lib/ngx-feature-toggle.module","NgxFeatureToggleRouteGuard":"./lib/ngx-feature-toggle-route-guard.router"},"importAs":"ngx-feature-toggle"}

@@ -5,3 +5,3 @@ {

"author": "Will Mendes <willmendesneto@gmail.com>",
"version": "10.1.0",
"version": "11.0.0",
"keywords": [

@@ -8,0 +8,0 @@ "angular",

export * from './lib/ngx-feature-toggle.directive';
export * from './lib/ngx-feature-toggle-provider.component';
export * from './lib/ngx-feature-toggle.module';
export * from './lib/ngx-feature-toggle-can-activate-guard.router';
export * from './lib/ngx-feature-toggle-can-activate-child-guard.router';
export * from './lib/ngx-feature-toggle-can-load-guard.router';
export * from './lib/ngx-feature-toggle-route-guard.router';

@@ -173,3 +173,3 @@ # NGX Feature Toggle

Also, you can use `NgxFeatureToggleCanActivateGuard` to check if the route should be activated or not by passing the class and configuration of the feature toggle to be checked in your route data.
Also, you can use `NgxFeatureToggleRouteGuard` to check if the route should be activated or not by passing the class and configuration of the feature toggle to be checked in your route data.

@@ -183,3 +183,3 @@ ```js

component: HomeComponent,
canActivate: [NgxFeatureToggleCanActivateGuard],
canActivate: [NgxFeatureToggleRouteGuard],
data: {

@@ -199,3 +199,3 @@ // Using array as configuration

component: DashboardComponent,
canActivate: [NgxFeatureToggleCanActivateGuard],
canActivate: [NgxFeatureToggleRouteGuard],
data: {

@@ -218,3 +218,3 @@ // Using string as configuration

component: HomeComponent,
canActivate: [NgxFeatureToggleCanActivateGuard],
canActivate: [NgxFeatureToggleRouteGuard],
data: {

@@ -234,3 +234,3 @@ // Using array as configuration

component: DashboardComponent,
canActivate: [NgxFeatureToggleCanActivateGuard],
canActivate: [NgxFeatureToggleRouteGuard],
data: {

@@ -247,3 +247,3 @@ // Using string as configuration

Use `NgxFeatureToggleCanActivateChildGuard` to control when the child component of a specific component can be activate via routing. It can be passed as an array of items.
Use `NgxFeatureToggleRouteGuard` to control when the child component of a specific component can be activate via routing. It can be passed as an array of items.

@@ -256,3 +256,3 @@ ```js

component: CustomerComponent,
canActivateChild: [NgxFeatureToggleCanActivateChildGuard],
canActivateChild: [NgxFeatureToggleRouteGuard],
children: [

@@ -279,3 +279,3 @@ {

component: DashboardComponent,
canActivateChild: [NgxFeatureToggleCanActivateChildGuard],
canActivateChild: [NgxFeatureToggleRouteGuard],
children: [

@@ -311,4 +311,5 @@ {

component: CustomerComponent,
canActivate: [NgxFeatureToggleCanActivateGuard],
canActivateChild: [NgxFeatureToggleCanActivateChildGuard],
canLoad: [NgxFeatureToggleRouteGuard],
canActivate: [NgxFeatureToggleRouteGuard],
canActivateChild: [NgxFeatureToggleRouteGuard],
// This is the featureToggle configuration for

@@ -315,0 +316,0 @@ // the parent component

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc