monkey-front-core 0.0.79 → 0.0.80
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/lib/core/services/config/monkeyecx-feature-toggle.service.mjs +4 -28
- package/fesm2015/monkey-front-core.mjs +3 -27
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +3 -27
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/services/config/monkeyecx-feature-toggle.service.d.ts +0 -1
- package/monkey-front-core-0.0.80.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.79.tgz +0 -0
|
@@ -2471,75 +2471,51 @@ class MonkeyEcxFeatureToggleService {
|
|
|
2471
2471
|
this.flagSubject$ = new BehaviorSubject(null);
|
|
2472
2472
|
this.flags = undefined;
|
|
2473
2473
|
this.ldClient = undefined;
|
|
2474
|
-
this.self = this;
|
|
2475
2474
|
// not to do
|
|
2476
2475
|
}
|
|
2477
|
-
getAllFlags(
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
console.log(this);
|
|
2481
|
-
console.log(self);
|
|
2482
|
-
console.log('!!!!!');
|
|
2476
|
+
getAllFlags() {
|
|
2477
|
+
if (!this)
|
|
2478
|
+
return;
|
|
2483
2479
|
this.flags = this.ldClient?.allFlags();
|
|
2484
|
-
console.log('11');
|
|
2485
2480
|
this.flagSubject$.next(true);
|
|
2486
|
-
console.log('12');
|
|
2487
2481
|
}
|
|
2488
2482
|
identify(config, environment) {
|
|
2489
|
-
console.log('1');
|
|
2490
|
-
console.log(this);
|
|
2491
2483
|
if (config) {
|
|
2492
|
-
console.log('2');
|
|
2493
2484
|
const email = 'monkey@monkey.exchange';
|
|
2494
|
-
console.log('3');
|
|
2495
2485
|
const user = {
|
|
2496
2486
|
email,
|
|
2497
2487
|
key: `${config.program?.token}#${email}`,
|
|
2498
2488
|
};
|
|
2499
|
-
console.log('4');
|
|
2500
2489
|
if (!this.ldClient) {
|
|
2501
|
-
console.log('5');
|
|
2502
2490
|
this.ldClient = initialize(environment.launchDarklyClientSideID, user, {
|
|
2503
2491
|
streaming: true,
|
|
2504
2492
|
disableSyncEventPost: true,
|
|
2505
2493
|
sendEvents: false,
|
|
2506
2494
|
diagnosticOptOut: true,
|
|
2507
2495
|
});
|
|
2508
|
-
console.log('6');
|
|
2509
2496
|
this.ldClient.on('change', this.getAllFlags.bind(this, 'change'));
|
|
2510
|
-
console.log('7');
|
|
2511
2497
|
this.ldClient.on('ready', this.getAllFlags.bind(this, 'ready'));
|
|
2512
|
-
console.log('8');
|
|
2513
2498
|
}
|
|
2514
2499
|
else {
|
|
2515
|
-
console.log('9');
|
|
2516
2500
|
this.ldClient.identify(user, undefined, this.getAllFlags);
|
|
2517
2501
|
}
|
|
2518
|
-
console.log(this);
|
|
2519
2502
|
}
|
|
2520
2503
|
}
|
|
2521
2504
|
apply(configSubject$, environment) {
|
|
2522
|
-
console.log('13');
|
|
2523
2505
|
if (environment.launchDarklyClientSideID) {
|
|
2524
|
-
console.log('14');
|
|
2525
2506
|
configSubject$.subscribe((config) => {
|
|
2526
|
-
console.log('15');
|
|
2527
2507
|
this.identify(config, environment);
|
|
2528
2508
|
});
|
|
2529
2509
|
}
|
|
2530
2510
|
else {
|
|
2531
|
-
console.log('16');
|
|
2532
2511
|
this.flagSubject$.next(true);
|
|
2533
2512
|
}
|
|
2534
2513
|
}
|
|
2535
2514
|
get onFlags() {
|
|
2536
|
-
console.log('17');
|
|
2537
2515
|
return this.flagSubject$.asObservable();
|
|
2538
2516
|
}
|
|
2539
2517
|
getFlag(flag) {
|
|
2540
|
-
console.log('18');
|
|
2541
2518
|
const flagValue = this.flags?.[flag];
|
|
2542
|
-
console.log('19');
|
|
2543
2519
|
return MonkeyUtils.persistNullEmptyUndefined(flagValue) ? flagValue : null;
|
|
2544
2520
|
}
|
|
2545
2521
|
}
|