@coolon/angular-ui-powerups 0.0.116 → 0.0.118

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.
@@ -3969,6 +3969,7 @@
3969
3969
  var _this = _super.call(this) || this;
3970
3970
  _this.context = context;
3971
3971
  _this._visits = new Map();
3972
+ _this.debugPropertyKeys = [];
3972
3973
  return _this;
3973
3974
  }
3974
3975
  Object.defineProperty(NavigationState.prototype, "name", {
@@ -4189,14 +4190,18 @@
4189
4190
  function (event) {
4190
4191
  /** @type {?} */
4191
4192
  var popstate = event.navigationTrigger === 'popstate';
4192
- return popstate ?
4193
- this.interactionService.isActive() ?
4194
- new NavigationState.InteractionPopStateTransition(this.context, this.currentRouterUrl()) :
4195
- new NavigationState.PopStateTransition(this.context, this.currentRouterUrl())
4196
- :
4197
- this.interactionService.isActive() ?
4198
- new NavigationState.InteractionTransition(this.context, this.currentRouterUrl()) :
4199
- new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());
4193
+ /** @type {?} */
4194
+ var inInteraction = this.interactionService.isActive();
4195
+ if (popstate) {
4196
+ return inInteraction ?
4197
+ new NavigationState.LeavingInteractionAfterPopStateTransition(this.context, this.currentRouterUrl(), event.url) :
4198
+ new NavigationState.PopStateTransition(this.context, this.currentRouterUrl(), event.url);
4199
+ }
4200
+ else {
4201
+ return inInteraction ?
4202
+ new NavigationState.StartingInteractionTransition(this.context, this.currentRouterUrl()) :
4203
+ new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());
4204
+ }
4200
4205
  };
4201
4206
  /**
4202
4207
  * @protected
@@ -4211,17 +4216,36 @@
4211
4216
  new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
4212
4217
  new NavigationState.Idle(this.context);
4213
4218
  };
4219
+ //
4220
+ //
4214
4221
  /**
4215
4222
  * @param {?} url
4216
4223
  * @return {?}
4217
4224
  */
4218
- NavigationState.prototype.resetBrowserLocation = /**
4225
+ NavigationState.prototype.resetBrowserLocation =
4226
+ //
4227
+ /**
4219
4228
  * @param {?} url
4220
4229
  * @return {?}
4221
4230
  */
4222
4231
  function (url) {
4223
4232
  this.placeRouter.resetBrowserLocation(url);
4224
4233
  };
4234
+ /**
4235
+ * @param {?} event
4236
+ * @param {?=} reason
4237
+ * @return {?}
4238
+ */
4239
+ NavigationState.prototype.ignore = /**
4240
+ * @param {?} event
4241
+ * @param {?=} reason
4242
+ * @return {?}
4243
+ */
4244
+ function (event, reason) {
4245
+ reason = reason ? " -> " + reason : '';
4246
+ pectin.Logger.get(this).info("Ignoring router event" + reason + ": " + event.constructor.name + " -> " + event.url + " :: " + this.toString());
4247
+ return this;
4248
+ };
4225
4249
  /**
4226
4250
  * @return {?}
4227
4251
  */
@@ -4229,7 +4253,27 @@
4229
4253
  * @return {?}
4230
4254
  */
4231
4255
  function () {
4232
- return this.constructor.name;
4256
+ return this.constructor.name + "(" + this.debugState() + ")";
4257
+ };
4258
+ /**
4259
+ * @protected
4260
+ * @param {?=} properties
4261
+ * @return {?}
4262
+ */
4263
+ NavigationState.prototype.debugState = /**
4264
+ * @protected
4265
+ * @param {?=} properties
4266
+ * @return {?}
4267
+ */
4268
+ function (properties) {
4269
+ var _this = this;
4270
+ return (properties || this.debugPropertyKeys).map((/**
4271
+ * @param {?} p
4272
+ * @return {?}
4273
+ */
4274
+ function (p) {
4275
+ return p + ": " + _this[p];
4276
+ })).join(', ');
4233
4277
  };
4234
4278
  return NavigationState;
4235
4279
  }(pectin.GarbageCollector));
@@ -4245,6 +4289,8 @@
4245
4289
  exports.NavigationState.prototype.startingUrl;
4246
4290
  /** @type {?} */
4247
4291
  exports.NavigationState.prototype.isPopState;
4292
+ /** @type {?} */
4293
+ exports.NavigationState.prototype.debugPropertyKeys;
4248
4294
  /**
4249
4295
  * @type {?}
4250
4296
  * @protected
@@ -4310,7 +4356,7 @@
4310
4356
  }
4311
4357
  if (this.placeRouter.hasActiveInteractionIds(event.url)) {
4312
4358
  pectin.Logger.get(this).info("navigation started with interaction outlet -> " + event.url);
4313
- return new InteractionTransition(this.context, event.url);
4359
+ return new StartingInteractionTransition(this.context, event.url);
4314
4360
  }
4315
4361
  else {
4316
4362
  return this.createTransitionStateFor(event);
@@ -4403,14 +4449,14 @@
4403
4449
  return new Idle(this.context);
4404
4450
  };
4405
4451
  /**
4406
- * @param {?} locationTriggerUrl
4452
+ * @param {?} newUrl
4407
4453
  * @return {?}
4408
4454
  */
4409
4455
  AbstractNavigationTransition.prototype.onBackClickedDuringNavigationInteraction = /**
4410
- * @param {?} locationTriggerUrl
4456
+ * @param {?} newUrl
4411
4457
  * @return {?}
4412
4458
  */
4413
- function (locationTriggerUrl) {
4459
+ function (newUrl) {
4414
4460
  pectin.Logger.get(this).info("back button pressed during navigation session interaction promise");
4415
4461
  // detach the interaction from the session so it doesn't get disposed until the activity has completed.
4416
4462
  /** @type {?} */
@@ -4418,25 +4464,22 @@
4418
4464
  var when = pectin.Dsl.disposeWith(navigationInteraction).when;
4419
4465
  // TODO: I need to make the exclusive interaction context disallow nested activities or
4420
4466
  // that would mess things up entirely. Or, can I do a context.abortAll().then(..)
4467
+ pectin.Logger.get(this).info('cancelling current navigation activity..');
4421
4468
  navigationInteraction.cancelActiveActivity().then((/**
4422
4469
  * @return {?}
4423
4470
  */
4424
4471
  function () {
4425
4472
  navigationInteraction.dispose();
4426
4473
  }));
4427
- return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, this.isPopState, locationTriggerUrl);
4474
+ return this.createNavigationInteractionCancelledState(newUrl);
4428
4475
  };
