diff --git a/vue-app/.env.example b/vue-app/.env.example index b7a9357e4..26689edf3 100644 --- a/vue-app/.env.example +++ b/vue-app/.env.example @@ -21,7 +21,7 @@ VITE_SUBGRAPH_URL=http://localhost:8000/subgraphs/name/clrfund/clrfund VITE_CLRFUND_ADDRESS=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82 -# Supported values: simple, brightid, snapshot, merkle +# Supported values: simple, brightid, snapshot, merkle, semaphore VITE_USER_REGISTRY_TYPE=simple # clr.fund (prod) or CLRFundTest (testing) # Learn more about BrightID and context in /docs/brightid.md diff --git a/vue-app/src/api/core.ts b/vue-app/src/api/core.ts index 5caa704c6..6d79b2785 100644 --- a/vue-app/src/api/core.ts +++ b/vue-app/src/api/core.ts @@ -45,6 +45,7 @@ export enum UserRegistryType { SIMPLE = 'simple', SNAPSHOT = 'snapshot', MERKLE = 'merkle', + SEMAPHORE = 'semaphore', } if (!Object.values(UserRegistryType).includes(userRegistryType as UserRegistryType)) { @@ -92,7 +93,11 @@ export const showComplianceRequirement = /^yes$/i.test(import.meta.env.VITE_SHOW export const isBrightIdRequired = userRegistryType === 'brightid' export const isOptimisticRecipientRegistry = recipientRegistryType === 'optimistic' -export const isUserRegistrationRequired = userRegistryType !== UserRegistryType.SIMPLE +export const isUserRegistrationRequired = [ + UserRegistryType.BRIGHT_ID, + UserRegistryType.MERKLE, + UserRegistryType.SNAPSHOT, +].includes(userRegistryType) // Try to get the next scheduled start date const nextStartDate = import.meta.env.VITE_NEXT_ROUND_START_DATE diff --git a/vue-app/src/components/CallToActionCard.vue b/vue-app/src/components/CallToActionCard.vue index 7d094a1a6..2d29121d7 100644 --- a/vue-app/src/components/CallToActionCard.vue +++ b/vue-app/src/components/CallToActionCard.vue @@ -55,7 +55,7 @@ import { computed } from 'vue' import BrightIdWidget from '@/components/BrightIdWidget.vue' import Links from '@/components/Links.vue' -import { userRegistryType, UserRegistryType, isBrightIdRequired } from '@/api/core' +import { isUserRegistrationRequired, isBrightIdRequired } from '@/api/core' import { useAppStore, useUserStore } from '@/stores' import { storeToRefs } from 'pinia' @@ -69,7 +69,7 @@ const hasStartedVerification = computed( ) const showUserVerification = computed(() => { return ( - userRegistryType !== UserRegistryType.SIMPLE && + isUserRegistrationRequired && currentRound.value && currentUser.value?.isRegistered !== undefined && !currentUser.value.isRegistered diff --git a/vue-app/src/components/Cart.vue b/vue-app/src/components/Cart.vue index cb10c454a..1e0301d38 100644 --- a/vue-app/src/components/Cart.vue +++ b/vue-app/src/components/Cart.vue @@ -237,7 +237,7 @@ import CartItems from '@/components/CartItems.vue' import Links from '@/components/Links.vue' import TimeLeft from '@/components/TimeLeft.vue' import { MAX_CONTRIBUTION_AMOUNT, MAX_CART_SIZE, type CartItem, isContributionAmountValid } from '@/api/contributions' -import { userRegistryType, UserRegistryType, operator } from '@/api/core' +import { userRegistryType, UserRegistryType, operator, isUserRegistrationRequired } from '@/api/core' import { RoundStatus } from '@/api/round' import { formatAmount as _formatAmount } from '@/utils/amounts' import FundsNeededWarning from '@/components/FundsNeededWarning.vue' @@ -477,18 +477,16 @@ const isBrightIdRequired = computed( () => userRegistryType === UserRegistryType.BRIGHT_ID && !currentUser.value?.isRegistered, ) -const isRegistrationRequired = computed( - () => userRegistryType !== UserRegistryType.SIMPLE && !currentUser.value?.isRegistered, -) +const isRegistrationRequired = computed(() => isUserRegistrationRequired && !currentUser.value?.isRegistered) const errorMessage = computed(() => { if (isMessageLimitReached.value) return t('dynamic.cart.error.reached_contribution_limit') if (!currentUser.value) return t('dynamic.cart.error.connect_wallet') if (isBrightIdRequired.value) return t('dynamic.cart.error.need_to_setup_brightid') if (!currentUser.value.isRegistered) { - return userRegistryType === UserRegistryType.SIMPLE - ? t('dynamic.cart.error.user_not_registered', { operator }) - : t('dynamic.cart.error.need_to_register') + return isUserRegistrationRequired + ? t('dynamic.cart.error.need_to_register') + : t('dynamic.cart.error.user_not_registered', { operator }) } if (!isFormValid()) return t('dynamic.cart.error.invalid_contribution_amount') if (cart.value.length > MAX_CART_SIZE)