Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,863 changes: 129 additions & 1,734 deletions graphql/data/schema.js

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions graphql/data/types/CauseOnboardingCopyType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export default new GraphQLObjectType({
name: 'OnboardingUICopy',
description: 'cause specific UI content around onboarding',
fields: () => ({
steps: {
type: new GraphQLNonNull(
new GraphQLList(
new GraphQLObjectType({
name: 'onboardingUIStep',
description: 'ui content for each onboarding step',
fields: () => ({
title: {
type: new GraphQLNonNull(GraphQLString),
description: 'markdown title for onboarding step',
},
subtitle: {
type: new GraphQLNonNull(GraphQLString),
description: 'markdown subtitle for onboarding step',
},
imgName: {
type: new GraphQLNonNull(GraphQLString),
description: 'name of image to show',
},
}),
})
)
),
description: 'the steps array in onboarding',
resolve: (onboarding) => onboarding.steps,
},
firstTabIntroDescription: {
type: new GraphQLNonNull(GraphQLString),
resolve: (onboarding) => onboarding.firstTabIntroDescription,
description:
'markdown string shown when prompting the user to open their first tab, currently info about cat treats',
},
}),
});
46 changes: 46 additions & 0 deletions graphql/data/types/CauseSharingCopyType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export default new GraphQLObjectType({
name: 'SharingUICopy',
description: 'cause specific UI content around sharing',
fields: () => ({
title: {
type: new GraphQLNonNull(GraphQLString),
description: 'markdown for modal title',
},
subtitle: {
type: new GraphQLNonNull(GraphQLString),
description: 'markdown for modal subtitle',
},
imgCategory: {
type: new GraphQLNonNull(GraphQLString),
description: `value to use for img switch statement on frontend, probably ‘cats’ or ‘seas’`,
},
shareImage: {
type: new GraphQLNonNull(GraphQLString),
description: 'Image to use in email invite dialog',
},
sentImage: {
type: new GraphQLNonNull(GraphQLString),
description: 'Image shown after email invite sent',
},
redditButtonTitle: {
type: new GraphQLNonNull(GraphQLString),
description: 'copy for reddit button',
},
facebookButtonTitle: {
type: new GraphQLNonNull(GraphQLString),
description: 'copy for facebook button',
},
twitterButtonTitle: {
type: new GraphQLNonNull(GraphQLString),
description: 'copy for twitter button',
},
tumblrTitle: {
type: new GraphQLNonNull(GraphQLString),
description: 'copy for tumblr button',
},
tumblrCaption: {
type: new GraphQLNonNull(GraphQLString),
description: 'copy for tumblr caption',
},
}),
});
14 changes: 14 additions & 0 deletions graphql/data/types/CauseThemeType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default new GraphQLObjectType({
name: 'CauseTheming',
description: 'css properties for a specific cause',
fields: () => ({
primaryColor: {
type: new GraphQLNonNull(GraphQLString),
description: 'the primary color hex value',
},
secondaryColor: {
type: new GraphQLNonNull(GraphQLString),
description: 'the secondary color hex value',
},
}),
});
115 changes: 115 additions & 0 deletions graphql/data/types/CauseType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
export default new GraphQLObjectType({
name: CAUSE,
description: 'all cause specific data and ui content',
fields: () => ({
id: globalIdField(CAUSE),
about: {
type: new GraphQLNonNull(GraphQLString),
description: `Markdown - content that populates an "About the Cause" page`,
},
name: {
type: new GraphQLNonNull(GraphQLString),
description: `String used to describe cause in account page`,
},
nameForShop: {
type: new GraphQLNonNull(GraphQLString),
description: `String used to describe cause in the shop extension`,
},
isAvailableToSelect: {
type: new GraphQLNonNull(GraphQLBoolean),
description: 'boolean if cause is available to select in ui',
},
causeId: {
type: new GraphQLNonNull(GraphQLString),
description: "Cause's id",
resolve: (cause) => cause.id,
},
icon: {
type: new GraphQLNonNull(GraphQLString),
description: `Name of an icon, mapping to an icon component on the frontend`,
},
landingPagePath: {
type: new GraphQLNonNull(GraphQLString),
description: `URL path for the landing page belonging to this cause`,
},
landingPagePhrase: {
type: new GraphQLNonNull(GraphQLString),
description: `Phrase for the landing page belonging to this cause`,
resolve: (cause, _, context) => getLandingPagePhrase(context.user, cause),
},
individualImpactEnabled: {
type: new GraphQLNonNull(GraphQLBoolean),
description: `Whether or not the current cause supports individual impact`,
deprecationReason: 'Replaced by "impactType" field.',
},
impactType: {
type: new GraphQLNonNull(
new GraphQLEnumType({
name: 'causeImpactType',
description:
"The type of charitable impact that's enabled for this cause",
values: {
none: { value: CAUSE_IMPACT_TYPES.none },
individual: { value: CAUSE_IMPACT_TYPES.individual },
group: { value: CAUSE_IMPACT_TYPES.group },
individual_and_group: {
value: CAUSE_IMPACT_TYPES.individual_and_group,
},
},
})
),
description: `Whether or not the current cause supports individual impact`,
},
impactVisits: {
type: GraphQLInt,
description: `number of visits required for each impact unit (e.g. 14 for cat charity)`,
},
impact: {
type: CauseImpactCopy,
description: 'the impact object on cause model',
resolve: (cause) => cause.impact,
},
theme: {
type: new GraphQLNonNull(CauseThemeType),
description: 'the theme object on cause model',
resolve: (cause) => cause.theme,
},
sharing: {
type: new GraphQLNonNull(CauseSharingCopyType),
description: 'the sharing object on cause model',
resolve: (cause) => cause.sharing,
},
onboarding: {
type: new GraphQLNonNull(CauseOnboardingCopyType),
resolve: (cause) => cause.onboarding,
description: 'the onboarding object on cause model',
},
groupImpactMetric: {
type: groupImpactMetricType,
description:
'the group impact metric currently associated with this cause',
resolve: (cause, _args, context) =>
getGroupImpactMetricForCause(context.user, cause.id),
},
groupImpactMetricCount: {
type: GraphQLInt,
description:
'how many times this particular group impact metric has been completed for this cause',
resolve: (cause, _args, context) =>
getCauseImpactMetricCount(context.user, cause.id),
},
charity: {
type: charityType,
description: 'Charity that this cause is currently generating impact for',
resolve: (cause, _, context) =>
CharityModel.get(context.user, cause.charityId),
},
charities: {
type: new GraphQLList(charityType),
description: 'Charity that this cause is currently generating impact for',
resolve: (cause, _, context) =>
getCharitiesForCause(context.user, cause.charityIds, cause.charityId),
},
}),
interfaces: [nodeInterface],
});
24 changes: 24 additions & 0 deletions graphql/data/types/EncodedRevenueValueType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default new GraphQLInputObjectType({
name: 'EncodedRevenueValue',
description: 'An object representing a single revenue value',
fields: {
encodingType: {
type: new GraphQLNonNull(
new GraphQLEnumType({
name: 'EncodedRevenueValueTypeEnum',
description:
'The type of transformation we should use to resolve the object into a revenue value',
values: {
AMAZON_CPM: { value: 'AMAZON_CPM' },
},
})
),
},
encodedValue: {
description:
'A string that we can decode to a revenue value (float) using the "encodingType" method',
type: new GraphQLNonNull(GraphQLString),
},
adSize: { type: GraphQLString },
},
});
5 changes: 5 additions & 0 deletions graphql/data/types/ExperimentActionsOutputType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default new GraphQLObjectType({
name: 'ExperimentActionsOutput',
description: 'The actions a user has taken in an experiment',
fields: () => experimentActionsFields,
});
5 changes: 5 additions & 0 deletions graphql/data/types/ExperimentActionsType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default new GraphQLInputObjectType({
name: 'ExperimentActions',
description: 'The actions a user may take in an experiment',
fields: experimentActionsFields,
});
114 changes: 114 additions & 0 deletions graphql/data/types/ExperimentGroupsType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
export default new GraphQLInputObjectType({
name: 'ExperimentGroups',
description: 'The experimental groups to which the user is assigned',
fields: {
anonSignIn: {
type: new GraphQLEnumType({
name: 'ExperimentGroupAnonSignIn',
description: 'The test of allowing anonymous user authentication',
values: {
NONE: { value: experimentConfig.anonSignIn.NONE },
AUTHED_USER_ONLY: {
value: experimentConfig.anonSignIn.AUTHED_USER_ONLY,
},
ANONYMOUS_ALLOWED: {
value: experimentConfig.anonSignIn.ANONYMOUS_ALLOWED,
},
},
}),
},
variousAdSizes: {
type: new GraphQLEnumType({
name: 'ExperimentGroupVariousAdSizes',
description: 'The test of enabling many different ad sizes',
values: {
NONE: { value: experimentConfig.variousAdSizes.NONE },
STANDARD: { value: experimentConfig.variousAdSizes.STANDARD },
VARIOUS: { value: experimentConfig.variousAdSizes.VARIOUS },
},
}),
},
thirdAd: {
type: new GraphQLEnumType({
name: 'ExperimentGroupThirdAd',
description: 'The test of enabling a third ad',
values: {
NONE: { value: experimentConfig.thirdAd.NONE },
TWO_ADS: { value: experimentConfig.thirdAd.TWO_ADS },
THREE_ADS: { value: experimentConfig.thirdAd.THREE_ADS },
},
}),
},
oneAdForNewUsers: {
type: new GraphQLEnumType({
name: 'ExperimentGroupOneAdForNewUsers',
description: 'The test of showing only one ad to new users',
values: {
NONE: { value: experimentConfig.oneAdForNewUsers.NONE },
DEFAULT: { value: experimentConfig.oneAdForNewUsers.DEFAULT },
ONE_AD_AT_FIRST: {
value: experimentConfig.oneAdForNewUsers.ONE_AD_AT_FIRST,
},
},
}),
},
adExplanation: {
type: new GraphQLEnumType({
name: 'ExperimentGroupAdExplanation',
description: 'The test of showing an explanation of why there are ads',
values: {
NONE: { value: experimentConfig.adExplanation.NONE },
DEFAULT: { value: experimentConfig.adExplanation.DEFAULT },
SHOW_EXPLANATION: {
value: experimentConfig.adExplanation.SHOW_EXPLANATION,
},
},
}),
},
searchIntro: {
type: new GraphQLEnumType({
name: 'ExperimentGroupSearchIntro',
description:
'The test of showing an introduction message to Search for a Cause',
values: {
NONE: { value: experimentConfig.searchIntro.NONE },
NO_INTRO: { value: experimentConfig.searchIntro.NO_INTRO },
INTRO_A: {
value: experimentConfig.searchIntro.INTRO_A,
},
INTRO_HOMEPAGE: {
value: experimentConfig.searchIntro.INTRO_HOMEPAGE,
},
},
}),
},
referralNotification: {
type: new GraphQLEnumType({
name: 'ExperimentGroupReferralNotification',
description:
'The test of showing a notification to ask users to recruit friends',
values: {
NONE: { value: experimentConfig.referralNotification.NONE },
NO_NOTIFICATION: {
value: experimentConfig.referralNotification.NO_NOTIFICATION,
},
COPY_A: {
value: experimentConfig.referralNotification.COPY_A,
},
COPY_B: {
value: experimentConfig.referralNotification.COPY_B,
},
COPY_C: {
value: experimentConfig.referralNotification.COPY_C,
},
COPY_D: {
value: experimentConfig.referralNotification.COPY_D,
},
COPY_E: {
value: experimentConfig.referralNotification.COPY_E,
},
},
}),
},
},
});
Loading