@posiwise/shared-components 0.0.1
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.
- package/README.md +7 -0
- package/esm2020/index.mjs +2 -0
- package/esm2020/lib/ab-test/ab-alternative/ab-alternative.component.mjs +25 -0
- package/esm2020/lib/ab-test/ab-test-container/ab-test-container.component.mjs +46 -0
- package/esm2020/lib/ab-test/ab-test.interface.mjs +2 -0
- package/esm2020/lib/shared-components.module.mjs +22 -0
- package/esm2020/shared-components.mjs +5 -0
- package/fesm2015/shared-components.mjs +92 -0
- package/fesm2015/shared-components.mjs.map +1 -0
- package/fesm2020/shared-components.mjs +92 -0
- package/fesm2020/shared-components.mjs.map +1 -0
- package/index.d.ts +1 -0
- package/lib/ab-test/ab-alternative/ab-alternative.component.d.ts +16 -0
- package/lib/ab-test/ab-test-container/ab-test-container.component.d.ts +19 -0
- package/lib/ab-test/ab-test.interface.d.ts +9 -0
- package/lib/shared-components.module.d.ts +8 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from './lib/shared-components.module';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL3NoYXJlZC1jb21wb25lbnRzL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGdDQUFnQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9saWIvc2hhcmVkLWNvbXBvbmVudHMubW9kdWxlJztcbiJdfQ==
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { AbTestContainerComponent } from '../ab-test-container/ab-test-container.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class AbAlternativeComponent {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* If the getExperiment call fails, it can be set to show the experiment
|
|
8
|
+
* as fallback
|
|
9
|
+
*/
|
|
10
|
+
this.default = false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
AbAlternativeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbAlternativeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14
|
+
AbAlternativeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AbAlternativeComponent, selector: "ab-alternative", inputs: { name: "name", ref: "ref", default: "default" }, ngImport: i0, template: "<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n" });
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbAlternativeComponent, decorators: [{
|
|
16
|
+
type: Component,
|
|
17
|
+
args: [{ selector: 'ab-alternative', template: "<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n" }]
|
|
18
|
+
}], propDecorators: { name: [{
|
|
19
|
+
type: Input
|
|
20
|
+
}], ref: [{
|
|
21
|
+
type: Input
|
|
22
|
+
}], default: [{
|
|
23
|
+
type: Input
|
|
24
|
+
}] } });
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWItYWx0ZXJuYXRpdmUuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGl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RpdmUnLFxuICAgIHRlbXBsYXRlVXJsOiAnLi9hYi1hbHRlcm5hdGl2ZS5jb21wb25lbnQuaHRtbCdcbn0pXG5leHBvcnQgY2xhc3MgQWJBbHRlcm5hdGl2ZUNvbXBvbmVudCB7XG4gICAgQElucHV0KClcbiAgICBuYW1lOiBzdHJpbmc7XG5cbiAgICAvKipcbiAgICAgKiBTcGVjZmljaWVzIEFiVGVzdENvbnRhaW5lckNvbXBvbmVudCBpbnN0YW5jZSB0ZW1wbGF0ZSByZWZlcmVuY2VcbiAgICAgKi9cbiAgICBASW5wdXQoKVxuICAgIHJlZjogQWJUZXN0Q29udGFpbmVyQ29tcG9uZW50O1xuXG4gICAgLyoqXG4gICAgICogSWYgdGhlIGdldEV4cGVyaW1lbnQgY2FsbCBmYWlscywgaXQgY2FuIGJlIHNldCB0byBzaG93IHRoZSBleHBlcmltZW50XG4gICAgICogYXMgZmFsbGJhY2tcbiAgICAgKi9cbiAgICBASW5wdXQoKVxuICAgIGRlZmF1bHQgPSBmYWxzZTtcbn1cbiIsIjwhLS0gcmVuZGVycyB0aGUgdGVtcGxhdGUgZm9yIHRoZSBzdGFydGVkIGV4cGVyaW1lbnQuXG5pbiBjYXNlIG9mIGVycm9yLCByZW5kZXIgdGhlIHRlbXBsYXRlIG1hcmtlZCBhcyBkZWZhdWx0PXRydWUgIC0tPlxuPG5nLXRlbXBsYXRlIFtuZ0lmXT1cIlxuICAgICAgICByZWY/LmRhdGE/LmFsdGVybmF0aXZlID09PSBuYW1lIHx8IChkZWZhdWx0ID09PSB0cnVlICYmIHJlZi5zaG93RGVmYXVsdEV4cGVyaW1lbnQgPT09IHRydWUpXG4gICAgXCI+XG4gIDxuZy1jb250ZW50PjwvbmctY29udGVudD5cbjwvbmctdGVtcGxhdGU+XG4iXX0=
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { AB_TEST_ACTIONS } from '@posiwise/common-utilities';
|
|
3
|
+
import { AbTestService } from '@posiwise/common-services';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@posiwise/common-services";
|
|
6
|
+
export class AbTestContainerComponent {
|
|
7
|
+
constructor(service) {
|
|
8
|
+
this.service = service;
|
|
9
|
+
/**
|
|
10
|
+
* Specifies boolean to show the experiment as fallback
|
|
11
|
+
*/
|
|
12
|
+
this.showDefaultExperiment = false;
|
|
13
|
+
}
|
|
14
|
+
ngOnInit() {
|
|
15
|
+
this.getExperiment();
|
|
16
|
+
}
|
|
17
|
+
getExperiment() {
|
|
18
|
+
this.service
|
|
19
|
+
.getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceName)
|
|
20
|
+
.subscribe({
|
|
21
|
+
next: (response) => {
|
|
22
|
+
this.showDefaultExperiment = false;
|
|
23
|
+
this.data = response || {};
|
|
24
|
+
},
|
|
25
|
+
error: () => {
|
|
26
|
+
// in case the api for experiment fails, we show the default experiment
|
|
27
|
+
this.showDefaultExperiment = true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
AbTestContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
+
AbTestContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AbTestContainerComponent, selector: "pw-ab-test-container", inputs: { experimentName: "experimentName", serviceName: "serviceName" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbTestContainerComponent, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{
|
|
37
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
38
|
+
selector: 'pw-ab-test-container',
|
|
39
|
+
template: '<ng-content></ng-content>'
|
|
40
|
+
}]
|
|
41
|
+
}], ctorParameters: function () { return [{ type: i1.AbTestService }]; }, propDecorators: { experimentName: [{
|
|
42
|
+
type: Input
|
|
43
|
+
}], serviceName: [{
|
|
44
|
+
type: Input
|
|
45
|
+
}] } });
|
|
46
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWItdGVzdC1jb250YWluZXIuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9zaGFyZWQtY29tcG9uZW50cy9zcmMvbGliL2FiLXRlc3QvYWItdGVzdC1jb250YWluZXIvYWItdGVzdC1jb250YWluZXIuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFVLE1BQU0sZUFBZSxDQUFDO0FBRXpELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUU3RCxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7OztBQU8xRCxNQUFNLE9BQU8sd0JBQXdCO0lBY2pDLFlBQW9CLE9BQXNCO1FBQXRCLFlBQU8sR0FBUCxPQUFPLENBQWU7UUFMMUM7O1dBRUc7UUFDSCwwQkFBcUIsR0FBRyxLQUFLLENBQUM7SUFFZSxDQUFDO0lBRTlDLFFBQVE7UUFDSixJQUFJLENBQUMsYUFBYSxFQUFFLENBQUM7SUFDekIsQ0FBQztJQUVPLGFBQWE7UUFDakIsSUFBSSxDQUFDLE9BQU87YUFDUCxhQUFhLENBQUMsSUFBSSxDQUFDLGNBQWMsRUFBRSxlQUFlLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxXQUFXLENBQUM7YUFDM0UsU0FBUyxDQUFDO1lBQ1AsSUFBSSxFQUFFLEN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0ZW1wbGF0ZTogJzxuZy1jb250ZW50PjwvbmctY29udGVudD4nXG59KVxuZXhwb3J0IGNsYXNzIEFiVGVzdENvbnRhaW5lckNvbXBvbmVudCBpbXBsZW1lbnRzIE9uSW5pdCB7XG4gICAgQElucHV0KClcbiAgICBleHBlcmltZW50TmFtZTogc3RyaW5nO1xuXG4gICAgQElucHV0KClcbiAgICBzZXJ2aWNlTmFtZTogc3RyaW5nO1xuXG4gICAgZGF0YTogRXhwZXJpbWVudDtcblxuICAgIC8qKlxuICAgICAqIFNwZWNpZmllcyBib29sZWFuIHRvIHNob3cgdGhlIGV4cGVyaW1lbnQgYXMgZmFsbGJhY2tcbiAgICAgKi9cbiAgICBzaG93RGVmYXVsdEV4cGVyaW1lbnQgPSBmYWxzZTtcblxuICAgIGNvbnN0cnVjdG9yKHByaXZhdGUgc2VydmljZTogQWJUZXN0U2VydmljZSkge31cblxuICAgIG5nT25Jbml0KCk6IHZvaWQge1xuICAgICAgICB0aGlzLmdldEV4cGVyaW1lbnQoKTtcbiAgICB9XG5cbiAgICBwcml2YXRlIGdldEV4cGVyaW1lbnQoKSB7XG4gICAgICAgIHRoaXMuc2VydmljZVxuICAgICAgICAgICAgLmdldEV4cGVyaW1lbnQodGhpcy5leHBlcmltZW50TmFtZSwgQUJfVEVTVF9BQ1RJT05TLlNUQVJULCB0aGlzLnNlcnZpY2VOYW1lKVxuICAgICAgICAgICAgLnN1YnNjcmliZSh7XG4gICAgICAgICAgICAgICAgbmV4dDogKHJlc3BvbnNlOiBFeHBlcmltZW50KSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2hvd0RlZmF1bHRFeHBlcmltZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGF0YSA9IHJlc3BvbnNlIHx8ICh7fSBhcyBFeHBlcmltZW50KTtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGVycm9yOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGluIGNhc2UgdGhlIGFwaSBmb3IgZXhwZXJpbWVudCBmYWlscywgd2Ugc2hvdyB0aGUgZGVmYXVsdCBleHBlcmltZW50XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2hvd0RlZmF1bHRFeHBlcmltZW50ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICB9XG59XG4iXX0=
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWItdGVzdC5pbnRlcmZhY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL3NoYXJlZC1jb21wb25lbnRzL3NyYy9saWIvYWItdGVzdC9hYi10ZXN0LmludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW50ZXJmYWNlIEV4cGVyaW1lbnRNZXRhIHtcbiAgICBkZXNjcmlwdGlvbjogc3RyaW5nO1xuICAgIHRleHQ6IHN0cmluZztcbn1cblxuZXhwb3J0IGludGVyZmFjZSBFeHBlcmltZW50IHtcbiAgICBhbHRlcm5hdGl2ZTogc3RyaW5nO1xuICAgIG1ldGE6IEV4cGVyaW1lbnRNZXRhO1xufVxuIl19
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { AbTestContainerComponent } from "./ab-test/ab-test-container/ab-test-container.component";
|
|
3
|
+
import { AbAlternativeComponent } from "./ab-test/ab-alternative/ab-alternative.component";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class SharedComponentsModule {
|
|
6
|
+
}
|
|
7
|
+
SharedComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
8
|
+
SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, declarations: [AbTestContainerComponent,
|
|
9
|
+
AbAlternativeComponent] });
|
|
10
|
+
SharedComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule });
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, decorators: [{
|
|
12
|
+
type: NgModule,
|
|
13
|
+
args: [{
|
|
14
|
+
declarations: [
|
|
15
|
+
AbTestContainerComponent,
|
|
16
|
+
AbAlternativeComponent
|
|
17
|
+
],
|
|
18
|
+
imports: [],
|
|
19
|
+
exports: []
|
|
20
|
+
}]
|
|
21
|
+
}] });
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLWNvbXBvbmVudHMubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9zaGFyZWQtY29tcG9uZW50cy9zcmMvbGliL3NoYXJlZC1jb21wb25lbnRzLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBQyx3QkFBd0IsRUFBQyxNQUFNLHlEQUF5RCxDQUFDO0FBQ2pHLE9BQU8sRUFBQyxzQkFBc0IsRUFBQyxNQUFNLG1EQUFtRCxDQUFDOztBQVd6RixNQUFNLE9BQU8sc0JBQXNCOzttSEFBdEIsc0JBQXNCO29IQUF0QixzQkFBc0IsaUJBUC9CLHdCQUF3QjtRQUN4QixzQkFBc0I7b0hBTWIsc0JBQXNCOzJGQUF0QixzQkFBc0I7a0JBVGxDLFFBQVE7bUJBQUM7b0JBQ1IsWUFBWSxFQUFFO3dCQUNaLHdCQUF3Qjt3QkFDeEIsc0JBQXNCO3FCQUN2QjtvQkFDRCxPQUFPLEVBQUUsRUFDUjtvQkFDRCxPQUFPLEVBQUUsRUFBRTtpQkFDWiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IE5nTW9kdWxlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQge0FiVGVzdENvbnRhaW5lckNvbXBvbmVudH0gZnJvbSBcIi4vYWItdGVzdC9hYi10ZXN0LWNvbnRhaW5lci9hYi10ZXN0LWNvbnRhaW5lci5jb21wb25lbnRcIjtcbmltcG9ydCB7QWJBbHRlcm5hdGl2ZUNvbXBvbmVudH0gZnJvbSBcIi4vYWItdGVzdC9hYi1hbHRlcm5hdGl2ZS9hYi1hbHRlcm5hdGl2ZS5jb21wb25lbnRcIjtcblxuQE5nTW9kdWxlKHtcbiAgZGVjbGFyYXRpb25zOiBbXG4gICAgQWJUZXN0Q29udGFpbmVyQ29tcG9uZW50LFxuICAgIEFiQWx0ZXJuYXRpdmVDb21wb25lbnRcbiAgXSxcbiAgaW1wb3J0czogW1xuICBdLFxuICBleHBvcnRzOiBbXVxufSlcbmV4cG9ydCBjbGFzcyBTaGFyZWRDb21wb25lbnRzTW9kdWxlIHsgfVxuIl19
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLWNvbXBvbmVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL3NoYXJlZC1jb21wb25lbnRzL3NyYy9zaGFyZWQtY29tcG9uZW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, Input, NgModule } from '@angular/core';
|
|
3
|
+
import { AB_TEST_ACTIONS } from '@posiwise/common-utilities';
|
|
4
|
+
import * as i1 from '@posiwise/common-services';
|
|
5
|
+
|
|
6
|
+
class AbTestContainerComponent {
|
|
7
|
+
constructor(service) {
|
|
8
|
+
this.service = service;
|
|
9
|
+
/**
|
|
10
|
+
* Specifies boolean to show the experiment as fallback
|
|
11
|
+
*/
|
|
12
|
+
this.showDefaultExperiment = false;
|
|
13
|
+
}
|
|
14
|
+
ngOnInit() {
|
|
15
|
+
this.getExperiment();
|
|
16
|
+
}
|
|
17
|
+
getExperiment() {
|
|
18
|
+
this.service
|
|
19
|
+
.getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceName)
|
|
20
|
+
.subscribe({
|
|
21
|
+
next: (response) => {
|
|
22
|
+
this.showDefaultExperiment = false;
|
|
23
|
+
this.data = response || {};
|
|
24
|
+
},
|
|
25
|
+
error: () => {
|
|
26
|
+
// in case the api for experiment fails, we show the default experiment
|
|
27
|
+
this.showDefaultExperiment = true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
AbTestContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
+
AbTestContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AbTestContainerComponent, selector: "pw-ab-test-container", inputs: { experimentName: "experimentName", serviceName: "serviceName" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbTestContainerComponent, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{
|
|
37
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
38
|
+
selector: 'pw-ab-test-container',
|
|
39
|
+
template: '<ng-content></ng-content>'
|
|
40
|
+
}]
|
|
41
|
+
}], ctorParameters: function () { return [{ type: i1.AbTestService }]; }, propDecorators: { experimentName: [{
|
|
42
|
+
type: Input
|
|
43
|
+
}], serviceName: [{
|
|
44
|
+
type: Input
|
|
45
|
+
}] } });
|
|
46
|
+
|
|
47
|
+
class AbAlternativeComponent {
|
|
48
|
+
constructor() {
|
|
49
|
+
/**
|
|
50
|
+
* If the getExperiment call fails, it can be set to show the experiment
|
|
51
|
+
* as fallback
|
|
52
|
+
*/
|
|
53
|
+
this.default = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
AbAlternativeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbAlternativeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
57
|
+
AbAlternativeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AbAlternativeComponent, selector: "ab-alternative", inputs: { name: "name", ref: "ref", default: "default" }, ngImport: i0, template: "<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n" });
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbAlternativeComponent, decorators: [{
|
|
59
|
+
type: Component,
|
|
60
|
+
args: [{ selector: 'ab-alternative', template: "<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n" }]
|
|
61
|
+
}], propDecorators: { name: [{
|
|
62
|
+
type: Input
|
|
63
|
+
}], ref: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], default: [{
|
|
66
|
+
type: Input
|
|
67
|
+
}] } });
|
|
68
|
+
|
|
69
|
+
class SharedComponentsModule {
|
|
70
|
+
}
|
|
71
|
+
SharedComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
72
|
+
SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, declarations: [AbTestContainerComponent,
|
|
73
|
+
AbAlternativeComponent] });
|
|
74
|
+
SharedComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule });
|
|
75
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, decorators: [{
|
|
76
|
+
type: NgModule,
|
|
77
|
+
args: [{
|
|
78
|
+
declarations: [
|
|
79
|
+
AbTestContainerComponent,
|
|
80
|
+
AbAlternativeComponent
|
|
81
|
+
],
|
|
82
|
+
imports: [],
|
|
83
|
+
exports: []
|
|
84
|
+
}]
|
|
85
|
+
}] });
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Generated bundle index. Do not edit.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
export { SharedComponentsModule };
|
|
92
|
+
//# sourceMappingURL=shared-components.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-components.mjs","sources":["../../../../libs/shared-components/src/lib/ab-test/ab-test-container/ab-test-container.component.ts","../../../../libs/shared-components/src/lib/ab-test/ab-alternative/ab-alternative.component.ts","../../../../libs/shared-components/src/lib/ab-test/ab-alternative/ab-alternative.component.html","../../../../libs/shared-components/src/lib/shared-components.module.ts","../../../../libs/shared-components/src/shared-components.ts"],"sourcesContent":["import { Component, Input, OnInit } from '@angular/core';\n\nimport { AB_TEST_ACTIONS } from '@posiwise/common-utilities';\nimport { Experiment } from '../ab-test.interface';\nimport { AbTestService } from '@posiwise/common-services';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'pw-ab-test-container',\n template: '<ng-content></ng-content>'\n})\nexport class AbTestContainerComponent implements OnInit {\n @Input()\n experimentName: string;\n\n @Input()\n serviceName: string;\n\n data: Experiment;\n\n /**\n * Specifies boolean to show the experiment as fallback\n */\n showDefaultExperiment = false;\n\n constructor(private service: AbTestService) {}\n\n ngOnInit(): void {\n this.getExperiment();\n }\n\n private getExperiment() {\n this.service\n .getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceName)\n .subscribe({\n next: (response: Experiment) => {\n this.showDefaultExperiment = false;\n this.data = response || ({} as Experiment);\n },\n error: () => {\n // in case the api for experiment fails, we show the default experiment\n this.showDefaultExperiment = true;\n }\n });\n }\n}\n","import { Component, Input } from '@angular/core';\n\nimport { AbTestContainerComponent } from '../ab-test-container/ab-test-container.component';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'ab-alternative',\n templateUrl: './ab-alternative.component.html'\n})\nexport class AbAlternativeComponent {\n @Input()\n name: string;\n\n /**\n * Specficies AbTestContainerComponent instance template reference\n */\n @Input()\n ref: AbTestContainerComponent;\n\n /**\n * If the getExperiment call fails, it can be set to show the experiment\n * as fallback\n */\n @Input()\n default = false;\n}\n","<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport {AbTestContainerComponent} from \"./ab-test/ab-test-container/ab-test-container.component\";\nimport {AbAlternativeComponent} from \"./ab-test/ab-alternative/ab-alternative.component\";\n\n@NgModule({\n declarations: [\n AbTestContainerComponent,\n AbAlternativeComponent\n ],\n imports: [\n ],\n exports: []\n})\nexport class SharedComponentsModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAWa,wBAAwB,CAAA;AAcjC,IAAA,WAAA,CAAoB,OAAsB,EAAA;AAAtB,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAe;AAL1C;;AAEG;AACH,QAAA,IAAqB,CAAA,qBAAA,GAAG,KAAK,CAAC;KAEgB;IAE9C,QAAQ,GAAA;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;KACxB;IAEO,aAAa,GAAA;AACjB,QAAA,IAAI,CAAC,OAAO;AACP,aAAA,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC;AAC3E,aAAA,SAAS,CAAC;AACP,YAAA,IAAI,EAAE,CAAC,QAAoB,KAAI;AAC3B,gBAAA,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;AACnC,gBAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,IAAK,EAAiB,CAAC;aAC9C;YACD,KAAK,EAAE,MAAK;;AAER,gBAAA,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;aACrC;AACJ,SAAA,CAAC,CAAC;KACV;;qHAjCQ,wBAAwB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,aAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA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EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,iBAP/B,wBAAwB;QACxB,sBAAsB,CAAA,EAAA,CAAA,CAAA;oHAMb,sBAAsB,EAAA,CAAA,CAAA;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBATlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,wBAAwB;wBACxB,sBAAsB;AACvB,qBAAA;AACD,oBAAA,OAAO,EAAE,EACR;AACD,oBAAA,OAAO,EAAE,EAAE;iBACZ,CAAA;;;ACZD;;AAEG;;;;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, Input, NgModule } from '@angular/core';
|
|
3
|
+
import { AB_TEST_ACTIONS } from '@posiwise/common-utilities';
|
|
4
|
+
import * as i1 from '@posiwise/common-services';
|
|
5
|
+
|
|
6
|
+
class AbTestContainerComponent {
|
|
7
|
+
constructor(service) {
|
|
8
|
+
this.service = service;
|
|
9
|
+
/**
|
|
10
|
+
* Specifies boolean to show the experiment as fallback
|
|
11
|
+
*/
|
|
12
|
+
this.showDefaultExperiment = false;
|
|
13
|
+
}
|
|
14
|
+
ngOnInit() {
|
|
15
|
+
this.getExperiment();
|
|
16
|
+
}
|
|
17
|
+
getExperiment() {
|
|
18
|
+
this.service
|
|
19
|
+
.getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceName)
|
|
20
|
+
.subscribe({
|
|
21
|
+
next: (response) => {
|
|
22
|
+
this.showDefaultExperiment = false;
|
|
23
|
+
this.data = response || {};
|
|
24
|
+
},
|
|
25
|
+
error: () => {
|
|
26
|
+
// in case the api for experiment fails, we show the default experiment
|
|
27
|
+
this.showDefaultExperiment = true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
AbTestContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbTestContainerComponent, deps: [{ token: i1.AbTestService }], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
+
AbTestContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AbTestContainerComponent, selector: "pw-ab-test-container", inputs: { experimentName: "experimentName", serviceName: "serviceName" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbTestContainerComponent, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{
|
|
37
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
38
|
+
selector: 'pw-ab-test-container',
|
|
39
|
+
template: '<ng-content></ng-content>'
|
|
40
|
+
}]
|
|
41
|
+
}], ctorParameters: function () { return [{ type: i1.AbTestService }]; }, propDecorators: { experimentName: [{
|
|
42
|
+
type: Input
|
|
43
|
+
}], serviceName: [{
|
|
44
|
+
type: Input
|
|
45
|
+
}] } });
|
|
46
|
+
|
|
47
|
+
class AbAlternativeComponent {
|
|
48
|
+
constructor() {
|
|
49
|
+
/**
|
|
50
|
+
* If the getExperiment call fails, it can be set to show the experiment
|
|
51
|
+
* as fallback
|
|
52
|
+
*/
|
|
53
|
+
this.default = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
AbAlternativeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbAlternativeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
57
|
+
AbAlternativeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AbAlternativeComponent, selector: "ab-alternative", inputs: { name: "name", ref: "ref", default: "default" }, ngImport: i0, template: "<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n" });
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AbAlternativeComponent, decorators: [{
|
|
59
|
+
type: Component,
|
|
60
|
+
args: [{ selector: 'ab-alternative', template: "<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n" }]
|
|
61
|
+
}], propDecorators: { name: [{
|
|
62
|
+
type: Input
|
|
63
|
+
}], ref: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], default: [{
|
|
66
|
+
type: Input
|
|
67
|
+
}] } });
|
|
68
|
+
|
|
69
|
+
class SharedComponentsModule {
|
|
70
|
+
}
|
|
71
|
+
SharedComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
72
|
+
SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, declarations: [AbTestContainerComponent,
|
|
73
|
+
AbAlternativeComponent] });
|
|
74
|
+
SharedComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule });
|
|
75
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, decorators: [{
|
|
76
|
+
type: NgModule,
|
|
77
|
+
args: [{
|
|
78
|
+
declarations: [
|
|
79
|
+
AbTestContainerComponent,
|
|
80
|
+
AbAlternativeComponent
|
|
81
|
+
],
|
|
82
|
+
imports: [],
|
|
83
|
+
exports: []
|
|
84
|
+
}]
|
|
85
|
+
}] });
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Generated bundle index. Do not edit.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
export { SharedComponentsModule };
|
|
92
|
+
//# sourceMappingURL=shared-components.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-components.mjs","sources":["../../../../libs/shared-components/src/lib/ab-test/ab-test-container/ab-test-container.component.ts","../../../../libs/shared-components/src/lib/ab-test/ab-alternative/ab-alternative.component.ts","../../../../libs/shared-components/src/lib/ab-test/ab-alternative/ab-alternative.component.html","../../../../libs/shared-components/src/lib/shared-components.module.ts","../../../../libs/shared-components/src/shared-components.ts"],"sourcesContent":["import { Component, Input, OnInit } from '@angular/core';\n\nimport { AB_TEST_ACTIONS } from '@posiwise/common-utilities';\nimport { Experiment } from '../ab-test.interface';\nimport { AbTestService } from '@posiwise/common-services';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'pw-ab-test-container',\n template: '<ng-content></ng-content>'\n})\nexport class AbTestContainerComponent implements OnInit {\n @Input()\n experimentName: string;\n\n @Input()\n serviceName: string;\n\n data: Experiment;\n\n /**\n * Specifies boolean to show the experiment as fallback\n */\n showDefaultExperiment = false;\n\n constructor(private service: AbTestService) {}\n\n ngOnInit(): void {\n this.getExperiment();\n }\n\n private getExperiment() {\n this.service\n .getExperiment(this.experimentName, AB_TEST_ACTIONS.START, this.serviceName)\n .subscribe({\n next: (response: Experiment) => {\n this.showDefaultExperiment = false;\n this.data = response || ({} as Experiment);\n },\n error: () => {\n // in case the api for experiment fails, we show the default experiment\n this.showDefaultExperiment = true;\n }\n });\n }\n}\n","import { Component, Input } from '@angular/core';\n\nimport { AbTestContainerComponent } from '../ab-test-container/ab-test-container.component';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'ab-alternative',\n templateUrl: './ab-alternative.component.html'\n})\nexport class AbAlternativeComponent {\n @Input()\n name: string;\n\n /**\n * Specficies AbTestContainerComponent instance template reference\n */\n @Input()\n ref: AbTestContainerComponent;\n\n /**\n * If the getExperiment call fails, it can be set to show the experiment\n * as fallback\n */\n @Input()\n default = false;\n}\n","<!-- renders the template for the started experiment.\nin case of error, render the template marked as default=true -->\n<ng-template [ngIf]=\"\n ref?.data?.alternative === name || (default === true && ref.showDefaultExperiment === true)\n \">\n <ng-content></ng-content>\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport {AbTestContainerComponent} from \"./ab-test/ab-test-container/ab-test-container.component\";\nimport {AbAlternativeComponent} from \"./ab-test/ab-alternative/ab-alternative.component\";\n\n@NgModule({\n declarations: [\n AbTestContainerComponent,\n AbAlternativeComponent\n ],\n imports: [\n ],\n exports: []\n})\nexport class SharedComponentsModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAWa,wBAAwB,CAAA;AAcjC,IAAA,WAAA,CAAoB,OAAsB,EAAA;QAAtB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAe;AAL1C;;AAEG;QACH,IAAqB,CAAA,qBAAA,GAAG,KAAK,CAAC;KAEgB;IAE9C,QAAQ,GAAA;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;KACxB;IAEO,aAAa,GAAA;AACjB,QAAA,IAAI,CAAC,OAAO;AACP,aAAA,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC;AAC3E,aAAA,SAAS,CAAC;AACP,YAAA,IAAI,EAAE,CAAC,QAAoB,KAAI;AAC3B,gBAAA,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;AACnC,gBAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,IAAK,EAAiB,CAAC;aAC9C;YACD,KAAK,EAAE,MAAK;;AAER,gBAAA,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;aACrC;AACJ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;MEVG,sBAAsB,CAAA;;mHAAtB,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAtB,sBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,iBAP/B,wBAAwB;QACxB,sBAAsB,CAAA,EAAA,CAAA,CAAA;oHAMb,sBAAsB,EAAA,CAAA,CAAA;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBATlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,wBAAwB;wBACxB,sBAAsB;AACvB,qBAAA;AACD,oBAAA,OAAO,EAAE,EACR;AACD,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA,CAAA;;;ACZD;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/shared-components.module';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbTestContainerComponent } from '../ab-test-container/ab-test-container.component';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class AbAlternativeComponent {
|
|
4
|
+
name: string;
|
|
5
|
+
/**
|
|
6
|
+
* Specficies AbTestContainerComponent instance template reference
|
|
7
|
+
*/
|
|
8
|
+
ref: AbTestContainerComponent;
|
|
9
|
+
/**
|
|
10
|
+
* If the getExperiment call fails, it can be set to show the experiment
|
|
11
|
+
* as fallback
|
|
12
|
+
*/
|
|
13
|
+
default: boolean;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AbAlternativeComponent, never>;
|
|
15
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AbAlternativeComponent, "ab-alternative", never, { "name": "name"; "ref": "ref"; "default": "default"; }, {}, never, ["*"], false, never>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { Experiment } from '../ab-test.interface';
|
|
3
|
+
import { AbTestService } from '@posiwise/common-services';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class AbTestContainerComponent implements OnInit {
|
|
6
|
+
private service;
|
|
7
|
+
experimentName: string;
|
|
8
|
+
serviceName: string;
|
|
9
|
+
data: Experiment;
|
|
10
|
+
/**
|
|
11
|
+
* Specifies boolean to show the experiment as fallback
|
|
12
|
+
*/
|
|
13
|
+
showDefaultExperiment: boolean;
|
|
14
|
+
constructor(service: AbTestService);
|
|
15
|
+
ngOnInit(): void;
|
|
16
|
+
private getExperiment;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AbTestContainerComponent, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AbTestContainerComponent, "pw-ab-test-container", never, { "experimentName": "experimentName"; "serviceName": "serviceName"; }, {}, never, ["*"], false, never>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ab-test/ab-test-container/ab-test-container.component";
|
|
3
|
+
import * as i2 from "./ab-test/ab-alternative/ab-alternative.component";
|
|
4
|
+
export declare class SharedComponentsModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharedComponentsModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SharedComponentsModule, [typeof i1.AbTestContainerComponent, typeof i2.AbAlternativeComponent], never, never>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<SharedComponentsModule>;
|
|
8
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@posiwise/shared-components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "15.2.5",
|
|
6
|
+
"@angular/core": "15.2.5",
|
|
7
|
+
"@posiwise/common-services": "^0.0.45"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.3.0"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"module": "fesm2015/shared-components.mjs",
|
|
14
|
+
"es2020": "fesm2020/shared-components.mjs",
|
|
15
|
+
"esm2020": "esm2020/shared-components.mjs",
|
|
16
|
+
"fesm2020": "fesm2020/shared-components.mjs",
|
|
17
|
+
"fesm2015": "fesm2015/shared-components.mjs",
|
|
18
|
+
"typings": "index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": {
|
|
21
|
+
"default": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
|
+
"esm2020": "./esm2020/shared-components.mjs",
|
|
26
|
+
"es2020": "./fesm2020/shared-components.mjs",
|
|
27
|
+
"es2015": "./fesm2015/shared-components.mjs",
|
|
28
|
+
"node": "./fesm2015/shared-components.mjs",
|
|
29
|
+
"default": "./fesm2020/shared-components.mjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"description": "This library was generated with [Nx](https://nx.dev).",
|
|
33
|
+
"main": "index.js",
|
|
34
|
+
"directories": {
|
|
35
|
+
"lib": "lib"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
39
|
+
},
|
|
40
|
+
"author": "",
|
|
41
|
+
"license": "ISC"
|
|
42
|
+
}
|