Package Exports
- @epurchasepower/can-action-carousel
- @epurchasepower/can-action-carousel/dist/production/can-plugin.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@epurchasepower/can-action-carousel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Climate Action Now Web Plugin
A React-based web plugin for embedding climate action cards into any website. Built with TypeScript, Vite, and Tailwind CSS.
Embedding
Quick start for embedding the plugin:
<!-- Option 1: Script Embedding (auto-sizing) -->
<script
src="https://unpkg.com/@epurchasepower/can-action-carousel@latest/dist/production/embed-loader.js"
data-client-id="can"
data-campaign-code="173"
data-theme="light"
></script>
<!-- Option 2: Direct Iframe (most reliable) -->
<iframe
src="https://unpkg.com/@epurchasepower/can-action-carousel@latest/dist/production/src/embed.html?clientId=can&campaignCode=173&theme=light"
width="100%"
style="border: 0; height: 600px;"
title="Climate Action Plugin"
sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
>
</iframe>Features
- Action Cards: Interactive climate action cards with completion tracking
- Multi-Step Flows: Petition signing, calling representatives, and learning actions
- Responsive Design: Works on desktop and mobile devices
- Theme Support: Light and dark themes
- Auto-Resize: Dynamic height adjustment (script embedding)
- Cross-Origin Safe: Bypasses browser security restrictions
Development
Quick Start
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Start iframe development (for embedding tests)
pnpm dev:iframe
# Build for production
pnpm build:staging # Staging build
pnpm build:production # Production build
# Run tests
pnpm test
pnpm check-types
pnpm lintEnvironment Configuration
Create .env.development from .env.example:
VITE_API_BASE_URL=http://localhost:8040
VITE_TENANT_ID=can
VITE_CAMPAIGN_CODE=173Releasing
The plugin supports multi-environment releases to npm/unpkg with separate versions for development, staging, and production.
Release Commands
# Development releases (for active development and testing)
# ⚠️ IMPORTANT: Uses STAGING environment variables (staging API, test Stripe keys)
pnpm run release:development # Interactive version selection
pnpm run release:development:patch # Patch version (0.0.X)
pnpm run release:development:minor # Minor version (0.X.0)
pnpm run release:development:major # Major version (X.0.0)
# Staging releases (for testing before production)
pnpm run release:staging # Interactive version selection
pnpm run release:staging:patch # Patch version with -staging suffix
pnpm run release:staging:minor # Minor version with -staging suffix
pnpm run release:staging:major # Major version with -staging suffix
# Production releases (for live production use)
pnpm run release:production # Interactive version selection
pnpm run release:production:patch # Patch version (0.0.X)
pnpm run release:production:minor # Minor version (0.X.0)
pnpm run release:production:major # Major version (X.0.0)
# View all options
pnpm run release:helpVersion Strategy
- Development (
@developmenttag):X.Y.Z-dev.N- For rapid iteration and testing- ⚠️ Uses STAGING environment variables (staging API, test Stripe keys, etc.)
- This allows published development builds to be tested externally without localhost
- Staging (
@stagingtag):X.Y.Z-staging.N- For pre-production testing- Uses staging environment variables
- Production (
@latesttag):X.Y.Z- For production use- Uses production environment variables
Release Process
Each release automatically:
- Validates code (type checking, linting)
- Builds all three environments (development, staging, production)
- Bumps version according to selection
- Publishes to npm with appropriate dist-tag
- Displays unpkg CDN URLs for immediate use
Example development workflow:
# Make changes to the code
# ...
# Publish a development version
pnpm run release:development:patch
# Test using the development URL:
# https://unpkg.com/@epurchasepower/can-action-carousel@development/dist/development/iframe-embed-loader.js
# When ready, promote to staging
pnpm run release:staging:patch
# After testing staging, release to production
pnpm run release:production:patchTesting Releases
# Test local development build
pnpm dev
# Test published development version from unpkg
pnpm run test:embed:development
# Test staging version
pnpm run test:embed:staging
# Test production version
pnpm run test:embed:productionArchitecture
Built with React, TypeScript, and Tailwind CSS. Key directories:
src/components/- React componentssrc/features/- Feature modules (actions, carousel)src/hooks/- Custom React hookssrc/services/- API services
Contributing
- Create a feature branch
- Make your changes
- Run
pnpm testandpnpm check-types - Submit a pull request