Skip to content

Commit

Permalink
feat: #1125: Merge master and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nphivu414 committed May 8, 2020
2 parents c35dee4 + 403e4cf commit 863268d
Show file tree
Hide file tree
Showing 89 changed files with 1,905 additions and 565 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ scripts/webpack/webpack-sass-prod/.temp/*

# jest cache
scripts/jest/.jest-cache

# credentials temp files, using in yarn scan-secrets
.temp-credentials
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
"release:prod": "lerna run --parallel release:prod",
"test": "lerna run --parallel test:ci -- --detectOpenHandles --runInBand",
"test-e2e:ci": "lerna run test-e2e:ci --stream",
"update-doc": "node --unhandled-rejections=strict ./scripts/document-update/get-release-and-create-pr.js"
"update-doc": "node --unhandled-rejections=strict ./scripts/document-update/get-release-and-create-pr.js",
"scan-secrets": "node --unhandled-rejections=strict ./scripts/utils/git-secrets.js"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && lerna run test:update-badges --stream --parallel --since HEAD && git add .",
"pre-commit": "yarn scan-secrets && lint-staged && lerna run test:update-badges --stream --parallel --since HEAD && git add .",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
Expand Down Expand Up @@ -170,6 +171,7 @@
"serve": "^11.2.0",
"serverless-plugin-ifelse": "^1.0.5",
"serverless-single-page-app-plugin": "^1.0.2",
"shelljs": "^0.8.4",
"start-server-and-test": "^1.11.0",
"style-loader": "^0.23.1",
"svelte": "^3.20.1",
Expand Down
1 change: 1 addition & 0 deletions packages/demo-site/config.example.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"API_KEY": "",
"CUSTOMER_ID": "",
"CDN_URL": "https://web-components.reapit.cloud"
}
122 changes: 5 additions & 117 deletions packages/demo-site/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf8" />
<meta name="viewport" content="width=device-width" />

<title>Web Components</title>
<title>DEMO</title>
<style>
#appointment-bookings-valuation {
float: right;
Expand All @@ -28,136 +28,24 @@
<script src="<%= CDN_URL %>/search-widget.js"></script>
<script src="<%= CDN_URL %>/appointment-bookings.js"></script>
<script src="<%= CDN_URL %>/viewing-booking.js"></script>
<script>
const variantDefault = {
// appointment-bookings's specific styles
dateCellHeaderBackgroundColor: '#ececec',
timeCellBackgroundColor: '#dfdfdf',
timeCellBackgroundColorHover: '#d3d3d3',
timeCellsContainerBackgroundColor: '#f9f9f9',
formLabelColor: '#737373',
formHrSeparatorFontColor: '#e6e6e6',
formButtonFontSize: '1.2rem',
// base
baseBackgroundColor: '#f9fbfd',
basefontSize: '16px',
basefontColor: '#12263f',
secondaryfontColor: '#1e2554',
primaryHeadingFontSize: '24px',
secondaryHeadingFontSize: '20px',
baseFontFamily: '"Roboto", sans-serif',
headingFontFamily: '"Open Sans", sans-serif',
primaryAccentColor: '#0061a8',
secondaryAccentColor: '#6c757d',
mapAccentColor: '#7bc9eb',
breakPoints: {
mobile: '',
tablet: '',
laptop: '',
desktop: '',
},
}
const variantA = {
baseBackgroundColor: '#fff',
basefontSize: '16px',
basefontColor: '#556986',
inverseFontColor: '#fff',
secondaryfontColor: '#95aac9',
primaryHeadingFontSize: '22px',
secondaryHeadingFontSize: '18px',
baseFontFamily: '"Open Sans", sans-serif',
headingFontFamily: '"Montserrat", sans-serif',
primaryAccentColor: '#887e96',
secondaryAccentColor: '#7d9d88',
mapAccentColor: '',
breakPoints: {
mobile: '',
tablet: '',
laptop: '',
desktop: '',
},
searchPlaceholder: 'e.g. London or EC1N',
}
const variantB = {
baseBackgroundColor: '#f9fbfd',
basefontSize: '14px',
basefontColor: '#12263f',
inverseFontColor: '#f9fbfd',
secondaryfontColor: '#1e2554',
primaryHeadingFontSize: '24px',
secondaryHeadingFontSize: '20px',
baseFontFamily: '"Roboto", sans-serif',
headingFontFamily: '"Open Sans", sans-serif',
primaryAccentColor: '#0061a8',
secondaryAccentColor: '#1e2554',
mapAccentColor: '#7bc9eb',
breakPoints: {
mobile: '',
tablet: '',
laptop: '',
desktop: '',
},
searchPlaceholder: 'e.g. London or EC1N',
}
const variantC = {
baseBackgroundColor: '#4C566A',
basefontSize: '14px',
basefontColor: '#fff',
inverseFontColor: '#4C566A',
secondaryfontColor: '#88C0D0',
primaryHeadingFontSize: '28px',
secondaryHeadingFontSize: '24px',
baseFontFamily: '"Open Sans", sans-serif',
headingFontFamily: '"Roboto Slab", serif',
primaryAccentColor: '#A3BE8C',
secondaryAccentColor: '##88C0D0',
mapAccentColor: '#8FBCBB',
breakPoints: {
mobile: '',
tablet: '',
laptop: '',
desktop: '',
},
searchPlaceholder: 'e.g. London or EC1N',
}
const params = new URLSearchParams(window.location.search)
const variant = params.get('variant')
switch (variant) {
case 'A':
window.theme = variantA
break
case 'B':
window.theme = variantB
break
case 'C':
window.theme = variantC
break
default:
window.theme = variantDefault
}
</script>
<script src="<%= CDN_URL %>/themes.js"></script>
<script>
ReapitSearchWidgetComponent &&
new ReapitSearchWidgetComponent({
theme: window.theme,
apiKey: '<%= API_KEY %>',
customerId: '<%= CUSTOMER_ID %>',
parentSelector: '#search-widget',
})
ReapitAppointmentBookingComponent &&
new ReapitAppointmentBookingComponent({
theme: window.theme,
apiKey: '<%= API_KEY %>',
customerId: '<%= CUSTOMER_ID %>',
parentSelector: '#appointment-bookings-valuation',
variant: 'VALUATION',
})
</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion packages/demo-site/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const compileTemplate = async () => {
CDN_URL = 'http://localhost:5000'
}

const html = template({ API_KEY: config.API_KEY, CDN_URL })
const html = template({ API_KEY: config.API_KEY, CUSTOMER_ID: config.CUSTOMER_ID, CDN_URL })

fs.mkdirSync(distDir, { recursive: true })
fs.writeFileSync(indexHtmlDir, html)
Expand Down
4 changes: 2 additions & 2 deletions packages/foundations-ts-definitions/types/platform-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ export interface ContactRoleModel {
*/
contactId?: string
/**
* The type of related entity (applicant/vendor/landlord/tenancy)
* The type of related entity (applicant/landlord/offer/tenancy/vendor)
*/
associatedType?: string
/**
Expand Down Expand Up @@ -6202,7 +6202,7 @@ export interface PagedResultContactRoleModel_ {
*/
contactId?: string
/**
* The type of related entity (applicant/vendor/landlord/tenancy)
* The type of related entity (applicant/landlord/offer/tenancy/vendor)
*/
associatedType?: string
/**
Expand Down
23 changes: 23 additions & 0 deletions packages/marketplace/src/actions/__tests__/developer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import {
developerClearData,
developerCreate,
developerSetFormState,
fetchBilling,
fetchBillingSuccess,
fetchBillingFailure,
} from '../developer'
import ActionTypes from '../../constants/action-types'
import { appsDataStub } from '../../sagas/__stubs__/apps'
import { CreateDeveloperModel } from '@reapit/foundations-ts-definitions'
import { appPermissionStub } from '@/sagas/__stubs__/app-permission'
import { billing } from '@/sagas/__stubs__/billing'

describe('developer actions', () => {
it('should create a developerLoading action', () => {
Expand Down Expand Up @@ -50,4 +54,23 @@ describe('developer actions', () => {
expect(developerSetFormState.type).toEqual(ActionTypes.DEVELOPER_SET_FORM_STATE)
expect(developerSetFormState('DONE').data).toEqual('DONE')
})

it('should create a fetchBilling action', () => {
expect(fetchBilling.type).toEqual(ActionTypes.DEVELOPER_FETCH_BILLING)
expect(fetchBilling({ dateFrom: '2020-01', dateTo: '2020-05', applicationId: ['123'] }).data).toEqual({
dateFrom: '2020-01',
dateTo: '2020-05',
applicationId: ['123'],
})
})

it('should create a fetchBillingFailure action', () => {
expect(fetchBillingSuccess.type).toEqual(ActionTypes.DEVELOPER_FETCH_BILLING_SUCCESS)
expect(fetchBillingSuccess(billing).data).toEqual(billing)
})

it('should create a fetchBillingFailure action', () => {
expect(fetchBillingFailure.type).toEqual(ActionTypes.DEVELOPER_FETCH_BILLING_FAILURE)
expect(fetchBillingFailure('error').data).toEqual('error')
})
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
requestWebhookSubcriptionData,
requestWebhookSubcriptionReceiveData,
webhookEditLoading,
createWebhook,
CreateWebhookParams,
requestWebhookData,
Expand All @@ -11,11 +10,6 @@ import ActionTypes from '../../constants/action-types'
import { webhookDataStub } from '@/sagas/__stubs__/webhook-edit'

describe('developer webhook actions', () => {
it('should create a developerWebhookLoading action', () => {
expect(webhookEditLoading.type).toEqual(ActionTypes.WEBHOOK_EDIT_LOADING)
expect(webhookEditLoading(true).data).toEqual(true)
})

it('should create a requestDeveloperWebhookData action', () => {
expect(requestWebhookSubcriptionData.type).toEqual(ActionTypes.WEBHOOK_EDIT_SUBCRIPTION_REQUEST_DATA)
})
Expand Down
13 changes: 10 additions & 3 deletions packages/marketplace/src/actions/developer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// TODO: WILL MOVE ALL DEVELOPER ACTIONS TO HERE
import { actionCreator } from '../utils/actions'
import ActionTypes from '../constants/action-types'
import { DeveloperItem, DeveloperRequestParams } from '../reducers/developer'
import { CreateDeveloperModel } from '@reapit/foundations-ts-definitions'
import { FormState } from '../types/core'
import { DeveloperItem, DeveloperRequestParams, Billing } from '../reducers/developer'
import { CreateDeveloperModel, DeveloperModel } from '@reapit/foundations-ts-definitions'
import { FormState } from '@/types/core'
import { FetchBillingParams } from '@/sagas/api'

export const developerRequestData = actionCreator<DeveloperRequestParams>(ActionTypes.DEVELOPER_REQUEST_DATA)
export const developerRequestDataFailure = actionCreator<void>(ActionTypes.DEVELOPER_REQUEST_DATA_FAILURE)
Expand All @@ -11,3 +13,8 @@ export const developerReceiveData = actionCreator<DeveloperItem | undefined>(Act
export const developerClearData = actionCreator<null>(ActionTypes.DEVELOPER_CLEAR_DATA)
export const developerCreate = actionCreator<CreateDeveloperModel>(ActionTypes.DEVELOPER_CREATE)
export const developerSetFormState = actionCreator<FormState>(ActionTypes.DEVELOPER_SET_FORM_STATE)
export const fetchMyIdentity = actionCreator<void>(ActionTypes.DEVELOPER_FETCH_MY_IDENTITY)
export const setMyIdentity = actionCreator<DeveloperModel>(ActionTypes.DEVELOPER_SET_MY_IDENTITY)
export const fetchBilling = actionCreator<FetchBillingParams>(ActionTypes.DEVELOPER_FETCH_BILLING)
export const fetchBillingSuccess = actionCreator<Billing>(ActionTypes.DEVELOPER_FETCH_BILLING_SUCCESS)
export const fetchBillingFailure = actionCreator<unknown>(ActionTypes.DEVELOPER_FETCH_BILLING_FAILURE)
5 changes: 0 additions & 5 deletions packages/marketplace/src/actions/webhook-edit-modal.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import { actionCreator } from '../utils/actions'
import ActionTypes from '../constants/action-types'
import { WebhookModal, WebhookSubscription } from '@/reducers/webhook-edit-modal'
import { StringMap } from '../../../elements/src/types/core'

export interface SubscriptionCustomersRequestParams {
AppId: string
}
export interface SubscriptionTopicsRequestParams {
applicationId: string
headers: StringMap
}

export interface FetchWebhookRequestParams {
headers: StringMap
webhookId: string
}

export interface DeleteWebhookRequestParams {
headers: StringMap
webhookId: string
}

Expand Down Expand Up @@ -52,7 +48,6 @@ export interface EditWebhookParams {
active: boolean
}

export const webhookEditLoading = actionCreator<boolean>(ActionTypes.WEBHOOK_EDIT_LOADING)
export const requestWebhookSubcriptionData = actionCreator<string>(ActionTypes.WEBHOOK_EDIT_SUBCRIPTION_REQUEST_DATA)
export const requestWebhookSubcriptionReceiveData = actionCreator<WebhookSubscription>(
ActionTypes.WEBHOOK_EDIT_SUBCRIPTION_RECEIVE_DATA,
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/actions/webhook-subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export const webhookSubscriptionsRequestData = actionCreator<string>(ActionTypes
export const webhookSubscriptionsReceiveData = actionCreator<PagedResultWebhookModel_>(
ActionTypes.WEBHOOK_SUBSCRIPTION_RECEIVE_DATA,
)
export const webhookTopicsRequestData = actionCreator<void>(ActionTypes.WEBHOOK_TOPICS_REQUEST_DATA)
export const webhookTopicsRequestData = actionCreator<string>(ActionTypes.WEBHOOK_TOPICS_REQUEST_DATA)
export const webhookTopicsReceiveData = actionCreator<PagedResultTopicModel_>(ActionTypes.WEBHOOK_TOPICS_RECEIVE_DATA)
export const setApplicationId = actionCreator<string>(ActionTypes.WEBHOOK_SET_APPLICATION_ID)
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@ exports[`DeveloperWebHooks should match a snapshot 1`] = `
<Component />
</Formik>
<Component>
<Component>
<Component
dataTest="logout-btn"
onClick={[Function]}
type="button"
variant="primary"
>
Add New Webhook
</Component>
</Component>
<Component />
</Component>
<Component
columns={
Expand All @@ -47,10 +38,12 @@ exports[`DeveloperWebHooks should match a snapshot 1`] = `
"accessor": "url",
},
Object {
"Cell": [Function],
"Header": "Topics",
"accessor": "topics",
},
Object {
"Cell": [Function],
"Header": "Customer",
"accessor": "customer",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ describe('DeveloperHome', () => {
it('should match a snapshot', () => {
const mockProps: DeveloperProps = {
developerState: {
myIdentity: {},
error: null,
billing: {
from: '',
to: '',
requestsByPeriod: [],
},
isServiceChartLoading: false,
loading: false,
isVisible: false,
developerData: {
Expand Down Expand Up @@ -52,6 +60,14 @@ describe('DeveloperHome', () => {
it('should match a snapshot', () => {
const mockProps: DeveloperProps = {
developerState: {
isServiceChartLoading: false,
myIdentity: {},
error: null,
billing: {
from: '',
to: '',
requestsByPeriod: [],
},
loading: false,
isVisible: true,
developerData: {
Expand Down
Loading

0 comments on commit 863268d

Please sign in to comment.