Skip to content
Merged

Dev #47

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
24 changes: 12 additions & 12 deletions .github/workflows/staging-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ jobs:
- name: 'Create env file'
run: |
touch .env
echo GATSBY_ALGOLIA_APP_ID=${{ secrets.STAGING_GATSBY_ALGOLIA_APP_ID }} >> .env
echo GATSBY_ALGOLIA_SEARCH_KEY=${{ secrets.STAGING_GATSBY_ALGOLIA_SEARCH_KEY }} >> .env
echo ALGOLIA_ADMIN_KEY=${{ secrets.STAGING_ALGOLIA_ADMIN_KEY }} >> .env
echo BUCKET_NAME=${{ secrets.STAGING_BUCKET_NAME }} >> .env
echo HOST_NAME=${{ secrets.STAGING_HOST_NAME }} >> .env
echo ASSET_HOST=${{ secrets.STAGING_ASSET_HOST }} >> .env
echo FRESHCHAT_TOKEN=${{ secrets.STAGING_FRESHCHAT_TOKEN }} >> .env
echo GA_TRACKING_ID=${{ secrets.STAGING_GA_TRACKING_ID }} >> .env
echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GA4 }} >> .env
echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GTAG }} >> .env
echo GATSBY_ALGOLIA_APP_ID=${{ secrets.WEBSITE_STAGING_GATSBY_ALGOLIA_APP_ID }} >> .env
echo GATSBY_ALGOLIA_SEARCH_KEY=${{ secrets.WEBSITE_STAGING_GATSBY_ALGOLIA_SEARCH_KEY }} >> .env
echo ALGOLIA_ADMIN_KEY=${{ secrets.WEBSITE_STAGING_ALGOLIA_ADMIN_KEY }} >> .env
echo BUCKET_NAME=${{ secrets.WEBSITE_STAGING_BUCKET_NAME }} >> .env
echo HOST_NAME=${{ secrets.WEBSITE_STAGING_HOST_NAME }} >> .env
echo ASSET_HOST=${{ secrets.WEBSITE_STAGING_ASSET_HOST }} >> .env
echo FRESHCHAT_TOKEN=${{ secrets.WEBSITE_STAGING_FRESHCHAT_TOKEN }} >> .env
echo GA_TRACKING_ID=${{ secrets.WEBSITE_STAGING_GA_TRACKING_ID }} >> .env
echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.WEBSITE_STAGING_GTAG_TRACKING_ID_FOR_GA4 }} >> .env
echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.WEBSITE_STAGING_GTAG_TRACKING_ID_FOR_GTAG }} >> .env
cat .env
- name: Set environment
run : sed -i 's/localhost/website.testsigma.com/g' src/environment.ts
- name: Build
run: |
PREFIX_PATHS=true npm run build && npm run deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.WEBSITE_STAGING_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEBSITE_STAGING_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
AWS_DEFAULT_OUTPUT: json
119 changes: 92 additions & 27 deletions src/components/Footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
}

.footer_greenbox{
margin-top: 30px;
margin-top: 3.5rem;
background-color: #CDF0EA;
margin-bottom: 20px;
display: -webkit-box;
Expand All @@ -85,44 +85,27 @@
display: flex;
padding: 18px 18px 18px 28px;
border-radius: 6px;
flex-direction: column;
@media (max-width: 576px) {
display: block;
padding: 18px;
}
.green_text{
font-size: 16px;
font-size: 18px;
line-height: 26px;
font-weight: bold;
text-align: initial;
padding-left: 15px;
text-align: center;
padding-right: 20px;
margin-top: 3px;
margin-bottom: 0px;
}
form{
margin-top: -15px;
input{
height: 40px;
margin-top: 11px;
.flex_item {
width: 60%;
max-width: 60%;
margin: auto;
@media only screen and (max-width: 767px) {
width: 100%;
padding-left: 40px;
padding-right: 15px;
border-radius: 4px;
&:focus{
outline: none;
}
&::placeholder{
position: relative;
left: 0px;
color: #cacaca;
font-size: 15px;
}
}
svg{
display: block;
position: relative;
top: 39px;
left: 15px;
max-width: 100%;
}
}
.btn_width{
Expand Down Expand Up @@ -183,6 +166,88 @@
}
}
}
#hubspot-form-wrapper{
padding: 1rem 0;
padding-left: 1rem;
@media only screen and (max-width: 767px) {
padding-left: 0;
}
fieldset{
.hs-form-field{
padding: 0.7rem 0;
label{
span{
height: 18px;
color: #666779;
font-size: 16px;
font-weight: 500;
letter-spacing: 0px;
margin-left: 1px;
margin-bottom: 12px;
line-height: 18px;
text-align: center;
}
.hs-form-required{
color: #FE6B6B;
}
}
.input{
@media only screen and (max-width: 767px) {
margin: 0;
}
input{
box-sizing: border-box;
height: 44px;
border: 1px solid #EEEEEE;
border-radius: 3px;
background-color: #FFF;
box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.03);
@media only screen and (max-width: 767px) {
max-width: 100%;
width: 100%;
}
}
}
}
}
.hs_recaptcha{
display: none;
}
.hs_submit{
.actions{
input[type="submit"]{
color: #FFF;
margin-top: 11px;
margin-left: 0px;
background: #03A973 !important;
border: 1px solid #03A973 !important;
max-width: 100%;
width: 92%;
height: 40px;
border-radius: 4px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
line-height: 39px;
text-align: center;
justify-content: center;
align-items: center;
font-size: 1.3rem;
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
-ms-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
cursor: pointer;
padding-left: 20px;
padding-right: 20px;
@media (max-width: 576px) {
right: 0;
min-width: 100%;
}
}
}
}
}

