diff options
Diffstat (limited to 'plugins/jetpack/_inc/build/connect-button.min.js')
-rw-r--r-- | plugins/jetpack/_inc/build/connect-button.min.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/jetpack/_inc/build/connect-button.min.js b/plugins/jetpack/_inc/build/connect-button.min.js index 1cfe3962..b6f1881e 100644 --- a/plugins/jetpack/_inc/build/connect-button.min.js +++ b/plugins/jetpack/_inc/build/connect-button.min.js @@ -1,3 +1,3 @@ /* Do not modify this file directly. It is compiled from other files. */ /* global jpConnect */ -jQuery(document).ready(function(n){var e=n(".jp-connect-button, .jp-banner__alt-connect-button").eq(0),t=n(".jp-connect-full__tos-blurb"),o=n('<iframe class="jp-jetpack-connect__iframe" />'),a=n("#jetpack-connection-cards, .jp-connect-full__dismiss-paragraph");e.on("click",function(n){n.preventDefault(),a.length&&a.fadeOut(600),i.selectAndStartConnectionFlow()});var i={isRegistering:!1,isPaidPlan:!1,selectAndStartConnectionFlow:function(){var e=n("#jetpack-connection-cards");e.length&&e.fadeOut(600),i.isRegistering||("original"===jpConnect.forceVariation?i.handleOriginalFlow():"in_place"===jpConnect.forceVariation?i.handleConnectInPlaceFlow():i.startConnectionFlow())},startConnectionFlow:function(){n.ajax({url:"https://public-api.wordpress.com/wpcom/v2/abtest/jetpack_connect_in_place_v3",type:"GET",error:i.handleConnectionError,data:jpConnect.identity,xhrFields:{withCredentials:!0},crossDomain:!0,success:function(n){n&&"in_place"===n.variation?i.handleConnectInPlaceFlow():i.handleOriginalFlow()}})},handleOriginalFlow:function(){window.location=e.attr("href")},handleConnectInPlaceFlow:function(){if(e.hasClass("jp-banner__alt-connect-button"))window.location=jpConnect.connectInPlaceUrl;else{i.isRegistering=!0,t.hide(),e.hide(),i.triggerLoadingState();var o=jpConnect.apiBaseUrl+"/connection/register";window.Initial_State&&window.Initial_State.calypsoEnv&&(o=o+"?"+n.param({calypso_env:window.Initial_State.calypsoEnv})),n.ajax({url:o,type:"POST",data:{registration_nonce:jpConnect.registrationNonce,_wpnonce:jpConnect.apiNonce},error:i.handleConnectionError,success:i.handleConnectionSuccess})}},triggerLoadingState:function(){var e=n("<span>").addClass("jp-connect-full__button-container-loading").text(jpConnect.buttonTextRegistering).appendTo(".jp-connect-full__button-container"),t=n("<div>").addClass("jp-spinner"),o=n("<div>").addClass("jp-spinner__outer").appendTo(t);n("<div>").addClass("jp-spinner__inner").appendTo(o),e.after(t)},handleConnectionSuccess:function(e){i.fetchPlanType(),window.addEventListener("message",i.receiveData),o.attr("src",e.authorizeUrl),o.on("load",function(){o.show(),n(".jp-connect-full__button-container").hide()}),o.hide(),n(".jp-connect-full__button-container").after(o)},fetchPlanType:function(){n.ajax({url:jpConnect.apiBaseUrl+"/site",type:"GET",data:{_wpnonce:jpConnect.apiSiteDataNonce},success:function(n){var e=JSON.parse(n.data);i.isPaidPlan=!e.plan.is_free}})},receiveData:function(n){n.origin===jpConnect.jetpackApiDomain&&n.source===o.get(0).contentWindow&&"close"===n.data&&(window.removeEventListener("message",this.receiveData),i.handleAuthorizationComplete())},handleAuthorizationComplete:function(){i.isRegistering=!1,i.isPaidPlan?window.location.assign(jpConnect.dashboardUrl):window.location.assign(jpConnect.plansPromptUrl),window.location.reload(!0)},handleConnectionError:function(n){i.isRegistering=!1,i.handleOriginalFlow()}};"setup"===location.hash.replace(/#\//,"")&&(a.length&&a.hide(),i.selectAndStartConnectionFlow())});
\ No newline at end of file +jQuery(document).ready(function(n){var e=n(".jp-connect-button, .jp-banner__alt-connect-button").eq(0),t=n(".jp-connect-full__tos-blurb"),a=n('<iframe class="jp-jetpack-connect__iframe" />'),o=n("#jetpack-connection-cards, .jp-connect-full__dismiss-paragraph");e.on("click",function(n){n.preventDefault(),o.length&&o.fadeOut(600),i.selectAndStartConnectionFlow()});var i={isRegistering:!1,isPaidPlan:!1,selectAndStartConnectionFlow:function(){var e=n("#jetpack-connection-cards");e.length&&e.fadeOut(600),i.isRegistering||("original"===jpConnect.forceVariation?i.handleOriginalFlow():"in_place"===jpConnect.forceVariation?i.handleConnectInPlaceFlow():i.startConnectionFlow())},startConnectionFlow:function(){n.ajax({url:"https://public-api.wordpress.com/wpcom/v2/abtest/jetpack_connect_in_place_v3",type:"GET",error:i.handleConnectionError,data:jpConnect.identity,xhrFields:{withCredentials:!0},crossDomain:!0,success:function(n){n&&"in_place"===n.variation?i.handleConnectInPlaceFlow():i.handleOriginalFlow()}})},handleOriginalFlow:function(){window.location=e.attr("href")},handleConnectInPlaceFlow:function(){if(e.hasClass("jp-banner__alt-connect-button"))window.location=jpConnect.connectInPlaceUrl;else{i.isRegistering=!0,t.hide(),e.hide(),i.triggerLoadingState();var a=jpConnect.apiBaseUrl+"/connection/register";window.Initial_State&&window.Initial_State.calypsoEnv&&(a=a+"?"+n.param({calypso_env:window.Initial_State.calypsoEnv})),n.ajax({url:a,type:"POST",data:{registration_nonce:jpConnect.registrationNonce,_wpnonce:jpConnect.apiNonce},error:i.handleConnectionError,success:i.handleConnectionSuccess})}},triggerLoadingState:function(){var e=n("<span>").addClass("jp-connect-full__button-container-loading").text(jpConnect.buttonTextRegistering).appendTo(".jp-connect-full__button-container"),t=n("<div>").addClass("jp-spinner"),a=n("<div>").addClass("jp-spinner__outer").appendTo(t);n("<div>").addClass("jp-spinner__inner").appendTo(a),e.after(t)},handleConnectionSuccess:function(e){i.fetchPlanType(),window.addEventListener("message",i.receiveData),a.attr("src",e.authorizeUrl),a.on("load",function(){a.show(),n(".jp-connect-full__button-container").hide()}),a.hide(),n(".jp-connect-full__button-container").after(a);var t=document.createElement("link");t.rel="preload",t.as="script",t.href=jpConnect.preFetchScript,document.head.appendChild(t)},fetchPlanType:function(){n.ajax({url:jpConnect.apiBaseUrl+"/site",type:"GET",data:{_wpnonce:jpConnect.apiSiteDataNonce},success:function(n){var e=JSON.parse(n.data);i.isPaidPlan=!e.plan.is_free}})},receiveData:function(n){n.origin===jpConnect.jetpackApiDomain&&n.source===a.get(0).contentWindow&&"close"===n.data&&(window.removeEventListener("message",this.receiveData),i.handleAuthorizationComplete())},handleAuthorizationComplete:function(){i.isRegistering=!1,i.isPaidPlan?window.location.assign(jpConnect.dashboardUrl):window.location.assign(jpConnect.plansPromptUrl),window.location.reload(!0)},handleConnectionError:function(n){i.isRegistering=!1,i.handleOriginalFlow()}};"setup"===location.hash.replace(/#\//,"")&&(o.length&&o.hide(),i.selectAndStartConnectionFlow())});
\ No newline at end of file |