ng-configcat-publicapi-ui 2.3.3 → 2.5.2

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 (58) hide show
  1. package/{esm2015/lib/_models/index.js → esm2020/lib/_models/index.mjs} +0 -0
  2. package/{esm2015/lib/_models/settingValuesModel.js → esm2020/lib/_models/settingValuesModel.mjs} +0 -0
  3. package/{esm2015/lib/_models/updateSettingValuesModel.js → esm2020/lib/_models/updateSettingValuesModel.mjs} +0 -0
  4. package/{esm2015/lib/_services/form-helper.js → esm2020/lib/_services/form-helper.mjs} +0 -0
  5. package/{esm2015/lib/_services/index.js → esm2020/lib/_services/index.mjs} +0 -0
  6. package/esm2020/lib/_services/public-api.service.mjs +68 -0
  7. package/esm2020/lib/_services/setting-list-form-helper.mjs +152 -0
  8. package/esm2020/lib/authorization/authorization.component.mjs +50 -0
  9. package/{esm2015/lib/base/base.component.js → esm2020/lib/base/base.component.mjs} +7 -4
  10. package/{esm2015/lib/configuration.js → esm2020/lib/configuration.mjs} +4 -4
  11. package/esm2020/lib/dialogs/concurrent-dialog/concurrent-dialog.component.mjs +25 -0
  12. package/esm2020/lib/dialogs/expand-dialog/expand-dialog.component.mjs +77 -0
  13. package/esm2020/lib/dialogs/reason-dialog/reason-dialog.component.mjs +36 -0
  14. package/esm2020/lib/dialogs/save-snackbar/save-snackbar.component.mjs +14 -0
  15. package/{esm2015/lib/ng-configcat-publicapi-ui.module.js → esm2020/lib/ng-configcat-publicapi-ui.module.mjs} +5 -5
  16. package/{esm2015/lib/selects/config-select/config-select.component.js → esm2020/lib/selects/config-select/config-select.component.mjs} +7 -12
  17. package/esm2020/lib/selects/environment-select/environment-select.component.mjs +43 -0
  18. package/esm2020/lib/selects/product-select/product-select.component.mjs +36 -0
  19. package/esm2020/lib/selects/setting-select/setting-select.component.mjs +43 -0
  20. package/esm2020/lib/setting-item/setting-item.component.mjs +126 -0
  21. package/esm2020/lib/setting-list/setting/rollout-percentage-items/rollout-percentage-items.component.mjs +81 -0
  22. package/esm2020/lib/setting-list/setting/rollout-rules/rollout-rules.component.mjs +295 -0
  23. package/esm2020/lib/setting-list/setting/setting.component.mjs +134 -0
  24. package/esm2020/lib/setting-list/setting/value/value.component.mjs +32 -0
  25. package/esm2020/lib/setting-list/setting-list.component.mjs +197 -0
  26. package/{esm2015/ng-configcat-publicapi-ui.js → esm2020/ng-configcat-publicapi-ui.mjs} +0 -0
  27. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  28. package/fesm2015/ng-configcat-publicapi-ui.mjs +1579 -0
  29. package/fesm2015/ng-configcat-publicapi-ui.mjs.map +1 -0
  30. package/fesm2020/ng-configcat-publicapi-ui.mjs +1560 -0
  31. package/fesm2020/ng-configcat-publicapi-ui.mjs.map +1 -0
  32. package/lib/_services/public-api.service.d.ts +2 -1
  33. package/lib/base/base.component.d.ts +1 -0
  34. package/lib/setting-item/setting-item.component.d.ts +3 -1
  35. package/lib/setting-list/setting/rollout-rules/rollout-rules.component.d.ts +10 -2
  36. package/lib/setting-list/setting/setting.component.d.ts +4 -2
  37. package/lib/setting-list/setting-list.component.d.ts +4 -1
  38. package/package.json +22 -9
  39. package/bundles/ng-configcat-publicapi-ui.umd.js +0 -1979
  40. package/bundles/ng-configcat-publicapi-ui.umd.js.map +0 -1
  41. package/esm2015/lib/_services/public-api.service.js +0 -69
  42. package/esm2015/lib/_services/setting-list-form-helper.js +0 -135
  43. package/esm2015/lib/authorization/authorization.component.js +0 -54
  44. package/esm2015/lib/dialogs/concurrent-dialog/concurrent-dialog.component.js +0 -29
  45. package/esm2015/lib/dialogs/expand-dialog/expand-dialog.component.js +0 -81
  46. package/esm2015/lib/dialogs/reason-dialog/reason-dialog.component.js +0 -40
  47. package/esm2015/lib/dialogs/save-snackbar/save-snackbar.component.js +0 -18
  48. package/esm2015/lib/selects/environment-select/environment-select.component.js +0 -47
  49. package/esm2015/lib/selects/product-select/product-select.component.js +0 -40
  50. package/esm2015/lib/selects/setting-select/setting-select.component.js +0 -47
  51. package/esm2015/lib/setting-item/setting-item.component.js +0 -121
  52. package/esm2015/lib/setting-list/setting/rollout-percentage-items/rollout-percentage-items.component.js +0 -87
  53. package/esm2015/lib/setting-list/setting/rollout-rules/rollout-rules.component.js +0 -287
  54. package/esm2015/lib/setting-list/setting/setting.component.js +0 -131
  55. package/esm2015/lib/setting-list/setting/value/value.component.js +0 -39
  56. package/esm2015/lib/setting-list/setting-list.component.js +0 -195
  57. package/fesm2015/ng-configcat-publicapi-ui.js +0 -1574
  58. package/fesm2015/ng-configcat-publicapi-ui.js.map +0 -1
