@posiwise/shared-components 0.0.1 → 0.0.3
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/esm2020/index.mjs +3 -1
- package/esm2020/lib/shared-components.module.mjs +6 -10
- package/fesm2015/shared-components.mjs +4 -8
- package/fesm2015/shared-components.mjs.map +1 -1
- package/fesm2020/shared-components.mjs +4 -8
- package/fesm2020/shared-components.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/lib/shared-components.module.d.ts +1 -1
- package/package.json +2 -2
package/esm2020/index.mjs
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export * from './lib/shared-components.module';
|
|
2
|
-
|
|
2
|
+
export * from './lib/ab-test/ab-test-container/ab-test-container.component';
|
|
3
|
+
export * from './lib/ab-test/ab-alternative/ab-alternative.component';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL3NoYXJlZC1jb21wb25lbnRzL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGdDQUFnQyxDQUFDO0FBQy9DLGNBQWMsNkRBQTZELENBQUM7QUFDNUUsY0FBYyx1REFBdUQsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliL3NoYXJlZC1jb21wb25lbnRzLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9hYi10ZXN0L2FiLXRlc3QtY29udGFpbmVyL2FiLXRlc3QtY29udGFpbmVyLmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9hYi10ZXN0L2FiLWFsdGVybmF0aXZlL2FiLWFsdGVybmF0aXZlLmNvbXBvbmVudCc7XG4iXX0=
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
-
import { AbTestContainerComponent } from
|
|
3
|
-
import { AbAlternativeComponent } from
|
|
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
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export class SharedComponentsModule {
|
|
6
6
|
}
|
|
7
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] });
|
|
8
|
+
SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, declarations: [AbTestContainerComponent, AbAlternativeComponent], exports: [AbTestContainerComponent, AbAlternativeComponent] });
|
|
10
9
|
SharedComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule });
|
|
11
10
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, decorators: [{
|
|
12
11
|
type: NgModule,
|
|
13
12
|
args: [{
|
|
14
|
-
declarations: [
|
|
15
|
-
AbTestContainerComponent,
|
|
16
|
-
AbAlternativeComponent
|
|
17
|
-
],
|
|
13
|
+
declarations: [AbTestContainerComponent, AbAlternativeComponent],
|
|
18
14
|
imports: [],
|
|
19
|
-
exports: []
|
|
15
|
+
exports: [AbTestContainerComponent, AbAlternativeComponent]
|
|
20
16
|
}]
|
|
21
17
|
}] });
|
|
22
|
-
//# sour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aXZlQ29tcG9uZW50IH0gZnJvbSAnLi9hYi10ZXN0L2FiLWFsdGVybmF0aXZlL2FiLWFsdGVybmF0aXZlLmNvbXBvbmVudCc7XG5cbkBOZ01vZHVsZSh7XG4gICAgZGVjbGFyYXRpb25zOiBbQWJUZXN0Q29udGFpbmVyQ29tcG9uZW50LCBBYkFsdGVybmF0aXZlQ29tcG9uZW50XSxcbiAgICBpbXBvcnRzOiBbXSxcbiAgICBleHBvcnRzOiBbQWJUZXN0Q29udGFpbmVyQ29tcG9uZW50LCBBYkFsdGVybmF0aXZlQ29tcG9uZW50XVxufSlcbmV4cG9ydCBjbGFzcyBTaGFyZWRDb21wb25lbnRzTW9kdWxlIHt9XG4iXX0=
|
|
@@ -69,18 +69,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
69
69
|
class SharedComponentsModule {
|
|
70
70
|
}
|
|
71
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] });
|
|
72
|
+
SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, declarations: [AbTestContainerComponent, AbAlternativeComponent], exports: [AbTestContainerComponent, AbAlternativeComponent] });
|
|
74
73
|
SharedComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule });
|
|
75
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, decorators: [{
|
|
76
75
|
type: NgModule,
|
|
77
76
|
args: [{
|
|
78
|
-
declarations: [
|
|
79
|
-
AbTestContainerComponent,
|
|
80
|
-
AbAlternativeComponent
|
|
81
|
-
],
|
|
77
|
+
declarations: [AbTestContainerComponent, AbAlternativeComponent],
|
|
82
78
|
imports: [],
|
|
83
|
-
exports: []
|
|
79
|
+
exports: [AbTestContainerComponent, AbAlternativeComponent]
|
|
84
80
|
}]
|
|
85
81
|
}] });
|
|
86
82
|
|
|
@@ -88,5 +84,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
88
84
|
* Generated bundle index. Do not edit.
|
|
89
85
|
*/
|
|
90
86
|
|
|
91
|
-
export { SharedComponentsModule };
|
|
87
|
+
export { AbAlternativeComponent, AbTestContainerComponent, SharedComponentsModule };
|
|
92
88
|
//# sourceMappingURL=shared-components.mjs.map
|
|
@@ -1 +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
|
|
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: [AbTestContainerComponent, AbAlternativeComponent],\n imports: [],\n exports: [AbTestContainerComponent, AbAlternativeComponent]\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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: "12.0.0", version: "15.2.5", ngImpor
|
|
|
69
69
|
class SharedComponentsModule {
|
|
70
70
|
}
|
|
71
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] });
|
|
72
|
+
SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, declarations: [AbTestContainerComponent, AbAlternativeComponent], exports: [AbTestContainerComponent, AbAlternativeComponent] });
|
|
74
73
|
SharedComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule });
|
|
75
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SharedComponentsModule, decorators: [{
|
|
76
75
|
type: NgModule,
|
|
77
76
|
args: [{
|
|
78
|
-
declarations: [
|
|
79
|
-
AbTestContainerComponent,
|
|
80
|
-
AbAlternativeComponent
|
|
81
|
-
],
|
|
77
|
+
declarations: [AbTestContainerComponent, AbAlternativeComponent],
|
|
82
78
|
imports: [],
|
|
83
|
-
exports: []
|
|
79
|
+
exports: [AbTestContainerComponent, AbAlternativeComponent]
|
|
84
80
|
}]
|
|
85
81
|
}] });
|
|
86
82
|
|
|
@@ -88,5 +84,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
88
84
|
* Generated bundle index. Do not edit.
|
|
89
85
|
*/
|
|
90
86
|
|
|
91
|
-
export { SharedComponentsModule };
|
|
87
|
+
export { AbAlternativeComponent, AbTestContainerComponent, SharedComponentsModule };
|
|
92
88
|
//# sourceMappingURL=shared-components.mjs.map
|
|
@@ -1 +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
|
|
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: [AbTestContainerComponent, AbAlternativeComponent],\n imports: [],\n exports: [AbTestContainerComponent, AbAlternativeComponent]\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,SAAA,CAAC,CAAC;KACV;;q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tB,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,iBAJhB,wBAAwB,EAAE,sBAAsB,CAErD,EAAA,OAAA,EAAA,CAAA,wBAAwB,EAAE,sBAAsB,CAAA,EAAA,CAAA,CAAA;oHAEjD,sBAAsB,EAAA,CAAA,CAAA;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBALlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,YAAY,EAAE,CAAC,wBAAwB,EAAE,sBAAsB,CAAC;AAChE,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,CAAC,wBAAwB,EAAE,sBAAsB,CAAC;AAC9D,iBAAA,CAAA;;;ACRD;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import * as i1 from "./ab-test/ab-test-container/ab-test-container.component";
|
|
|
3
3
|
import * as i2 from "./ab-test/ab-alternative/ab-alternative.component";
|
|
4
4
|
export declare class SharedComponentsModule {
|
|
5
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<SharedComponentsModule, never>;
|
|
6
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<SharedComponentsModule, [typeof i1.AbTestContainerComponent, typeof i2.AbAlternativeComponent], never,
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SharedComponentsModule, [typeof i1.AbTestContainerComponent, typeof i2.AbAlternativeComponent], never, [typeof i1.AbTestContainerComponent, typeof i2.AbAlternativeComponent]>;
|
|
7
7
|
static ɵinj: i0.ɵɵInjectorDeclaration<SharedComponentsModule>;
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posiwise/shared-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "15.2.5",
|
|
6
6
|
"@angular/core": "15.2.5",
|
|
7
|
-
"@posiwise/common-services": "^0.0.
|
|
7
|
+
"@posiwise/common-services": "^0.0.46"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"tslib": "^2.3.0"
|