nl_tokens: Updates state with latest MailChimp connected plugin settings
pl_tokens: function settings ( state = { } , action ) { switch ( action . type ) { case WOOCOMMERCE_MAILCHIMP_SETTINGS_REQUEST_SUCCESS : case WOOCOMMERCE_MAILCHIMP_SETTINGS_REQUEST_FAILURE : case WOOCOMMERCE_MAILCHIMP_API_KEY_SUBMIT_SUCCESS : case WOOCOMMERCE_MAILCHIMP_STORE_INFO_SUBMIT_SUCCESS : case WOOCOMMERCE_MAILCHIMP_CAMPAIGN_DEFAULTS_SUBMIT_SUCCESS : case WOOCOMMERCE_MAILCHIMP_NEWSLETTER_SETTINGS_SUBMIT_SUCCESS : return Object . assign ( { } , state , action . settings ) ; case WOOCOMMERCE_MAILCHIMP_LISTS_REQUEST_SUCCESS : const data = { mailchimp_lists : action . lists } ; const listKeys = keys ( action . lists ) ; if ( ! state . mailchimp_list && listKeys . length > 0 ) { // Just pick first that will be shown to the user in the dropdown // We are setting mailchimp_list just in case user likes it and clicks // Continue without actually sellecting something. data . mailchimp_list = listKeys [ 0 ] ; } return Object . assign ( { } , state , data ) ; } return <mask> ; }