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

Method start

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

* Starts the save subscription * @return {!Promise}

()

Source from the content-addressed store, hash-verified

14428 * @return {!Promise}
14429 */
14430 start() {
14431 const iframeArgs = this.activityPorts_.addDefaultArguments({
14432 'isClosable': true,
14433 });
14434 this.activityIframeView_ = new ActivityIframeView(
14435 this.win_,
14436 this.activityPorts_,
14437 feUrl('/linksaveiframe'),
14438 iframeArgs,
14439 /* shouldFadeBody */ false,
14440 /* hasLoadingIndicator */ true
14441 );
14442 this.activityIframeView_.on(
14443 LinkingInfoResponse,
14444 this.sendLinkSaveToken_.bind(this)
14445 );
14446
14447 this.openPromise_ = this.dialogManager_.openView(
14448 this.activityIframeView_,
14449 /* hidden */ true
14450 );
14451 this.deps_
14452 .eventManager()
14453 .logSwgEvent(AnalyticsEvent.IMPRESSION_SAVE_SUBSCR_TO_GOOGLE);
14454 /** {!Promise<boolean>} */
14455 return this.activityIframeView_
14456 .acceptResultAndVerify(
14457 feOrigin(),
14458 /* requireOriginVerified */ true,
14459 /* requireSecureChannel */ true
14460 )
14461 .then((result) => {
14462 return this.handleLinkSaveResponse_(result);
14463 })
14464 .catch((reason) => {
14465 // In case this flow wasn't complete, complete it here
14466 this.complete_();
14467 // Handle cancellation from user, link confirm start or completion here
14468 if (isCancelError(reason)) {
14469 this.deps_
14470 .eventManager()
14471 .logSwgEvent(
14472 AnalyticsEvent.ACTION_SAVE_SUBSCR_TO_GOOGLE_CANCEL,
14473 true
14474 );
14475 this.deps_
14476 .callbacks()
14477 .triggerFlowCanceled(SubscriptionFlows.LINK_ACCOUNT);
14478 return false;
14479 }
14480 throw reason;
14481 });
14482 }
14483}
14484
14485/**

Callers

nothing calls this directly

Calls 15

complete_Method · 0.95
feUrlFunction · 0.85
feOriginFunction · 0.85
isCancelErrorFunction · 0.85
addDefaultArgumentsMethod · 0.80
logSwgEventMethod · 0.80
eventManagerMethod · 0.80
catchMethod · 0.80
acceptResultAndVerifyMethod · 0.80
triggerFlowCanceledMethod · 0.80
callbacksMethod · 0.80

Tested by

no test coverage detected