Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Object.assign( {}, state, { isLoading: false, lastKey: null } );
case ActionTypes.DSS_UPDATE_IMAGES:
if ( state.imageResultsByKey[ action.searchTerm ] ) {
return Object.assign( {}, state, { isLoading: false, lastKey: action.searchTerm } );
}
debug( 'tried to update dynamic-screenshots image, but no cached data found for', action.searchTerm );
return Object.assign( {}, state, { isLoading: false } );
case ActionTypes.DSS_RECEIVE_IMAGES:
const images = get( action, 'data.images', [] );
if ( images.length < 1 ) {
// TODO: notify the user of the error
debug( 'error getting dynamic-screenshots images', action );
analytics.tracks.recordEvent( 'calypso_dss_fetch_error', { searchterm: action.searchTerm } );
return Object.assign( {}, state, { isLoading: false } );
}
debug( 'saving image results for', action.searchTerm );
const imageResultsByKey = Object.assign( {}, state.imageResultsByKey, { [ action.searchTerm ]: images[0] } );
analytics.tracks.recordEvent( 'calypso_dss_fetch_images', Object.assign( {}, { searchterm: action.searchTerm }, imageResultsByKey[ action.searchTerm ] ) );
return Object.assign( {}, state, { isLoading: false, lastKey: action.searchTerm, imageResultsByKey } );
}
return state;
}, initialState );
handleSubmit() {
analytics.tracks.recordEvent( 'calypso_dss_select_theme', {
theme: this.props.themeRepoSlug,
search_term: this.props.lastSearchTerm,
} );
SignupActions.submitSignupStep( { stepName: this.props.stepName }, null, {
theme: this.props.themeRepoSlug,
images: this.props.dssImage ? [ this.props.dssImage ] : undefined
} );
this.props.goToNextStep();
},
clickPostLink: function( event ) {
var site = this.props.sites.getSite( this.props.siteId );
analytics.tracks.recordEvent( 'calypso_stats_post_click' );
event.preventDefault();
page( '/post/' + site.slug );
},
clickPostLink: function( event ) {
event.preventDefault();
analytics.tracks.recordEvent( 'calypso_stats_post_click' );
page( '/post/' + this.props.site.slug );
},
handleSubmit: function() {
var themeSlug = this.props.themeSlug;
if ( true === this.props.useHeadstart && themeSlug ) {
analytics.tracks.recordEvent( 'calypso_signup_theme_select', { theme: themeSlug, headstart: true } );
SignupActions.submitSignupStep( { stepName: this.props.stepName }, null, {
theme: 'pub/' + themeSlug,
images: undefined
} );
} else {
analytics.tracks.recordEvent( 'calypso_signup_theme_select', { theme: themeSlug, headstart: false } );
SignupActions.submitSignupStep( {
stepName: this.props.stepName,
processingMessage: this.translate( 'Adding your theme' ),
themeSlug
} );
}
this.props.goToNextStep();
},
trackClickContactSupport() {
analytics.tracks.recordEvent(
'calypso_purchases_click_contact_support',
{ product_slug: this.props.purchase.productSlug }
);
},
notices.error( error.message || this.translate( 'Unable to cancel your purchase. Please try again later or contact support.' ) );
return;
}
const purchase = getPurchase( this.props ),
purchaseName = getName( purchase );
notices.success(
this.translate( '%(purchaseName)s was successfully cancelled and refunded.', {
args: { purchaseName }
} ), { persistent: true } );
clearPurchases();
analytics.tracks.recordEvent(
'calypso_purchases_cancel_form_submit',
{ product_slug: getPurchase( this.props ).productSlug }
);
page.redirect( paths.list( this.props.selectedSite.slug ) );
},
buildPromo: function() {
var promo,
site = this.props.sites.getSite( this.props.siteId ),
queryDate = this.props.date.format( 'YYYY-MM-DD' );
analytics.tracks.recordEvent( 'calypso_stats_post_view' );
promo = (
<div>
<div>
<div></div>
</div>
<div>
<h1>{ this.translate( 'Want to learn more about how your content performs?' ) }</h1>
<p>{ this.translate( 'Attract visitors from around the globe.' ) }</p>
<button>{ this.translate( 'Write a Post' ) }</button>
</div>
</div>
);
return promo;
},
buildPromo: function() {
var content;
analytics.tracks.recordEvent( 'calypso_stats_post_view' );
content = (
<div>
<div>
<div></div>
</div>
<div>
<h1>{ this.translate( 'Want to learn more about how your content performs?' ) }</h1>
<p>{ this.translate( 'Attract new views, likes, and comments.' ) }</p>
<button>{ this.translate( 'Write a Post' ) }</button>
</div>
</div>
);
return content;
},