Skip to content

Commit

Permalink
ref: delete mail subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
fricoben committed Dec 2, 2024
1 parent 94b23ac commit 6197b2f
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 68 deletions.
14 changes: 0 additions & 14 deletions components/discount/freeRenewalCheckout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react";
import { FunctionComponent, useEffect, useState } from "react";
import Button from "../UI/button";
import { useAccount, useSendTransaction } from "@starknet-react/core";
import { formatHexString } from "../../utils/stringService";
import { applyRateToBigInt } from "../../utils/feltService";
import styles from "../../styles/components/registerV2.module.css";
import SwissForm from "../domains/swissForm";
Expand Down Expand Up @@ -32,13 +31,11 @@ import { areArraysEqual } from "@/utils/arrayService";
import { useFreeRenewalTxPrep } from "@/hooks/checkout/useFreeRenewalTxPrep";

type FreeRenewalCheckoutProps = {
groups: string[];
goBack: () => void;
offer: Discount;
};

const FreeRenewalCheckout: FunctionComponent<FreeRenewalCheckoutProps> = ({
groups,
offer,
goBack,
}) => {
Expand Down Expand Up @@ -105,17 +102,6 @@ const FreeRenewalCheckout: FunctionComponent<FreeRenewalCheckoutProps> = ({
.catch((err) => console.log("Error on sending metadata:", err));
}

// Subscribe to auto renewal mailing list if renewal box is checked
fetch(`${process.env.NEXT_PUBLIC_SALES_SERVER_LINK}/mail_subscribe`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
tx_hash: formatHexString(renewData.transaction_hash),
groups,
}),
})
.then((res) => res.json())
.catch((err) => console.log("Error on registering to email:", err));

addTransaction({
timestamp: Date.now(),
Expand Down
17 changes: 1 addition & 16 deletions components/domains/autorenewal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FunctionComponent, useEffect, useState } from "react";
import Button from "../UI/button";
import { useAccount, useSendTransaction } from "@starknet-react/core";
import {
formatHexString,
selectedDomainsToArray,
} from "../../utils/stringService";
import { applyRateToBigInt } from "../../utils/feltService";
Expand Down Expand Up @@ -46,11 +45,8 @@ import useNeedSubscription from "@/hooks/useNeedSubscription";
import AutoRenewalDomainsBox from "./autoRenewalDomainsBox";
import Notification from "../UI/notification";

type SubscriptionProps = {
groups: string[];
};

const Subscription: FunctionComponent<SubscriptionProps> = ({ groups }) => {
const Subscription: FunctionComponent = () => {
const [isSwissResident, setIsSwissResident] = useState<boolean>(false);
const [salesTaxRate, setSalesTaxRate] = useState<number>(0);
const [salesTaxAmount, setSalesTaxAmount] = useState<bigint>(BigInt(0));
Expand Down Expand Up @@ -124,17 +120,6 @@ const Subscription: FunctionComponent<SubscriptionProps> = ({ groups }) => {
});
}

// Subscribe to auto renewal mailing list if renewal box is checked
fetch(`${process.env.NEXT_PUBLIC_SALES_SERVER_LINK}/mail_subscribe`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
tx_hash: formatHexString(autorenewData.transaction_hash),
groups,
}),
})
.then((res) => res.json())
.catch((err) => console.log("Error on registering to email:", err));

