Skip to content

Commit

Permalink
Merge branch 'development' into TW-1638-reduce-amount-of-requests-for…
Browse files Browse the repository at this point in the history
…-ads-providers
  • Loading branch information
keshan3262 authored Jan 22, 2025
2 parents 833319d + 76fa7d4 commit bc15849
Show file tree
Hide file tree
Showing 10 changed files with 262 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ SMARTY_970_250_PLACEMENT_ID=
SMARTY_320_100_PLACEMENT_ID=
SMARTY_300_600_PLACEMENT_ID=

BITMEDIA_320_50_PLACEMENT_ID=
BITMEDIA_320_100_PLACEMENT_ID=
BITMEDIA_300_250_PLACEMENT_ID=
BITMEDIA_728_90_PLACEMENT_ID=

TEMPLE_ADS_ORIGIN_PASSPHRASE=

TAKE_ADS_TOKEN=
10 changes: 10 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ jobs:
SMARTY_970_250_PLACEMENT_ID: ${{ vars.SMARTY_970_250_PLACEMENT_ID }}
SMARTY_320_100_PLACEMENT_ID: ${{ vars.SMARTY_320_100_PLACEMENT_ID }}
SMARTY_300_600_PLACEMENT_ID: ${{ vars.SMARTY_300_600_PLACEMENT_ID }}
BITMEDIA_320_50_PLACEMENT_ID: ${{ vars.BITMEDIA_320_50_PLACEMENT_ID }}
BITMEDIA_320_100_PLACEMENT_ID: ${{ vars.BITMEDIA_320_100_PLACEMENT_ID }}
BITMEDIA_300_250_PLACEMENT_ID: ${{ vars.BITMEDIA_300_250_PLACEMENT_ID }}
BITMEDIA_728_90_PLACEMENT_ID: ${{ vars.BITMEDIA_728_90_PLACEMENT_ID }}
BITMEDIA_300_100_PLACEMENT_ID: ${{ vars.BITMEDIA_300_100_PLACEMENT_ID }}
BITMEDIA_250_250_PLACEMENT_ID: ${{ vars.BITMEDIA_250_250_PLACEMENT_ID }}
BITMEDIA_336_280_PLACEMENT_ID: ${{ vars.BITMEDIA_336_280_PLACEMENT_ID }}
BITMEDIA_160_600_PLACEMENT_ID: ${{ vars.BITMEDIA_160_600_PLACEMENT_ID }}
BITMEDIA_300_600_PLACEMENT_ID: ${{ vars.BITMEDIA_300_600_PLACEMENT_ID }}
BITMEDIA_970_90_PLACEMENT_ID: ${{ vars.BITMEDIA_970_90_PLACEMENT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE: ${{ vars.TEMPLE_ADS_ORIGIN_PASSPHRASE }}
TAKE_ADS_TOKEN: ${{ secrets.TAKE_ADS_TOKEN }}
CONVERSION_VERIFICATION_URL: ${{ vars.CONVERSION_VERIFICATION_URL }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/manual-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ jobs:
SMARTY_970_250_PLACEMENT_ID: ${{ vars.SMARTY_970_250_PLACEMENT_ID }}
SMARTY_320_100_PLACEMENT_ID: ${{ vars.SMARTY_320_100_PLACEMENT_ID }}
SMARTY_300_600_PLACEMENT_ID: ${{ vars.SMARTY_300_600_PLACEMENT_ID }}
BITMEDIA_320_50_PLACEMENT_ID: ${{ vars.BITMEDIA_320_50_PLACEMENT_ID }}
BITMEDIA_320_100_PLACEMENT_ID: ${{ vars.BITMEDIA_320_100_PLACEMENT_ID }}
BITMEDIA_300_250_PLACEMENT_ID: ${{ vars.BITMEDIA_300_250_PLACEMENT_ID }}
BITMEDIA_728_90_PLACEMENT_ID: ${{ vars.BITMEDIA_728_90_PLACEMENT_ID }}
BITMEDIA_300_100_PLACEMENT_ID: ${{ vars.BITMEDIA_300_100_PLACEMENT_ID }}
BITMEDIA_250_250_PLACEMENT_ID: ${{ vars.BITMEDIA_250_250_PLACEMENT_ID }}
BITMEDIA_336_280_PLACEMENT_ID: ${{ vars.BITMEDIA_336_280_PLACEMENT_ID }}
BITMEDIA_160_600_PLACEMENT_ID: ${{ vars.BITMEDIA_160_600_PLACEMENT_ID }}
BITMEDIA_300_600_PLACEMENT_ID: ${{ vars.BITMEDIA_300_600_PLACEMENT_ID }}
BITMEDIA_970_90_PLACEMENT_ID: ${{ vars.BITMEDIA_970_90_PLACEMENT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE: ${{ vars.TEMPLE_ADS_ORIGIN_PASSPHRASE }}
TAKE_ADS_TOKEN: ${{ secrets.TAKE_ADS_TOKEN }}
CONVERSION_VERIFICATION_URL: ${{ vars.CONVERSION_VERIFICATION_URL }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ jobs:
SMARTY_970_250_PLACEMENT_ID: ${{ vars.SMARTY_970_250_PLACEMENT_ID }}
SMARTY_320_100_PLACEMENT_ID: ${{ vars.SMARTY_320_100_PLACEMENT_ID }}
SMARTY_300_600_PLACEMENT_ID: ${{ vars.SMARTY_300_600_PLACEMENT_ID }}
BITMEDIA_320_50_PLACEMENT_ID: ${{ vars.BITMEDIA_320_50_PLACEMENT_ID }}
BITMEDIA_320_100_PLACEMENT_ID: ${{ vars.BITMEDIA_320_100_PLACEMENT_ID }}
BITMEDIA_300_250_PLACEMENT_ID: ${{ vars.BITMEDIA_300_250_PLACEMENT_ID }}
BITMEDIA_728_90_PLACEMENT_ID: ${{ vars.BITMEDIA_728_90_PLACEMENT_ID }}
BITMEDIA_300_100_PLACEMENT_ID: ${{ vars.BITMEDIA_300_100_PLACEMENT_ID }}
BITMEDIA_250_250_PLACEMENT_ID: ${{ vars.BITMEDIA_250_250_PLACEMENT_ID }}
BITMEDIA_336_280_PLACEMENT_ID: ${{ vars.BITMEDIA_336_280_PLACEMENT_ID }}
BITMEDIA_160_600_PLACEMENT_ID: ${{ vars.BITMEDIA_160_600_PLACEMENT_ID }}
BITMEDIA_300_600_PLACEMENT_ID: ${{ vars.BITMEDIA_300_600_PLACEMENT_ID }}
BITMEDIA_970_90_PLACEMENT_ID: ${{ vars.BITMEDIA_970_90_PLACEMENT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE: ${{ vars.TEMPLE_ADS_ORIGIN_PASSPHRASE }}
TAKE_ADS_TOKEN: ${{ secrets.TAKE_ADS_TOKEN }}
CONVERSION_VERIFICATION_URL: ${{ vars.CONVERSION_VERIFICATION_URL }}
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/secrets-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,26 @@ inputs:
required: true
SMARTY_300_600_PLACEMENT_ID:
required: true
BITMEDIA_320_50_PLACEMENT_ID:
required: true
BITMEDIA_320_100_PLACEMENT_ID:
required: true
BITMEDIA_300_250_PLACEMENT_ID:
required: true
BITMEDIA_728_90_PLACEMENT_ID:
required: true
BITMEDIA_300_100_PLACEMENT_ID:
required: false
BITMEDIA_250_250_PLACEMENT_ID:
required: false
BITMEDIA_336_280_PLACEMENT_ID:
required: false
BITMEDIA_160_600_PLACEMENT_ID:
required: false
BITMEDIA_300_600_PLACEMENT_ID:
required: false
BITMEDIA_970_90_PLACEMENT_ID:
required: false
CONVERSION_VERIFICATION_URL:
required: true
# [e2e]
Expand Down Expand Up @@ -195,6 +215,16 @@ runs:
SMARTY_970_250_PLACEMENT_ID=${{ inputs.SMARTY_970_250_PLACEMENT_ID }}
SMARTY_320_100_PLACEMENT_ID=${{ inputs.SMARTY_320_100_PLACEMENT_ID }}
SMARTY_300_600_PLACEMENT_ID=${{ inputs.SMARTY_300_600_PLACEMENT_ID }}
BITMEDIA_320_50_PLACEMENT_ID=${{ inputs.BITMEDIA_320_50_PLACEMENT_ID }}
BITMEDIA_320_100_PLACEMENT_ID=${{ inputs.BITMEDIA_320_100_PLACEMENT_ID }}
BITMEDIA_300_250_PLACEMENT_ID=${{ inputs.BITMEDIA_300_250_PLACEMENT_ID }}
BITMEDIA_728_90_PLACEMENT_ID=${{ inputs.BITMEDIA_728_90_PLACEMENT_ID }}
BITMEDIA_300_100_PLACEMENT_ID=${{ inputs.BITMEDIA_300_100_PLACEMENT_ID }}
BITMEDIA_250_250_PLACEMENT_ID=${{ inputs.BITMEDIA_250_250_PLACEMENT_ID }}
BITMEDIA_336_280_PLACEMENT_ID=${{ inputs.BITMEDIA_336_280_PLACEMENT_ID }}
BITMEDIA_160_600_PLACEMENT_ID=${{ inputs.BITMEDIA_160_600_PLACEMENT_ID }}
BITMEDIA_300_600_PLACEMENT_ID=${{ inputs.BITMEDIA_300_600_PLACEMENT_ID }}
BITMEDIA_970_90_PLACEMENT_ID=${{ inputs.BITMEDIA_970_90_PLACEMENT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE=${{ inputs.TEMPLE_ADS_ORIGIN_PASSPHRASE }}
TAKE_ADS_TOKEN=${{ inputs.TAKE_ADS_TOKEN }}
CONVERSION_VERIFICATION_URL=${{ inputs.CONVERSION_VERIFICATION_URL }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "temple-wallet",
"version": "1.32.0",
"version": "1.32.1",
"private": true,
"scripts": {
"start-run": "cross-env TS_NODE_PROJECT=\"webpack/tsconfig.json\" webpack --watch --stats errors-warnings",
Expand Down
43 changes: 26 additions & 17 deletions src/app/pages/TempleTapAirdrop/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { FC, memo, PropsWithChildren, useCallback, useMemo, useState } from 'react';

import clsx from 'clsx';
import { OnSubmit, useForm } from 'react-hook-form';

import { Alert, Anchor, FormField, FormSubmitButton } from 'app/atoms';
Expand All @@ -18,7 +19,7 @@ import BannerImgSrc from './banner.png';
import { ReactComponent as ConfirmedSvg } from './confirmed.svg';

interface FormData {
username: string;
usernameOrId: string;
}

export const TempleTapAirdropPage = memo(() => {
Expand Down Expand Up @@ -81,13 +82,13 @@ export const TempleTapAirdropPage = memo(() => {
const submitting = formState.isSubmitting;

const onSubmit = useCallback<OnSubmit<FormData>>(
async ({ username }) => {
async ({ usernameOrId }) => {
clearError();

try {
const sigAuthValues = await prepSigAuthValues();

const res = await sendTempleTapAirdropUsernameConfirmation(accountPkh, username, sigAuthValues);
const res = await sendTempleTapAirdropUsernameConfirmation(accountPkh, usernameOrId, sigAuthValues);

switch (res.data.status) {
case 'ACCEPTED':
Expand All @@ -103,7 +104,7 @@ export const TempleTapAirdropPage = memo(() => {
} catch (error: any) {
console.error(error);

setError('username', 'submit-error', error?.response?.data?.message || 'Something went wrong...');
setError('usernameOrId', 'submit-error', error?.response?.data?.message || 'Something went wrong...');
}
},
[reset, clearError, setError, setStoredRecord, prepSigAuthValues, accountPkh]
Expand Down Expand Up @@ -140,13 +141,14 @@ export const TempleTapAirdropPage = memo(() => {
<BlockComp
title="Address confirmed"
description="Your address has been successfully confirmed in Temple Tap bot for future airdrop distribution."
padText
>
<ConfirmedSvg className="w-6 h-6 absolute top-4 right-4" />
</BlockComp>
) : (
<BlockComp
title="Confirm address"
description="Enter your telegram @username to confirm your Tezos address in Temple Tap bot for future airdrop distribution"
description="Enter your Telegram ID or @username to confirm your Tezos address in Temple Tap bot for future airdrop distribution"
>
<div className="text-xs leading-5 text-dark-gray">
<span>Your address: </span>
Expand All @@ -155,19 +157,13 @@ export const TempleTapAirdropPage = memo(() => {

<form onSubmit={handleSubmit(onSubmit)} className="contents">
<FormField
ref={register({
pattern: {
value: TG_USERNAME_REGEX,
message:
"Starts with '@'. You can use a-z, A-Z, 0-9 and '_' in between. Minimum length is 6 characters."
}
})}
name="username"
placeholder="@username"
ref={register({ validate })}
name="usernameOrId"
placeholder="Telegram ID or @username"
className="mt-4"
style={{ backgroundColor: 'white' }}
disabled={submitting}
errorCaption={errors.username?.message}
errorCaption={errors.usernameOrId?.message}
/>

<FormSubmitButton type="submit" loading={submitting} className="mt-4">
Expand Down Expand Up @@ -200,13 +196,14 @@ type LocalStorageRecord = StringRecord<true>;
interface BlockCompProps {
title: string;
description: string;
padText?: boolean;
}

const BlockComp: FC<PropsWithChildren<BlockCompProps>> = ({ title, description, children }) => (
const BlockComp: FC<PropsWithChildren<BlockCompProps>> = ({ title, description, padText, children }) => (
<div className="mt-4 relative flex flex-col p-4 bg-gray-100 rounded-xl">
<span className="text-sm font-semibold text-dark">{title}</span>

<p className="my-1 pr-4 text-xs leading-5 text-gray-600">{description}</p>
<p className={clsx('my-1 text-xs leading-5 text-gray-600', padText && 'pr-4')}>{description}</p>

{children}
</div>
Expand All @@ -233,3 +230,15 @@ const SocialItem: FC<SocialItemProps> = ({ title, IconComp, followUrl }) => (
);

const TG_USERNAME_REGEX = /^@[a-zA-Z0-9](?:[a-zA-Z0-9_]{3,}[a-zA-Z0-9])$/;

function validate(value: string) {
const numberValue = Number(value);
if (Number.isInteger(numberValue) && numberValue > 0) return true;

if (TG_USERNAME_REGEX.test(value)) return true;

if (value.includes('@'))
return "Username starts with '@'. You can use a-z, A-Z, 0-9 and '_' in between. Minimum length is 6 characters.";

return 'Telegram ID should contain only numbers';
}
Loading

0 comments on commit bc15849

Please sign in to comment.