Skip to content

Commit

Permalink
Merge pull request #2833 from dev-protocol/feat-checkout-page-offerings
Browse files Browse the repository at this point in the history
feat: add offerings into join plugin paths
  • Loading branch information
yashdesu authored Oct 15, 2024
2 parents 885d13c + 3a7e796 commit 67e0cc8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/plugins/join/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import { default as Icon } from './assets/icon.svg'
import { Content as Readme } from './README.md'
import Preview1 from './assets/join-1.jpg'
import Preview2 from './assets/join-2.jpg'
import { isPriced } from '@plugins/memberships/utils/is'

export const getPagePaths = (async (
_,
{ propertyAddress, name, rpcUrl },
{ propertyAddress, name, rpcUrl, offerings },
{ getPluginConfigById },
) => {
const [membershipConfig] = getPluginConfigById(
Expand All @@ -27,21 +26,31 @@ export const getPagePaths = (async (
const allMemberships = membershipConfig?.options.find(
(opt) => opt.key === 'memberships',
)?.value as UndefinedOr<Membership[]>

// Filter out deprecated memberships.
const memberships = allMemberships?.filter(
(membership) => !membership.deprecated,
)
const membershipTiers = memberships?.map((mem) => ({
...mem,
currency: mem.currency?.toLocaleLowerCase(),
title: mem.name,
amount: mem.price,
badgeImageSrc: mem.imageSrc,
badgeImageDescription: mem.description,
managedBy: 'devprotocol:clubs:simple-memberships',
}))

const tiers = memberships?.map((mem) => ({
const offeringTiers = offerings?.map((mem) => ({
...mem,
currency: mem.currency?.toLocaleLowerCase(),
title: mem.name,
amount: mem.price,
badgeImageSrc: mem.imageSrc,
badgeImageDescription: mem.description,
managedBy: mem.managedBy,
}))

const tiers = [...(membershipTiers ?? []), ...(offeringTiers ?? [])]
return tiers
? [
{
Expand Down

0 comments on commit 67e0cc8

Please sign in to comment.