4429
- // @Trace()
4430
- // @Trace()
4431
4476
  /**
4432
4477
  * @param {?} component
4433
4478
  * @param {?} currentUrl
4434
4479
  * @param {?} nextUrl
4435
4480
  * @return {?}
4436
4481
  */
4437
- AbstractNavigationTransition.prototype.canDeactivatePlace =
4438
- // @Trace()
4439
- /**
4482
+ AbstractNavigationTransition.prototype.canDeactivatePlace = /**
4440
4483
  * @param {?} component
4441
4484
  * @param {?} currentUrl
4442
4485
  * @param {?} nextUrl
@@ -4458,11 +4501,11 @@
4458
4501
  });
4459
4502
  };
4460
4503
  /**
4461
- * @private
4504
+ * @protected
4462
4505
  * @return {?}
4463
4506
  */
4464
4507
  AbstractNavigationTransition.prototype.detachInteractionContext = /**
4465
- * @private
4508
+ * @protected
4466
4509
  * @return {?}
4467
4510
  */
4468
4511
  function () {
@@ -4489,12 +4532,19 @@
4489
4532
  AbstractNavigationTransition.prototype._interactionContext;
4490
4533
  /** @type {?} */
4491
4534
  AbstractNavigationTransition.prototype.startingUrl;
4535
+ /**
4536
+ * @abstract
4537
+ * @param {?} newUrl
4538
+ * @return {?}
4539
+ */
4540
+ AbstractNavigationTransition.prototype.createNavigationInteractionCancelledState = function (newUrl) { };
4492
4541
  }
