- Tenant-Admin-PWA: Neues /event-admin/welcome Onboarding mit WelcomeHero, Packages-, Order-Summary- und Event-Setup-Pages, Zustandsspeicher, Routing-Guard und Dashboard-CTA für Erstnutzer; Filament-/admin-Login via Custom-View behoben.
- Brand/Theming: Marketing-Farb- und Typographievariablen in `resources/css/app.css` eingeführt, AdminLayout, Dashboardkarten und Onboarding-Komponenten entsprechend angepasst; Dokumentation (`docs/todo/tenant-admin-onboarding-fusion.md`, `docs/changes/...`) aktualisiert. - Checkout & Payments: Checkout-, PayPal-Controller und Tests für integrierte Stripe/PayPal-Flows sowie Paket-Billing-Abläufe überarbeitet; neue PayPal SDK-Factory und Admin-API-Helper (`resources/js/admin/api.ts`) schaffen Grundlage für Billing/Members/Tasks-Seiten. - DX & Tests: Neue Playwright/E2E-Struktur (docs/testing/e2e.md, `tests/e2e/tenant-onboarding-flow.test.ts`, Utilities), E2E-Tenant-Seeder und zusätzliche Übersetzungen/Factories zur Unterstützung der neuen Flows. - Marketing-Kommunikation: Automatische Kontakt-Bestätigungsmail (`ContactConfirmation` + Blade-Template) implementiert; Guest-PWA unter `/event` erreichbar. - Nebensitzung: Blogsystem gefixt und umfassenden BlogPostSeeder für Beispielinhalte angelegt.
This commit is contained in:
22
docs/changes/2025-10-09-paypal-sdk-migration.md
Normal file
22
docs/changes/2025-10-09-paypal-sdk-migration.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# PayPal SDK Migration to v1 Server SDK
|
||||
|
||||
## Summary
|
||||
Migrated from deprecated `paypal/paypal-checkout-sdk` to `paypal/paypal-server-sdk ^1.0+` in PayPalController.php. The new SDK uses a Builder pattern for requests and dedicated Controllers for API calls, based on OAuth2 Client Credentials.
|
||||
|
||||
## Changes
|
||||
- **Composer**: Removed `paypal/paypal-checkout-sdk`; retained/updated `paypal/paypal-server-sdk`.
|
||||
- **Imports**: Replaced old classes (PayPalHttpClient, OrdersCreateRequest, etc.) with new (PaypalServerSdkClientBuilder, OrderRequestBuilder, OrdersController, etc.).
|
||||
- **Constructor**: Updated to use `PaypalServerSdkClientBuilder` with `ClientCredentialsAuthCredentialsBuilder` and Environment (Sandbox/Production based on config/services.php).
|
||||
- **createOrder**: Now uses `OrdersController->createOrder` with `OrderRequestBuilder` for intent, purchase units (AmountWithBreakdownBuilder), custom_id, and application_context.
|
||||
- **captureOrder**: Now uses `OrdersController->captureOrder`; extracts custom_id from response->result->purchaseUnits for DB creation (PackagePurchase/TenantPackage).
|
||||
- **createSubscription**: Now uses `SubscriptionsController->createSubscription` with `SubscriptionRequestBuilder` for plan_id, subscriber (NameBuilder), custom_id, and application_context.
|
||||
- **Tests**: Updated tests/Feature/PurchaseTest.php to mock new SDK classes (e.g., OrdersController, SubscriptionsController) and responses; preserved test logic for flows, errors, idempotency.
|
||||
- **Documentation**: Updated docs/prp/08-billing.md to reflect new SDK usage, flow, and migration notes.
|
||||
|
||||
## Testing
|
||||
- Unit/Feature Tests: All PayPal-related tests pass with mocks simulating new API responses (statusCode 201, result structure).
|
||||
- Integration: Verified with Sandbox keys; simulated orders/subscriptions create DB entries correctly; error handling intact.
|
||||
- No Breaking Changes: Existing webhook logic and completePurchase calls unaffected; custom_id metadata preserved.
|
||||
|
||||
## Rationale
|
||||
The old SDK is deprecated and not recommended by PayPal. The new v1 Server SDK aligns with modern standards, improves security (OAuth2), and supports future features. Migration maintains backward compatibility for frontend and DB logic.
|
||||
84
docs/changes/2025-10-10-tenant-admin-onboarding-plan.md
Normal file
84
docs/changes/2025-10-10-tenant-admin-onboarding-plan.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Tenant Admin PWA — Onboarding + Management Fusion
|
||||
|
||||
## Context
|
||||
- Goal: Merge the immersive onboarding / ordering flow from the legacy Capacitor app with the new `/event-admin` management experience inside Laravel.
|
||||
- Desired outcome: Tenants land in a polished, mobile-first “welcome†journey when they first log in, complete package purchase + event setup, then switch to the operational dashboard once active.
|
||||
|
||||
## TODOs
|
||||
1. **Audit Legacy Assets**
|
||||
- Inventory screens/components from `fotospiel-tenant-app/tenant-admin-app` worth porting (intro carousel, package picker, CTA cards, animations, themed styles).
|
||||
- Document any dependencies (Framework7, custom icons, animation libs) and decide whether to port or recreate with our current Tailwind/React stack.
|
||||
|
||||
2. **Bootstrap Welcome Route Namespace**
|
||||
- Create `/event-admin/welcome/*` routes inside the Laravel tenant PWA.
|
||||
- Establish shared layout primitives (full-height hero, gradient backgrounds, swipeable steps) to match native feel.
|
||||
|
||||
3. **Port UI Steps**
|
||||
- Recreate the storytelling sequence (Brand intro → How it works → Package selection → Order CTA → First-event setup).
|
||||
- Hook actions into existing APIs (packages, checkout, event creation) and leverage current auth context.
|
||||
|
||||
4. **Lifecycle Routing Logic**
|
||||
- Add guard that directs tenants with no events / onboarding incomplete to the welcome flow after login.
|
||||
- Provide quick access from dashboard back into the guided flow when creating additional events.
|
||||
|
||||
5. **Capacitor/TWA Packaging Prep**
|
||||
- Ensure the merged `/event-admin` build is PWA-complete (manifest, offline) for future store submission.
|
||||
- Plan thin Capacitor wrapper reuse; retire the legacy repo after migration.
|
||||
|
||||
6. **Documentation & Hand-off**
|
||||
- Update PRP (tenant admin specs + onboarding) to reflect the unified experience.
|
||||
- Record component inventory and routing rules so future agents can extend both modes consistently.
|
||||
|
||||
## Component Audit — 2025-10-10
|
||||
|
||||
### Legacy Welcome & Story Shell
|
||||
- **Hero experience**: `App.tsx` renders a premium hero card with eyebrow, script headline, and dual CTA buttons (`/create-event`, `/tutorial`) layered on a soft gradient background with Framework7 cards and brand fonts.
|
||||
- **Feature highlights**: A three-card grid introduces guest gallery, timeline/tasks, and invites; badges flag free or included items for unauthenticated vs. subscribed tenants.
|
||||
- **Quick actions**: Responsive button stack that shifts based on auth state (`demo event`, `tutorial`, `events`, `login`) providing an immediate action list after the hero.
|
||||
- **Credits strip**: `credits-card` combines balance chips, a RevenueCat-aware badge, and CTA to `/credits-store`; replicating this card gives tenants a quick read on package status.
|
||||
|
||||
### Monetisation & Ordering
|
||||
- **IAP store** (`pages/IAPStorePage.tsx`): Uses `@revenuecat/purchases-capacitor` for offerings, purchase status banners, and analytics tracking; cards highlight price, credit count, and subscription state. Needs Stripe/PayPal parity discussion before porting.
|
||||
- **Credits context** (`contexts/AuthContext.tsx`): Persists tokens and credit balances via Capacitor Preferences and refresh logic; emits helper APIs `purchasePackage`, `getCreditsBalance`.
|
||||
|
||||
### Event Creation Wizard
|
||||
- **Multi-step flow** (`pages/CreateEventWizard.tsx`): Three validated steps (Basics, Event type & mood, Confirmation) with segmented chips, animated progress bar, and analytics events (`trackEvent`). Integrates `EventService` for API calls and includes next/back navigation with swipe gestures.
|
||||
- **Mood board**: Step includes card gallery, tags, and dynamic feature chips to capture desired vibes—helpful reference for onboarding's storytelling portion.
|
||||
|
||||
### Theme & Visual System
|
||||
- **Design tokens** (`styles/tokens.css`): Brand palette, typography stack (Playfair Display, Montserrat, Lora, Great Vibes), spacing, radius, and shadow definitions exported as CSS variables.
|
||||
- **Framework7 overrides** (`styles/theme.css`, `styles/fonts.css`): Maps tokens onto Framework7 CSS variables to achieve native-feel bars, cards, and typography.
|
||||
- **Assets** (`src/assets/fonts/*`): Self-hosted font files referenced by tokens; need a Tailwind-friendly strategy (e.g., CSS `@font-face` via Vite) if we replicate the look.
|
||||
|
||||
### Supporting Utilities
|
||||
- **Services**: `services/AuthService.ts`, `services/EventService.ts`, `services/analytics.ts` provide OAuth PKCE glue, event CRUD helpers, and event tracking (mixpanel-like contract).
|
||||
- **i18n** (`src/i18n`): React context-based i18next with `en`/`de` copies for all hero/wizard strings; reuse dictionary keys where possible during port to keep translations aligned.
|
||||
|
||||
**Porting Recommendation**
|
||||
- Rebuild the hero, feature cards, quick actions, and wizard using Tailwind + shadcn components inside Laravel PWA while reusing copy/structure.
|
||||
- Lift design tokens into a Tailwind preset or CSS module so new welcome surfaces keep the premium typography without forcing Framework7 runtime.
|
||||
- Treat RevenueCat-specific logic as optional: plan abstraction so Stripe/PayPal packages in Laravel can slot in later if we skip native IAPs initially.
|
||||
|
||||
## Proposed Laravel PWA Welcome Primitives
|
||||
- **`TenantWelcomeLayout`**: Full-height, gradient-backed shell with centered content column, safe-area padding, and optional bottom action rail. Applies the legacy token palette via Tailwind CSS variables and toggles between light/dark.
|
||||
- **`WelcomeHero`**: Composable hero card exposing slots for eyebrow, headline, script subtitle, and dual CTA buttons. Ships with animation hooks (e.g., `framer-motion`/CSS fade) but degrades gracefully.
|
||||
- **`WelcomeStepCard`**: Step wrapper with built-in progress indicator, icon slot, and scroll snap. Intended for storytelling slides (`How it works`, `Why Fotospiel`) before handing off to form-based steps.
|
||||
- **`OnboardingCTAList`**: Responsive button group mirroring legacy quick actions; renders stacked buttons on mobile and inline actions on larger breakpoints. Consumes tenant/auth context to toggle copy.
|
||||
- **`OnboardingHighlightsGrid`**: Reusable grid for feature cards (icon, title, badge, copy) using existing shadcn `Card` primitives to reproduce the premium look without Framework7.
|
||||
- **`OnboardingProgressProvider`**: Lightweight Zustand or React context store that tracks completion state (welcome_seen, package_selected, event_created) for guards and resume logic.
|
||||
- **Theming bridge**: Introduce `tenant-admin.css` (or Tailwind preset) that re-exports critical tokens (`--tenant-primary`, serif display font) so the welcome experience and management dashboard share a palette while staying Tailwind-native.
|
||||
|
||||
These primitives live under `resources/js/admin/onboarding/` and integrate with current router constants (`ADMIN_BASE_PATH`). They should support lazy-loading so existing dashboard bundle size remains manageable.
|
||||
|
||||
## Progress
|
||||
- **Inline Checkout**: Die Order-Summary-Seite unterstützt jetzt Stripe-Kartenzahlungen (Payment Element) und PayPal (Orders API) direkt aus dem Onboarding heraus. Free-Packages lassen sich ohne Umweg aktivieren.
|
||||
- Dashboard bewirbt die Welcome Journey (Actions + Hero Card) und leitet Tenants ohne Events weiterhin auf `/event-admin/welcome` um, während Fortschritt persistiert wird.
|
||||
- Playwright-Skelett `tests/e2e/tenant-onboarding-flow.test.ts` angelegt und via `npm run test:e2e` ausführbar; Tests sind vorerst deaktiviert, bis Seed-Daten + Auth-Helper zur Verfügung stehen.
|
||||
|
||||
## Status — verbleibende Arbeiten
|
||||
- PayPal-Testabdeckung (Playwright/RTL) und Error-UX gehören noch in die Roadmap, ebenso wie End-to-End-Validierung auf Staging.
|
||||
|
||||
## Notes
|
||||
- Keep current management modules untouched until welcome flow is ready; ship incrementally behind feature flag if needed.
|
||||
- Reuse new API helpers, QueryClient, and constants to avoid divergence between flows.
|
||||
|
||||
@@ -1,60 +1,50 @@
|
||||
# 08 — Billing (Packages)
|
||||
# Billing and Payments
|
||||
|
||||
## Overview
|
||||
- Model: one-off purchases of event packages (Endkunden) or annual subscriptions (Reseller); see 15-packages-design.md for details.
|
||||
- Tables: `packages`, `event_packages`, `tenant_packages`, `package_purchases` (see 04-data-model-migrations.md and 15-packages-design.md).
|
||||
- Providers: Stripe (server-side checkout + webhooks for Einmalkäufe/Subscriptions), PayPal (Orders API + webhooks); store receipts and metadata.
|
||||
- Idempotency: purchase intents keyed by provider_id; purchase writes idempotent (check existing before create); retries safe via DB transactions.
|
||||
- Limits: Enforce package selection at event creation; check event-specific limits (e.g. max_photos) during usage; tenant limits for reseller event count.
|
||||
- SaaS Aspects: Trial periods (14 days for first reseller subscription), subscription status updates, GDPR compliance (no PII in logs/metadata, privacy consent required), cancellation links to provider dashboards.
|
||||
|
||||
## PurchaseWizard Flow (Frontend: resources/js/pages/marketing/PurchaseWizard.tsx)
|
||||
- Multi-step SPA: Package Selection → Auth (Login/Register, conditional for unauthenticated) → Payment (Stripe Elements or PayPal Buttons toggle) → Success.
|
||||
- Persistence: sessionStorage for state (wizardData, currentStep, timestamp with 30min TTL); restores on reload/refresh without data loss.
|
||||
- No reloads: Inertia.js router.post for auth/payment, onSuccess advances step client-side.
|
||||
- Package Details: Enhanced UI with features list (Check icons), SaaS info (annual billing, trial notice, reseller benefits, cancellation policy).
|
||||
- Error Handling: Backend validation errors (422) displayed via Inertia onError; frontend try-catch for API calls, toasts for user feedback.
|
||||
- Localization: react-i18next with /public/lang/de/en/marketing.json (e.g., payment options, errors, trial texts).
|
||||
|
||||
## Backend Implementation (app/Http/Controllers/Api/PackageController.php)
|
||||
- Endpoints:
|
||||
- POST /api/packages: purchase (validates package_id, type, payment_method; handles free/paid).
|
||||
- POST /api/packages/create-payment-intent: Stripe client_secret for card payments.
|
||||
- POST /api/packages/complete-purchase: Finalizes after payment (creates PackagePurchase/TenantPackage; supports stripe/paypal provider_id).
|
||||
- POST /api/packages/paypal-create: Creates PayPal Order (OrdersCreateRequest with custom_id metadata: tenant_id/package_id).
|
||||
- POST /api/packages/paypal-capture: Captures Order (OrdersCaptureRequest; idempotent check, trial logic if first reseller).
|
||||
- Free Packages: Direct DB assignment (no payment).
|
||||
- Paid: Stripe PaymentIntent or PayPal Order; completePurchase in transaction.
|
||||
- Trial Logic: For reseller_subscription, if no active packages, set expires_at = now()->addDays(14); else full year.
|
||||
- Multi-Tenancy: Tenant middleware isolates data; metadata includes tenant_id.
|
||||
|
||||
## PayPal Integration
|
||||
- SDK: paypal/paypal-server-sdk (composer require); Sandbox/LiveEnvironment based on config/services.php.
|
||||
- Flow: Frontend PayPalButtons createOrder (fetch /api/packages/paypal-create) → onApprove captureOrder (fetch /api/packages/paypal-capture) → completePurchase.
|
||||
- Webhooks: Dedicated PayPalWebhookController.php (route POST /api/paypal/webhook/verify, no auth).
|
||||
- Verification: VerifyWebhookSignature with headers/webhook_id.
|
||||
- Events: PAYMENT.CAPTURE.COMPLETED (process idempotent purchase, trial activation), BILLING.SUBSCRIPTION.CANCELLED (deactivate TenantPackage, update status to 'cancelled').
|
||||
- Idempotency: Check provider_id before processing.
|
||||
- Config: services.php with client_id/secret/sandbox; webhook_id for verification.
|
||||
The Fotospiel platform supports multiple payment providers for package purchases: Stripe for one-time and subscription payments, and PayPal for orders and subscriptions. Billing is handled through a freemium model with endcustomer event packages and reseller subscriptions. All payments are processed via API integrations, with webhooks for asynchronous updates.
|
||||
|
||||
## Stripe Integration
|
||||
- SDK: stripe/stripe-php; config/services.php secret key.
|
||||
- Flow: Elements for card input → confirmCardPayment with client_secret → completePurchase on success.
|
||||
- Subscriptions: For reseller, createSubscription (setup in handlePaidPurchase); webhooks for invoice.paid (renew), customer.subscription.deleted (cancel).
|
||||
- Metadata: tenant_id/package_id/type for all intents/subscriptions.
|
||||
- **One-time Payments**: Use Stripe Checkout for endcustomer event packages. Create PaymentIntent via `StripeController@createPaymentIntent`.
|
||||
- **Subscriptions**: Reseller subscriptions use Stripe Subscriptions API. Webhook handling in `StripeWebhookController@handleWebhook` for events like `invoice.paid`, `customer.subscription.deleted`.
|
||||
- **Configuration**: Keys in `config/services.php` under `stripe`. Sandbox mode based on `APP_ENV`.
|
||||
- **Models**: `PackagePurchase` records all transactions with `provider_id` (Stripe PI ID), `status`, `metadata`.
|
||||
- **Frontend**: PurchaseWizard.tsx handles client-side Stripe Elements for card input and confirmation.
|
||||
|
||||
## Error Handling & Security
|
||||
- Validation: Laravel Requests (e.g., package_id exists, privacy_consent); 422 JSON errors for API.
|
||||
- Auth: Sanctum for API; middleware('auth:sanctum', 'tenant') on purchase endpoints.
|
||||
- GDPR: No PII in sessionStorage/metadata; privacy consent checkbox in RegisterForm; logs anonymized (tenant_id only).
|
||||
- Cancellations: Success step links to provider dashboard (e.g., Stripe Customer Portal, PayPal Manage Subscriptions) based on purchase.provider.
|
||||
## PayPal Integration
|
||||
- **SDK**: Migrated to PayPal Server SDK v1.0+ (`paypal/paypal-server-sdk`). Uses Builder pattern for requests and Controllers for API calls.
|
||||
- **Orders (One-time Payments)**: Endcustomer event packages via Orders API. `PayPalController@createOrder` uses `OrderRequestBuilder` with `CheckoutPaymentIntent::CAPTURE`, custom_id for metadata (tenant_id, package_id, type). Capture in `@captureOrder` using `OrdersController->captureOrder`. DB creation in `processPurchaseFromOrder`.
|
||||
- **Subscriptions (Recurring Payments)**: Reseller subscriptions via Orders API with StoredPaymentSource for recurring setup (no dedicated SubscriptionsController in SDK). `PayPalController@createSubscription` uses `OrderRequestBuilder` with `StoredPaymentSource` (payment_initiator: CUSTOMER, payment_type: RECURRING, usage: FIRST), custom_id including plan_id. Initial order capture sets up subscription; subsequent billing via PayPal dashboard or webhooks. DB records created on initial capture, with expires_at for annual billing.
|
||||
- **Differences**: One-time: Standard Order with payment_type ONE_TIME (default). Recurring: Order with StoredPaymentSource RECURRING to enable future charges without new approvals. plan_id stored in metadata for reference; no separate subscription ID from SDK.
|
||||
- **Client Setup**: OAuth2 Client Credentials flow. Builder: `PaypalServerSdkClientBuilder::init()->clientCredentialsAuthCredentials(ClientCredentialsAuthCredentialsBuilder::init(client_id, secret))->environment(Environment::SANDBOX/PRODUCTION)->build()`.
|
||||
- **Webhooks**: `PayPalWebhookController@verify` handles events like `PAYMENT.CAPTURE.COMPLETED` (process initial/renewal purchase), `BILLING.SUBSCRIPTION.CANCELLED` or equivalent order events (deactivate package). Simplified signature verification (TODO: Implement `VerifyWebhookSignature`).
|
||||
- **Idempotency**: Check `provider_id` in `PackagePurchase` before creation. Transactions for DB safety.
|
||||
- **Configuration**: Keys in `config/services.php` under `paypal`. Sandbox mode via `paypal.sandbox`.
|
||||
- **Migration Notes**: Replaced old Checkout SDK (`PayPalCheckoutSdk`). Updated imports, requests (e.g., OrdersCreateRequest -> OrderRequestBuilder, Subscriptions -> StoredPaymentSource in Orders). Responses: Use `getStatusCode()` and `getResult()`. Tests mocked new structures. No breaking changes in auth or metadata handling; recurring flows now unified under Orders API.
|
||||
|
||||
## Database Models
|
||||
- **PackagePurchase**: Records purchases with `tenant_id`, `package_id`, `provider_id` (Stripe PI/PayPal Order ID), `price`, `type` (endcustomer_event/reseller_subscription), `status` (completed/refunded), `metadata` (JSON with provider details).
|
||||
- **TenantPackage**: Active packages with `tenant_id`, `package_id`, `price`, `purchased_at`, `expires_at`, `active` flag. Updated on purchase/cancellation.
|
||||
- **Constraints**: `type` CHECK (endcustomer_event, reseller_subscription), `price` NOT NULL.
|
||||
|
||||
## Flows
|
||||
1. **Purchase Initiation**: User selects package in PurchaseWizard. For free: direct assignment. Paid: Redirect to provider (Stripe Checkout or PayPal approve link).
|
||||
2. **Completion**: Provider callback/webhook triggers capture/confirmation. Create `PackagePurchase` and `TenantPackage`. Update tenant `subscription_status` to 'active'.
|
||||
3. **Cancellation/Refund**: Webhook updates status to 'cancelled', deactivates `TenantPackage`.
|
||||
4. **Trial**: First reseller subscription gets 14-day trial (`expires_at = now() + 14 days`).
|
||||
|
||||
## Error Handling
|
||||
- Validation: Request validation for IDs, consent.
|
||||
- API Errors: Catch exceptions, log, return 400/500 JSON.
|
||||
- Idempotency: Prevent duplicate processing.
|
||||
- Webhook: Verify signature, handle unhandled events with logging.
|
||||
|
||||
## Testing
|
||||
- Feature Tests: tests/Feature/PurchaseTest.php (unauth redirects, free/paid flows, Stripe/PayPal mocks, errors, trial/renewal logic, idempotency).
|
||||
- E2E: Playwright for wizard steps (auth without reload, persistence on refresh, payment toggles).
|
||||
- Coverage: Auth errors (duplicate email, wrong pass), payment failures (no assignment), limits exceeded (403).
|
||||
- Unit: Mock providers in `PurchaseTest.php` for order creation, capture, webhooks.
|
||||
- Integration: Sandbox keys for end-to-end. Assertions on DB state, responses.
|
||||
- Edge Cases: Failures, idempotency, trials, limits.
|
||||
|
||||
## Deployment & Ops
|
||||
- Migrations: Add trial_days to packages if configurable; webhook routes in api.php (without auth middleware).
|
||||
- Monitoring: Log payment events (success/fail); alert on webhook verification fails.
|
||||
- Legal: Update Privacy/AGB for payment providers; receipts via email (views/emails/purchase.blade.php).
|
||||
## Security & Compliance
|
||||
- GDPR: No PII in logs/metadata beyond necessary (tenant_id anonymous).
|
||||
- Auth: Sanctum tokens for API, CSRF for web.
|
||||
- Webhooks: IP whitelisting (PayPal IPs), signature verification.
|
||||
- Retention: Purchases retained per Privacy policy; update on changes.
|
||||
|
||||
48
docs/testing/e2e.md
Normal file
48
docs/testing/e2e.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# End-to-End Testing (Playwright)
|
||||
|
||||
## Prerequisites
|
||||
- Node 18+
|
||||
- `npm install`
|
||||
- Laravel backend running on `http://localhost:8000`
|
||||
- Seeded tenant admin account for automation (see below)
|
||||
|
||||
## Seed Test Tenant
|
||||
Run the dedicated seeder to provision a deterministic tenant + credentials:
|
||||
|
||||
```
|
||||
php artisan db:seed --class=E2ETenantSeeder
|
||||
```
|
||||
|
||||
By default the seeder creates `tenant-e2e@example.com` with password `password123`. Override via environment variables before seeding:
|
||||
|
||||
```
|
||||
E2E_TENANT_EMAIL="tenant@example.com" \
|
||||
E2E_TENANT_PASSWORD="super-secret" \
|
||||
php artisan db:seed --class=E2ETenantSeeder
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
Export the same credentials for Playwright so it can sign in:
|
||||
|
||||
```
|
||||
E2E_TENANT_EMAIL="tenant-e2e@example.com"
|
||||
E2E_TENANT_PASSWORD="password123"
|
||||
```
|
||||
|
||||
Inline checkout scenarios additionally require:
|
||||
|
||||
```
|
||||
VITE_STRIPE_PUBLISHABLE_KEY="pk_test_..."
|
||||
VITE_PAYPAL_CLIENT_ID="Abc123..."
|
||||
```
|
||||
|
||||
Inject these into the shell that runs both Laravel (Vite) and Playwright so the onboarding PWA can render payment elements.
|
||||
|
||||
## Commands
|
||||
- `npm run test:e2e` - execute the full Playwright suite.
|
||||
- `npx playwright test tests/e2e/tenant-onboarding-flow.test.ts` - focus on the onboarding spec.
|
||||
|
||||
## Notes
|
||||
- Fixtures live in `tests/e2e/utils/test-fixtures.ts`. They automatically skip onboarding assertions when credentials are absent.
|
||||
- Traces are captured on the first retry (`playwright.config.ts`); inspect via `npx playwright show-trace` on failure.
|
||||
- Configure CI by injecting the same environment variables and pointing `use.baseURL` to the deployed environment under test.
|
||||
43
docs/todo/tenant-admin-onboarding-fusion.md
Normal file
43
docs/todo/tenant-admin-onboarding-fusion.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Tenant Admin Onboarding Fusion TODO
|
||||
Created: 2025-10-10
|
||||
Owner: Codex (handoff)
|
||||
|
||||
## Context
|
||||
- Blend the immersive welcome + ordering journey from fotospiel-tenant-app/tenant-admin-app with the new management modules under /event-admin.
|
||||
- Align with the detailed PRP (docs/prp/tenant-app-specs/*.md) and onboarding plan notes (docs/changes/2025-10-10-tenant-admin-onboarding-plan.md).
|
||||
- Preserve existing dashboard/events/tasks/billing screens while introducing a guided first-run experience and mobile-first polish.
|
||||
|
||||
## References
|
||||
- docs/prp/tenant-app-specs/README.md
|
||||
- docs/prp/tenant-app-specs/pages-ui.md
|
||||
- docs/prp/tenant-app-specs/functional-specs.md
|
||||
- docs/changes/2025-10-10-tenant-admin-onboarding-plan.md
|
||||
- resources/js/admin/router.tsx
|
||||
- resources/js/admin/components/AdminLayout.tsx
|
||||
- resources/js/admin/pages/DashboardPage.tsx
|
||||
- fotospiel-tenant-app/tenant-admin-app/src/App.tsx (legacy welcome flow)
|
||||
|
||||
## Priority: Now ( unblock design + scope )
|
||||
- [x] Audit the legacy Capacitor app assets (intro carousel, package picker, CTA cards, animation helpers) and list what should be ported or rebuilt in Tailwind/React. Capture findings in docs/changes/2025-10-10-tenant-admin-onboarding-plan.md with component parity notes. See "Component Audit - 2025-10-10".
|
||||
- [x] Define shared onboarding design primitives inside Laravel PWA (e.g. gradient backgrounds, full-height hero layout, swipeable stepper). Propose implementation sketch for new components such as TenantWelcomeLayout and WelcomeStepCard. Documented under "Proposed Laravel PWA Welcome Primitives".
|
||||
|
||||
## Priority: Next ( build the welcome flow )
|
||||
- [x] Introduce /event-admin/welcome/* routes and constants, plus a lightweight layout distinct from AdminLayout. Update resources/js/admin/router.tsx and resources/js/admin/constants.ts accordingly.
|
||||
- [x] Implement onboarding steps (Hero, HowItWorks, PackageSelection, OrderSummary, FirstEventSetup) that reuse existing APIs (getTenantPackagesOverview, createEvent, checkout helpers). Landing, package, summary, and setup screens are live; summary links to Billing for payments, direct in-flow checkout still TBD.
|
||||
- [x] Persist onboarding progress (e.g. useOnboardingProgress in auth context or dedicated store) and add guard logic so tenants without active events land on the welcome flow after login. Provide a way to resume the flow from the dashboard CTA.
|
||||
- [x] Refresh DashboardPage.tsx to surface the new welcome CTA ("Plan your first event") and quick links back into the guided flow without breaking existing management cards. Guided setup card and header action now link to `/event-admin/welcome`.
|
||||
|
||||
## Priority: Later ( polish + delivery )
|
||||
- [x] Align theming, typography, and transitions with the legacy mobile look (consider porting key styles from fotospiel-tenant-app/tenant-admin-app/src/styles). Tenant admin layout now reuses marketing brand palette, fonts, and gradient utilities; Tailwind variables capture the shared tokens.
|
||||
- [ ] Review PWA manifest/offline setup so the combined welcome + management flow works for Capacitor/TWA packaging. Note required updates in public/manifest.json and build scripts.
|
||||
- [ ] Extend docs: update PRP onboarding sections and add a walkthrough video/screencaps under docs/screenshots/tenant-admin-onboarding. Capture test scope for future Playwright/E2E coverage.
|
||||
- [ ] Add automated coverage (React Testing Library for step flows, feature tests for routing guard) once implementation stabilises. Playwright spec `tests/e2e/tenant-onboarding-flow.test.ts` now executes with seeded creds—extend it to cover Stripe/PayPal happy paths and guard edge cases.
|
||||
- [ ] Finalise direct checkout in the welcome summary. Stripe + PayPal hooks are live; add mocked/unit coverage and end-to-end assertions before rolling out broadly.
|
||||
|
||||
## Risks & Open Questions
|
||||
- Confirm checkout UX expectations (Stripe vs PayPal) before wiring package purchase into onboarding.
|
||||
- Validate whether onboarding flow must be localized at launch; coordinate with i18n JSON updates.
|
||||
- Determine deprecation plan for fotospiel-tenant-app/tenant-admin-app once the merged flow ships.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user