@coolon/angular-ui-powerups 0.0.91 → 0.0.93

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.
Files changed (62) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +2104 -1817
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.d.ts +23 -19
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +23 -19
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/interaction/services/dialog-interaction.service.js +3 -3
  10. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +52 -10
  11. package/esm2015/lib/place/guards/abstract-enter-place.guard.js +296 -0
  12. package/esm2015/lib/place/guards/leave-place.guard.js +47 -0
  13. package/esm2015/lib/place/guards/noop-auth-guard.service.js +30 -0
  14. package/esm2015/lib/place/index.js +5 -3
  15. package/esm2015/lib/place/navigation-session.js +7 -18
  16. package/esm2015/lib/place/place-router.js +60 -9
  17. package/esm2015/lib/place/place.decorator.js +1 -1
  18. package/esm2015/lib/place/place.module.js +4 -2
  19. package/esm2015/lib/place/places/noop-gateway-place.component.js +58 -0
  20. package/esm2015/public_api.js +2 -2
  21. package/esm5/coolon-angular-ui-powerups.js +23 -19
  22. package/esm5/index.js +2 -2
  23. package/esm5/lib/interaction/services/dialog-interaction.service.js +3 -3
  24. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +52 -10
  25. package/esm5/lib/place/guards/abstract-enter-place.guard.js +372 -0
  26. package/esm5/lib/place/guards/leave-place.guard.js +55 -0
  27. package/esm5/lib/place/guards/noop-auth-guard.service.js +39 -0
  28. package/esm5/lib/place/index.js +5 -3
  29. package/esm5/lib/place/navigation-session.js +6 -17
  30. package/esm5/lib/place/place-router.js +74 -8
  31. package/esm5/lib/place/place.decorator.js +1 -1
  32. package/esm5/lib/place/place.module.js +4 -2
  33. package/esm5/lib/place/places/noop-gateway-place.component.js +61 -0
  34. package/esm5/public_api.js +2 -2
  35. package/fesm2015/coolon-angular-ui-powerups.js +568 -355
  36. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  37. package/fesm5/coolon-angular-ui-powerups.js +2048 -1766
  38. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  39. package/lib/place/components/place-outlet/place-outlet.component.d.ts +6 -2
  40. package/lib/place/{route/guards/enter-place-guard.service.d.ts → guards/abstract-enter-place.guard.d.ts} +9 -4
  41. package/lib/place/{route/guards → guards}/leave-place.guard.d.ts +2 -2
  42. package/lib/place/guards/noop-auth-guard.service.d.ts +5 -0
  43. package/lib/place/index.d.ts +4 -2
  44. package/lib/place/navigation-session.d.ts +2 -2
  45. package/lib/place/place-router.d.ts +8 -2
  46. package/lib/place/places/noop-gateway-place.component.d.ts +10 -0
  47. package/package.json +1 -1
  48. package/schematics/place-routes/place-builder.d.ts +2 -1
  49. package/schematics/place-routes/place-builder.js +11 -3
  50. package/schematics/place-routes/place-builder.js.map +1 -1
  51. package/schematics/place-routes/place-class-scanner.js +1 -0
  52. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  53. package/schematics/place-routes/place-def.d.ts +0 -1
  54. package/schematics/place-routes/place-def.js +1 -14
  55. package/schematics/place-routes/place-def.js.map +1 -1
  56. package/schematics/place-routes/templates/place-destinations.ts.template +3 -2
  57. package/schematics/place-routes/templates/place-routes.ts.template +20 -4
  58. package/schematics/place-routes/templates/place-visits.ts.template +2 -1
  59. package/esm2015/lib/place/route/guards/enter-place-guard.service.js +0 -248
  60. package/esm2015/lib/place/route/guards/leave-place.guard.js +0 -47
  61. package/esm5/lib/place/route/guards/enter-place-guard.service.js +0 -278
  62. package/esm5/lib/place/route/guards/leave-place.guard.js +0 -55
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
4
4
  import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule } from '@angular/material';
5
5
  import { MatTabsModule } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, Command, StoreInValueModel, OptionsHelper, ValueHolder } from '@coolon/pectin';
7
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
8
  import { __decorate, __metadata, __awaiter } from 'tslib';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, UrlSerializer, UrlSegment, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
@@ -19,6 +19,7 @@ import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
19
19
  import 'reflect-metadata';
20
20
  import { style, query, group, animate, trigger, transition } from '@angular/animations';
21
21
  import ResizeObserver from 'resize-observer-polyfill';
22
+ import { Observable } from 'rxjs';
22
23
 
23
24
  /**
24
25
  * @fileoverview added by tsickle
@@ -1891,7 +1892,7 @@ class DialogInteractionService extends InteractionContext {
1891
1892
  * @return {?}
1892
1893
  */
1893
1894
  () => {
1894
- console.log('###### STARTING');
1895
+ // console.log('###### STARTING');
1895
1896
  this._inActivityPromise.value = true;
1896
1897
  // this.currentActivityId = uuid.v1();
1897
1898
  // this.location.go(this.router.routerState.snapshot.url, "aup");
@@ -1952,7 +1953,7 @@ class DialogInteractionService extends InteractionContext {
1952
1953
  */
1953
1954
  () => {
1954
1955
  this._inActivityPromise.value = false;
1955
- console.log('###### FINISHED');
1956
+ // console.log('###### FINISHED');
1956
1957
  // this.currentActivityId = null;
1957
1958
  self.safelyUpdateActivityListDelegate(null);
1958
1959
  }));
@@ -2993,39 +2994,30 @@ if (false) {
2993
2994
  }
