dynamatic-upsell
v1.0.0
Published
Shared utilities for Dynamatic widgets
Maintainers
Readme
dynamatic-upsell
Shared utilities for Dynamatic widgets including schedule management, timezone handling, and more.
Features
- Schedule Management: Check if entities (widgets, campaigns) are currently live based on their schedule
- Timezone Support: Full IANA timezone support with automatic DST handling
- Repeat Patterns: Support for daily, weekly, monthly, and yearly schedules
- Type Safe: Full TypeScript support with exported types
Installation
bun add dynamatic-upsellUsage
import { isEntityCurrentlyLive, getCurrentHourInTimezone } from 'dynamatic-upsell'
import type { Entity, ScheduleConfig } from 'dynamatic-upsell'
## API
### Types
- `ScheduleConfig` - Configuration for repeating schedules
- `Entity` - Entity with schedule configuration
### Functions
- `isEntityCurrentlyLive(entity)` - Check if entity is currently live
- `isRepeatingScheduleLive(entity)` - Check repeating schedule specifically
- `getCurrentHourInTimezone(timezone)` - Get current hour (0-23) in timezone
- `formatTime(date)` - Format Date to HH:mm string
- `checkDailyPattern()` - Check daily repeat pattern
- `checkWeeklyPattern()` - Check weekly repeat pattern
- `checkMonthlyPattern()` - Check monthly repeat pattern
- `checkYearlyPattern()` - Check yearly repeat pattern
## License
MIT