Skip to content

Conversation

@prosdev
Copy link
Contributor

@prosdev prosdev commented Dec 26, 2025

Multiple Buttons API with Variants

Implements flexible buttons array for banner experiences with visual variants and responsive layout.

Key Changes

Breaking Change: button property replaced with buttons array

// Before
button: { text: 'Click', url: '/start' }

// After
buttons: [
  { text: 'Accept', variant: 'primary', action: 'accept' },
  { text: 'Reject', variant: 'secondary', action: 'reject' },
  { text: 'More', variant: 'link', url: '/info' }
]

Features

  • Three variants: primary (blue), secondary (gray), link (text)
  • Responsive layout: inline on desktop, stacked on mobile
  • Enhanced events: variant and metadata in action events
  • New docs page: Complete Plugins reference at /reference/plugins

Build Improvements

  • pnpm build and pnpm dev now exclude docs (SDK only)
  • Added basePath for GitHub Pages: prosdevlab.github.io/experience-sdk
  • Updated navigation and cleaned up broken doc links

Testing

All 138 tests passing

- Runtime emits both decision and experience in evaluated event
- Banner plugin auto-renders on experiences:evaluated event
- Frequency plugin listens to new event structure
- Plugins self-organize by checking experience type
- Runtime stays generic and unopinionated
- Fix SDK lifecycle management after destroy/init cycle
- Update all tests to match new event structure

This enables true modularity - adding new experience types (modal,
tooltip) only requires adding a plugin, no runtime changes needed.
- Add event examples to Getting Started (tracking, multiple consumers)
- Expand API Reference with all SDK events and payloads
- Create comprehensive Events Reference page (/reference/events)
- Add jstag3, GA4, Segment integration examples

- Add CTA button support to banner plugin (text, url, action)
- Emit experiences:action events on button clicks
- Add dismissable flag to banner content
- Update demo with CTA button

- Fix dev mode: ESM-only in watch, ESM+IIFE in production
- Remove unused imports and fix type issues
- Add priority field to Experience interface (default: 0)
- Implement evaluateAll() method to evaluate all experiences
- Sort by priority (descending), ties maintain registration order
- All matching experiences shown (natural stacking)
- Update plugins to handle array and single event payloads
- Add comprehensive tests for priority sorting and multiple experiences
- Emit single experiences:evaluated event with array of {decision, experience}
- Add buttons array to BannerContent with primary/secondary/link variants
- Add responsive layout (desktop inline, mobile stack)
- Remove legacy single button property (no backward compat)
- Update all tests and documentation
- Create comprehensive Plugins reference page
- Fix build to exclude docs from SDK build/dev
- Clean up outdated doc references

BREAKING CHANGE: button property replaced with buttons array
@prosdev prosdev merged commit f187552 into main Dec 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants