@posiwise/public-modules 0.0.118 → 0.0.119
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.
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
2
|
import { AbTestService } from '@posiwise/common-services';
|
|
3
3
|
import { AB_TEST_ACTIONS } from '@posiwise/common-utilities';
|
|
4
|
-
import { catchError, of, take } from 'rxjs';
|
|
5
4
|
import * as i0 from "@angular/core";
|
|
6
5
|
import * as i1 from "@posiwise/common-services";
|
|
7
6
|
export class AbTestContainerComponent {
|
|
8
|
-
constructor(service
|
|
7
|
+
constructor(service) {
|
|
9
8
|
this.service = service;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
this.showDefaultExperiment = true;
|
|
9
|
+
/**
|
|
10
|
+
* Specifies boolean to show the experiment as fallback
|
|
11
|
+
*/
|
|
12
|
+
this.showDefaultExperiment = false;
|
|
16
13
|
}
|
|
17
14
|
ngOnInit() {
|
|
18
|
-
|
|
19
|
-
this.cdr.markForCheck();
|
|
20
|
-
// Non-blocking experiment resolution with timeout
|
|
21
|
-
setTimeout(() => this.getExperiment(), 50);
|
|
15
|
+
this.getExperiment();
|
|
22
16
|
}
|
|
23
17
|
getExperiment() {
|
|
24
18
|
this.service
|
|
25
19
|
.getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceInput)
|
|
26
|
-
.pipe(take(1), catchError(() => {
|
|
27
|
-
console.warn('Experiment retrieval failed, using default');
|
|
28
|
-
return of(this.data);
|
|
29
|
-
}))
|
|
30
20
|
.subscribe({
|
|
31
21
|
next: (response) => {
|
|
32
|
-
this.data = response || this.data;
|
|
33
22
|
this.showDefaultExperiment = false;
|
|
34
|
-
this.
|
|
23
|
+
this.data = response || {};
|
|
24
|
+
},
|
|
25
|
+
error: () => {
|
|
26
|
+
// in case the api for experiment fails, we show the default experiment
|
|
27
|
+
this.showDefaultExperiment = true;
|
|
35
28
|
}
|
|
36
29
|
});
|
|
37
30
|
}
|
|
38
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }
|
|
39
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: AbTestContainerComponent, selector: "pw-ab-test-container", inputs: { experimentName: "experimentName", serviceInput: "serviceInput" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
32
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: AbTestContainerComponent, selector: "pw-ab-test-container", inputs: { experimentName: "experimentName", serviceInput: "serviceInput" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); }
|
|
40
33
|
}
|
|
41
34
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, decorators: [{
|
|
42
35
|
type: Component,
|
|
43
36
|
args: [{
|
|
37
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
44
38
|
selector: 'pw-ab-test-container',
|
|
45
|
-
template: '<ng-content></ng-content>'
|
|
46
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
39
|
+
template: '<ng-content></ng-content>'
|
|
47
40
|
}]
|
|
48
|
-
}], ctorParameters: () => [{ type: i1.AbTestService }
|
|
41
|
+
}], ctorParameters: () => [{ type: i1.AbTestService }], propDecorators: { experimentName: [{
|
|
49
42
|
type: Input
|
|
50
43
|
}], serviceInput: [{
|
|
51
44
|
type: Input
|
|
52
45
|
}] } });
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ZhdWx0IGV4cGVyaW1lbnRcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaG93RGVmYXVsdEV4cGVyaW1lbnQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgIH1cbn1cbiJdfQ==
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i3 from '@angular/common';
|
|
2
2
|
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Component,
|
|
4
|
+
import { Component, Input, NgModule, ChangeDetectionStrategy, ViewChild, Inject } from '@angular/core';
|
|
5
5
|
import * as i2$2 from '@angular/forms';
|
|
6
6
|
import { UntypedFormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import { CoreTranslocoModule } from '@posiwise/core-transloco';
|
|
@@ -23,7 +23,6 @@ import * as i1 from '@posiwise/common-services';
|
|
|
23
23
|
import { FormHelperService, ValidationService, CustomToastService, MainApiHttpService } from '@posiwise/common-services';
|
|
24
24
|
import { PipesModule } from '@posiwise/pipes';
|
|
25
25
|
import { AB_TEST_ACTIONS, COUNTRIES_CODE, MICRO_SERVICE } from '@posiwise/common-utilities';
|
|
26
|
-
import { take, catchError, of } from 'rxjs';
|
|
27
26
|
import swal from 'sweetalert2';
|
|
28
27
|
import { HelperService } from '@posiwise/helper-service';
|
|
29
28
|
import * as i2$3 from '@posiwise/smart-crm-shared';
|
|
@@ -133,47 +132,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
133
132
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: i1.CommonService }, { type: i1.AuthService }, { type: i2$1.DomSanitizer }] });
|
|
134
133
|
|
|
135
134
|
class AbTestContainerComponent {
|
|
136
|
-
constructor(service
|
|
135
|
+
constructor(service) {
|
|
137
136
|
this.service = service;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
};
|
|
143
|
-
this.showDefaultExperiment = true;
|
|
137
|
+
/**
|
|
138
|
+
* Specifies boolean to show the experiment as fallback
|
|
139
|
+
*/
|
|
140
|
+
this.showDefaultExperiment = false;
|
|
144
141
|
}
|
|
145
142
|
ngOnInit() {
|
|
146
|
-
|
|
147
|
-
this.cdr.markForCheck();
|
|
148
|
-
// Non-blocking experiment resolution with timeout
|
|
149
|
-
setTimeout(() => this.getExperiment(), 50);
|
|
143
|
+
this.getExperiment();
|
|
150
144
|
}
|
|
151
145
|
getExperiment() {
|
|
152
146
|
this.service
|
|
153
147
|
.getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceInput)
|
|
154
|
-
.pipe(take(1), catchError(() => {
|
|
155
|
-
console.warn('Experiment retrieval failed, using default');
|
|
156
|
-
return of(this.data);
|
|
157
|
-
}))
|
|
158
148
|
.subscribe({
|
|
159
149
|
next: (response) => {
|
|
160
|
-
this.data = response || this.data;
|
|
161
150
|
this.showDefaultExperiment = false;
|
|
162
|
-
this.
|
|
151
|
+
this.data = response || {};
|
|
152
|
+
},
|
|
153
|
+
error: () => {
|
|
154
|
+
// in case the api for experiment fails, we show the default experiment
|
|
155
|
+
this.showDefaultExperiment = true;
|
|
163
156
|
}
|
|
164
157
|
});
|
|
165
158
|
}
|
|
166
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }
|
|
167
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: AbTestContainerComponent, selector: "pw-ab-test-container", inputs: { experimentName: "experimentName", serviceInput: "serviceInput" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true
|
|
159
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
160
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: AbTestContainerComponent, selector: "pw-ab-test-container", inputs: { experimentName: "experimentName", serviceInput: "serviceInput" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); }
|
|
168
161
|
}
|
|
169
162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, decorators: [{
|
|
170
163
|
type: Component,
|
|
171
164
|
args: [{
|
|
165
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
172
166
|
selector: 'pw-ab-test-container',
|
|
173
|
-
template: '<ng-content></ng-content>'
|
|
174
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
167
|
+
template: '<ng-content></ng-content>'
|
|
175
168
|
}]
|
|
176
|
-
}], ctorParameters: () => [{ type: i1.AbTestService }
|
|
169
|
+
}], ctorParameters: () => [{ type: i1.AbTestService }], propDecorators: { experimentName: [{
|
|
177
170
|
type: Input
|
|
178
171
|
}], serviceInput: [{
|
|
179
172
|
type: Input
|