Skip to content

Commit

Permalink
add support for per-channel pricing (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
bverbeken authored Aug 23, 2024
1 parent a3b6bd1 commit ed6359b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ const fullChartRendererConfig: Required<ChartRendererConfigOptions> = {
{ ticketType: 'adult', price: 30, label: 'Adults' },
{ ticketType: 'child', price: 20, label: 'Children' },
{ ticketType: 'senior', price: 25, label: 'Senior', description: '65+ – Requires ID' }
]}
], channels: [
{ channel: 'channel1', price: 30},
]},
{ category: 'C', price: 10, channels: [
{ channel: 'channel1', price: 30},
{ channel: 'channel2', originalPrice: 40, price: 50},
{ channel: 'channel3', ticketTypes: [
{ ticketType: 'adult', price: 60 },
{ ticketType: 'child', price: 70, label: 'Children' }
]}
]
}
],
priceFormatter: price => '$' + price,
showSectionPricingOverlay: true,
Expand Down
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1096,13 +1096,28 @@ export type SimplePricing = {
category: CategoryKey
originalPrice?: number
price: number
channels?: ChannelPricing[]
}

export type MultiLevelPricing = {
category: number | string,
ticketTypes: TicketType[]
}

export type ChannelPricing = (SimpleChannelPricing | MultiLevelChannelPricing)

export type SimpleChannelPricing = {
channel: string
originalPrice?: number
price: number
}

export type MultiLevelChannelPricing = {
channel: string
ticketTypes: TicketType[]
}


export type TicketType = {
ticketType: string
originalPrice?: number
Expand Down

0 comments on commit ed6359b

Please sign in to comment.