third_party/subscriptions-project/swg.js
/**
   * Starts the offers flow or alreadySubscribed flow.
   * @return {!Promise}
   */
Starts the offers flow or alreadySubscribed flow.
@return {!Promise}
Starts the offers flow or alreadySubscribed flow . @return { !Promise }
start() {
    this.deps_
      .callbacks()
      .triggerFlowStarted(SubscriptionFlows.SHOW_SUBSCRIBE_OPTION);
    this.activityIframeView_.onCancel(() => {
      this.deps_
        .callbacks()
        .triggerFlowCanceled(SubscriptionFlows.SHOW_SUBSCRIBE_OPTION);
    });
    this.activityIframeView_.on(
      SubscribeResponse$1,
      this.maybeOpenOffersFlow_.bind(this)
    );
    this.activityIframeView_.acceptResult().then(
      (result) => {
        const data = result.data;
        const response = new SubscribeResponse$1();
        if (data['subscribe']) {
          response.setSubscribe(true);
        }
        this.maybeOpenOffersFlow_(response);
      },
      (reason) => {
        this.dialogManager_.completeView(this.activityIframeView_);
        throw reason;
      }
    );
    this.eventManager_.logSwgEvent(
      AnalyticsEvent.IMPRESSION_CLICK_TO_SHOW_OFFERS
    );
    return this.dialogManager_.openView(this.activityIframeView_);
  }
start ( ) { this . deps_ . callbacks ( ) . triggerFlowStarted ( SubscriptionFlows . SHOW_SUBSCRIBE_OPTION ) ; this . activityIframeView_ . onCancel ( ( ) => { this . deps_ . callbacks ( ) . triggerFlowCanceled ( SubscriptionFlows . SHOW_SUBSCRIBE_OPTION ) ; } ) ; this . activityIframeView_ . on ( SubscribeResponse$1 , this . maybeOpenOffersFlow_ . bind ( this ) ) ; this . activityIframeView_ . acceptResult ( ) . then ( ( result ) => { const data = result . data ; const response = new SubscribeResponse$1 ( ) ; if ( data [ 'subscribe' ] ) { response . setSubscribe ( true ) ; } this . maybeOpenOffersFlow_ ( response ) ; } , ( reason ) => { this . dialogManager_ . completeView ( this . activityIframeView_ ) ; throw reason ; } ) ; this . eventManager_ . logSwgEvent ( AnalyticsEvent . IMPRESSION_CLICK_TO_SHOW_OFFERS ) ; return this . dialogManager_ . openView ( this . activityIframeView_ ) ; }
Starts the offers flow or alreadySubscribed flow.
Starts the offers flow or alreadySubscribed flow .
// Start/cancel events.