* Starts the offers flow or alreadySubscribed flow. * @return {!Promise}
()
| 6593 | * @return {!Promise} |
| 6594 | */ |
| 6595 | start() { |
| 6596 | // Start/cancel events. |
| 6597 | this.deps_ |
| 6598 | .callbacks() |
| 6599 | .triggerFlowStarted(SubscriptionFlows.SHOW_SUBSCRIBE_OPTION); |
| 6600 | this.activityIframeView_.onCancel(() => { |
| 6601 | this.deps_ |
| 6602 | .callbacks() |
| 6603 | .triggerFlowCanceled(SubscriptionFlows.SHOW_SUBSCRIBE_OPTION); |
| 6604 | }); |
| 6605 | this.activityIframeView_.on( |
| 6606 | SubscribeResponse$1, |
| 6607 | this.maybeOpenOffersFlow_.bind(this) |
| 6608 | ); |
| 6609 | |
| 6610 | this.activityIframeView_.acceptResult().then( |
| 6611 | (result) => { |
| 6612 | const data = result.data; |
| 6613 | const response = new SubscribeResponse$1(); |
| 6614 | if (data['subscribe']) { |
| 6615 | response.setSubscribe(true); |
| 6616 | } |
| 6617 | this.maybeOpenOffersFlow_(response); |
| 6618 | }, |
| 6619 | (reason) => { |
| 6620 | this.dialogManager_.completeView(this.activityIframeView_); |
| 6621 | throw reason; |
| 6622 | } |
| 6623 | ); |
| 6624 | this.eventManager_.logSwgEvent( |
| 6625 | AnalyticsEvent.IMPRESSION_CLICK_TO_SHOW_OFFERS |
| 6626 | ); |
| 6627 | return this.dialogManager_.openView(this.activityIframeView_); |
| 6628 | } |
| 6629 | |
| 6630 | /** |
| 6631 | * @param {SubscribeResponse} response |
no test coverage detected