Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
feat: Integrating the quote (#258)
Browse files Browse the repository at this point in the history
* feat: adding the barebones of the quote

* feat: adding more details for the quote and updating naming

* feat: redux state for quote inprogress

* feat: redux state for quote inprogress

* feat: adding more depth

* feat: created a unique id for the quotes

* feat: adding the quote creation and viewing of the newly made quote

* feat: cleaning up the code

* feat: sending messages and signing

* feat: all working need some clean up

* feat: cleaning up adding my quote list view

* feat: added the delete to the quote

* feat: cleaning up

* feat: fixed bug

* feat: after resolving changes from the conflicts updated quote to work

* feat: fixed all errors

* feat: updated according to review

* feat: updated according to review

* Update src/containers/MyQuotesList/MyQuotesList.scss

fix: removed space

Co-authored-by: Raphael Flechtner <39338561+flechtnergalani@users.noreply.github.com>

* Update src/containers/Tasks/SubmitTerms/SubmitTerms.tsx

Co-authored-by: Raphael Flechtner <39338561+flechtnergalani@users.noreply.github.com>

* refactor: changed from terms to legitimations

* refactor: accordingly changes to  review updated checks and removed code

* refactor: updated the requestforattestation quesstion

* refactor: added the date picker will check styling

* refactor: saved quote only after sending claim

* refactor: saving the agreed quote

* refactor: removed the double date pickers

* refactor: forgot to add the new dependancy

* refactor: updating naming to make it more explict

* feat: updating ui

* feat: updating ui

* feat: removing some ui changes for another ticket

* feat: updating the styling

* feat: updating the styling and hashing

* feat: updating the logic to only delete the owner of the quote

* feat: updating the logic to save claimer signature quote for claimer

* feat: updating the redux logic to have one redux action for saving

* feat: trying to solve error from styling date picker

* feat: updated the config  mini has been remov in later addition

* feat: updated the config  mini has been remov in later addition

* feat: updated the config  mini has been remov in later addition

Co-authored-by: Raphael Flechtner <39338561+flechtnergalani@users.noreply.github.com>
  • Loading branch information
Dudleyneedham and rflechtner authored Jun 29, 2020
1 parent 956e808 commit 005af0b
Show file tree
Hide file tree
Showing 45 changed files with 1,221 additions and 254 deletions.
1 change: 0 additions & 1 deletion config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ module.exports = {
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
minimize: true,
sourceMap: shouldUseSourceMap,
},
},
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"raf": "3.4.0",
"react": "^16.6.3",
"react": "^16.8.0",
"react-day-picker": "^7.4.8",
"react-dev-utils": "^5.0.2",
"react-dom": "^16.6.3",
"react-json-view": "^1.19.1",
Expand All @@ -75,6 +76,7 @@
"ts-jest": "22.0.1",
"ts-loader": "^2.3.7",
"tslib": "^1.10.0",
"types": "^0.1.1",
"url-loader": "0.6.2",
"utility-types": "^3.4.1",
"whatwg-fetch": "2.0.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
margin-bottom: 0;
}

& > div:not(.legitimations) {
& > div:not(.terms) {

& > h2,
& > .delegation {
display: none;
}
}

& .legitimations {
& .terms {

&,
& > .delegation {
Expand Down Expand Up @@ -160,7 +160,7 @@

& & {

& > .legitimations {
& > .terms {

&,
& > .attestations {
Expand Down
14 changes: 7 additions & 7 deletions src/components/AttestedClaimsListView/AttestedClaimsListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface IPossibleLabels {

interface ILabels {
default: IPossibleLabels
legitimations: IPossibleLabels
terms: IPossibleLabels
}

const LABELS: ILabels = {
Expand All @@ -29,16 +29,16 @@ const LABELS: ILabels = {
h2Multi: 'Attested claims',
h2Single: 'Attested claim',
},
legitimations: {
emptyList: 'No legitimations found.',
h2Multi: 'Legitimations',
h2Single: 'Legitimation',
terms: {
emptyList: 'No terms found.',
h2Multi: 'terms',
h2Single: 'term',
},
}

type Props = {
attestedClaims: sdk.IAttestedClaim[]
context?: 'legitimations'
context?: 'terms'
delegationId: sdk.IDelegationNode['id'] | null
currentDelegationViewType?: ViewType

Expand Down Expand Up @@ -172,7 +172,7 @@ class AttestedClaimsListView extends React.Component<Props, State> {
<AttestedClaimsListView
attestedClaims={attestedClaim.request.legitimations}
delegationId={attestedClaim.request.delegationId}
context="legitimations"
context="terms"
onToggleChildOpen={this.toggleChildOpen}
/>

Expand Down
12 changes: 6 additions & 6 deletions src/components/CTypePresentation/CTypePresentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import React, { ReactNode } from 'react'
import { Link, RouteComponentProps, withRouter } from 'react-router-dom'
import { RequestAcceptDelegationProps } from '../../containers/Tasks/RequestAcceptDelegation/RequestAcceptDelegation'
import { RequestClaimsForCTypeProps } from '../../containers/Tasks/RequestClaimsForCType/RequestClaimsForCType'
import { RequestLegitimationsProps } from '../../containers/Tasks/RequestLegitimation/RequestLegitimation'
import { RequestTermsProps } from '../../containers/Tasks/RequestTerms/RequestTerms'
import { SubmitClaimsForCTypeProps } from '../../containers/Tasks/SubmitClaimsForCType/SubmitClaimsForCType'
import { SubmitLegitimationsProps } from '../../containers/Tasks/SubmitLegitimations/SubmitLegitimations'
import { SubmitTermsProps } from '../../containers/Tasks/SubmitTerms/SubmitTerms'

import CTypeRepository from '../../services/CtypeRepository'
import * as UiState from '../../state/ducks/UiState'
Expand Down Expand Up @@ -111,11 +111,11 @@ class CTypePresentation extends React.Component<Props, State> {
objective: sdk.MessageBodyType.REQUEST_TERMS,
props: {
cTypeHash,
} as RequestLegitimationsProps,
} as RequestTermsProps,
})
)
},
label: 'Request legitimations',
label: 'Request Terms',
},
{
callback: () => {
Expand All @@ -135,11 +135,11 @@ class CTypePresentation extends React.Component<Props, State> {
objective: sdk.MessageBodyType.SUBMIT_TERMS,
props: {
claim: { cTypeHash },
} as SubmitLegitimationsProps,
} as SubmitTermsProps,
})
)
},
label: 'Submit legitimations',
label: 'Submit Terms',
},
{
callback: () => {
Expand Down
12 changes: 6 additions & 6 deletions src/components/ContactPresentation/ContactPresentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import _ from 'lodash'
import React from 'react'
import { connect, MapStateToProps } from 'react-redux'
import { RequestAcceptDelegationProps } from '../../containers/Tasks/RequestAcceptDelegation/RequestAcceptDelegation'
import { RequestLegitimationsProps } from '../../containers/Tasks/RequestLegitimation/RequestLegitimation'
import { SubmitLegitimationsProps } from '../../containers/Tasks/SubmitLegitimations/SubmitLegitimations'
import { RequestTermsProps } from '../../containers/Tasks/RequestTerms/RequestTerms'
import { SubmitTermsProps } from '../../containers/Tasks/SubmitTerms/SubmitTerms'

import ContactRepository from '../../services/ContactRepository'
import * as Contacts from '../../state/ducks/Contacts'
Expand Down Expand Up @@ -104,11 +104,11 @@ class ContactPresentation extends React.Component<Props, State> {
objective: sdk.MessageBodyType.REQUEST_TERMS,
props: {
receiverAddresses: [address],
} as RequestLegitimationsProps,
} as RequestTermsProps,
})
)
},
label: 'Request legitimations',
label: 'Request Terms',
})

actions.push({
Expand All @@ -132,11 +132,11 @@ class ContactPresentation extends React.Component<Props, State> {
objective: sdk.MessageBodyType.SUBMIT_TERMS,
props: {
receiverAddresses: [address],
} as SubmitLegitimationsProps,
} as SubmitTermsProps,
})
)
},
label: 'Submit legitimations',
label: 'Submit Terms',
})

actions.push({
Expand Down
2 changes: 1 addition & 1 deletion src/components/CtypeListView/CtypeListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type StateProps = {
}

type OwnProps = {
onRequestLegitimation: (cType: ICTypeWithMetadata) => void
onRequestTerm: (cType: ICTypeWithMetadata) => void
}

type Props = RouteComponentProps<{}> & StateProps & OwnProps
Expand Down
24 changes: 12 additions & 12 deletions src/components/DevTools/DevTools.attestations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type UpdateCallback = (bsAttestationKey: keyof BsAttestationsPool) => void
type BsAttestationsPoolElement = {
attest: {
attesterKey: keyof BsIdentitiesPool
legitimations?: Array<keyof BsAttestationsPool>
terms?: Array<keyof BsAttestationsPool>
delegationKey?: keyof BsDelegationsPool
}
claimKey: keyof BsClaimsPool
Expand Down Expand Up @@ -152,19 +152,18 @@ class BsAttestation {
claimerIdentity: IMyIdentity
): Promise<sdk.RequestForAttestation> {
const { attest } = bsAttestationData
const { delegationKey, legitimations } = attest
const { delegationKey, terms } = attest

// resolve delegation
let delegation: IMyDelegation | undefined
if (delegationKey) {
delegation = await BsDelegation.getDelegationByKey(delegationKey)
}

// get legitimations of attester
let legitimationsFromPool: sdk.AttestedClaim[] = []
if (legitimations && Array.isArray(legitimations) && legitimations.length) {
legitimationsFromPool = await Promise.all(
legitimations.map(bsAttestationKey => {
let termsFromPool: sdk.AttestedClaim[] = []
if (terms && Array.isArray(terms) && terms.length) {
termsFromPool = await Promise.all(
terms.map(bsAttestationKey => {
const bsAttestedClaim = bsAttestedClaims[bsAttestationKey]
if (bsAttestedClaim) {
return Promise.resolve(bsAttestedClaim)
Expand All @@ -179,7 +178,7 @@ class BsAttestation {
return sdk.RequestForAttestation.fromClaimAndIdentity(
claimToAttest.claim,
claimerIdentity.identity,
legitimationsFromPool,
termsFromPool,
delegation ? delegation.id : null
)
}
Expand Down Expand Up @@ -247,7 +246,7 @@ class BsAttestation {
owner: claimerIdentity.identity.address,
}

// send request for legitimation from claimer to attester
// send request for term from claimer to attester
const requestAcceptDelegation: sdk.IRequestTerms = {
content: partialClaim,
type: sdk.MessageBodyType.REQUEST_TERMS,
Expand All @@ -258,17 +257,18 @@ class BsAttestation {
ContactRepository.getContactFromIdentity(attesterIdentity)
)

// send legitimations from attester to claimer
const submitLegitimations: sdk.ISubmitTerms = {
// send terms from attester to claimer
const submitTerms: sdk.ISubmitTerms = {
content: {
claim: partialClaim,
delegationId: attestedClaim.request.delegationId || undefined,
legitimations: attestedClaim.request.legitimations,
quote: undefined,
},
type: sdk.MessageBodyType.SUBMIT_TERMS,
}
await MessageRepository.singleSend(
submitLegitimations,
submitTerms,
attesterIdentity,
ContactRepository.getContactFromIdentity(claimerIdentity)
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/DevTools/data/attestations.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@
"delegationKey": "DRIVERS_LICENSE_2_1"
}
}
}
}
2 changes: 1 addition & 1 deletion src/components/DevTools/data/claims.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"name": "CLAIMER"
}
}
}
}
32 changes: 8 additions & 24 deletions src/components/DevTools/data/delegations.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,29 @@
"DRIVERS_LICENSE_1": {
"alias": "Driving License Authority Berlin (Delegation)",
"ownerKey": "DEPARTMENT_1",
"permissions": [
"ATTEST",
"DELEGATE"
],
"permissions": ["ATTEST", "DELEGATE"],
"children": {
"DRIVERS_LICENSE_1_1": {
"alias": "Employee 1 Berlin (Delegation)",
"ownerKey": "EMPLOYEE_1_1",
"permissions": [
"ATTEST"
]
"permissions": ["ATTEST"]
},
"DRIVERS_LICENSE_1_2": {
"alias": "Employee 2 Berlin (Delegation)",
"ownerKey": "EMPLOYEE_1_2",
"permissions": [
"ATTEST"
]
"permissions": ["ATTEST"]
}
}
},
"DRIVERS_LICENSE_2": {
"alias": "Driving License Authority Munich (Delegation)",
"ownerKey": "DEPARTMENT_2",
"permissions": [
"ATTEST",
"DELEGATE"
],
"permissions": ["ATTEST", "DELEGATE"],
"children": {
"DRIVERS_LICENSE_2_1": {
"alias": "Employee 2 Munich (Delegation)",
"ownerKey": "EMPLOYEE_2_1",
"permissions": [
"ATTEST"
]
"permissions": ["ATTEST"]
}
}
}
Expand All @@ -55,17 +43,13 @@
"IS_OFFICIAL_1": {
"alias": "Driving License Authority Berlin (Delegation)",
"ownerKey": "DEPARTMENT_1",
"permissions": [
"ATTEST"
]
"permissions": ["ATTEST"]
},
"IS_OFFICIAL_2": {
"alias": "Driving License Authority Munich (Delegation)",
"ownerKey": "DEPARTMENT_2",
"permissions": [
"ATTEST"
]
"permissions": ["ATTEST"]
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/components/DevTools/data/identities.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"EMPLOYEE_2_1": "Employee 1 of DLA Munich",
"CLAIMER": "Driver (Claimer)",
"VERIFIER": "Cop (Verifier)"
}
}
Loading

0 comments on commit 005af0b

Please sign in to comment.