4493
4542
  var NavigationTransition = /** @class */ (function (_super) {
4494
4543
  __extends(NavigationTransition, _super);
4495
4544
  function NavigationTransition() {
4496
4545
  var _this = _super !== null && _super.apply(this, arguments) || this;
4497
4546
  _this.isPopState = false;
4547
+ _this.debugPropertyKeys = ['startingUrl'];
4498
4548
  return _this;
4499
4549
  }
4500
4550
  /**
@@ -4521,13 +4571,15 @@
4521
4571
  return new Idle(this.context);
4522
4572
  };
4523
4573
  /**
4574
+ * @param {?} newUrl
4524
4575
  * @return {?}
4525
4576
  */
4526
- NavigationTransition.prototype.toString = /**
4577
+ NavigationTransition.prototype.createNavigationInteractionCancelledState = /**
4578
+ * @param {?} newUrl
4527
4579
  * @return {?}
4528
4580
  */
4529
- function () {
4530
- return this.constructor.name + "(startingUrl: " + this.startingUrl + ")";
4581
+ function (newUrl) {
4582
+ return new LinkTriggeredNavigationInteractionCancelled(this.context, this.startingUrl, newUrl);
4531
4583
  };
4532
4584
  return NavigationTransition;
4533
4585
  }(AbstractNavigationTransition));
@@ -4535,12 +4587,16 @@
4535
4587
  if (false) {
4536
4588
  /** @type {?} */
4537
4589
  NavigationTransition.prototype.isPopState;
4590
+ /** @type {?} */
4591
+ NavigationTransition.prototype.debugPropertyKeys;
4538
4592
  }
4539
4593
  var PopStateTransition = /** @class */ (function (_super) {
4540
4594
  __extends(PopStateTransition, _super);
4541
- function PopStateTransition() {
4542
- var _this = _super !== null && _super.apply(this, arguments) || this;
4595
+ function PopStateTransition(context, startingUrl, poppedHistoryUrl) {
4596
+ var _this = _super.call(this, context, startingUrl) || this;
4597
+ _this.poppedHistoryUrl = poppedHistoryUrl;
4543
4598
  _this.isPopState = true;
4599
+ _this.debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];
4544
4600
  return _this;
4545
4601
  }
4546
4602
  /**
@@ -4555,7 +4611,8 @@
4555
4611
  // Angular doesn't preserve the url when a guard cancels the back button.
4556
4612
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4557
4613
  pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4558
- this.resetBrowserLocation(this.startingUrl);
4614
+ this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
4615
+ this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4559
4616
  return new Idle(this.context);
4560
4617
  };
4561
4618
  /**
@@ -4572,24 +4629,75 @@
4572
4629
  // Angular doesn't preserve the url when a guard cancels the back button.
4573
4630
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4574
4631
  pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4575
- this.resetBrowserLocation(this.startingUrl);
4632
+ this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
4633
+ this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4576
4634
  }
4577
4635
  return new Idle(this.context);
4578
4636
  };
4637
+ /**
4638
+ * @param {?} locationTriggerUrl
4639
+ * @return {?}
4640
+ */
4641
+ PopStateTransition.prototype.createNavigationInteractionCancelledState = /**
4642
+ * @param {?} locationTriggerUrl
4643
+ * @return {?}
4644
+ */
4645
+ function (locationTriggerUrl) {
4646
+ return new PopStateTriggeredNavigationInteractionCancelled(this.context, this.startingUrl, locationTriggerUrl, this.poppedHistoryUrl);
4647
+ };
4579
4648
  return PopStateTransition;
4580
4649
  }(AbstractNavigationTransition));
4581
4650
  NavigationState.PopStateTransition = PopStateTransition;
4582
4651
  if (false) {
4583
4652
  /** @type {?} */
4584
4653
  PopStateTransition.prototype.isPopState;
4654
+ /** @type {?} */
4655
+ PopStateTransition.prototype.debugPropertyKeys;
4656
+ /** @type {?} */
4657
+ PopStateTransition.prototype.poppedHistoryUrl;
4658
+ }
4659
+ /**
4660
+ * @abstract
4661
+ */
4662
+ var /**
4663
+ * @abstract
4664
+ */
4665
+ AbstractInteractionTransition = /** @class */ (function (_super) {
4666
+ __extends(AbstractInteractionTransition, _super);
4667
+ function AbstractInteractionTransition(context, startingUrl) {
4668
+ var _this = _super.call(this, context, startingUrl) || this;
4669
+ _this.startingUrl = startingUrl;
4670
+ _this.isTransitional = true;
4671
+ return _this;
4672
+ }
4673
+ return AbstractInteractionTransition;
4674
+ }(AbstractNavigationTransition));
4675
+ NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
4676
+ if (false) {
4677
+ /** @type {?} */
4678
+ AbstractInteractionTransition.prototype.isTransitional;
4679
+ /** @type {?} */
4680
+ AbstractInteractionTransition.prototype.startingUrl;
4585
4681
  }
4586
- var IdleDuringInteraction = /** @class */ (function (_super) {
4682
+ // The following states exist to handle all events while any kind of navigation is in progress. That way all other states can
4683
+ // happily ignore interaction contexts.
4684
+ /**
4685
+ * This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.
4686
+ */
4687
+ var
4688
+ // The following states exist to handle all events while any kind of navigation is in progress. That way all other states can
4689
+ // happily ignore interaction contexts.
4690
+ /**
4691
+ * This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.
4692
+ */
4693
+ IdleDuringInteraction = /** @class */ (function (_super) {
4587
4694
  __extends(IdleDuringInteraction, _super);
4588
4695
  function IdleDuringInteraction(context, startingUrl) {
4589
4696
  var _this = _super.call(this, context) || this;
4590
4697
  _this.startingUrl = startingUrl;
4591
4698
  _this.isTransitional = false;
4592
4699
  _this.isPopState = false;
4700
+ _this.debugPropertyKeys = ['startingUrl'];
4593
4701
  return _this;
4594
4702
  }
4595
4703
  /**
@@ -4603,40 +4711,34 @@
4603
4711
  * @return {?}
4604
4712
  */
4605
4713
  function (visit, initialUrl) {
4714
+ // we're in an interaction and the user clicked back
4606
4715
  /** @type {?} */
4607
- var navigationTransition = new InteractionTransition(this.context, initialUrl);
4716
+ var navigationTransition = new StartingInteractionTransition(this.context, initialUrl);
4608
4717
  navigationTransition.storeVisit(visit);
4609
4718
  return navigationTransition;
4610
4719
  };
4611
- // @Trace()
4612
- // @Trace()
4613
4720
  /**
4614
4721
  * @param {?} event
4615
4722
  * @return {?}
4616
4723
  */
4617
- IdleDuringInteraction.prototype.onRouterStarted =
4618
- // @Trace()
4619
- /**
4724
+ IdleDuringInteraction.prototype.onRouterStarted = /**
4620
4725
  * @param {?} event
4621
4726
  * @return {?}
4622
4727
  */
4623
4728
  function (event) {
4624
- return new InteractionTransition(this.context, event.url);
4729
+ return new StartingInteractionTransition(this.context, event.url);
4625
4730
  };
4626
- // @Trace()
4627
- // @Trace()
4628
4731
  /**
4629
4732
  * @param {?} event
4630
4733
  * @return {?}
4631
4734
  */
4632
- IdleDuringInteraction.prototype.onPopState =
4633
- // @Trace()
4634
- /**
4735
+ IdleDuringInteraction.prototype.onPopState = /**
4635
4736
  * @param {?} event
4636
4737
  * @return {?}
4637
4738
  */
4638
4739
  function (event) {
4639
- return new InteractionPopStateTransition(this.context, event.url);
4740
+ // we're in an interaction and the user clicked back
4741
+ return new LeavingInteractionAfterPopStateTransition(this.context, event.url, event.url);
4640
4742
  };
4641
4743
  return IdleDuringInteraction;
4642
4744
  }(NavigationState));
@@ -4647,55 +4749,34 @@
4647
4749
  /** @type {?} */
4648
4750
  IdleDuringInteraction.prototype.isPopState;
4649
4751
  /** @type {?} */
4650
- IdleDuringInteraction.prototype.startingUrl;
4651
- }
4652
- /**
4653
- * @abstract
4654
- */
4655
- var /**
4656
- * @abstract
4657
- */
4658
- AbstractInteractionTransition = /** @class */ (function (_super) {
4659
- __extends(AbstractInteractionTransition, _super);
4660
- function AbstractInteractionTransition(context, startingUrl) {
4661
- var _this = _super.call(this, context, startingUrl) || this;
4662
- _this.startingUrl = startingUrl;
4663
- _this.isTransitional = true;
4664
- return _this;
4665
- }
4666
- return AbstractInteractionTransition;
4667
- }(AbstractNavigationTransition));
4668
- NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
4669
- if (false) {
4752
+ IdleDuringInteraction.prototype.debugPropertyKeys;
4670
4753
  /** @type {?} */
4671
- AbstractInteractionTransition.prototype.isTransitional;
4672
- /** @type {?} */
4673
- AbstractInteractionTransition.prototype.startingUrl;
4754
+ IdleDuringInteraction.prototype.startingUrl;
4674
4755
  }
4675
4756
  /**
4676
4757
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4677
4758
  * happily ignore interaction contexts.
4759
+ * NOTE: This state is activated when ever an interaction is started. It might be better to split it into
4760
+ * different states for different scenarios, e.g. starting model, starting model during route guard etc.
4678
4761
  */
4679
4762
  var /**
4680
4763
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4681
4764
  * happily ignore interaction contexts.
4765
+ * NOTE: This state is activated when ever an interaction is started. It might be better to split it into
4766
+ * different states for different scenarios, e.g. starting model, starting model during route guard etc.
4682
4767
  */
4683
- InteractionTransition = /** @class */ (function (_super) {
4684
- __extends(InteractionTransition, _super);
4685
- function InteractionTransition() {
4768
+ StartingInteractionTransition = /** @class */ (function (_super) {
4769
+ __extends(StartingInteractionTransition, _super);
4770
+ function StartingInteractionTransition() {
4686
4771
  var _this = _super !== null && _super.apply(this, arguments) || this;
4687
4772
  _this.isPopState = false;
4688
4773
  return _this;
4689
4774
  }
4690
- // @Trace()
4691
- // @Trace()
4692
4775
  /**
4693
4776
  * @param {?} event
4694
4777
  * @return {?}
4695
4778
  */
4696
- InteractionTransition.prototype.onRouterCancelled =
4697
- // @Trace()
4698
- /**
4779
+ StartingInteractionTransition.prototype.onRouterCancelled = /**
4699
4780
  * @param {?} event
4700
4781
  * @return {?}
4701
4782
  */
@@ -4710,15 +4791,11 @@
4710
4791
  return new Idle(this.context);
4711
4792
  }
4712
4793
  };
4713
- // @Trace()
4714
- // @Trace()
4715
4794
  /**
4716
4795
  * @param {?} event
4717
4796
  * @return {?}
4718
4797
  */
4719
- InteractionTransition.prototype.onRouterError =
4720
- // @Trace()
4721
- /**
4798
+ StartingInteractionTransition.prototype.onRouterError = /**
4722
4799
  * @param {?} event
4723
4800
  * @return {?}
4724
4801
  */
@@ -4726,15 +4803,11 @@
4726
4803
  // navigation was aborted.
4727
4804
  return new IdleDuringInteraction(this.context, this.startingUrl);
4728
4805
  };
4729
- // @Trace()
4730
- // @Trace()
4731
4806
  /**
4732
4807
  * @param {?} event
4733
4808
  * @return {?}
4734
4809
  */
4735
- InteractionTransition.prototype.onRouterEnd =
4736
- // @Trace()
4737
- /**
4810
+ StartingInteractionTransition.prototype.onRouterEnd = /**
4738
4811
  * @param {?} event
4739
4812
  * @return {?}
4740
4813
  */
@@ -4746,12 +4819,163 @@
4746
4819
  return new Idle(this.context);
4747
4820
  }
4748
4821
  };
4749
- return InteractionTransition;
4822
+ /**
4823
+ * @param {?} locationTriggerUrl
4824
+ * @return {?}
4825
+ */
4826
+ StartingInteractionTransition.prototype.createNavigationInteractionCancelledState = /**
4827
+ * @param {?} locationTriggerUrl
4828
+ * @return {?}
4829
+ */
4830
+ function (locationTriggerUrl) {
4831
+ return new LeavingInteractionTransitionCancelled(this.context, this.startingUrl, locationTriggerUrl);
4832
+ };
4833
+ return StartingInteractionTransition;
4750
4834
  }(AbstractInteractionTransition));
