Skip to content

Commit

Permalink
Merge #592
Browse files Browse the repository at this point in the history
592: Fix hubspot form build r=Strift a=Strift

This PR:
- Add default values for Hubspot form
- Add a `prebuild` script that checks that the env are available
- Bump version to create a new release


Co-authored-by: Strift <[email protected]>
  • Loading branch information
meili-bors[bot] and Strift authored Mar 4, 2025
2 parents adffeed + 387b546 commit a916648
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hubspot newsletter
REACT_APP_HUBSPOT_PORTAL_ID=25945010
REACT_APP_HUBSPOT_FORM_GUID=991e2a09-77c2-4428-9242-ebf26bfc6c64
11 changes: 11 additions & 0 deletions cypress/e2e/side-panel.cy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const WAITING_TIME = Cypress.env('waitingTime')

describe(`Right side panel`, () => {
beforeEach(() => {
cy.saveApiTokenCookie()
Expand All @@ -18,4 +20,13 @@ describe(`Right side panel`, () => {
cy.get('button[aria-label="Open Panel"]').click()
cy.get('[data-testid="right-panel"]').should('be.visible')
})

it('Should allow subscribing to the newsletter', () => {
cy.get('input[placeholder="Enter your email"]').type('[email protected]')
cy.get('button[aria-label="Subscribe"]').click()
cy.wait(WAITING_TIME)
cy.get('[data-testid="right-panel"]').within(() => {
cy.get('p').should('contain', 'Thanks for subscribing!')
})
})
})
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mini-dashboard",
"version": "0.2.17",
"version": "0.2.18",
"private": true,
"dependencies": {
"@meilisearch/instant-meilisearch": "0.24",
Expand All @@ -22,8 +22,9 @@
},
"scripts": {
"version-script": "node version-script.js",
"prestart": "yarn version-script",
"prebuild": "yarn version-script",
"validate-env": "node validate-env.js",
"prestart": "yarn version-script && yarn validate-env",
"prebuild": "yarn version-script && yarn validate-env",
"start": "react-scripts start",
"start:ci": "REACT_APP_MEILI_SERVER_ADDRESS=http://meilisearch:7700 react-scripts start",
"build": "react-scripts build",
Expand Down
6 changes: 5 additions & 1 deletion src/components/NewsletterForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ const NewsletterForm = () => {
required
style={{ marginTop: '0rem' }}
/>
<Button type="submit" disabled={status === 'loading'}>
<Button
type="submit"
disabled={status === 'loading'}
aria-label="Subscribe"
>
{status === 'loading' ? (
<>
<SpinningIcon>
Expand Down
2 changes: 1 addition & 1 deletion src/version/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '0.2.17'
export default '0.2.18'
13 changes: 13 additions & 0 deletions validate-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable no-console */

const requiredEnv = ['REACT_APP_API_URL', 'REACT_APP_ANOTHER_ENV_VAR']

const missingEnv = requiredEnv.filter((env) => !process.env[env])

if (missingEnv.length > 0) {
console.error(
`Missing required environment variables: ${missingEnv.join(', ')}`
)
process.exit(1)
}
console.log('All required environment variables are set.')

0 comments on commit a916648

Please sign in to comment.