MCPcopy Create free account
hub / github.com/ampproject/amphtml / start

Method start

third_party/subscriptions-project/swg.js:6595–6628  ·  view source on GitHub ↗

* Starts the offers flow or alreadySubscribed flow. * @return {!Promise}

()

Source from the content-addressed store, hash-verified

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

Callers 1

showSubscribeOptionMethod · 0.95

Calls 12

setSubscribeMethod · 0.95
maybeOpenOffersFlow_Method · 0.95
triggerFlowStartedMethod · 0.80
callbacksMethod · 0.80
onCancelMethod · 0.80
triggerFlowCanceledMethod · 0.80
completeViewMethod · 0.80
logSwgEventMethod · 0.80
onMethod · 0.45
thenMethod · 0.45
acceptResultMethod · 0.45
openViewMethod · 0.45

Tested by

no test coverage detected