4751
- NavigationState.InteractionTransition = InteractionTransition;
4835
+ NavigationState.StartingInteractionTransition = StartingInteractionTransition;
4836
+ if (false) {
4837
+ /** @type {?} */
4838
+ StartingInteractionTransition.prototype.isPopState;
4839
+ }
4840
+ /**
4841
+ * The sequence of router events are:
4842
+ * Error -> url = url of navigation link
4843
+ * End
4844
+ * onPopState url = current intereaction url sans the query params
4845
+ * Cancel url == same as above.
4846
+ */
4847
+ var /**
4848
+ * The sequence of router events are:
4849
+ * Error -> url = url of navigation link
4850
+ * End
4851
+ * onPopState url = current intereaction url sans the query params
4852
+ * Cancel url == same as above.
4853
+ */
4854
+ LeavingInteractionTransitionCancelled = /** @class */ (function (_super) {
4855
+ __extends(LeavingInteractionTransitionCancelled, _super);
4856
+ function LeavingInteractionTransitionCancelled(context, startingUrl, locationChangeTriggerUrl) {
4857
+ var _this = _super.call(this, context) || this;
4858
+ _this.startingUrl = startingUrl;
4859
+ _this.locationChangeTriggerUrl = locationChangeTriggerUrl;
4860
+ _this.isPopState = false;
4861
+ _this.firstCancelHandled = false;
4862
+ _this.popStateHandled = false;
4863
+ _this.debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
4864
+ return _this;
4865
+ }
4866
+ Object.defineProperty(LeavingInteractionTransitionCancelled.prototype, "isTransitional", {
4867
+ get: /**
4868
+ * @return {?}
4869
+ */
4870
+ function () {
4871
+ return true;
4872
+ },
4873
+ enumerable: true,
4874
+ configurable: true
4875
+ });
4876
+ /**
4877
+ * @param {?} event
4878
+ * @return {?}
4879
+ */
4880
+ LeavingInteractionTransitionCancelled.prototype.onRouterStarted = /**
4881
+ * @param {?} event
4882
+ * @return {?}
4883
+ */
4884
+ function (event) {
4885
+ return this.ignore(event);
4886
+ };
4887
+ /**
4888
+ * @param {?} event
4889
+ * @return {?}
4890
+ */
4891
+ LeavingInteractionTransitionCancelled.prototype.onRouterCancelled = /**
4892
+ * @param {?} event
4893
+ * @return {?}
4894
+ */
4895
+ function (event) {
4896
+ // Angular doesn't preserve the url when a guard cancels the back button.
4897
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4898
+ pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4899
+ if (this.interactionService.isActive()) {
4900
+ /** @type {?} */
4901
+ var interactionIds = this.interactionService.activeInteractionContextIds.value;
4902
+ this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
4903
+ }
4904
+ else {
4905
+ this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
4906
+ }
4907
+ return this.createIdleState();
4908
+ };
4909
+ /**
4910
+ * @param {?} event
4911
+ * @return {?}
4912
+ */
4913
+ LeavingInteractionTransitionCancelled.prototype.onRouterEnd = /**
4914
+ * @param {?} event
4915
+ * @return {?}
4916
+ */
4917
+ function (event) {
4918
+ return this.ignore(event);
4919
+ };
4920
+ /**
4921
+ * @param {?} event
4922
+ * @return {?}
4923
+ */
4924
+ LeavingInteractionTransitionCancelled.prototype.onRouterError = /**
4925
+ * @param {?} event
4926
+ * @return {?}
4927
+ */
4928
+ function (event) {
4929
+ return this.ignore(event);
4930
+ };
4931
+ /**
4932
+ * @param {?} event
4933
+ * @return {?}
4934
+ */
4935
+ LeavingInteractionTransitionCancelled.prototype.onPopState = /**
4936
+ * @param {?} event
4937
+ * @return {?}
4938
+ */
4939
+ function (event) {
4940
+ return this.ignore(event);
4941
+ };
4942
+ /**
4943
+ * @param {?} component
4944
+ * @param {?} currentUrl
4945
+ * @param {?} nextUrl
4946
+ * @return {?}
4947
+ */
4948
+ LeavingInteractionTransitionCancelled.prototype.canDeactivatePlace = /**
4949
+ * @param {?} component
4950
+ * @param {?} currentUrl
4951
+ * @param {?} nextUrl
4952
+ * @return {?}
4953
+ */
4954
+ function (component, currentUrl, nextUrl) {
4955
+ return __awaiter(this, void 0, void 0, function () {
4956
+ return __generator(this, function (_a) {
4957
+ return [2 /*return*/, false];
4958
+ });
4959
+ });
4960
+ };
4961
+ return LeavingInteractionTransitionCancelled;
4962
+ }(NavigationState));
4963
+ NavigationState.LeavingInteractionTransitionCancelled = LeavingInteractionTransitionCancelled;
4752
4964
  if (false) {
4753
4965
  /** @type {?} */
4754
- InteractionTransition.prototype.isPopState;
4966
+ LeavingInteractionTransitionCancelled.prototype.isPopState;
4967
+ /** @type {?} */
4968
+ LeavingInteractionTransitionCancelled.prototype.firstCancelHandled;
4969
+ /** @type {?} */
4970
+ LeavingInteractionTransitionCancelled.prototype.popStateHandled;
4971
+ /** @type {?} */
4972
+ LeavingInteractionTransitionCancelled.prototype.popStateEventUrl;
4973
+ /** @type {?} */
4974
+ LeavingInteractionTransitionCancelled.prototype.debugPropertyKeys;
4975
+ /** @type {?} */
4976
+ LeavingInteractionTransitionCancelled.prototype.startingUrl;
4977
+ /** @type {?} */
4978
+ LeavingInteractionTransitionCancelled.prototype.locationChangeTriggerUrl;
4755
4979
  }
4756
4980
  /**
4757
4981
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
@@ -4761,22 +4985,19 @@
4761
4985
  * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4762
4986
  * happily ignore interaction contexts.
4763
4987
  */
