Add KYC profile integration and SupplierInfoBlock component
Some checks failed
Build Docker Image / build (push) Failing after 2m51s

This commit is contained in:
Ruslan Bakiev
2026-01-21 09:19:44 +07:00
parent d8befc8b9f
commit ace458ed7e
10 changed files with 159 additions and 1 deletions

View File

@@ -26,6 +26,7 @@
:currency="getOfferData(option.sourceUuid)?.currency"
:unit="getOfferData(option.sourceUuid)?.unit"
:stages="getRouteStages(option)"
:kyc-profile-uuid="getKycProfileUuid(option.sourceUuid)"
/>
</div>
@@ -64,7 +65,7 @@
<script setup lang="ts">
import { GetOffersByHubDocument } from '~/composables/graphql/public/geo-generated'
import type { RouteStageItem } from '~/components/RouteStagesList.vue'
import { GetOfferDocument } from '~/composables/graphql/public/exchange-generated'
import { GetOfferDocument, GetSupplierProfileByTeamDocument } from '~/composables/graphql/public/exchange-generated'
const route = useRoute()
const searchStore = useSearchStore()
@@ -76,6 +77,8 @@ const quantity = computed(() => (route.query.quantity as string) || (searchStore
// Offer data for prices
const offersData = ref<Map<string, any>>(new Map())
// Supplier data for KYC profile UUID (by team_uuid)
const suppliersData = ref<Map<string, any>>(new Map())
const summaryTitle = computed(() => `${productName.value}${locationName.value}`)
const summaryMeta = computed(() => {
@@ -163,26 +166,57 @@ const getOfferData = (uuid?: string | null) => {
return offersData.value.get(uuid)
}
// Get KYC profile UUID by offer UUID
const getKycProfileUuid = (offerUuid?: string | null) => {
if (!offerUuid) return null
const offer = offersData.value.get(offerUuid)
if (!offer?.teamUuid) return null
const supplier = suppliersData.value.get(offer.teamUuid)
return supplier?.kycProfileUuid || null
}
// Load offer details for prices
const loadOfferDetails = async (options: ProductRouteOption[]) => {
if (options.length === 0) {
offersData.value.clear()
suppliersData.value.clear()
return
}
const newOffersData = new Map<string, any>()
const newSuppliersData = new Map<string, any>()
const teamUuidsToLoad = new Set<string>()
// First, load all offers
await Promise.all(options.map(async (option) => {
if (!option.sourceUuid) return
try {
const data = await execute(GetOfferDocument, { uuid: option.sourceUuid }, 'public', 'exchange')
if (data?.getOffer) {
newOffersData.set(option.sourceUuid, data.getOffer)
if (data.getOffer.teamUuid) {
teamUuidsToLoad.add(data.getOffer.teamUuid)
}
}
} catch (error) {
console.error('Error loading offer:', option.sourceUuid, error)
}
}))
// Then, load supplier profiles for all team UUIDs
await Promise.all([...teamUuidsToLoad].map(async (teamUuid) => {
try {
const data = await execute(GetSupplierProfileByTeamDocument, { teamUuid }, 'public', 'exchange')
if (data?.getSupplierProfileByTeam) {
newSuppliersData.set(teamUuid, data.getSupplierProfileByTeam)
}
} catch (error) {
console.error('Error loading supplier:', teamUuid, error)
}
}))
offersData.value = newOffersData
suppliersData.value = newSuppliersData
}
// Watch for route options and load offers