Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purchases: Rename constants for upgrade actions to be more consistent #1253

Merged
merged 22 commits into from
Dec 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8255f5c
Domains: Order upgrade action constants alphabetically
stephanethomas Dec 3, 2015
b32b799
Domains: Rename constant for resent ICANN verification action to be m…
stephanethomas Dec 3, 2015
97ebc28
Checkout: Rename constant for add cart item action to be more consistent
stephanethomas Dec 3, 2015
56addeb
Checkout: Rename constant for remove cart item action to be more cons…
stephanethomas Dec 3, 2015
417c357
Checkout: Rename constant for apply cart coupon action to be more con…
stephanethomas Dec 3, 2015
c685e45
Checkout: Rename constant for close cart popup action to be more cons…
stephanethomas Dec 3, 2015
2d10394
Checkout: Rename constant for open cart popup action to be more consi…
stephanethomas Dec 3, 2015
32ceb33
Checkout: Rename constant for add privacy protection to cart action t…
stephanethomas Dec 3, 2015
51a8238
Checkout: Rename constant for remove privacy protection to cart actio…
stephanethomas Dec 3, 2015
1d75a89
Purchases: Remove unused constant for receive site upgrades action
stephanethomas Dec 3, 2015
8b29211
Domains: Rename constant for add DNS action to be more consistent
stephanethomas Dec 3, 2015
b34434d
Domains: Rename constant for delete DNS action to be more consistent
stephanethomas Dec 3, 2015
7be02b9
Domains: Rename constants for fetch DNS actions to be more consistent
stephanethomas Dec 3, 2015
cc9478b
Domains: Rename constant for enable domain locking action to be more …
stephanethomas Dec 3, 2015
94b5cad
Domains: Rename constant for enable privacy protection action to be m…
stephanethomas Dec 3, 2015
ec4d573
Domains: Rename constants for fetch Google Apps users actions to be m…
stephanethomas Dec 3, 2015
9eb5cea
Purchases: Rename constants for cancel privacy protection action to b…
stephanethomas Dec 3, 2015
f240960
Checkout: Rename constant for set transaction step action to be more …
stephanethomas Dec 3, 2015
150dde3
Checkout: Rename constant for reset transaction action to be more con…
stephanethomas Dec 3, 2015
40df408
Checkout: Rename constant for set domain details in transaction actio…
stephanethomas Dec 3, 2015
4430a6f
Checkout: Rename constant for set new credit card details in transact…
stephanethomas Dec 3, 2015
451f44a
Checkout: Rename constant for set payment in transaction action to be…
stephanethomas Dec 3, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/lib/cart/store/cart-synchronizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ CartSynchronizer.prototype.handleDispatch = function( payload ) {
var action = payload.action,
step;

if ( action.type !== upgradesActionTypes.TRANSACTION_STEP ) {
if ( action.type !== upgradesActionTypes.TRANSACTION_STEP_SET ) {
return;
}

Expand Down
10 changes: 5 additions & 5 deletions client/lib/cart/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,23 @@ CartStore.dispatchToken = Dispatcher.register( function( payload ) {
}

switch ( action.type ) {
case UpgradesActionTypes.ADD_PRIVACY_TO_ALL_DOMAIN_CART_ITEMS:
case UpgradesActionTypes.CART_PRIVACY_PROTECTION_ADD:
update( cartItems.addPrivacyToAllDomains( CartStore.get() ) );
break;

case UpgradesActionTypes.REMOVE_PRIVACY_FROM_ALL_DOMAIN_CART_ITEMS:
case UpgradesActionTypes.CART_PRIVACY_PROTECTION_REMOVE:
update( cartItems.removePrivacyFromAllDomains( CartStore.get() ) );
break;

case UpgradesActionTypes.ADD_CART_ITEM:
case UpgradesActionTypes.CART_ITEM_ADD:
update( cartItems.add( cartItem ) );
break;

case UpgradesActionTypes.APPLY_CART_COUPON:
case UpgradesActionTypes.CART_COUPON_APPLY:
update( applyCoupon( action.coupon ) );
break;

case UpgradesActionTypes.REMOVE_CART_ITEM:
case UpgradesActionTypes.CART_ITEM_REMOVE:
update( cartItems.removeItemAndDependencies( cartItem, CartStore.get() ) );
break;
}
Expand Down
8 changes: 4 additions & 4 deletions client/lib/domains/dns/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ function reducer( state, payload ) {
const { action } = payload;

switch ( action.type ) {
case ActionTypes.DELETING_DNS:
case ActionTypes.DNS_DELETE:
if ( ! action.error ) {
state = deleteDns( state, action.domainName, action.record );
}
break;

case ActionTypes.ADD_DNS:
case ActionTypes.DNS_ADD_COMPLETED:
if ( ! action.error ) {
state = addDns( state, action.domainName, action.record );
}
break;
case ActionTypes.FETCH_DNS:
case ActionTypes.DNS_FETCH:
if ( ! state[ action.domainName ] ) {
state = updateDomainState( state, action.domainName, {
hasLoadedFromServer: false
} );
}
break;
case ActionTypes.RECEIVE_DNS:
case ActionTypes.DNS_FETCH_COMPLETED:
state = updateDomainState( state, action.domainName, {
records: action.records,
hasLoadedFromServer: true
Expand Down
2 changes: 1 addition & 1 deletion client/lib/domains/google-apps-users/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function reducer( state, payload ) {
const { action } = payload;

switch ( action.type ) {
case ActionTypes.RECEIVE_GOOGLE_APPS_USERS:
case ActionTypes.GOOGLE_APPS_USERS_FETCH_COMPLETED:
state = updateState( state, action.domainName, {
hasLoadedFromServer: true,
value: action.users
Expand Down
2 changes: 1 addition & 1 deletion client/lib/domains/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function reducer( state, payload ) {
settingPrimaryDomain: false
} );

case UpgradesActionTypes.DOMAIN_ENABLE_PRIVACY_PROTECTION_COMPLETED:
case UpgradesActionTypes.PRIVACY_PROTECTION_ENABLE_COMPLETED:
return updateDomainState( state, action.siteId, action.domainName, {
privateDomain: true
} );
Expand Down
4 changes: 2 additions & 2 deletions client/lib/domains/wapi-domain-info/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ function reducer( state, payload ) {
needsUpdate: true
} );

case UpgradesActionTypes.DOMAIN_ENABLE_LOCKING_COMPLETED:
case UpgradesActionTypes.DOMAIN_LOCKING_ENABLE_COMPLETED:
return updateDomainState( state, action.domainName, {
data: Object.assign( {}, state[ action.domainName ].data, {
locked: true,
pendingTransfer: false
} )
} );

case UpgradesActionTypes.DOMAIN_ENABLE_PRIVACY_PROTECTION_COMPLETED:
case UpgradesActionTypes.PRIVACY_PROTECTION_ENABLE_COMPLETED:
return updateDomainState( state, action.domainName, {
data: Object.assign( {}, state[ action.domainName ].data, {
pendingTransfer: false
Expand Down
4 changes: 2 additions & 2 deletions client/lib/purchases/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ const PurchasesStore = createReducerStore( ( state, payload ) => {
case ActionTypes.PURCHASES_USER_FETCH_FAILED:
return assign( {}, state, { error: action.error } );

case ActionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL_COMPLETED:
case ActionTypes.PRIVACY_PROTECTION_CANCEL_COMPLETED:
return updatePurchaseById( state, action.purchase.id, action.purchase );

case ActionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL_FAILED:
case ActionTypes.PRIVACY_PROTECTION_CANCEL_FAILED:
return updatePurchaseById( state, action.purchaseId, {
error: action.error
} );
Expand Down
6 changes: 3 additions & 3 deletions client/lib/purchases/test/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe( 'Purchases Store', () => {

it( 'should return an object with original purchase when cancelation of private registration is triggered', () => {
Dispatcher.handleServerAction( {
type: actionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL,
type: actionTypes.PRIVACY_PROTECTION_CANCEL,
purchaseId: 2
} );

Expand All @@ -80,7 +80,7 @@ describe( 'Purchases Store', () => {

it( 'should return an object with original purchase and error message when cancelation of private registration failed', () => {
Dispatcher.handleServerAction( {
type: actionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL_FAILED,
type: actionTypes.PRIVACY_PROTECTION_CANCEL_FAILED,
error: 'Unable to fetch stored cards',
purchaseId: 2
} );
Expand All @@ -98,7 +98,7 @@ describe( 'Purchases Store', () => {

it( 'should return an object with updated purchase when cancelation of private registration completed', () => {
Dispatcher.handleServerAction( {
type: actionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL_COMPLETED,
type: actionTypes.PRIVACY_PROTECTION_CANCEL_COMPLETED,
purchase: {
amount: 2200,
error: null,
Expand Down
12 changes: 6 additions & 6 deletions client/lib/transaction/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,30 +76,30 @@ TransactionStore.dispatchToken = Dispatcher.register( function( payload ) {
var action = payload.action;

switch ( action.type ) {
case UpgradesActionTypes.SET_TRANSACTION_DOMAIN_DETAILS:
case UpgradesActionTypes.TRANSACTION_DOMAIN_DETAILS_SET:
setDomainDetails( action.domainDetails );
break;

case UpgradesActionTypes.SET_TRANSACTION_PAYMENT:
case UpgradesActionTypes.TRANSACTION_PAYMENT_SET:
setPayment( action.payment );
break;

case UpgradesActionTypes.SET_TRANSACTION_NEW_CREDIT_CARD_DETAILS:
case UpgradesActionTypes.TRANSACTION_NEW_CREDIT_CARD_DETAILS_SET:
setNewCreditCardDetails( {
rawDetails: action.rawDetails,
maskedDetails: action.maskedDetails
} );
break;

case UpgradesActionTypes.TRANSACTION_STEP:
case UpgradesActionTypes.TRANSACTION_STEP_SET:
setStep( action.step );
break;

case UpgradesActionTypes.RESET_TRANSACTION:
case UpgradesActionTypes.TRANSACTION_RESET:
reset();
break;

case UpgradesActionTypes.REMOVE_CART_ITEM:
case UpgradesActionTypes.CART_ITEM_REMOVE:
Dispatcher.waitFor( [ CartStore.dispatchToken ] );

if ( ! cartItems.hasDomainRegistration( CartStore.get() ) && hasDomainDetails( TransactionStore.get() ) ) {
Expand Down
14 changes: 7 additions & 7 deletions client/lib/upgrades/actions/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ import 'lib/cart/store';

function openCartPopup( options ) {
Dispatcher.handleViewAction( {
type: ActionTypes.OPEN_CART_POPUP,
type: ActionTypes.CART_POPUP_OPEN,
options: options || {}
} );
}

function closeCartPopup() {
Dispatcher.handleViewAction( {
type: ActionTypes.CLOSE_CART_POPUP
type: ActionTypes.CART_POPUP_CLOSE
} );
}

function addPrivacyToAllDomains() {
Dispatcher.handleViewAction( {
type: ActionTypes.ADD_PRIVACY_TO_ALL_DOMAIN_CART_ITEMS
type: ActionTypes.CART_PRIVACY_PROTECTION_ADD
} );
}

function removePrivacyFromAllDomains() {
Dispatcher.handleViewAction( {
type: ActionTypes.REMOVE_PRIVACY_FROM_ALL_DOMAIN_CART_ITEMS
type: ActionTypes.CART_PRIVACY_PROTECTION_REMOVE
} );
}

Expand All @@ -46,14 +46,14 @@ function addItem( cartItem ) {
newCartItem = assign( {}, cartItem, { extra } );

Dispatcher.handleViewAction( {
type: ActionTypes.ADD_CART_ITEM,
type: ActionTypes.CART_ITEM_ADD,
cartItem: newCartItem
} );
}

function removeItem( cartItem ) {
Dispatcher.handleViewAction( {
type: ActionTypes.REMOVE_CART_ITEM,
type: ActionTypes.CART_ITEM_REMOVE,
cartItem
} );
}
Expand All @@ -74,7 +74,7 @@ function removeDomainFromCart( domainSuggestion ) {

function applyCoupon( coupon ) {
Dispatcher.handleViewAction( {
type: ActionTypes.APPLY_CART_COUPON,
type: ActionTypes.CART_COUPON_APPLY,
coupon
} );
}
Expand Down
10 changes: 5 additions & 5 deletions client/lib/upgrades/actions/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import storeTransactions from 'lib/store-transactions';

function setDomainDetails( domainDetails ) {
Dispatcher.handleViewAction( {
type: ActionTypes.SET_TRANSACTION_DOMAIN_DETAILS,
type: ActionTypes.TRANSACTION_DOMAIN_DETAILS_SET,
domainDetails
} );
}

function setPayment( payment ) {
Dispatcher.handleViewAction( {
type: ActionTypes.SET_TRANSACTION_PAYMENT,
type: ActionTypes.TRANSACTION_PAYMENT_SET,
payment
} );
}
Expand All @@ -23,7 +23,7 @@ function setNewCreditCardDetails( options ) {
const { rawDetails, maskedDetails } = options;

Dispatcher.handleViewAction( {
type: ActionTypes.SET_TRANSACTION_NEW_CREDIT_CARD_DETAILS,
type: ActionTypes.TRANSACTION_NEW_CREDIT_CARD_DETAILS_SET,
rawDetails,
maskedDetails
} );
Expand All @@ -38,15 +38,15 @@ function submitTransaction( { cart, transaction } ) {

steps.on( 'data', ( step ) => {
Dispatcher.handleViewAction( {
type: ActionTypes.TRANSACTION_STEP,
type: ActionTypes.TRANSACTION_STEP_SET,
step
} );
} );
}

function resetTransaction() {
Dispatcher.handleViewAction( {
type: ActionTypes.RESET_TRANSACTION
type: ActionTypes.TRANSACTION_RESET
} );
}

Expand Down
18 changes: 9 additions & 9 deletions client/lib/upgrades/actions/domain-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ function updateWhois( domainName, contactInformation, onComplete ) {

function fetchDns( domainName ) {
Dispatcher.handleViewAction( {
type: ActionTypes.FETCH_DNS,
type: ActionTypes.DNS_FETCH,
domainName
} );

wpcom.fetchDns( domainName, ( error, data ) => {
Dispatcher.handleServerAction( {
type: ActionTypes.RECEIVE_DNS,
type: ActionTypes.DNS_FETCH_COMPLETED,
records: data && data.records,
domainName,
error
Expand All @@ -210,7 +210,7 @@ function fetchDns( domainName ) {
function addDns( domainName, record, onComplete ) {
wpcom.addDns( domainName, record, ( error ) => {
Dispatcher.handleServerAction( {
type: ActionTypes.ADD_DNS,
type: ActionTypes.DNS_ADD_COMPLETED,
domainName,
record,
error
Expand All @@ -222,7 +222,7 @@ function addDns( domainName, record, onComplete ) {

function deleteDns( domainName, record, onComplete ) {
Dispatcher.handleViewAction( {
type: ActionTypes.DELETING_DNS,
type: ActionTypes.DNS_DELETE,
domainName,
record
} );
Expand Down Expand Up @@ -282,7 +282,7 @@ function resendIcannVerification( domainName, onComplete ) {
wpcom.resendIcannVerification( domainName, ( error ) => {
if ( ! error ) {
Dispatcher.handleServerAction( {
type: ActionTypes.RESEND_ICANN_VERIFICATION,
type: ActionTypes.ICANN_VERIFICATION_RESEND_COMPLETED,
domainName
} );
}
Expand All @@ -293,7 +293,7 @@ function resendIcannVerification( domainName, onComplete ) {

function fetchGoogleAppsUsers( domainName ) {
Dispatcher.handleViewAction( {
type: ActionTypes.FETCH_GOOGLE_APPS_USERS,
type: ActionTypes.GOOGLE_APPS_USERS_FETCH,
domainName
} );

Expand All @@ -304,7 +304,7 @@ function fetchGoogleAppsUsers( domainName ) {
}

Dispatcher.handleServerAction( {
type: ActionTypes.RECEIVE_GOOGLE_APPS_USERS,
type: ActionTypes.GOOGLE_APPS_USERS_FETCH_COMPLETED,
domainName,
users: googleAppsUsersAssembler.createDomainObject( data )
} );
Expand Down Expand Up @@ -443,7 +443,7 @@ function enableDomainLocking( domainName, onComplete ) {
}

Dispatcher.handleServerAction( {
type: ActionTypes.DOMAIN_ENABLE_LOCKING_COMPLETED,
type: ActionTypes.DOMAIN_LOCKING_ENABLE_COMPLETED,
domainName
} );

Expand All @@ -459,7 +459,7 @@ function enablePrivacyProtection( { siteId, domainName }, onComplete ) {
}

Dispatcher.handleServerAction( {
type: ActionTypes.DOMAIN_ENABLE_PRIVACY_PROTECTION_COMPLETED,
type: ActionTypes.PRIVACY_PROTECTION_ENABLE_COMPLETED,
siteId,
domainName
} );
Expand Down
6 changes: 3 additions & 3 deletions client/lib/upgrades/actions/purchases.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function cancelPurchase( purchaseId, onComplete ) {

function cancelPrivateRegistration( purchaseId, onComplete ) {
Dispatcher.handleViewAction( {
type: ActionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL,
type: ActionTypes.PRIVACY_PROTECTION_CANCEL,
purchaseId
} );

Expand All @@ -40,12 +40,12 @@ function cancelPrivateRegistration( purchaseId, onComplete ) {

if ( success ) {
Dispatcher.handleServerAction( {
type: ActionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL_COMPLETED,
type: ActionTypes.PRIVACY_PROTECTION_CANCEL_COMPLETED,
purchase: purchasesAssembler.createPurchaseObject( data.upgrade )
} );
} else {
Dispatcher.handleServerAction( {
type: ActionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL_FAILED,
type: ActionTypes.PRIVACY_PROTECTION_CANCEL_FAILED,
purchaseId,
error: error.message || i18n.translate( 'There was a problem canceling this private registration. Please try again later or contact support.' )
} );
Expand Down
Loading