4764
- InteractionPopStateTransition = /** @class */ (function (_super) {
4765
- __extends(InteractionPopStateTransition, _super);
4766
- function InteractionPopStateTransition() {
4767
- var _this = _super !== null && _super.apply(this, arguments) || this;
4988
+ LeavingInteractionAfterPopStateTransition = /** @class */ (function (_super) {
4989
+ __extends(LeavingInteractionAfterPopStateTransition, _super);
4990
+ function LeavingInteractionAfterPopStateTransition(context, startingUrl, poppedHistoryUrl) {
4991
+ var _this = _super.call(this, context, startingUrl) || this;
4992
+ _this.poppedHistoryUrl = poppedHistoryUrl;
4768
4993
  _this.isPopState = true;
4769
4994
  return _this;
4770
4995
  }
4771
- // @Trace()
4772
- // @Trace()
4773
4996
  /**
4774
4997
  * @param {?} event
4775
4998
  * @return {?}
4776
4999
  */
4777
- InteractionPopStateTransition.prototype.onRouterCancelled =
4778
- // @Trace()
4779
- /**
5000
+ LeavingInteractionAfterPopStateTransition.prototype.onRouterCancelled = /**
4780
5001
  * @param {?} event
4781
5002
  * @return {?}
4782
5003
  */
@@ -4791,15 +5012,11 @@
4791
5012
  return new Idle(this.context);
4792
5013
  }
4793
5014
  };
4794
- // @Trace()
4795
- // @Trace()
4796
5015
  /**
4797
5016
  * @param {?} event
4798
5017
  * @return {?}
4799
5018
  */
4800
- InteractionPopStateTransition.prototype.onRouterEnd =
4801
- // @Trace()
4802
- /**
5019
+ LeavingInteractionAfterPopStateTransition.prototype.onRouterEnd = /**
4803
5020
  * @param {?} event
4804
5021
  * @return {?}
4805
5022
  */
@@ -4811,25 +5028,219 @@
4811
5028
  return new Idle(this.context);
4812
5029
  }
4813
5030
  };
4814
- return InteractionPopStateTransition;
5031
+ /**
5032
+ * @param {?} newUrl
5033
+ * @return {?}
5034
+ */
5035
+ LeavingInteractionAfterPopStateTransition.prototype.createNavigationInteractionCancelledState = /**
5036
+ * @param {?} newUrl
5037
+ * @return {?}
5038
+ */
5039
+ function (newUrl) {
5040
+ return this.illegalTransition("Leaving interaction after pop-state should't block so should never see a back button click");
5041
+ };
5042
+ return LeavingInteractionAfterPopStateTransition;
4815
5043
  }(AbstractInteractionTransition));
4816
- NavigationState.InteractionPopStateTransition = InteractionPopStateTransition;
5044
+ NavigationState.LeavingInteractionAfterPopStateTransition = LeavingInteractionAfterPopStateTransition;
4817
5045
  if (false) {
4818
5046
  /** @type {?} */
4819
- InteractionPopStateTransition.prototype.isPopState;
5047
+ LeavingInteractionAfterPopStateTransition.prototype.isPopState;
5048
+ /** @type {?} */
5049
+ LeavingInteractionAfterPopStateTransition.prototype.poppedHistoryUrl;
4820
5050
  }
