@dereekb/dbx-core 9.5.3 → 9.6.0
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/auth/router/provider/uirouter/hook.mjs +5 -5
- package/esm2020/lib/router/router/provider/angular/angular.router.service.mjs +4 -1
- package/esm2020/lib/router/router/provider/uirouter/uirouter.router.service.mjs +14 -7
- package/esm2020/lib/router/router/service/router.service.mjs +1 -1
- package/esm2020/lib/router/router/transition/transition.rxjs.mjs +19 -2
- package/fesm2015/dereekb-dbx-core.mjs +38 -12
- package/fesm2015/dereekb-dbx-core.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-core.mjs +38 -12
- package/fesm2020/dereekb-dbx-core.mjs.map +1 -1
- package/lib/auth/router/provider/uirouter/hook.d.ts +5 -1
- package/lib/router/router/provider/angular/angular.router.service.d.ts +1 -0
- package/lib/router/router/provider/uirouter/uirouter.router.service.d.ts +2 -0
- package/lib/router/router/service/router.service.d.ts +6 -0
- package/lib/router/router/transition/transition.rxjs.d.ts +27 -0
- package/package.json +4 -4
|
@@ -5,7 +5,7 @@ import { switchMap, first, BehaviorSubject, combineLatest, distinctUntilChanged,
|
|
|
5
5
|
import * as i1$5 from '@dereekb/rxjs';
|
|
6
6
|
import { SubscriptionObject, LockSet, filterMaybe, LoadingStateType, beginLoading, idleLoadingState, errorResult, successResult, scanCount, combineLatestFromMapValuesObsFn, workFactory, emitDelayObs, asObservable, returnIfIs, timeoutStartWith, skipFirstMaybe, maybeValueFromObservableOrValueGetter, switchMapToDefault, onFalseToTrue, onTrueToFalse, setContainsAllValuesFrom, setContainsNoValueFrom, FilterSourceInstance, FilterSource, FilterSourceConnector, FilterMap } from '@dereekb/rxjs';
|
|
7
7
|
import * as i1$6 from '@dereekb/util';
|
|
8
|
-
import { isDefinedAndNotFalse, hasValueOrNotEmpty, BooleanStringKeyArrayUtilityInstance, reduceBooleansWithOrFn, getValueFromGetter, toReadableError, isGetter, setIncludes, isAllowed, maybeSet, expandTreeFunction, flattenTreeToArrayFunction, expandFlattenTreeFunction, mergeObjects, KeyValueTypleValueFilter, defaultForwardFunctionFactory, mergeArrays, filterMaybeValues, mergeArrayOrValueIntoArray, promiseReference, DataIsExpiredError, DataDoesNotExistError, hasNonNullValue, splitJoinRemainder, StorageObjectUtility, SHARED_MEMORY_STORAGE } from '@dereekb/util';
|
|
8
|
+
import { isDefinedAndNotFalse, hasValueOrNotEmpty, BooleanStringKeyArrayUtilityInstance, reduceBooleansWithOrFn, getValueFromGetter, toReadableError, isGetter, setIncludes, isAllowed, maybeSet, expandTreeFunction, flattenTreeToArrayFunction, expandFlattenTreeFunction, mergeObjects, KeyValueTypleValueFilter, asArray, defaultForwardFunctionFactory, mergeArrays, filterMaybeValues, mergeArrayOrValueIntoArray, promiseReference, DataIsExpiredError, DataDoesNotExistError, hasNonNullValue, splitJoinRemainder, StorageObjectUtility, SHARED_MEMORY_STORAGE } from '@dereekb/util';
|
|
9
9
|
import { ComponentStore } from '@ngrx/component-store';
|
|
10
10
|
import { CommonModule, formatDate } from '@angular/common';
|
|
11
11
|
import * as i1$3 from '@ngrx/effects';
|
|
@@ -1691,7 +1691,7 @@ class DbxAuthService {
|
|
|
1691
1691
|
* This generates a TransitionHookFn that can be used with redirecting routes.
|
|
1692
1692
|
*/
|
|
1693
1693
|
function makeAuthTransitionHook(config) {
|
|
1694
|
-
const { defaultRedirectTarget, errorRedirectTarget = defaultRedirectTarget } = config;
|
|
1694
|
+
const { defaultRedirectTarget, errorRedirectTarget = defaultRedirectTarget, timeoutTime = 1000 } = config;
|
|
1695
1695
|
// https://ui-router.github.io/ng2/docs/latest/modules/transition.html#hookresult
|
|
1696
1696
|
const assertIsAuthenticated = (transition) => {
|
|
1697
1697
|
const injector = transition.injector();
|
|
@@ -1730,8 +1730,8 @@ function makeAuthTransitionHook(config) {
|
|
|
1730
1730
|
return redirectToObs;
|
|
1731
1731
|
}
|
|
1732
1732
|
const resultObs = decisionObs.pipe(
|
|
1733
|
-
// after
|
|
1734
|
-
timeoutStartWith(false,
|
|
1733
|
+
// after the timeoutTime seconds of no transition working, redirect with a false decision
|
|
1734
|
+
timeoutStartWith(false, timeoutTime), first(), switchMap((decision) => {
|
|
1735
1735
|
if (typeof decision === 'boolean') {
|
|
1736
1736
|
if (decision) {
|
|
1737
1737
|
return of(true);
|
|
@@ -1745,7 +1745,7 @@ function makeAuthTransitionHook(config) {
|
|
|
1745
1745
|
return of($state.target(asSegueRefString(segueRef.ref), segueRef.refParams, segueRef.refOptions));
|
|
1746
1746
|
}
|
|
1747
1747
|
}), catchError((x) => {
|
|
1748
|
-
console.warn(
|
|
1748
|
+
console.warn(`Encountered error in auth transition hook. Attempting redirect to ${errorRedirectTarget}.`, x);
|
|
1749
1749
|
return of($state.target(errorRedirectTarget, { location: true })); // Redirect to home
|
|
1750
1750
|
}));
|
|
1751
1751
|
return firstValueFrom(resultObs);
|
|
@@ -2280,6 +2280,9 @@ class DbxAngularRouterService {
|
|
|
2280
2280
|
isActive(segueRef) {
|
|
2281
2281
|
return false; // TODO!
|
|
2282
2282
|
}
|
|
2283
|
+
isActiveExactly(segueRef) {
|
|
2284
|
+
return false; // TODO!
|
|
2285
|
+
}
|
|
2283
2286
|
comparePrecision(a, b) {
|
|
2284
2287
|
return 0; // TODO!
|
|
2285
2288
|
}
|
|
@@ -2399,12 +2402,10 @@ class DbxUIRouterService {
|
|
|
2399
2402
|
return this.go(segueUpdate);
|
|
2400
2403
|
}
|
|
2401
2404
|
isActive(input) {
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
const active = this.state.includes(targetRef, refParams);
|
|
2407
|
-
return active;
|
|
2405
|
+
return this.isActiveState(input, false);
|
|
2406
|
+
}
|
|
2407
|
+
isActiveExactly(input) {
|
|
2408
|
+
return this.isActiveState(input, true);
|
|
2408
2409
|
}
|
|
2409
2410
|
comparePrecision(aInput, bInput) {
|
|
2410
2411
|
const aRef = asSegueRefString(aInput);
|
|
@@ -2413,6 +2414,15 @@ class DbxUIRouterService {
|
|
|
2413
2414
|
const bLength = bRef.length;
|
|
2414
2415
|
return aLength > bLength ? 1 : aLength === bLength ? 0 : -1;
|
|
2415
2416
|
}
|
|
2417
|
+
// MARK: Internal
|
|
2418
|
+
isActiveState(input, exactly) {
|
|
2419
|
+
const segueRef = asSegueRef(input);
|
|
2420
|
+
const ref = segueRef.ref;
|
|
2421
|
+
const refParams = segueRef.refParams;
|
|
2422
|
+
const targetRef = ref.startsWith('.') ? `^${ref}` : ref;
|
|
2423
|
+
const active = exactly ? this.state.is(targetRef, refParams) : this.state.includes(targetRef, refParams);
|
|
2424
|
+
return active;
|
|
2425
|
+
}
|
|
2416
2426
|
}
|
|
2417
2427
|
DbxUIRouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxUIRouterService, deps: [{ token: i1$2.StateService }, { token: i1$2.TransitionService }, { token: i1$2.UIRouterGlobals }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2418
2428
|
DbxUIRouterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxUIRouterService });
|
|
@@ -2461,6 +2471,22 @@ function filterTransitionSuccess() {
|
|
|
2461
2471
|
function filterTransitionEvent(type) {
|
|
2462
2472
|
return filter((x) => x.type === type);
|
|
2463
2473
|
}
|
|
2474
|
+
/**
|
|
2475
|
+
* Creates a new observable that uses the input DbxRouterTransitionService and DbxRouterService to determine whether or not any of the configured routes are active.
|
|
2476
|
+
*
|
|
2477
|
+
* @param obs
|
|
2478
|
+
* @param config
|
|
2479
|
+
* @returns
|
|
2480
|
+
*/
|
|
2481
|
+
function isLatestSuccessfulRoute(config) {
|
|
2482
|
+
const { dbxRouterTransitionService, dbxRouterService, activeExactly } = config;
|
|
2483
|
+
const routes = asArray(config.routes);
|
|
2484
|
+
const checkRoute = activeExactly ? (route) => dbxRouterService.isActiveExactly(route) : (route) => dbxRouterService.isActive(route);
|
|
2485
|
+
return successTransition(dbxRouterTransitionService.transitions$).pipe(startWith(undefined), map(() => {
|
|
2486
|
+
const isActive = routes.findIndex(checkRoute) !== -1;
|
|
2487
|
+
return isActive;
|
|
2488
|
+
}), distinctUntilChanged(), shareReplay(1));
|
|
2489
|
+
}
|
|
2464
2490
|
|
|
2465
2491
|
/**
|
|
2466
2492
|
* Abstract directive that listens to onSuccess transition events and runs a function.
|
|
@@ -4649,5 +4675,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
|
|
|
4649
4675
|
* Generated bundle index. Do not edit.
|
|
4650
4676
|
*/
|
|
4651
4677
|
|
|
4652
|
-
export { APP_ACTION_DISABLED_DIRECTIVE_KEY, APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY, AbstractActionFilterSourceDirective, AbstractDbxActionValueOnTriggerDirective, AbstractDbxAnchorDirective, AbstractDbxButtonDirective, AbstractDbxFilterMapInstanceDirective, AbstractDbxInjectionDirective, AbstractFilterSourceConnectorDirective, AbstractFilterSourceDirective, AbstractForwardDbxInjectionContextDirective, AbstractIfDirective, AbstractLockSetSubscriptionDirective, AbstractSubscriptionDirective, AbstractTransitionDirective, AbstractTransitionWatcherDirective, ActionContextStore, ActionContextStoreSource, ActionContextStoreSourceMap, AnchorType, DBX_APP_APP_CONTEXT_STATE, DBX_APP_AUTH_ROUTER_EFFECTS_TOKEN, DBX_AUTH_APP_CONTEXT_STATE, DBX_INIT_APP_CONTEXT_STATE, DBX_INJECTION_COMPONENT_DATA, DBX_KNOWN_APP_CONTEXT_STATES, DBX_ONBOARDING_APP_CONTEXT_STATE, DBX_PUBLIC_APP_CONTEXT_STATE, DEFAULT_ACTION_DISABLED_KEY, DEFAULT_ACTION_MAP_WORKING_DISABLED_KEY, DEFAULT_STORAGE_ACCESSOR_FACTORY_TOKEN, DEFAULT_STORAGE_OBJECT_TOKEN, DateDistancePipe, DateFormatDistancePipe, DateFromToTimePipe, DbxActionAutoModifyDirective, DbxActionAutoTriggerDirective, DbxActionButtonDirective, DbxActionButtonTriggerDirective, DbxActionContextBaseSource, DbxActionContextLoggerDirective, DbxActionContextMachine, DbxActionContextMapDirective, DbxActionContextMapDirectiveSourceInstance, DbxActionContextStoreSourceInstance, DbxActionDirective, DbxActionDisabledDirective, DbxActionEnforceModifiedDirective, DbxActionFromMapDirective, DbxActionHandlerDirective, DbxActionHasSuccessDirective, DbxActionIsWorkingDirective, DbxActionMapSourceDirective, DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionState, DbxActionSuccessHandlerDirective, DbxActionValueDirective, DbxActionValueOnTriggerInstance, DbxActionValueTriggerDirective, DbxActionWorkInstanceDelegate, DbxAnchor, DbxAngularRouterService, DbxAppAuthRouterEffects, DbxAppAuthRouterModule, DbxAppAuthRouterService, DbxAppAuthRouterStateModule, DbxAppAuthRoutes, DbxAppAuthStateModule, DbxAppAuthStateService, DbxAppContextService, DbxAppContextStateDirective, DbxAppContextStateModule, DbxAuthHasAnyRoleDirective, DbxAuthHasRolesDirective, DbxAuthNotAnyRolesDirective, DbxAuthService, DbxButton, DbxButtonDirective, DbxButtonSegueDirective, DbxCoreActionModule, DbxCoreAngularRouterSegueModule, DbxCoreAuthModule, DbxCoreButtonModule, DbxCoreFilterModule, DbxCoreUIRouterSegueModule, DbxDatePipeModule, DbxFilterMapDirective, DbxFilterMapSourceConnectorDirective, DbxFilterMapSourceDirective, DbxFilterSourceConnectorDirective, DbxFilterSourceDirective, DbxInjectionComponent, DbxInjectionComponentModule, DbxInjectionContext, DbxInjectionContextDirective, DbxInjectionInstance, DbxLoadingButtonDirective, DbxMiscPipeModule, DbxPipesModule, DbxRouteParamDefaultRedirectInstance, DbxRouteParamReaderInstance, DbxRouterService, DbxRouterTransitionEventType, DbxRouterTransitionService, DbxStorageModule, DbxUIRouterService, FullLocalStorageObject, InstantStorageAccessor, LimitedStorageAccessor, LockSetComponentStore, MemoryStorageObject, MinutesStringPipe, NO_AUTH_USER_IDENTIFIER, PrettyJsonPipe, SecondaryActionContextStoreSource, SimpleStorageAccessor, SimpleStorageAccessorFactory, StorageAccessor, StringStorageAccessor, StringifySimpleStorageAccessorConverter, TimeDistanceCountdownPipe, TimeDistancePipe, ToJsDatePipe, ToMinutesPipe, WrapperSimpleStorageAccessorDelegate, actionContextHasNoErrorAndIsModifiedAndCanTrigger, actionContextIsModifiedAndCanTrigger, actionContextStoreSourceInstanceFactory, actionContextStoreSourcePipe, anchorTypeForAnchor, asSegueRef, asSegueRefString, authRolesSetContainsAllRolesFrom, authRolesSetContainsAnyRoleFrom, authRolesSetContainsNoRolesFrom, authUserIdentifier, canReadyValue, canTriggerAction, canTriggerActionState, checkNgContentWrapperHasContent, dbxActionValueStreamDirective, defaultStorageObjectFactory, enableHasAuthRoleHook, enableHasAuthStateHook, enableIsLoggedInHook, expandClickableAnchorLinkTree, expandClickableAnchorLinkTreeNode, expandClickableAnchorLinkTrees, filterTransitionEvent, filterTransitionSuccess, flattenExpandedClickableAnchorLinkTree, flattenExpandedClickableAnchorLinkTreeToLinks, index as fromDbxAppAuth, index$2 as fromDbxAppContext, goWithRouter, isActionContextDisabled, isActionContextEnabled, isDisabledActionContextState, isIdleActionState, isSegueRef, isWorkingActionState, loadingStateForActionContextState, loadingStateTypeForActionContextState, loadingStateTypeForActionState, loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, makeAuthTransitionHook, makeDbxActionContextSourceReference, mapRefStringObsToSegueRefObs, mergeDbxInjectionComponentConfigs, index$1 as onDbxAppAuth, index$3 as onDbxAppContext, pipeActionStore, provideActionStoreSource, provideDbxAnchor, provideDbxButton, provideDbxInjectionContext, provideFilterSource, provideFilterSourceConnector, provideSecondaryActionStoreSource, redirectBasedOnAuthUserState, refStringToSegueRef, safeDetectChanges, safeMarkForCheck, safeUseCdRef, successTransition, tapDetectChanges, useActionStore };
|
|
4678
|
+
export { APP_ACTION_DISABLED_DIRECTIVE_KEY, APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY, AbstractActionFilterSourceDirective, AbstractDbxActionValueOnTriggerDirective, AbstractDbxAnchorDirective, AbstractDbxButtonDirective, AbstractDbxFilterMapInstanceDirective, AbstractDbxInjectionDirective, AbstractFilterSourceConnectorDirective, AbstractFilterSourceDirective, AbstractForwardDbxInjectionContextDirective, AbstractIfDirective, AbstractLockSetSubscriptionDirective, AbstractSubscriptionDirective, AbstractTransitionDirective, AbstractTransitionWatcherDirective, ActionContextStore, ActionContextStoreSource, ActionContextStoreSourceMap, AnchorType, DBX_APP_APP_CONTEXT_STATE, DBX_APP_AUTH_ROUTER_EFFECTS_TOKEN, DBX_AUTH_APP_CONTEXT_STATE, DBX_INIT_APP_CONTEXT_STATE, DBX_INJECTION_COMPONENT_DATA, DBX_KNOWN_APP_CONTEXT_STATES, DBX_ONBOARDING_APP_CONTEXT_STATE, DBX_PUBLIC_APP_CONTEXT_STATE, DEFAULT_ACTION_DISABLED_KEY, DEFAULT_ACTION_MAP_WORKING_DISABLED_KEY, DEFAULT_STORAGE_ACCESSOR_FACTORY_TOKEN, DEFAULT_STORAGE_OBJECT_TOKEN, DateDistancePipe, DateFormatDistancePipe, DateFromToTimePipe, DbxActionAutoModifyDirective, DbxActionAutoTriggerDirective, DbxActionButtonDirective, DbxActionButtonTriggerDirective, DbxActionContextBaseSource, DbxActionContextLoggerDirective, DbxActionContextMachine, DbxActionContextMapDirective, DbxActionContextMapDirectiveSourceInstance, DbxActionContextStoreSourceInstance, DbxActionDirective, DbxActionDisabledDirective, DbxActionEnforceModifiedDirective, DbxActionFromMapDirective, DbxActionHandlerDirective, DbxActionHasSuccessDirective, DbxActionIsWorkingDirective, DbxActionMapSourceDirective, DbxActionMapWorkingDisableDirective, DbxActionSourceDirective, DbxActionState, DbxActionSuccessHandlerDirective, DbxActionValueDirective, DbxActionValueOnTriggerInstance, DbxActionValueTriggerDirective, DbxActionWorkInstanceDelegate, DbxAnchor, DbxAngularRouterService, DbxAppAuthRouterEffects, DbxAppAuthRouterModule, DbxAppAuthRouterService, DbxAppAuthRouterStateModule, DbxAppAuthRoutes, DbxAppAuthStateModule, DbxAppAuthStateService, DbxAppContextService, DbxAppContextStateDirective, DbxAppContextStateModule, DbxAuthHasAnyRoleDirective, DbxAuthHasRolesDirective, DbxAuthNotAnyRolesDirective, DbxAuthService, DbxButton, DbxButtonDirective, DbxButtonSegueDirective, DbxCoreActionModule, DbxCoreAngularRouterSegueModule, DbxCoreAuthModule, DbxCoreButtonModule, DbxCoreFilterModule, DbxCoreUIRouterSegueModule, DbxDatePipeModule, DbxFilterMapDirective, DbxFilterMapSourceConnectorDirective, DbxFilterMapSourceDirective, DbxFilterSourceConnectorDirective, DbxFilterSourceDirective, DbxInjectionComponent, DbxInjectionComponentModule, DbxInjectionContext, DbxInjectionContextDirective, DbxInjectionInstance, DbxLoadingButtonDirective, DbxMiscPipeModule, DbxPipesModule, DbxRouteParamDefaultRedirectInstance, DbxRouteParamReaderInstance, DbxRouterService, DbxRouterTransitionEventType, DbxRouterTransitionService, DbxStorageModule, DbxUIRouterService, FullLocalStorageObject, InstantStorageAccessor, LimitedStorageAccessor, LockSetComponentStore, MemoryStorageObject, MinutesStringPipe, NO_AUTH_USER_IDENTIFIER, PrettyJsonPipe, SecondaryActionContextStoreSource, SimpleStorageAccessor, SimpleStorageAccessorFactory, StorageAccessor, StringStorageAccessor, StringifySimpleStorageAccessorConverter, TimeDistanceCountdownPipe, TimeDistancePipe, ToJsDatePipe, ToMinutesPipe, WrapperSimpleStorageAccessorDelegate, actionContextHasNoErrorAndIsModifiedAndCanTrigger, actionContextIsModifiedAndCanTrigger, actionContextStoreSourceInstanceFactory, actionContextStoreSourcePipe, anchorTypeForAnchor, asSegueRef, asSegueRefString, authRolesSetContainsAllRolesFrom, authRolesSetContainsAnyRoleFrom, authRolesSetContainsNoRolesFrom, authUserIdentifier, canReadyValue, canTriggerAction, canTriggerActionState, checkNgContentWrapperHasContent, dbxActionValueStreamDirective, defaultStorageObjectFactory, enableHasAuthRoleHook, enableHasAuthStateHook, enableIsLoggedInHook, expandClickableAnchorLinkTree, expandClickableAnchorLinkTreeNode, expandClickableAnchorLinkTrees, filterTransitionEvent, filterTransitionSuccess, flattenExpandedClickableAnchorLinkTree, flattenExpandedClickableAnchorLinkTreeToLinks, index as fromDbxAppAuth, index$2 as fromDbxAppContext, goWithRouter, isActionContextDisabled, isActionContextEnabled, isDisabledActionContextState, isIdleActionState, isLatestSuccessfulRoute, isSegueRef, isWorkingActionState, loadingStateForActionContextState, loadingStateTypeForActionContextState, loadingStateTypeForActionState, loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, makeAuthTransitionHook, makeDbxActionContextSourceReference, mapRefStringObsToSegueRefObs, mergeDbxInjectionComponentConfigs, index$1 as onDbxAppAuth, index$3 as onDbxAppContext, pipeActionStore, provideActionStoreSource, provideDbxAnchor, provideDbxButton, provideDbxInjectionContext, provideFilterSource, provideFilterSourceConnector, provideSecondaryActionStoreSource, redirectBasedOnAuthUserState, refStringToSegueRef, safeDetectChanges, safeMarkForCheck, safeUseCdRef, successTransition, tapDetectChanges, useActionStore };
|
|
4653
4679
|
//# sourceMappingURL=dereekb-dbx-core.mjs.map
|