From 69ee8c6a8685eddac919b2cb6fee45e529fd05fc Mon Sep 17 00:00:00 2001 From: Hannu Lyytikainen Date: Fri, 22 Nov 2019 15:30:08 +0200 Subject: [PATCH 01/29] Update API reference docs links --- src/components/BookingBreakdown/LineItemBookingPeriod.js | 2 +- src/components/BookingTimeInfo/BookingTimeInfo.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/BookingBreakdown/LineItemBookingPeriod.js b/src/components/BookingBreakdown/LineItemBookingPeriod.js index 74c4e1e44..004260def 100644 --- a/src/components/BookingBreakdown/LineItemBookingPeriod.js +++ b/src/components/BookingBreakdown/LineItemBookingPeriod.js @@ -62,7 +62,7 @@ const LineItemBookingPeriod = props => { // Attributes: displayStart and displayEnd can be used to differentiate shown time range // from actual start and end times used for availability reservation. It can help in situations // where there are preparation time needed between bookings. - // Read more: https://www.sharetribe.com/api-reference/#bookings + // Read more: https://www.sharetribe.com/api-reference/marketplace.html#bookings const { start, end, displayStart, displayEnd } = booking.attributes; const localStartDate = dateFromAPIToLocalNoon(displayStart || start); const localEndDateRaw = dateFromAPIToLocalNoon(displayEnd || end); diff --git a/src/components/BookingTimeInfo/BookingTimeInfo.js b/src/components/BookingTimeInfo/BookingTimeInfo.js index 81b3cb977..bab44d49e 100644 --- a/src/components/BookingTimeInfo/BookingTimeInfo.js +++ b/src/components/BookingTimeInfo/BookingTimeInfo.js @@ -20,7 +20,7 @@ const bookingData = (unitType, tx, isOrder, intl) => { // Attributes: displayStart and displayEnd can be used to differentiate shown time range // from actual start and end times used for availability reservation. It can help in situations // where there are preparation time needed between bookings. - // Read more: https://www.sharetribe.com/api-reference/#bookings + // Read more: https://www.sharetribe.com/api-reference/marketplace.html#bookings const { start, end, displayStart, displayEnd } = tx.booking.attributes; const startDate = dateFromAPIToLocalNoon(displayStart || start); const endDateRaw = dateFromAPIToLocalNoon(displayEnd || end); From 4b90ca5360a2a8ada230cd9497f7499a440336e6 Mon Sep 17 00:00:00 2001 From: Hannu Lyytikainen Date: Tue, 10 Dec 2019 15:07:19 +0200 Subject: [PATCH 02/29] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 686517fe5..f4332d33d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2019-XX-XX +- [fix] Update links to API Reference docs. [#1231](https://github.com/sharetribe/ftw-daily/pull/1231) + ## [v3.7.0] 2019-12-09 - [change] Make it easier to reorder EditListingWizard tabs/panels. From 3c8bc3358e57ce1553c45bd6c549954b9083ae6f Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Thu, 19 Dec 2019 09:30:50 +0200 Subject: [PATCH 03/29] Update missing props to tests related to EditListingWizard --- .../EditListingAvailabilityForm.test.js | 2 ++ .../__snapshots__/EditListingAvailabilityForm.test.js.snap | 2 ++ .../EditListingDescriptionForm.test.js | 2 ++ .../EditListingLocationForm/EditListingLocationForm.test.js | 2 ++ .../__snapshots__/EditListingLocationForm.test.js.snap | 2 ++ src/forms/EditListingPhotosForm/EditListingPhotosForm.test.js | 2 ++ .../__snapshots__/EditListingPhotosForm.test.js.snap | 1 + .../EditListingPoliciesForm/EditListingPoliciesForm.test.js | 2 ++ .../__snapshots__/EditListingPoliciesForm.test.js.snap | 2 ++ 9 files changed, 17 insertions(+) diff --git a/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.test.js b/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.test.js index bb8388e98..ede226f54 100644 --- a/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.test.js +++ b/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.test.js @@ -16,6 +16,8 @@ describe('EditListingAvailabilityForm', () => { saveActionMsg="Save rules" updated={false} updateInProgress={false} + disabled={false} + ready={false} availability={{ calendar: { // '2018-12': { diff --git a/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap b/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap index c420ea481..28bf91e23 100644 --- a/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap +++ b/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap @@ -46,6 +46,7 @@ exports[`EditListingAvailabilityForm matches snapshot 1`] = ` "type": "availability-plan/day", } } + disabled={false} dispatch={[Function]} intl={ Object { @@ -60,6 +61,7 @@ exports[`EditListingAvailabilityForm matches snapshot 1`] = ` } } onSubmit={[Function]} + ready={false} render={[Function]} saveActionMsg="Save rules" updateError={null} diff --git a/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.test.js b/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.test.js index 30ade1377..8ed278aef 100644 --- a/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.test.js +++ b/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.test.js @@ -15,6 +15,8 @@ describe('EditListingDescriptionForm', () => { saveActionMsg="Save description" updated={false} updateInProgress={false} + disabled={false} + ready={false} categories={[{ key: 'cat1', label: 'Cat 1' }, { key: 'cat2', label: 'Cat 2' }]} /> ); diff --git a/src/forms/EditListingLocationForm/EditListingLocationForm.test.js b/src/forms/EditListingLocationForm/EditListingLocationForm.test.js index a97b5e0b3..28832ad9f 100644 --- a/src/forms/EditListingLocationForm/EditListingLocationForm.test.js +++ b/src/forms/EditListingLocationForm/EditListingLocationForm.test.js @@ -16,6 +16,8 @@ describe('EditListingLocationForm', () => { saveActionMsg="Save location" updated={false} updateInProgress={false} + disabled={false} + ready={false} /> ); expect(tree).toMatchSnapshot(); diff --git a/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap b/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap index 042fcfb62..055452644 100644 --- a/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap +++ b/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap @@ -2,6 +2,7 @@ exports[`EditListingLocationForm matches snapshot 1`] = ` { updated={false} ready={false} updateInProgress={false} + disabled={false} + ready={false} onRemoveImage={noop} /> ); diff --git a/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap b/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap index 029cb95e7..b5edb5e47 100644 --- a/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap +++ b/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap @@ -2,6 +2,7 @@ exports[`EditListingPhotosForm matches snapshot 1`] = ` { saveActionMsg="Save rules" updated={false} updateInProgress={false} + disabled={false} + ready={false} /> ); expect(tree).toMatchSnapshot(); diff --git a/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap b/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap index 6b703bb3c..0a0bbd714 100644 --- a/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap +++ b/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap @@ -2,6 +2,7 @@ exports[`EditListingPoliciesForm matches snapshot 1`] = ` Date: Thu, 19 Dec 2019 09:32:02 +0200 Subject: [PATCH 04/29] Update changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4332d33d..c8380a3a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,10 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2019-XX-XX -- [fix] Update links to API Reference docs. [#1231](https://github.com/sharetribe/ftw-daily/pull/1231) +- [fix] Add missing props to tests related to EditListingWizard + [#1246](https://github.com/sharetribe/ftw-daily/pull/1246) +- [fix] Update links to API Reference docs. + [#1231](https://github.com/sharetribe/ftw-daily/pull/1231) ## [v3.7.0] 2019-12-09 From e21cc48a26c7cfd59a47e04fcb5354d51dc60e55 Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Thu, 19 Dec 2019 09:41:01 +0200 Subject: [PATCH 05/29] Update examples --- .../EditListingAvailabilityForm.example.js | 2 ++ .../EditListingDescriptionForm.example.js | 2 ++ .../EditListingFeaturesForm/EditListingFeaturesForm.example.js | 2 ++ .../EditListingLocationForm/EditListingLocationForm.example.js | 2 ++ .../EditListingPhotosForm/EditListingPhotosForm.example.js | 1 + .../EditListingPoliciesForm/EditListingPoliciesForm.example.js | 2 ++ .../EditListingPricingForm/EditListingPricingForm.example.js | 2 ++ src/forms/EditListingPricingForm/EditListingPricingForm.test.js | 2 ++ 8 files changed, 15 insertions(+) diff --git a/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.example.js b/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.example.js index b21d9bf0a..ce49e5a00 100644 --- a/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.example.js +++ b/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.example.js @@ -10,6 +10,8 @@ export const Empty = { saveActionMsg: 'Save rules', updated: false, updateInProgress: false, + disabled: false, + ready: false, availability: { calendar: { // '2018-12': { diff --git a/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.example.js b/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.example.js index cd92b871c..d316fdf72 100644 --- a/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.example.js +++ b/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.example.js @@ -10,6 +10,8 @@ export const Empty = { saveActionMsg: 'Save description', updated: false, updateInProgress: false, + disabled: false, + ready: false, }, group: 'forms', }; diff --git a/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.example.js b/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.example.js index a0e336070..16d8f44e0 100644 --- a/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.example.js +++ b/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.example.js @@ -14,6 +14,8 @@ export const Amenities = { saveActionMsg: 'Save amenities', updated: false, updateInProgress: false, + disabled: false, + ready: false, }, group: 'forms', }; diff --git a/src/forms/EditListingLocationForm/EditListingLocationForm.example.js b/src/forms/EditListingLocationForm/EditListingLocationForm.example.js index 000005df3..0b2006c69 100644 --- a/src/forms/EditListingLocationForm/EditListingLocationForm.example.js +++ b/src/forms/EditListingLocationForm/EditListingLocationForm.example.js @@ -10,6 +10,8 @@ export const Empty = { saveActionMsg: 'Save location', updated: false, updateInProgress: false, + disabled: false, + ready: false, }, group: 'forms', }; diff --git a/src/forms/EditListingPhotosForm/EditListingPhotosForm.example.js b/src/forms/EditListingPhotosForm/EditListingPhotosForm.example.js index 3128ecf74..b185f449b 100644 --- a/src/forms/EditListingPhotosForm/EditListingPhotosForm.example.js +++ b/src/forms/EditListingPhotosForm/EditListingPhotosForm.example.js @@ -16,6 +16,7 @@ export const Empty = { updated: false, ready: false, updateInProgress: false, + disabled: false, onUpdateImageOrder: imageOrder => { console.log('onUpdateImageOrder with new imageOrder:', imageOrder); }, diff --git a/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.example.js b/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.example.js index d3b06e0eb..049c245e9 100644 --- a/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.example.js +++ b/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.example.js @@ -11,6 +11,8 @@ export const Empty = { saveActionMsg: 'Save rules', updated: false, updateInProgress: false, + disabled: false, + ready: false, }, group: 'forms', }; diff --git a/src/forms/EditListingPricingForm/EditListingPricingForm.example.js b/src/forms/EditListingPricingForm/EditListingPricingForm.example.js index 19ce0d568..89602c101 100644 --- a/src/forms/EditListingPricingForm/EditListingPricingForm.example.js +++ b/src/forms/EditListingPricingForm/EditListingPricingForm.example.js @@ -10,6 +10,8 @@ export const Empty = { saveActionMsg: 'Save price', updated: false, updateInProgress: false, + disabled: false, + ready: false, }, group: 'forms', }; diff --git a/src/forms/EditListingPricingForm/EditListingPricingForm.test.js b/src/forms/EditListingPricingForm/EditListingPricingForm.test.js index d79355028..a5c0e4a51 100644 --- a/src/forms/EditListingPricingForm/EditListingPricingForm.test.js +++ b/src/forms/EditListingPricingForm/EditListingPricingForm.test.js @@ -15,6 +15,8 @@ describe('EditListingPricingForm', () => { saveActionMsg="Save price" updated={false} updateInProgress={false} + disabled={false} + ready={false} /> ); expect(tree).toMatchSnapshot(); From 41da35157ee614951846a01db6a65b21bf73cfdc Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Thu, 19 Dec 2019 09:41:52 +0200 Subject: [PATCH 06/29] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8380a3a9..5aeec3da6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2019-XX-XX +- [fix] Add missing props to examples related to EditListingWizard + [#1247](https://github.com/sharetribe/ftw-daily/pull/1247) - [fix] Add missing props to tests related to EditListingWizard [#1246](https://github.com/sharetribe/ftw-daily/pull/1246) - [fix] Update links to API Reference docs. From e40de5a75fd6d800557ae0cbb6bcdf114a330850 Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Thu, 28 Nov 2019 15:43:33 +0200 Subject: [PATCH 07/29] Create StripePayoutPage --- .../StripePayoutPage/StripePayoutPage.css | 27 +++ .../StripePayoutPage/StripePayoutPage.duck.js | 68 +++++++ .../StripePayoutPage/StripePayoutPage.js | 131 ++++++++++++++ .../StripePayoutPage/StripePayoutPage.test.js | 69 ++++++++ .../StripePayoutPage.test.js.snap | 167 ++++++++++++++++++ src/translations/en.json | 5 + 6 files changed, 467 insertions(+) create mode 100644 src/containers/StripePayoutPage/StripePayoutPage.css create mode 100644 src/containers/StripePayoutPage/StripePayoutPage.duck.js create mode 100644 src/containers/StripePayoutPage/StripePayoutPage.js create mode 100644 src/containers/StripePayoutPage/StripePayoutPage.test.js create mode 100644 src/containers/StripePayoutPage/__snapshots__/StripePayoutPage.test.js.snap diff --git a/src/containers/StripePayoutPage/StripePayoutPage.css b/src/containers/StripePayoutPage/StripePayoutPage.css new file mode 100644 index 000000000..b16ae38a7 --- /dev/null +++ b/src/containers/StripePayoutPage/StripePayoutPage.css @@ -0,0 +1,27 @@ +@import '../../marketplace.css'; + +.content { + @media (--viewportMedium) { + margin: 32px auto 0 auto; + max-width: 564px; + } + + @media (--viewportLarge) { + margin: 0; + } +} + +.desktopTopbar, +.mobileTopbar { + box-shadow: none; +} + +.title { + hyphens: auto; + margin-top: 8px; + margin-bottom: 19px; + + @media (--viewportMedium) { + margin-bottom: 47px; + } +} diff --git a/src/containers/StripePayoutPage/StripePayoutPage.duck.js b/src/containers/StripePayoutPage/StripePayoutPage.duck.js new file mode 100644 index 000000000..9befc20a5 --- /dev/null +++ b/src/containers/StripePayoutPage/StripePayoutPage.duck.js @@ -0,0 +1,68 @@ +import { createStripeAccount } from '../../ducks/stripe.duck'; +import { fetchCurrentUser } from '../../ducks/user.duck'; + +// ================ Action types ================ // + +export const SET_INITIAL_STATE = 'app/StripePayoutPage/SET_INITIAL_STATE'; +export const SAVE_PAYOUT_DETAILS_REQUEST = 'app/StripePayoutPage/SAVE_PAYOUT_DETAILS_REQUEST'; +export const SAVE_PAYOUT_DETAILS_SUCCESS = 'app/StripePayoutPage/SAVE_PAYOUT_DETAILS_SUCCESS'; +export const SAVE_PAYOUT_DETAILS_ERROR = 'app/StripePayoutPage/SAVE_PAYOUT_DETAILS_ERROR'; + +// ================ Reducer ================ // + +const initialState = { + payoutDetailsSaveInProgress: false, + payoutDetailsSaved: false, +}; + +export default function payoutPreferencesPageReducer(state = initialState, action = {}) { + const { type } = action; + switch (type) { + case SET_INITIAL_STATE: + return initialState; + + case SAVE_PAYOUT_DETAILS_REQUEST: + return { ...state, payoutDetailsSaveInProgress: true }; + case SAVE_PAYOUT_DETAILS_ERROR: + return { ...state, payoutDetailsSaveInProgress: false }; + case SAVE_PAYOUT_DETAILS_SUCCESS: + return { ...state, payoutDetailsSaveInProgress: false, payoutDetailsSaved: true }; + + default: + return state; + } +} + +// ================ Action creators ================ // + +export const setInitialState = () => ({ + type: SET_INITIAL_STATE, +}); + +export const savePayoutDetailsRequest = () => ({ + type: SAVE_PAYOUT_DETAILS_REQUEST, +}); +export const savePayoutDetailsError = () => ({ + type: SAVE_PAYOUT_DETAILS_ERROR, +}); +export const savePayoutDetailsSuccess = () => ({ + type: SAVE_PAYOUT_DETAILS_SUCCESS, +}); + +// ================ Thunks ================ // + +export const savePayoutDetails = values => (dispatch, getState, sdk) => { + dispatch(savePayoutDetailsRequest()); + + return dispatch(createStripeAccount(values)) + .then(() => dispatch(savePayoutDetailsSuccess())) + .catch(() => dispatch(savePayoutDetailsError())); +}; + +export const loadData = () => (dispatch, getState, sdk) => { + // Clear state so that previously loaded data is not visible + // in case this page load fails. + dispatch(setInitialState()); + + return dispatch(fetchCurrentUser()); +}; diff --git a/src/containers/StripePayoutPage/StripePayoutPage.js b/src/containers/StripePayoutPage/StripePayoutPage.js new file mode 100644 index 000000000..fb32c8399 --- /dev/null +++ b/src/containers/StripePayoutPage/StripePayoutPage.js @@ -0,0 +1,131 @@ +import React from 'react'; +import { bool, func } from 'prop-types'; +import { compose } from 'redux'; +import { connect } from 'react-redux'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; +import { ensureCurrentUser } from '../../util/data'; +import { propTypes } from '../../util/types'; +import { isScrollingDisabled } from '../../ducks/UI.duck'; +import { stripeAccountClearError } from '../../ducks/stripe.duck'; +import { + LayoutSideNavigation, + LayoutWrapperMain, + LayoutWrapperAccountSettingsSideNav, + LayoutWrapperTopbar, + LayoutWrapperFooter, + Footer, + Page, + UserNav, +} from '../../components'; +import { TopbarContainer } from '..'; +import { savePayoutDetails, loadData } from './StripePayoutPage.duck'; + +import css from './StripePayoutPage.css'; + +export const StripePayoutPageComponent = props => { + const { + currentUser, + scrollingDisabled, + // createStripeAccountError, + // onPayoutDetailsFormChange, + // onPayoutDetailsFormSubmit, + // payoutDetailsSaveInProgress, + // payoutDetailsSaved, + intl, + } = props; + + const ensuredCurrentUser = ensureCurrentUser(currentUser); + const currentUserLoaded = !!ensuredCurrentUser.id; + const stripeConnected = + currentUserLoaded && + !!ensuredCurrentUser.stripeAccount && + !!ensuredCurrentUser.stripeAccount.id; + + const title = intl.formatMessage({ id: 'StripePayoutPage.title' }); + + let message = ; + + if (currentUserLoaded && stripeConnected) { + message =

TODO: show edit verification information

; + } else if (currentUserLoaded && !stripeConnected) { + message = ; + } + + const form =

TODO: Connect Onboarding flow

; + return ( + + + + + + + + +
+

+ +

+ {message} + {form} +
+
+ +