.footer_greyBox{
margin-top: 30px;
Expand Down
133 changes: 35 additions & 98 deletions src/components/SubscribeButton.jsx
Original file line number Diff line number Diff line change
@@ -1,105 +1,42 @@
import React, { Component } from 'react';
import ReCAPTCHA from "react-google-recaptcha";
import axios from 'axios';

class SubscribeButton extends Component {
constructor(props) {
super(props);

this.state = {
subscribed: false,
};
this._reCaptchaRef = React.createRef();
}
import React, { useEffect, useRef } from 'react';

const SubscribeButton = () => {
const formRef = useRef(null);

subscribeNewsletters = async (e) => {
e.preventDefault();
const CONTACT_LIST_API = 'https://staging.testsigma.com/api/website/contacts';
const email = document.getElementById('email').value;
const emailError = document.getElementById('email_error');
let trimmedURL = window.location.href;
useEffect(() => {
const script = document.createElement('script');
script.src = '//js.hsforms.net/forms/embed/v2.js';
script.charset = 'utf-8';
script.type = 'text/javascript';
script.async = true;
document.body.appendChild(script);

if (trimmedURL.length > 250)
trimmedURL = window.location.href.substr(0, 240)+"...";
script.addEventListener('load', () => {
if (window.hbspt && window.hbspt.forms) {
window.hbspt.forms.create({
region: "na1",
portalId: "23341221",
formId: "87576ba1-bb40-433e-9257-4af82e747a6e",
target: "#hubspot-form-wrapper",
});
}
});

const regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

emailError.style.display = "none";
if (!regex.test(email)) {
emailError.style.display = "block";
return false;
} else {
this._reCaptchaRef.current.executeAsync().then(value => {
if (value) {
const formData = {
'CATEGORY': 'Product Updates',
'LSOURCE': 'Tutorials',
'UPDATES': '',
'URL': trimmedURL,
'add_tags_immediately': false,
'email': email,
'g-recaptcha-response': value,
'list_id' : 'bec00ef235',
'tags': ['Product Updates']
};

axios({
method: 'POST',
url: CONTACT_LIST_API,
data: formData,
headers: { "Content-Type": "application/json; charset=UTF-8" },
})
.then(function (response) {
// handle success
this.setState({ subscribed: true });
}.bind(this))
.catch(function (response) {
// handle error
console.error("Failed: ", response);
});
}
});
}
}
return () => {
document.body.removeChild(script);
};
}, []);

render() {
return (
<>
<div className="footer_greenbox">
<div className="flex_item">
<h4 className="green_text">
Stay up to date with product updates & news
</h4>
</div>
<div className={this.state.subscribed ? "hide" : "flex_item"}>
<form>
<svg width="20" height="15" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12.75 10.4829H1.41667C1.04094 10.4829 0.680609 10.3449 0.414933 10.0991C0.149256 9.85337 0 9.52008 0 9.17255V1.25336C0.0158898 0.915807 0.172132 0.596975 0.436106 0.36343C0.70008 0.129885 1.05138 -0.00031923 1.41667 5.87777e-07H12.75C13.1257 5.87777e-07 13.4861 0.138056 13.7518 0.383797C14.0174 0.629538 14.1667 0.962834 14.1667 1.31036V9.17255C14.1667 9.52008 14.0174 9.85337 13.7518 10.0991C13.4861 10.3449 13.1257 10.4829 12.75 10.4829ZM1.41667 2.53424V9.17255H12.75V2.53424L7.08334 6.02767L1.41667 2.53424ZM1.98334 1.31036L7.08334 4.45524L12.1834 1.31036H1.98334Z"
fill="#CACACA"/>
</svg>
<input type="text" id="email" name="email" placeholder="Your Email Id"/>
</form>
<p id="email_error" className="email-error">Please fill out this field.</p>
</div>
<div className={this.state.subscribed ? "hide" : "flex_item btn_width"}>
<ReCAPTCHA
size="invisible"
ref={this._reCaptchaRef}
sitekey='6LcL08cZAAAAAAn21PBn75R1qLquLlbx1ZB0ZIFd'
/>
<button className="btn" onClick={this.subscribeNewsletters}>Subscribe</button>
</div>
<div className={this.state.subscribed ? "flex_item subscribe-success" : "hide"}>
<h4 className="green_text">
You're now subscribed to our monthly product updates.
</h4>
</div>
</div>
</>
);
}
}
return (
<div className="footer_greenbox">
<div className="flex_item">
<h4 className="green_text">
Stay up to date with product updates & news
</h4>
</div>
<div className="flex_item" id="hubspot-form-wrapper" />
</div>
);
};

export default SubscribeButton;