ngx-techlify-core 11.3.5 → 11.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/bundles/ngx-techlify-core.umd.js +576 -39
  2. package/bundles/ngx-techlify-core.umd.js.map +1 -1
  3. package/bundles/ngx-techlify-core.umd.min.js +2 -2
  4. package/bundles/ngx-techlify-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/audit-log/audit-log-view/audit-log-view.component.js +7 -9
  6. package/esm2015/lib/audit-log/audit-log-view-model/audit-log-view-model.component.js +7 -9
  7. package/esm2015/lib/email-subscription/email-subscription-type/email-subscription-type-list/email-subscription-type-list.component.js +2 -2
  8. package/esm2015/lib/email-subscription/email-subscription-user/email-subscription-user-list-filter/email-subscription-user-list-filter.component.js +2 -2
  9. package/esm2015/lib/login-history-for-user/login-history-for-user.component.js +11 -2
  10. package/esm2015/lib/techlify-feature/on-off-switch/on-off-switch.component.js +27 -0
  11. package/esm2015/lib/techlify-feature/techlify-feature-enabled.directive.js +77 -0
  12. package/esm2015/lib/techlify-feature/techlify-feature-listing.component.js +174 -0
  13. package/esm2015/lib/techlify-feature/techlify-feature.module.js +30 -0
  14. package/esm2015/lib/techlify-feature/techlify-feature.routing.js +12 -0
  15. package/esm2015/lib/techlify-feature/techlify-feature.service.js +28 -0
  16. package/esm2015/lib/timeline-filter/calculate-timeline.js +2 -2
  17. package/esm2015/lib/timeline-filter/timeline-filter.component.js +146 -16
  18. package/esm2015/ngx-techlify-core.js +4 -1
  19. package/esm2015/public-api.js +5 -1
  20. package/fesm2015/ngx-techlify-core.js +478 -33
  21. package/fesm2015/ngx-techlify-core.js.map +1 -1
  22. package/lib/login-history-for-user/login-history-for-user.component.d.ts +2 -0
  23. package/lib/techlify-feature/on-off-switch/on-off-switch.component.d.ts +9 -0
  24. package/lib/techlify-feature/techlify-feature-enabled.directive.d.ts +16 -0
  25. package/lib/techlify-feature/techlify-feature-listing.component.d.ts +34 -0
  26. package/lib/techlify-feature/techlify-feature.module.d.ts +2 -0
  27. package/lib/techlify-feature/techlify-feature.routing.d.ts +2 -0
  28. package/lib/techlify-feature/techlify-feature.service.d.ts +8 -0
  29. package/lib/timeline-filter/calculate-timeline.d.ts +5 -0
  30. package/lib/timeline-filter/timeline-filter.component.d.ts +47 -6
  31. package/ngx-techlify-core.d.ts +3 -0
  32. package/ngx-techlify-core.metadata.json +1 -1
  33. package/package.json +1 -1
  34. package/public-api.d.ts +4 -0
@@ -4,7 +4,7 @@ import { __decorate, __awaiter } from 'tslib';
4
4
  import { MatTableDataSource, MatTableModule } from '@angular/material/table';
5
5
  import { MatSort, MatSortModule } from '@angular/material/sort';
6
6
  import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
