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 7.4.4 to 7.4.5

134

bundles/ngx-feature-toggle.umd.js

@@ -239,3 +239,3 @@ (function (global, factory) {

FeatureToggleDirective.prototype.ngDoCheck = function () {
if (this.isOn !== featureToggleService.isOn(this.featureToggle)) {
if (this.isOn !== this.isOnCheck(this.featureToggle)) {
this.shouldRender();

@@ -245,3 +245,3 @@ }

FeatureToggleDirective.prototype.shouldRender = function () {
this.isOn = featureToggleService.isOn(this.featureToggle);
this.isOn = this.isOnCheck(this.featureToggle);
if (this.isOn) {

@@ -254,2 +254,17 @@ this.viewContainer.createEmbeddedView(this.templateRef);

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

@@ -261,3 +276,3 @@ { type: core.TemplateRef },

core.Input(),
__metadata("design:type", String)
__metadata("design:type", Object)
], FeatureToggleDirective.prototype, "featureToggle", void 0);

@@ -275,47 +290,2 @@ FeatureToggleDirective = __decorate([

var FeatureToggleWhenDisabledDirective = /** @class */ (function () {
function FeatureToggleWhenDisabledDirective(templateRef, viewContainer) {
this.templateRef = templateRef;
this.viewContainer = viewContainer;
this.isOn = false;
}
FeatureToggleWhenDisabledDirective.prototype.ngOnInit = function () {
if (!this.featureToggleWhenDisabled) {
throw new Error('Attribute `featureToggleWhenDisabled` should not be null or empty');
}
this.shouldRender();
};
FeatureToggleWhenDisabledDirective.prototype.ngDoCheck = function () {
if (this.isOn !== featureToggleService.isOn(this.featureToggleWhenDisabled)) {
this.shouldRender();
}
};
FeatureToggleWhenDisabledDirective.prototype.shouldRender = function () {
this.isOn = featureToggleService.isOn(this.featureToggleWhenDisabled);
if (!this.isOn) {
this.viewContainer.createEmbeddedView(this.templateRef);
}
else {
this.viewContainer.clear();
}
};
FeatureToggleWhenDisabledDirective.ctorParameters = function () { return [
{ type: core.TemplateRef },
{ type: core.ViewContainerRef }
]; };
__decorate([
core.Input(),
__metadata("design:type", String)
], FeatureToggleWhenDisabledDirective.prototype, "featureToggleWhenDisabled", void 0);
FeatureToggleWhenDisabledDirective = __decorate([
core.Directive({
// tslint:disable-next-line: directive-selector
selector: '[featureToggleWhenDisabled]',
}),
__metadata("design:paramtypes", [core.TemplateRef,
core.ViewContainerRef])
], FeatureToggleWhenDisabledDirective);
return FeatureToggleWhenDisabledDirective;
}());
var FeatureToggleProviderComponent = /** @class */ (function () {

@@ -359,4 +329,4 @@ function FeatureToggleProviderComponent() {

core.NgModule({
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective],
imports: [common.CommonModule],

@@ -382,12 +352,15 @@ })

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -415,12 +388,15 @@ NgxFeatureToggleCanActivateGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateGuard_Factory() { return new NgxFeatureToggleCanActivateGuard(); }, token: NgxFeatureToggleCanActivateGuard, providedIn: "root" });

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -448,12 +424,15 @@ NgxFeatureToggleCanActivateChildGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateChildGuard_Factory() { return new NgxFeatureToggleCanActivateChildGuard(); }, token: NgxFeatureToggleCanActivateChildGuard, providedIn: "root" });

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !featureToggleService.isOn(toggle.replace('!', '')) : featureToggleService.isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -470,3 +449,2 @@ NgxFeatureToggleCanLoadGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanLoadGuard_Factory() { return new NgxFeatureToggleCanLoadGuard(); }, token: NgxFeatureToggleCanLoadGuard, providedIn: "root" });

exports.FeatureToggleProviderComponent = FeatureToggleProviderComponent;
exports.FeatureToggleWhenDisabledDirective = FeatureToggleWhenDisabledDirective;
exports.NgxFeatureToggleCanActivateChildGuard = NgxFeatureToggleCanActivateChildGuard;

@@ -473,0 +451,0 @@ exports.NgxFeatureToggleCanActivateGuard = NgxFeatureToggleCanActivateGuard;

@@ -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")):"function"==typeof define&&define.amd?define("ngx-feature-toggle",["exports","@angular/core","feature-toggle-service","@angular/common"],t):t((e=e||self)["ngx-feature-toggle"]={},e.ng.core,e.FeatureToggleService,e.ng.common)}(this,(function(e,t,r,o){"use strict";

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

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

## [7.4.5][] - 2020-06-13
### Added
- Adding support for accept array or string as feature toggle configuration of
- `NgxFeatureToggleCanLoadGuard`
- `NgxFeatureToggleCanActivateGuard`
- `NgxFeatureToggleCanActivateChildGuard`
- `*featureToggle` now supports a string or an array of toggles to be checked
```html
<div
class="feature-toggle-enabled-with-exclamation-mark"
*featureToggle="'enableFirstText'"
>
Feature toggle is enabled if `enableFirstText` is true
</div>
<div
class="feature-toggle-enabled-with-exclamation-mark"
*featureToggle="['enableFirstText', 'enableSecondText']"
>
Feature toggle is enabled if both feature toggles are true
</div>
```
### Updated
- Breaking changes:
- `*featureToggleWhenDisabled` directive was removed since we can have the same behavior by using `*featureToggle` directive and passing `!` as a prefix for the feature toggle.
```html
<div
class="feature-toggle-enabled-with-exclamation-mark"
*featureToggle="'enableFirstText'"
>
Feature toggle is enabled
</div>
<div
class="feature-toggle-enabled-with-exclamation-mark"
*featureToggle="'!enableFirstText'"
>
Feature toggle disabled since it's enabled and it has <b>!</b> at front.
</div>
```
## [7.4.4][] - 2020-06-01

@@ -339,5 +387,7 @@

[7.4.3]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v7.4.3
[unreleased]: https://github.com/willmendesneto/ngx-feature-toggle/compare/v7.4.4...HEAD
[7.4.4]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v7.4.4
[Unreleased]: https://github.com/willmendesneto/ngx-feature-toggle/compare/v7.4.4...HEAD
[7.4.4]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v7.4.4
[Unreleased]: https://github.com/willmendesneto/ngx-feature-toggle/compare/v7.4.5...HEAD
[7.4.5]: https://github.com/willmendesneto/ngx-feature-toggle/tree/v7.4.5

@@ -17,10 +17,13 @@ import { __decorate } from "tslib";

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
const isFeatureToggleOn = (toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
const userCanAccess = route.data.featureToggle.every(toggle => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}

@@ -33,2 +36,2 @@ };

export { NgxFeatureToggleCanActivateChildGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWZlYXR1cmUtdG9nZ2xl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Xkocm91dGUuZGF0YS5mZWF0dXJlVG9nZ2xlKSkge1xuICAgICAgcmV0dXJuIChyb3V0ZS5kYXRhLmZlYXR1cmVUb2dnbGUgYXMgc3RyaW5nW10pLmV2ZXJ5KGlzRmVhdHVyZVRvZ2dsZU9uKTtcbiAgICB9XG5cbiAgICBpZiAoREVWX01PREUpIHtcbiAgICAgIGNvbnNvbGUuZXJyb3IoXG4gICAgICAgICdgTmd4RmVhdHVyZVRvZ2dsZUNhbkFjdGl2YXRlQ2hpbGRHdWFyZGAgbmVlZCB0byByZWNlaXZlIGBmZWF0dXJlVG9nZ2xlYCBhcyBkYXRhIGFzIGFuIGFycmF5IG9yIHN0cmluZyBpbiB5b3VyIHJvdXRlIGNvbmZpZ3VyYXRpb24uJ1xuICAgICAgKTtcbiAgICB9XG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG59XG4iXX0=

@@ -17,10 +17,13 @@ import { __decorate } from "tslib";

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
const isFeatureToggleOn = (toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
const userCanAccess = route.data.featureToggle.every(toggle => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}

@@ -33,2 +36,2 @@ };

export { NgxFeatureToggleCanActivateGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1hY3RpdmF0ZS1ndWFyZC5yb3V0ZXIu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YgKERFVl9NT0RFKSB7XG4gICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAnYE5neEZlYXR1cmVUb2dnbGVDYW5BY3RpdmF0ZUd1YXJkYCBuZWVkIHRvIHJlY2VpdmUgYGZlYXR1cmVUb2dnbGVgIGFzIGRhdGEgYXMgYW4gYXJyYXkgb3Igc3RyaW5nIGluIHlvdXIgcm91dGUgY29uZmlndXJhdGlvbi4nXG4gICAgICApO1xuICAgIH1cbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cbn1cbiJdfQ==

@@ -17,10 +17,13 @@ import { __decorate } from "tslib";

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
const isFeatureToggleOn = (toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
const userCanAccess = route.data.featureToggle.every(toggle => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}

@@ -33,2 +36,2 @@ };

export { NgxFeatureToggleCanLoadGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1sb2FkLWd1YXJkLnJvdXRlci5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1mZWF0dXJlLXRvZ2dsZS8iLCJzb3VyY2VzIjpbImxpYi9uZ3gtZmVhdHVyZS10b2dnbGUtY2FuLWxvYWQtZ3VhcmQucm91dGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxPQUFPLEV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2dsZWAgYXMgZGF0YSBpbiB5b3VyIHJvdXRlIGNvbmZpZ3VyYXRpb24uJ1xuICAgICAgICApO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIGNvbnN0IGlzRmVhdHVyZVRvZ2dsZU9uID0gKHRvZ2dsZSkgPT5cbiAgICAgIHRvZ2dsZVswXSA9PT0gJyEnID8gIWlzT24odG9nZ2xlLnJlcGxhY2UoJyEnLCAnJykpIDogaXNPbih0b2dnbGUpO1xuXG4gICAgaWYgKHR5cGVvZiByb3V0ZS5kYXRhLmZlYXR1cmVUb2dnbGUgPT09ICdzdHJpbmcnKSB7XG4gICAgICByZXR1cm4gaXNGZWF0dXJlVG9nZ2xlT24ocm91dGUuZGF0YS5mZWF0dXJlVG9nZ2xlIGFzIHN0cmluZyk7XG4gICAgfSBlbHNlIGlmIChBcnJheS5pc0FycmF5KHJvdXRlLmRhdGEuZmVhdHVyZVRvZ2dsZSkpIHtcbiAgICAgIHJldHVybiAocm91dGUuZGF0YS5mZWF0dXJlVG9nZ2xlIGFzIHN0cmluZ1tdKS5ldmVyeShpc0ZlYXR1cmVUb2dnbGVPbik7XG4gICAgfVxuXG4gICAgaWYgKERFVl9NT0RFKSB7XG4gICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAnYE5neEZlYXR1cmVUb2dnbGVDYW5Mb2FkR3VhcmRgIG5lZWQgdG8gcmVjZWl2ZSBgZmVhdHVyZVRvZ2dsZWAgYXMgZGF0YSBhcyBhbiBhcnJheSBvciBzdHJpbmcgaW4geW91ciByb3V0ZSBjb25maWd1cmF0aW9uLidcbiAgICAgICk7XG4gICAgfVxuXG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG59XG4iXX0=
import { __decorate, __metadata } from "tslib";
import { Directive, Input, OnInit, TemplateRef, ViewContainerRef, DoCheck, } from '@angular/core';
import { Directive, Input, OnInit, TemplateRef, ViewContainerRef, DoCheck, isDevMode, } from '@angular/core';
import { isOn } from 'feature-toggle-service';

@@ -17,3 +17,3 @@ let FeatureToggleDirective = class FeatureToggleDirective {

ngDoCheck() {
if (this.isOn !== isOn(this.featureToggle)) {
if (this.isOn !== this.isOnCheck(this.featureToggle)) {
this.shouldRender();

@@ -23,3 +23,3 @@ }

shouldRender() {
this.isOn = isOn(this.featureToggle);
this.isOn = this.isOnCheck(this.featureToggle);
if (this.isOn) {

@@ -32,2 +32,15 @@ this.viewContainer.createEmbeddedView(this.templateRef);

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

@@ -40,3 +53,3 @@ FeatureToggleDirective.ctorParameters = () => [

Input(),
__metadata("design:type", String)
__metadata("design:type", Object)
], FeatureToggleDirective.prototype, "featureToggle", void 0);

@@ -52,2 +65,2 @@ FeatureToggleDirective = __decorate([

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

@@ -6,3 +6,2 @@ import { __decorate } from "tslib";

import { FeatureToggleDirective } from './ngx-feature-toggle.directive';
import { FeatureToggleWhenDisabledDirective } from './ngx-feature-toggle-when-disabled.directive';
let FeatureToggleModule = class FeatureToggleModule {

@@ -12,4 +11,4 @@ };

NgModule({
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective],
imports: [CommonModule],

@@ -19,2 +18,2 @@ })

export { FeatureToggleModule };
//# sour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lY3RpdmVdLFxuICBpbXBvcnRzOiBbQ29tbW9uTW9kdWxlXSxcbn0pXG5leHBvcnQgY2xhc3MgRmVhdHVyZVRvZ2dsZU1vZHVsZSB7fVxuIl19

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

export * from './lib/ngx-feature-toggle.directive';
export * from './lib/ngx-feature-toggle-when-disabled.directive';
export * from './lib/ngx-feature-toggle-provider.component';

@@ -12,2 +11,2 @@ export * from './lib/ngx-feature-toggle.module';

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

@@ -19,12 +19,15 @@ import { __decorate } from "tslib";

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -38,2 +41,2 @@ NgxFeatureToggleCanActivateChildGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateChildGuard_Factory() { return new NgxFeatureToggleCanActivateChildGuard(); }, token: NgxFeatureToggleCanActivateChildGuard, providedIn: "root" });

export { NgxFeatureToggleCanActivateChildGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1hY3RpdmF0ZS1jaGlsZC1ndWFyZC5yb3V0ZXIuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ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AgICAgIHJldHVybiAocm91dGUuZGF0YS5mZWF0dXJlVG9nZ2xlIGFzIHN0cmluZ1tdKS5ldmVyeShpc0ZlYXR1cmVUb2dnbGVPbik7XG4gICAgfVxuXG4gICAgaWYgKERFVl9NT0RFKSB7XG4gICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAnYE5neEZlYXR1cmVUb2dnbGVDYW5BY3RpdmF0ZUNoaWxkR3VhcmRgIG5lZWQgdG8gcmVjZWl2ZSBgZmVhdHVyZVRvZ2dsZWAgYXMgZGF0YSBhcyBhbiBhcnJheSBvciBzdHJpbmcgaW4geW91ciByb3V0ZSBjb25maWd1cmF0aW9uLidcbiAgICAgICk7XG4gICAgfVxuICAgIHJldHVybiBmYWxzZTtcbiAgfVxufVxuIl19

@@ -19,12 +19,15 @@ import { __decorate } from "tslib";

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -38,2 +41,2 @@ NgxFeatureToggleCanActivateGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateGuard_Factory() { return new NgxFeatureToggleCanActivateGuard(); }, token: NgxFeatureToggleCanActivateGuard, providedIn: "root" });

export { NgxFeatureToggleCanActivateGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW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AgIHJldHVybiAocm91dGUuZGF0YS5mZWF0dXJlVG9nZ2xlIGFzIHN0cmluZ1tdKS5ldmVyeShpc0ZlYXR1cmVUb2dnbGVPbik7XG4gICAgfVxuXG4gICAgaWYgKERFVl9NT0RFKSB7XG4gICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAnYE5neEZlYXR1cmVUb2dnbGVDYW5BY3RpdmF0ZUd1YXJkYCBuZWVkIHRvIHJlY2VpdmUgYGZlYXR1cmVUb2dnbGVgIGFzIGRhdGEgYXMgYW4gYXJyYXkgb3Igc3RyaW5nIGluIHlvdXIgcm91dGUgY29uZmlndXJhdGlvbi4nXG4gICAgICApO1xuICAgIH1cbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cbn1cbiJdfQ==

@@ -19,12 +19,15 @@ import { __decorate } from "tslib";

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -38,2 +41,2 @@ NgxFeatureToggleCanLoadGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanLoadGuard_Factory() { return new NgxFeatureToggleCanLoadGuard(); }, token: NgxFeatureToggleCanLoadGuard, providedIn: "root" });

export { NgxFeatureToggleCanLoadGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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SBgZmVhdHVyZVRvZ2dsZWAgYXMgZGF0YSBhcyBhbiBhcnJheSBvciBzdHJpbmcgaW4geW91ciByb3V0ZSBjb25maWd1cmF0aW9uLidcbiAgICAgICk7XG4gICAgfVxuXG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG59XG4iXX0=
import { __decorate, __metadata } from "tslib";
import { Directive, Input, OnInit, TemplateRef, ViewContainerRef, DoCheck, } from '@angular/core';
import { Directive, Input, OnInit, TemplateRef, ViewContainerRef, DoCheck, isDevMode, } from '@angular/core';
import { isOn } from 'feature-toggle-service';

@@ -17,3 +17,3 @@ var FeatureToggleDirective = /** @class */ (function () {

FeatureToggleDirective.prototype.ngDoCheck = function () {
if (this.isOn !== isOn(this.featureToggle)) {
if (this.isOn !== this.isOnCheck(this.featureToggle)) {
this.shouldRender();

@@ -23,3 +23,3 @@ }

FeatureToggleDirective.prototype.shouldRender = function () {
this.isOn = isOn(this.featureToggle);
this.isOn = this.isOnCheck(this.featureToggle);
if (this.isOn) {

@@ -32,2 +32,17 @@ this.viewContainer.createEmbeddedView(this.templateRef);

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

@@ -39,3 +54,3 @@ { type: TemplateRef },

Input(),
__metadata("design:type", String)
__metadata("design:type", Object)
], FeatureToggleDirective.prototype, "featureToggle", void 0);

@@ -53,2 +68,2 @@ FeatureToggleDirective = __decorate([

export { FeatureToggleDirective };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWZlYXR1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iAgICB9XG4gIH1cbn1cbiJdfQ==

@@ -6,3 +6,2 @@ import { __decorate } from "tslib";

import { FeatureToggleDirective } from './ngx-feature-toggle.directive';
import { FeatureToggleWhenDisabledDirective } from './ngx-feature-toggle-when-disabled.directive';
var FeatureToggleModule = /** @class */ (function () {

@@ -13,4 +12,4 @@ function FeatureToggleModule() {

NgModule({
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective],
imports: [CommonModule],

@@ -22,2 +21,2 @@ })

export { FeatureToggleModule };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWZlYXR1cmUtdG9nZ2xlLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1mZWF0dXJlLXRvZ2dsZS8iLCJzb3VyY2VzIjpbImxpYi9uZ3gtZmVhdHVyZS10b2dnbGUubW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUMvQyxPQUFPLEVBQUUsOEJBQThCLEVBQUUsTUFBTSx5Q0FBeUMsQ0FBQztBQUN6RixPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN4RSxPQUFPLEVBQUUsa0NBQWtDLEVBQUUsTUFBTSw4Q0FBOEMsQ0FBQztBQU9sRztJQUFBO0lBQW1DLENBQUM7SUFBdkIsbUJBQW1CO1FBTC9CLFFBQVEsQ0FBQztZQUNSLFlBQVksRUFBRSxDQUFDLDhCQUE4QixFQUFFLHNCQUF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ZVRvZ2dsZVByb3ZpZGVyQ29tcG9uZW50IH0gZnJvbSAnLi9uZ3gtZmVhdHVyZS10b2dnbGUtcHJvdmlkZXIuY29tcG9uZW50JztcbmltcG9ydCB7IEZlYXR1cmVUb2dnbGVEaXJlY3RpdmUgfSBmcm9tICcuL25neC1mZWF0dXJlLXRvZ2dsZS5kaXJlY3RpdmUnO1xuXG5ATmdNb2R1bGUoe1xuICBkZWNsYXJhdGlvbnM6IFtGZWF0dXJlVG9nZ2xlUHJvdmlkZXJDb21wb25lbnQsIEZlYXR1cmVUb2dnbGVEaXJlY3RpdmVdLFxuICBleHBvcnRzOiBbRmVhdHVyZVRvZ2dsZVByb3ZpZGVyQ29tcG9uZW50LCBGZWF0dXJlVG9nZ2xlRGlyZWN0aXZlXSxcbiAgaW1wb3J0czogW0NvbW1vbk1vZHVsZV0sXG59KVxuZXhwb3J0IGNsYXNzIEZlYXR1cmVUb2dnbGVNb2R1bGUge31cbiJdfQ==

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

export * from './lib/ngx-feature-toggle.directive';
export * from './lib/ngx-feature-toggle-when-disabled.directive';
export * from './lib/ngx-feature-toggle-provider.component';

@@ -12,2 +11,2 @@ export * from './lib/ngx-feature-toggle.module';

export * from './lib/ngx-feature-toggle-can-load-guard.router';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1mZWF0dXJlLXRvZ2dsZS8iLCJzb3VyY2VzIjpbInB1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLG9DQUFvQyxDQUFDO0FBQ25ELGNBQWMsa0RBQWtELENBQUM7QUFDakUsY0FBYyw2Q0FBNkMsQ0FBQztBQUM1RCxjQUFjLGlDQUFpQyxDQUFDO0FBQ2hELGNBQWMsb0RBQW9ELENBQUM7QUFDbkUsY0FBYywwREFBMEQsQ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FDO0FBQ25FLGNBQWMsMERBQTBELENBQUM7QUFDekUsY0FBYyxnREFBZ0QsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2Ygbmd4LWZlYXR1cmUtdG9nZ2xlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLmRpcmVjdGl2ZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtZmVhdHVyZS10b2dnbGUtcHJvdmlkZXIuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1mZWF0dXJlLXRvZ2dsZS5tb2R1bGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1hY3RpdmF0ZS1ndWFyZC5yb3V0ZXInO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1hY3RpdmF0ZS1jaGlsZC1ndWFyZC5yb3V0ZXInO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWZlYXR1cmUtdG9nZ2xlLWNhbi1sb2FkLWd1YXJkLnJvdXRlcic7XG4iXX0=
import { __decorate, __metadata } from 'tslib';
import { TemplateRef, ViewContainerRef, Input, Directive, Component, NgModule, isDevMode, ɵɵdefineInjectable, Injectable } from '@angular/core';
import { isDevMode, TemplateRef, ViewContainerRef, Input, Directive, Component, NgModule, ɵɵdefineInjectable, Injectable } from '@angular/core';
import { isOn, set } from 'feature-toggle-service';

@@ -19,3 +19,3 @@ import { CommonModule } from '@angular/common';

ngDoCheck() {
if (this.isOn !== isOn(this.featureToggle)) {
if (this.isOn !== this.isOnCheck(this.featureToggle)) {
this.shouldRender();

@@ -25,3 +25,3 @@ }

shouldRender() {
this.isOn = isOn(this.featureToggle);
this.isOn = this.isOnCheck(this.featureToggle);
if (this.isOn) {

@@ -34,2 +34,15 @@ this.viewContainer.createEmbeddedView(this.templateRef);

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

@@ -42,3 +55,3 @@ FeatureToggleDirective.ctorParameters = () => [

Input(),
__metadata("design:type", String)
__metadata("design:type", Object)
], FeatureToggleDirective.prototype, "featureToggle", void 0);

@@ -54,46 +67,2 @@ FeatureToggleDirective = __decorate([

let FeatureToggleWhenDisabledDirective = class FeatureToggleWhenDisabledDirective {
constructor(templateRef, viewContainer) {
this.templateRef = templateRef;
this.viewContainer = viewContainer;
this.isOn = false;
}
ngOnInit() {
if (!this.featureToggleWhenDisabled) {
throw new Error('Attribute `featureToggleWhenDisabled` should not be null or empty');
}
this.shouldRender();
}
ngDoCheck() {
if (this.isOn !== isOn(this.featureToggleWhenDisabled)) {
this.shouldRender();
}
}
shouldRender() {
this.isOn = isOn(this.featureToggleWhenDisabled);
if (!this.isOn) {
this.viewContainer.createEmbeddedView(this.templateRef);
}
else {
this.viewContainer.clear();
}
}
};
FeatureToggleWhenDisabledDirective.ctorParameters = () => [
{ type: TemplateRef },
{ type: ViewContainerRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], FeatureToggleWhenDisabledDirective.prototype, "featureToggleWhenDisabled", void 0);
FeatureToggleWhenDisabledDirective = __decorate([
Directive({
// tslint:disable-next-line: directive-selector
selector: '[featureToggleWhenDisabled]',
}),
__metadata("design:paramtypes", [TemplateRef,
ViewContainerRef])
], FeatureToggleWhenDisabledDirective);
let FeatureToggleProviderComponent = class FeatureToggleProviderComponent {

@@ -137,4 +106,4 @@ constructor() {

NgModule({
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective],
imports: [CommonModule],

@@ -156,10 +125,13 @@ })

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
const isFeatureToggleOn = (toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
const userCanAccess = route.data.featureToggle.every(toggle => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}

@@ -184,10 +156,13 @@ };

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
const isFeatureToggleOn = (toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
const userCanAccess = route.data.featureToggle.every(toggle => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}

@@ -212,10 +187,13 @@ };

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
const isFeatureToggleOn = (toggle) => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
const userCanAccess = route.data.featureToggle.every(toggle => toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle));
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
}

@@ -236,3 +214,3 @@ };

export { FeatureToggleDirective, FeatureToggleModule, FeatureToggleProviderComponent, FeatureToggleWhenDisabledDirective, NgxFeatureToggleCanActivateChildGuard, NgxFeatureToggleCanActivateGuard, NgxFeatureToggleCanLoadGuard };
export { FeatureToggleDirective, FeatureToggleModule, FeatureToggleProviderComponent, NgxFeatureToggleCanActivateChildGuard, NgxFeatureToggleCanActivateGuard, NgxFeatureToggleCanLoadGuard };
//# sourceMappingURL=ngx-feature-toggle.js.map
import { __decorate, __metadata } from 'tslib';
import { TemplateRef, ViewContainerRef, Input, Directive, Component, NgModule, isDevMode, ɵɵdefineInjectable, Injectable } from '@angular/core';
import { isDevMode, TemplateRef, ViewContainerRef, Input, Directive, Component, NgModule, ɵɵdefineInjectable, Injectable } from '@angular/core';
import { isOn, set } from 'feature-toggle-service';

@@ -19,3 +19,3 @@ import { CommonModule } from '@angular/common';

FeatureToggleDirective.prototype.ngDoCheck = function () {
if (this.isOn !== isOn(this.featureToggle)) {
if (this.isOn !== this.isOnCheck(this.featureToggle)) {
this.shouldRender();

@@ -25,3 +25,3 @@ }

FeatureToggleDirective.prototype.shouldRender = function () {
this.isOn = isOn(this.featureToggle);
this.isOn = this.isOnCheck(this.featureToggle);
if (this.isOn) {

@@ -34,2 +34,17 @@ this.viewContainer.createEmbeddedView(this.templateRef);

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

@@ -41,3 +56,3 @@ { type: TemplateRef },

Input(),
__metadata("design:type", String)
__metadata("design:type", Object)
], FeatureToggleDirective.prototype, "featureToggle", void 0);

@@ -55,47 +70,2 @@ FeatureToggleDirective = __decorate([

var FeatureToggleWhenDisabledDirective = /** @class */ (function () {
function FeatureToggleWhenDisabledDirective(templateRef, viewContainer) {
this.templateRef = templateRef;
this.viewContainer = viewContainer;
this.isOn = false;
}
FeatureToggleWhenDisabledDirective.prototype.ngOnInit = function () {
if (!this.featureToggleWhenDisabled) {
throw new Error('Attribute `featureToggleWhenDisabled` should not be null or empty');
}
this.shouldRender();
};
FeatureToggleWhenDisabledDirective.prototype.ngDoCheck = function () {
if (this.isOn !== isOn(this.featureToggleWhenDisabled)) {
this.shouldRender();
}
};
FeatureToggleWhenDisabledDirective.prototype.shouldRender = function () {
this.isOn = isOn(this.featureToggleWhenDisabled);
if (!this.isOn) {
this.viewContainer.createEmbeddedView(this.templateRef);
}
else {
this.viewContainer.clear();
}
};
FeatureToggleWhenDisabledDirective.ctorParameters = function () { return [
{ type: TemplateRef },
{ type: ViewContainerRef }
]; };
__decorate([
Input(),
__metadata("design:type", String)
], FeatureToggleWhenDisabledDirective.prototype, "featureToggleWhenDisabled", void 0);
FeatureToggleWhenDisabledDirective = __decorate([
Directive({
// tslint:disable-next-line: directive-selector
selector: '[featureToggleWhenDisabled]',
}),
__metadata("design:paramtypes", [TemplateRef,
ViewContainerRef])
], FeatureToggleWhenDisabledDirective);
return FeatureToggleWhenDisabledDirective;
}());
var FeatureToggleProviderComponent = /** @class */ (function () {

@@ -139,4 +109,4 @@ function FeatureToggleProviderComponent() {

NgModule({
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective, FeatureToggleWhenDisabledDirective],
declarations: [FeatureToggleProviderComponent, FeatureToggleDirective],
exports: [FeatureToggleProviderComponent, FeatureToggleDirective],
imports: [CommonModule],

@@ -162,12 +132,15 @@ })

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -195,12 +168,15 @@ NgxFeatureToggleCanActivateGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateGuard_Factory() { return new NgxFeatureToggleCanActivateGuard(); }, token: NgxFeatureToggleCanActivateGuard, providedIn: "root" });

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanActivateChildGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -228,12 +204,15 @@ NgxFeatureToggleCanActivateChildGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanActivateChildGuard_Factory() { return new NgxFeatureToggleCanActivateChildGuard(); }, token: NgxFeatureToggleCanActivateChildGuard, providedIn: "root" });

}
if (!Array.isArray(route.data.featureToggle)) {
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array in your route configuration.');
}
return false;
var isFeatureToggleOn = function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
};
if (typeof route.data.featureToggle === 'string') {
return isFeatureToggleOn(route.data.featureToggle);
}
var userCanAccess = route.data.featureToggle.every(function (toggle) {
return toggle[0] === '!' ? !isOn(toggle.replace('!', '')) : isOn(toggle);
});
return userCanAccess;
else if (Array.isArray(route.data.featureToggle)) {
return route.data.featureToggle.every(isFeatureToggleOn);
}
if (DEV_MODE) {
console.error('`NgxFeatureToggleCanLoadGuard` need to receive `featureToggle` as data as an array or string in your route configuration.');
}
return false;
};

@@ -255,3 +234,3 @@ NgxFeatureToggleCanLoadGuard.ɵprov = ɵɵdefineInjectable({ factory: function NgxFeatureToggleCanLoadGuard_Factory() { return new NgxFeatureToggleCanLoadGuard(); }, token: NgxFeatureToggleCanLoadGuard, providedIn: "root" });

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

@@ -5,3 +5,3 @@ import { OnInit, TemplateRef, ViewContainerRef, DoCheck } from '@angular/core';

private viewContainer;
featureToggle: string;
featureToggle: string[] | string;
private isOn;

@@ -12,2 +12,3 @@ constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef);

private shouldRender;
isOnCheck(featureToggle: string[] | string): boolean;
}

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

{"__symbolic":"module","version":4,"metadata":{"FeatureToggleDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":11,"character":1},"arguments":[{"selector":"[featureToggle]"}]}],"members":{"featureToggle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"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":23,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"shouldRender":[{"__symbolic":"method"}]}},"FeatureToggleWhenDisabledDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":11,"character":1},"arguments":[{"selector":"[featureToggleWhenDisabled]"}]}],"members":{"featureToggleWhenDisabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"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":23,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"shouldRender":[{"__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":"\n <ng-content></ng-content>\n "}]}],"members":{"features":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"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":6,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"FeatureToggleProviderComponent"},{"__symbolic":"reference","name":"FeatureToggleDirective"},{"__symbolic":"reference","name":"FeatureToggleWhenDisabledDirective"}],"exports":[{"__symbolic":"reference","name":"FeatureToggleProviderComponent"},{"__symbolic":"reference","name":"FeatureToggleDirective"},{"__symbolic":"reference","name":"FeatureToggleWhenDisabledDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":9,"character":12}]}]}],"members":{}},"NgxFeatureToggleCanActivateGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":5,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"isDevMode":[{"__symbolic":"method"}],"canActivate":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"NgxFeatureToggleCanActivateChildGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":5,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"isDevMode":[{"__symbolic":"method"}],"canActivateChild":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"NgxFeatureToggleCanLoadGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":5,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"isDevMode":[{"__symbolic":"method"}],"canLoad":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"FeatureToggleDirective":"./lib/ngx-feature-toggle.directive","FeatureToggleWhenDisabledDirective":"./lib/ngx-feature-toggle-when-disabled.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":"\n <ng-content></ng-content>\n "}]}],"members":{"features":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"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":5,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"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":{"isDevMode":[{"__symbolic":"method"}],"canActivateChild":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"NgxFeatureToggleCanLoadGuard":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":5,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"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"}

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

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

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

export * from './lib/ngx-feature-toggle.directive';
export * from './lib/ngx-feature-toggle-when-disabled.directive';
export * from './lib/ngx-feature-toggle-provider.component';

@@ -4,0 +3,0 @@ export * from './lib/ngx-feature-toggle.module';

@@ -93,6 +93,6 @@ # NGX Feature Toggle

```typescript
import { Component } from '@angular/core';
import { Component } from "@angular/core";
@Component({
selector: 'component-docs',
selector: "component-docs",
template: `

@@ -105,13 +105,24 @@ <feature-toggle-provider [features]="featureToggleData">

<p>
condition is false and "featureToggle" is disabled. In that case this content should not
be rendered.
condition is false and "featureToggle" is disabled. In that case this
content should not be rendered.
</p>
</div>
<div *featureToggleWhenDisabled="'enableFirstText'">
<div *featureToggle="'!enableFirstText'">
<p>
condition is false and "featureToggle" is disabled
<b>and it has "featureToggleWhenDisabled" directive.</b> In that case this content should
be rendered.
<b>but it has "!" as a prefix of the feature toggle to be checked.</b>
In that case this content should be rendered.
</p>
</div>
<div
class="combined-feature-toggles-with-truthly-option"
*featureToggle="['!enableFirstText', 'enableSecondText']"
>
<p>
This is a combined condition. It shows if <b>enableSecondText</b> is
true and <b>enableFirstText</b> is falsy, but it has "!" as a prefix.
If both cases are correct, then the "featureToggle" is enabled and
rendering this component.
</p>
</div>
</feature-toggle-provider>

@@ -135,10 +146,27 @@ `,

export const routes: Routes = [
{
path: 'home',
component: HomeComponent,
canLoad: [NgxFeatureToggleCanLoadGuard],
canActivate: [NgxFeatureToggleCanLoadGuard],
data: {
featureToggle: ['enableSecondText'],
// Using array as configuration
featureToggle: [
// This configuration will check if feature toggle is enabled
'enableSecondText',
// This configuration will check if feature toggle is disabled
// since it has `!` prefix in the configuration
'!enableFirstText'
],
},
},
{
path: 'dashboard',
component: DashboardComponent,
canActivate: [NgxFeatureToggleCanLoadGuard],
data: {
// Using string as configuration
featureToggle: 'enableSecondText',
},
},
];

@@ -153,2 +181,3 @@ ...

export const routes: Routes = [
{

@@ -159,5 +188,21 @@ path: 'home',

data: {
featureToggle: ['enableSecondText'],
// Using array as configuration
featureToggle: [
// This configuration will check if feature toggle is enabled
'enableSecondText',
// This configuration will check if feature toggle is disabled
// since it has `!` prefix in the configuration
'!enableFirstText'
],
},
},
{
path: 'dashboard',
component: DashboardComponent,
canActivate: [NgxFeatureToggleCanActivateGuard],
data: {
// Using string as configuration
featureToggle: 'enableSecondText',
},
},
];

@@ -177,2 +222,3 @@ ...

data: {
// Using array as configuration
featureToggle: [

@@ -187,2 +233,11 @@ // This configuration will check if feature toggle is enabled

},
{
path: 'dashboard',
component: DashboardComponent,
canActivate: [NgxFeatureToggleCanActivateGuard],
data: {
// Using string as configuration
featureToggle: 'enableSecondText',
},
},
];

@@ -211,3 +266,8 @@ ...

data: {
featureToggle: ['enableCustomerPage', '!enableChildrenNavigation'],
featureToggle: [
// This configuration will check if feature toggle is enabled
'enableCustomerPage',
// This configuration will check if feature toggle is disabled
// since it has `!` prefix in the configuration
'!enableChildrenNavigation'],
},

@@ -217,2 +277,20 @@ },

},
{
path: 'dashboard',
component: DashboardComponent,
canActivateChild: [NgxFeatureToggleCanActivateChildGuard],
children: [
{
path: ':id',
component: DashboardDetailsComponent,
// This is the featureToggle configuration for
// the child component. It can also use
// a combination of feature toggles
data: {
// using string to configure
featureToggle: 'enableDashboardDetailsPage',
},
},
],
},
];

@@ -219,0 +297,0 @@ ...

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