addTransaction({
timestamp: Date.now(),
Expand Down
3 changes: 0 additions & 3 deletions components/domains/registerV3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import evergreenDiscounts from "@/utils/discounts/evergreen";

type RegisterV3Props = {
domain: string;
groups: string[];
setDomain: (domain: string) => void;
};

const RegisterV3: FunctionComponent<RegisterV3Props> = ({
domain,
setDomain,
groups,
}) => {
const { address } = useAccount();
const [currentStep, setCurrentStep] = useState(1);
Expand Down Expand Up @@ -85,7 +83,6 @@ const RegisterV3: FunctionComponent<RegisterV3Props> = ({
{currentStep === 3 && (
<CheckoutCard
type={FormType.REGISTER}
groups={groups}
discount={evergreenDiscounts.registration}
/>
)}
Expand Down
6 changes: 1 addition & 5 deletions components/domains/renewalV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ import SelectPfp from "./steps/selectPfp";
import { StarknetIdJsContext } from "@/context/StarknetIdJsProvider";
import evergreenDiscounts from "@/utils/discounts/evergreen";

type RenewalProps = {
groups: string[];
};

const RenewalV2: FunctionComponent<RenewalProps> = ({ groups }) => {
const RenewalV2: FunctionComponent = () => {
const { address } = useAccount();
const [currentStep, setCurrentStep] = useState(1);
const { updateFormState, userNfts, isLoadingNfts } = useContext(FormContext);
Expand Down Expand Up @@ -95,7 +92,6 @@ const RenewalV2: FunctionComponent<RenewalProps> = ({ groups }) => {
{currentStep === 3 && (
<CheckoutCard
type={FormType.RENEW}
groups={groups}
discount={evergreenDiscounts.renewal}
/>
)}
Expand Down
12 changes: 0 additions & 12 deletions components/domains/steps/checkoutCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ import { useRenewalTxPrep } from "@/hooks/checkout/useRenewalTxPrep";

type CheckoutCardProps = {
type: FormType;
groups: string[];
discount: Upsell;
};

const CheckoutCard: FunctionComponent<CheckoutCardProps> = ({
type,
discount,
groups,
}) => {
const router = useRouter();
const { account, address } = useAccount();
Expand Down Expand Up @@ -175,16 +173,6 @@ const CheckoutCard: FunctionComponent<CheckoutCardProps> = ({
.catch((err) => console.log("Error on sending metadata:", err));
}

fetch(`${process.env.NEXT_PUBLIC_SALES_SERVER_LINK}/mail_subscribe`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
tx_hash: formatHexString(checkoutData.transaction_hash),
groups: renewalBox ? groups : [groups[0]],
}),
})
.then((res) => res.json())
.catch((err) => console.log("Error on registering to email:", err));

addTransaction({
timestamp: Date.now(),
Expand Down
4 changes: 0 additions & 4 deletions pages/freerenewal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ const FreeRenewalPage: NextPage = () => {
{screen === 2 ? (
<div className={styles.container}>
<FreeRenewalCheckout
groups={[
process.env.NEXT_PUBLIC_MAILING_LIST_GROUP_AUTO_RENEWAL ?? "",
freeRenewalDiscount.discountMailGroupId,
]}
offer={freeRenewalDiscount.offer}
goBack={goBack}
/>
Expand Down
4 changes: 0 additions & 4 deletions pages/register/[domainToRegister].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ const RegistrationPage: NextPage = () => {
<RegisterV3
domain={getDomainWithoutStark(domain)}
setDomain={setDomain}
groups={[
process.env.NEXT_PUBLIC_MAILING_LIST_GROUP ?? "",
process.env.NEXT_PUBLIC_MAILING_LIST_GROUP_AUTO_RENEWAL ?? "",
]}
/>
</FormProvider>
</div>
Expand Down
6 changes: 1 addition & 5 deletions pages/renewal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ const RenewalPage: NextPage = () => {
<div className={homeStyles.screen}>
<div className={styles.container}>
<FormProvider>
<RenewalV2
groups={[
process.env.NEXT_PUBLIC_MAILING_LIST_GROUP_AUTO_RENEWAL ?? "",
]}
/>
<RenewalV2 />
</FormProvider>
</div>
</div>
Expand Down
6 changes: 1 addition & 5 deletions pages/subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ const AutoRenewalPage: NextPage = () => {
return (
<div className={homeStyles.screen}>
<div className={styles.container}>
<AutoRenewal
groups={[
process.env.NEXT_PUBLIC_MAILING_LIST_GROUP_AUTO_RENEWAL ?? "",
]}
/>
<AutoRenewal />
</div>
</div>
);
Expand Down

0 comments on commit 6197b2f

Please sign in to comment.