2994
2995
  class Factory {
2995
2996
  /**
2996
- * @param {?} appModelInteractionContext
2997
+ * @param {?} interactionContext
2997
2998
  */
2998
- constructor(appModelInteractionContext) {
2999
- this.appModelInteractionContext = appModelInteractionContext;
2999
+ constructor(interactionContext) {
3000
+ this.interactionContext = interactionContext;
3000
3001
  }
3001
3002
  /**
3002
3003
  * @param {?} visit
3003
3004
  * @return {?}
3004
3005
  */
3005
3006
  createInternal(visit) {
3006
- return new Internal(visit, this.appModelInteractionContext);
3007
+ return new Internal(visit, this.interactionContext);
3007
3008
  }
3008
3009
  /**
3009
3010
  * @param {?} firstTimeRoute
3010
3011
  * @return {?}
3011
3012
  */
3012
3013
  createExternal(firstTimeRoute) {
3013
- return new External(firstTimeRoute, this.appModelInteractionContext);
3014
+ return new External(firstTimeRoute, this.interactionContext);
3014
3015
  }
3015
3016
  }
3016
- Factory.decorators = [
3017
- { type: Injectable, args: [{
3018
- providedIn: 'root'
3019
- },] },
3020
- ];
3021
- /** @nocollapse */
3022
- Factory.ctorParameters = () => [
3023
- { type: InteractionContext }
3024
- ];
3025
3017
  NavigationSession.Factory = Factory;
3026
3018
  if (false) {
3027
3019
  /** @type {?} */
3028
- Factory.prototype.appModelInteractionContext;
3020
+ Factory.prototype.interactionContext;
3029
3021
  }
3030
3022
  class ComponentDeactivationHandler {
3031
3023
  /**
@@ -3201,26 +3193,301 @@ if (false) {
3201
3193
  * @fileoverview added by tsickle
3202
3194
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3203
3195
  */
3196
+ /**
3197
+ * @param {?} options
3198
+ * @return {?}
3199
+ */
3200
+ function Place(options) {
3201
+ return (/**
3202
+ * @param {?} target
3203
+ * @return {?}
3204
+ */
3205
+ (target) => {
3206
+ if (PlaceComponent.isPlaceComponentConstructor(target)) {
3207
+ PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
3208
+ * @param {?} c
3209
+ * @return {?}
3210
+ */
3211
+ c => PlaceComponent.getDefinition(c)))));
3212
+ }
3213
+ else {
3214
+ lang.illegalState(`${target} must extend PlaceComponent to use the @Place decorator`);
3215
+ }
3216
+ });
3217
+ }
3218
+ (function (Place) {
3219
+ /**
3220
+ * @record
3221
+ */
3222
+ function Options() { }
3223
+ Place.Options = Options;
3224
+ if (false) {
3225
+ /** @type {?} */
3226
+ Options.prototype.path;
3227
+ /** @type {?|undefined} */
3228
+ Options.prototype.data;
3229
+ /** @type {?|undefined} */
3230
+ Options.prototype.authenticate;
3231
+ /** @type {?|undefined} */
3232
+ Options.prototype.children;
3233
+ /** @type {?|undefined} */
3234
+ Options.prototype.defaultChild;
3235
+ }
3236
+ })(Place || (Place = {}));
3237
+
3238
+ /**
3239
+ * @fileoverview added by tsickle
3240
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3241
+ */
3242
+ // WARNING: interface has both a type and a value, skipping emit
3243
+ var Formatter;
3244
+ (function (Formatter) {
3245
+ class StringType {
3246
+ /**
3247
+ * @param {?} value
3248
+ * @return {?}
3249
+ */
3250
+ format(value) {
3251
+ return value;
3252
+ }
3253
+ /**
3254
+ * @param {?} value
3255
+ * @return {?}
3256
+ */
3257
+ parse(value) {
3258
+ return value;
3259
+ }
3260
+ }
3261
+ class NumberType {
3262
+ /**
3263
+ * @param {?} value
3264
+ * @return {?}
3265
+ */
3266
+ format(value) {
3267
+ return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
3268
+ }
3269
+ /**
3270
+ * @param {?} value
3271
+ * @return {?}
3272
+ */
3273
+ parse(value) {
3274
+ /** @type {?} */
3275
+ const parsed = Number.parseFloat(value);
3276
+ return ___default.isNaN(parsed) ? null : parsed;
3277
+ }
3278
+ }
3279
+ class BooleanType {
3280
+ /**
3281
+ * @param {?} value
3282
+ * @return {?}
3283
+ */
3284
+ format(value) {
3285
+ return value ? 'true' : 'false';
3286
+ }
3287
+ /**
3288
+ * @param {?} value
3289
+ * @return {?}
3290
+ */
3291
+ parse(value) {
3292
+ return value === 'true';
3293
+ }
3294
+ }
3295
+ Formatter.STRING = new StringType();
3296
+ Formatter.NUMBER = new NumberType();
3297
+ Formatter.BOOLEAN = new BooleanType();
3298
+ })(Formatter || (Formatter = {}));
3299
+
3300
+ /**
3301
+ * @fileoverview added by tsickle
3302
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3303
+ */
3304
+ /**
3305
+ * @record
3306
+ * @template T
3307
+ */
3308
+ function RouteIdOptions() { }
3309
+ if (false) {
3310
+ /** @type {?|undefined} */
3311
+ RouteIdOptions.prototype.as;
3312
+ /** @type {?|undefined} */
3313
+ RouteIdOptions.prototype.optional;
3314
+ /** @type {?|undefined} */
3315
+ RouteIdOptions.prototype.remember;
3316
+ /** @type {?|undefined} */
3317
+ RouteIdOptions.prototype.defaultValue;
3318
+ }
3319
+ /**
3320
+ * @record
3321
+ * @template T
3322
+ */
3323
+ function RouteParameterOptions() { }
3324
+ if (false) {
3325
+ /** @type {?|undefined} */
3326
+ RouteParameterOptions.prototype.as;
3327
+ /** @type {?|undefined} */
3328
+ RouteParameterOptions.prototype.optional;
3329
+ /** @type {?|undefined} */
3330
+ RouteParameterOptions.prototype.remember;
3331
+ /** @type {?|undefined} */
3332
+ RouteParameterOptions.prototype.defaultValue;
3333
+ /** @type {?|undefined} */
3334
+ RouteParameterOptions.prototype.storeInUrl;
3335
+ }
3336
+ /**
3337
+ * @record
3338
+ * @template T
3339
+ */
3340
+ function RouteListParameterOptions() { }
3341
+ if (false) {
3342
+ /** @type {?|undefined} */
3343
+ RouteListParameterOptions.prototype.as;
3344
+ /** @type {?|undefined} */
3345
+ RouteListParameterOptions.prototype.optional;
3346
+ /** @type {?|undefined} */
3347
+ RouteListParameterOptions.prototype.remember;
3348
+ /** @type {?|undefined} */
3349
+ RouteListParameterOptions.prototype.defaultValue;
3350
+ /** @type {?|undefined} */
3351
+ RouteListParameterOptions.prototype.storeInUrl;
3352
+ }
3353
+ /**
3354
+ * @template T
3355
+ * @param {?} type
3356
+ * @param {?=} options
3357
+ * @return {?}
3358
+ */
3359
+ function RouteId(type, options) {
3360
+ return (/**
3361
+ * @param {?} prototype
3362
+ * @param {?} propertyKey
3363
+ * @return {?}
3364
+ */
3365
+ (prototype, propertyKey) => {
3366
+ /** @type {?} */
3367
+ const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
3368
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3369
+ UseDelegate()(prototype, propertyKey);
3370
+ });
3371
+ }
3372
+ /**
3373
+ * @template T
3374
+ * @param {?=} options
3375
+ * @return {?}
3376
+ */
3377
+ function VisitParameter(options) {
3378
+ /** @type {?} */
3379
+ const opts = Opts.get(options);
3380
+ return (/**
3381
+ * @param {?} prototype
3382
+ * @param {?} propertyKey
3383
+ * @return {?}
3384
+ */
3385
+ (prototype, propertyKey) => {
3386
+ /** @type {?} */
3387
+ const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
3388
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3389
+ UseDelegate()(prototype, propertyKey);
3390
+ });
3391
+ }
3392
+ /**
3393
+ * @template E
3394
+ * @param {?=} options
3395
+ * @return {?}
3396
+ */
3397
+ function VisitParameterList(options) {
3398
+ /** @type {?} */
3399
+ const opts = Opts.get(options);
3400
+ return (/**
3401
+ * @param {?} prototype
3402
+ * @param {?} propertyKey
3403
+ * @return {?}
3404
+ */
3405
+ (prototype, propertyKey) => {
3406
+ /** @type {?} */
3407
+ const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
3408
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3409
+ UseDelegate()(prototype, propertyKey);
3410
+ });
3411
+ }
3412
+
3413
+ /**
3414
+ * @fileoverview added by tsickle
3415
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3416
+ */
3417
+ let NoopGatewayPlace = class NoopGatewayPlace extends PlaceComponent {
3418
+ /**
3419
+ * @param {?} router
3420
+ */
3421
+ constructor(router) {
3422
+ super();
3423
+ this.router = router;
3424
+ }
3425
+ /**
3426
+ * @return {?}
3427
+ */
3428
+ ngOnInit() {
3429
+ this.router.navigateByUrl(this.returnUrl.value);
3430
+ }
3431
+ };
3432
+ NoopGatewayPlace.ctorParameters = () => [
3433
+ { type: Router }
3434
+ ];
3435
+ NoopGatewayPlace.decorators = [
3436
+ { type: Component, args: [{
3437
+ template: ''
3438
+ }] }
3439
+ ];
3440
+ /** @nocollapse */
3441
+ NoopGatewayPlace.ctorParameters = () => [
3442
+ { type: Router }
3443
+ ];
3444
+ __decorate([
3445
+ VisitParameter({ storeInUrl: Formatter.STRING }),
3446
+ __metadata("design:type", MutableValueModel)
3447
+ ], NoopGatewayPlace.prototype, "returnUrl", void 0);
3448
+ NoopGatewayPlace = __decorate([
3449
+ Place({
3450
+ path: 'aup-gateway-route',
3451
+ authenticate: false
3452
+ }),
3453
+ __metadata("design:paramtypes", [Router])
3454
+ ], NoopGatewayPlace);
3455
+ if (false) {
3456
+ /** @type {?} */
3457
+ NoopGatewayPlace.prototype.returnUrl;
3458
+ /** @type {?} */
3459
+ NoopGatewayPlace.prototype.router;
3460
+ }
3461
+
3462
+ /**
3463
+ * @fileoverview added by tsickle
3464
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3465
+ */
3466
+ /** @type {?} */
3467
+ const noopPlaceDef = PlaceComponent.getDefinition(NoopGatewayPlace);
3204
3468
  class PlaceRouter extends GarbageCollector {
3205
3469
  /**
3206
3470
  * @param {?} router
3207
3471
  * @param {?} urlSerializer
3208
- * @param {?} navigationSessionFactory
3472
+ * @param {?} interactionContext
3209
3473
  * @param {?} angularLocation
3210
3474
  * @param {?} placeHistory
3211
3475
  */
3212
- constructor(router, urlSerializer, navigationSessionFactory, angularLocation, placeHistory) {
3476
+ constructor(router, urlSerializer, interactionContext, angularLocation, placeHistory) {
3213
3477
  super();
3214
3478
  this.router = router;
3215
3479
  this.urlSerializer = urlSerializer;
3216
- this.navigationSessionFactory = navigationSessionFactory;
3480
+ this.interactionContext = interactionContext;
3217
3481
  this.angularLocation = angularLocation;
3218
3482
  this.placeHistory = placeHistory;
3219
3483
  this.firstRoute = true;
3220
3484
  this._navigationSessionModel = new MutableValueModel();
3221
3485
  this._activeVisits = new MutableListModel();
3486
+ this.initialRedirectStarted = false;
3487
+ this.initialRedirectFinished = false;
3222
3488
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3223
3489
  this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');
3490
+ this.navigationSessionFactory = new NavigationSession.Factory(interactionContext);
3224
3491
  angularLocation.onUrlChange((/**
3225
3492
  * @param {?} url
3226
3493
  * @return {?}
@@ -3438,6 +3705,34 @@ class PlaceRouter extends GarbageCollector {
3438
3705
  parseUrl(snapshot) {
3439
3706
  return new PlaceRouter.UrlHelper(this.urlSerializer.parse(snapshot.url));
3440
3707
  }
3708
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
3709
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
3710
+ // TODO: urls out of the history.
3711
+ /**
3712
+ * @param {?} activatedRoute
3713
+ * @param {?} state
3714
+ * @return {?}
3715
+ */
3716
+ performInitialNavigationIntercept(activatedRoute, state) {
3717
+ assert.isTruthy(this.isInitialNavigation());
3718
+ Logger.get(this).info(`Redirecting to: ${noopPlaceDef.path}`, { returnUrl: state.url });
3719
+ if (!this.initialRedirectFinished) {
3720
+ this.initialRedirectFinished = true;
3721
+ return this.router.createUrlTree([noopPlaceDef.path, {
3722
+ returnUrl: state.url
3723
+ }], {
3724
+ replaceUrl: true,
3725
+ // make sure we update our history
3726
+ skipLocationChange: false
3727
+ });
3728
+ }
3729
+ }
3730
+ /**
3731
+ * @return {?}
3732
+ */
3733
+ isInitialNavigation() {
3734
+ return this.navigationSession.firstNavigation && !this.initialRedirectFinished;
3735
+ }
3441
3736
  }
3442
3737
  PlaceRouter.decorators = [
3443
3738
  { type: Injectable, args: [{
@@ -3448,11 +3743,11 @@ PlaceRouter.decorators = [
3448
3743
  PlaceRouter.ctorParameters = () => [
3449
3744
  { type: Router },
3450
3745
  { type: UrlSerializer },
3451
- { type: NavigationSession.Factory },
3746
+ { type: InteractionContext },
3452
3747
  { type: Location },
3453
3748
  { type: PlaceHistory }
3454
3749
  ];
3455
- /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(NavigationSession.Factory), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
3750
+ /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(InteractionContext), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
3456
3751
  __decorate([
3457
3752
  Trace(),
3458
3753
  __metadata("design:type", Function),
@@ -3479,6 +3774,21 @@ if (false) {
3479
3774
  PlaceRouter.prototype.navigationSessionActive;
3480
3775
  /** @type {?} */
3481
3776
  PlaceRouter.prototype.activeVisitIndex;
3777
+ /**
3778
+ * @type {?}
3779
+ * @private
3780
+ */
3781
+ PlaceRouter.prototype.navigationSessionFactory;
3782
+ /**
3783
+ * @type {?}
3784
+ * @private
3785
+ */
3786
+ PlaceRouter.prototype.initialRedirectStarted;
3787
+ /**
3788
+ * @type {?}
3789
+ * @private
3790
+ */
3791
+ PlaceRouter.prototype.initialRedirectFinished;
3482
3792
  /**
3483
3793
  * @type {?}
3484
3794
  * @private
@@ -3493,7 +3803,7 @@ if (false) {
3493
3803
  * @type {?}
3494
3804
  * @private
3495
3805
  */
3496
- PlaceRouter.prototype.navigationSessionFactory;
3806
+ PlaceRouter.prototype.interactionContext;
3497
3807
  /** @type {?} */
3498
3808
  PlaceRouter.prototype.angularLocation;
3499
3809
  /** @type {?} */
@@ -3691,9 +4001,9 @@ class PlaceOutletComponent extends DisposableComponent {
3691
4001
  this.router = router;
3692
4002
  this.placeRouter = placeRouter;
3693
4003
  this.placeConfig = placeConfig;
3694
- this.animate = true;
3695
4004
  this.placeChanged = new EventEmitter();
3696
4005
  this._activePlace = new MutableValueModel();
4006
+ this._previousPlace = new MutableValueModel();
3697
4007
  this._activePlaceVisitModel = new DelegatingValueModel();
3698
4008
  this._inOutletActivation = new Guard$1();
3699
4009
  this._inOutletDeactivation = new Guard$1();
@@ -3715,12 +4025,32 @@ class PlaceOutletComponent extends DisposableComponent {
3715
4025
  .pluck('placeDefinition')
3716
4026
  .pluckList('children')
3717
4027
  .pluck('component');
4028
+ // TODO: This is a hack to prevent animation during the NoopGatewayPlace
3718
4029
  /** @type {?} */
3719
- const activatePlaceType = chain(this.activePlaceModel).map((/**
4030
+ const activePlaceType = chain(this._activePlace).map((/**
4031
+ * @param {?} p
4032
+ * @return {?}
4033
+ */
4034
+ p => {
4035
+ return (/** @type {?} */ (p.constructor));
4036
+ }), {
4037
+ postponeWhile: chain(this.activePlaceModel).isNil()
4038
+ });
4039
+ /** @type {?} */
4040
+ const previousPlaceType = chain(this._previousPlace).map((/**
3720
4041
  * @param {?} p
3721
4042
  * @return {?}
3722
4043
  */
3723
4044
  p => (/** @type {?} */ (p.constructor))));
4045
+ this.ready = chain.reduce(activePlaceType, previousPlaceType, (/**
4046
+ * @param {?} current
4047
+ * @param {?} previous
4048
+ * @return {?}
4049
+ */
4050
+ (current, previous) => {
4051
+ return !!current && current !== NoopGatewayPlace && previous !== NoopGatewayPlace;
4052
+ }));
4053
+ this.enableAnimation = valueOf.all(this.ready, this.animateModel).areTruthy();
3724
4054
  this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)
3725
4055
  .otherwise(defaultPlaceAnimationOrder)
3726
4056
  .reduce((/**
@@ -3730,14 +4060,14 @@ class PlaceOutletComponent extends DisposableComponent {
3730
4060
  (placesInOrder) => {
3731
4061
  /** @type {?} */
3732
4062
  let placeIndex = 0;
3733
- if (activatePlaceType.value) {
3734
- placeIndex = placesInOrder.indexOf(activatePlaceType.value);
3735
- if (isNil(this.initialPlaceIndex)) {
4063
+ if (activePlaceType.value) {
4064
+ placeIndex = placesInOrder.indexOf(activePlaceType.value);
4065
+ if (isNil(this.initialPlaceIndex && placeIndex >= 0)) {
3736
4066
  this.initialPlaceIndex = placeIndex;
3737
4067
  }
3738
4068
  }
3739
4069
  return isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;
3740
- }), { dependsOn: activatePlaceType });
4070
+ }), { dependsOn: activePlaceType });
3741
4071
  // Push incoming changes into the component
3742
4072
  this.routerVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
3743
4073
  // Our router visit will change when our active is nullified during deactivation, which will push a null visit
@@ -3872,7 +4202,7 @@ class PlaceOutletComponent extends DisposableComponent {
3872
4202
  console.error(error);
3873
4203
  }
3874
4204
  }));
3875
- if (!this.animate) {
4205
+ if (!this.enableAnimation.value) {
3876
4206
  // we're not animating so trigger any post animation callbacks now.
3877
4207
  this.animationDone();
3878
4208
  }
@@ -3886,6 +4216,7 @@ class PlaceOutletComponent extends DisposableComponent {
3886
4216
  * @return {?}
3887
4217
  */
3888
4218
  () => {
4219
+ this._previousPlace.value = this._activePlace.value;
3889
4220
  this._activePlace.value = null;
3890
4221
  this._activatedRouteModel.value = null;
3891
4222
  this._placeDefinition.value = null;
@@ -3912,7 +4243,7 @@ class PlaceOutletComponent extends DisposableComponent {
3912
4243
  PlaceOutletComponent.decorators = [
3913
4244
  { type: Component, args: [{
3914
4245
  selector: 'aup-place-outlet',
3915
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n</div>\n\n",
4246
+ template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n [@.disabled]=\"!enableAnimation.value\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n</div>\n\n",
3916
4247
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
3917
4248
  styles: [":host{display:flex;flex-direction:column;min-height:0;overflow-x:hidden}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
3918
4249
  }] }
@@ -3926,11 +4257,20 @@ PlaceOutletComponent.ctorParameters = () => [
3926
4257
  ];
3927
4258
  PlaceOutletComponent.propDecorators = {
3928
4259
  animate: [{ type: Input }],
4260
+ animateModel: [{ type: Input, args: ['animateModel',] }],
3929
4261
  customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
3930
4262
  customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
3931
4263
  placeChanged: [{ type: Output }],
3932
4264
  routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
3933
4265
  };
4266
+ __decorate([
4267
+ StoreInValueModel('animateModel'),
4268
+ __metadata("design:type", Boolean)
4269
+ ], PlaceOutletComponent.prototype, "animate", void 0);
4270
+ __decorate([
4271
+ UseDelegate({ defaultValue: true }),
4272
+ __metadata("design:type", ValueModel)
4273
+ ], PlaceOutletComponent.prototype, "animateModel", void 0);
3934
4274
  __decorate([
3935
4275
  UseDelegate(),
3936
4276
  __metadata("design:type", ListModel)
@@ -3943,6 +4283,8 @@ if (false) {
3943
4283
  /** @type {?} */
3944
4284
  PlaceOutletComponent.prototype.animate;
3945
4285
  /** @type {?} */
4286
+ PlaceOutletComponent.prototype.animateModel;
4287
+ /** @type {?} */
3946
4288
  PlaceOutletComponent.prototype.customPlaceAnimationOrderModel;
3947
4289
  /** @type {?} */
3948
4290
  PlaceOutletComponent.prototype.customPlaceAnimationOrder;
@@ -3955,6 +4297,11 @@ if (false) {
3955
4297
  * @private
3956
4298
  */
3957
4299
  PlaceOutletComponent.prototype._activePlace;
4300
+ /**
4301
+ * @type {?}
4302
+ * @private
4303
+ */
4304
+ PlaceOutletComponent.prototype._previousPlace;
3958
4305
  /**
3959
4306
  * @type {?}
3960
4307
  * @private
@@ -4007,6 +4354,10 @@ if (false) {
4007
4354
  * @private
4008
4355
  */
4009
4356
  PlaceOutletComponent.prototype.routerVisit;
4357
+ /** @type {?} */
4358
+ PlaceOutletComponent.prototype.ready;
4359
+ /** @type {?} */
4360
+ PlaceOutletComponent.prototype.enableAnimation;
4010
4361
  /**
4011
4362
  * @type {?}
4012
4363
  * @private
@@ -4291,7 +4642,8 @@ PlaceModule.decorators = [
4291
4642
  PlaceOutletComponent,
4292
4643
  TabbedPlaceNavigationComponent,
4293
4644
  ListPlaceNavComponent,
4294
- AbstractPlaceNavigationComponent
4645
+ AbstractPlaceNavigationComponent,
4646
+ NoopGatewayPlace
4295
4647
  ],
4296
4648
  entryComponents: [BusyOverlayComponent],
4297
4649
  exports: [
@@ -4775,279 +5127,6 @@ if (false) {
4775
5127
  NavItem.prototype.tooltip = function () { };
4776
5128
  }
4777
5129
 
4778
- /**
4779
- * @fileoverview added by tsickle
4780
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4781
- */
4782
- /**
4783
- * @param {?} options
4784
- * @return {?}
4785
- */
4786
- function Place(options) {
4787
- return (/**
4788
- * @param {?} target
4789
- * @return {?}
4790
- */
4791
- (target) => {
4792
- if (PlaceComponent.isPlaceComponentConstructor(target)) {
4793
- PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
4794
- * @param {?} c
4795
- * @return {?}
4796
- */
4797
- c => PlaceComponent.getDefinition(c)))));
4798
- }
4799
- else {
4800
- lang.illegalState(`${target} must extend PlaceComponent to use the @Place decorator`);
4801
- }
4802
- });
4803
- }
4804
- (function (Place) {
4805
- /**
4806
- * @record
4807
- */
4808
- function Options() { }
4809
- Place.Options = Options;
4810
- if (false) {
4811
- /** @type {?} */
4812
- Options.prototype.path;
4813
- /** @type {?|undefined} */
4814
- Options.prototype.data;
4815
- /** @type {?|undefined} */
4816
- Options.prototype.authenticate;
4817
- /** @type {?|undefined} */
4818
- Options.prototype.children;
4819
- /** @type {?|undefined} */
4820
- Options.prototype.defaultChild;
4821
- }
4822
- })(Place || (Place = {}));
4823
-
4824
- /**
4825
- * @fileoverview added by tsickle
4826
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4827
- */
4828
- // WARNING: interface has both a type and a value, skipping emit
4829
- var Formatter;
4830
- (function (Formatter) {
4831
- class StringType {
4832
- /**
4833
- * @param {?} value
4834
- * @return {?}
4835
- */
4836
- format(value) {
4837
- return value;
4838
- }
4839
- /**
4840
- * @param {?} value
4841
- * @return {?}
4842
- */
4843
- parse(value) {
4844
- return value;
4845
- }
4846
- }
4847
- class NumberType {
4848
- /**
4849
- * @param {?} value
4850
- * @return {?}
4851
- */
4852
- format(value) {
4853
- return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
4854
- }
4855
- /**
4856
- * @param {?} value
4857
- * @return {?}
4858
- */
4859
- parse(value) {
4860
- /** @type {?} */
4861
- const parsed = Number.parseFloat(value);
4862
- return ___default.isNaN(parsed) ? null : parsed;
4863
- }
4864
- }
4865
- class BooleanType {
4866
- /**
4867
- * @param {?} value
4868
- * @return {?}
4869
- */
4870
- format(value) {
4871
- return value ? 'true' : 'false';
4872
- }
4873
- /**
4874
- * @param {?} value
4875
- * @return {?}
4876
- */
4877
- parse(value) {
4878
- return value === 'true';
4879
- }
4880
- }
4881
- Formatter.STRING = new StringType();
4882
- Formatter.NUMBER = new NumberType();
4883
- Formatter.BOOLEAN = new BooleanType();
4884
- })(Formatter || (Formatter = {}));
4885
-
4886
- /**
4887
- * @fileoverview added by tsickle
4888
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4889
- */
4890
- /**
4891
- * @record
4892
- */
4893
- function JsonArray() { }
4894
- /**
4895
- * @record
4896
- */
4897
- function JsonMap() { }
4898
-
4899
- /**
4900
- * @fileoverview added by tsickle
4901
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4902
- */
4903
- /**
4904
- * @record
4905
- * @template T
4906
- */
4907
- function RouteIdOptions() { }
4908
- if (false) {
4909
- /** @type {?|undefined} */
4910
- RouteIdOptions.prototype.as;
4911
- /** @type {?|undefined} */
4912
- RouteIdOptions.prototype.optional;
4913
- /** @type {?|undefined} */
4914
- RouteIdOptions.prototype.remember;
4915
- /** @type {?|undefined} */
4916
- RouteIdOptions.prototype.defaultValue;
4917
- }
4918
- /**
4919
- * @record
4920
- * @template T
4921
- */
4922
- function RouteParameterOptions() { }
4923
- if (false) {
4924
- /** @type {?|undefined} */
4925
- RouteParameterOptions.prototype.as;
4926
- /** @type {?|undefined} */
4927
- RouteParameterOptions.prototype.optional;
4928
- /** @type {?|undefined} */
4929
- RouteParameterOptions.prototype.remember;
4930
- /** @type {?|undefined} */
4931
- RouteParameterOptions.prototype.defaultValue;
4932
- /** @type {?|undefined} */
4933
- RouteParameterOptions.prototype.storeInUrl;
4934
- }
4935
- /**
4936
- * @record
4937
- * @template T
4938
- */
4939
- function RouteListParameterOptions() { }
4940
- if (false) {
4941
- /** @type {?|undefined} */
4942
- RouteListParameterOptions.prototype.as;
4943
- /** @type {?|undefined} */
4944
- RouteListParameterOptions.prototype.optional;
4945
- /** @type {?|undefined} */
4946
- RouteListParameterOptions.prototype.remember;
4947
- /** @type {?|undefined} */
4948
- RouteListParameterOptions.prototype.defaultValue;
4949
- /** @type {?|undefined} */
4950
- RouteListParameterOptions.prototype.storeInUrl;
4951
- }
4952
- /**
4953
- * @template T
4954
- * @param {?} type
4955
- * @param {?=} options
4956
- * @return {?}
4957
- */
4958
- function RouteId(type, options) {
4959
- return (/**
4960
- * @param {?} prototype
4961
- * @param {?} propertyKey
4962
- * @return {?}
4963
- */
4964
- (prototype, propertyKey) => {
4965
- /** @type {?} */
4966
- const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
4967
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
4968
- UseDelegate()(prototype, propertyKey);
4969
- });
4970
- }
4971
- /**
4972
- * @template T
4973
- * @param {?=} options
4974
- * @return {?}
4975
- */
4976
- function VisitParameter(options) {
4977
- /** @type {?} */
4978
- const opts = Opts.get(options);
4979
- return (/**
4980
- * @param {?} prototype
4981
- * @param {?} propertyKey
4982
- * @return {?}
4983
- */
4984
- (prototype, propertyKey) => {
4985
- /** @type {?} */
4986
- const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
4987
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
4988
- UseDelegate()(prototype, propertyKey);
4989
- });
4990
- }
4991
- /**
4992
- * @template E
4993
- * @param {?=} options
4994
- * @return {?}
4995
- */
4996
- function VisitParameterList(options) {
4997
- /** @type {?} */
4998
- const opts = Opts.get(options);
4999
- return (/**
5000
- * @param {?} prototype
5001
- * @param {?} propertyKey
5002
- * @return {?}
5003
- */
5004
- (prototype, propertyKey) => {
5005
- /** @type {?} */
5006
- const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
5007
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5008
- UseDelegate()(prototype, propertyKey);
5009
- });
5010
- }
5011
-
5012
- /**
5013
- * @fileoverview added by tsickle
5014
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5015
- */
5016
- /**
5017
- * @record
5018
- * @template S
5019
- */
5020
- function ParameterSanitiser() { }
5021
- if (false) {
5022
- /**
5023
- * @param {?} parameterValue
5024
- * @param {?=} visit
5025
- * @param {?=} injector
5026
- * @return {?}
5027
- */
5028
- ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
5029
- }
5030
-
5031
- /**
5032
- * @fileoverview added by tsickle
5033
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5034
- */
5035
- /**
5036
- * @record
5037
- * @template T
5038
- */
5039
- function ParameterSnapshot() { }
5040
- if (false) {
5041
- /** @type {?} */
5042
- ParameterSnapshot.prototype.definition;
5043
- /** @type {?} */
5044
- ParameterSnapshot.prototype.value;
5045
- /**
5046
- * @return {?}
5047
- */
5048
- ParameterSnapshot.prototype.isMissing = function () { };
5049
- }
5050
-
5051
5130
  /**
5052
5131
  * @fileoverview added by tsickle
5053
5132
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -5139,7 +5218,10 @@ if (false) {
5139
5218
  * @fileoverview added by tsickle
5140
5219
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5141
5220
  */
5142
- class EnterPlaceGuard {
5221
+ /**
5222
+ * @abstract
5223
+ */
5224
+ class AbstractEnterPlaceGuard {
5143
5225
  /**
5144
5226
  * @param {?} router
5145
5227
  * @param {?} urlSerializer
@@ -5161,85 +5243,137 @@ class EnterPlaceGuard {
5161
5243
  * @return {?}
5162
5244
  */
5163
5245
  canActivate(activatedRoute, state) {
5246
+ return __awaiter(this, void 0, void 0, function* () {
5247
+ return this.interceptInitialRouteOtherwise(activatedRoute, state, (/**
5248
+ * @return {?}
5249
+ */
5250
+ () => {
5251
+ return this.authorisePlaceThen(activatedRoute, state, (/**
5252
+ * @param {?} placeDefinition
5253
+ * @return {?}
5254
+ */
5255
+ (placeDefinition) => __awaiter(this, void 0, void 0, function* () {
5256
+ // Parse our route params.
5257
+ /** @type {?} */
5258
+ const params = new AbstractEnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5259
+ /** @type {?} */
5260
+ const parsedParams = placeDefinition.parseRouteParams(params);
5261
+ /** @type {?} */
5262
+ const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5263
+ /** @type {?} */
5264
+ const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5265
+ /** @type {?} */
5266
+ const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
5267
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5268
+ this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5269
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5270
+ // Regenerate the url
5271
+ /** @type {?} */
5272
+ const commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
5273
+ console.log('##### Place Guard Redirect', commands);
5274
+ return this.router.createUrlTree(commands, {
5275
+ replaceUrl: true,
5276
+ skipLocationChange: false
5277
+ });
5278
+ }
5279
+ else {
5280
+ return true;
5281
+ }
5282
+ })));
5283
+ }));
5284
+ });
5285
+ }
5286
+ /**
5287
+ * @protected
5288
+ * @param {?} activatedRoute
5289
+ * @param {?} state
5290
+ * @param {?} canActivate
5291
+ * @return {?}
5292
+ */
5293
+ authorisePlaceThen(activatedRoute, state, canActivate) {
5164
5294
  return __awaiter(this, void 0, void 0, function* () {
5165
5295
  if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
5166
5296
  /** @type {?} */
5167
5297
  const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
5168
- // Parse our route params.
5169
- /** @type {?} */
5170
- const params = new EnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5171
- /** @type {?} */
5172
- const parsedParams = placeDefinition.parseRouteParams(params);
5173
- /** @type {?} */
5174
- const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5175
5298
  /** @type {?} */
5176
- const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5177
- /** @type {?} */
5178
- const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
5179
- // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5180
- this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5181
- if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5182
- // Regenerate the url
5183
- /** @type {?} */
5184
- const commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
5185
- console.log('##### Place Guard Redirect', commands);
5186
- return this.router.createUrlTree(commands, {
5187
- replaceUrl: true,
5188
- skipLocationChange: false
5189
- });
5190
- }
5191
- else {
5192
- return true;
5193
- }
5299
+ const authorised = placeDefinition.authenticate ? yield this.isAuthorised(activatedRoute, state) : true;
5300
+ return authorised === true ? canActivate(placeDefinition) : authorised;
5194
5301
  }
5195
5302
  else {
5196
5303
  return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);
5197
5304
  }
5198
5305
  });
5199
5306
  }
5307
+ /**
5308
+ * @protected
5309
+ * @param {?} activatedRoute
5310
+ * @param {?} state
5311
+ * @param {?} canActivate
5312
+ * @return {?}
5313
+ */
5314
+ interceptInitialRouteOtherwise(activatedRoute, state, canActivate) {
5315
+ return __awaiter(this, void 0, void 0, function* () {
5316
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
5317
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
5318
+ // TODO: urls out of the history.
5319
+ if (this.placeRouter.isInitialNavigation()) {
5320
+ // This is the very first entry into our app so we redirect to a dummy place so we can get bump our
5321
+ // history by one. This ensures that we can capture back button presses on the initial page without
5322
+ // leaving our app.
5323
+ return this.placeRouter.performInitialNavigationIntercept(activatedRoute, state);
5324
+ }
5325
+ else {
5326
+ return canActivate();
5327
+ }
5328
+ });
5329
+ }
5330
+ /**
5331
+ * @param {?} activatedRoute
5332
+ * @param {?} state
5333
+ * @return {?}
5334
+ */
5335
+ isAuthorised(activatedRoute, state) {
5336
+ return __awaiter(this, void 0, void 0, function* () {
5337
+ /** @type {?} */
5338
+ const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
5339
+ return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
5340
+ });
5341
+ }
5200
5342
  }
5201
- EnterPlaceGuard.decorators = [
5202
- { type: Injectable, args: [{
5203
- providedIn: 'root'
5204
- },] }
5205
- ];
5206
- /** @nocollapse */
5207
- EnterPlaceGuard.ctorParameters = () => [
5208
- { type: Router },
5209
- { type: UrlSerializer },
5210
- { type: PlaceRouter },
5211
- { type: PlaceHistory },
5212
- { type: Injector }
5213
- ];
5214
- /** @nocollapse */ EnterPlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function EnterPlaceGuard_Factory() { return new EnterPlaceGuard(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(INJECTOR)); }, token: EnterPlaceGuard, providedIn: "root" });
5215
5343
  if (false) {
5216
5344
  /**
5217
5345
  * @type {?}
5218
5346
  * @private
5219
5347
  */
5220
- EnterPlaceGuard.prototype.router;
5348
+ AbstractEnterPlaceGuard.prototype.router;
5221
5349
  /**
5222
5350
  * @type {?}
5223
5351
  * @private
5224
5352
  */
5225
- EnterPlaceGuard.prototype.urlSerializer;
5353
+ AbstractEnterPlaceGuard.prototype.urlSerializer;
5226
5354
  /**
5227
5355
  * @type {?}
5228
5356
  * @private
5229
5357
  */
5230
- EnterPlaceGuard.prototype.placeRouter;
5358
+ AbstractEnterPlaceGuard.prototype.placeRouter;
5231
5359
  /**
5232
5360
  * @type {?}
5233
5361
  * @private
5234
5362
  */
5235
- EnterPlaceGuard.prototype.placeHistory;
5363
+ AbstractEnterPlaceGuard.prototype.placeHistory;
5236
5364
  /**
5237
5365
  * @type {?}
5238
5366
  * @private
5239
5367
  */
5240
- EnterPlaceGuard.prototype.injector;
5368
+ AbstractEnterPlaceGuard.prototype.injector;
5369
+ /**
5370
+ * @abstract
5371
+ * @param {?} injector
5372
+ * @return {?}
5373
+ */
5374
+ AbstractEnterPlaceGuard.prototype.getAuthGuard = function (injector) { };
5241
5375
  }
5242
- (function (EnterPlaceGuard) {
5376
+ (function (AbstractEnterPlaceGuard) {
5243
5377
  /**
5244
5378
  * This a work around for the fact that an activated route with multiple segments doesn't
5245
5379
  * include the segment params in the paramMap as well as each segment returns an empty
@@ -5315,7 +5449,7 @@ if (false) {
5315
5449
  __metadata("design:type", Array),
5316
5450
  __metadata("design:paramtypes", [])
5317
5451
  ], ConsolidatedParameterMap.prototype, "keys", null);
5318
- EnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5452
+ AbstractEnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5319
5453
  if (false) {
5320
5454
  /**
5321
5455
  * @type {?}
@@ -5367,7 +5501,7 @@ if (false) {
5367
5501
  */
5368
5502
  ParamMapAdapter.prototype.params;
5369
5503
  }
5370
- })(EnterPlaceGuard || (EnterPlaceGuard = {}));
5504
+ })(AbstractEnterPlaceGuard || (AbstractEnterPlaceGuard = {}));
5371
5505
 
5372
5506
  /**
5373
5507
  * @fileoverview added by tsickle
@@ -5411,6 +5545,85 @@ if (false) {
5411
5545
  LeavePlaceGuard.prototype.placeRouter;
5412
5546
  }
5413
5547
 
5548
+ /**
5549
+ * @fileoverview added by tsickle
5550
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5551
+ */
5552
+ class NoopAuthGuard {
5553
+ constructor() {
5554
+ }
5555
+ /**
5556
+ * @param {?} activatedRoute
5557
+ * @param {?} state
5558
+ * @return {?}
5559
+ */
5560
+ canActivate(activatedRoute, state) {
5561
+ return __awaiter(this, void 0, void 0, function* () {
5562
+ return true;
5563
+ });
5564
+ }
5565
+ }
5566
+ NoopAuthGuard.decorators = [
5567
+ { type: Injectable, args: [{
5568
+ providedIn: 'root'
5569
+ },] }
5570
+ ];
5571
+ /** @nocollapse */
5572
+ NoopAuthGuard.ctorParameters = () => [];
5573
+ /** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
5574
+
5575
+ /**
5576
+ * @fileoverview added by tsickle
5577
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5578
+ */
5579
+ /**
5580
+ * @record
5581
+ */
5582
+ function JsonArray() { }
5583
+ /**
5584
+ * @record
5585
+ */
5586
+ function JsonMap() { }
5587
+
5588
+ /**
5589
+ * @fileoverview added by tsickle
5590
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5591
+ */
5592
+ /**
5593
+ * @record
5594
+ * @template S
5595
+ */
5596
+ function ParameterSanitiser() { }
5597
+ if (false) {
5598
+ /**
5599
+ * @param {?} parameterValue
5600
+ * @param {?=} visit
5601
+ * @param {?=} injector
5602
+ * @return {?}
5603
+ */
5604
+ ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
5605
+ }
5606
+
5607
+ /**
5608
+ * @fileoverview added by tsickle
5609
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5610
+ */
5611
+ /**
5612
+ * @record
5613
+ * @template T
5614
+ */
5615
+ function ParameterSnapshot() { }
5616
+ if (false) {
5617
+ /** @type {?} */
5618
+ ParameterSnapshot.prototype.definition;
5619
+ /** @type {?} */
5620
+ ParameterSnapshot.prototype.value;
5621
+ /**
5622
+ * @return {?}
5623
+ */
5624
+ ParameterSnapshot.prototype.isMissing = function () { };
5625
+ }
5626
+
5414
5627
  /**
5415
5628
  * @fileoverview added by tsickle
5416
5629
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -5431,5 +5644,5 @@ if (false) {
5431
5644
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5432
5645
  */
5433
5646
 
5434
- export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, EnterPlaceGuard, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, InteractionModule as ɵba, ActivityContainerComponent as ɵbb, ActivityOutletComponent as ɵbc, ConfirmationDialogComponent as ɵbd, AbstractActivity as ɵbe, ACTIVITY_DATA as ɵbf, Activity as ɵbg, ConfirmThenDialogComponent as ɵbi, AlertDialogComponent as ɵbj, InteractionOutletComponent as ɵbl, InplaceInteractionContextComponent as ɵbm, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbn, DialogInteractionService as ɵbo, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, NavigationSession as ɵu, InteractionContext as ɵv, PlaceHistory as ɵw, TabbedPlaceNavigationComponent as ɵx, AbstractPlaceNavigationComponent as ɵy, ListPlaceNavComponent as ɵz };
5647
+ export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractEnterPlaceGuard, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopAuthGuard, NoopComponent, NoopGatewayPlace, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, PlaceComponent as ɵba, Place as ɵbb, VisitParameter as ɵbc, Formatter as ɵbd, InteractionModule as ɵbe, ActivityContainerComponent as ɵbf, ActivityOutletComponent as ɵbg, ConfirmationDialogComponent as ɵbh, AbstractActivity as ɵbi, ACTIVITY_DATA as ɵbj, Activity as ɵbk, ConfirmThenDialogComponent as ɵbm, AlertDialogComponent as ɵbn, InteractionOutletComponent as ɵbp, InplaceInteractionContextComponent as ɵbq, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbr, DialogInteractionService as ɵbs, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, InteractionContext as ɵu, PlaceHistory as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, NoopGatewayPlace as ɵz };
5435
5648
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map