Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update product names #1991

Merged
merged 22 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const planChangeSuccessModal = {
planChangeSuccessSubheader: () => cy.get("[data-cy=label-plan-changed-successfully]"),
featuresSummaryLabel: () => cy.get("[data-cy=label-features-summary-title]"),
newStorageCapacityLabel: () => cy.get("[data-cy=label-new-plan-capacity]"),
newPlanNameLabel: () => cy.get("[data-cy=label-new-plan-name]"),
billingHistoryLabel: () => cy.get("[data-cy=label-billing-history-notice]"),
invoicesLink: () => cy.get("[data-cy=link-view-invoices]"),
closeButton: () => cy.get("[data-testid=button-close-success-modal]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export const selectPlanModal = {
// creates a cypress alias for each individual plan.
createPlanCypressAliases() {
this.planBoxContainer().should("have.length.greaterThan", 0)
this.planBoxContainer().contains("Free plan")
this.planBoxContainer().contains("Files Free")
.should("be.visible")
.as("freePlanBox")
this.planBoxContainer().contains("Standard plan")
.as("filesFreeBox")
this.planBoxContainer().contains("Files Pro")
.should("be.visible")
.as("standardPlanBox")
this.planBoxContainer().contains("Premium plan")
.as("filesProBox")
this.planBoxContainer().contains("Files Max")
.should("be.visible")
.as("premiumPlanBox")
.as("filesMaxBox")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const settingsPage = {
payNowButton: () => cy.get("[data-testid=button-pay-invoice]"),

// use this convenience function when an upgraded account is required as a test requisite
upgradeSubscription(plan: "standard" | "premium") {
const planContainer = plan === "standard" ? "@standardPlanBox" : "@premiumPlanBox"
upgradeSubscription(plan: "pro" | "max") {
const planContainer = plan === "pro" ? "@filesProBox" : "@filesMaxBox"

this.subscriptionTabButton().click()
this.changePlanButton().click()
Expand Down
63 changes: 31 additions & 32 deletions packages/files-ui/cypress/tests/subscription-plan-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe("Subscription Plan", () => {
selectPlanModal.createPlanCypressAliases()

// ensure all plan boxes contain expected elements and element state
cy.get("@freePlanBox").parent().within(() => {
cy.get("@filesFreeBox").parent().within(() => {
selectPlanModal.planTitleLabel().should("be.visible")
selectPlanModal.FreePriceLabel().should("be.visible")
selectPlanModal.storageDescriptionLabel().should("be.visible")
Expand All @@ -172,7 +172,7 @@ describe("Subscription Plan", () => {
.should("be.disabled")
})

cy.get("@standardPlanBox").parent().within(() => {
cy.get("@filesProBox").parent().within(() => {
selectPlanModal.planTitleLabel().should("be.visible")
selectPlanModal.monthlyPriceLabel().should("be.visible")
selectPlanModal.storageDescriptionLabel().should("be.visible")
Expand All @@ -181,7 +181,7 @@ describe("Subscription Plan", () => {
.should("be.enabled")
})

cy.get("@premiumPlanBox").parent().within(() => {
cy.get("@filesMaxBox").parent().within(() => {
selectPlanModal.planTitleLabel().should("be.visible")
selectPlanModal.monthlyPriceLabel().should("be.visible")
selectPlanModal.storageDescriptionLabel().should("be.visible")
Expand All @@ -190,8 +190,8 @@ describe("Subscription Plan", () => {
.should("be.enabled")
})

// select the standard plan
cy.get("@standardPlanBox").parent().within(() => {
// select the Files Pro
cy.get("@filesProBox").parent().within(() => {
selectPlanModal.selectPlanButton().click()
})

Expand All @@ -217,9 +217,9 @@ describe("Subscription Plan", () => {
it("cannot downgrade if used storage exceeds plan allowance", () => {
cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true })

// upgrade to a premium plan first
// upgrade to a Max plan first
navigationMenu.settingsNavButton().click()
settingsPage.upgradeSubscription("premium")
settingsPage.upgradeSubscription("max")

// setup intercepter, stub the used products response to disallow update
cy.intercept("GET", "**/billing/products", (req) => {
Expand All @@ -233,7 +233,7 @@ describe("Subscription Plan", () => {
selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0)

// ensure warning is shown and the free plan is not selectable
cy.get("@freePlanBox").parent().within(() => {
cy.get("@filesFreeBox").parent().within(() => {
selectPlanModal.storageCapacityWarningLabel().should("be.visible")
selectPlanModal.selectPlanButton()
.should("be.visible")
Expand All @@ -250,7 +250,7 @@ describe("Subscription Plan", () => {
// create cypress aliases for the plans
selectPlanModal.createPlanCypressAliases()

cy.get("@standardPlanBox").parent().within(() => {
cy.get("@filesProBox").parent().within(() => {
selectPlanModal.selectPlanButton().click()
})

Expand All @@ -273,11 +273,11 @@ describe("Subscription Plan", () => {
settingsPage.subscriptionTabButton().click()
settingsPage.changePlanButton().click()

selectPlanModal.planBoxContainer().contains("Standard plan")
selectPlanModal.planBoxContainer().contains("Files Pro")
.should("be.visible")
.as("standardPlanBox")
.as("filesProBox")

cy.get("@standardPlanBox").parent().within(() => {
cy.get("@filesProBox").parent().within(() => {
selectPlanModal.selectPlanButton().click()
})

Expand Down Expand Up @@ -313,13 +313,13 @@ describe("Subscription Plan", () => {
selectPlanModal.body().should("be.visible")
selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0)

// create a cypress alias for the premium plan
selectPlanModal.planBoxContainer().contains("Premium plan")
// create a cypress alias for the Max plan
selectPlanModal.planBoxContainer().contains("Files Max")
.should("be.visible")
.as("premiumPlanBox")
.as("filesMaxBox")

// select the premium plan
cy.get("@premiumPlanBox").parent().within(() => {
// select the Max plan
cy.get("@filesMaxBox").parent().within(() => {
selectPlanModal.selectPlanButton().click()
})

Expand Down Expand Up @@ -371,7 +371,6 @@ describe("Subscription Plan", () => {
planChangeSuccessModal.planChangeSuccessSubheader().should("be.visible")
planChangeSuccessModal.featuresSummaryLabel().should("be.visible")
planChangeSuccessModal.newStorageCapacityLabel().should("be.visible")
planChangeSuccessModal.newPlanNameLabel().should("be.visible")
planChangeSuccessModal.billingHistoryLabel().should("be.visible")
planChangeSuccessModal.invoicesLink().should("be.visible")
planChangeSuccessModal.closeButton().should("be.visible")
Expand All @@ -397,12 +396,12 @@ describe("Subscription Plan", () => {
})
})

it("can downgrade from premium plan to standard plan", () => {
it("can downgrade from Max plan to Pro plan", () => {
cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true })

// upgrade to a premium plan first using convenience function
// upgrade to a max plan first using convenience function
navigationMenu.settingsNavButton().click()
settingsPage.upgradeSubscription("premium")
settingsPage.upgradeSubscription("max")

// store the upgraded plan name for later comparison
settingsPage.planNameLabel()
Expand All @@ -412,7 +411,7 @@ describe("Subscription Plan", () => {
// initiate the downgrade process
settingsPage.changePlanButton().click()
selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0)
cy.get("@standardPlanBox").parent().within(() => {
cy.get("@filesProBox").parent().within(() => {
selectPlanModal.selectPlanButton().click()
})

Expand Down Expand Up @@ -440,30 +439,30 @@ describe("Subscription Plan", () => {
// store the downgraded plan name for later comparison
settingsPage.planNameLabel()
.should("be.visible")
.invoke("text").as("standardPlanName")
.invoke("text").as("proPlanName")

// ensure the downgraded plan name is not the same as the previously upgraded plan
cy.get("@premiumPlanName").then(($premiumPlanName) => {
cy.get("@standardPlanName").should("not.equal", $premiumPlanName)
cy.get("@proPlanName").should("not.equal", $premiumPlanName)
})
})

it("can downgrade from standard plan to free plan", () => {
it("can downgrade from Pro plan to free plan", () => {
cy.web3Login({ deleteCreditCard: true, resetToFreePlan: true })

// upgrade to a standard plan first
// upgrade to a Pro plan first
navigationMenu.settingsNavButton().click()
settingsPage.upgradeSubscription("standard")
settingsPage.upgradeSubscription("pro")

// store the standard plan name for later comparison
// store the Pro plan name for later comparison
settingsPage.planNameLabel()
.should("be.visible")
.invoke("text").as("standardPlanName")
.invoke("text").as("proPlanName")

// initiate the downgrade process
settingsPage.changePlanButton().click()
selectPlanModal.planBoxContainer().should("have.length.greaterThan", 0)
cy.get("@freePlanBox").parent().within(() => {
cy.get("@filesFreeBox").parent().within(() => {
selectPlanModal.selectPlanButton().click()
})

Expand All @@ -487,7 +486,7 @@ describe("Subscription Plan", () => {
.invoke("text").as("freePlanName")

// ensure the downgraded plan name is not the same as the previously upgraded plan
cy.get("@standardPlanName").then(($standardPlanName) => {
cy.get("@proPlanName").then(($standardPlanName) => {
cy.get("@freePlanName").should("not.equal", $standardPlanName)
})
})
Expand All @@ -498,7 +497,7 @@ describe("Subscription Plan", () => {
settingsPage.subscriptionTabButton().click()
settingsPage.changePlanButton().click()
selectPlanModal.createPlanCypressAliases()
cy.get("@standardPlanBox").parent().within(() => {
cy.get("@filesProBox").parent().within(() => {
selectPlanModal.selectPlanButton().click()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,9 @@ const SelectPlan = ({ className, onSelectPlan, plans }: ISelectPlan) => {
className={classes.description}
data-cy="label-storage-capacity-amount"
>
{
monthly?.metadata?.storage_size_bytes
? <Trans>{planStorageCapacity} of storage</Trans>
: plan.description
{monthly?.metadata?.storage_size_bytes
? <Trans>{planStorageCapacity} of storage</Trans>
: plan.description
}
</Typography>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React from "react"
import { makeStyles, createStyles } from "@chainsafe/common-theme"
import { CSFTheme } from "../../../../../Themes/types"
import { Product, ProductPrice } from "@chainsafe/files-api-client"
import { Button, CheckCircleIcon, CheckIcon, Divider, formatBytes, Link, Typography } from "@chainsafe/common-components"
import { Button, CheckCircleIcon, CheckIcon, Divider, formatBytes, Link, Typography } from "@chainsafe/common-components"
import { Trans } from "@lingui/macro"
import { ROUTE_LINKS } from "../../../../FilesRoutes"
import clsx from "clsx"
import { PaymentMethod } from "../../../../../Contexts/BillingContext"

const useStyles = makeStyles(({ constants, palette }: CSFTheme) =>
createStyles({
root: {
root: {
margin: `${constants.generalUnit * 2}px ${constants.generalUnit * 2}px`
},
headingBadge: {
Expand Down Expand Up @@ -68,7 +68,7 @@ const useStyles = makeStyles(({ constants, palette }: CSFTheme) =>
textLink: {
color: palette.primary.background
},
checkCircleIcon: {
checkCircleIcon: {
fill: palette.additional["gray"][7],
marginLeft: constants.generalUnit
},
Expand Down Expand Up @@ -137,16 +137,6 @@ const PlanSuccess = ({ plan, onClose, planPrice, paymentMethod }: IPlanSuccess)
}
</Typography>
</div>
<div className={classes.middleRowBox}>
<CheckIcon className={classes.tickIcon} />
<Typography
component="p"
variant="body1"
data-cy="label-new-plan-name"
>
{plan.description}
</Typography>
</div>
</div>
</div>
<div className={classes.rowBox}>
Expand Down
23 changes: 14 additions & 9 deletions packages/files-ui/src/Contexts/BillingContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,26 @@ interface IBillingContext {

const ProductMapping: {[key: string]: {
name: string
description: string
}} = {
// Staging Product Ids
prod_JwRu6Ph25b1f2O: {
name: t`Free plan`,
description: t`This is the free product.`
name: t`Files Free`
},
prod_JwS49Qfnr6vD3K: {
name: t`Standard plan`,
description: t`Standard plan`
name: t`Files Pro`
},
prod_JwSGHB8qFx7rRM: {
name: t`Premium plan`,
description: t`Premium plan`
name: t`Files Max`
},
// Production Product Ids
prod_KRAq3CngQMKebw: {
name: t`Files Free`
},
prod_LDXtKgrbAoZvIB: {
name: t`Files Pro`
},
prod_LDXtBLuzjVxMzg: {
name: t`Files Max`
}
}

Expand Down Expand Up @@ -167,7 +174,6 @@ const BillingProvider = ({ children }: BillingContextProps) => {
return filesApiClient.getCurrentSubscription()
.then((subscription) => {
subscription.product.name = ProductMapping[subscription.product.id].name
subscription.product.description = ProductMapping[subscription.product.id].description
setCurrentSubscription(subscription)
return subscription
})
Expand All @@ -187,7 +193,6 @@ const BillingProvider = ({ children }: BillingContextProps) => {
.then((products) => {
return products.map(product => {
product.name = ProductMapping[product.id].name
product.description = ProductMapping[product.id].description
return product
})
})
Expand Down
21 changes: 9 additions & 12 deletions packages/files-ui/src/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,15 @@ msgstr "Dateigröße"
msgid "Files"
msgstr "Dateien"

msgid "Files Free"
msgstr ""

msgid "Files Max"
msgstr ""

msgid "Files Pro"
msgstr ""

msgid "Files sharing key"
msgstr "Dateifreigabeschlüssel"

Expand All @@ -418,9 +427,6 @@ msgstr "Diesen Browser vergessen"
msgid "Free"
msgstr ""

msgid "Free plan"
msgstr ""

msgid "General"
msgstr "Allgemein"

Expand Down Expand Up @@ -688,9 +694,6 @@ msgstr "Bitte geben Sie ein Passwort an"
msgid "Please select a file to upload"
msgstr "Bitte wählen Sie eine Datei zum Hochladen"

msgid "Premium plan"
msgstr ""

msgid "Preview"
msgstr "Vorschau"

Expand Down Expand Up @@ -889,9 +892,6 @@ msgstr "Es ist etwas schief gelaufen. Wir konnten Ihre Datei nicht hochladen"
msgid "Sort By:"
msgstr ""

msgid "Standard plan"
msgstr ""

msgid "Start Upload"
msgstr "Hochladen starten"

Expand Down Expand Up @@ -979,9 +979,6 @@ msgstr ""
msgid "This card will become your default payment method"
msgstr ""

msgid "This is the free product."
msgstr ""

msgid "This link is marlformed. Please verify that you copy/pasted it correctly."
msgstr ""

Expand Down
Loading