@@ -0,0 +1,1579 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Optional, Component, Input, Inject, EventEmitter, Output, forwardRef, NgModule } from '@angular/core';
3
+ import { MeService, Configuration as Configuration$1, ProductsService, ConfigsService, EnvironmentsService, FeatureFlagsSettingsService, FeatureFlagSettingValuesService, IntegrationLinksService, SegmentsService, SettingType, RolloutRuleComparator, SegmentComparator, ApiModule } from 'ng-configcat-publicapi';
4
+ import * as i1 from '@angular/common/http';
5
+ import { forkJoin, throwError, of } from 'rxjs';
6
+ import { map, catchError } from 'rxjs/operators';
7
+ import * as i2 from '@angular/forms';
8
+ import { Validators, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
+ import * as i1$1 from '@angular/material/dialog';
10
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
11
+ import * as i3 from '@angular/material/form-field';
12
+ import { MatFormFieldModule } from '@angular/material/form-field';
13
+ import * as i4 from '@angular/material/button';
14
+ import { MatButtonModule } from '@angular/material/button';
15
+ import * as i5 from '@angular/material/input';
16
+ import { MatInputModule } from '@angular/material/input';
17
+ import * as i5$1 from '@angular/common';
18
+ import { CommonModule } from '@angular/common';
19
+ import * as i3$1 from '@angular/router';
20
+ import { RouterModule } from '@angular/router';
21
+ import * as i2$2 from '@angular/material/snack-bar';
22
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
23
+ import * as i2$1 from '@angular/material/icon';
24
+ import { MatIconModule } from '@angular/material/icon';
25
+ import * as i8 from '@angular/cdk/drag-drop';
26
+ import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
27
+ import { valid } from 'semver';
28
+ import * as i3$2 from '@angular/material/chips';
29
+ import { MatChipsModule } from '@angular/material/chips';
30
+ import * as i4$1 from '@angular/material/autocomplete';
31
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
32
+ import * as i4$2 from '@angular/material/core';
33
+ import { MatOptionModule } from '@angular/material/core';
34
+ import * as i5$2 from '@angular/material/tooltip';
35
+ import { MatTooltipModule } from '@angular/material/tooltip';
36
+ import * as i3$3 from '@angular/material/select';
37
+ import { MatSelectModule } from '@angular/material/select';
38
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
39
+ import { MatMenuModule } from '@angular/material/menu';
40
+
41
+ class Configuration {
42
+ constructor() {
43
+ this.basePath = 'https://api.configcat.com';
44
+ }
45
+ }
46
+ Configuration.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: Configuration, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
47
+ Configuration.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: Configuration });
48
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: Configuration, decorators: [{
49
+ type: Injectable
50
+ }] });
51
+
52
+ class PublicApiService {
53
+ constructor(httpClient, configuration) {
54
+ this.httpClient = httpClient;
55
+ this.configuration = configuration;
56
+ }
57
+ createMeService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
58
+ var _a, _b, _c;
59
+ return new MeService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
60
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
61
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
62
+ }));
63
+ }
64
+ createProductsService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
65
+ var _a, _b, _c;
66
+ return new ProductsService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
67
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
68
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
69
+ }));
70
+ }
71
+ createConfigsService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
72
+ var _a, _b, _c;
73
+ return new ConfigsService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
74
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
75
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
76
+ }));
77
+ }
78
+ createEnvironmentsService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
79
+ var _a, _b, _c;
80
+ return new EnvironmentsService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
81
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
82
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
83
+ }));
84
+ }
85
+ createSettingsService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
86
+ var _a, _b, _c;
87
+ return new FeatureFlagsSettingsService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
88
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
89
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
90
+ }));
91
+ }
92
+ createSettingValuesService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
93
+ var _a, _b, _c;
94
+ return new FeatureFlagSettingValuesService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
95
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
96
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
97
+ }));
98
+ }
99
+ createIntegrationLinksService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
100
+ var _a, _b, _c;
101
+ return new IntegrationLinksService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
102
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
103
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
104
+ }));
105
+ }
106
+ createSegmentsService(basicAuthUsername = null, basicAuthPassword = null, basePath = null) {
107
+ var _a, _b, _c;
108
+ return new SegmentsService(this.httpClient, basePath !== null && basePath !== void 0 ? basePath : (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.basePath, new Configuration$1({
109
+ username: basicAuthUsername !== null && basicAuthUsername !== void 0 ? basicAuthUsername : (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.basicAuthUsername,
110
+ password: basicAuthPassword !== null && basicAuthPassword !== void 0 ? basicAuthPassword : (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.basicAuthPassword
111
+ }));
112
+ }
113
+ }
114
+ PublicApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: PublicApiService, deps: [{ token: i1.HttpClient }, { token: Configuration, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
115
+ PublicApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: PublicApiService, providedIn: 'root' });
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: PublicApiService, decorators: [{
117
+ type: Injectable,
118
+ args: [{ providedIn: 'root' }]
119
+ }], ctorParameters: function () {
120
+ return [{ type: i1.HttpClient }, { type: Configuration, decorators: [{
121
+ type: Optional
122
+ }] }];
123
+ } });
124
+
125
+ class BaseComponent {
126
+ constructor(publicApiService) {
127
+ this.publicApiService = publicApiService;
128
+ this.basePath = null;
129
+ this.basicAuthUsername = null;
130
+ this.basicAuthPassword = null;
131
+ }
132
+ createProductsService() {
133
+ return this.publicApiService.createProductsService(this.basicAuthUsername, this.basicAuthPassword, this.basePath);
134
+ }
135
+ createConfigsService() {
136
+ return this.publicApiService.createConfigsService(this.basicAuthUsername, this.basicAuthPassword, this.basePath);
137
+ }
138
+ createEnvironmentsService() {
139
+ return this.publicApiService.createEnvironmentsService(this.basicAuthUsername, this.basicAuthPassword, this.basePath);
140
+ }
141
+ createSettingsService() {
142
+ return this.publicApiService.createSettingsService(this.basicAuthUsername, this.basicAuthPassword, this.basePath);
143
+ }
144
+ createSettingValuesService() {
145
+ return this.publicApiService.createSettingValuesService(this.basicAuthUsername, this.basicAuthPassword, this.basePath);
146
+ }
147
+ createSegmentsService() {
148
+ return this.publicApiService.createSegmentsService(this.basicAuthUsername, this.basicAuthPassword, this.basePath);
149
+ }
150
+ }
151
+ BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: BaseComponent, deps: [{ token: PublicApiService }], target: i0.ɵɵFactoryTarget.Component });
152
+ BaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: BaseComponent, selector: "base", inputs: { basePath: "basePath", basicAuthUsername: "basicAuthUsername", basicAuthPassword: "basicAuthPassword" }, ngImport: i0, template: '<div></div>', isInline: true });
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: BaseComponent, decorators: [{
154
+ type: Component,
155
+ args: [{
156
+ selector: 'base',
157
+ template: '<div></div>'
158
+ }]
159
+ }], ctorParameters: function () { return [{ type: PublicApiService }]; }, propDecorators: { basePath: [{
160
+ type: Input
161
+ }], basicAuthUsername: [{
162
+ type: Input
163
+ }], basicAuthPassword: [{
164
+ type: Input
165
+ }] } });
166
+
167
+ class ReasonDialogComponent {
168
+ constructor(dialogRef, formBuilder) {
169
+ this.dialogRef = dialogRef;
170
+ this.formBuilder = formBuilder;
171
+ }
172
+ ngOnInit() {
173
+ this.formGroup = this.formBuilder.group({
174
+ reason: ['', [Validators.required, Validators.maxLength(1000)]]
175
+ });
176
+ }
177
+ handleSaveButton() {
178
+ if (!this.formGroup.valid) {
179
+ return;
180
+ }
181
+ this.dialogRef.close({ button: 'save', reason: this.formGroup.controls.reason.value });
182
+ }
183
+ cancel() {
184
+ this.dialogRef.close({ button: 'cancel' });
185
+ }
186
+ }
187
+ ReasonDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ReasonDialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: i2.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
188
+ ReasonDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: ReasonDialogComponent, selector: "configcat-reason-dialog", ngImport: i0, template: "<h3 mat-dialog-title>Add notes</h3>\n<p>This will appear in the Why column of the Audit Log.</p>\n<form [formGroup]=\"formGroup\" (ngSubmit)=\"handleSaveButton()\">\n <div mat-dialog-content class=\"container\">\n <mat-form-field appearance=\"outline\">\n <mat-label></mat-label>\n <textarea matInput formControlName=\"reason\" name=\"reason\" placeholder=\"I'm changing settings because...\"\n rows=\"3\"></textarea>\n <mat-error *ngIf=\"formGroup.controls.reason.invalid\">The field is required.</mat-error>\n </mat-form-field>\n </div>\n <br>\n <div mat-dialog-actions>\n <button type=\"submit\" style=\"margin-right: 10px;\" mat-raised-button color=\"primary\">Add notes & Save</button>\n <button type=\"button\" mat-raised-button (click)=\"cancel()\">Cancel</button>\n </div>\n</form>", styles: [".container>*{width:100%}\n"], components: [{ type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i3.MatLabel, selector: "mat-label" }, { type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.MatError, selector: "mat-error", inputs: ["id"] }, { type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
189
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ReasonDialogComponent, decorators: [{
190
+ type: Component,
191
+ args: [{ selector: 'configcat-reason-dialog', template: "<h3 mat-dialog-title>Add notes</h3>\n<p>This will appear in the Why column of the Audit Log.</p>\n<form [formGroup]=\"formGroup\" (ngSubmit)=\"handleSaveButton()\">\n <div mat-dialog-content class=\"container\">\n <mat-form-field appearance=\"outline\">\n <mat-label></mat-label>\n <textarea matInput formControlName=\"reason\" name=\"reason\" placeholder=\"I'm changing settings because...\"\n rows=\"3\"></textarea>\n <mat-error *ngIf=\"formGroup.controls.reason.invalid\">The field is required.</mat-error>\n </mat-form-field>\n </div>\n <br>\n <div mat-dialog-actions>\n <button type=\"submit\" style=\"margin-right: 10px;\" mat-raised-button color=\"primary\">Add notes & Save</button>\n <button type=\"button\" mat-raised-button (click)=\"cancel()\">Cancel</button>\n </div>\n</form>", styles: [".container>*{width:100%}\n"] }]
192
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: i2.FormBuilder }]; } });
193
+
194
+ class SaveSnackbarComponent {
195
+ constructor() { }
196
+ ngOnInit() {
197
+ }
198
+ }
199
+ SaveSnackbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SaveSnackbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
200
+ SaveSnackbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: SaveSnackbarComponent, selector: "configcat-save-snackbar", ngImport: i0, template: "<p class=\"header\">Settings saved successfully.</p>", styles: ["p{text-align:center;font-weight:700}.header{font-size:1.2em}\n"] });
201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SaveSnackbarComponent, decorators: [{
202
+ type: Component,
203
+ args: [{ selector: 'configcat-save-snackbar', template: "<p class=\"header\">Settings saved successfully.</p>", styles: ["p{text-align:center;font-weight:700}.header{font-size:1.2em}\n"] }]
204
+ }], ctorParameters: function () { return []; } });
205
+
206
+ class ConcurrentDialogComponent {
207
+ constructor(dialogRef) {
208
+ this.dialogRef = dialogRef;
209
+ }
210
+ ngOnInit() {
211
+ }
212
+ save() {
213
+ this.dialogRef.close({ button: 'save' });
214
+ }
215
+ discard() {
216
+ this.dialogRef.close({ button: 'discard' });
217
+ }
218
+ }
219
+ ConcurrentDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ConcurrentDialogComponent, deps: [{ token: i1$1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
220
+ ConcurrentDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: ConcurrentDialogComponent, selector: "configcat-concurrent-dialog", ngImport: i0, template: "<h3 mat-dialog-title>Concurrent update detected</h3>\n<p>\n Somebody updated the feature flags & settings while you were editing them.\n</p>\n<ul>\n <li>\n To discard your local changes and reload the updated values, click <strong>Discard my changes & reload</strong>\n </li>\n <li>\n To save you local values and overwrite the remote changes, click <strong>Save anyway</strong>\n </li>\n</ul>\n<p>For more info about the changes check the <a [routerLink]=\"['/auditlog']\" target=\"_blank\" rel=\"noopener noreferrer\" >audit logs</a> in a new tab.</p>\n<div mat-dialog-actions>\n <button type=\"button\" style=\"margin-right: 10px;\" mat-raised-button color=\"primary\" (click)=\"discard()\">Discard\n local changes & reload</button>\n <button type=\"button\" mat-raised-button (click)=\"save()\">Save anyway</button>\n</div>", styles: [""], components: [{ type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i3$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ConcurrentDialogComponent, decorators: [{
222
+ type: Component,
223
+ args: [{ selector: 'configcat-concurrent-dialog', template: "<h3 mat-dialog-title>Concurrent update detected</h3>\n<p>\n Somebody updated the feature flags & settings while you were editing them.\n</p>\n<ul>\n <li>\n To discard your local changes and reload the updated values, click <strong>Discard my changes & reload</strong>\n </li>\n <li>\n To save you local values and overwrite the remote changes, click <strong>Save anyway</strong>\n </li>\n</ul>\n<p>For more info about the changes check the <a [routerLink]=\"['/auditlog']\" target=\"_blank\" rel=\"noopener noreferrer\" >audit logs</a> in a new tab.</p>\n<div mat-dialog-actions>\n <button type=\"button\" style=\"margin-right: 10px;\" mat-raised-button color=\"primary\" (click)=\"discard()\">Discard\n local changes & reload</button>\n <button type=\"button\" mat-raised-button (click)=\"save()\">Save anyway</button>\n</div>", styles: [""] }]
224
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }]; } });
225
+
226
+ class SettingListFormHelper {
227
+ constructor(formBuilder) {
228
+ this.formBuilder = formBuilder;
229
+ }
230
+ createSettingValuesFormGroup(settingValuesModel) {
231
+ const formGroup = this.formBuilder.group({
232
+ settingValues: this.formBuilder.array(settingValuesModel.settingValues.map(sv => {
233
+ return this.createSettingValueFormGroup(sv, settingValuesModel.readOnly);
234
+ })),
235
+ // Decorator
236
+ environment: this.formBuilder.group({
237
+ environmentId: [{ value: settingValuesModel.environment.environmentId, disabled: true }],
238
+ name: [{ value: settingValuesModel.environment.name, disabled: true }],
239
+ }),
240
+ comparisonAttributes: [[]],
241
+ allRolloutRulesCount: [0]
242
+ });
243
+ const rolloutRules = this.getAllRolloutRules(formGroup);
244
+ const comparisonAttributes = this.getComparisonAttributes(rolloutRules);
245
+ formGroup.patchValue({ allRolloutRulesCount: rolloutRules.length });
246
+ formGroup.patchValue({ comparisonAttributes: comparisonAttributes });
247
+ return formGroup;
248
+ }
249
+ createSettingValueFormGroup(settingValueModel, readOnly) {
250
+ if (!settingValueModel.setting) {
251
+ return this.formBuilder.group({});
252
+ }
253
+ return this.formBuilder.group({
254
+ settingId: [settingValueModel.setting.settingId],
255
+ value: [
256
+ { value: settingValueModel.value, disabled: readOnly },
257
+ this.getValidatorsForSettingType(settingValueModel.setting.settingType)
258
+ ],
259
+ rolloutPercentageItems: settingValueModel.rolloutPercentageItems
260
+ ? this.formBuilder.array(settingValueModel.rolloutPercentageItems.map(p => {
261
+ // @ts-ignore()
262
+ return this.createRolloutPercentageItemFormGroup(p, readOnly, settingValueModel.setting.settingType);
263
+ }))
264
+ : this.formBuilder.array([]), rolloutRules: settingValueModel.rolloutRules
265
+ ? this.formBuilder.array(settingValueModel.rolloutRules.map(r => {
266
+ // @ts-ignore()
267
+ return this.createRolloutRuleFormGroup(r, readOnly, settingValueModel.setting.settingType);
268
+ }))
269
+ : this.formBuilder.array([]),
270
+ updatedAt: [{ value: settingValueModel.updatedAt, disabled: true }],
271
+ lastUpdaterUserEmail: [{ value: settingValueModel.lastUpdaterUserEmail, disabled: true }],
272
+ lastUpdaterUserFullName: [{ value: settingValueModel.lastUpdaterUserFullName, disabled: true }],
273
+ rolloutPercentageItemsSum: [{ value: 100, disabled: false }, [Validators.min(100), Validators.max(100)]],
274
+ // Decoration
275
+ setting: this.formBuilder.group({
276
+ settingId: [{ value: settingValueModel.setting.settingId, disabled: true }],
277
+ key: [{ value: settingValueModel.setting.key, disabled: true }],
278
+ name: [{ value: settingValueModel.setting.name, disabled: true }],
279
+ hint: [{ value: settingValueModel.setting.hint, disabled: true }],
280
+ settingType: [{ value: settingValueModel.setting.settingType, disabled: true }],
281
+ creatorEmail: [{ value: settingValueModel.setting.creatorEmail, disabled: true }],
282
+ creatorFullName: [{ value: settingValueModel.setting.creatorFullName, disabled: true }],
283
+ createdAt: [{ value: settingValueModel.setting.createdAt, disabled: true }]
284
+ }),
285
+ integrationLinks: settingValueModel.integrationLinks ? this.formBuilder.array(settingValueModel.integrationLinks.map(il => {
286
+ return this.formBuilder.group({
287
+ key: [{ value: il.key, disabled: true }],
288
+ description: [{ value: il.description, disabled: true }],
289
+ integrationLinkType: [{ value: il.integrationLinkType, disabled: true }],
290
+ url: [{ value: il.url, disabled: true }],
291
+ });
292
+ })) : this.formBuilder.array([])
293
+ });
294
+ }
295
+ createRolloutPercentageItemFormGroup(p, readOnly, settingType) {
296
+ return this.formBuilder.group({
297
+ percentage: [{ value: p.percentage, disabled: readOnly }, [Validators.required, Validators.min(0), Validators.max(100)]],
298
+ value: [
299
+ { value: p.value, disabled: readOnly },
300
+ this.getValidatorsForSettingType(settingType)
301
+ ],
302
+ valueDisabled: [
303
+ { value: p.value, disabled: true }, // For percentage item value
304
+ ]
305
+ });
306
+ }
307
+ createRolloutRuleFormGroup(r, readOnly, settingType) {
308
+ if (r.comparator) {
309
+ return this.formBuilder.group({
310
+ type: [{ value: 0, disabled: true }],
311
+ comparisonAttribute: [{ value: r.comparisonAttribute, disabled: readOnly }, [Validators.required]],
312
+ comparator: [{ value: r.comparator, disabled: readOnly }, [Validators.required]],
313
+ comparisonValue: [{ value: r.comparisonValue, disabled: readOnly }, [Validators.required]],
314
+ value: [
315
+ { value: r.value, disabled: readOnly },
316
+ this.getValidatorsForSettingType(settingType)
317
+ ],
318
+ });
319
+ }
320
+ else if (r.segmentComparator) {
321
+ return this.formBuilder.group({
322
+ type: [{ value: 1, disabled: true }],
323
+ segmentComparator: [{ value: r.segmentComparator, disabled: readOnly }, [Validators.required]],
324
+ segmentId: [{ value: r.segmentId, disabled: readOnly }, [Validators.required]],
325
+ value: [
326
+ { value: r.value, disabled: readOnly },
327
+ this.getValidatorsForSettingType(settingType)
328
+ ],
329
+ });
330
+ }
331
+ else {
332
+ throw new Error('Invalid rollout rule');
333
+ }
334
+ }
335
+ getValidatorsForSettingType(settingType) {
336
+ switch (settingType) {
337
+ case SettingType.Int:
338
+ return [Validators.required,
339
+ Validators.min(-2147483648), Validators.max(2147483647), Validators.pattern('^[-+]?[0-9]\\d*$')];
340
+ case SettingType.Double:
341
+ return [Validators.required, Validators.min(-1.79769313486232E+308), Validators.max(1.79769313486232E+308)];
342
+ case SettingType.String:
343
+ case SettingType.Boolean:
344
+ return [Validators.required];
345
+ default:
346
+ return [];
347
+ }
348
+ }
349
+ getAllRolloutRules(formGroup) {
350
+ const settingValues = formGroup.get('settingValues');
351
+ const rolloutRules = settingValues.controls.map(cv => cv.get('rolloutRules').value);
352
+ return rolloutRules.length === 0 ? rolloutRules : rolloutRules.reduce((a, b) => a.concat(b));
353
+ }
354
+ getComparisonAttributes(rolloutRules) {
355
+ if (rolloutRules.length > 0) {
356
+ const currentComparisonAttributes = rolloutRules.map(r => r.comparisonAttribute);
357
+ const defaultComparisonAttributes = ['Identifier', 'Email', 'Country'];
358
+ const comparisonAttributes = currentComparisonAttributes.filter(c => defaultComparisonAttributes.indexOf(c) === -1);
359
+ return Array.from(new Set(comparisonAttributes));
360
+ }
361
+ else {
362
+ return [];
363
+ }
364
+ }
365
+ }
366
+ SettingListFormHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingListFormHelper, deps: [{ token: i2.FormBuilder }], target: i0.ɵɵFactoryTarget.Injectable });
367
+ SettingListFormHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingListFormHelper, providedIn: 'root' });
368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingListFormHelper, decorators: [{
369
+ type: Injectable,
370
+ args: [{ providedIn: 'root' }]
371
+ }], ctorParameters: function () { return [{ type: i2.FormBuilder }]; } });
372
+
373
+ class ExpandDialogComponent {
374
+ constructor(dialogRef, formBuilder, data) {
375
+ this.dialogRef = dialogRef;
376
+ this.formBuilder = formBuilder;
377
+ this.data = data;
378
+ }
379
+ ngOnInit() {
380
+ if (this.data.multiline) {
381
+ this.buildFormGroup();
382
+ }
383
+ else {
384
+ this.formControlSubscription = this.data.control.valueChanges.subscribe((value) => {
385
+ this.data.control.setValue(value, { onlySelf: true, emitEvent: false, emitModelToViewChange: true });
386
+ this.data.control.markAsDirty();
387
+ }, () => { }, () => { });
388
+ }
389
+ }
390
+ values() {
391
+ return this.formGroup.get('values');
392
+ }
393
+ getValueControls() {
394
+ return this.values().controls.map(c => c);
395
+ }
396
+ buildFormGroup() {
397
+ const value = this.data.control.value ? this.data.control.value : '';
398
+ const list = value.split(',').map((v) => v.trim()).filter((v) => !!v);
399
+ this.formGroup = this.formBuilder.group({
400
+ values: this.formBuilder.array(list.map((v) => this.formBuilder.control(v)))
401
+ });
402
+ this.formGroupSubscription = this.formGroup.valueChanges.subscribe((formGroupValue) => {
403
+ this.data.control.setValue(formGroupValue.values
404
+ .filter((v) => !!v)
405
+ .join(','), { onlySelf: true, emitEvent: false, emitModelToViewChange: true });
406
+ this.data.control.updateValueAndValidity();
407
+ this.data.control.markAsDirty();
408
+ });
409
+ }
410
+ add() {
411
+ this.formGroup.controls.values.push(this.formBuilder.control(''));
412
+ }
413
+ remove(index) {
414
+ this.formGroup.controls.values.removeAt(index);
415
+ }
416
+ ngOnDestroy() {
417
+ if (this.formControlSubscription) {
418
+ this.formControlSubscription.unsubscribe();
419
+ this.formControlSubscription = null;
420
+ }
421
+ if (this.formGroupSubscription) {
422
+ this.formGroupSubscription.unsubscribe();
423
+ this.formGroupSubscription = null;
424
+ }
425
+ }
426
+ close() {
427
+ this.dialogRef.close();
428
+ }
429
+ }
430
+ ExpandDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ExpandDialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: i2.FormBuilder }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
431
+ ExpandDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: ExpandDialogComponent, selector: "configcat-expand-dialog", ngImport: i0, template: "<div mat-dialog-content class=\"container\">\n\n <mat-form-field appearance=\"outline\" *ngIf=\"!data.multiline\">\n <mat-label></mat-label>\n <textarea matInput [formControl]=\"data.control\" rows=\"15\"></textarea>\n </mat-form-field>\n <div [formGroup]=\"formGroup\" *ngIf=\"data.multiline\">\n <div *ngFor=\"let valueControl of getValueControls(); let i = index;\"\n class=\"value-field\">\n <mat-form-field appearance=\"outline\">\n <input matInput [formControl]=\"valueControl\" rows=\"15\" />\n </mat-form-field>\n <button (click)=\"remove(i)\" mat-icon-button type=\"button\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n </div>\n <button (click)=\"add()\" mat-icon-button type=\"button\">\n <mat-icon>add</mat-icon>\n </button>\n </div>\n</div>\n<div mat-dialog-actions>\n <button type=\"button\" mat-raised-button color=\"primary\" (click)=\"close()\">Done</button>\n</div>", styles: [".container>*{width:100%}.container>* .value-field{display:flex;font-size:12px;flex-wrap:nowrap}.container>* .value-field mat-form-field{flex-grow:1}\n"], components: [{ type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.MatLabel, selector: "mat-label" }, { type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ExpandDialogComponent, decorators: [{
433
+ type: Component,
434
+ args: [{ selector: 'configcat-expand-dialog', template: "<div mat-dialog-content class=\"container\">\n\n <mat-form-field appearance=\"outline\" *ngIf=\"!data.multiline\">\n <mat-label></mat-label>\n <textarea matInput [formControl]=\"data.control\" rows=\"15\"></textarea>\n </mat-form-field>\n <div [formGroup]=\"formGroup\" *ngIf=\"data.multiline\">\n <div *ngFor=\"let valueControl of getValueControls(); let i = index;\"\n class=\"value-field\">\n <mat-form-field appearance=\"outline\">\n <input matInput [formControl]=\"valueControl\" rows=\"15\" />\n </mat-form-field>\n <button (click)=\"remove(i)\" mat-icon-button type=\"button\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n </div>\n <button (click)=\"add()\" mat-icon-button type=\"button\">\n <mat-icon>add</mat-icon>\n </button>\n </div>\n</div>\n<div mat-dialog-actions>\n <button type=\"button\" mat-raised-button color=\"primary\" (click)=\"close()\">Done</button>\n</div>", styles: [".container>*{width:100%}.container>* .value-field{display:flex;font-size:12px;flex-wrap:nowrap}.container>* .value-field mat-form-field{flex-grow:1}\n"] }]
435
+ }], ctorParameters: function () {
436
+ return [{ type: i1$1.MatDialogRef }, { type: i2.FormBuilder }, { type: undefined, decorators: [{
437
+ type: Inject,
438
+ args: [MAT_DIALOG_DATA]
439
+ }] }];
440
+ } });
441
+
442
+ class ValueComponent {
443
+ constructor(dialog) {
444
+ this.dialog = dialog;
445
+ this.SettingType = SettingType;
446
+ }
447
+ popOut() {
448
+ this.dialog.open(ExpandDialogComponent, {
449
+ width: '640px',
450
+ data: { control: this.valueFormControl }
451
+ });
452
+ }
453
+ }
454
+ ValueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ValueComponent, deps: [{ token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
455
+ ValueComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: ValueComponent, selector: "configcat-value", inputs: { valueFormControl: "valueFormControl", setting: "setting" }, ngImport: i0, template: "<div class=\"flex\">\n <div class=\"container\" [ngSwitch]=\"setting.settingType\">\n <div *ngSwitchCase=\"SettingType.String\" class=\"with-validation\">\n <span *ngIf=\"valueFormControl.invalid\" class=\"error\">*</span>\n <input [ngClass]=\"{'invalid': valueFormControl.invalid}\" type=\"text\"\n [formControl]=\"valueFormControl\" placeholder=\"my value\" name=\"value\">\n <div class=\"expand\" (click)=\"popOut()\" matTooltip=\"Pop-out Editor\">\n <mat-icon>height</mat-icon>\n </div>\n </div>\n <div *ngSwitchCase=\"SettingType.Int\" class=\"with-validation\">\n <span *ngIf=\"valueFormControl.invalid\" class=\"error\">*</span>\n <input [ngClass]=\"{'invalid': valueFormControl.invalid}\" type=\"number\" [formControl]=\"valueFormControl\"\n placeholder=\"42\" name=\"value\" />\n </div>\n <div *ngSwitchCase=\"SettingType.Double\" class=\"with-validation\">\n <span *ngIf=\"valueFormControl.invalid\" class=\"error\">*</span>\n <input [ngClass]=\"{'invalid': valueFormControl.invalid}\" type=\"number\" [formControl]=\"valueFormControl\"\n placeholder=\"3.14\" name=\"value\">\n </div>\n <div *ngSwitchCase=\"SettingType.Boolean\" class=\"toggle\">\n <label class=\"switch\">\n <input type=\"checkbox\" [formControl]=\"valueFormControl\" name=\"value\" />\n <span class=\"slider round\"></span>\n </label>\n </div>\n </div>\n <div *ngIf=\"setting.settingType === SettingType.Boolean\" class=\"spacer\"></div>\n\n</div>\n", styles: [".switch{position:relative;width:66px;height:30px;margin-left:4px;margin-top:0;margin-bottom:0}.switch input{display:none}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ff5252;transition:.4s;width:66px;height:30px}.slider:before{position:absolute;content:\"\";height:22px;width:22px;left:4px;bottom:4px;background-color:#fff;transition:.4s}input:checked+.slider{background-color:#9acd32}input:focus+.slider{box-shadow:0 0 1px #9acd32}input:checked+.slider:before{transform:translate(36px)}.slider.round{border-radius:34px}.slider.round:before{border-radius:50%}.slider:after{content:\"Off\";color:#fff;display:block;position:absolute;transform:translate(-14%,-50%);top:50%;left:50%;font-size:10px;font-family:Verdana,sans-serif}input:checked+.slider:after{content:\"On\";transform:translate(-91%,-50%)}\n", ".flex{display:flex;margin-right:20px;align-items:center}.flex .spacer{width:15px}.flex .container .with-validation{display:flex;flex-wrap:nowrap}.flex .container .toggle{width:66px;height:30px}.flex .container input{background-color:#fff;border:1px solid #e5e5e5;min-height:28px;font-size:15px;padding:0 30px 0 10px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300;min-width:170px}.flex .container .invalid{border:1px solid #ff5252}.flex .container .error{color:#ff5252;margin-right:5px}@media (max-width: 1200px){.flex .container input{min-width:auto}}.flex .variationId{margin-left:5px;cursor:pointer;color:#888;display:flex;align-items:center}.flex .expand{position:relative;top:2px;height:24px;cursor:pointer;margin-left:-28px;z-index:1;color:#b3b3b3;background-color:#fff}.flex .expand mat-icon{transform:rotate(45deg)}\n"], components: [{ type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i5$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }] });
456
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ValueComponent, decorators: [{
457
+ type: Component,
458
+ args: [{ selector: 'configcat-value', template: "<div class=\"flex\">\n <div class=\"container\" [ngSwitch]=\"setting.settingType\">\n <div *ngSwitchCase=\"SettingType.String\" class=\"with-validation\">\n <span *ngIf=\"valueFormControl.invalid\" class=\"error\">*</span>\n <input [ngClass]=\"{'invalid': valueFormControl.invalid}\" type=\"text\"\n [formControl]=\"valueFormControl\" placeholder=\"my value\" name=\"value\">\n <div class=\"expand\" (click)=\"popOut()\" matTooltip=\"Pop-out Editor\">\n <mat-icon>height</mat-icon>\n </div>\n </div>\n <div *ngSwitchCase=\"SettingType.Int\" class=\"with-validation\">\n <span *ngIf=\"valueFormControl.invalid\" class=\"error\">*</span>\n <input [ngClass]=\"{'invalid': valueFormControl.invalid}\" type=\"number\" [formControl]=\"valueFormControl\"\n placeholder=\"42\" name=\"value\" />\n </div>\n <div *ngSwitchCase=\"SettingType.Double\" class=\"with-validation\">\n <span *ngIf=\"valueFormControl.invalid\" class=\"error\">*</span>\n <input [ngClass]=\"{'invalid': valueFormControl.invalid}\" type=\"number\" [formControl]=\"valueFormControl\"\n placeholder=\"3.14\" name=\"value\">\n </div>\n <div *ngSwitchCase=\"SettingType.Boolean\" class=\"toggle\">\n <label class=\"switch\">\n <input type=\"checkbox\" [formControl]=\"valueFormControl\" name=\"value\" />\n <span class=\"slider round\"></span>\n </label>\n </div>\n </div>\n <div *ngIf=\"setting.settingType === SettingType.Boolean\" class=\"spacer\"></div>\n\n</div>\n", styles: [".switch{position:relative;width:66px;height:30px;margin-left:4px;margin-top:0;margin-bottom:0}.switch input{display:none}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ff5252;transition:.4s;width:66px;height:30px}.slider:before{position:absolute;content:\"\";height:22px;width:22px;left:4px;bottom:4px;background-color:#fff;transition:.4s}input:checked+.slider{background-color:#9acd32}input:focus+.slider{box-shadow:0 0 1px #9acd32}input:checked+.slider:before{transform:translate(36px)}.slider.round{border-radius:34px}.slider.round:before{border-radius:50%}.slider:after{content:\"Off\";color:#fff;display:block;position:absolute;transform:translate(-14%,-50%);top:50%;left:50%;font-size:10px;font-family:Verdana,sans-serif}input:checked+.slider:after{content:\"On\";transform:translate(-91%,-50%)}\n", ".flex{display:flex;margin-right:20px;align-items:center}.flex .spacer{width:15px}.flex .container .with-validation{display:flex;flex-wrap:nowrap}.flex .container .toggle{width:66px;height:30px}.flex .container input{background-color:#fff;border:1px solid #e5e5e5;min-height:28px;font-size:15px;padding:0 30px 0 10px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300;min-width:170px}.flex .container .invalid{border:1px solid #ff5252}.flex .container .error{color:#ff5252;margin-right:5px}@media (max-width: 1200px){.flex .container input{min-width:auto}}.flex .variationId{margin-left:5px;cursor:pointer;color:#888;display:flex;align-items:center}.flex .expand{position:relative;top:2px;height:24px;cursor:pointer;margin-left:-28px;z-index:1;color:#b3b3b3;background-color:#fff}.flex .expand mat-icon{transform:rotate(45deg)}\n"] }]
459
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialog }]; }, propDecorators: { valueFormControl: [{
460
+ type: Input
461
+ }], setting: [{
462
+ type: Input
463
+ }] } });
464
+
465
+ class RolloutRulesComponent {
466
+ constructor(dialog) {
467
+ this.dialog = dialog;
468
+ this.readOnly = false;
469
+ this.SettingType = SettingType;
470
+ this.defaultComparisonAttributes = ['Identifier', 'Email', 'Country'];
471
+ this.rolloutRuleComparators = [
472
+ { value: RolloutRuleComparator.IsOneOf, label: 'IS ONE OF' },
473
+ { value: RolloutRuleComparator.IsNotOneOf, label: 'IS NOT ONE OF' },
474
+ { value: RolloutRuleComparator.Contains, label: 'CONTAINS' },
475
+ { value: RolloutRuleComparator.DoesNotContain, label: 'DOES NOT CONTAIN' },
476
+ { value: RolloutRuleComparator.SemVerIsOneOf, label: 'IS ONE OF (SemVer)' },
477
+ { value: RolloutRuleComparator.SemVerIsNotOneOf, label: 'IS NOT ONE OF (SemVer)' },
478
+ { value: RolloutRuleComparator.SemVerLess, label: '< (SemVer)' },
479
+ { value: RolloutRuleComparator.SemVerLessOrEquals, label: '<= (SemVer)' },
480
+ { value: RolloutRuleComparator.SemVerGreater, label: '> (SemVer)' },
481
+ { value: RolloutRuleComparator.SemVerGreaterOrEquals, label: '>= (SemVer)' },
482
+ { value: RolloutRuleComparator.NumberEquals, label: '= (Number)' },
483
+ { value: RolloutRuleComparator.NumberDoesNotEqual, label: '!= (Number)' },
484
+ { value: RolloutRuleComparator.NumberLess, label: '< (Number)' },
485
+ { value: RolloutRuleComparator.NumberLessOrEquals, label: '<= (Number)' },
486
+ { value: RolloutRuleComparator.NumberGreater, label: '> (Number)' },
487
+ { value: RolloutRuleComparator.NumberGreaterOrEquals, label: '>= (Number)' },
488
+ { value: RolloutRuleComparator.SensitiveIsOneOf, label: 'IS ONE OF (Sensitive)' },
489
+ { value: RolloutRuleComparator.SensitiveIsNotOneOf, label: 'IS NOT ONE OF (Sensitive)' },
490
+ ];
491
+ this.segmentComparators = [
492
+ { value: SegmentComparator.IsIn, label: 'IS IN SEGMENT' },
493
+ { value: SegmentComparator.IsNotIn, label: 'IS NOT IN SEGMENT' },
494
+ ];
495
+ }
496
+ onlyFirstTooltip() {
497
+ var _a;
498
+ return ((_a = this.formGroup.root.get('allRolloutRulesCount')) === null || _a === void 0 ? void 0 : _a.value) > 20 || this.rolloutRules().controls.length > 10;
499
+ }
500
+ setting() {
501
+ var _a;
502
+ return (_a = this.formGroup.get('setting')) === null || _a === void 0 ? void 0 : _a.value;
503
+ }
504
+ rolloutRules() {
505
+ return this.formGroup.get('rolloutRules');
506
+ }
507
+ comparisonAttributes() {
508
+ var _a;
509
+ return (_a = this.formGroup.root.get('comparisonAttributes')) === null || _a === void 0 ? void 0 : _a.value;
510
+ }
511
+ removeRule(index) {
512
+ this.rolloutRules().removeAt(index);
513
+ this.rolloutRules().markAsDirty();
514
+ }
515
+ onDrop(event) {
516
+ const rolloutRules = this.rolloutRules().controls;
517
+ moveItemInArray(rolloutRules, event.previousIndex, event.currentIndex);
518
+ this.formGroup.markAsDirty();
519
+ }
520
+ attributeChanged(event, comparisonAttribute) {
521
+ if (this.defaultComparisonAttributes.indexOf(event.value) !== -1) {
522
+ if (comparisonAttribute.value !== event.value) {
523
+ comparisonAttribute.setValue(event.value);
524
+ this.formGroup.markAsDirty();
525
+ }
526
+ }
527
+ else {
528
+ if (comparisonAttribute.value !== '') {
529
+ comparisonAttribute.setValue('');
530
+ this.formGroup.markAsDirty();
531
+ }
532
+ }
533
+ }
534
+ getPlaceHolder(rolloutRule) {
535
+ if (!rolloutRule.controls.comparisonAttribute.value) {
536
+ return '';
537
+ }
538
+ switch (rolloutRule.controls.comparator.value) {
539
+ case RolloutRuleComparator.IsOneOf:
540
+ case RolloutRuleComparator.IsNotOneOf:
541
+ case RolloutRuleComparator.SensitiveIsOneOf:
542
+ case RolloutRuleComparator.SensitiveIsNotOneOf:
543
+ switch (rolloutRule.controls.comparisonAttribute.value.toLowerCase()) {
544
+ case 'identifier':
545
+ return 'e.g: user_id1, user_id2, user_id3';
546
+ case 'email':
547
+ return 'e.g: jane@example.com, john@example.com';
548
+ case 'country':
549
+ return 'e.g: France, Brazil';
550
+ default:
551
+ return 'e.g: value1, value2, value3';
552
+ }
553
+ case RolloutRuleComparator.Contains:
554
+ case RolloutRuleComparator.DoesNotContain:
555
+ switch (rolloutRule.controls.comparisonAttribute.value.toLowerCase()) {
556
+ case 'identifier':
557
+ return 'part-of-id';
558
+ case 'email':
559
+ return 'e.g: @example.com';
560
+ case 'country':
561
+ return 'e.g: United';
562
+ default:
563
+ return 'e.g: any-part-of-your-value-string';
564
+ }
565
+ case RolloutRuleComparator.SemVerIsOneOf:
566
+ case RolloutRuleComparator.SemVerIsNotOneOf:
567
+ return 'e.g: 1.0.0, 2.0.1';
568
+ case RolloutRuleComparator.SemVerLessOrEquals:
569
+ case RolloutRuleComparator.SemVerLess:
570
+ case RolloutRuleComparator.SemVerGreater:
571
+ case RolloutRuleComparator.SemVerGreaterOrEquals:
572
+ return 'e.g: 1.0.0';
573
+ case RolloutRuleComparator.NumberEquals:
574
+ case RolloutRuleComparator.NumberDoesNotEqual:
575
+ case RolloutRuleComparator.NumberLess:
576
+ case RolloutRuleComparator.NumberLessOrEquals:
577
+ case RolloutRuleComparator.NumberGreater:
578
+ case RolloutRuleComparator.NumberGreaterOrEquals:
579
+ return 'e.g: 42';
580
+ }
581
+ return '';
582
+ }
583
+ getComparisonValueType(rolloutRule) {
584
+ switch (rolloutRule.controls.comparator.value) {
585
+ case RolloutRuleComparator.NumberEquals:
586
+ case RolloutRuleComparator.NumberDoesNotEqual:
587
+ case RolloutRuleComparator.NumberLess:
588
+ case RolloutRuleComparator.NumberLessOrEquals:
589
+ case RolloutRuleComparator.NumberGreater:
590
+ case RolloutRuleComparator.NumberGreaterOrEquals:
591
+ return 'number';
592
+ default:
593
+ return 'text';
594
+ }
595
+ }
596
+ getInfoClass(rolloutRule) {
597
+ if (!rolloutRule.controls.comparisonAttribute.value) {
598
+ return 'info';
599
+ }
600
+ switch (rolloutRule.controls.comparator.value) {
601
+ case RolloutRuleComparator.IsOneOf:
602
+ case RolloutRuleComparator.IsNotOneOf:
603
+ case RolloutRuleComparator.Contains:
604
+ case RolloutRuleComparator.DoesNotContain:
605
+ return 'warn';
606
+ default:
607
+ return 'info';
608
+ }
609
+ }
610
+ getInfoTooltip(rolloutRule) {
611
+ if (!rolloutRule.controls.comparisonAttribute.value) {
612
+ return 'Learn more about comparators';
613
+ }
614
+ switch (rolloutRule.controls.comparator.value) {
615
+ case RolloutRuleComparator.IsOneOf:
616
+ case RolloutRuleComparator.IsNotOneOf:
617
+ case RolloutRuleComparator.Contains:
618
+ case RolloutRuleComparator.DoesNotContain:
619
+ return 'Consider using sensitive text comparators. Click to learn more.';
620
+ default:
621
+ return 'Click to learn more about comparators';
622
+ }
623
+ }
624
+ comparatorChanged(rolloutRule) {
625
+ let validators = [];
626
+ switch (rolloutRule.controls.comparator.value) {
627
+ case RolloutRuleComparator.IsOneOf:
628
+ case RolloutRuleComparator.IsNotOneOf:
629
+ case RolloutRuleComparator.SensitiveIsOneOf:
630
+ case RolloutRuleComparator.SensitiveIsNotOneOf:
631
+ case RolloutRuleComparator.Contains:
632
+ case RolloutRuleComparator.DoesNotContain:
633
+ validators = [Validators.required, Validators.maxLength(65535)];
634
+ break;
635
+ case RolloutRuleComparator.SemVerIsOneOf:
636
+ case RolloutRuleComparator.SemVerIsNotOneOf:
637
+ validators = [Validators.required, this.validateSemVerList];
638
+ break;
639
+ case RolloutRuleComparator.SemVerLessOrEquals:
640
+ case RolloutRuleComparator.SemVerLess:
641
+ case RolloutRuleComparator.SemVerGreater:
642
+ case RolloutRuleComparator.SemVerGreaterOrEquals:
643
+ validators = [Validators.required, this.validateSemVer];
644
+ break;
645
+ case RolloutRuleComparator.NumberEquals:
646
+ case RolloutRuleComparator.NumberDoesNotEqual:
647
+ case RolloutRuleComparator.NumberLess:
648
+ case RolloutRuleComparator.NumberLessOrEquals:
649
+ case RolloutRuleComparator.NumberGreater:
650
+ case RolloutRuleComparator.NumberGreaterOrEquals:
651
+ validators = [Validators.required, Validators.min(-1.79769313486232E+308), Validators.max(1.79769313486232E+308)];
652
+ break;
653
+ }
654
+ rolloutRule.controls.comparisonValue.setValidators(validators);
655
+ rolloutRule.controls.comparisonValue.updateValueAndValidity();
656
+ }
657
+ isListType(rolloutRule) {
658
+ switch (rolloutRule.controls.comparator.value) {
659
+ case RolloutRuleComparator.IsOneOf:
660
+ case RolloutRuleComparator.IsNotOneOf:
661
+ case RolloutRuleComparator.SensitiveIsOneOf:
662
+ case RolloutRuleComparator.SensitiveIsNotOneOf:
663
+ case RolloutRuleComparator.SemVerIsOneOf:
664
+ case RolloutRuleComparator.SemVerIsNotOneOf:
665
+ return true;
666
+ default:
667
+ return false;
668
+ }
669
+ }
670
+ validateSemVer(c) {
671
+ if (valid(c.value) === null) {
672
+ return {
673
+ validateSemVer: {
674
+ valid: false
675
+ }
676
+ };
677
+ }
678
+ return null;
679
+ }
680
+ validateSemVerList(c) {
681
+ if (!c.value) {
682
+ return {
683
+ validateSemVerList: {
684
+ valid: false
685
+ }
686
+ };
687
+ }
688
+ const semvers = c.value.split(',').map((s) => s.trim());
689
+ if (semvers.find((s) => s && s !== '' && valid(s) === null)) {
690
+ return {
691
+ validateSemVerList: {
692
+ valid: false
693
+ }
694
+ };
695
+ }
696
+ return null;
697
+ }
698
+ popOut(rolloutRule) {
699
+ this.dialog.open(ExpandDialogComponent, {
700
+ width: '640px',
701
+ data: {
702
+ control: rolloutRule.controls.comparisonValue,
703
+ multiline: this.isListType(rolloutRule)
704
+ }
705
+ });
706
+ }
707
+ trackByIndex(index) {
708
+ return index;
709
+ }
710
+ getRolloutRuleValueFormControl(rolloutRule) {
711
+ return rolloutRule.controls.value;
712
+ }
713
+ getRolloutRuleComparisonValueFormControl(rolloutRule) {
714
+ return rolloutRule.controls.comparisonValue;
715
+ }
716
+ getRolloutRuleComparisonAttributeFormControl(rolloutRule) {
717
+ return rolloutRule.controls.comparisonAttribute;
718
+ }
719
+ getRolloutRuleTypeFormControl(rolloutRule) {
720
+ return rolloutRule.controls.type;
721
+ }
722
+ getRolloutRuleComparatorFormControl(rolloutRule) {
723
+ return rolloutRule.controls.comparator;
724
+ }
725
+ getRolloutRuleSegmentComparatorFormControl(rolloutRule) {
726
+ return rolloutRule.controls.segmentComparator;
727
+ }
728
+ getRolloutRuleSegmentIdFormControl(rolloutRule) {
729
+ return rolloutRule.controls.segmentId;
730
+ }
731
+ }
732
+ RolloutRulesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: RolloutRulesComponent, deps: [{ token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
733
+ RolloutRulesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: RolloutRulesComponent, selector: "configcat-rollout-rules", inputs: { formGroup: "formGroup", readOnly: "readOnly", segments: "segments" }, ngImport: i0, template: "<div [formGroup]=\"formGroup\">\n <div cdkDropList (cdkDropListDropped)=\"onDrop($event)\" [cdkDropListDisabled]=\"readOnly\"\n [cdkDropListData]=\"rolloutRules().controls\">\n <div *ngFor=\"let rolloutRule of rolloutRules().controls; trackBy: trackByIndex; let i = index\" cdkDrag>\n <div class=\"targeting-row\">\n <div class=\"fields flex\" *ngIf=\"getRolloutRuleTypeFormControl(rolloutRule).value === 0\">\n <div class=\"drag-handle\" cdkDragHandle data-tooltip=\"Drag here to reorder\" *ngIf=\"!readOnly\">\n <mat-icon>drag_indicator</mat-icon>\n </div>\n <div class=\"if\">\n <mat-chip-list [class.spacing]=\"i === 0\">\n <mat-chip class=\"chip\">{{ i === 0 ? 'IF' : 'ELSE IF' }}</mat-chip>\n </mat-chip-list>\n <a href=\"https://configcat.com/docs/advanced/user-object\" target=\"_blank\"\n rel=\"noopener noreferrer\">user's</a>\n </div>\n\n <select class=\"custom-select attribute-select\" matTooltip=\"Comparison attribute\"\n matTooltipPosition=\"above\" [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\"\n (change)=\"attributeChanged($event.target, getRolloutRuleComparisonAttributeFormControl(rolloutRule))\">\n <option *ngFor=\"let comparisonAttribute of defaultComparisonAttributes\"\n [selected]=\"comparisonAttribute === getRolloutRuleComparisonAttributeFormControl(rolloutRule).value\">\n {{comparisonAttribute}}</option>\n <option\n [selected]=\"defaultComparisonAttributes.indexOf(getRolloutRuleComparisonAttributeFormControl(rolloutRule).value) === -1\">\n Custom\n </option>\n </select>\n\n\n <span class=\"attribute-span\" data-tooltip=\"Custom user attribute\"\n [hidden]=\"defaultComparisonAttributes.indexOf(getRolloutRuleComparisonAttributeFormControl(rolloutRule).value) !== -1\">\n <span class=\"attribute-error\"\n *ngIf=\"getRolloutRuleComparisonAttributeFormControl(rolloutRule).invalid\">*</span>\n <input\n [ngClass]=\"{'invalid': getRolloutRuleComparisonAttributeFormControl(rolloutRule).invalid}\"\n type=\"text\" matInput [matAutocomplete]=\"auto\"\n [formControl]=\"getRolloutRuleComparisonAttributeFormControl(rolloutRule)\" class=\"attribute\"\n placeholder=\"e.g. Eye color\">\n </span>\n\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of comparisonAttributes()\" [value]=\"option\">\n {{option}}\n </mat-option>\n </mat-autocomplete>\n\n <div class=\"select-wrapper\">\n <select class=\"custom-select\" [formControl]=\"getRolloutRuleComparatorFormControl(rolloutRule)\"\n matTooltip=\"Comparator\" matTooltipPosition=\"above\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\"\n (change)=\"comparatorChanged(rolloutRule)\">\n <optgroup label=\"SENSITIVE TEXT\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(16, 18)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n <optgroup label=\"TEXT\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(0, 4)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n <optgroup label=\"SEMANTIC VERSION\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(4, 10)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n <optgroup label=\"NUMBER\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(10, 16)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n </select>\n <div [class]=\"getInfoClass(rolloutRule)\" [matTooltip]=\"getInfoTooltip(rolloutRule)\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\">\n <a href=\"https://configcat.com/docs/advanced/targeting/#comparator\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n <mat-icon>info</mat-icon>\n </a>\n </div>\n </div>\n\n <div class=\"comparison-value\" data-tooltip=\"Comparison value\">\n <span class=\"error\"\n *ngIf=\"getRolloutRuleComparisonValueFormControl(rolloutRule).invalid\">*</span>\n\n <input [ngClass]=\"{'invalid': getRolloutRuleComparisonValueFormControl(rolloutRule).invalid}\"\n [formControl]=\"getRolloutRuleComparisonValueFormControl(rolloutRule)\"\n [type]=\"getComparisonValueType(rolloutRule)\" [placeholder]=\"getPlaceHolder(rolloutRule)\">\n <div class=\"expand\" matTooltip=\"Pop-out Editor\" (click)=\"popOut(rolloutRule)\"\n *ngIf=\"getComparisonValueType(rolloutRule)==='text'\">\n <mat-icon>height</mat-icon>\n </div>\n </div>\n\n <div class=\"delete\" matTooltip=\"Remove targeting rule\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\" *ngIf=\"!readOnly\" (click)=\"removeRule(i)\">\n <mat-icon>cancel</mat-icon>\n </div>\n </div>\n\n <div class=\"fields flex\" *ngIf=\"getRolloutRuleTypeFormControl(rolloutRule).value === 1\">\n <div class=\"drag-handle\" cdkDragHandle data-tooltip=\"Drag here to reorder\" *ngIf=\"!readOnly\">\n <mat-icon>drag_indicator</mat-icon>\n </div>\n <div class=\"if\">\n <mat-chip-list [class.spacing]=\"i === 0\">\n <mat-chip class=\"chip\">{{ i === 0 ? 'IF' : 'ELSE IF' }}</mat-chip>\n </mat-chip-list>\n <a href=\"https://configcat.com/docs/advanced/user-object\" target=\"_blank\"\n rel=\"noopener noreferrer\">user</a>\n </div>\n\n\n <div class=\"select-wrapper\">\n <select class=\"custom-select segment-comparator\"\n [formControl]=\"getRolloutRuleSegmentComparatorFormControl(rolloutRule)\"\n matTooltip=\"Segment comparator\" matTooltipPosition=\"above\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\">\n <option *ngFor=\"let comparator of segmentComparators\" [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </select>\n </div>\n\n <div class=\"select-wrapper\">\n <span class=\"attribute-error\"\n *ngIf=\"getRolloutRuleSegmentIdFormControl(rolloutRule).invalid\">*</span>\n <select class=\"custom-select segment-select\"\n [formControl]=\"getRolloutRuleSegmentIdFormControl(rolloutRule)\" matTooltip=\"Segment\"\n matTooltipPosition=\"above\" [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\"\n [ngClass]=\"{'invalid': getRolloutRuleSegmentIdFormControl(rolloutRule).invalid}\">\n <option *ngFor=\"let segment of segments\" [ngValue]=\"segment.segmentId\">\n {{segment.name}}\n </option>\n </select>\n </div>\n\n\n <div class=\"delete\" matTooltip=\"Remove targeting rule\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\" *ngIf=\"!readOnly\" (click)=\"removeRule(i)\">\n <mat-icon>cancel</mat-icon>\n </div>\n </div>\n\n\n <div class=\"value flex\">\n <div class=\"serve\" *ngIf=\"setting().settingType !== SettingType.Boolean\">\n <mat-chip-list>\n <mat-chip class=\"chip\">Serve:</mat-chip>\n </mat-chip-list>\n </div>\n\n <configcat-value class=\"served-value\"\n [valueFormControl]=\"getRolloutRuleValueFormControl(rolloutRule)\" [setting]=\"setting()\">\n </configcat-value>\n </div>\n </div>\n </div>\n </div>\n</div>", styles: [".cdk-drop-list-dragging .cdk-drag{transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-animating{transition:transform .3s cubic-bezier(0,0,.2,1)}.targeting-row{border:1px solid #d5d5d5;border-radius:4px;background-color:#fff;margin:.5em 1em;display:flex;position:relative;padding:.5em 0}.targeting-row .select-wrapper{position:relative}.targeting-row .info{position:absolute;cursor:pointer;top:-8px;left:166px}.targeting-row .info a{color:#7fb3fd}.targeting-row .info a:hover{color:#0068f0}.targeting-row .info mat-icon{font-size:18px}.targeting-row .warn{position:absolute;cursor:pointer;top:-8px;left:128px}.targeting-row .warn a{color:#fdc67f}.targeting-row .warn a:hover{color:#ff9200}.targeting-row .warn mat-icon{font-size:18px}.chip{background-color:#67b1fc3d}.fields{justify-content:left;max-width:1060px;flex-grow:100}.fields .if{display:flex;align-items:center}.fields .if>*{margin:0 .5em}.fields .if .spacing{margin-right:46px}.fields .attribute-span{margin-left:.5em}.fields .attribute{width:170px;background-color:#fff;border:1px solid #e5e5e5;min-height:28px;min-width:170px;font-size:15px;padding:0 10px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.fields .invalid{border:1px solid #ff5252}.fields .attribute-error{color:#ff5252;margin-right:5px}.fields .delete{position:absolute;color:#d6a9a9;cursor:pointer;top:-8px;right:-12px;z-index:999}.fields .delete:hover{color:#ed5251}.fields .delete mat-icon{font-size:20px}.fields .drag-handle{position:absolute;cursor:-moz-grab;left:-20px;top:14px}.fields .drag-handle mat-icon{font-size:20px}.fields .custom-select{margin-left:.5em;width:170px;background-color:#fff;border:1px solid #e5e5e5;min-height:30px;min-width:170px;font-size:.8em;padding:0 5px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.fields .attribute-select{min-width:100px;width:100px;margin-left:0}.fields .comparison-value{flex-grow:100;min-width:200px;display:flex;align-items:center;margin-left:.5em}.fields .comparison-value .error{color:#ff5252;margin:0 5px}.fields .comparison-value input{background-color:#fff;border:1px solid #e5e5e5;min-height:28px;min-width:170px;flex-grow:100;font-size:15px;padding:0 30px 0 10px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.fields .comparison-value .invalid{border:1px solid #ff5252}.value{margin-left:auto;flex-wrap:nowrap}.value .serve{margin:0 5px}.warn{padding-left:3em;font-size:.8em}.flex{display:flex;flex-wrap:wrap;align-items:center}.expand{position:absolute;right:2px;font-size:8px;cursor:pointer;margin-left:-28px;z-index:1;color:#b3b3b3;background-color:#fff}.expand mat-icon{transform:rotate(45deg)}@media (max-width: 1200px){.targeting-row{flex-wrap:wrap}.targeting-row .fields{max-width:500px}}@media (max-width: 700px){.targeting-row{flex-direction:column;margin:.5em .3em}.targeting-row .help{left:161px}.targeting-row .fields{flex-direction:column;align-items:stretch}.targeting-row .fields .custom-select,.targeting-row .fields .comparison-value{margin:0}}\n"], components: [{ type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3$2.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i4$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: ValueComponent, selector: "configcat-value", inputs: ["valueFormControl", "setting"] }], directives: [{ type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i8.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i8.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i3$2.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i5$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }] });
734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: RolloutRulesComponent, decorators: [{
735
+ type: Component,
736
+ args: [{ selector: 'configcat-rollout-rules', template: "<div [formGroup]=\"formGroup\">\n <div cdkDropList (cdkDropListDropped)=\"onDrop($event)\" [cdkDropListDisabled]=\"readOnly\"\n [cdkDropListData]=\"rolloutRules().controls\">\n <div *ngFor=\"let rolloutRule of rolloutRules().controls; trackBy: trackByIndex; let i = index\" cdkDrag>\n <div class=\"targeting-row\">\n <div class=\"fields flex\" *ngIf=\"getRolloutRuleTypeFormControl(rolloutRule).value === 0\">\n <div class=\"drag-handle\" cdkDragHandle data-tooltip=\"Drag here to reorder\" *ngIf=\"!readOnly\">\n <mat-icon>drag_indicator</mat-icon>\n </div>\n <div class=\"if\">\n <mat-chip-list [class.spacing]=\"i === 0\">\n <mat-chip class=\"chip\">{{ i === 0 ? 'IF' : 'ELSE IF' }}</mat-chip>\n </mat-chip-list>\n <a href=\"https://configcat.com/docs/advanced/user-object\" target=\"_blank\"\n rel=\"noopener noreferrer\">user's</a>\n </div>\n\n <select class=\"custom-select attribute-select\" matTooltip=\"Comparison attribute\"\n matTooltipPosition=\"above\" [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\"\n (change)=\"attributeChanged($event.target, getRolloutRuleComparisonAttributeFormControl(rolloutRule))\">\n <option *ngFor=\"let comparisonAttribute of defaultComparisonAttributes\"\n [selected]=\"comparisonAttribute === getRolloutRuleComparisonAttributeFormControl(rolloutRule).value\">\n {{comparisonAttribute}}</option>\n <option\n [selected]=\"defaultComparisonAttributes.indexOf(getRolloutRuleComparisonAttributeFormControl(rolloutRule).value) === -1\">\n Custom\n </option>\n </select>\n\n\n <span class=\"attribute-span\" data-tooltip=\"Custom user attribute\"\n [hidden]=\"defaultComparisonAttributes.indexOf(getRolloutRuleComparisonAttributeFormControl(rolloutRule).value) !== -1\">\n <span class=\"attribute-error\"\n *ngIf=\"getRolloutRuleComparisonAttributeFormControl(rolloutRule).invalid\">*</span>\n <input\n [ngClass]=\"{'invalid': getRolloutRuleComparisonAttributeFormControl(rolloutRule).invalid}\"\n type=\"text\" matInput [matAutocomplete]=\"auto\"\n [formControl]=\"getRolloutRuleComparisonAttributeFormControl(rolloutRule)\" class=\"attribute\"\n placeholder=\"e.g. Eye color\">\n </span>\n\n <mat-autocomplete #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of comparisonAttributes()\" [value]=\"option\">\n {{option}}\n </mat-option>\n </mat-autocomplete>\n\n <div class=\"select-wrapper\">\n <select class=\"custom-select\" [formControl]=\"getRolloutRuleComparatorFormControl(rolloutRule)\"\n matTooltip=\"Comparator\" matTooltipPosition=\"above\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\"\n (change)=\"comparatorChanged(rolloutRule)\">\n <optgroup label=\"SENSITIVE TEXT\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(16, 18)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n <optgroup label=\"TEXT\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(0, 4)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n <optgroup label=\"SEMANTIC VERSION\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(4, 10)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n <optgroup label=\"NUMBER\">\n <option *ngFor=\"let comparator of rolloutRuleComparators.slice(10, 16)\"\n [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </optgroup>\n </select>\n <div [class]=\"getInfoClass(rolloutRule)\" [matTooltip]=\"getInfoTooltip(rolloutRule)\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\">\n <a href=\"https://configcat.com/docs/advanced/targeting/#comparator\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n <mat-icon>info</mat-icon>\n </a>\n </div>\n </div>\n\n <div class=\"comparison-value\" data-tooltip=\"Comparison value\">\n <span class=\"error\"\n *ngIf=\"getRolloutRuleComparisonValueFormControl(rolloutRule).invalid\">*</span>\n\n <input [ngClass]=\"{'invalid': getRolloutRuleComparisonValueFormControl(rolloutRule).invalid}\"\n [formControl]=\"getRolloutRuleComparisonValueFormControl(rolloutRule)\"\n [type]=\"getComparisonValueType(rolloutRule)\" [placeholder]=\"getPlaceHolder(rolloutRule)\">\n <div class=\"expand\" matTooltip=\"Pop-out Editor\" (click)=\"popOut(rolloutRule)\"\n *ngIf=\"getComparisonValueType(rolloutRule)==='text'\">\n <mat-icon>height</mat-icon>\n </div>\n </div>\n\n <div class=\"delete\" matTooltip=\"Remove targeting rule\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\" *ngIf=\"!readOnly\" (click)=\"removeRule(i)\">\n <mat-icon>cancel</mat-icon>\n </div>\n </div>\n\n <div class=\"fields flex\" *ngIf=\"getRolloutRuleTypeFormControl(rolloutRule).value === 1\">\n <div class=\"drag-handle\" cdkDragHandle data-tooltip=\"Drag here to reorder\" *ngIf=\"!readOnly\">\n <mat-icon>drag_indicator</mat-icon>\n </div>\n <div class=\"if\">\n <mat-chip-list [class.spacing]=\"i === 0\">\n <mat-chip class=\"chip\">{{ i === 0 ? 'IF' : 'ELSE IF' }}</mat-chip>\n </mat-chip-list>\n <a href=\"https://configcat.com/docs/advanced/user-object\" target=\"_blank\"\n rel=\"noopener noreferrer\">user</a>\n </div>\n\n\n <div class=\"select-wrapper\">\n <select class=\"custom-select segment-comparator\"\n [formControl]=\"getRolloutRuleSegmentComparatorFormControl(rolloutRule)\"\n matTooltip=\"Segment comparator\" matTooltipPosition=\"above\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\">\n <option *ngFor=\"let comparator of segmentComparators\" [ngValue]=\"comparator.value\">\n {{comparator.label}}\n </option>\n </select>\n </div>\n\n <div class=\"select-wrapper\">\n <span class=\"attribute-error\"\n *ngIf=\"getRolloutRuleSegmentIdFormControl(rolloutRule).invalid\">*</span>\n <select class=\"custom-select segment-select\"\n [formControl]=\"getRolloutRuleSegmentIdFormControl(rolloutRule)\" matTooltip=\"Segment\"\n matTooltipPosition=\"above\" [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\"\n [ngClass]=\"{'invalid': getRolloutRuleSegmentIdFormControl(rolloutRule).invalid}\">\n <option *ngFor=\"let segment of segments\" [ngValue]=\"segment.segmentId\">\n {{segment.name}}\n </option>\n </select>\n </div>\n\n\n <div class=\"delete\" matTooltip=\"Remove targeting rule\"\n [matTooltipDisabled]=\"onlyFirstTooltip() && i !== 0\" *ngIf=\"!readOnly\" (click)=\"removeRule(i)\">\n <mat-icon>cancel</mat-icon>\n </div>\n </div>\n\n\n <div class=\"value flex\">\n <div class=\"serve\" *ngIf=\"setting().settingType !== SettingType.Boolean\">\n <mat-chip-list>\n <mat-chip class=\"chip\">Serve:</mat-chip>\n </mat-chip-list>\n </div>\n\n <configcat-value class=\"served-value\"\n [valueFormControl]=\"getRolloutRuleValueFormControl(rolloutRule)\" [setting]=\"setting()\">\n </configcat-value>\n </div>\n </div>\n </div>\n </div>\n</div>", styles: [".cdk-drop-list-dragging .cdk-drag{transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-animating{transition:transform .3s cubic-bezier(0,0,.2,1)}.targeting-row{border:1px solid #d5d5d5;border-radius:4px;background-color:#fff;margin:.5em 1em;display:flex;position:relative;padding:.5em 0}.targeting-row .select-wrapper{position:relative}.targeting-row .info{position:absolute;cursor:pointer;top:-8px;left:166px}.targeting-row .info a{color:#7fb3fd}.targeting-row .info a:hover{color:#0068f0}.targeting-row .info mat-icon{font-size:18px}.targeting-row .warn{position:absolute;cursor:pointer;top:-8px;left:128px}.targeting-row .warn a{color:#fdc67f}.targeting-row .warn a:hover{color:#ff9200}.targeting-row .warn mat-icon{font-size:18px}.chip{background-color:#67b1fc3d}.fields{justify-content:left;max-width:1060px;flex-grow:100}.fields .if{display:flex;align-items:center}.fields .if>*{margin:0 .5em}.fields .if .spacing{margin-right:46px}.fields .attribute-span{margin-left:.5em}.fields .attribute{width:170px;background-color:#fff;border:1px solid #e5e5e5;min-height:28px;min-width:170px;font-size:15px;padding:0 10px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.fields .invalid{border:1px solid #ff5252}.fields .attribute-error{color:#ff5252;margin-right:5px}.fields .delete{position:absolute;color:#d6a9a9;cursor:pointer;top:-8px;right:-12px;z-index:999}.fields .delete:hover{color:#ed5251}.fields .delete mat-icon{font-size:20px}.fields .drag-handle{position:absolute;cursor:-moz-grab;left:-20px;top:14px}.fields .drag-handle mat-icon{font-size:20px}.fields .custom-select{margin-left:.5em;width:170px;background-color:#fff;border:1px solid #e5e5e5;min-height:30px;min-width:170px;font-size:.8em;padding:0 5px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.fields .attribute-select{min-width:100px;width:100px;margin-left:0}.fields .comparison-value{flex-grow:100;min-width:200px;display:flex;align-items:center;margin-left:.5em}.fields .comparison-value .error{color:#ff5252;margin:0 5px}.fields .comparison-value input{background-color:#fff;border:1px solid #e5e5e5;min-height:28px;min-width:170px;flex-grow:100;font-size:15px;padding:0 30px 0 10px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.fields .comparison-value .invalid{border:1px solid #ff5252}.value{margin-left:auto;flex-wrap:nowrap}.value .serve{margin:0 5px}.warn{padding-left:3em;font-size:.8em}.flex{display:flex;flex-wrap:wrap;align-items:center}.expand{position:absolute;right:2px;font-size:8px;cursor:pointer;margin-left:-28px;z-index:1;color:#b3b3b3;background-color:#fff}.expand mat-icon{transform:rotate(45deg)}@media (max-width: 1200px){.targeting-row{flex-wrap:wrap}.targeting-row .fields{max-width:500px}}@media (max-width: 700px){.targeting-row{flex-direction:column;margin:.5em .3em}.targeting-row .help{left:161px}.targeting-row .fields{flex-direction:column;align-items:stretch}.targeting-row .fields .custom-select,.targeting-row .fields .comparison-value{margin:0}}\n"] }]
737
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialog }]; }, propDecorators: { formGroup: [{
738
+ type: Input
739
+ }], readOnly: [{
740
+ type: Input
741
+ }], segments: [{
742
+ type: Input
743
+ }] } });
744
+
745
+ class RolloutPercentageItemsComponent {
746
+ constructor() {
747
+ this.readOnly = false;
748
+ this.SettingType = SettingType;
749
+ }
750
+ setting() {
751
+ var _a;
752
+ return (_a = this.formGroup.get('setting')) === null || _a === void 0 ? void 0 : _a.value;
753
+ }
754
+ rolloutRules() {
755
+ return this.formGroup.get('rolloutRules');
756
+ }
757
+ rolloutPercentageItems() {
758
+ return this.formGroup.get('rolloutPercentageItems');
759
+ }
760
+ rolloutPercentageItemsSum() {
761
+ return this.formGroup.get('rolloutPercentageItemsSum');
762
+ }
763
+ value(rolloutPercentageItem) {
764
+ return this.setting().settingType === SettingType.Boolean ?
765
+ rolloutPercentageItem.get('valueDisabled') :
766
+ rolloutPercentageItem.get('value');
767
+ }
768
+ percentageChanged(index) {
769
+ if (this.rolloutPercentageItems().controls[index].value.percentage < 0) {
770
+ this.rolloutPercentageItems().controls[index].controls.percentage.setValue(0);
771
+ }
772
+ if (this.rolloutPercentageItems().controls[index].value.percentage > 100) {
773
+ this.rolloutPercentageItems().controls[index].controls.percentage.setValue(100);
774
+ }
775
+ if (this.rolloutPercentageItems().controls.length === 2) {
776
+ this.rolloutPercentageItems().controls[1 - index].controls.percentage
777
+ .setValue(100 - this.rolloutPercentageItems().controls[index].value.percentage);
778
+ }
779
+ this.updateSum();
780
+ }
781
+ updateSum() {
782
+ if (this.rolloutPercentageItems().controls.length === 0) {
783
+ this.rolloutPercentageItemsSum().setValue(100);
784
+ }
785
+ else {
786
+ this.rolloutPercentageItemsSum().setValue(this.rolloutPercentageItems().controls.map(v => v.value.percentage)
787
+ .reduce((a, b) => a + b));
788
+ }
789
+ }
790
+ removeRolloutPercentageItem(index) {
791
+ this.rolloutPercentageItems().removeAt(index);
792
+ this.rolloutPercentageItems().markAsDirty();
793
+ this.updateSum();
794
+ }
795
+ removeAll() {
796
+ this.rolloutPercentageItems().clear();
797
+ this.rolloutPercentageItems().markAsDirty();
798
+ this.updateSum();
799
+ }
800
+ getRolloutPercentageItemFormGroups() {
801
+ var _a, _b;
802
+ return (_b = (_a = this.rolloutPercentageItems()) === null || _a === void 0 ? void 0 : _a.controls) === null || _b === void 0 ? void 0 : _b.map(c => c);
803
+ }
804
+ getPercentageFormControl(rolloutPercentageItem) {
805
+ return rolloutPercentageItem.controls.percentage;
806
+ }
807
+ }
808
+ RolloutPercentageItemsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: RolloutPercentageItemsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
809
+ RolloutPercentageItemsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: RolloutPercentageItemsComponent, selector: "configcat-rollout-percentage-items", inputs: { formGroup: "formGroup", readOnly: "readOnly" }, ngImport: i0, template: "<div class=\"percentage-wrapper\" [formGroup]=\"formGroup\">\n\n <div class=\"if\" *ngIf=\"rolloutRules().controls.length > 0\">\n <mat-chip-list>\n <mat-chip class=\"chip\">ELSE IF</mat-chip>\n </mat-chip-list>\n </div>\n <div class=\"grow\">\n <div class=\"percentage-row flex\"\n *ngFor=\"let rolloutPercentageItem of getRolloutPercentageItemFormGroups(); let i = index\">\n <div class=\"flex\">\n <input type=\"number\" [formControl]=\"getPercentageFormControl(rolloutPercentageItem)\"\n (input)=\"percentageChanged(i)\">%\n <span class=\"users\">of <a href=\"https://configcat.com/docs/advanced/user-object\" target=\"_blank\"\n rel=\"noopener noreferrer\">users</a>\n </span>\n </div>\n\n <div class=\"delete-option\" matTooltip=\"Remove this % option\"\n *ngIf=\"!readOnly && rolloutPercentageItems().controls.length > 2\"\n (click)=\"removeRolloutPercentageItem(i)\">\n <mat-icon>cancel</mat-icon>\n </div>\n\n <span data-tooltip=\"The sum of percentages must be equal to 100.\"\n *ngIf=\"(i === rolloutPercentageItems().controls.length -1) && (rolloutPercentageItemsSum().invalid)\">\n <mat-icon color=\"warn\">\n error_outline\n </mat-icon>\n </span>\n\n <div class=\"value flex\">\n <span class=\"value-name\" *ngIf=\"setting().settingType !== SettingType.Boolean\">Served value:</span>\n <configcat-value class=\"served-value\" [valueFormControl]=\"value(rolloutPercentageItem)\"\n [setting]=\"setting()\">\n </configcat-value>\n </div>\n <div class=\"delete\" matTooltip=\"Remove % options\" (click)=\"removeAll()\" *ngIf=\"!readOnly\">\n <mat-icon>cancel</mat-icon>\n </div>\n </div>\n </div>\n</div>", styles: [".percentage-wrapper{border:1px solid #d5d5d5;background-color:#fff;border-radius:4px;margin:.5em 1em;position:relative;padding:.5em 0;display:flex}.percentage-wrapper .delete{position:absolute;color:#d6a9a9;cursor:pointer;top:-8px;right:-12px}.percentage-wrapper .delete:hover{color:#ed5251}.percentage-wrapper .delete mat-icon{font-size:20px}.percentage-wrapper .delete-option{color:#d6a9a9;cursor:pointer;margin-left:1rem;margin-top:4px}.percentage-wrapper .delete-option:hover{color:#ed5251}.percentage-wrapper .delete-option mat-icon{font-size:20px}.if{display:flex;align-items:center}.if>*{margin:0 .5em}.if .spacing{margin-right:44px}.if .chip{background-color:#67b1fc3d}.grow{flex-grow:1}.percentage-row{min-height:40px;margin-left:.5em}.flex{display:flex;flex-wrap:wrap;align-items:center}.value{margin-left:auto;min-width:100px}.value .value-name{display:none}input{background-color:#fff;border:1px solid #e5e5e5;min-height:28px;width:40px;margin-right:5px;font-size:15px;padding:0 5px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.users{margin-left:20px}@media (max-width: 700px){.percentage-wrapper{margin:.5em .3em}}\n"], components: [{ type: i3$2.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: ValueComponent, selector: "configcat-value", inputs: ["valueFormControl", "setting"] }], directives: [{ type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$2.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
810
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: RolloutPercentageItemsComponent, decorators: [{
811
+ type: Component,
812
+ args: [{ selector: 'configcat-rollout-percentage-items', template: "<div class=\"percentage-wrapper\" [formGroup]=\"formGroup\">\n\n <div class=\"if\" *ngIf=\"rolloutRules().controls.length > 0\">\n <mat-chip-list>\n <mat-chip class=\"chip\">ELSE IF</mat-chip>\n </mat-chip-list>\n </div>\n <div class=\"grow\">\n <div class=\"percentage-row flex\"\n *ngFor=\"let rolloutPercentageItem of getRolloutPercentageItemFormGroups(); let i = index\">\n <div class=\"flex\">\n <input type=\"number\" [formControl]=\"getPercentageFormControl(rolloutPercentageItem)\"\n (input)=\"percentageChanged(i)\">%\n <span class=\"users\">of <a href=\"https://configcat.com/docs/advanced/user-object\" target=\"_blank\"\n rel=\"noopener noreferrer\">users</a>\n </span>\n </div>\n\n <div class=\"delete-option\" matTooltip=\"Remove this % option\"\n *ngIf=\"!readOnly && rolloutPercentageItems().controls.length > 2\"\n (click)=\"removeRolloutPercentageItem(i)\">\n <mat-icon>cancel</mat-icon>\n </div>\n\n <span data-tooltip=\"The sum of percentages must be equal to 100.\"\n *ngIf=\"(i === rolloutPercentageItems().controls.length -1) && (rolloutPercentageItemsSum().invalid)\">\n <mat-icon color=\"warn\">\n error_outline\n </mat-icon>\n </span>\n\n <div class=\"value flex\">\n <span class=\"value-name\" *ngIf=\"setting().settingType !== SettingType.Boolean\">Served value:</span>\n <configcat-value class=\"served-value\" [valueFormControl]=\"value(rolloutPercentageItem)\"\n [setting]=\"setting()\">\n </configcat-value>\n </div>\n <div class=\"delete\" matTooltip=\"Remove % options\" (click)=\"removeAll()\" *ngIf=\"!readOnly\">\n <mat-icon>cancel</mat-icon>\n </div>\n </div>\n </div>\n</div>", styles: [".percentage-wrapper{border:1px solid #d5d5d5;background-color:#fff;border-radius:4px;margin:.5em 1em;position:relative;padding:.5em 0;display:flex}.percentage-wrapper .delete{position:absolute;color:#d6a9a9;cursor:pointer;top:-8px;right:-12px}.percentage-wrapper .delete:hover{color:#ed5251}.percentage-wrapper .delete mat-icon{font-size:20px}.percentage-wrapper .delete-option{color:#d6a9a9;cursor:pointer;margin-left:1rem;margin-top:4px}.percentage-wrapper .delete-option:hover{color:#ed5251}.percentage-wrapper .delete-option mat-icon{font-size:20px}.if{display:flex;align-items:center}.if>*{margin:0 .5em}.if .spacing{margin-right:44px}.if .chip{background-color:#67b1fc3d}.grow{flex-grow:1}.percentage-row{min-height:40px;margin-left:.5em}.flex{display:flex;flex-wrap:wrap;align-items:center}.value{margin-left:auto;min-width:100px}.value .value-name{display:none}input{background-color:#fff;border:1px solid #e5e5e5;min-height:28px;width:40px;margin-right:5px;font-size:15px;padding:0 5px;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;font-weight:300}.users{margin-left:20px}@media (max-width: 700px){.percentage-wrapper{margin:.5em .3em}}\n"] }]
813
+ }], ctorParameters: function () { return []; }, propDecorators: { formGroup: [{
814
+ type: Input
815
+ }], readOnly: [{
816
+ type: Input
817
+ }] } });
818
+
819
+ class SettingComponent {
820
+ constructor(formHelper, cdRef) {
821
+ this.formHelper = formHelper;
822
+ this.cdRef = cdRef;
823
+ this.readOnly = false;
824
+ this.canEditSetting = false;
825
+ this.canDeleteSetting = false;
826
+ this.deleteSettingText = 'Delete setting';
827
+ this.showEnvironmentName = false;
828
+ this.editSettingRequested = new EventEmitter();
829
+ this.deleteSettingRequested = new EventEmitter();
830
+ this.rulesBeingRendered = false;
831
+ this.SettingType = SettingType;
832
+ }
833
+ ngOnInit() { }
834
+ environment() {
835
+ var _a;
836
+ return (_a = this.formGroup.root.get('environment')) === null || _a === void 0 ? void 0 : _a.value;
837
+ }
838
+ setting() {
839
+ var _a;
840
+ return (_a = this.formGroup.get('setting')) === null || _a === void 0 ? void 0 : _a.value;
841
+ }
842
+ integrationLinks() {
843
+ return this.formGroup.get('integrationLinks');
844
+ }
845
+ rolloutRules() {
846
+ return this.formGroup.get('rolloutRules');
847
+ }
848
+ rolloutPercentageItems() {
849
+ return this.formGroup.get('rolloutPercentageItems');
850
+ }
851
+ value() {
852
+ return this.formGroup.get('value');
853
+ }
854
+ addRolloutRule() {
855
+ this.rolloutRules().push(this.formHelper.createRolloutRuleFormGroup({
856
+ comparisonAttribute: 'Identifier',
857
+ comparator: RolloutRuleComparator.SensitiveIsOneOf,
858
+ comparisonValue: '',
859
+ value: this.setting().settingType === SettingType.Boolean ? false : null
860
+ }, this.readOnly, this.setting().settingType));
861
+ this.rolloutRules().markAsDirty();
862
+ }
863
+ addSegmentRolloutRule() {
864
+ this.rolloutRules().push(this.formHelper.createRolloutRuleFormGroup({
865
+ segmentComparator: SegmentComparator.IsIn,
866
+ value: this.setting().settingType === SettingType.Boolean ? false : null
867
+ }, this.readOnly, this.setting().settingType));
868
+ this.rolloutRules().markAsDirty();
869
+ }
870
+ removeRolloutRules() {
871
+ this.rolloutRules().clear();
872
+ this.rolloutRules().markAsDirty();
873
+ }
874
+ addRolloutPercentageItem() {
875
+ if (this.rolloutPercentageItems().length === 0) {
876
+ switch (this.setting().settingType) {
877
+ case SettingType.Boolean:
878
+ this.rolloutPercentageItems().push(this.formHelper.createRolloutPercentageItemFormGroup({
879
+ percentage: 0,
880
+ value: true
881
+ }, this.readOnly, this.setting().settingType));
882
+ this.rolloutPercentageItems().push(this.formHelper.createRolloutPercentageItemFormGroup({
883
+ percentage: 100,
884
+ value: false
885
+ }, this.readOnly, this.setting().settingType));
886
+ break;
887
+ case SettingType.String:
888
+ case SettingType.Int:
889
+ case SettingType.Double:
890
+ for (let i = 0; i < 4; i++) {
891
+ this.rolloutPercentageItems().push(this.formHelper.createRolloutPercentageItemFormGroup({
892
+ percentage: 25,
893
+ value: null
894
+ }, this.readOnly, this.setting().settingType));
895
+ }
896
+ break;
897
+ }
898
+ }
899
+ else if (this.setting().settingType !== SettingType.Boolean) {
900
+ this.rolloutPercentageItems().push(this.formHelper.createRolloutPercentageItemFormGroup({
901
+ percentage: 0,
902
+ value: null
903
+ }, this.readOnly, this.setting().settingType));
904
+ }
905
+ this.rolloutPercentageItems().markAsDirty();
906
+ }
907
+ removeRolloutPercentageItems() {
908
+ this.rolloutPercentageItems().clear();
909
+ this.rolloutPercentageItems().markAsDirty();
910
+ }
911
+ editSetting() {
912
+ this.editSettingRequested.emit({ setting: this.setting() });
913
+ }
914
+ deleteSetting() {
915
+ this.deleteSettingRequested.emit({ setting: this.setting() });
916
+ }
917
+ }
918
+ SettingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingComponent, deps: [{ token: SettingListFormHelper }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
919
+ SettingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: SettingComponent, selector: "setting", inputs: { formGroup: "formGroup", readOnly: "readOnly", canEditSetting: "canEditSetting", canDeleteSetting: "canDeleteSetting", deleteSettingText: "deleteSettingText", showEnvironmentName: "showEnvironmentName", segments: "segments" }, outputs: { editSettingRequested: "editSettingRequested", deleteSettingRequested: "deleteSettingRequested" }, ngImport: i0, template: "<div class=\"setting-full\"\n [formGroup]=\"formGroup\">\n <div class=\"delete\" (click)=\"deleteSetting()\" *ngIf=\"canDeleteSetting\" [matTooltip]=\"deleteSettingText\"\n data-robot=\"deleteSetting\">\n <mat-icon>cancel</mat-icon>\n </div>\n <div class=\"setting-header flex\">\n <div class=\"setting-name flex\">\n <div class=\"name\" data-robot=\"settingName\">\n {{setting().name}}\n <span *ngIf=\"showEnvironmentName\"> ({{environment().name}})</span>\n </div>\n <div class=\"edit\" matTooltip=\"Edit name and description\" (click)=\"editSetting()\" *ngIf=\"canEditSetting\"\n data-robot=\"renameSetting\">\n <mat-icon>edit</mat-icon>\n </div>\n </div>\n </div>\n <div class=\"setting-content\">\n <div class=\"setting-details\">\n <div class=\"setting-key\"><code data-robot=\"settingKey\">{{setting().key}}</code></div>\n <span *ngIf=\"setting().hint\" class=\"description\">{{setting().hint}}</span>\n </div>\n\n <div class=\"rules-list\">\n <div>\n <configcat-rollout-rules *ngIf=\"rolloutRules().controls.length !== 0\" [formGroup]=\"formGroup\" [segments]=\"segments\">\n </configcat-rollout-rules>\n </div>\n\n <configcat-rollout-percentage-items *ngIf=\"rolloutPercentageItems().controls.length !== 0\"\n [formGroup]=\"formGroup\">\n </configcat-rollout-percentage-items>\n\n <div class=\"all-other flex\">\n <div *ngIf=\"rolloutPercentageItems().length === 0 && rolloutRules().length !== 0\"\n data-tooltip=\"This value will be served to all users who the above rules don't apply.\">\n <mat-chip-list>\n <mat-chip class=\"chip\">To all other users, serve:</mat-chip>\n </mat-chip-list>\n </div>\n <div *ngIf=\"rolloutPercentageItems().length !== 0\"\n data-tooltip=\"This fallback value will be served in case the user can't be identified.\">\n <mat-chip-list>\n <mat-chip class=\"chip\">To unidentified users, serve:</mat-chip>\n </mat-chip-list>\n </div>\n <div *ngIf=\"rolloutPercentageItems().length === 0 && rolloutRules().length === 0\">\n <mat-chip-list>\n <mat-chip class=\"chip\">To all users, serve:</mat-chip>\n </mat-chip-list>\n </div>\n <configcat-value class=\"served-value\" [valueFormControl]=\"value()\" [setting]=\"setting()\">\n </configcat-value>\n </div>\n <div class=\"buttons\">\n <button type=\"button\" class=\"sige-button targeting-button\" (click)=\"addRolloutRule()\" *ngIf=\"!readOnly\">\n {{rolloutRules().length === 0 ? 'Target specific users' : 'Add new targeting rule'}}\n </button>\n <button type=\"button\" class=\"sige-button targeting-button\" (click)=\"addRolloutRule()\" *ngIf=\"!readOnly\">\n {{rolloutRules().length === 0 ? 'Target segment' : 'Target new segment'}}\n </button>\n <button type=\"button\" class=\"sige-button targeting-button\" (click)=\"addRolloutPercentageItem()\"\n *ngIf=\"!readOnly\"\n [disabled]=\"setting().settingType === SettingType.Boolean && rolloutPercentageItems().length !== 0\">\n {{rolloutPercentageItems().length === 0 ? 'Target % of users' : 'Add new % option'}}\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".setting-full{position:relative;display:flex;flex-wrap:nowrap;flex-direction:column;border-radius:3px}.setting-full .delete{position:absolute;right:-15px;top:-10px;color:#d6a9a9;cursor:pointer}.setting-full .delete:hover{color:#ed5251}.setting-full .delete mat-icon{font-size:20px}.setting-full .setting-header{padding:1.5em 1.5em 0}.setting-full .setting-header .setting-name{flex-direction:row}.setting-full .setting-header .setting-name:hover>.edit{visibility:visible}.setting-full .setting-header .setting-name .name{font-weight:700;word-wrap:break-word;max-width:100%}.setting-full .setting-header .setting-name .edit{margin:5px 0 0 5px;cursor:pointer;visibility:hidden;color:gray}.setting-full .setting-header .setting-name .edit:hover{visibility:visible}.setting-full .setting-header .setting-name .edit mat-icon{font-size:18px}.setting-full .setting-header .setting-meta{margin-left:auto;margin-right:14px;font-size:.7em;color:gray}.setting-full .setting-content{display:flex}.setting-full .setting-content .setting-details{display:flex;flex-direction:column;width:400px;padding:0 0 1em 1em}.setting-full .setting-content .setting-details>*{margin:.5em}.setting-full .setting-content .setting-details .integrations{font-size:.8rem}.setting-full .setting-content .setting-details .integrations>div{margin:3px}.setting-full .setting-content .setting-details .integrations>div>a:hover{text-decoration:underline}.setting-full .setting-content .setting-details .setting-key{word-wrap:break-word}.setting-full .setting-content .setting-details .description{font-size:.8em;white-space:pre-wrap;word-wrap:break-word;max-width:300px}.setting-full .setting-content .setting-details code{background-color:#d3d3d3;padding:3px 6px}.setting-full .setting-content .rules-list{width:100%;padding:0 1em 1em}.setting-full .setting-content .targeting-button{margin-left:.5rem;margin-right:.5rem;margin-bottom:1em}.all-other{min-height:40px;justify-content:flex-start;border:1px solid #d5d5d5;border-radius:4px;background-color:#fff;margin:.5em 1em;padding:4px 0 4px .5em}.all-other .chip{background-color:#67b1fc3d}.all-other .served-value{margin-left:auto;min-width:100px}.end{margin-left:auto}.buttons{display:flex;margin-left:.5rem;margin-right:.5rem}.buttons .updated-date{font-size:.7em;margin-left:auto;margin-right:22px;color:gray}.flex{display:flex;flex-wrap:wrap;align-items:center}.show-hide-toggle{margin-left:1em;cursor:pointer}.show-hide-toggle a{font-size:.8rem}.sige-button{background-color:#d9eadc;color:#363636;cursor:pointer;justify-content:center;padding:.375em .75em;text-align:center;white-space:nowrap;border-radius:2px;font-size:.75rem;border:1px solid #dbdbdb;box-shadow:none;display:inline-flex;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif}.sige-button:hover{background-color:#bad0be}.sige-button:disabled{background-color:#fff;color:#b3b3b3}@media (max-width: 1200px){.setting-details{width:300px}}@media (max-width: 700px){.setting-full .setting-content{flex-wrap:wrap}.setting-full .setting-content .rules-list{padding:0}.buttons{flex-direction:column}.updated-date{display:none}.setting-details{padding:.2em 0 .2em .2em}.all-other{margin:.5em .3em}}\n"], components: [{ type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: RolloutRulesComponent, selector: "configcat-rollout-rules", inputs: ["formGroup", "readOnly", "segments"] }, { type: RolloutPercentageItemsComponent, selector: "configcat-rollout-percentage-items", inputs: ["formGroup", "readOnly"] }, { type: i3$2.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: ValueComponent, selector: "configcat-value", inputs: ["valueFormControl", "setting"] }], directives: [{ type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i3$2.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }] });
920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingComponent, decorators: [{
921
+ type: Component,
922
+ args: [{ selector: 'setting', template: "<div class=\"setting-full\"\n [formGroup]=\"formGroup\">\n <div class=\"delete\" (click)=\"deleteSetting()\" *ngIf=\"canDeleteSetting\" [matTooltip]=\"deleteSettingText\"\n data-robot=\"deleteSetting\">\n <mat-icon>cancel</mat-icon>\n </div>\n <div class=\"setting-header flex\">\n <div class=\"setting-name flex\">\n <div class=\"name\" data-robot=\"settingName\">\n {{setting().name}}\n <span *ngIf=\"showEnvironmentName\"> ({{environment().name}})</span>\n </div>\n <div class=\"edit\" matTooltip=\"Edit name and description\" (click)=\"editSetting()\" *ngIf=\"canEditSetting\"\n data-robot=\"renameSetting\">\n <mat-icon>edit</mat-icon>\n </div>\n </div>\n </div>\n <div class=\"setting-content\">\n <div class=\"setting-details\">\n <div class=\"setting-key\"><code data-robot=\"settingKey\">{{setting().key}}</code></div>\n <span *ngIf=\"setting().hint\" class=\"description\">{{setting().hint}}</span>\n </div>\n\n <div class=\"rules-list\">\n <div>\n <configcat-rollout-rules *ngIf=\"rolloutRules().controls.length !== 0\" [formGroup]=\"formGroup\" [segments]=\"segments\">\n </configcat-rollout-rules>\n </div>\n\n <configcat-rollout-percentage-items *ngIf=\"rolloutPercentageItems().controls.length !== 0\"\n [formGroup]=\"formGroup\">\n </configcat-rollout-percentage-items>\n\n <div class=\"all-other flex\">\n <div *ngIf=\"rolloutPercentageItems().length === 0 && rolloutRules().length !== 0\"\n data-tooltip=\"This value will be served to all users who the above rules don't apply.\">\n <mat-chip-list>\n <mat-chip class=\"chip\">To all other users, serve:</mat-chip>\n </mat-chip-list>\n </div>\n <div *ngIf=\"rolloutPercentageItems().length !== 0\"\n data-tooltip=\"This fallback value will be served in case the user can't be identified.\">\n <mat-chip-list>\n <mat-chip class=\"chip\">To unidentified users, serve:</mat-chip>\n </mat-chip-list>\n </div>\n <div *ngIf=\"rolloutPercentageItems().length === 0 && rolloutRules().length === 0\">\n <mat-chip-list>\n <mat-chip class=\"chip\">To all users, serve:</mat-chip>\n </mat-chip-list>\n </div>\n <configcat-value class=\"served-value\" [valueFormControl]=\"value()\" [setting]=\"setting()\">\n </configcat-value>\n </div>\n <div class=\"buttons\">\n <button type=\"button\" class=\"sige-button targeting-button\" (click)=\"addRolloutRule()\" *ngIf=\"!readOnly\">\n {{rolloutRules().length === 0 ? 'Target specific users' : 'Add new targeting rule'}}\n </button>\n <button type=\"button\" class=\"sige-button targeting-button\" (click)=\"addRolloutRule()\" *ngIf=\"!readOnly\">\n {{rolloutRules().length === 0 ? 'Target segment' : 'Target new segment'}}\n </button>\n <button type=\"button\" class=\"sige-button targeting-button\" (click)=\"addRolloutPercentageItem()\"\n *ngIf=\"!readOnly\"\n [disabled]=\"setting().settingType === SettingType.Boolean && rolloutPercentageItems().length !== 0\">\n {{rolloutPercentageItems().length === 0 ? 'Target % of users' : 'Add new % option'}}\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".setting-full{position:relative;display:flex;flex-wrap:nowrap;flex-direction:column;border-radius:3px}.setting-full .delete{position:absolute;right:-15px;top:-10px;color:#d6a9a9;cursor:pointer}.setting-full .delete:hover{color:#ed5251}.setting-full .delete mat-icon{font-size:20px}.setting-full .setting-header{padding:1.5em 1.5em 0}.setting-full .setting-header .setting-name{flex-direction:row}.setting-full .setting-header .setting-name:hover>.edit{visibility:visible}.setting-full .setting-header .setting-name .name{font-weight:700;word-wrap:break-word;max-width:100%}.setting-full .setting-header .setting-name .edit{margin:5px 0 0 5px;cursor:pointer;visibility:hidden;color:gray}.setting-full .setting-header .setting-name .edit:hover{visibility:visible}.setting-full .setting-header .setting-name .edit mat-icon{font-size:18px}.setting-full .setting-header .setting-meta{margin-left:auto;margin-right:14px;font-size:.7em;color:gray}.setting-full .setting-content{display:flex}.setting-full .setting-content .setting-details{display:flex;flex-direction:column;width:400px;padding:0 0 1em 1em}.setting-full .setting-content .setting-details>*{margin:.5em}.setting-full .setting-content .setting-details .integrations{font-size:.8rem}.setting-full .setting-content .setting-details .integrations>div{margin:3px}.setting-full .setting-content .setting-details .integrations>div>a:hover{text-decoration:underline}.setting-full .setting-content .setting-details .setting-key{word-wrap:break-word}.setting-full .setting-content .setting-details .description{font-size:.8em;white-space:pre-wrap;word-wrap:break-word;max-width:300px}.setting-full .setting-content .setting-details code{background-color:#d3d3d3;padding:3px 6px}.setting-full .setting-content .rules-list{width:100%;padding:0 1em 1em}.setting-full .setting-content .targeting-button{margin-left:.5rem;margin-right:.5rem;margin-bottom:1em}.all-other{min-height:40px;justify-content:flex-start;border:1px solid #d5d5d5;border-radius:4px;background-color:#fff;margin:.5em 1em;padding:4px 0 4px .5em}.all-other .chip{background-color:#67b1fc3d}.all-other .served-value{margin-left:auto;min-width:100px}.end{margin-left:auto}.buttons{display:flex;margin-left:.5rem;margin-right:.5rem}.buttons .updated-date{font-size:.7em;margin-left:auto;margin-right:22px;color:gray}.flex{display:flex;flex-wrap:wrap;align-items:center}.show-hide-toggle{margin-left:1em;cursor:pointer}.show-hide-toggle a{font-size:.8rem}.sige-button{background-color:#d9eadc;color:#363636;cursor:pointer;justify-content:center;padding:.375em .75em;text-align:center;white-space:nowrap;border-radius:2px;font-size:.75rem;border:1px solid #dbdbdb;box-shadow:none;display:inline-flex;font-family:Montserrat,Roboto,Helvetica Neue,sans-serif}.sige-button:hover{background-color:#bad0be}.sige-button:disabled{background-color:#fff;color:#b3b3b3}@media (max-width: 1200px){.setting-details{width:300px}}@media (max-width: 700px){.setting-full .setting-content{flex-wrap:wrap}.setting-full .setting-content .rules-list{padding:0}.buttons{flex-direction:column}.updated-date{display:none}.setting-details{padding:.2em 0 .2em .2em}.all-other{margin:.5em .3em}}\n"] }]
923
+ }], ctorParameters: function () { return [{ type: SettingListFormHelper }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { formGroup: [{
924
+ type: Input
925
+ }], readOnly: [{
926
+ type: Input
927
+ }], canEditSetting: [{
928
+ type: Input
929
+ }], canDeleteSetting: [{
930
+ type: Input
931
+ }], deleteSettingText: [{
932
+ type: Input
933
+ }], showEnvironmentName: [{
934
+ type: Input
935
+ }], segments: [{
936
+ type: Input
937
+ }], editSettingRequested: [{
938
+ type: Output
939
+ }], deleteSettingRequested: [{
940
+ type: Output
941
+ }] } });
942
+
943
+ class SettingListComponent {
944
+ constructor(formHelper, snackBar, dialog) {
945
+ this.formHelper = formHelper;
946
+ this.snackBar = snackBar;
947
+ this.dialog = dialog;
948
+ this.canEditSetting = false;
949
+ this.canDeleteSetting = false;
950
+ this.deleteSettingText = 'Delete setting';
951
+ this.showEnvironmentName = false;
952
+ this.editSettingRequested = new EventEmitter();
953
+ this.deleteSettingRequested = new EventEmitter();
954
+ this.formValuesChanged = new EventEmitter();
955
+ this.loading = true;
956
+ this.submitting = false;
957
+ this.showRevertQuestion = false;
958
+ this.showFeedBackMessage = false;
959
+ this.readOnly = false;
960
+ }
961
+ ngOnInit() {
962
+ this.reloadSettingValues();
963
+ }
964
+ ngOnChanges() {
965
+ this.reloadSettingValues();
966
+ }
967
+ ngOnDestroy() {
968
+ if (this.formValuesChangedSubscription) {
969
+ this.formValuesChangedSubscription.unsubscribe();
970
+ this.formValuesChangedSubscription = null;
971
+ }
972
+ }
973
+ reloadSettingValues() {
974
+ this.showFeedBackMessage = false;
975
+ this.loading = true;
976
+ forkJoin({
977
+ segments: this.loadSegments(),
978
+ settingValues: this.loadSettingValues()
979
+ }).subscribe(result => {
980
+ this.readOnly = result.settingValues.readOnly;
981
+ this.settingValues = result.settingValues;
982
+ this.segments = result.segments;
983
+ this.createFormGroup();
984
+ this.loading = false;
985
+ }, error => {
986
+ this.snackBar.open('Ooops. We could not load your Feature Flags and Settings. Please try again or contact us.', 'Dismiss', { duration: 60000, panelClass: 'red-snackbar' });
987
+ });
988
+ }
989
+ createFormGroup() {
990
+ this.formGroup = this.formHelper.createSettingValuesFormGroup(this.settingValues);
991
+ this.formValuesChangedSubscription = this.formGroup.valueChanges.subscribe(() => {
992
+ this.formValuesChanged.emit();
993
+ });
994
+ }
995
+ settingValuesFormArray() {
996
+ return this.formGroup.get('settingValues');
997
+ }
998
+ getSettingValueFormGroups() {
999
+ return this.settingValuesFormArray().controls.map(c => c);
1000
+ }
1001
+ submit() {
1002
+ if (!this.formGroup || !this.formGroup.valid) {
1003
+ this.showFeedBackMessage = true;
1004
+ this.formGroup.markAsTouched();
1005
+ return;
1006
+ }
1007
+ this.showFeedBackMessage = false;
1008
+ this.submitting = true;
1009
+ const updateSettingValuesModel = {
1010
+ settingValues: this.formGroup.controls.settingValues.value,
1011
+ knownLastUpdatedAt: this.settingValues.lastUpdatedAt,
1012
+ forced: false
1013
+ };
1014
+ if (this.settingValues.reasonRequired) {
1015
+ const dialogRef = this.dialog.open(ReasonDialogComponent, {
1016
+ width: '450px'
1017
+ });
1018
+ dialogRef.afterClosed()
1019
+ .subscribe(result => {
1020
+ if (result && result.button === 'save' && result.reason) {
1021
+ updateSettingValuesModel.reason = result.reason;
1022
+ this.updateSettingValues(updateSettingValuesModel);
1023
+ }
1024
+ else {
1025
+ this.submitting = false;
1026
+ }
1027
+ });
1028
+ return;
1029
+ }
1030
+ this.updateSettingValues(updateSettingValuesModel);
1031
+ }
1032
+ updateSettingValues(updateSettingValuesModel) {
1033
+ this.onSave(updateSettingValuesModel).subscribe(settingValues => {
1034
+ this.settingValues = settingValues;
1035
+ this.createFormGroup();
1036
+ this.submitting = false;
1037
+ this.snackBar.openFromComponent(SaveSnackbarComponent, { duration: 5000, panelClass: 'green-snackbar' });
1038
+ }, (error) => {
1039
+ if (error.status === 400 && error.error
1040
+ && error.error.KnownLastUpdatedAt && error.error.KnownLastUpdatedAt[0] === 'Concurrent update') {
1041
+ const dialogRef = this.dialog.open(ConcurrentDialogComponent, {
1042
+ width: '560px'
1043
+ });
1044
+ dialogRef.afterClosed()
1045
+ .subscribe(result => {
1046
+ if (result && result.button === 'save') {
1047
+ updateSettingValuesModel.forced = true;
1048
+ this.updateSettingValues(updateSettingValuesModel);
1049
+ }
1050
+ else {
1051
+ this.reloadSettingValues();
1052
+ this.submitting = false;
1053
+ }
1054
+ });
1055
+ return;
1056
+ }
1057
+ if (error.status === 400 && error.error && error.error.Reason && error.error.Reason[0] === 'Reason required') {
1058
+ const dialogRef = this.dialog.open(ReasonDialogComponent, {
1059
+ width: '450px'
1060
+ });
1061
+ dialogRef.afterClosed()
1062
+ .subscribe(result => {
1063
+ if (result && result.button === 'save' && result.reason) {
1064
+ updateSettingValuesModel.reason = result.reason;
1065
+ this.updateSettingValues(updateSettingValuesModel);
1066
+ }
1067
+ else {
1068
+ this.submitting = false;
1069
+ }
1070
+ });
1071
+ return;
1072
+ }
1073
+ this.formGroup.setErrors({ internalServerError: 'Internal server error' });
1074
+ this.showFeedBackMessage = true;
1075
+ });
1076
+ }
1077
+ handleRevertYes() {
1078
+ this.showRevertQuestion = false;
1079
+ this.reloadSettingValues();
1080
+ }
1081
+ handleRevertCancel() {
1082
+ this.showRevertQuestion = false;
1083
+ }
1084
+ onEditSettingRequested(setting) {
1085
+ this.editSettingRequested.emit({
1086
+ setting: setting.setting,
1087
+ environment: this.settingValues.environment,
1088
+ config: this.settingValues.config
1089
+ });
1090
+ }
1091
+ onDeleteSettingRequested(setting) {
1092
+ this.deleteSettingRequested.emit({
1093
+ setting: setting.setting,
1094
+ environment: this.settingValues.environment,
1095
+ config: this.settingValues.config
1096
+ });
1097
+ }
1098
+ }
1099
+ SettingListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingListComponent, deps: [{ token: SettingListFormHelper }, { token: i2$2.MatSnackBar }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
1100
+ SettingListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: SettingListComponent, selector: "configcat-setting-list", inputs: { canEditSetting: "canEditSetting", canDeleteSetting: "canDeleteSetting", onSave: "onSave", loadSettingValues: "loadSettingValues", loadSegments: "loadSegments", deleteSettingText: "deleteSettingText", showEnvironmentName: "showEnvironmentName" }, outputs: { editSettingRequested: "editSettingRequested", deleteSettingRequested: "deleteSettingRequested", formValuesChanged: "formValuesChanged" }, usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"submit()\" *ngIf=\"!loading\">\n <div class=\"wrapper\" *ngFor=\"let settingValueFromGroup of getSettingValueFormGroups(); let i = index\">\n <setting [formGroup]=\"settingValueFromGroup\" [readOnly]=\"readOnly\" [canEditSetting]=\"canEditSetting\"\n [canDeleteSetting]=\"canDeleteSetting\" (editSettingRequested)=\"onEditSettingRequested($event)\"\n (deleteSettingRequested)=\"onDeleteSettingRequested($event)\" [deleteSettingText]=\"deleteSettingText\"\n [showEnvironmentName]=\"showEnvironmentName\" [segments]=\"segments\">\n </setting>\n </div>\n\n <div class=\"save\" *ngIf=\"!readOnly && !submitting && formGroup.dirty\">\n <div class=\"feedback\" *ngIf=\"formGroup.touched && formGroup.invalid && showFeedBackMessage\">\n <div class=\"error\" *ngIf=\"formGroup.errors && formGroup.errors.internalServerError\">\n <span>Something went wrong and we could not save your settings. You can try again or <a\n href=\"https://configcat.com/support\" target=\"_blank\" rel=\"noopener noreferrer\">contact us.</a></span>\n </div>\n <div class=\"error\" *ngIf=\"!formGroup.errors || !formGroup.errors.internalServerError\">\n <span>Oh no! A feature flag has invalid or missing data.</span>\n </div>\n </div>\n <button type=\"button\" mat-stroked-button *ngIf=\"!showRevertQuestion\" (click)=\"showRevertQuestion = true\">\n <mat-icon>history</mat-icon><span>Revert changes</span>\n </button>\n <div *ngIf=\"showRevertQuestion\">\n <span class=\"revert\">Revert to last saved state?</span>\n <button type=\"button\" class=\"yes\" mat-stroked-button (click)=\"handleRevertYes()\">Yes</button>\n <button type=\"button\" mat-stroked-button (click)=\"handleRevertCancel()\">No</button>\n </div>\n <button class=\"save-button\" mat-flat-button color=\"warn\" type=\"submit\" [disabled]=\"submitting\">\n <mat-icon>backup</mat-icon> <span> Save & publish changes</span>\n </button>\n </div>\n</form>", styles: [".wrapper{background-color:#f3f3f3;border:1px solid rgba(0,0,0,.12);border-radius:4px;margin:1em 0}.show-hide a{cursor:pointer;font-size:.8rem}.save{position:sticky;bottom:0;min-height:38px;padding:.5rem .5rem .5rem 0;background-color:#fff;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-end;z-index:1000}.save .save-button{animation:shadow-pulse 1s 3;margin-left:1rem}.save>*{margin:.3em}.save .revert{margin:0 16px;font-size:14px}.save .yes{margin:0 5px}.error{background-color:#a32b2d;color:#fff;padding:5px;font-size:.9em}.error a{color:#fff;text-decoration:underline}@media (max-width: 700px){.save{padding:.5rem 0}}\n"], components: [{ type: SettingComponent, selector: "setting", inputs: ["formGroup", "readOnly", "canEditSetting", "canDeleteSetting", "deleteSettingText", "showEnvironmentName", "segments"], outputs: ["editSettingRequested", "deleteSettingRequested"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingListComponent, decorators: [{
1102
+ type: Component,
1103
+ args: [{ selector: 'configcat-setting-list', template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"submit()\" *ngIf=\"!loading\">\n <div class=\"wrapper\" *ngFor=\"let settingValueFromGroup of getSettingValueFormGroups(); let i = index\">\n <setting [formGroup]=\"settingValueFromGroup\" [readOnly]=\"readOnly\" [canEditSetting]=\"canEditSetting\"\n [canDeleteSetting]=\"canDeleteSetting\" (editSettingRequested)=\"onEditSettingRequested($event)\"\n (deleteSettingRequested)=\"onDeleteSettingRequested($event)\" [deleteSettingText]=\"deleteSettingText\"\n [showEnvironmentName]=\"showEnvironmentName\" [segments]=\"segments\">\n </setting>\n </div>\n\n <div class=\"save\" *ngIf=\"!readOnly && !submitting && formGroup.dirty\">\n <div class=\"feedback\" *ngIf=\"formGroup.touched && formGroup.invalid && showFeedBackMessage\">\n <div class=\"error\" *ngIf=\"formGroup.errors && formGroup.errors.internalServerError\">\n <span>Something went wrong and we could not save your settings. You can try again or <a\n href=\"https://configcat.com/support\" target=\"_blank\" rel=\"noopener noreferrer\">contact us.</a></span>\n </div>\n <div class=\"error\" *ngIf=\"!formGroup.errors || !formGroup.errors.internalServerError\">\n <span>Oh no! A feature flag has invalid or missing data.</span>\n </div>\n </div>\n <button type=\"button\" mat-stroked-button *ngIf=\"!showRevertQuestion\" (click)=\"showRevertQuestion = true\">\n <mat-icon>history</mat-icon><span>Revert changes</span>\n </button>\n <div *ngIf=\"showRevertQuestion\">\n <span class=\"revert\">Revert to last saved state?</span>\n <button type=\"button\" class=\"yes\" mat-stroked-button (click)=\"handleRevertYes()\">Yes</button>\n <button type=\"button\" mat-stroked-button (click)=\"handleRevertCancel()\">No</button>\n </div>\n <button class=\"save-button\" mat-flat-button color=\"warn\" type=\"submit\" [disabled]=\"submitting\">\n <mat-icon>backup</mat-icon> <span> Save & publish changes</span>\n </button>\n </div>\n</form>", styles: [".wrapper{background-color:#f3f3f3;border:1px solid rgba(0,0,0,.12);border-radius:4px;margin:1em 0}.show-hide a{cursor:pointer;font-size:.8rem}.save{position:sticky;bottom:0;min-height:38px;padding:.5rem .5rem .5rem 0;background-color:#fff;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-end;z-index:1000}.save .save-button{animation:shadow-pulse 1s 3;margin-left:1rem}.save>*{margin:.3em}.save .revert{margin:0 16px;font-size:14px}.save .yes{margin:0 5px}.error{background-color:#a32b2d;color:#fff;padding:5px;font-size:.9em}.error a{color:#fff;text-decoration:underline}@media (max-width: 700px){.save{padding:.5rem 0}}\n"] }]
1104
+ }], ctorParameters: function () { return [{ type: SettingListFormHelper }, { type: i2$2.MatSnackBar }, { type: i1$1.MatDialog }]; }, propDecorators: { canEditSetting: [{
1105
+ type: Input
1106
+ }], canDeleteSetting: [{
1107
+ type: Input
1108
+ }], onSave: [{
1109
+ type: Input
1110
+ }], loadSettingValues: [{
1111
+ type: Input
1112
+ }], loadSegments: [{
1113
+ type: Input
1114
+ }], deleteSettingText: [{
1115
+ type: Input
1116
+ }], showEnvironmentName: [{
1117
+ type: Input
1118
+ }], editSettingRequested: [{
1119
+ type: Output
1120
+ }], deleteSettingRequested: [{
1121
+ type: Output
1122
+ }], formValuesChanged: [{
1123
+ type: Output
1124
+ }] } });
1125
+
1126
+ class SettingItemComponent extends BaseComponent {
1127
+ constructor(publicApiService) {
1128
+ super(publicApiService);
1129
+ this.canEditSetting = true;
1130
+ this.canDeleteSetting = true;
1131
+ this.deleteSettingText = 'Delete setting';
1132
+ this.showEnvironmentName = true;
1133
+ this.editSettingRequested = new EventEmitter();
1134
+ this.deleteSettingRequested = new EventEmitter();
1135
+ this.loadSucceeded = new EventEmitter();
1136
+ this.loadFailed = new EventEmitter();
1137
+ this.saveSucceeded = new EventEmitter();
1138
+ this.saveFailed = new EventEmitter();
1139
+ this.formValuesChanged = new EventEmitter();
1140
+ this.loadSettingValues = () => {
1141
+ return this.createSettingValuesService().getSettingValue(this.environmentId, this.settingId)
1142
+ .pipe(map(settingValue => {
1143
+ this.settingValue = settingValue;
1144
+ const settingValues = {
1145
+ settingValues: [settingValue],
1146
+ readOnly: settingValue.readOnly,
1147
+ config: settingValue.config,
1148
+ environment: settingValue.environment
1149
+ };
1150
+ this.loadSucceeded.emit(settingValues);
1151
+ return settingValues;
1152
+ }), catchError(error => {
1153
+ this.loadFailed.emit(error);
1154
+ return throwError(error);
1155
+ }));
1156
+ };
1157
+ this.loadSegments = () => {
1158
+ return this.createSegmentsService().getSegments(this.productId)
1159
+ .pipe(map(segments => {
1160
+ this.segments = segments;
1161
+ return segments;
1162
+ }), catchError(error => {
1163
+ return throwError(error);
1164
+ }));
1165
+ };
1166
+ this.handleSave = (model) => {
1167
+ if (model.settingValues.length === 0) {
1168
+ return of();
1169
+ }
1170
+ const updateModel = model.settingValues[0];
1171
+ return this.createSettingValuesService().replaceSettingValue(this.environmentId, this.settingId, updateModel, model.reason)
1172
+ .pipe(map(settingValue => {
1173
+ this.settingValue = settingValue;
1174
+ const settingValues = {
1175
+ settingValues: [settingValue],
1176
+ readOnly: settingValue.readOnly,
1177
+ config: settingValue.config,
1178
+ environment: settingValue.environment
1179
+ };
1180
+ this.saveSucceeded.emit(settingValues);
1181
+ return settingValues;
1182
+ }), catchError(error => {
1183
+ this.saveFailed.emit(error);
1184
+ return throwError(error);
1185
+ }));
1186
+ };
1187
+ }
1188
+ ngOnInit() {
1189
+ }
1190
+ onEditSettingRequested(setting) {
1191
+ this.editSettingRequested.emit({
1192
+ setting: setting.setting,
1193
+ environment: this.settingValue.environment,
1194
+ config: this.settingValue.config
1195
+ });
1196
+ }
1197
+ onDeleteSettingRequested(setting) {
1198
+ this.deleteSettingRequested.emit({
1199
+ setting: setting.setting,
1200
+ environment: this.settingValue.environment,
1201
+ config: this.settingValue.config
1202
+ });
1203
+ }
1204
+ onFormValuesChanged() {
1205
+ this.formValuesChanged.emit();
1206
+ }
1207
+ }
1208
+ SettingItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingItemComponent, deps: [{ token: PublicApiService }], target: i0.ɵɵFactoryTarget.Component });
1209
+ SettingItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: SettingItemComponent, selector: "configcat-setting-item", inputs: { productId: "productId", environmentId: "environmentId", configId: "configId", settingId: "settingId", canEditSetting: "canEditSetting", canDeleteSetting: "canDeleteSetting", deleteSettingText: "deleteSettingText", showEnvironmentName: "showEnvironmentName" }, outputs: { editSettingRequested: "editSettingRequested", deleteSettingRequested: "deleteSettingRequested", loadSucceeded: "loadSucceeded", loadFailed: "loadFailed", saveSucceeded: "saveSucceeded", saveFailed: "saveFailed", formValuesChanged: "formValuesChanged" }, usesInheritance: true, ngImport: i0, template: "<configcat-setting-list [canEditSetting]=\"canEditSetting\" [canDeleteSetting]=\"canDeleteSetting\" [onSave]=\"handleSave\"\n [loadSettingValues]=\"loadSettingValues\" [loadSegments]=\"loadSegments\"\n (editSettingRequested)=\"onEditSettingRequested($event)\" (deleteSettingRequested)=\"onDeleteSettingRequested($event)\"\n [deleteSettingText]=\"deleteSettingText\" [showEnvironmentName]=\"showEnvironmentName\"\n (formValuesChanged)=\"onFormValuesChanged()\">\n</configcat-setting-list>", styles: [".container{font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;background-color:#f3f3f3;border:1px solid rgba(0,0,0,.12);border-radius:4px;margin:1em 0}.container .setting-full{position:relative;display:flex;flex-wrap:nowrap}.container .setting-full .setting-details{display:flex;flex-direction:column;width:400px;padding:1em 0 1em 1em}.container .setting-full .setting-details>*{margin:.5em}.container .setting-full .setting-details .setting-name{flex-direction:row}.container .setting-full .setting-details .setting-name .name{font-weight:700;word-wrap:break-word;max-width:100%}.container .setting-full .setting-details .setting-key{word-wrap:break-word}.container .setting-full .setting-details .description{font-size:.8em}.container .setting-full .setting-details code{background-color:#d3d3d3;padding:3px 6px}.container .setting-full .rules-list{width:100%;padding:1em}.container .setting-full .targeting-button{margin-left:1rem;margin-bottom:1em}.all-other{min-height:40px;justify-content:flex-start;border:1px solid #d5d5d5;border-radius:4px;background-color:#fff;margin:.5em 1em;padding:4px 0 4px .5em}.all-other .chip{background-color:#67b1fc3d}.all-other .served-value{margin-left:auto;min-width:100px}.end{margin-left:auto}.flex{display:flex;flex-wrap:wrap;align-items:center}.show-hide-toggle{margin-left:1em;cursor:pointer}@media (max-width: 1200px){.setting-full .setting-details{width:300px}}@media (max-width: 700px){.setting-full{flex-wrap:wrap}.setting-full .setting-details{padding:.2em 0 .2em .2em}.setting-full .all-other{margin:.5em .3em}}\n"], components: [{ type: SettingListComponent, selector: "configcat-setting-list", inputs: ["canEditSetting", "canDeleteSetting", "onSave", "loadSettingValues", "loadSegments", "deleteSettingText", "showEnvironmentName"], outputs: ["editSettingRequested", "deleteSettingRequested", "formValuesChanged"] }] });
1210
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingItemComponent, decorators: [{
1211
+ type: Component,
1212
+ args: [{ selector: 'configcat-setting-item', template: "<configcat-setting-list [canEditSetting]=\"canEditSetting\" [canDeleteSetting]=\"canDeleteSetting\" [onSave]=\"handleSave\"\n [loadSettingValues]=\"loadSettingValues\" [loadSegments]=\"loadSegments\"\n (editSettingRequested)=\"onEditSettingRequested($event)\" (deleteSettingRequested)=\"onDeleteSettingRequested($event)\"\n [deleteSettingText]=\"deleteSettingText\" [showEnvironmentName]=\"showEnvironmentName\"\n (formValuesChanged)=\"onFormValuesChanged()\">\n</configcat-setting-list>", styles: [".container{font-family:Montserrat,Roboto,Helvetica Neue,sans-serif;background-color:#f3f3f3;border:1px solid rgba(0,0,0,.12);border-radius:4px;margin:1em 0}.container .setting-full{position:relative;display:flex;flex-wrap:nowrap}.container .setting-full .setting-details{display:flex;flex-direction:column;width:400px;padding:1em 0 1em 1em}.container .setting-full .setting-details>*{margin:.5em}.container .setting-full .setting-details .setting-name{flex-direction:row}.container .setting-full .setting-details .setting-name .name{font-weight:700;word-wrap:break-word;max-width:100%}.container .setting-full .setting-details .setting-key{word-wrap:break-word}.container .setting-full .setting-details .description{font-size:.8em}.container .setting-full .setting-details code{background-color:#d3d3d3;padding:3px 6px}.container .setting-full .rules-list{width:100%;padding:1em}.container .setting-full .targeting-button{margin-left:1rem;margin-bottom:1em}.all-other{min-height:40px;justify-content:flex-start;border:1px solid #d5d5d5;border-radius:4px;background-color:#fff;margin:.5em 1em;padding:4px 0 4px .5em}.all-other .chip{background-color:#67b1fc3d}.all-other .served-value{margin-left:auto;min-width:100px}.end{margin-left:auto}.flex{display:flex;flex-wrap:wrap;align-items:center}.show-hide-toggle{margin-left:1em;cursor:pointer}@media (max-width: 1200px){.setting-full .setting-details{width:300px}}@media (max-width: 700px){.setting-full{flex-wrap:wrap}.setting-full .setting-details{padding:.2em 0 .2em .2em}.setting-full .all-other{margin:.5em .3em}}\n"] }]
1213
+ }], ctorParameters: function () { return [{ type: PublicApiService }]; }, propDecorators: { productId: [{
1214
+ type: Input
1215
+ }], environmentId: [{
1216
+ type: Input
1217
+ }], configId: [{
1218
+ type: Input
1219
+ }], settingId: [{
1220
+ type: Input
1221
+ }], canEditSetting: [{
1222
+ type: Input
1223
+ }], canDeleteSetting: [{
1224
+ type: Input
1225
+ }], deleteSettingText: [{
1226
+ type: Input
1227
+ }], showEnvironmentName: [{
1228
+ type: Input
1229
+ }], editSettingRequested: [{
1230
+ type: Output
1231
+ }], deleteSettingRequested: [{
1232
+ type: Output
1233
+ }], loadSucceeded: [{
1234
+ type: Output
1235
+ }], loadFailed: [{
1236
+ type: Output
1237
+ }], saveSucceeded: [{
1238
+ type: Output
1239
+ }], saveFailed: [{
1240
+ type: Output
1241
+ }], formValuesChanged: [{
1242
+ type: Output
1243
+ }] } });
1244
+
1245
+ class SettingSelectComponent extends BaseComponent {
1246
+ constructor(publicApiService) {
1247
+ super(publicApiService);
1248
+ this.settings = [];
1249
+ }
1250
+ ngOnInit() {
1251
+ this.settings = [];
1252
+ this.reloadSettings();
1253
+ }
1254
+ ngOnChanges() {
1255
+ this.reloadSettings();
1256
+ }
1257
+ reloadSettings() {
1258
+ if (this.configId) {
1259
+ this.createSettingsService().getSettings(this.configId).subscribe(settings => {
1260
+ this.settings = settings;
1261
+ if (this.settings.length > 0) {
1262
+ this.valueFormControl.setValue(this.settings[0].settingId);
1263
+ }
1264
+ });
1265
+ }
1266
+ }
1267
+ }
1268
+ SettingSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingSelectComponent, deps: [{ token: PublicApiService }], target: i0.ɵɵFactoryTarget.Component });
1269
+ SettingSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: SettingSelectComponent, selector: "configcat-setting-select", inputs: { valueFormControl: "valueFormControl", configId: "configId" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Feature flag or setting\" [formControl]=\"valueFormControl\" *ngIf=\"settings\" name=\"value\">\n <mat-option *ngFor=\"let setting of settings\" [value]=\"setting.settingId\">{{setting.name}}\n </mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"], components: [{ type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$3.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: SettingSelectComponent, decorators: [{
1271
+ type: Component,
1272
+ args: [{ selector: 'configcat-setting-select', template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Feature flag or setting\" [formControl]=\"valueFormControl\" *ngIf=\"settings\" name=\"value\">\n <mat-option *ngFor=\"let setting of settings\" [value]=\"setting.settingId\">{{setting.name}}\n </mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"] }]
1273
+ }], ctorParameters: function () { return [{ type: PublicApiService }]; }, propDecorators: { valueFormControl: [{
1274
+ type: Input
1275
+ }], configId: [{
1276
+ type: Input
1277
+ }] } });
1278
+
1279
+ class ProductSelectComponent extends BaseComponent {
1280
+ constructor(publicApiService) {
1281
+ super(publicApiService);
1282
+ this.products = [];
1283
+ }
1284
+ ngOnInit() {
1285
+ this.products = [];
1286
+ this.createProductsService().getProducts().subscribe(products => {
1287
+ this.products = products;
1288
+ if (this.products.length > 0) {
1289
+ this.valueFormControl.setValue(this.products[0].productId, {
1290
+ emitEvent: true,
1291
+ emitModelToViewChange: true, emitViewToModelChange: true
1292
+ });
1293
+ }
1294
+ });
1295
+ }
1296
+ }
1297
+ ProductSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ProductSelectComponent, deps: [{ token: PublicApiService }], target: i0.ɵɵFactoryTarget.Component });
1298
+ ProductSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: ProductSelectComponent, selector: "configcat-product-select", inputs: { valueFormControl: "valueFormControl" }, usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Product\" [formControl]=\"valueFormControl\" name=\"productValue\">\n <mat-option *ngFor=\"let product of products\" [value]=\"product.productId\">{{product.name}}\n </mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"], components: [{ type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$3.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1299
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ProductSelectComponent, decorators: [{
1300
+ type: Component,
1301
+ args: [{ selector: 'configcat-product-select', template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Product\" [formControl]=\"valueFormControl\" name=\"productValue\">\n <mat-option *ngFor=\"let product of products\" [value]=\"product.productId\">{{product.name}}\n </mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"] }]
1302
+ }], ctorParameters: function () { return [{ type: PublicApiService }]; }, propDecorators: { valueFormControl: [{
1303
+ type: Input
1304
+ }] } });
1305
+
1306
+ class ConfigSelectComponent extends BaseComponent {
1307
+ constructor(publicApiService) {
1308
+ super(publicApiService);
1309
+ this.configs = [];
1310
+ }
1311
+ ngOnInit() {
1312
+ this.configs = [];
1313
+ this.reloadConfigs();
1314
+ }
1315
+ ngOnChanges() {
1316
+ this.reloadConfigs();
1317
+ }
1318
+ reloadConfigs() {
1319
+ if (this.productId) {
1320
+ this.createConfigsService().getConfigs(this.productId).subscribe(configs => {
1321
+ this.configs = configs;
1322
+ if (this.configs.length > 0) {
1323
+ this.valueFormControl.setValue(this.configs[0].configId);
1324
+ }
1325
+ });
1326
+ }
1327
+ }
1328
+ }
1329
+ ConfigSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ConfigSelectComponent, deps: [{ token: PublicApiService }], target: i0.ɵɵFactoryTarget.Component });
1330
+ ConfigSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: ConfigSelectComponent, selector: "configcat-config-select", inputs: { valueFormControl: "valueFormControl", productId: "productId" }, providers: [
1331
+ {
1332
+ provide: NG_VALUE_ACCESSOR,
1333
+ useExisting: forwardRef(() => ConfigSelectComponent),
1334
+ multi: true
1335
+ }
1336
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Config\" [formControl]=\"valueFormControl\" *ngIf=\"configs\" name=\"value\">\n <mat-option *ngFor=\"let config of configs\" [value]=\"config.configId\">{{config.name}}</mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"], components: [{ type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$3.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ConfigSelectComponent, decorators: [{
1338
+ type: Component,
1339
+ args: [{ selector: 'configcat-config-select', providers: [
1340
+ {
1341
+ provide: NG_VALUE_ACCESSOR,
1342
+ useExisting: forwardRef(() => ConfigSelectComponent),
1343
+ multi: true
1344
+ }
1345
+ ], template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Config\" [formControl]=\"valueFormControl\" *ngIf=\"configs\" name=\"value\">\n <mat-option *ngFor=\"let config of configs\" [value]=\"config.configId\">{{config.name}}</mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"] }]
1346
+ }], ctorParameters: function () { return [{ type: PublicApiService }]; }, propDecorators: { valueFormControl: [{
1347
+ type: Input
1348
+ }], productId: [{
1349
+ type: Input
1350
+ }] } });
1351
+
1352
+ class EnvironmentSelectComponent extends BaseComponent {
1353
+ constructor(publicApiService) {
1354
+ super(publicApiService);
1355
+ this.environments = [];
1356
+ }
1357
+ ngOnInit() {
1358
+ this.environments = [];
1359
+ this.reloadEnvironments();
1360
+ }
1361
+ ngOnChanges() {
1362
+ this.reloadEnvironments();
1363
+ }
1364
+ reloadEnvironments() {
1365
+ if (this.productId) {
1366
+ this.createEnvironmentsService().getEnvironments(this.productId).subscribe(environments => {
1367
+ this.environments = environments;
1368
+ if (this.environments.length > 0) {
1369
+ this.valueFormControl.setValue(this.environments[0].environmentId);
1370
+ }
1371
+ });
1372
+ }
1373
+ }
1374
+ }
1375
+ EnvironmentSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: EnvironmentSelectComponent, deps: [{ token: PublicApiService }], target: i0.ɵɵFactoryTarget.Component });
1376
+ EnvironmentSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: EnvironmentSelectComponent, selector: "configcat-environment-select", inputs: { valueFormControl: "valueFormControl", productId: "productId" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Environment\" [formControl]=\"valueFormControl\" *ngIf=\"environments\" name=\"value\">\n <mat-option *ngFor=\"let environment of environments\" [value]=\"environment.environmentId\">{{environment.name}}\n </mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"], components: [{ type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$3.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: EnvironmentSelectComponent, decorators: [{
1378
+ type: Component,
1379
+ args: [{ selector: 'configcat-environment-select', template: "<mat-form-field class=\"form-field\">\n <mat-select placeholder=\"Environment\" [formControl]=\"valueFormControl\" *ngIf=\"environments\" name=\"value\">\n <mat-option *ngFor=\"let environment of environments\" [value]=\"environment.environmentId\">{{environment.name}}\n </mat-option>\n </mat-select>\n</mat-form-field>", styles: [".form-field{width:100%}\n"] }]
1380
+ }], ctorParameters: function () { return [{ type: PublicApiService }]; }, propDecorators: { valueFormControl: [{
1381
+ type: Input
1382
+ }], productId: [{
1383
+ type: Input
1384
+ }] } });
1385
+
1386
+ class FormHelper {
1387
+ static getErrorMessage(control, hint = '') {
1388
+ if (!control || control.valid) {
1389
+ return;
1390
+ }
1391
+ if (control.hasError('required')) {
1392
+ return `${hint} The field is required.`;
1393
+ }
1394
+ if (control.hasError('pattern')) {
1395
+ return 'Not a valid e-mail address.';
1396
+ }
1397
+ if (control.hasError('minlength')) {
1398
+ return 'The field must be at least ' + control.getError('minlength').requiredLength + ' characters long';
1399
+ }
1400
+ if (control.hasError('maxlength')) {
1401
+ return 'The field must be at max ' + control.getError('maxlength').requiredLength + ' characters long';
1402
+ }
1403
+ return;
1404
+ }
1405
+ }
1406
+
1407
+ class AuthorizationComponent {
1408
+ constructor(formBuilder, publicApiService) {
1409
+ this.formBuilder = formBuilder;
1410
+ this.publicApiService = publicApiService;
1411
+ this.basePath = null;
1412
+ this.authorized = new EventEmitter();
1413
+ this.FormHelper = FormHelper;
1414
+ }
1415
+ ngOnInit() {
1416
+ this.formGroup = this.formBuilder.group({
1417
+ basicAuthUsername: ['', Validators.required],
1418
+ basicAuthPassword: ['', Validators.required],
1419
+ });
1420
+ }
1421
+ onSubmit() {
1422
+ if (!this.formGroup.valid) {
1423
+ return;
1424
+ }
1425
+ const meService = this.publicApiService.createMeService(this.formGroup.controls.basicAuthUsername.value, this.formGroup.controls.basicAuthPassword.value, this.basePath);
1426
+ meService.getMe().subscribe(me => {
1427
+ this.authorized.emit({
1428
+ basicAuthUsername: this.formGroup.controls.basicAuthUsername.value,
1429
+ basicAuthPassword: this.formGroup.controls.basicAuthPassword.value
1430
+ });
1431
+ }, error => {
1432
+ this.formGroup.setErrors({ invalidAuthorization: 'Invalid Basic auth user name or password' });
1433
+ });
1434
+ }
1435
+ }
1436
+ AuthorizationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AuthorizationComponent, deps: [{ token: i2.FormBuilder }, { token: PublicApiService }], target: i0.ɵɵFactoryTarget.Component });
1437
+ AuthorizationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: AuthorizationComponent, selector: "configcat-authorization", inputs: { basePath: "basePath" }, outputs: { authorized: "authorized" }, ngImport: i0, template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\n <div class=\"container\">\n <div class=\"form\">\n <p>\n <a href=\"https://app.configcat.com/my-account/public-api-credentials\" target=\"_blank\">\n Get your Basic Auth user name and password</a> to access ConfigCat Public API.\n <br /><br />\n <b>Note!</b> Your ConfigCat account's email address and password will not work here.\n </p>\n\n <mat-form-field class=\"form-field\">\n <mat-label>Basic auth user name</mat-label>\n <input matInput placeholder=\"Basic auth user name\" formControlName=\"basicAuthUsername\">\n <mat-error *ngIf=\"formGroup.controls.basicAuthUsername.invalid\">\n {{FormHelper.getErrorMessage(formGroup.controls.basicAuthUsername)}}\n </mat-error>\n </mat-form-field>\n <mat-form-field class=\"form-field\">\n <mat-label>Basic auth password</mat-label>\n <input matInput placeholder=\"Basic auth password\" formControlName=\"basicAuthPassword\" type=\"password\"\n autocomplete=\"current-password\">\n <mat-error *ngIf=\"formGroup.controls.basicAuthPassword.invalid\">\n {{FormHelper.getErrorMessage(formGroup.controls.basicAuthPassword)}}\n </mat-error>\n </mat-form-field>\n <div>\n <button mat-raised-button color=\"primary\" type=\"submit\" class=\"submit\">Authorize</button>\n <mat-error *ngIf=\"formGroup.invalid && formGroup.errors && formGroup.errors.invalidAuthorization\">\n {{formGroup.errors.invalidAuthorization}}</mat-error>\n </div>\n </div>\n </div>\n</form>", styles: [".container{display:flex;margin:8px}.form{width:100%}.form-field{width:100%;margin-bottom:8px}.submit{margin-top:8px;margin-bottom:8px}\n"], components: [{ type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.MatLabel, selector: "mat-label" }, { type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.MatError, selector: "mat-error", inputs: ["id"] }] });
1438
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AuthorizationComponent, decorators: [{
1439
+ type: Component,
1440
+ args: [{ selector: 'configcat-authorization', template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\n <div class=\"container\">\n <div class=\"form\">\n <p>\n <a href=\"https://app.configcat.com/my-account/public-api-credentials\" target=\"_blank\">\n Get your Basic Auth user name and password</a> to access ConfigCat Public API.\n <br /><br />\n <b>Note!</b> Your ConfigCat account's email address and password will not work here.\n </p>\n\n <mat-form-field class=\"form-field\">\n <mat-label>Basic auth user name</mat-label>\n <input matInput placeholder=\"Basic auth user name\" formControlName=\"basicAuthUsername\">\n <mat-error *ngIf=\"formGroup.controls.basicAuthUsername.invalid\">\n {{FormHelper.getErrorMessage(formGroup.controls.basicAuthUsername)}}\n </mat-error>\n </mat-form-field>\n <mat-form-field class=\"form-field\">\n <mat-label>Basic auth password</mat-label>\n <input matInput placeholder=\"Basic auth password\" formControlName=\"basicAuthPassword\" type=\"password\"\n autocomplete=\"current-password\">\n <mat-error *ngIf=\"formGroup.controls.basicAuthPassword.invalid\">\n {{FormHelper.getErrorMessage(formGroup.controls.basicAuthPassword)}}\n </mat-error>\n </mat-form-field>\n <div>\n <button mat-raised-button color=\"primary\" type=\"submit\" class=\"submit\">Authorize</button>\n <mat-error *ngIf=\"formGroup.invalid && formGroup.errors && formGroup.errors.invalidAuthorization\">\n {{formGroup.errors.invalidAuthorization}}</mat-error>\n </div>\n </div>\n </div>\n</form>", styles: [".container{display:flex;margin:8px}.form{width:100%}.form-field{width:100%;margin-bottom:8px}.submit{margin-top:8px;margin-bottom:8px}\n"] }]
1441
+ }], ctorParameters: function () { return [{ type: i2.FormBuilder }, { type: PublicApiService }]; }, propDecorators: { basePath: [{
1442
+ type: Input
1443
+ }], authorized: [{
1444
+ type: Output
1445
+ }] } });
1446
+
1447
+ class NgConfigCatPublicApiUIModule {
1448
+ constructor() { }
1449
+ static forRoot(configurationFactory) {
1450
+ return {
1451
+ ngModule: NgConfigCatPublicApiUIModule,
1452
+ providers: [{ provide: Configuration, useFactory: configurationFactory }]
1453
+ };
1454
+ }
1455
+ }
1456
+ NgConfigCatPublicApiUIModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: NgConfigCatPublicApiUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1457
+ NgConfigCatPublicApiUIModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: NgConfigCatPublicApiUIModule, declarations: [BaseComponent,
1458
+ ProductSelectComponent,
1459
+ ConfigSelectComponent,
1460
+ EnvironmentSelectComponent,
1461
+ SettingSelectComponent,
1462
+ SettingItemComponent,
1463
+ AuthorizationComponent,
1464
+ SettingListComponent,
1465
+ SettingComponent,
1466
+ RolloutPercentageItemsComponent,
1467
+ RolloutRulesComponent,
1468
+ ValueComponent,
1469
+ ReasonDialogComponent,
1470
+ ConcurrentDialogComponent,
1471
+ SaveSnackbarComponent,
1472
+ ExpandDialogComponent], imports: [CommonModule,
1473
+ FormsModule,
1474
+ ReactiveFormsModule,
1475
+ BrowserAnimationsModule,
1476
+ MatFormFieldModule,
1477
+ MatOptionModule,
1478
+ MatSelectModule,
1479
+ MatButtonModule,
1480
+ MatInputModule,
1481
+ MatIconModule,
1482
+ MatTooltipModule,
1483
+ MatChipsModule,
1484
+ MatAutocompleteModule,
1485
+ DragDropModule,
1486
+ RouterModule,
1487
+ MatSnackBarModule,
1488
+ MatDialogModule,
1489
+ MatMenuModule,
1490
+ ApiModule], exports: [AuthorizationComponent,
1491
+ ProductSelectComponent,
1492
+ ConfigSelectComponent,
1493
+ EnvironmentSelectComponent,
1494
+ SettingSelectComponent,
1495
+ SettingItemComponent] });
1496
+ NgConfigCatPublicApiUIModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: NgConfigCatPublicApiUIModule, imports: [[
1497
+ CommonModule,
1498
+ FormsModule,
1499
+ ReactiveFormsModule,
1500
+ BrowserAnimationsModule,
1501
+ MatFormFieldModule,
1502
+ MatOptionModule,
1503
+ MatSelectModule,
1504
+ MatButtonModule,
1505
+ MatInputModule,
1506
+ MatIconModule,
1507
+ MatTooltipModule,
1508
+ MatChipsModule,
1509
+ MatAutocompleteModule,
1510
+ DragDropModule,
1511
+ RouterModule,
1512
+ MatSnackBarModule,
1513
+ MatDialogModule,
1514
+ MatMenuModule,
1515
+ ApiModule
1516
+ ]] });
1517
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: NgConfigCatPublicApiUIModule, decorators: [{
1518
+ type: NgModule,
1519
+ args: [{
1520
+ declarations: [
1521
+ BaseComponent,
1522
+ ProductSelectComponent,
1523
+ ConfigSelectComponent,
1524
+ EnvironmentSelectComponent,
1525
+ SettingSelectComponent,
1526
+ SettingItemComponent,
1527
+ AuthorizationComponent,
1528
+ SettingListComponent,
1529
+ SettingComponent,
1530
+ RolloutPercentageItemsComponent,
1531
+ RolloutRulesComponent,
1532
+ ValueComponent,
1533
+ ReasonDialogComponent,
1534
+ ConcurrentDialogComponent,
1535
+ SaveSnackbarComponent,
1536
+ ExpandDialogComponent
1537
+ ],
1538
+ imports: [
1539
+ CommonModule,
1540
+ FormsModule,
1541
+ ReactiveFormsModule,
1542
+ BrowserAnimationsModule,
1543
+ MatFormFieldModule,
1544
+ MatOptionModule,
1545
+ MatSelectModule,
1546
+ MatButtonModule,
1547
+ MatInputModule,
1548
+ MatIconModule,
1549
+ MatTooltipModule,
1550
+ MatChipsModule,
1551
+ MatAutocompleteModule,
1552
+ DragDropModule,
1553
+ RouterModule,
1554
+ MatSnackBarModule,
1555
+ MatDialogModule,
1556
+ MatMenuModule,
1557
+ ApiModule
1558
+ ],
1559
+ exports: [
1560
+ AuthorizationComponent,
1561
+ ProductSelectComponent,
1562
+ ConfigSelectComponent,
1563
+ EnvironmentSelectComponent,
1564
+ SettingSelectComponent,
1565
+ SettingItemComponent
1566
+ ]
1567
+ }]
1568
+ }], ctorParameters: function () { return []; } });
1569
+
1570
+ /*
1571
+ * Public API Surface of ng-configcat-publicapi-ui
1572
+ */
1573
+
1574
+ /**
1575
+ * Generated bundle index. Do not edit.
1576
+ */
1577
+
1578
+ export { AuthorizationComponent, ConfigSelectComponent, EnvironmentSelectComponent, NgConfigCatPublicApiUIModule, ProductSelectComponent, PublicApiService, SettingItemComponent, SettingSelectComponent };
1579
+ //# sourceMappingURL=ng-configcat-publicapi-ui.mjs.map