Skip to content

Commit

Permalink
Merge pull request #317 from LinkdropHQ/dev_country-restrictions
Browse files Browse the repository at this point in the history
Dev country restrictions
  • Loading branch information
spacehaz authored Jul 11, 2024
2 parents ec0f6e4 + 18c7fa4 commit fd6cf78
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/pages/claim-page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type TDefineStep = (
setAddressCallback: (address: string) => void
) => ReactElement

const defineCurrentScreen: TDefineStep = (step, setStep, setAddressCallback) => {
const defineCurrentScreen: TDefineStep = (step, setStep, setAddressCallback) => {
switch (step) {
case 'initial':
return <InitialScreen />
Expand Down
4 changes: 2 additions & 2 deletions src/configs/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const weddingParams: TApplicationParams = {
highlightActiveColor: '#095AF5',

primaryText: 'I love you, onchain',
primaryDescription: 'Tap to claim an onchain memento of our wedding, as well as 0.001 ETH on Base to get your started exploring onchain.',
primaryDescription: 'Tap to claim an onchain memento of our wedding, as well as 0.001 ETH on Base to get you started exploring onchain.',
tokenImage: WeddingImage
}

Expand All @@ -90,4 +90,4 @@ const applicationParams: TConfig = {

export const COINBASE_CLAIM_URL = 'https://wallet.coinbase.com/claim?tk=code&k=<CODE>&c=<CHAIN_ID>&v=<VERSION>&src=d'

export default applicationParams
export default applicationParams
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@ export default function getData(
dispatch: Dispatch<DropActions> & Dispatch<TokenActions> & Dispatch<UserActions> & IAppDispatch,
getState: () => RootState
) => {

const {
drop: {
campaignId
}
} = getState()

try {
dispatch(actionsDrop.setLoading(true))

await dispatch(asyncActionsUser.initialize(
onReload,
connector,
signer,
userChainId,
userAddress
))

const {
user: {
provider,
Expand All @@ -47,7 +51,6 @@ export default function getData(
expirationTime,
tokenId,
type,
campaignId,
claimCode
}
} = getState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default function getLinkByCode(
claiming_finished_description,
claiming_finished_button_title,
claiming_finished_button_url,
claiming_finished_button_on,
available_wallets
} : TLinkParams = data

Expand Down Expand Up @@ -95,7 +96,11 @@ export default function getLinkByCode(
// }


if (claiming_finished_button_title && claiming_finished_button_url) {
if (
claiming_finished_button_title &&
claiming_finished_button_url &&
claiming_finished_button_on
) {
dispatch(actionsDrop.setClaimingFinishedButtonTitle(claiming_finished_button_title))
dispatch(actionsDrop.setClaimingFinishedButtonURL(claiming_finished_button_url))
}
Expand Down
10 changes: 8 additions & 2 deletions src/data/store/reducers/drop/async-actions/get-link-from-url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DropActions } from '../types'
import * as actionsDrop from '../actions'
import * as asyncActionsDrop from '.'
import axios, { AxiosError } from 'axios'
import { IAppDispatch } from 'data/store'
import { IAppDispatch, RootState } from 'data/store'
import { plausibleApi } from 'data/api'
import { TSystem } from 'types'

Expand All @@ -14,9 +14,15 @@ export default function getLinkFromURL(
callback: (location: string) => void
) {
return async (
dispatch: Dispatch<DropActions> & IAppDispatch
dispatch: Dispatch<DropActions> & IAppDispatch,
getState: () => RootState
) => {
dispatch(actionsDrop.setError(null))
const {
drop: {
campaignId
}
} = getState()
try {
await dispatch(asyncActionsDrop.getLinkByCode(
linkCode,
Expand Down
7 changes: 4 additions & 3 deletions src/data/store/reducers/user/async-actions/initialize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ const initialize = (
dispatch(actions.setHasConnector(true))
dispatch(actions.setAddress(userAddress))
dispatch(actions.setChainId(userChainId))

const provider = await connector.getProvider()
if (connector.getProvider) {
const provider = await connector.getProvider()
dispatch(actions.setUserProvider(provider))
}

dispatch(actions.setUserProvider(provider))
dispatch(actions.setSigner(signer))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ const updateUserData = (
dispatch(userActions.setAddress(address))
dispatch(userActions.setChainId(chainId))
if (connector) {
const provider = await connector.getProvider()
dispatch(userActions.setUserProvider(provider))
if (connector.getProvider) {
const provider = await connector.getProvider()
dispatch(userActions.setUserProvider(provider))
}
}
if (signer) {
dispatch(userActions.setSigner(signer))
Expand Down
1 change: 1 addition & 0 deletions src/types/link-params.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export type TLinkParams = {
claiming_finished_description?: string
claiming_finished_button_title?: string
claiming_finished_button_url?: string
claiming_finished_button_on?: boolean
available_wallets?: string[]
}

0 comments on commit fd6cf78

Please sign in to comment.