@posiwise/public-modules 0.0.116 → 0.0.117
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,51 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AbTestService } from '@posiwise/common-services';
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
3
2
|
import { AB_TEST_ACTIONS } from '@posiwise/common-utilities';
|
|
4
|
-
import {
|
|
3
|
+
import { AbTestService } from '@posiwise/common-services';
|
|
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
|
-
// Fetch experiment immediately without delay
|
|
19
15
|
this.getExperiment();
|
|
20
16
|
}
|
|
21
17
|
getExperiment() {
|
|
22
18
|
this.service
|
|
23
19
|
.getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceInput)
|
|
24
|
-
.pipe(take(1), catchError(() => {
|
|
25
|
-
console.warn('Experiment retrieval failed, using default');
|
|
26
|
-
return of(this.data);
|
|
27
|
-
}))
|
|
28
20
|
.subscribe({
|
|
29
21
|
next: (response) => {
|
|
30
|
-
this.data = response || this.data;
|
|
31
22
|
this.showDefaultExperiment = false;
|
|
32
|
-
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;
|
|
33
28
|
}
|
|
34
29
|
});
|
|
35
30
|
}
|
|
36
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }
|
|
37
|
-
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 }); }
|
|
38
33
|
}
|
|
39
34
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, decorators: [{
|
|
40
35
|
type: Component,
|
|
41
36
|
args: [{
|
|
37
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
42
38
|
selector: 'pw-ab-test-container',
|
|
43
|
-
template: '<ng-content></ng-content>'
|
|
44
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
39
|
+
template: '<ng-content></ng-content>'
|
|
45
40
|
}]
|
|
46
|
-
}], ctorParameters: () => [{ type: i1.AbTestService }
|
|
41
|
+
}], ctorParameters: () => [{ type: i1.AbTestService }], propDecorators: { experimentName: [{
|
|
47
42
|
type: Input
|
|
48
43
|
}], serviceInput: [{
|
|
49
44
|
type: Input
|
|
50
45
|
}] } });
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
46
|
+
//# sourceMappingURL=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WVudE5hbWU6IHN0cmluZztcblxuICAgIEBJbnB1dCgpXG4gICAgc2VydmljZUlucHV0OiBzdHJpbmc7XG5cbiAgICBkYXRhOiBFeHBlcmltZW50O1xuXG4gICAgLyoqXG4gICAgICogU3BlY2lmaWVzIGJvb2xlYW4gdG8gc2hvdyB0aGUgZXhwZXJpbWVudCBhcyBmYWxsYmFja1xuICAgICAqL1xuICAgIHNob3dEZWZhdWx0RXhwZXJpbWVudCA9IGZhbHNlO1xuXG4gICAgY29uc3RydWN0b3IocHJpdmF0ZSByZWFkb25seSBzZXJ2aWNlOiBBYlRlc3RTZXJ2aWNlKSB7fVxuXG4gICAgbmdPbkluaXQoKTogdm9pZCB7XG4gICAgICAgIHRoaXMuZ2V0RXhwZXJpbWVudCgpO1xuICAgIH1cblxuICAgIHByaXZhdGUgZ2V0RXhwZXJpbWVudCgpIHtcbiAgICAgICAgdGhpcy5zZXJ2aWNlXG4gICAgICAgICAgICAuZ2V0RXhwZXJpbWVudCh0aGlzLmV4cGVyaW1lbnROYW1lLCBBQl9URVNUX0FDVElPTlMuU1RBUlQsIHRoaXMuc2VydmljZUlucHV0KVxuICAgICAgICAgICAgLnN1YnNjcmliZSh7XG4gICAgICAgICAgICAgICAgbmV4dDogKHJlc3BvbnNlOiBFeHBlcmltZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2hvd0RlZmF1bHRFeHBlcmltZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGF0YSA9IHJlc3BvbnNlIHx8ICh7fSBhcyBFeHBlcmltZW50KTtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGVycm9yOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGluIGNhc2UgdGhlIGFwaSBmb3IgZXhwZXJpbWVudCBmYWlscywgd2Ugc2hvdyB0aGUgZGVmYXVsdCBleHBlcmltZW50XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2hvd0RlZmF1bHRFeHBlcmltZW50ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICB9XG59XG4iXX0=
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i3 from '@angular/common';
|
|
2
2
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Component,
|
|
4
|
+
import { Component, Input, ChangeDetectionStrategy, ViewChild, Inject, NgModule } 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,45 +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
|
-
// Fetch experiment immediately without delay
|
|
147
143
|
this.getExperiment();
|
|
148
144
|
}
|
|
149
145
|
getExperiment() {
|
|
150
146
|
this.service
|
|
151
147
|
.getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceInput)
|
|
152
|
-
.pipe(take(1), catchError(() => {
|
|
153
|
-
console.warn('Experiment retrieval failed, using default');
|
|
154
|
-
return of(this.data);
|
|
155
|
-
}))
|
|
156
148
|
.subscribe({
|
|
157
149
|
next: (response) => {
|
|
158
|
-
this.data = response || this.data;
|
|
159
150
|
this.showDefaultExperiment = false;
|
|
160
|
-
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;
|
|
161
156
|
}
|
|
162
157
|
});
|
|
163
158
|
}
|
|
164
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }
|
|
165
|
-
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 }); }
|
|
166
161
|
}
|
|
167
162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: AbTestContainerComponent, decorators: [{
|
|
168
163
|
type: Component,
|
|
169
164
|
args: [{
|
|
165
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
170
166
|
selector: 'pw-ab-test-container',
|
|
171
|
-
template: '<ng-content></ng-content>'
|
|
172
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
167
|
+
template: '<ng-content></ng-content>'
|
|
173
168
|
}]
|
|
174
|
-
}], ctorParameters: () => [{ type: i1.AbTestService }
|
|
169
|
+
}], ctorParameters: () => [{ type: i1.AbTestService }], propDecorators: { experimentName: [{
|
|
175
170
|
type: Input
|
|
176
171
|
}], serviceInput: [{
|
|
177
172
|
type: Input
|