7
- import { Location, CommonModule } from '@angular/common';
7
+ import { Location, DatePipe, CommonModule } from '@angular/common';
8
8
  import { Validators, FormBuilder, FormControl, NgControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
9
  import { HttpResponse, HttpClient, HttpHandler, HttpClientModule } from '@angular/common/http';
10
10
  import { throwError, Observable, Subject, of, from, fromEvent } from 'rxjs';
@@ -38,6 +38,7 @@ import { diff, formatters } from 'jsondiffpatch';
38
38
  import { ENTER, COMMA } from '@angular/cdk/keycodes';
39
39
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
40
40
  import { MatButtonToggleModule } from '@angular/material/button-toggle';
41
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
41
42
 
42
43
  class ActionPopup {
43
44
  }
@@ -2289,7 +2290,7 @@ function calculateTimeline(value) {
2289
2290
  }
2290
2291
  case 4: { // This Week
2291
2292
  var first = date.getDate() - date.getDay() + 1; // First day is the day of the month - the day of the week
2292
- var last = first + 6; // last day is the first day + 6
2293
+ var last = first + 6; // last day is the first day + 6
2293
2294
  data.date_from = new Date(date.setDate(first));
2294
2295
  data.date_to = new Date(date.setDate(last));
2295
2296
  break;
@@ -2368,8 +2369,11 @@ Timeline.THIS_YEAR = 10;
2368
2369
  Timeline.LAST_YEAR = 11;
2369
2370
  Timeline.ALL = 12;
2370
2371
 
2371
- let TimelineFilterComponent = class TimelineFilterComponent {
2372
- constructor() {
2372
+ var TimelineFilterComponent_1;
2373
+ let TimelineFilterComponent = TimelineFilterComponent_1 = class TimelineFilterComponent {
2374
+ constructor(formBuilder, ngControl, datePipe) {
2375
+ this.ngControl = ngControl;
2376
+ this.datePipe = datePipe;
2373
2377
  this.timelineValue = new FormControl('');
2374
2378
  this.timelines = [
2375
2379
  { value: 1, viewValue: 'Custom' },
@@ -2385,20 +2389,73 @@ let TimelineFilterComponent = class TimelineFilterComponent {
2385
2389
  { value: 11, viewValue: 'Last Year' },
2386
2390
  { value: 12, viewValue: 'All dates' },
2387
2391
  ];
2388
- this.labelText = 'Select Timeline';
2389
2392
  this.dateFrom = 'date_from';
2390
2393
  this.dateTo = 'date_to';
2391
2394
  this.appearance = "legacy";
2392
2395
  this.showClearbutton = false;
2396
+ /**
2397
+ * @deprecated The form input is deprated
2398
+ */
2399
+ this.form = null;
2400
+ this.labelText = 'Select Timeline';
2401
+ this.touchUi = true;
2402
+ this.selectedValueChange = new EventEmitter();
2403
+ this.selectionChange = new EventEmitter();
2404
+ this.onChange = () => { };
2405
+ this.onTouched = () => { };
2406
+ this.stateChanges = new Subject();
2407
+ this.controlType = 'timeline-filter';
2408
+ this.id = `timeline-filter-${TimelineFilterComponent_1.nextId++}`;
2409
+ this.describedBy = '';
2393
2410
  this.showCustomDateFields = false;
2411
+ this._required = false;
2412
+ this._disabled = false;
2413
+ this.selectorForm = formBuilder.group({
2414
+ select_value: [null],
2415
+ });
2416
+ if (this.ngControl != null) {
2417
+ this.ngControl.valueAccessor = this;
2418
+ }
2394
2419
  }
2395
2420
  set defaultValue(value) {
2396
2421
  this.timelineValue.setValue(value);
2397
2422
  this.changeTimeline(value);
2398
2423
  }
2399
- ngOnInit() {
2400
- this.timelineValue.valueChanges.
2401
- pipe(debounceTime(100), distinctUntilChanged(), untilDestroyed(this)).subscribe(value => this.changeTimeline(value));
2424
+ get required() { return this._required; }
2425
+ set required(value) {
2426
+ this.selectorForm.get('select_value').setValidators(Validators.required);
2427
+ this._required = coerceBooleanProperty(value);
2428
+ this.stateChanges.next();
2429
+ }
2430
+ get disabled() { return this._disabled; }
2431
+ set disabled(value) {
2432
+ this._disabled = coerceBooleanProperty(value);
2433
+ this._disabled ? this.selectorForm.disable() : this.selectorForm.enable();
2434
+ this.stateChanges.next();
2435
+ }
2436
+ get value() {
2437
+ if (this.selectorForm.valid) {
2438
+ return this.selectorForm.value.select_value;
2439
+ }
2440
+ return '';
2441
+ }
2442
+ set value(data) {
2443
+ this.selectorForm.patchValue({ select_value: data || '' });
2444
+ this._handleInput();
2445
+ this.stateChanges.next();
2446
+ }
2447
+ getDateRangeString() {
2448
+ var _a, _b, _c, _d, _e, _f, _g;
2449
+ let str = "";
2450
+ if ((_a = this.selectedRange) === null || _a === void 0 ? void 0 : _a.show_custom_field) {
2451
+ if (((_b = this.selectedRange) === null || _b === void 0 ? void 0 : _b.date_from.toUTCString()) != 'Invalid Date') {
2452
+ str += ' - ' + this.datePipe.transform((_d = (_c = this.selectedRange) === null || _c === void 0 ? void 0 : _c.date_from) === null || _d === void 0 ? void 0 : _d.toUTCString());
2453
+ }
2454
+ if (((_e = this.selectedRange) === null || _e === void 0 ? void 0 : _e.date_to.toUTCString()) != 'Invalid Date') {
2455
+ str += ' - ' + this.datePipe.transform((_g = (_f = this.selectedRange) === null || _f === void 0 ? void 0 : _f.date_to) === null || _g === void 0 ? void 0 : _g.toUTCString());
2456
+ }
2457
+ }
2458
+ return str;
2402
2459
  }
2403
2460
  resetFieldValue(field) {
2404
2461
  this.form.get(field).setValue('');
@@ -2417,27 +2474,97 @@ let TimelineFilterComponent = class TimelineFilterComponent {
2417
2474
  this.showCustomDateFields = timeline.show_custom_field;
2418
2475
  }
2419
2476
  }
2477
+ _handleInput() {
2478
+ if (this.value == 1) {
2479
+ this.picker.open();
2480
+ return;
2481
+ }
2482
+ const range = calculateTimeline(this.value);
2483
+ this.selectedRange = range;
2484
+ this.onChange(this.value);
2485
+ this.selectedValueChange.emit(this.selectedValue);
2486
+ this.selectionChange.emit(range);
2487
+ }
2488
+ dateRangeChange(dateRangeStart, dateRangeEnd) {
2489
+ const range = {
2490
+ date_from: new Date(dateRangeStart.value),
2491
+ date_to: new Date(dateRangeEnd.value),
2492
+ show_custom_field: true
2493
+ };
2494
+ this.selectedRange = range;
2495
+ this.onChange(this.value);
2496
+ this.selectedValueChange.emit(this.selectedValue);
2497
+ this.selectionChange.emit(range);
2498
+ }
2499
+ onCustomDateChange(event) {
2500
+ console.log(event);
2501
+ }
2502
+ setDescribedByIds(ids) {
2503
+ this.describedBy = ids.join(' ');
2504
+ }
2505
+ onContainerClick(event) {
2506
+ event.stopPropagation();
2507
+ }
2508
+ writeValue(data) {
2509
+ this.value = data;
2510
+ }
2511
+ registerOnChange(fn) {
2512
+ this.onChange = fn;
2513
+ }
2514
+ registerOnTouched(fn) {
2515
+ this.onTouched = fn;
2516
+ }
2517
+ setDisabledState(isDisabled) {
2518
+ this.disabled = isDisabled;
2519
+ }
2520
+ ngOnInit() {
2521
+ console.log(this.form);
2522
+ this.timelineValue.valueChanges.
2523
+ pipe(debounceTime(100), distinctUntilChanged(), untilDestroyed(this)).subscribe(value => this.changeTimeline(value));
2524
+ }
2525
+ ngOnDestroy() {
2526
+ this.stateChanges.complete();
2527
+ }
2420
2528
  };
2529
+ TimelineFilterComponent.nextId = 0;
2421
2530
  TimelineFilterComponent.decorators = [
2422
2531
  { type: Component, args: [{
2423
2532
  selector: 'app-timeline-filter',
2424
- template: "<ng-container [formGroup]=\"form\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>{{labelText}}</mat-label>\n <mat-select [formControl]=\"timelineValue\">\n <mat-option *ngFor=\"let timeline of timelines\" [value]=\"timeline.value\">\n {{timeline.viewValue}}\n </mat-option>\n </mat-select>\n <button mat-button *ngIf=\"showClearbutton && timelineValue.value\" matSuffix mat-icon-button\n (click)=\"timelineValue.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <ng-container *ngIf=\"showCustomDateFields\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>From Date</mat-label>\n <input matInput formControlName=\"{{dateFrom}}\" [matDatepicker]=\"fromPicker\" (click)=\"fromPicker.open()\"\n placeholder=\"From Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"fromPicker\"></mat-datepicker-toggle>\n <mat-datepicker #fromPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateFrom)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateFrom)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>To Date</mat-label>\n <input matInput formControlName=\"{{dateTo}}\" [matDatepicker]=\"toPicker\" (click)=\"toPicker.open()\"\n placeholder=\"To Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"\"></mat-datepicker-toggle>\n <mat-datepicker #toPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateTo)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateTo)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n </ng-container>\n</ng-container>",
2533
+ template: "<ng-container *ngIf=\"form\" [formGroup]=\"form\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>{{labelText}}</mat-label>\n <mat-select [formControl]=\"timelineValue\">\n <mat-option *ngFor=\"let timeline of timelines\" [value]=\"timeline.value\">\n {{timeline.viewValue}}\n </mat-option>\n </mat-select>\n <button mat-button *ngIf=\"showClearbutton && timelineValue.value\" matSuffix mat-icon-button\n (click)=\"timelineValue.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <ng-container *ngIf=\"showCustomDateFields\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>From Date</mat-label>\n <input matInput formControlName=\"{{dateFrom}}\" [matDatepicker]=\"fromPicker\" (click)=\"fromPicker.open()\"\n placeholder=\"From Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"fromPicker\"></mat-datepicker-toggle>\n <mat-datepicker #fromPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateFrom)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateFrom)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>To Date</mat-label>\n <input matInput formControlName=\"{{dateTo}}\" [matDatepicker]=\"toPicker\" (click)=\"toPicker.open()\"\n placeholder=\"To Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"\"></mat-datepicker-toggle>\n <mat-datepicker #toPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateTo)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateTo)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n </ng-container>\n</ng-container>\n<div *ngIf=\"!form\" [formGroup]=\"selectorForm\">\n <mat-select formControlName=\"select_value\" focused=\"false\" [required]=\"required\"\n autocomplete=\"off\" (selectionChange)=\"_handleInput()\">\n <mat-option *ngFor=\"let timeline of timelines\" [value]=\"timeline?.value\">\n {{ timeline?.viewValue }} {{ selectedRange?.show_custom_field && timeline?.value == 1 ? getDateRangeString() : '' }}\n </mat-option>\n </mat-select>\n <mat-date-range-input hidden (dateChange)=\"onCustomDateChange($event)\" [rangePicker]=\"picker\">\n <input matStartDate #customStartDate>\n <input matEndDate (dateChange)=\"dateRangeChange(customStartDate, customEndDate)\" #customEndDate>\n </mat-date-range-input>\n <mat-date-range-picker #picker [touchUi]=\"touchUi\"></mat-date-range-picker>\n</div>\n",
2534
+ providers: [
2535
+ {
2536
+ provide: MatFormFieldControl,
2537
+ useExisting: TimelineFilterComponent_1
2538
+ }
2539
+ ],
2425
2540
  styles: [""]
2426
2541
  },] }
2427
2542
  ];
2428
- TimelineFilterComponent.ctorParameters = () => [];
2543
+ TimelineFilterComponent.ctorParameters = () => [
2544
+ { type: FormBuilder },
2545
+ { type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
2546
+ { type: DatePipe }
2547
+ ];
2429
2548
  TimelineFilterComponent.propDecorators = {
2549
+ picker: [{ type: ViewChild, args: ['picker',] }],
2430
2550
  timelineValue: [{ type: Input }],
2431
2551
  timelines: [{ type: Input }],
2432
- labelText: [{ type: Input }],
2433
2552
  dateFrom: [{ type: Input }],
2434
2553
  dateTo: [{ type: Input }],
2435
2554
  appearance: [{ type: Input }],
2436
2555
  showClearbutton: [{ type: Input }],
2437
2556
  form: [{ type: Input }],
2438
- defaultValue: [{ type: Input }]
2557
+ labelText: [{ type: Input }],
2558
+ selectedValue: [{ type: Input }],
2559
+ touchUi: [{ type: Input }],
2560
+ selectedValueChange: [{ type: Output }],
2561
+ selectionChange: [{ type: Output }],
2562
+ defaultValue: [{ type: Input }],
2563
+ required: [{ type: Input }],
2564
+ disabled: [{ type: Input }],
2565
+ value: [{ type: Input }]
2439
2566
  };
2440
- TimelineFilterComponent = __decorate([
2567
+ TimelineFilterComponent = TimelineFilterComponent_1 = __decorate([
2441
2568
  UntilDestroy()
2442
2569
  ], TimelineFilterComponent);
2443
2570
 
@@ -3441,7 +3568,7 @@ let EmailSubscriptionUserListFilterComponent = class EmailSubscriptionUserListFi
3441
3568
  EmailSubscriptionUserListFilterComponent.decorators = [
3442
3569
  { type: Component, args: [{
3443
3570
  selector: 'app-email-subscription-user-list-filter',
3444
- template: "<form [formGroup]=\"esUserFilterForm\" fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" fxLayoutAlign=\"start center\">\n <mat-form-field class=\"ml-3\">\n <mat-label>User</mat-label>\n <app-searchable-selector formControlName=\"user_id\" apiUrl=\"api/users\" titleField=\"name\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('user_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('user_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field class=\"ml-3\">\n <mat-label>Email Type</mat-label>\n <app-searchable-selector formControlName=\"email_type_id\" apiUrl=\"api/email-subscription-types\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('user_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('user_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</form>",
3571
+ template: "<form [formGroup]=\"esUserFilterForm\" fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" fxLayoutAlign=\"start center\">\n <mat-form-field class=\"ml-3\">\n <mat-label>User</mat-label>\n <app-searchable-selector formControlName=\"user_id\" apiUrl=\"api/users\" titleField=\"name\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('user_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('user_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field class=\"ml-3\">\n <mat-label>Email Type</mat-label>\n <app-searchable-selector formControlName=\"email_type_id\" apiUrl=\"api/email-subscription-types\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('email_type_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('email_type_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</form>",
3445
3572
  styles: [""]
3446
3573
  },] }
3447
3574
  ];
@@ -3761,7 +3888,7 @@ let EmailSubscriptionTypeListComponent = class EmailSubscriptionTypeListComponen
3761
3888
  EmailSubscriptionTypeListComponent.decorators = [
3762
3889
  { type: Component, args: [{
3763
3890
  selector: 'app-email-subscription-type-list',
3764
- template: "<div class=\"mat-typography m-4\">\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"start center\">\n <mat-form-field>\n <input matInput [formControl]=\"search\" placeholder=\"Email Type\" autocomplete=\"off\" />\n <button mat-button matSuffix mat-icon-button>\n <mat-icon>search</mat-icon>\n </button>\n <button mat-button *ngIf=\"search.value\" matSuffix mat-icon-button (click)=\"search.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n <div class=\"ml-2\">\n <button mat-raised-button color=\"primary\" type=\"button\" (click)=\"addEmailSubscriptionType()\">+ Email\n Type</button>\n </div>\n <span fxFlex></span>\n <mat-form-field appearance=\"outline\" class=\"no-padding\">\n <mat-label>Columns</mat-label>\n <mat-select [formControl]=\"displayColumns\" multiple (selectionChange)=\"columnsChange()\">\n <mat-option *ngFor=\"let column of availableDisplayColumns\" [value]=\"column.value\">{{column.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"emailSubscriptionTypeList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"email-subscription-type-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Title </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.title }} </td>\n </ng-container>\n <ng-container matColumnDef=\"code\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.code }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"frequency.title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.frequency?.title }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"description\">\n <th mat-header-cell *matHeaderCellDef> Description </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.description }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef> Actions </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType\">\n <button type=\"button\" mat-icon-button\n (click)=\"deleteEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>delete</mat-icon>\n </button>\n <button type=\"button\" mat-icon-button\n (click)=\"editEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>edit</mat-icon>\n </button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky:true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n </section>\n</div>",
3891
+ template: "<div class=\"mat-typography m-4\">\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"start center\">\n <mat-form-field>\n <input matInput [formControl]=\"search\" placeholder=\"Email Type\" autocomplete=\"off\" />\n <button mat-button matSuffix mat-icon-button>\n <mat-icon>search</mat-icon>\n </button>\n <button mat-button *ngIf=\"search.value\" matSuffix mat-icon-button (click)=\"search.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n <div class=\"ml-2\">\n <button mat-raised-button color=\"primary\" type=\"button\" (click)=\"addEmailSubscriptionType()\">+ Email\n Type</button>\n </div>\n <span fxFlex></span>\n <mat-form-field appearance=\"outline\" class=\"no-padding\">\n <mat-label>Columns</mat-label>\n <mat-select [formControl]=\"displayColumns\" multiple (selectionChange)=\"columnsChange()\">\n <mat-option *ngFor=\"let column of availableDisplayColumns\" [value]=\"column.value\">{{column.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"emailSubscriptionTypeList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"email-subscription-type-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Title </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.title }} </td>\n </ng-container>\n <ng-container matColumnDef=\"code\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.code }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"frequency.title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Frequency </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.frequency?.title }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"description\">\n <th mat-header-cell *matHeaderCellDef> Description </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.description }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef> Actions </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType\">\n <button type=\"button\" mat-icon-button\n (click)=\"deleteEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>delete</mat-icon>\n </button>\n <button type=\"button\" mat-icon-button\n (click)=\"editEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>edit</mat-icon>\n </button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky:true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n </section>\n</div>",
3765
3892
  styles: [".scroll-container{max-height:800px;overflow-y:auto}"]
3766
3893
  },] }
3767
3894
  ];
@@ -4712,14 +4839,12 @@ let AuditLogViewModelComponent = class AuditLogViewModelComponent {
4712
4839
  }
4713
4840
  getTransformedChanges() {
4714
4841
  var _a, _b, _c, _d;
4715
- if ((_b = (_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.changes) {
4716
- const changes = Object.keys((_d = (_c = this.logInfo) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.changes) || [];
4717
- changes.forEach((key) => {
4718
- var _a, _b, _c, _d;
4719
- const displayAttribute = key.split('_').map(x => x.charAt(0).toUpperCase() + x.slice(1)).join(' ');
4720
- this.changeList.push({ displayAttribute: displayAttribute, attribute: key, newValue: (_b = (_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.object[key]) !== null && _b !== void 0 ? _b : '', oldValue: (_d = (_c = this.logInfo) === null || _c === void 0 ? void 0 : _c.pre_object[key]) !== null && _d !== void 0 ? _d : '' });
4721
- });
4722
- }
4842
+ const changes = ((((_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.action) === 'deleted') ? Object.keys((_b = this.logInfo) === null || _b === void 0 ? void 0 : _b.object) : Object.keys((_d = (_c = this.logInfo) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.changes)) || [];
4843
+ changes.forEach((key) => {
4844
+ var _a, _b, _c, _d, _e;
4845
+ const displayAttribute = key.split('_').map(x => x.charAt(0).toUpperCase() + x.slice(1)).join(' ');
4846
+ this.changeList.push({ displayAttribute: displayAttribute, attribute: key, newValue: (((_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.action) === 'deleted') ? '' : ((_c = (_b = this.logInfo) === null || _b === void 0 ? void 0 : _b.object[key]) !== null && _c !== void 0 ? _c : ''), oldValue: (_e = (_d = this.logInfo) === null || _d === void 0 ? void 0 : _d.pre_object[key]) !== null && _e !== void 0 ? _e : '' });
4847
+ });
4723
4848
  }
4724
4849
  close() {
4725
4850
  this.dialogRef.close();
@@ -5160,14 +5285,12 @@ class AuditLogViewComponent {
5160
5285
  }
5161
5286
  getTransformedChanges() {
5162
5287
  var _a, _b, _c, _d;
5163
- if ((_b = (_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.changes) {
5164
- const changes = Object.keys((_d = (_c = this.logInfo) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.changes) || [];
5165
- changes.forEach((key) => {
5166
- var _a, _b, _c, _d;
5167
- const displayAttribute = key.split('_').map(x => x.charAt(0).toUpperCase() + x.slice(1)).join(' ');
5168
- this.changeList.push({ displayAttribute: displayAttribute, attribute: key, newValue: (_b = (_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.object[key]) !== null && _b !== void 0 ? _b : '', oldValue: (_d = (_c = this.logInfo) === null || _c === void 0 ? void 0 : _c.pre_object[key]) !== null && _d !== void 0 ? _d : '' });
5169
- });
5170
- }
5288
+ const changes = ((((_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.action) === 'deleted') ? Object.keys((_b = this.logInfo) === null || _b === void 0 ? void 0 : _b.object) : Object.keys((_d = (_c = this.logInfo) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.changes)) || [];
5289
+ changes.forEach((key) => {
5290
+ var _a, _b, _c, _d, _e;
5291
+ const displayAttribute = key.split('_').map(x => x.charAt(0).toUpperCase() + x.slice(1)).join(' ');
5292
+ this.changeList.push({ displayAttribute: displayAttribute, attribute: key, newValue: (((_a = this.logInfo) === null || _a === void 0 ? void 0 : _a.action) === 'deleted') ? '' : ((_c = (_b = this.logInfo) === null || _b === void 0 ? void 0 : _b.object[key]) !== null && _c !== void 0 ? _c : ''), oldValue: (_e = (_d = this.logInfo) === null || _d === void 0 ? void 0 : _d.pre_object[key]) !== null && _e !== void 0 ? _e : '' });
5293
+ });
5171
5294
  }
5172
5295
  fetchLogDetail(logId) {
5173
5296
  return __awaiter(this, void 0, void 0, function* () {
@@ -5604,6 +5727,7 @@ let LoginHistoryForUserComponent = class LoginHistoryForUserComponent {
5604
5727
  };
5605
5728
  this.displayedColumns = ['index', 'created_at'];
5606
5729
  this.historyFilterForm = this.fb.group({
5730
+ 'duration': [''],
5607
5731
  'date_from': [''],
5608
5732
  'date_to': ['']
5609
5733
  });
@@ -5619,6 +5743,14 @@ let LoginHistoryForUserComponent = class LoginHistoryForUserComponent {
5619
5743
  });
5620
5744
  this.initializeData();
5621
5745
  }
5746
+ onTimelineChange(range) {
5747
+ let date_from = (range === null || range === void 0 ? void 0 : range.date_from) ? new Date(range.date_from) : '';
5748
+ let date_to = (range === null || range === void 0 ? void 0 : range.date_to) ? new Date(range.date_to) : '';
5749
+ this.historyFilterForm.patchValue({
5750
+ date_from,
5751
+ date_to
5752
+ });
5753
+ }
5622
5754
  initializeData() {
5623
5755
  this.http.get(`api/user-login-history`, { params: Object.assign(Object.assign({}, this.filters), this.pageEvent) })
5624
5756
  .pipe(untilDestroyed(this))
@@ -5650,7 +5782,7 @@ let LoginHistoryForUserComponent = class LoginHistoryForUserComponent {
5650
5782
  LoginHistoryForUserComponent.decorators = [
5651
5783
  { type: Component, args: [{
5652
5784
  selector: 'app-login-history-for-user',
5653
- template: "<div class=\"mat-typography m-4\">\n <form fxLayoutAlign=\" start center\">\n <app-timeline-filter [form]=\"historyFilterForm\"></app-timeline-filter>\n </form>\n\n\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"loginHistoryList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"login-history-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let loginHistory; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n\n <ng-container matColumnDef=\"created_at\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Last Login</th>\n <td mat-cell *matCellDef=\"let loginHistory;\">\n {{loginHistory?.created_at | date:'medium' }}\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns;\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n\n </section>\n</div>",
5785
+ template: "<div class=\"mat-typography m-4\">\n <form [formGroup]=\"historyFilterForm\" fxLayoutAlign=\" start center\">\n <app-timeline-filter formControlName=\"duration\" (selectionChange)=\"onTimelineChange($event)\"></app-timeline-filter>\n </form>\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"loginHistoryList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"login-history-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let loginHistory; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n\n <ng-container matColumnDef=\"created_at\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Last Login</th>\n <td mat-cell *matCellDef=\"let loginHistory;\">\n {{loginHistory?.created_at | date:'medium' }}\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns;\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n\n </section>\n</div>\n",
5654
5786
  styles: [".scroll-container{max-height:800px;overflow-y:auto}"]
5655
5787
  },] }
5656
5788
  ];
@@ -6166,6 +6298,319 @@ TechlifyTaggerTagSelectorModule.decorators = [
6166
6298
  },] }
6167
6299
  ];
6168
6300
 
6301
+ class TechlifyFeatureService {
6302
+ constructor(dataManager) {
6303
+ this.dataManager = dataManager;
6304
+ }
6305
+ getFeatures() {
6306
+ return this.dataManager.GET(`api/features`);
6307
+ }
6308
+ disableFeature(id) {
6309
+ return this.dataManager.GET(`api/feature/${id}/disable`);
6310
+ }
6311
+ enableFeature(id) {
6312
+ return this.dataManager.GET(`api/feature/${id}/enable`);
6313
+ }
6314
+ }
6315
+ TechlifyFeatureService.ɵprov = ɵɵdefineInjectable({ factory: function TechlifyFeatureService_Factory() { return new TechlifyFeatureService(ɵɵinject(DataManager)); }, token: TechlifyFeatureService, providedIn: "root" });
6316
+ TechlifyFeatureService.decorators = [
6317
+ { type: Injectable, args: [{
6318
+ providedIn: 'root'
6319
+ },] }
6320
+ ];
6321
+ TechlifyFeatureService.ctorParameters = () => [
6322
+ { type: DataManager }
6323
+ ];
6324
+
6325
+ let TechlifyFeatureListingComponent = class TechlifyFeatureListingComponent {
6326
+ constructor(dataManager, errorHandler, fb, alertService, dialog, storage, featureService) {
6327
+ this.dataManager = dataManager;
6328
+ this.errorHandler = errorHandler;
6329
+ this.fb = fb;
6330
+ this.alertService = alertService;
6331
+ this.dialog = dialog;
6332
+ this.storage = storage;
6333
+ this.featureService = featureService;
6334
+ this.features = [];
6335
+ this.displayedColumns = [
6336
+ 'index',
6337
+ 'feature',
6338
+ 'description',
6339
+ 'actions',
6340
+ ];
6341
+ this.dataSource = new MatTableDataSource();
6342
+ this.page = 1;
6343
+ this.perPage = 25;
6344
+ this.isWorking = false;
6345
+ this.filterFormGroup = this.fb.group({
6346
+ num_items: [""]
6347
+ });
6348
+ }
6349
+ ngOnInit() {
6350
+ this.loadData();
6351
+ this.listenForChanges();
6352
+ }
6353
+ listenForChanges() {
6354
+ this.filterFormGroup.valueChanges
6355
+ .pipe(debounceTime(500), untilDestroyed(this))
6356
+ .subscribe((changes) => {
6357
+ this.reload();
6358
+ });
6359
+ }
6360
+ loadData() {
6361
+ return __awaiter(this, void 0, void 0, function* () {
6362
+ let result;
6363
+ try {
6364
+ this.isWorking = true;
6365
+ var filter = this.filterFormGroup.value;
6366
+ filter.page = this.page;
6367
+ filter.perPage = this.perPage;
6368
+ result = yield this.dataManager.GET(`api/features`, filter);
6369
+ this.features = this.features.concat(result.data);
6370
+ this.dataSource = new MatTableDataSource(this.features);
6371
+ if (!this.storage.getItem('features')) {
6372
+ this.setStorage(this.features);
6373
+ }
6374
+ this.isWorking = false;
6375
+ }
6376
+ catch (error) {
6377
+ this.errorHandler.handleError(error);
6378
+ }
6379
+ finally {
6380
+ this.isWorking = false;
6381
+ }
6382
+ });
6383
+ }
6384
+ toggeleFeature(element, feature) {
6385
+ return __awaiter(this, void 0, void 0, function* () {
6386
+ let status = element ? 'Off' : "On";
6387
+ let data;
6388
+ const dialogRef = this.dialog.open(ActionPopupComponent, {
6389
+ width: "400px",
6390
+ data: {
6391
+ title: `Turn this feature ${status}?`,
6392
+ message: `Would you like to turn ${feature.title} feature ${status}`
6393
+ }
6394
+ });
6395
+ dialogRef.afterClosed().subscribe((result) => __awaiter(this, void 0, void 0, function* () {
6396
+ if (result) {
6397
+ try {
6398
+ data = element
6399
+ ? yield this.featureService.disableFeature(feature.id)
6400
+ : yield this.featureService.enableFeature(feature.id);
6401
+ }
6402
+ catch (error) {
6403
+ this.errorHandler.handleError(error);
6404
+ }
6405
+ finally {
6406
+ this.alertService.addAlert(`You have just turned ${status} the feature ${feature.title}`, 'success');
6407
+ this.reload();
6408
+ this.storage.removeItem('features');
6409
+ this.setStorage(this.features);
6410
+ this.isWorking = false;
6411
+ }
6412
+ }
6413
+ else {
6414
+ this.reload();
6415
+ }
6416
+ }));
6417
+ });
6418
+ }
6419
+ setStorage(features) {
6420
+ let localFeatures = [];
6421
+ for (let feature of features) {
6422
+ if (!feature.client_feature) {
6423
+ if (feature.is_enabled_default) {
6424
+ localFeatures.push(feature.code);
6425
+ }
6426
+ }
6427
+ else {
6428
+ if (feature.client_feature.is_enabled) {
6429
+ localFeatures.push(feature.code);
6430
+ }
6431
+ }
6432
+ }
6433
+ this.storage.setItem("features", localFeatures);
6434
+ }
6435
+ reload() {
6436
+ this.features = [];
6437
+ this.page = 1;
6438
+ if (!this.isWorking) {
6439
+ this.loadData();
6440
+ }
6441
+ }
6442
+ onScroll() {
6443
+ if (!this.isWorking && this.page < this.lastPage) {
6444
+ this.page += 1;
6445
+ this.loadData();
6446
+ }
6447
+ }
6448
+ sortColumn(event) {
6449
+ var direction = event.direction.toString().toUpperCase();
6450
+ this.assignFilter(event.active, direction);
6451
+ this.reload();
6452
+ }
6453
+ assignFilter(column, direction) {
6454
+ switch (column) {
6455
+ case 'name': {
6456
+ return this.filterFormGroup
6457
+ .get('sort_by')
6458
+ .setValue('first_name|' + direction);
6459
+ }
6460
+ case 'added_on': {
6461
+ return this.filterFormGroup
6462
+ .get('sort_by')
6463
+ .setValue('created_at|' + direction);
6464
+ }
6465
+ }
6466
+ }
6467
+ };
6468
+ TechlifyFeatureListingComponent.decorators = [
6469
+ { type: Component, args: [{
6470
+ selector: 'app-techlify-listing-feature',
6471
+ template: "<div fxLayout=\"column\" fxLayoutGap=\"3rem\" class=\"p-3\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" class=\"primary-color mt-3\">\n <h3>Features Configuration</h3>\n <mat-hint>\n <i> Here you can specify which optional features you'd like to have available to your team </i>\n </mat-hint>\n </div>\n\n\n <div>\n <mat-card>\n <mat-card-content fxlayout=\"column\" style=\"overflow: auto; height: 700px\" class=\"classifications-card\">\n <table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 w-100\" matSort multiTemplateDataRows\n (matSortChange)=\"sortColumn($event)\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [fromRoot]=\"true\" [infiniteScrollContainer]=\"'.classifications-card'\">\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Title Column -->\n <ng-container matColumnDef=\"feature\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>\n Feature\n </th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.title }}</td>\n </ng-container>\n\n <!-- Description Column -->\n <ng-container matColumnDef=\"description\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>\n Descriptions\n </th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.description }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>\n Actions\n </th>\n <td mat-cell *matCellDef=\"let element\">\n <div *ngIf=\"!element?.client_feature\">\n <app-on-off-switch [value]=\"element?.is_enabled_default\"\n (click)=\"toggeleFeature(element?.is_enabled_default, element)\"></app-on-off-switch>\n </div>\n <div *ngIf=\"element?.client_feature\">\n <app-on-off-switch [value]=\"element?.client_feature?.is_enabled\"\n (click)=\"toggeleFeature(element?.client_feature?.is_enabled, element)\"></app-on-off-switch>\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n </mat-card-content>\n </mat-card>\n </div>\n</div>\n",
6472
+ styles: [""]
6473
+ },] }
6474
+ ];
6475
+ TechlifyFeatureListingComponent.ctorParameters = () => [
6476
+ { type: DataManager },
6477
+ { type: ErrorHandlerService },
6478
+ { type: FormBuilder },
6479
+ { type: AlertService },
6480
+ { type: MatDialog },
6481
+ { type: StorageService },
6482
+ { type: TechlifyFeatureService }
6483
+ ];
6484
+ TechlifyFeatureListingComponent = __decorate([
6485
+ UntilDestroy()
6486
+ ], TechlifyFeatureListingComponent);
6487
+
6488
+ const routes$n = [
6489
+ {
6490
+ path: '',
6491
+ component: TechlifyFeatureListingComponent,
6492
+ canActivate: [AuthenticationGuard]
6493
+ },
6494
+ ];
6495
+ const TechlifyFeatureRoutes = RouterModule.forChild(routes$n);
6496
+
6497
+ class OnOffSwitchComponent {
6498
+ constructor(fb) {
6499
+ this.fb = fb;
6500
+ this.slideToggle = this.fb.group({
6501
+ toggle: [""]
6502
+ });
6503
+ }
6504
+ ngOnInit() {
6505
+ this.slideToggle.get('toggle').setValue(this.value);
6506
+ }
6507
+ }
6508
+ OnOffSwitchComponent.decorators = [
6509
+ { type: Component, args: [{
6510
+ selector: 'app-on-off-switch',
6511
+ template: "<form [formGroup]=\"slideToggle\">\n <mat-slide-toggle formControlName=\"toggle\">On / Off\n </mat-slide-toggle>\n</form>\n",
6512
+ styles: [""]
6513
+ },] }
6514
+ ];
6515
+ OnOffSwitchComponent.ctorParameters = () => [
6516
+ { type: FormBuilder }
6517
+ ];
6518
+ OnOffSwitchComponent.propDecorators = {
6519
+ value: [{ type: Input }]
6520
+ };
6521
+
6522
+ class TechlifyFeatureEnabledDirective {
6523
+ constructor(el, featureService, errorHandler, storage) {
6524
+ this.el = el;
6525
+ this.featureService = featureService;
6526
+ this.errorHandler = errorHandler;
6527
+ this.storage = storage;
6528
+ this.localFeatures = [];
6529
+ }
6530
+ ngOnInit() {
6531
+ if (!this.storage.getItem('features')) {
6532
+ this.getFeatures();
6533
+ }
6534
+ else {
6535
+ this.checkForFeatureEnabled();
6536
+ }
6537
+ }
6538
+ getFeatures() {
6539
+ return __awaiter(this, void 0, void 0, function* () {
6540
+ try {
6541
+ let features = yield this.featureService.getFeatures();
6542
+ for (let feature of features.data) {
6543
+ if (!feature.client_feature) {
6544
+ if (feature.is_enabled_default) {
6545
+ this.localFeatures.push(feature.code);
6546
+ }
6547
+ }
6548
+ else {
6549
+ if (feature.client_feature.is_enabled) {
6550
+ this.localFeatures.push(feature.code);
6551
+ }
6552
+ }
6553
+ }
6554
+ this.storage.setItem("features", this.localFeatures);
6555
+ }
6556
+ catch (error) {
6557
+ this.errorHandler.handleError(error);
6558
+ }
6559
+ finally {
6560
+ this.checkForFeatureEnabled();
6561
+ }
6562
+ });
6563
+ }
6564
+ checkForFeatureEnabled() {
6565
+ try {
6566
+ let features = this.storage.getItem('features');
6567
+ let features_split = features.split(',');
6568
+ if (features_split.includes(this.enabledFeature)) {
6569
+ this.el.nativeElement.style.display = "show";
6570
+ }
6571
+ else {
6572
+ this.el.nativeElement.remove();
6573
+ }
6574
+ }
6575
+ catch (error) {
6576
+ this.errorHandler.handleError(error);
6577
+ }
6578
+ }
6579
+ }
6580
+ TechlifyFeatureEnabledDirective.decorators = [
6581
+ { type: Directive, args: [{
6582
+ selector: '[techlifyFeatureEnabled]'
6583
+ },] }
6584
+ ];
6585
+ TechlifyFeatureEnabledDirective.ctorParameters = () => [
6586
+ { type: ElementRef },
6587
+ { type: TechlifyFeatureService },
6588
+ { type: ErrorHandlerService },
6589
+ { type: StorageService }
6590
+ ];
6591
+ TechlifyFeatureEnabledDirective.propDecorators = {
6592
+ enabledFeature: [{ type: Input, args: ['techlifyFeatureEnabled',] }]
6593
+ };
6594
+
6595
+ class TechlifyFeatureModule {
6596
+ }
6597
+ TechlifyFeatureModule.decorators = [
6598
+ { type: NgModule, args: [{
6599
+ imports: [
6600
+ CommonModule,
6601
+ MaterialModule,
6602
+ FlexLayoutModule,
6603
+ TechlifyFeatureRoutes,
6604
+ MatSlideToggleModule,
6605
+ FormsModule,
6606
+ ReactiveFormsModule,
6607
+ InfiniteScrollModule
6608
+ ],
6609
+ declarations: [TechlifyFeatureListingComponent, OnOffSwitchComponent, TechlifyFeatureEnabledDirective],
6610
+ exports: [TechlifyFeatureListingComponent, TechlifyFeatureEnabledDirective]
6611
+ },] }
6612
+ ];
6613
+
6169
6614
  /*
6170
6615
  * Public API Surface of ngx-techlify-core
6171
6616
  */
@@ -6174,5 +6619,5 @@ TechlifyTaggerTagSelectorModule.decorators = [
6174
6619
  * Generated bundle index. Do not edit.
6175
6620
  */
6176
6621
 
6177
- export { ActionPopup, ActionPopupComponent, ActionPopupModule, AlertService, ApiPrefixInterceptor, AuditLogForModelComponent, AuditLogForModelModule, AuditLogForModelRoutingModule, AuditLogListComponent, AuditLogListFilterComponent, AuditLogListFilterModule, AuditLogListFilterRoutingModule, AuditLogListModule, AuditLogListRoutingModule, AuditLogModule, AuditLogRoutingModule, AuditLogViewComponent, AuditLogViewModelComponent, AuditLogViewModelModule, AuditLogViewModelRoutingModule, AuditLogViewModule, AuditLogViewRoutingModule, AuditLogsViewModelComponent, AuditLogsViewModelModule, AuditLogsViewModelRoutingModule, AuthenticationGuard, AuthenticationService, CacheInterceptor, CommentFormComponent, ConfigService, CoreModule, CredentialsService, DataManager, DataTable, DataTableComponent, DataTableModule, DateUtils, DateValidator, DocumentViewerComponent, DocumentViewerModule, EmailSubscriptionForUserComponent, EmailSubscriptionForUserModule, EmailSubscriptionForUserRoutingModule, EmailSubscriptionModule, EmailSubscriptionRoutingModule, EmailSubscriptionTypeFormComponent, EmailSubscriptionTypeFormModule, EmailSubscriptionTypeFormRoutingModule, EmailSubscriptionTypeListComponent, EmailSubscriptionTypeListModule, EmailSubscriptionTypeListRoutingModule, EmailSubscriptionTypeModule, EmailSubscriptionTypeRoutingModule, EmailSubscriptionUserFormComponent, EmailSubscriptionUserFormModule, EmailSubscriptionUserFormRoutingModule, EmailSubscriptionUserListComponent, EmailSubscriptionUserListFilterComponent, EmailSubscriptionUserListFilterModule, EmailSubscriptionUserListFilterRoutingModule, EmailSubscriptionUserListModule, EmailSubscriptionUserListRoutingModule, EmailSubscriptionUserModule, EmailSubscriptionUserRoutingModule, EntityFileFormComponent, EntityFilesViewAllComponent, EntityFilesViewAllModule, ErrorHandlerInterceptor, ErrorHandlerService, ErrorSnackComponent, ExportExcelButtonComponent, ExportExcelModule, FailedItemsComponent, FailedItemsModule, FailedItemsRoutingModule, FileDropperComponent, FileDropperConfig, FileDropperModule, FormValidatorService, HTTP_DYNAMIC_INTERCEPTORS, HttpCacheService, HttpService, ImportConfig, ImportCsvComponent, ImportCsvModule, ImportCsvRoutingModule, ImportItemsComponent, ImportItemsModule, ImportItemsRoutingModule, LoaderComponent, LoaderModule, LogLevel, Logger, LoginHistoryForUserComponent, LoginHistoryForUserModule, LoginHistoryForUserRoutingModule, MatSelectInfiniteScrollDirective, MaterialModule, NoteFormComponent, NoteListComponent, NoteModule, NumItemsSelector, NumberSelector, PageEvent, ReadMoreComponent, ReadMoreModule, RouteReusableStrategy, SearchableSelectorComponent, SearchableSelectorModule, SnackModule, StorageService, SuccessSnackComponent, TechlifyConfig, TechlifyTaggerTagFormConfigModel, TechlifyTaggerTagFormFieldComponent, TechlifyTaggerTagFormFieldModule, TechlifyTaggerTagSelectorComponent, TechlifyTaggerTagSelectorModule, TechlifyUpdateHistoryModule, TechlifyUpdateModule, Timeline, TimelineFilterComponent, TimelineFilterModule, TokenInterceptor, UpdateNotifierComponent, UpdateNotifierModule, UtilityModule, ViewerConfig, calculateTimeline, esfur, estlr, esulr, SnackModule as ɵa, SuccessSnackComponent as ɵb, NumberSelector as ɵba, TimelineFilterComponent as ɵbb, TimelineFilterRoutingModule as ɵbc, LoaderComponent as ɵbd, EmailSubscriptionUserFormComponent as ɵbe, EmailSubscriptionUserListComponent as ɵbf, AuthenticationGuard as ɵbg, EmailSubscriptionUserListFilterComponent as ɵbh, EmailSubscriptionTypeFormComponent as ɵbi, EmailSubscriptionTypeListComponent as ɵbj, EmailSubscriptionForUserComponent as ɵbk, TechlifyUpdatesListComponent as ɵbl, TechlifyUpdateService as ɵbm, TechlifyUpdateRoutingModule as ɵbn, TechlifyUpdateFormModule as ɵbo, TechlifyUpdateFormComponent as ɵbp, TechlifyUpdateHistoryRoutingModule as ɵbq, TechlifyUpdateHistoryComponent as ɵbr, UpdateNotifierSnackComponent as ɵbs, UpdateViewModule as ɵbt, UpdateViewComponent as ɵbu, DataManager as ɵbv, ErrorSnackComponent as ɵc, HTTP_DYNAMIC_INTERCEPTORS as ɵd, HttpService as ɵe, RouteReusableStrategy as ɵf, ActionPopupComponent as ɵg, ActionPopup as ɵh, DataTableComponent as ɵi, DocumentViewerComponent as ɵj, EntityFileFormComponent as ɵk, FormValidatorService as ɵl, EntityFileService as ɵm, AlertService as ɵn, EntityFilesViewAllComponent as ɵo, FileDropperComponent as ɵp, NoteListComponent as ɵq, NoteService as ɵr, NoteFormComponent as ɵs, CommentFormComponent as ɵt, CredentialsService as ɵu, ConfigService as ɵv, TechlifyConfig as ɵw, SearchableSelectorComponent as ɵx, MatSelectInfiniteScrollDirective as ɵy, NumItemsSelector as ɵz };
6622
+ export { ActionPopup, ActionPopupComponent, ActionPopupModule, AlertService, ApiPrefixInterceptor, AuditLogForModelComponent, AuditLogForModelModule, AuditLogForModelRoutingModule, AuditLogListComponent, AuditLogListFilterComponent, AuditLogListFilterModule, AuditLogListFilterRoutingModule, AuditLogListModule, AuditLogListRoutingModule, AuditLogModule, AuditLogRoutingModule, AuditLogViewComponent, AuditLogViewModelComponent, AuditLogViewModelModule, AuditLogViewModelRoutingModule, AuditLogViewModule, AuditLogViewRoutingModule, AuditLogsViewModelComponent, AuditLogsViewModelModule, AuditLogsViewModelRoutingModule, AuthenticationGuard, AuthenticationService, CacheInterceptor, CommentFormComponent, ConfigService, CoreModule, CredentialsService, DataManager, DataTable, DataTableComponent, DataTableModule, DateUtils, DateValidator, DocumentViewerComponent, DocumentViewerModule, EmailSubscriptionForUserComponent, EmailSubscriptionForUserModule, EmailSubscriptionForUserRoutingModule, EmailSubscriptionModule, EmailSubscriptionRoutingModule, EmailSubscriptionTypeFormComponent, EmailSubscriptionTypeFormModule, EmailSubscriptionTypeFormRoutingModule, EmailSubscriptionTypeListComponent, EmailSubscriptionTypeListModule, EmailSubscriptionTypeListRoutingModule, EmailSubscriptionTypeModule, EmailSubscriptionTypeRoutingModule, EmailSubscriptionUserFormComponent, EmailSubscriptionUserFormModule, EmailSubscriptionUserFormRoutingModule, EmailSubscriptionUserListComponent, EmailSubscriptionUserListFilterComponent, EmailSubscriptionUserListFilterModule, EmailSubscriptionUserListFilterRoutingModule, EmailSubscriptionUserListModule, EmailSubscriptionUserListRoutingModule, EmailSubscriptionUserModule, EmailSubscriptionUserRoutingModule, EntityFileFormComponent, EntityFilesViewAllComponent, EntityFilesViewAllModule, ErrorHandlerInterceptor, ErrorHandlerService, ErrorSnackComponent, ExportExcelButtonComponent, ExportExcelModule, FailedItemsComponent, FailedItemsModule, FailedItemsRoutingModule, FileDropperComponent, FileDropperConfig, FileDropperModule, FormValidatorService, HTTP_DYNAMIC_INTERCEPTORS, HttpCacheService, HttpService, ImportConfig, ImportCsvComponent, ImportCsvModule, ImportCsvRoutingModule, ImportItemsComponent, ImportItemsModule, ImportItemsRoutingModule, LoaderComponent, LoaderModule, LogLevel, Logger, LoginHistoryForUserComponent, LoginHistoryForUserModule, LoginHistoryForUserRoutingModule, MatSelectInfiniteScrollDirective, MaterialModule, NoteFormComponent, NoteListComponent, NoteModule, NumItemsSelector, NumberSelector, PageEvent, ReadMoreComponent, ReadMoreModule, RouteReusableStrategy, SearchableSelectorComponent, SearchableSelectorModule, SnackModule, StorageService, SuccessSnackComponent, TechlifyConfig, TechlifyFeatureEnabledDirective, TechlifyFeatureListingComponent, TechlifyFeatureModule, TechlifyFeatureRoutes, TechlifyTaggerTagFormConfigModel, TechlifyTaggerTagFormFieldComponent, TechlifyTaggerTagFormFieldModule, TechlifyTaggerTagSelectorComponent, TechlifyTaggerTagSelectorModule, TechlifyUpdateHistoryModule, TechlifyUpdateModule, Timeline, TimelineFilterComponent, TimelineFilterModule, TokenInterceptor, UpdateNotifierComponent, UpdateNotifierModule, UtilityModule, ViewerConfig, calculateTimeline, esfur, estlr, esulr, SnackModule as ɵa, SuccessSnackComponent as ɵb, NumberSelector as ɵba, TimelineFilterComponent as ɵbb, TimelineFilterRoutingModule as ɵbc, LoaderComponent as ɵbd, EmailSubscriptionUserFormComponent as ɵbe, EmailSubscriptionUserListComponent as ɵbf, AuthenticationGuard as ɵbg, EmailSubscriptionUserListFilterComponent as ɵbh, EmailSubscriptionTypeFormComponent as ɵbi, EmailSubscriptionTypeListComponent as ɵbj, EmailSubscriptionForUserComponent as ɵbk, TechlifyUpdatesListComponent as ɵbl, TechlifyUpdateService as ɵbm, TechlifyUpdateRoutingModule as ɵbn, TechlifyUpdateFormModule as ɵbo, TechlifyUpdateFormComponent as ɵbp, TechlifyUpdateHistoryRoutingModule as ɵbq, TechlifyUpdateHistoryComponent as ɵbr, UpdateNotifierSnackComponent as ɵbs, UpdateViewModule as ɵbt, UpdateViewComponent as ɵbu, DataManager as ɵbv, DataManager as ɵbw, ErrorHandlerService as ɵbx, AlertService as ɵby, StorageService as ɵbz, ErrorSnackComponent as ɵc, TechlifyFeatureService as ɵca, AuthenticationGuard as ɵcb, OnOffSwitchComponent as ɵcc, HTTP_DYNAMIC_INTERCEPTORS as ɵd, HttpService as ɵe, RouteReusableStrategy as ɵf, ActionPopupComponent as ɵg, ActionPopup as ɵh, DataTableComponent as ɵi, DocumentViewerComponent as ɵj, EntityFileFormComponent as ɵk, FormValidatorService as ɵl, EntityFileService as ɵm, AlertService as ɵn, EntityFilesViewAllComponent as ɵo, FileDropperComponent as ɵp, NoteListComponent as ɵq, NoteService as ɵr, NoteFormComponent as ɵs, CommentFormComponent as ɵt, CredentialsService as ɵu, ConfigService as ɵv, TechlifyConfig as ɵw, SearchableSelectorComponent as ɵx, MatSelectInfiniteScrollDirective as ɵy, NumItemsSelector as ɵz };
6178
6623
  //# sourceMappingURL=ngx-techlify-core.js.map