mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Improve transition docs
This commit is contained in:
parent
66d859a77e
commit
5a52ccbc1f
2 changed files with 8 additions and 8 deletions
|
|
@ -374,7 +374,7 @@ export const sendMessage = (txId, message) => (dispatch, getState, sdk) => {
|
|||
const REVIEW_TX_INCLUDES = ['reviews', 'reviews.author', 'reviews.subject'];
|
||||
|
||||
// If other party has already sent a review, we need to make transition to
|
||||
// TX_TRANSITION_REVIEW_BY_<CUSTOMER/PROVIDER>_SECOND
|
||||
// TRANSITION_REVIEW_2_BY_<CUSTOMER/PROVIDER>
|
||||
const sendReviewAsSecond = (id, params, role, dispatch, sdk) => {
|
||||
const transition =
|
||||
role === CUSTOMER ? TRANSITION_REVIEW_2_BY_CUSTOMER : TRANSITION_REVIEW_2_BY_PROVIDER;
|
||||
|
|
@ -398,7 +398,7 @@ const sendReviewAsSecond = (id, params, role, dispatch, sdk) => {
|
|||
};
|
||||
|
||||
// If other party has not yet sent a review, we need to make transition to
|
||||
// TX_TRANSITION_REVIEW_BY_<CUSTOMER/PROVIDER>_FIRST
|
||||
// TRANSITION_REVIEW_1_BY_<CUSTOMER/PROVIDER>
|
||||
// However, the other party might have made the review after previous data synch point.
|
||||
// So, error is likely to happen and then we must try another state transition
|
||||
// by calling sendReviewAsSecond().
|
||||
|
|
|
|||
|
|
@ -183,9 +183,9 @@ export const TRANSITION_CANCEL = 'transition/cancel';
|
|||
// The backend will mark the transaction completed.
|
||||
export const TRANSITION_COMPLETE = 'transition/mark-delivered';
|
||||
|
||||
// Review transitions
|
||||
// Reviews are given through transaction transitions.
|
||||
// Either party (provider or customer) can be the first to give a review.
|
||||
// Reviews are given through transaction transitions. Review 1 can be
|
||||
// by provider or customer, and review 2 will be the other party of
|
||||
// the transaction.
|
||||
export const TRANSITION_REVIEW_1_BY_PROVIDER = 'transition/review-by-provider-first';
|
||||
export const TRANSITION_REVIEW_2_BY_PROVIDER = 'transition/review-by-provider-second';
|
||||
export const TRANSITION_REVIEW_1_BY_CUSTOMER = 'transition/review-by-customer-first';
|
||||
|
|
@ -194,7 +194,7 @@ export const TRANSITION_EXPIRE_CUSTOMER_REVIEW_PERIOD = 'transition/mark-reviewe
|
|||
export const TRANSITION_EXPIRE_PROVIDER_REVIEW_PERIOD = 'transition/mark-reviewed-by-provider';
|
||||
export const TRANSITION_EXPIRE_REVIEW_PERIOD = 'transition/auto-complete-without-reviews';
|
||||
|
||||
export const TX_TRANSITIONS = [
|
||||
export const TRANSITIONS = [
|
||||
TRANSITION_ACCEPT,
|
||||
TRANSITION_CANCEL,
|
||||
TRANSITION_COMPLETE,
|
||||
|
|
@ -253,7 +253,7 @@ export const txIsReviewed = tx => areReviewsCompleted(txLastTransition(tx));
|
|||
propTypes.transition = shape({
|
||||
at: instanceOf(Date).isRequired,
|
||||
by: oneOf(TX_TRANSITION_ACTORS).isRequired,
|
||||
transition: oneOf(TX_TRANSITIONS).isRequired,
|
||||
transition: oneOf(TRANSITIONS).isRequired,
|
||||
});
|
||||
|
||||
const firstReviewTransitions = [TRANSITION_REVIEW_1_BY_CUSTOMER, TRANSITION_REVIEW_1_BY_PROVIDER];
|
||||
|
|
@ -306,7 +306,7 @@ propTypes.transaction = shape({
|
|||
attributes: shape({
|
||||
createdAt: instanceOf(Date).isRequired,
|
||||
lastTransitionedAt: instanceOf(Date).isRequired,
|
||||
lastTransition: oneOf(TX_TRANSITIONS).isRequired,
|
||||
lastTransition: oneOf(TRANSITIONS).isRequired,
|
||||
|
||||
// An enquiry won't need a total sum nor a booking so these are
|
||||
// optional.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue