-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
275 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const { merge } = require('webpack-merge'); | ||
var base = require('./index.js') | ||
var devVm = require('./dev-vm.js') | ||
|
||
module.exports = merge(base, devVm, { | ||
app: { | ||
apolloBatching: false, | ||
host: 'kiva-ui.local:8888', | ||
publicPath: '/', | ||
photoPath: 'https://www.development.kiva.org/img/', | ||
graphqlUri: 'https://gateway.development.kiva.org/graphql', | ||
enableAnalytics: false, | ||
enableSnowplow: false, | ||
snowplowUri: 'events.fivetran.com/snowplow/v5qt54ocr2nm', | ||
enableGA: false, | ||
gaId: 'UA-11686022-7', // dev-vm property | ||
enableSentry: false, | ||
sentryURI: 'https://[email protected]/1201287', | ||
auth0: { | ||
loginRedirectUrls: { | ||
xOXldYg02WsLnlnn0D5xoPWI2i3aNsFD: 'https://www.development.kiva.org/authenticate?authLevel=recent', | ||
KIzjUBQjKZwMRgYSn6NvMxsUwNppwnLH: 'http://kiva-ui.local:8888/ui-login?force=true', | ||
ouGKxT4mE4wQEKqpfsHSE96c9rHXQqZF: 'http://kiva-ui.local:8888/ui-login?force=true', | ||
}, | ||
enable: true, | ||
browserCallbackUri: 'http://kiva-ui.local:8888/process-browser-auth', | ||
serverCallbackUri: 'http://kiva-ui.local:8888/process-ssr-auth', | ||
apiAudience: 'https://gateway.development.kiva.org/graphql', | ||
}, | ||
}, | ||
server: { | ||
graphqlUri: 'https://gateway.development.kiva.org/graphql', | ||
sessionUri: 'https://www.development.kiva.org/start-ui-session', | ||
memcachedEnabled: false, | ||
disableCluster: true, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ query GetGoals ($teamId: Int, $limit: Int) { | |
values { | ||
lender { | ||
id | ||
image { | ||
url | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
export const TEAM_CHALLENGE_COOKIE_NAME = 'kv-team-challenge'; | ||
|
||
const getChallengeCookieData = cookieStore => { | ||
const cookie = cookieStore.get(TEAM_CHALLENGE_COOKIE_NAME); | ||
if (cookie) { | ||
return JSON.parse(cookie); | ||
} | ||
}; | ||
|
||
/** | ||
* If team challenge cookie is present, the user has added a loan to basket from the challenge page. | ||
* In that case, append the team info to the list of teams and attribute this loan to that team. | ||
* | ||
* @param cookieStore The object for affecting cookies | ||
* @param loanId The ID of the loan to check | ||
* @param combinedTeams The combined team list for the loan | ||
* @param appendedTeams The extra teams added to the loan | ||
* @returns The team ID possibly forced for the loan | ||
*/ | ||
export const getForcedTeamId = (cookieStore, loanId, combinedTeams, appendedTeams) => { | ||
const data = getChallengeCookieData(cookieStore); | ||
if (Array.isArray(data)) { | ||
let forcedTeamId; | ||
data.forEach(loan => { | ||
if (loan.loanId === loanId) { | ||
// Loan has a different team attribution, we should override the default | ||
// Is team not in the users list, append it | ||
if (!combinedTeams.some(team => team.id === loan.teamId)) { | ||
appendedTeams.push({ | ||
id: loan.teamId, | ||
name: loan.teamName | ||
}); | ||
forcedTeamId = loan.teamId; | ||
} | ||
} | ||
}); | ||
return forcedTeamId; | ||
} | ||
}; | ||
|
||
/** | ||
* Removes loans from the challenge cookie. | ||
* Used after checkout. | ||
* | ||
* @param cookieStore The object for affecting cookies | ||
* @param loanIds The IDs of the loans to check | ||
*/ | ||
export const removeLoansFromChallengeCookie = (cookieStore, loanIds) => { | ||
const data = getChallengeCookieData(cookieStore); | ||
if (Array.isArray(data)) { | ||
loanIds.forEach(loanId => { | ||
// Remove this loan from the cookie object after checkout | ||
data.splice(data.findIndex(loan => loan.loanId === loanId), 1); | ||
}); | ||
// Overwrite the cookie with the new data | ||
cookieStore.set(TEAM_CHALLENGE_COOKIE_NAME, JSON.stringify(data)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.