4821
- var CancelledDuringNavigationInteraction = /** @class */ (function (_super) {
4822
- __extends(CancelledDuringNavigationInteraction, _super);
4823
- function CancelledDuringNavigationInteraction(context, startingUrl, startingEventWasAPopState, locationChangeTriggerUrl) {
5051
+ // See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
5052
+ //
5053
+ // export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
5054
+ //
5055
+ // readonly isPopState = false;
5056
+ // firstCancelHandled = false;
5057
+ // popStateHandled = false;
5058
+ // popStateEventUrl: string;
5059
+ // debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
5060
+ //
5061
+ // constructor(context: Context,
5062
+ // readonly startingUrl: string,
5063
+ // readonly locationChangeTriggerUrl: string,
5064
+ // readonly poppedHistoryUrl: string) {
5065
+ // super(context);
5066
+ // }
5067
+ //
5068
+ // get isTransitional() {
5069
+ // return true;
5070
+ // }
5071
+ //
5072
+ // onRouterStarted(event: NavigationStart): NavigationState {
5073
+ // return this.ignore(event);
5074
+ // }
5075
+ //
5076
+ //
5077
+ // onRouterCancelled(event: NavigationCancel): NavigationState {
5078
+ //
5079
+ // // if (this.firstCancelHandled && this.popStateHandled) {
5080
+ // // // Angular doesn't preserve the url when a guard cancels the back button.
5081
+ // // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5082
+ // // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
5083
+ // // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
5084
+ // // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
5085
+ // // if (this.interactionService.isActive()) {
5086
+ // // const interactionIds = this.interactionService.activeInteractionContextIds.value;
5087
+ // // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
5088
+ // // } else {
5089
+ // // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
5090
+ // // }
5091
+ // // return this.createIdleState();
5092
+ // // } else {
5093
+ // // this.firstCancelHandled = true;
5094
+ // return this.ignore(event);
5095
+ // // }
5096
+ // }
5097
+ //
5098
+ //
5099
+ // onRouterEnd(event: NavigationEnd): NavigationState {
5100
+ // return this.ignore(event);
5101
+ // }
5102
+ //
5103
+ //
5104
+ // onRouterError(event: NavigationError): NavigationState {
5105
+ // return this.ignore(event);
5106
+ // }
5107
+ //
5108
+ //
5109
+ // onPopState(event: NavigationStart): NavigationState {
5110
+ // // this.popStateHandled = true;
5111
+ // // this.popStateEventUrl = event.url;
5112
+ // return this.ignore(event);
5113
+ // }
5114
+ //
5115
+ // async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
5116
+ // return false;
5117
+ // }
5118
+ // }
5119
+ /**
5120
+ * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
5121
+ * The routing event sequence is different depending on the link that was clicked.
5122
+ *
5123
+ * If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:
5124
+ *
5125
+ * -> Idle -> NavigationTransition
5126
+ * -> confirm dialog shown.
5127
+ * -> click back
5128
+ * -> NavigationCancel -> clickedLinkUrl === cancel.url
5129
+ * -> NavigationEnd
5130
+ *
5131
+ * Otherwise if the link is different from teh history location then the sequence is:
5132
+ *
5133
+ * -> Idle -> NavigationTransition
5134
+ * -> confirm dialog shown.
5135
+ * -> click back
5136
+ * -> NavigationCancel -> clickedLinkUrl !== cancel.url
5137
+ * -> NavigationEnd
5138
+ * -> PopState
5139
+ * -> NavigationCancel
5140
+ */
5141
+ var
5142
+ // See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
5143
+ //
5144
+ // export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
5145
+ //
5146
+ // readonly isPopState = false;
5147
+ // firstCancelHandled = false;
5148
+ // popStateHandled = false;
5149
+ // popStateEventUrl: string;
5150
+ // debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
5151
+ //
5152
+ // constructor(context: Context,
5153
+ // readonly startingUrl: string,
5154
+ // readonly locationChangeTriggerUrl: string,
5155
+ // readonly poppedHistoryUrl: string) {
5156
+ // super(context);
5157
+ // }
5158
+ //
5159
+ // get isTransitional() {
5160
+ // return true;
5161
+ // }
5162
+ //
5163
+ // onRouterStarted(event: NavigationStart): NavigationState {
5164
+ // return this.ignore(event);
5165
+ // }
5166
+ //
5167
+ //
5168
+ // onRouterCancelled(event: NavigationCancel): NavigationState {
5169
+ //
5170
+ // // if (this.firstCancelHandled && this.popStateHandled) {
5171
+ // // // Angular doesn't preserve the url when a guard cancels the back button.
5172
+ // // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5173
+ // // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
5174
+ // // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
5175
+ // // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
5176
+ // // if (this.interactionService.isActive()) {
5177
+ // // const interactionIds = this.interactionService.activeInteractionContextIds.value;
5178
+ // // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
5179
+ // // } else {
5180
+ // // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
5181
+ // // }
5182
+ // // return this.createIdleState();
5183
+ // // } else {
5184
+ // // this.firstCancelHandled = true;
5185
+ // return this.ignore(event);
5186
+ // // }
5187
+ // }
5188
+ //
5189
+ //
5190
+ // onRouterEnd(event: NavigationEnd): NavigationState {
5191
+ // return this.ignore(event);
5192
+ // }
5193
+ //
5194
+ //
5195
+ // onRouterError(event: NavigationError): NavigationState {
5196
+ // return this.ignore(event);
5197
+ // }
5198
+ //
5199
+ //
5200
+ // onPopState(event: NavigationStart): NavigationState {
5201
+ // // this.popStateHandled = true;
5202
+ // // this.popStateEventUrl = event.url;
5203
+ // return this.ignore(event);
5204
+ // }
5205
+ //
5206
+ // async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
5207
+ // return false;
5208
+ // }
5209
+ // }
5210
+ /**
5211
+ * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
5212
+ * The routing event sequence is different depending on the link that was clicked.
5213
+ *
5214
+ * If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:
5215
+ *
5216
+ * -> Idle -> NavigationTransition
5217
+ * -> confirm dialog shown.
5218
+ * -> click back
5219
+ * -> NavigationCancel -> clickedLinkUrl === cancel.url
5220
+ * -> NavigationEnd
5221
+ *
5222
+ * Otherwise if the link is different from teh history location then the sequence is:
5223
+ *
5224
+ * -> Idle -> NavigationTransition
5225
+ * -> confirm dialog shown.
5226
+ * -> click back
5227
+ * -> NavigationCancel -> clickedLinkUrl !== cancel.url
5228
+ * -> NavigationEnd
5229
+ * -> PopState
5230
+ * -> NavigationCancel
5231
+ */
5232
+ LinkTriggeredNavigationInteractionCancelled = /** @class */ (function (_super) {
5233
+ __extends(LinkTriggeredNavigationInteractionCancelled, _super);
5234
+ function LinkTriggeredNavigationInteractionCancelled(context, startingUrl, clickedLinkUrl) {
4824
5235
  var _this = _super.call(this, context) || this;
4825
5236
  _this.startingUrl = startingUrl;
4826
- _this.startingEventWasAPopState = startingEventWasAPopState;
4827
- _this.locationChangeTriggerUrl = locationChangeTriggerUrl;
5237
+ _this.clickedLinkUrl = clickedLinkUrl;
4828
5238
  _this.isPopState = false;
4829
- _this.gotPopStateWithLeavingUrl = false;
5239
+ _this.clickedLinkMatchedBackButtonUrl = false;
5240
+ _this.debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];
4830
5241
  return _this;
4831
5242
  }
4832
- Object.defineProperty(CancelledDuringNavigationInteraction.prototype, "isTransitional", {
5243
+ Object.defineProperty(LinkTriggeredNavigationInteractionCancelled.prototype, "isTransitional", {
4833
5244
  get: /**
4834
5245
  * @return {?}
4835
5246
  */
@@ -4843,53 +5254,56 @@
4843
5254
  * @param {?} event
4844
5255
  * @return {?}
4845
5256
  */
4846
- CancelledDuringNavigationInteraction.prototype.onRouterStarted = /**
5257
+ LinkTriggeredNavigationInteractionCancelled.prototype.onRouterStarted = /**
4847
5258
  * @param {?} event
4848
5259
  * @return {?}
4849
5260
  */
4850
5261
  function (event) {
4851
5262
  return this.ignore(event);
4852
5263
  };
4853
- // @Trace()
4854
- // @Trace()
4855
5264
  /**
4856
5265
  * @param {?} event
4857
5266
  * @return {?}
4858
5267
  */
4859
- CancelledDuringNavigationInteraction.prototype.onRouterCancelled =
4860
- // @Trace()
4861
- /**
5268
+ LinkTriggeredNavigationInteractionCancelled.prototype.onRouterCancelled = /**
4862
5269
  * @param {?} event
4863
5270
  * @return {?}
4864
5271
  */
4865
5272
  function (event) {
4866
- // Depending on the state of the router and what was done we get a different
4867
- // sequence of events.
4868
- // If the navigation change was triggered by clicking a link we'll get a cancel with the locationChangeTriggerUrl as the final event.
4869
- // If the navigation change was triggered with a pop state then we'll get an onPopState with the locationChangeTriggerUrl but no cancel event with it.
4870
- if (this.gotPopStateWithLeavingUrl && this.interactionService.isActive()) {
4871
- /** @type {?} */
4872
- var interactionIds = this.interactionService.activeInteractionContextIds.value;
4873
- this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
5273
+ // TODO: should really split this into two sub states in the first cancel event.
5274
+ if (!this.firstCancelEventUrl) {
5275
+ this.firstCancelEventUrl = event.url;
5276
+ this.clickedLinkMatchedBackButtonUrl = event.url === this.clickedLinkUrl;
5277
+ return this.ignore(event);
5278
+ }
5279
+ else {
5280
+ // we wait for our popped state to come in.
5281
+ if (!this.clickedLinkMatchedBackButtonUrl && this.popStateEventUrl) {
5282
+ return this.finaliseRouting();
5283
+ }
4874
5284
  }
4875
- return this.gotPopStateWithLeavingUrl || this.locationChangeTriggerUrl === event.url ? this.createIdleState() : this.ignore(event);
4876
5285
  };
4877
5286
  /**
4878
5287
  * @param {?} event
4879
5288
  * @return {?}
4880
5289
  */
4881
- CancelledDuringNavigationInteraction.prototype.onRouterEnd = /**
5290
+ LinkTriggeredNavigationInteractionCancelled.prototype.onRouterEnd = /**
4882
5291
  * @param {?} event
4883
5292
  * @return {?}
4884
5293
  */
4885
5294
  function (event) {
4886
- return this.ignore(event);
5295
+ if (this.clickedLinkMatchedBackButtonUrl) {
5296
+ return this.finaliseRouting();
5297
+ }
5298
+ else {
5299
+ return this.ignore(event);
5300
+ }
4887
5301
  };
4888
5302
  /**
4889
5303
  * @param {?} event
4890
5304
  * @return {?}
4891
5305
  */
4892
- CancelledDuringNavigationInteraction.prototype.onRouterError = /**
5306
+ LinkTriggeredNavigationInteractionCancelled.prototype.onRouterError = /**
4893
5307
  * @param {?} event
4894
5308
  * @return {?}
4895
5309
  */
@@ -4900,25 +5314,42 @@
4900
5314
  * @param {?} event
4901
5315
  * @return {?}
4902
5316
  */
4903
- CancelledDuringNavigationInteraction.prototype.onPopState = /**
5317
+ LinkTriggeredNavigationInteractionCancelled.prototype.onPopState = /**
4904
5318
  * @param {?} event
4905
5319
  * @return {?}
4906
5320
  */
4907
5321
  function (event) {
4908
- this.gotPopStateWithLeavingUrl = this.gotPopStateWithLeavingUrl || event.url === this.locationChangeTriggerUrl;
5322
+ this.popStateEventUrl = event.url;
4909
5323
  return this.ignore(event);
4910
5324
  };
4911
- // @Trace()
4912
- // @Trace()
5325
+ /**
5326
+ * @return {?}
5327
+ */
5328
+ LinkTriggeredNavigationInteractionCancelled.prototype.finaliseRouting = /**
5329
+ * @return {?}
5330
+ */
5331
+ function () {
5332
+ pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
5333
+ this.resetBrowserLocation(this.clickedLinkUrl); // put the back click one back in.
5334
+ if (this.interactionService.isActive()) {
5335
+ /** @type {?} */
5336
+ var interactionIds = this.interactionService.activeInteractionContextIds.value;
5337
+ // Angular doesn't preserve the url when a guard cancels the back button.
5338
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5339
+ this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
5340
+ }
5341
+ else {
5342
+ this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
5343
+ }
5344
+ return this.createIdleState();
5345
+ };
4913
5346
  /**
4914
5347
  * @param {?} component
4915
5348
  * @param {?} currentUrl
4916
5349
  * @param {?} nextUrl
4917
5350
  * @return {?}
4918
5351
  */
4919
- CancelledDuringNavigationInteraction.prototype.canDeactivatePlace =
4920
- // @Trace()
4921
- /**
5352
+ LinkTriggeredNavigationInteractionCancelled.prototype.canDeactivatePlace = /**
4922
5353
  * @param {?} component
4923
5354
  * @param {?} currentUrl
4924
5355
  * @param {?} nextUrl
@@ -4931,47 +5362,185 @@
4931
5362
  });
4932
5363
  });
4933
5364
  };
5365
+ return LinkTriggeredNavigationInteractionCancelled;
5366
+ }(NavigationState));
5367
+ NavigationState.LinkTriggeredNavigationInteractionCancelled = LinkTriggeredNavigationInteractionCancelled;
5368
+ if (false) {
5369
+ /** @type {?} */
5370
+ LinkTriggeredNavigationInteractionCancelled.prototype.isPopState;
5371
+ /** @type {?} */
5372
+ LinkTriggeredNavigationInteractionCancelled.prototype.firstCancelEventUrl;
5373
+ /** @type {?} */
5374
+ LinkTriggeredNavigationInteractionCancelled.prototype.popStateEventUrl;
5375
+ /** @type {?} */
5376
+ LinkTriggeredNavigationInteractionCancelled.prototype.clickedLinkMatchedBackButtonUrl;
5377
+ /** @type {?} */
5378
+ LinkTriggeredNavigationInteractionCancelled.prototype.debugPropertyKeys;
5379
+ /** @type {?} */
5380
+ LinkTriggeredNavigationInteractionCancelled.prototype.startingUrl;
5381
+ /** @type {?} */
5382
+ LinkTriggeredNavigationInteractionCancelled.prototype.clickedLinkUrl;
5383
+ }
5384
+ /**
5385
+ * This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.
5386
+ * The sequence of routing events/state transitions is as follows.
5387
+ * -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )
5388
+ * -> confirm dialog shown.
5389
+ * -> click back
5390
+ * -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)
5391
+ * -> NavigationCancel (for the previous back)
5392
+ * -> PopState
5393
+ * -> NavigationCancel
5394
+ */
5395
+ var /**
5396
+ * This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.
5397
+ * The sequence of routing events/state transitions is as follows.
5398
+ * -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )
5399
+ * -> confirm dialog shown.
5400
+ * -> click back
5401
+ * -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)
5402
+ * -> NavigationCancel (for the previous back)
5403
+ * -> PopState
5404
+ * -> NavigationCancel
5405
+ */
5406
+ PopStateTriggeredNavigationInteractionCancelled = /** @class */ (function (_super) {
5407
+ __extends(PopStateTriggeredNavigationInteractionCancelled, _super);
5408
+ function PopStateTriggeredNavigationInteractionCancelled(context, startingUrl, locationChangeTriggerUrl, poppedHistoryUrl) {
5409
+ var _this = _super.call(this, context) || this;
5410
+ _this.startingUrl = startingUrl;
5411
+ _this.locationChangeTriggerUrl = locationChangeTriggerUrl;
5412
+ _this.poppedHistoryUrl = poppedHistoryUrl;
5413
+ _this.isPopState = false;
5414
+ _this.firstCancelHandled = false;
5415
+ _this.popStateHandled = false;
5416
+ _this.debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
5417
+ return _this;
5418
+ }
5419
+ Object.defineProperty(PopStateTriggeredNavigationInteractionCancelled.prototype, "isTransitional", {
5420
+ get: /**
5421
+ * @return {?}
5422
+ */
5423
+ function () {
5424
+ return true;
5425
+ },
5426
+ enumerable: true,
5427
+ configurable: true
5428
+ });
4934
5429
  /**
4935
5430
  * @param {?} event
4936
- * @param {?=} reason
4937
5431
  * @return {?}
4938
5432
  */
4939
- CancelledDuringNavigationInteraction.prototype.ignore = /**
5433
+ PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterStarted = /**
4940
5434
  * @param {?} event
4941
- * @param {?=} reason
4942
5435
  * @return {?}
4943
5436
  */
4944
- function (event, reason) {
4945
- reason = reason ? " -> " + reason : '';
4946
- pectin.Logger.get(this).info("ignoring router event" + reason + ": " + event.constructor.name + " -> " + event.url);
4947
- return this;
5437
+ function (event) {
5438
+ return this.ignore(event);
4948
5439
  };
4949
5440
  /**
5441
+ * @param {?} event
4950
5442
  * @return {?}
4951
5443
  */
4952
- CancelledDuringNavigationInteraction.prototype.toString = /**
5444
+ PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterCancelled = /**
5445
+ * @param {?} event
4953
5446
  * @return {?}
4954
5447
  */
4955
- function () {
4956
- return this.constructor.name + "(isIdl: " + this.idle + ", startingUrl: " + this.startingUrl + ", locationChangeTriggerUrl:" + this.locationChangeTriggerUrl + ")";
5448
+ function (event) {
5449
+ if (this.firstCancelHandled && this.popStateHandled) {
5450
+ // Angular doesn't preserve the url when a guard cancels the back button.
5451
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5452
+ pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
5453
+ this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
5454
+ this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
5455
+ if (this.interactionService.isActive()) {
5456
+ /** @type {?} */
5457
+ var interactionIds = this.interactionService.activeInteractionContextIds.value;
5458
+ this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
5459
+ }
5460
+ else {
5461
+ this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
5462
+ }
5463
+ return this.createIdleState();
5464
+ }
5465
+ else {
5466
+ this.firstCancelHandled = true;
5467
+ return this.ignore(event);
5468
+ }
4957
5469
  };
4958
- return CancelledDuringNavigationInteraction;
5470
+ /**
5471
+ * @param {?} event
5472
+ * @return {?}
5473
+ */
5474
+ PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterEnd = /**
5475
+ * @param {?} event
5476
+ * @return {?}
5477
+ */
5478
+ function (event) {
5479
+ return this.ignore(event);
5480
+ };
5481
+ /**
5482
+ * @param {?} event
5483
+ * @return {?}
5484
+ */
5485
+ PopStateTriggeredNavigationInteractionCancelled.prototype.onRouterError = /**
5486
+ * @param {?} event
5487
+ * @return {?}
5488
+ */
5489
+ function (event) {
5490
+ return this.ignore(event);
5491
+ };
5492
+ /**
5493
+ * @param {?} event
5494
+ * @return {?}
5495
+ */
5496
+ PopStateTriggeredNavigationInteractionCancelled.prototype.onPopState = /**
5497
+ * @param {?} event
5498
+ * @return {?}
5499
+ */
5500
+ function (event) {
5501
+ this.popStateHandled = true;
5502
+ this.popStateEventUrl = event.url;
5503
+ return this.ignore(event);
5504
+ };
5505
+ /**
5506
+ * @param {?} component
5507
+ * @param {?} currentUrl
5508
+ * @param {?} nextUrl
5509
+ * @return {?}
5510
+ */
5511
+ PopStateTriggeredNavigationInteractionCancelled.prototype.canDeactivatePlace = /**
5512
+ * @param {?} component
5513
+ * @param {?} currentUrl
5514
+ * @param {?} nextUrl
5515
+ * @return {?}
5516
+ */
5517
+ function (component, currentUrl, nextUrl) {
5518
+ return __awaiter(this, void 0, void 0, function () {
5519
+ return __generator(this, function (_a) {
5520
+ return [2 /*return*/, false];
5521
+ });
5522
+ });
5523
+ };
5524
+ return PopStateTriggeredNavigationInteractionCancelled;
4959
5525
  }(NavigationState));
4960
- NavigationState.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
5526
+ NavigationState.PopStateTriggeredNavigationInteractionCancelled = PopStateTriggeredNavigationInteractionCancelled;
4961
5527
  if (false) {
4962
5528
  /** @type {?} */
4963
- CancelledDuringNavigationInteraction.prototype.isPopState;
4964
- /**
4965
- * @type {?}
4966
- * @private
4967
- */
4968
- CancelledDuringNavigationInteraction.prototype.gotPopStateWithLeavingUrl;
5529
+ PopStateTriggeredNavigationInteractionCancelled.prototype.isPopState;
4969
5530
  /** @type {?} */
4970
- CancelledDuringNavigationInteraction.prototype.startingUrl;
5531
+ PopStateTriggeredNavigationInteractionCancelled.prototype.firstCancelHandled;
4971
5532
  /** @type {?} */
4972
- CancelledDuringNavigationInteraction.prototype.startingEventWasAPopState;
5533
+ PopStateTriggeredNavigationInteractionCancelled.prototype.popStateHandled;
4973
5534
  /** @type {?} */
4974
- CancelledDuringNavigationInteraction.prototype.locationChangeTriggerUrl;
5535
+ PopStateTriggeredNavigationInteractionCancelled.prototype.popStateEventUrl;
5536
+ /** @type {?} */
5537
+ PopStateTriggeredNavigationInteractionCancelled.prototype.debugPropertyKeys;
5538
+ /** @type {?} */
5539
+ PopStateTriggeredNavigationInteractionCancelled.prototype.startingUrl;
5540
+ /** @type {?} */
5541
+ PopStateTriggeredNavigationInteractionCancelled.prototype.locationChangeTriggerUrl;
5542
+ /** @type {?} */
5543
+ PopStateTriggeredNavigationInteractionCancelled.prototype.poppedHistoryUrl;
4975
5544
  }
4976
5545
  })(exports.NavigationState || (exports.NavigationState = {}));
4977
5546
 
@@ -8132,6 +8701,7 @@
8132
8701
  var param = new exports.ParameterDefinition.RouteId(propertyKey.toString(), options, type);
8133
8702
  typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8134
8703
  pectin.UseDelegate({ tag: "@RouteId(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8704
+ // UseDelegate()(prototype, propertyKey);
8135
8705
  });
8136
8706
  }
8137
8707
  /**
@@ -8152,6 +8722,7 @@
8152
8722
  var param = new exports.ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
8153
8723
  typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8154
8724
  pectin.UseDelegate({ tag: "@VisitParameter(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8725
+ // UseDelegate()(prototype, propertyKey);
8155
8726
  });
8156
8727
  }
8157
8728
  /**
@@ -8170,8 +8741,9 @@
8170
8741
  function (prototype, propertyKey) {
8171
8742
  /** @type {?} */
8172
8743
  var param = new exports.ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
8173
- typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8744
+ // UseDelegate()(prototype, propertyKey);
8174
8745
  pectin.UseDelegate({ tag: "@VisitParameterList(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8746
+ typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8175
8747
  });
8176
8748
  }
8177
8749