adserver-dashboard 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ci/staging.yml +191 -0
- package/.dockerignore +117 -0
- package/.env +40 -0
- package/.env.staging +38 -0
- package/.gitlab-ci.yml +16 -0
- package/DEMO_STATUS.md +579 -0
- package/Dockerfile +61 -0
- package/Influence-MW-AdServer-12-02-2026/client/index.html +17 -0
- package/Influence-MW-AdServer-12-02-2026/client/public/favicon.png +0 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/App.tsx +91 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/advanced-map-drawer.tsx +1131 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ai-recommendation-panel.tsx +379 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/app-sidebar.tsx +183 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/auto-optimize-button.tsx +184 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/availability-drawer.tsx +385 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/brand-insights-panel.tsx +87 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/create-agency-drawer.tsx +198 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/create-brand-drawer.tsx +275 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/creative-assignment.tsx +526 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/data-table-toolbar.tsx +148 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/data-table.tsx +158 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/filter-drawer.tsx +356 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/form-insights-panel.tsx +82 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/geography-selector.tsx +699 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/header-user-menu.tsx +178 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/history-drawer.tsx +313 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-availability-section.tsx +176 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-format-drawer.tsx +173 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-selector.tsx +401 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/manual-inventory-drawer.tsx +368 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/mapbox-map.tsx +368 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/market-insights-panel.tsx +202 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/media-owner-drawer.tsx +217 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/metric-card.tsx +58 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/page-header.tsx +27 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/player-status-indicator.tsx +137 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/poi-targeting-drawer.tsx +298 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/recommendation-score-badge.tsx +102 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/recommended-inventories-panel.tsx +248 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/searchable-combobox.tsx +134 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/signal-visualizations.tsx +407 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/status-badge.tsx +35 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/theme-provider.tsx +73 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/theme-toggle.tsx +37 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/traffic-slider.tsx +75 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/accordion.tsx +56 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/alert-dialog.tsx +139 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/alert.tsx +59 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/aspect-ratio.tsx +5 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/avatar.tsx +51 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/badge.tsx +38 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/breadcrumb.tsx +115 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/button.tsx +62 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/calendar.tsx +68 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/card.tsx +85 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/carousel.tsx +260 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/chart.tsx +365 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/checkbox.tsx +28 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/collapsible.tsx +11 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/command.tsx +151 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/context-menu.tsx +198 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/dialog.tsx +122 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/drawer.tsx +118 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/dropdown-menu.tsx +198 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/form.tsx +178 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/hover-card.tsx +29 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/input-otp.tsx +69 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/input.tsx +23 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/label.tsx +24 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/menubar.tsx +256 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/navigation-menu.tsx +128 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/pagination.tsx +117 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/popover.tsx +29 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/progress.tsx +28 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/radio-group.tsx +42 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/resizable.tsx +45 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/scroll-area.tsx +46 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/select.tsx +160 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/separator.tsx +29 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/sheet.tsx +140 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/sidebar.tsx +727 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/skeleton.tsx +15 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/slider.tsx +26 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/switch.tsx +27 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/table.tsx +117 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/tabs.tsx +53 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/textarea.tsx +22 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toast.tsx +127 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toaster.tsx +33 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toggle-group.tsx +61 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toggle.tsx +43 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/tooltip.tsx +30 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/vendor-stores-modal.tsx +336 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/venue-type-drawer.tsx +359 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/components/venue-type-selector.tsx +436 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/hooks/use-mobile.tsx +19 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/hooks/use-toast.ts +191 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/index.css +244 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/lib/queryClient.ts +57 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/lib/utils.ts +39 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/lib/venue-taxonomy.ts +532 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/main.tsx +5 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/assign-creative.tsx +781 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/content-hub.tsx +995 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/custom-pois.tsx +431 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/dashboard.tsx +620 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/deal-detail.tsx +1062 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/deal-form.tsx +1570 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/deals.tsx +716 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/edit-creative-assignment.tsx +1051 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/geotargeting.tsx +675 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/integrations.tsx +425 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-item-creatives.tsx +622 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-item-form.tsx +3132 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-items.tsx +530 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/not-found.tsx +21 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/proof-of-play-upload.tsx +479 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/proof-of-play.tsx +880 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/reports.tsx +235 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/settings.tsx +652 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/signal-form.tsx +1117 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/signals.tsx +366 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/tags.tsx +332 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/pages/venues.tsx +381 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/types/mapbox-gl-draw.d.ts +37 -0
- package/Influence-MW-AdServer-12-02-2026/client/src/types/react-simple-maps.d.ts +57 -0
- package/Influence-MW-AdServer-12-02-2026/components.json +20 -0
- package/Influence-MW-AdServer-12-02-2026/docs/PRD.md +3373 -0
- package/Influence-MW-AdServer-12-02-2026/docs/influence-feature-mapping.csv +498 -0
- package/Influence-MW-AdServer-12-02-2026/drizzle.config.ts +14 -0
- package/Influence-MW-AdServer-12-02-2026/package-lock.json +9672 -0
- package/Influence-MW-AdServer-12-02-2026/package.json +118 -0
- package/Influence-MW-AdServer-12-02-2026/postcss.config.js +6 -0
- package/Influence-MW-AdServer-12-02-2026/replit.md +91 -0
- package/Influence-MW-AdServer-12-02-2026/script/build.ts +67 -0
- package/Influence-MW-AdServer-12-02-2026/scripts/create-miro-diagrams.cjs +318 -0
- package/Influence-MW-AdServer-12-02-2026/scripts/create-remaining-diagrams.cjs +270 -0
- package/Influence-MW-AdServer-12-02-2026/server/index.ts +103 -0
- package/Influence-MW-AdServer-12-02-2026/server/recommendation-service.ts +319 -0
- package/Influence-MW-AdServer-12-02-2026/server/routes.ts +1890 -0
- package/Influence-MW-AdServer-12-02-2026/server/static.ts +19 -0
- package/Influence-MW-AdServer-12-02-2026/server/storage.ts +2058 -0
- package/Influence-MW-AdServer-12-02-2026/server/vite.ts +58 -0
- package/Influence-MW-AdServer-12-02-2026/shared/schema.ts +1595 -0
- package/Influence-MW-AdServer-12-02-2026/tailwind.config.ts +107 -0
- package/Influence-MW-AdServer-12-02-2026/tsconfig.json +23 -0
- package/Influence-MW-AdServer-12-02-2026/vite.config.ts +40 -0
- package/LINE_ITEM_BUDGET_FIELD_MAPPING.md +178 -0
- package/PCM/.env.example +92 -0
- package/PCM/README.md +558 -0
- package/PCM/docs/TEST_CASES.md +422 -0
- package/PCM/index.js +106 -0
- package/PCM/package-lock.json +3282 -0
- package/PCM/package.json +32 -0
- package/PCM/replit.md +64 -0
- package/PCM/schema.sql +495 -0
- package/PCM/scripts/export-schema.js +183 -0
- package/PCM/scripts/seed-comprehensive.js +631 -0
- package/PCM/scripts/seed-production.js +477 -0
- package/PCM/src/config/db.js +56 -0
- package/PCM/src/config/swagger.js +5975 -0
- package/PCM/src/dto/EmailRequestDTO.js +166 -0
- package/PCM/src/middleware/errorHandler.js +52 -0
- package/PCM/src/middleware/logger.js +26 -0
- package/PCM/src/migrations/001_add_campaign_mode_fields.sql +36 -0
- package/PCM/src/migrations/002_create_deal_id_counters.sql +22 -0
- package/PCM/src/migrations/003_update_publishers_column.sql +15 -0
- package/PCM/src/migrations/004_add_direct_dealtype_and_advertiser.sql +5 -0
- package/PCM/src/migrations/005_add_programmatic_fields_and_update_enums.sql +31 -0
- package/PCM/src/migrations/006_add_line_item_programmatic_fields.sql +12 -0
- package/PCM/src/migrations/007_add_line_item_direct_fields.sql +15 -0
- package/PCM/src/migrations/008_add_inventory_fields.sql +45 -0
- package/PCM/src/migrations/009_move_inventory_fields_to_metadata.sql +32 -0
- package/PCM/src/migrations/010_add_draft_status_and_line_items_count.sql +23 -0
- package/PCM/src/migrations/011_add_planning_field.sql +21 -0
- package/PCM/src/migrations/012_fix_inventory_composite_pk.sql +17 -0
- package/PCM/src/migrations/013_make_external_id_optional.sql +3 -0
- package/PCM/src/migrations/014_create_change_history.sql +38 -0
- package/PCM/src/migrations/016_create_publisher_insertion_orders.sql +33 -0
- package/PCM/src/migrations/017_fix_line_item_id_fk_reference.sql +86 -0
- package/PCM/src/migrations/018_create_approval_tables.sql +44 -0
- package/PCM/src/migrations/019_add_encrypted_token_column.sql +2 -0
- package/PCM/src/migrations/020_add_rejection_reason_to_deals.sql +10 -0
- package/PCM/src/migrations/021_add_publisher_external_id_to_inventories.sql +12 -0
- package/PCM/src/migrations/022_add_line_item_extended_fields.sql +24 -0
- package/PCM/src/migrations/023_add_base_price_fields.sql +8 -0
- package/PCM/src/migrations/run-migrations.js +46 -0
- package/PCM/src/models/ApprovalOTP.js +51 -0
- package/PCM/src/models/ApprovalToken.js +79 -0
- package/PCM/src/models/ChangeHistory.js +107 -0
- package/PCM/src/models/Deal.js +186 -0
- package/PCM/src/models/DealIdCounter.js +28 -0
- package/PCM/src/models/LineItem.js +227 -0
- package/PCM/src/models/LineItemCreative.js +89 -0
- package/PCM/src/models/LineItemInventory.js +115 -0
- package/PCM/src/models/PublisherInsertionOrder.js +93 -0
- package/PCM/src/models/TransactionHistory.js +34 -0
- package/PCM/src/models/associations.js +81 -0
- package/PCM/src/routes/approval.js +321 -0
- package/PCM/src/routes/creatives.js +437 -0
- package/PCM/src/routes/deals.js +1638 -0
- package/PCM/src/routes/digitalSignage.js +242 -0
- package/PCM/src/routes/insertionOrders.js +380 -0
- package/PCM/src/routes/lineItems.js +926 -0
- package/PCM/src/routes/system.js +384 -0
- package/PCM/src/services/ApprovalService.js +885 -0
- package/PCM/src/services/CampaignImportConverter.js +631 -0
- package/PCM/src/services/CampaignModeService.js +273 -0
- package/PCM/src/services/CampaignStatusService.js +395 -0
- package/PCM/src/services/ChangeHistoryService.js +316 -0
- package/PCM/src/services/DealIdService.js +94 -0
- package/PCM/src/services/DealResponseFormatter.js +90 -0
- package/PCM/src/services/EmailNotificationService.js +315 -0
- package/PCM/src/services/LineItemResponseFormatter.js +122 -0
- package/PCM/src/services/LineItemStatusService.js +380 -0
- package/PCM/src/tests/comprehensiveTestRunner.js +360 -0
- package/PCM/src/tests/comprehensiveTests.js +1277 -0
- package/PCM/src/tests/dealTypeUnitTests.js +1058 -0
- package/PCM/src/tests/testRunner.js +248 -0
- package/PCM/src/utils/caseConverter.js +92 -0
- package/PCM/src/utils/dealCalculations.js +206 -0
- package/PCM/src/utils/lineItemPayloadNormalizer.js +41 -0
- package/PCM/src/utils/payloadNormalizer.js +34 -0
- package/PCM/src/utils/sourceNormalizer.js +56 -0
- package/PCM/src/validators/creativeValidator.js +27 -0
- package/PCM/src/validators/dealValidator.js +203 -0
- package/PCM/src/validators/lineItemValidator.js +489 -0
- package/PCM/tests/approval-flows.test.js +238 -0
- package/PCM/tests/approval-workflow.test.js +291 -0
- package/PCM/tests/campaign-import-converter.test.js +543 -0
- package/PCM/tests/campaign-import-e2e.test.js +520 -0
- package/PCM/tests/campaign-status.test.js +539 -0
- package/PCM/tests/direct-publisher-split-reimport.test.js +460 -0
- package/PCM/tests/e2e/digital-signage.test.js +145 -0
- package/PCM/tests/e2e/search-filter-pagination.test.js +399 -0
- package/PCM/tests/e2e-comprehensive.test.js +3446 -0
- package/PCM/tests/edge-cases.test.js +340 -0
- package/PCM/tests/line-item-status.test.js +340 -0
- package/PCM/tests/seller-account-external-ids.test.js +877 -0
- package/PCM/tests/source-validation.test.js +324 -0
- package/PRD.md +3373 -0
- package/README.md +186 -0
- package/client/index.html +35 -0
- package/client/public/DEMO_STATUS.md +579 -0
- package/client/public/img/MW-logo-trans_1754045676555.png +0 -0
- package/client/public/locales/ar/approval.json +144 -0
- package/client/public/locales/ar/buyer.json +61 -0
- package/client/public/locales/ar/campaigns.json +1 -0
- package/client/public/locales/ar/common.json +218 -0
- package/client/public/locales/ar/contentHub.json +266 -0
- package/client/public/locales/ar/creatives.json +79 -0
- package/client/public/locales/ar/dashboard.json +57 -0
- package/client/public/locales/ar/deals.json +886 -0
- package/client/public/locales/ar/dsp.json +131 -0
- package/client/public/locales/ar/inventory.json +201 -0
- package/client/public/locales/ar/lineItems.json +553 -0
- package/client/public/locales/ar/navigation.json +48 -0
- package/client/public/locales/ar/wizard.json +1 -0
- package/client/public/locales/en/approval.json +144 -0
- package/client/public/locales/en/buyer.json +65 -0
- package/client/public/locales/en/campaigns.json +1 -0
- package/client/public/locales/en/common.json +218 -0
- package/client/public/locales/en/contentHub.json +266 -0
- package/client/public/locales/en/creatives.json +79 -0
- package/client/public/locales/en/dashboard.json +57 -0
- package/client/public/locales/en/deals.json +886 -0
- package/client/public/locales/en/dsp.json +131 -0
- package/client/public/locales/en/inventory.json +201 -0
- package/client/public/locales/en/lineItems.json +659 -0
- package/client/public/locales/en/navigation.json +48 -0
- package/client/public/locales/en/wizard.json +1 -0
- package/client/public/locales/ja/approval.json +144 -0
- package/client/public/locales/ja/buyer.json +61 -0
- package/client/public/locales/ja/campaigns.json +1 -0
- package/client/public/locales/ja/common.json +218 -0
- package/client/public/locales/ja/contentHub.json +266 -0
- package/client/public/locales/ja/creatives.json +79 -0
- package/client/public/locales/ja/dashboard.json +57 -0
- package/client/public/locales/ja/deals.json +886 -0
- package/client/public/locales/ja/dsp.json +131 -0
- package/client/public/locales/ja/inventory.json +201 -0
- package/client/public/locales/ja/lineItems.json +553 -0
- package/client/public/locales/ja/navigation.json +48 -0
- package/client/public/locales/ja/wizard.json +1 -0
- package/client/public/locales/zh/approval.json +144 -0
- package/client/public/locales/zh/buyer.json +61 -0
- package/client/public/locales/zh/campaigns.json +1 -0
- package/client/public/locales/zh/common.json +218 -0
- package/client/public/locales/zh/contentHub.json +266 -0
- package/client/public/locales/zh/creatives.json +79 -0
- package/client/public/locales/zh/dashboard.json +57 -0
- package/client/public/locales/zh/deals.json +886 -0
- package/client/public/locales/zh/dsp.json +131 -0
- package/client/public/locales/zh/inventory.json +201 -0
- package/client/public/locales/zh/lineItems.json +553 -0
- package/client/public/locales/zh/navigation.json +48 -0
- package/client/public/locales/zh/wizard.json +1 -0
- package/client/public/manifest.json +36 -0
- package/client/src/App.tsx +464 -0
- package/client/src/components/app-sidebar.tsx +312 -0
- package/client/src/components/approval/approval-decision-form.test.tsx +294 -0
- package/client/src/components/approval/approval-decision-form.tsx +326 -0
- package/client/src/components/approval/approval-sheet.tsx +631 -0
- package/client/src/components/approval/line-item-details-sheet.tsx +371 -0
- package/client/src/components/approval/otp-verification.test.tsx +337 -0
- package/client/src/components/approval/otp-verification.tsx +180 -0
- package/client/src/components/content-hub/bulk-transcode-dialog.tsx +379 -0
- package/client/src/components/content-hub/content-hub-manager-v2.tsx +574 -0
- package/client/src/components/content-hub/content-hub-manager.tsx +330 -0
- package/client/src/components/content-hub/creative-card.tsx +456 -0
- package/client/src/components/content-hub/creative-detail-sheet.tsx +685 -0
- package/client/src/components/content-hub/creative-filters.tsx +457 -0
- package/client/src/components/content-hub/creative-grid.tsx +329 -0
- package/client/src/components/content-hub/creative-selector.tsx +415 -0
- package/client/src/components/content-hub/creative-upload.tsx +547 -0
- package/client/src/components/content-hub/folder-dialogs.tsx +445 -0
- package/client/src/components/content-hub/folder-list.tsx +280 -0
- package/client/src/components/content-hub/review-dialogs.tsx +268 -0
- package/client/src/components/content-hub/transcode-dialog.tsx +226 -0
- package/client/src/components/creative-library/creative-details-view.tsx +446 -0
- package/client/src/components/creative-library/creative-filters-panel.tsx +203 -0
- package/client/src/components/creative-library/creative-list.tsx +360 -0
- package/client/src/components/creative-library/creative-status-badge.tsx +71 -0
- package/client/src/components/creative-library/folder-card.tsx +78 -0
- package/client/src/components/creative-library/index.ts +27 -0
- package/client/src/components/creative-library/new-creative-card.tsx +211 -0
- package/client/src/components/creative-library/upload-creative-dialog.tsx +261 -0
- package/client/src/components/dashboard-overview.tsx +109 -0
- package/client/src/components/deals/approval-history-panel.test.tsx +240 -0
- package/client/src/components/deals/approval-history-panel.tsx +156 -0
- package/client/src/components/deals/deal-status-badge.tsx +92 -0
- package/client/src/components/deals/import-from-planner-dialog.tsx +399 -0
- package/client/src/components/deals/market-insights-panel.tsx +237 -0
- package/client/src/components/deals/reopen-deal-sheet.tsx +191 -0
- package/client/src/components/deals/request-approval-sheet.test.tsx +323 -0
- package/client/src/components/deals/request-approval-sheet.tsx +136 -0
- package/client/src/components/deals/resend-approval-sheet.tsx +201 -0
- package/client/src/components/direct-campaigns/campaign-card.tsx +283 -0
- package/client/src/components/direct-campaigns/deal-filter-panel.tsx +325 -0
- package/client/src/components/inventory/advanced-filters-panel.tsx +273 -0
- package/client/src/components/inventory/csv-upload-modal.tsx +639 -0
- package/client/src/components/inventory/inventory-availability-view.tsx +486 -0
- package/client/src/components/inventory/inventory-details-sheet.tsx +376 -0
- package/client/src/components/inventory/inventory-map-view.tsx +596 -0
- package/client/src/components/inventory/inventory-settings-menu.tsx +52 -0
- package/client/src/components/language-switcher.tsx +53 -0
- package/client/src/components/line-items/campaign-forecast-panel.tsx +138 -0
- package/client/src/components/line-items/form-insights.tsx +89 -0
- package/client/src/components/line-items/geofencing/LocationCsvUploadDrawer.tsx +100 -0
- package/client/src/components/line-items/geofencing/POIDropdown.tsx +379 -0
- package/client/src/components/line-items/geofencing/SelectedLocationsSidebar.tsx +436 -0
- package/client/src/components/line-items/geofencing/ViewFileLocationDrawer.tsx +199 -0
- package/client/src/components/line-items/geofencing/components/ExistingFilesTab.tsx +268 -0
- package/client/src/components/line-items/geofencing/components/TemplateDownloadSection.tsx +59 -0
- package/client/src/components/line-items/geofencing/components/UploadTab.tsx +215 -0
- package/client/src/components/line-items/geofencing-map.tsx +1270 -0
- package/client/src/components/line-items/inventory-availability-section.tsx +178 -0
- package/client/src/components/line-items/line-item-schedule-manager.tsx +313 -0
- package/client/src/components/line-items/manual-inventory-drawer.tsx +346 -0
- package/client/src/components/line-items/planner-inventory-card.tsx +495 -0
- package/client/src/components/line-items/planner-schedule-grid.tsx +495 -0
- package/client/src/components/line-items/schedule-rule-editor.tsx +649 -0
- package/client/src/components/line-items/schedule-rule-types.ts +122 -0
- package/client/src/components/line-items/steps/creatives-step.tsx +681 -0
- package/client/src/components/line-items/steps/inventory-schedule-step.tsx +1596 -0
- package/client/src/components/line-items/steps/inventory-step.tsx +1533 -0
- package/client/src/components/line-items/steps/line-item-details-step.tsx +916 -0
- package/client/src/components/line-items/steps/schedule-step.tsx +273 -0
- package/client/src/components/line-items/steps/summary-step.tsx +680 -0
- package/client/src/components/line-items/steps/targeting-step.tsx +1708 -0
- package/client/src/components/product-switcher.tsx +105 -0
- package/client/src/components/protected-route.tsx +49 -0
- package/client/src/components/skip-link.tsx +22 -0
- package/client/src/components/stat-card.tsx +53 -0
- package/client/src/components/status-badge.tsx +96 -0
- package/client/src/components/ui/hierarchical-venue-selector.tsx +389 -0
- package/client/src/components/ui/toaster.tsx +111 -0
- package/client/src/contexts/auth-context.tsx +181 -0
- package/client/src/contexts/sidebar-state.tsx +50 -0
- package/client/src/contexts/theme-context.tsx +66 -0
- package/client/src/data/campaign-data.json +107 -0
- package/client/src/data/countries.json +22 -0
- package/client/src/hooks/use-approval.ts +366 -0
- package/client/src/hooks/use-keyboard-shortcuts.ts +74 -0
- package/client/src/hooks/use-media-query.ts +46 -0
- package/client/src/hooks/use-mobile.tsx +19 -0
- package/client/src/hooks/use-page-title.ts +21 -0
- package/client/src/hooks/use-toast.ts +195 -0
- package/client/src/index.css +694 -0
- package/client/src/lib/__tests__/accessibility.test.ts +104 -0
- package/client/src/lib/__tests__/date-utils.test.ts +199 -0
- package/client/src/lib/__tests__/dsp-buyer-api.test.ts +127 -0
- package/client/src/lib/__tests__/dsp-buyer-integration.test.ts +247 -0
- package/client/src/lib/__tests__/storage-utils.test.ts +167 -0
- package/client/src/lib/__tests__/utils.test.ts +57 -0
- package/client/src/lib/accessibility.ts +141 -0
- package/client/src/lib/api-config.ts +9 -0
- package/client/src/lib/auth-service.ts +209 -0
- package/client/src/lib/campaign-creative-api.ts +82 -0
- package/client/src/lib/company-api.ts +61 -0
- package/client/src/lib/content-hub-api.ts +407 -0
- package/client/src/lib/creative-mapper.ts +61 -0
- package/client/src/lib/date-utils.ts +119 -0
- package/client/src/lib/deal-helpers.ts +220 -0
- package/client/src/lib/dsp-buyer-api.ts +196 -0
- package/client/src/lib/geo-import-api.ts +151 -0
- package/client/src/lib/google-poi-api.ts +305 -0
- package/client/src/lib/i18n/__tests__/formatting.test.ts +202 -0
- package/client/src/lib/i18n/formatting.ts +130 -0
- package/client/src/lib/i18n/index.ts +8 -0
- package/client/src/lib/i18n-compat.ts +76 -0
- package/client/src/lib/influence-deals-api.ts +896 -0
- package/client/src/lib/inventory-api.ts +399 -0
- package/client/src/lib/oauth-service.ts +678 -0
- package/client/src/lib/poi-types.ts +75 -0
- package/client/src/lib/queryClient.ts +144 -0
- package/client/src/lib/recommendation-api.ts +380 -0
- package/client/src/lib/storage-utils.ts +104 -0
- package/client/src/lib/tolgee.ts +85 -0
- package/client/src/lib/utils.ts +0 -0
- package/client/src/main.tsx +67 -0
- package/client/src/mapbox-draw-modes.d.ts +32 -0
- package/client/src/pages/all-folders.tsx +203 -0
- package/client/src/pages/auth-callback.tsx +115 -0
- package/client/src/pages/buyer-form.tsx +339 -0
- package/client/src/pages/buyer-list.tsx +622 -0
- package/client/src/pages/content-hub.tsx +1358 -0
- package/client/src/pages/create-deal.tsx +2093 -0
- package/client/src/pages/creative-assignment-page.tsx +548 -0
- package/client/src/pages/creatives.tsx +5 -0
- package/client/src/pages/custom-pois.tsx +425 -0
- package/client/src/pages/dashboard.tsx +615 -0
- package/client/src/pages/deal-history.tsx +434 -0
- package/client/src/pages/deal-line-items.tsx +1703 -0
- package/client/src/pages/demo-status.tsx +113 -0
- package/client/src/pages/direct-campaign-details.tsx +361 -0
- package/client/src/pages/direct-campaigns-new.tsx +824 -0
- package/client/src/pages/dsp-form.tsx +803 -0
- package/client/src/pages/dsp-list.tsx +239 -0
- package/client/src/pages/folder-content.tsx +336 -0
- package/client/src/pages/integrations.tsx +429 -0
- package/client/src/pages/line-item-creatives.tsx +789 -0
- package/client/src/pages/line-item-detail-page.tsx +684 -0
- package/client/src/pages/line-item-form-page.tsx +3261 -0
- package/client/src/pages/line-item-wizard.tsx +1207 -0
- package/client/src/pages/login.tsx +154 -0
- package/client/src/pages/not-found.tsx +23 -0
- package/client/src/pages/proof-of-play.tsx +397 -0
- package/client/src/pages/public-approval.tsx +551 -0
- package/client/src/pages/reports.tsx +231 -0
- package/client/src/pages/settings.tsx +760 -0
- package/client/src/pages/signals.tsx +389 -0
- package/client/src/pages/tags.tsx +318 -0
- package/client/src/pages/test-results.tsx +328 -0
- package/client/src/store/hooks.ts +5 -0
- package/client/src/store/index.ts +15 -0
- package/client/src/store/mapMarkerLocationsSlice.ts +241 -0
- package/client/src/styles/design-tokens.css +324 -0
- package/client/src/test/setup.ts +261 -0
- package/client/src/test/test-utils.tsx +40 -0
- package/client/src/types/approval.ts +221 -0
- package/client/src/types/content-hub.ts +209 -0
- package/client/src/types/geofencing.ts +67 -0
- package/client/src/types/transcoding.ts +140 -0
- package/client/src/vite-env.d.ts +18 -0
- package/components.json +20 -0
- package/creative-api.json +1 -0
- package/docs/AI_REFERENCE.md +459 -0
- package/docs/MWDesign-Prompt.md +132 -0
- package/docs/MWDesign-System.md +344 -0
- package/docs/test-plan.md +277 -0
- package/e2e/AUTONOMOUS-TESTING.md +406 -0
- package/e2e/README.md +219 -0
- package/e2e/autonomous-flow.spec.ts +308 -0
- package/e2e/debug-sso.spec.ts +163 -0
- package/e2e/direct-campaigns.spec.ts +219 -0
- package/e2e/explore-sso.spec.ts +149 -0
- package/e2e/fixtures/auth.ts +26 -0
- package/e2e/fixtures/enhanced-test.ts +331 -0
- package/e2e/pagination.spec.ts +280 -0
- package/e2e/view-toggle.spec.ts +312 -0
- package/generated-icon.png +0 -0
- package/i18next-scanner.config.cjs +46 -0
- package/package.json +141 -0
- package/playwright.config.ts +93 -0
- package/postcss.config.js +6 -0
- package/replit.md +196 -0
- package/screenshot-after-login.png +0 -0
- package/screenshot-contenthub-grid.png +0 -0
- package/screenshot-contenthub-list-fixed.png +0 -0
- package/screenshot-contenthub-list.png +0 -0
- package/screenshot-create-deal.png +0 -0
- package/screenshot-dashboard.png +0 -0
- package/screenshot-deals.png +0 -0
- package/screenshot-login-filled.png +0 -0
- package/screenshot-login.png +0 -0
- package/screenshot.mjs +24 -0
- package/scripts/deploy-stg.sh +185 -0
- package/shared/direct-io-schema.ts +383 -0
- package/shared/schema.ts +439 -0
- package/shared/screen-types.ts +149 -0
- package/springdocDefault.json +1 -0
- package/swagger-ui-bundle.js +2 -0
- package/swagger-ui-init.js +10316 -0
- package/tailwind.config.ts +282 -0
- package/terraform/README.md +306 -0
- package/terraform/cloudfront.tf +289 -0
- package/terraform/ecs.tf +727 -0
- package/terraform/environments/dev.tfvars +59 -0
- package/terraform/environments/production.tfvars +60 -0
- package/terraform/main.tf +47 -0
- package/terraform/outputs.tf +145 -0
- package/terraform/s3.tf +192 -0
- package/terraform/variables.tf +226 -0
- package/terraform/waf.tf +165 -0
- package/terraform-frontend/.terraform.lock.hcl +25 -0
- package/terraform-frontend/README.md +85 -0
- package/terraform-frontend/cloudfront.tf +125 -0
- package/terraform-frontend/main.tf +31 -0
- package/terraform-frontend/outputs.tf +24 -0
- package/terraform-frontend/terraform.tfvars +12 -0
- package/terraform-frontend/variables.tf +53 -0
- package/tsconfig.json +23 -0
- package/vite.config.ts +226 -0
- package/vitest.config.ts +56 -0
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Sheet,
|
|
4
|
+
SheetContent,
|
|
5
|
+
SheetHeader,
|
|
6
|
+
SheetTitle,
|
|
7
|
+
SheetDescription,
|
|
8
|
+
} from '@moving-walls/design-system';
|
|
9
|
+
import { Button } from '@moving-walls/design-system';
|
|
10
|
+
import { Badge } from '@moving-walls/design-system';
|
|
11
|
+
import { Separator } from '@moving-walls/design-system';
|
|
12
|
+
import { ScrollArea } from '@moving-walls/design-system';
|
|
13
|
+
import { useCreative, useTranscodeCreative, useDeleteCreative, useApproveCreative, useRejectCreative, useTranscodedVariants } from '@/lib/content-hub-api';
|
|
14
|
+
import { ApproveDialog, RejectDialog, DeleteDialog } from './review-dialogs';
|
|
15
|
+
import { TranscodeDialog } from './transcode-dialog';
|
|
16
|
+
import { useToast } from '@/hooks/use-toast';
|
|
17
|
+
import {
|
|
18
|
+
Download,
|
|
19
|
+
Trash2,
|
|
20
|
+
CheckCircle,
|
|
21
|
+
XCircle,
|
|
22
|
+
FileVideo,
|
|
23
|
+
Loader2,
|
|
24
|
+
Clock,
|
|
25
|
+
CheckCircle2,
|
|
26
|
+
AlertCircle,
|
|
27
|
+
PlayCircle,
|
|
28
|
+
ExternalLink,
|
|
29
|
+
} from 'lucide-react';
|
|
30
|
+
import type { Creative, CreativeStatus, JobStatus } from '@/types/content-hub';
|
|
31
|
+
import type { TranscodeProfile, TranscodeFormat } from '@/types/transcoding';
|
|
32
|
+
|
|
33
|
+
interface CreativeDetailSheetProps {
|
|
34
|
+
creativeId: string | null;
|
|
35
|
+
open: boolean;
|
|
36
|
+
onOpenChange: (open: boolean) => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function CreativeDetailSheet({
|
|
40
|
+
creativeId,
|
|
41
|
+
open,
|
|
42
|
+
onOpenChange,
|
|
43
|
+
}: CreativeDetailSheetProps) {
|
|
44
|
+
const { toast } = useToast();
|
|
45
|
+
const [showApproveDialog, setShowApproveDialog] = useState(false);
|
|
46
|
+
const [showRejectDialog, setShowRejectDialog] = useState(false);
|
|
47
|
+
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
|
|
48
|
+
|
|
49
|
+
const { data: creativeResponse, isLoading, refetch } = useCreative(creativeId || '');
|
|
50
|
+
// Handle both wrapped (ApiResponse) and direct response formats
|
|
51
|
+
const creative = (creativeResponse as any)?.result ||
|
|
52
|
+
((creativeResponse as any)?.id ? creativeResponse : null) as Creative | null;
|
|
53
|
+
|
|
54
|
+
const { data: variantsResponse, refetch: refetchVariants } = useTranscodedVariants(creativeId || '');
|
|
55
|
+
const variants = (variantsResponse as any)?.result || (variantsResponse as any)?.variants || [];
|
|
56
|
+
|
|
57
|
+
const approveMutation = useApproveCreative();
|
|
58
|
+
const rejectMutation = useRejectCreative();
|
|
59
|
+
|
|
60
|
+
const transcodeMutation = useTranscodeCreative();
|
|
61
|
+
const deleteMutation = useDeleteCreative();
|
|
62
|
+
|
|
63
|
+
const handleApprove = (data: { reviewer_id: string; comments?: string }) => {
|
|
64
|
+
if (!creative) return;
|
|
65
|
+
|
|
66
|
+
approveMutation.mutate(
|
|
67
|
+
{ creativeId: creative.id, payload: data },
|
|
68
|
+
{
|
|
69
|
+
onSuccess: () => {
|
|
70
|
+
toast({
|
|
71
|
+
title: 'Creative approved',
|
|
72
|
+
description: 'The creative has been approved successfully.',
|
|
73
|
+
className: 'bg-emerald-500 text-white',
|
|
74
|
+
});
|
|
75
|
+
setShowApproveDialog(false);
|
|
76
|
+
refetch();
|
|
77
|
+
},
|
|
78
|
+
onError: (error: any) => {
|
|
79
|
+
toast({
|
|
80
|
+
title: 'Approval failed',
|
|
81
|
+
description: error.message || 'Failed to approve creative',
|
|
82
|
+
variant: 'destructive',
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleReject = (data: { reviewer_id: string; comments?: string }) => {
|
|
90
|
+
if (!creative) return;
|
|
91
|
+
|
|
92
|
+
rejectMutation.mutate(
|
|
93
|
+
{ creativeId: creative.id, payload: data },
|
|
94
|
+
{
|
|
95
|
+
onSuccess: () => {
|
|
96
|
+
toast({
|
|
97
|
+
title: 'Creative rejected',
|
|
98
|
+
description: 'The creative has been rejected.',
|
|
99
|
+
className: 'bg-emerald-500 text-white',
|
|
100
|
+
});
|
|
101
|
+
setShowRejectDialog(false);
|
|
102
|
+
refetch();
|
|
103
|
+
},
|
|
104
|
+
onError: (error: any) => {
|
|
105
|
+
toast({
|
|
106
|
+
title: 'Rejection failed',
|
|
107
|
+
description: error.message || 'Failed to reject creative',
|
|
108
|
+
variant: 'destructive',
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Auto-refresh when transcode status is processing
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!creative) return;
|
|
118
|
+
|
|
119
|
+
if (creative.transcode_status === 'PROCESSING' || creative.transcode_status === 'PENDING') {
|
|
120
|
+
const interval = setInterval(() => {
|
|
121
|
+
refetch();
|
|
122
|
+
refetchVariants();
|
|
123
|
+
}, 3000);
|
|
124
|
+
return () => clearInterval(interval);
|
|
125
|
+
}
|
|
126
|
+
}, [creative, refetch, refetchVariants]);
|
|
127
|
+
|
|
128
|
+
const handleDownload = async () => {
|
|
129
|
+
if (!creative) return;
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
toast({
|
|
133
|
+
title: 'Download starting...',
|
|
134
|
+
description: creative.filename,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Fetch the file as a blob
|
|
138
|
+
const response = await fetch(creative.cdn_path);
|
|
139
|
+
if (!response.ok) throw new Error('Download failed');
|
|
140
|
+
|
|
141
|
+
const blob = await response.blob();
|
|
142
|
+
|
|
143
|
+
// Create a blob URL and trigger download
|
|
144
|
+
const blobUrl = window.URL.createObjectURL(blob);
|
|
145
|
+
const link = document.createElement('a');
|
|
146
|
+
link.href = blobUrl;
|
|
147
|
+
link.download = creative.filename;
|
|
148
|
+
document.body.appendChild(link);
|
|
149
|
+
link.click();
|
|
150
|
+
document.body.removeChild(link);
|
|
151
|
+
|
|
152
|
+
// Clean up the blob URL
|
|
153
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
154
|
+
|
|
155
|
+
toast({
|
|
156
|
+
title: 'Download complete',
|
|
157
|
+
description: creative.filename,
|
|
158
|
+
className: 'bg-emerald-500 text-white',
|
|
159
|
+
});
|
|
160
|
+
} catch (error) {
|
|
161
|
+
toast({
|
|
162
|
+
title: 'Download failed',
|
|
163
|
+
description: 'Failed to download the creative file',
|
|
164
|
+
variant: 'destructive',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const handleTranscode = (profiles: TranscodeProfile[], formats?: TranscodeFormat[]) => {
|
|
170
|
+
if (!creative) return;
|
|
171
|
+
|
|
172
|
+
transcodeMutation.mutate(
|
|
173
|
+
{
|
|
174
|
+
creativeId: creative.id,
|
|
175
|
+
payload: {
|
|
176
|
+
profiles,
|
|
177
|
+
target_formats: formats,
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
onSuccess: () => {
|
|
182
|
+
toast({
|
|
183
|
+
title: 'Transcoding started',
|
|
184
|
+
description: 'The transcoding jobs have been queued.',
|
|
185
|
+
className: 'bg-emerald-500 text-white',
|
|
186
|
+
});
|
|
187
|
+
refetch();
|
|
188
|
+
refetchVariants();
|
|
189
|
+
},
|
|
190
|
+
onError: (error: any) => {
|
|
191
|
+
toast({
|
|
192
|
+
title: 'Transcoding failed',
|
|
193
|
+
description: error.message || 'Failed to start transcoding',
|
|
194
|
+
variant: 'destructive',
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const handleDelete = () => {
|
|
202
|
+
if (!creative) return;
|
|
203
|
+
|
|
204
|
+
deleteMutation.mutate(creative.id, {
|
|
205
|
+
onSuccess: () => {
|
|
206
|
+
toast({
|
|
207
|
+
title: 'Creative deleted',
|
|
208
|
+
description: 'The creative has been deleted successfully.',
|
|
209
|
+
className: 'bg-emerald-500 text-white',
|
|
210
|
+
});
|
|
211
|
+
setShowDeleteDialog(false);
|
|
212
|
+
onOpenChange(false);
|
|
213
|
+
},
|
|
214
|
+
onError: (error: any) => {
|
|
215
|
+
toast({
|
|
216
|
+
title: 'Delete failed',
|
|
217
|
+
description: error.message || 'Failed to delete creative',
|
|
218
|
+
variant: 'destructive',
|
|
219
|
+
});
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const getStatusBadge = (status: CreativeStatus) => {
|
|
225
|
+
switch (status) {
|
|
226
|
+
case 'approved':
|
|
227
|
+
return (
|
|
228
|
+
<Badge variant="outline" className="bg-emerald-500/10 text-emerald-600 border-emerald-500/20">
|
|
229
|
+
<CheckCircle className="h-3 w-3 mr-1" />
|
|
230
|
+
Approved
|
|
231
|
+
</Badge>
|
|
232
|
+
);
|
|
233
|
+
case 'rejected':
|
|
234
|
+
return (
|
|
235
|
+
<Badge variant="outline" className="bg-red-500/10 text-red-600 border-red-500/20">
|
|
236
|
+
<XCircle className="h-3 w-3 mr-1" />
|
|
237
|
+
Rejected
|
|
238
|
+
</Badge>
|
|
239
|
+
);
|
|
240
|
+
default:
|
|
241
|
+
return (
|
|
242
|
+
<Badge variant="outline" className="bg-mw-primary-500/10 text-mw-primary-600 border-mw-primary-500/20">
|
|
243
|
+
<Clock className="h-3 w-3 mr-1" />
|
|
244
|
+
Draft
|
|
245
|
+
</Badge>
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const getTranscodeStatusBadge = (status?: JobStatus) => {
|
|
251
|
+
if (!status) return null;
|
|
252
|
+
|
|
253
|
+
switch (status) {
|
|
254
|
+
case 'PENDING':
|
|
255
|
+
return (
|
|
256
|
+
<Badge variant="outline" className="bg-yellow-500/10 text-yellow-600 border-yellow-500/20">
|
|
257
|
+
<Clock className="h-3 w-3 mr-1" />
|
|
258
|
+
Pending
|
|
259
|
+
</Badge>
|
|
260
|
+
);
|
|
261
|
+
case 'PROCESSING':
|
|
262
|
+
return (
|
|
263
|
+
<Badge variant="outline" className="bg-mw-primary-500/10 text-mw-primary-600 border-mw-primary-500/20">
|
|
264
|
+
<Loader2 className="h-3 w-3 mr-1 animate-spin" />
|
|
265
|
+
Processing
|
|
266
|
+
</Badge>
|
|
267
|
+
);
|
|
268
|
+
case 'COMPLETED':
|
|
269
|
+
return (
|
|
270
|
+
<Badge variant="outline" className="bg-emerald-500/10 text-emerald-600 border-emerald-500/20">
|
|
271
|
+
<CheckCircle2 className="h-3 w-3 mr-1" />
|
|
272
|
+
Completed
|
|
273
|
+
</Badge>
|
|
274
|
+
);
|
|
275
|
+
case 'FAILED':
|
|
276
|
+
return (
|
|
277
|
+
<Badge variant="outline" className="bg-red-500/10 text-red-600 border-red-500/20">
|
|
278
|
+
<AlertCircle className="h-3 w-3 mr-1" />
|
|
279
|
+
Failed
|
|
280
|
+
</Badge>
|
|
281
|
+
);
|
|
282
|
+
default:
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const formatFileSize = (bytes: number): string => {
|
|
288
|
+
if (bytes === 0) return '0 Bytes';
|
|
289
|
+
const k = 1024;
|
|
290
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
291
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
292
|
+
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const formatDuration = (seconds?: number): string => {
|
|
296
|
+
if (!seconds) return 'N/A';
|
|
297
|
+
const mins = Math.floor(seconds / 60);
|
|
298
|
+
const secs = Math.floor(seconds % 60);
|
|
299
|
+
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const isVideo = creative?.mime_type?.startsWith('video/');
|
|
303
|
+
const isImage = creative?.mime_type?.startsWith('image/');
|
|
304
|
+
const isAudio = creative?.mime_type?.startsWith('audio/');
|
|
305
|
+
|
|
306
|
+
return (
|
|
307
|
+
<>
|
|
308
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
309
|
+
<SheetContent side="right" className="w-full sm:max-w-2xl">
|
|
310
|
+
<SheetHeader>
|
|
311
|
+
<SheetTitle>Creative Details</SheetTitle>
|
|
312
|
+
<SheetDescription>
|
|
313
|
+
View and manage creative asset
|
|
314
|
+
</SheetDescription>
|
|
315
|
+
</SheetHeader>
|
|
316
|
+
|
|
317
|
+
{isLoading ? (
|
|
318
|
+
<div className="flex items-center justify-center h-96">
|
|
319
|
+
<Loader2 className="h-8 w-8 animate-spin text-mw-gray-600 dark:text-mw-gray-400" />
|
|
320
|
+
</div>
|
|
321
|
+
) : creative ? (
|
|
322
|
+
<ScrollArea className="h-[calc(100vh-8rem)] pr-4">
|
|
323
|
+
<div className="space-y-6 py-4">
|
|
324
|
+
{/* Preview Section */}
|
|
325
|
+
<div className="space-y-2">
|
|
326
|
+
<h3 className="text-sm font-semibold">Preview</h3>
|
|
327
|
+
<div className="rounded-md border bg-muted/50 overflow-hidden">
|
|
328
|
+
{isImage && (
|
|
329
|
+
<img
|
|
330
|
+
src={creative.cdn_path}
|
|
331
|
+
alt={creative.filename}
|
|
332
|
+
className="w-full h-auto"
|
|
333
|
+
data-testid="img-creative-preview"
|
|
334
|
+
/>
|
|
335
|
+
)}
|
|
336
|
+
{isVideo && (
|
|
337
|
+
<video
|
|
338
|
+
src={creative.cdn_path}
|
|
339
|
+
controls
|
|
340
|
+
className="w-full h-auto"
|
|
341
|
+
data-testid="video-creative-preview"
|
|
342
|
+
>
|
|
343
|
+
Your browser does not support the video tag.
|
|
344
|
+
</video>
|
|
345
|
+
)}
|
|
346
|
+
{isAudio && (
|
|
347
|
+
<div className="p-8 flex items-center justify-center">
|
|
348
|
+
<audio
|
|
349
|
+
src={creative.cdn_path}
|
|
350
|
+
controls
|
|
351
|
+
className="w-full"
|
|
352
|
+
data-testid="audio-creative-preview"
|
|
353
|
+
>
|
|
354
|
+
Your browser does not support the audio tag.
|
|
355
|
+
</audio>
|
|
356
|
+
</div>
|
|
357
|
+
)}
|
|
358
|
+
{!isImage && !isVideo && !isAudio && (
|
|
359
|
+
<div className="p-8 flex items-center justify-center text-mw-gray-600 dark:text-mw-gray-400">
|
|
360
|
+
<FileVideo className="h-12 w-12" />
|
|
361
|
+
</div>
|
|
362
|
+
)}
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
<Separator />
|
|
367
|
+
|
|
368
|
+
{/* Basic Info */}
|
|
369
|
+
<div className="space-y-3">
|
|
370
|
+
<h3 className="text-sm font-semibold">Basic Information</h3>
|
|
371
|
+
<div className="grid grid-cols-3 gap-2 text-sm">
|
|
372
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Filename</div>
|
|
373
|
+
<div className="col-span-2 font-medium" data-testid="text-filename">
|
|
374
|
+
{creative.filename}
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Status</div>
|
|
378
|
+
<div className="col-span-2" data-testid="badge-status">
|
|
379
|
+
{getStatusBadge(creative.status)}
|
|
380
|
+
</div>
|
|
381
|
+
|
|
382
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Format</div>
|
|
383
|
+
<div className="col-span-2 font-medium" data-testid="text-format">
|
|
384
|
+
{creative.format.toUpperCase()}
|
|
385
|
+
</div>
|
|
386
|
+
|
|
387
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">File Size</div>
|
|
388
|
+
<div className="col-span-2 font-medium" data-testid="text-filesize">
|
|
389
|
+
{creative.size_bytes ? formatFileSize(creative.size_bytes) : 'N/A'}
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">MIME Type</div>
|
|
393
|
+
<div className="col-span-2 font-medium" data-testid="text-mimetype">
|
|
394
|
+
{creative.mime_type}
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
{creative.tags && creative.tags.length > 0 && (
|
|
398
|
+
<>
|
|
399
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Tags</div>
|
|
400
|
+
<div className="col-span-2 flex flex-wrap gap-1">
|
|
401
|
+
{creative.tags.map((tag: string) => (
|
|
402
|
+
<Badge key={tag} variant="secondary" className="text-xs">
|
|
403
|
+
{tag}
|
|
404
|
+
</Badge>
|
|
405
|
+
))}
|
|
406
|
+
</div>
|
|
407
|
+
</>
|
|
408
|
+
)}
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
|
|
412
|
+
{/* Metadata */}
|
|
413
|
+
{((creative.width && creative.height) || creative.duration_seconds || (creative.metadata && Object.keys(creative.metadata).length > 0)) && (
|
|
414
|
+
<>
|
|
415
|
+
<Separator />
|
|
416
|
+
<div className="space-y-3">
|
|
417
|
+
<h3 className="text-sm font-semibold">Metadata</h3>
|
|
418
|
+
<div className="grid grid-cols-3 gap-2 text-sm">
|
|
419
|
+
{creative.width && creative.height && (
|
|
420
|
+
<>
|
|
421
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Dimensions</div>
|
|
422
|
+
<div className="col-span-2 font-medium" data-testid="text-dimensions">
|
|
423
|
+
{creative.width} × {creative.height}
|
|
424
|
+
</div>
|
|
425
|
+
</>
|
|
426
|
+
)}
|
|
427
|
+
|
|
428
|
+
{creative.duration_seconds && (
|
|
429
|
+
<>
|
|
430
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Duration</div>
|
|
431
|
+
<div className="col-span-2 font-medium" data-testid="text-duration">
|
|
432
|
+
{formatDuration(creative.duration_seconds)}
|
|
433
|
+
</div>
|
|
434
|
+
</>
|
|
435
|
+
)}
|
|
436
|
+
|
|
437
|
+
{creative.metadata?.frame_rate && (
|
|
438
|
+
<>
|
|
439
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Frame Rate</div>
|
|
440
|
+
<div className="col-span-2 font-medium" data-testid="text-framerate">
|
|
441
|
+
{creative.metadata.frame_rate} fps
|
|
442
|
+
</div>
|
|
443
|
+
</>
|
|
444
|
+
)}
|
|
445
|
+
|
|
446
|
+
{creative.metadata?.codec && (
|
|
447
|
+
<>
|
|
448
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Codec</div>
|
|
449
|
+
<div className="col-span-2 font-medium" data-testid="text-codec">
|
|
450
|
+
{creative.metadata.codec}
|
|
451
|
+
</div>
|
|
452
|
+
</>
|
|
453
|
+
)}
|
|
454
|
+
|
|
455
|
+
{creative.metadata?.bitrate && (
|
|
456
|
+
<>
|
|
457
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Bitrate</div>
|
|
458
|
+
<div className="col-span-2 font-medium" data-testid="text-bitrate">
|
|
459
|
+
{Math.round(creative.metadata.bitrate / 1000)} kbps
|
|
460
|
+
</div>
|
|
461
|
+
</>
|
|
462
|
+
)}
|
|
463
|
+
|
|
464
|
+
{creative.metadata?.aspect_ratio && (
|
|
465
|
+
<>
|
|
466
|
+
<div className="text-mw-gray-600 dark:text-mw-gray-400">Aspect Ratio</div>
|
|
467
|
+
<div className="col-span-2 font-medium" data-testid="text-aspectratio">
|
|
468
|
+
{creative.metadata.aspect_ratio}
|
|
469
|
+
</div>
|
|
470
|
+
</>
|
|
471
|
+
)}
|
|
472
|
+
</div>
|
|
473
|
+
</div>
|
|
474
|
+
</>
|
|
475
|
+
)}
|
|
476
|
+
|
|
477
|
+
{/* Transcoding Section */}
|
|
478
|
+
{(isVideo || isAudio) && (
|
|
479
|
+
<>
|
|
480
|
+
<Separator />
|
|
481
|
+
<div className="space-y-3">
|
|
482
|
+
<div className="flex items-center justify-between">
|
|
483
|
+
<h3 className="text-sm font-semibold">Transcoding</h3>
|
|
484
|
+
{creative.transcode_status && getTranscodeStatusBadge(creative.transcode_status)}
|
|
485
|
+
</div>
|
|
486
|
+
|
|
487
|
+
<TranscodeDialog
|
|
488
|
+
creative={creative}
|
|
489
|
+
onTranscode={handleTranscode}
|
|
490
|
+
isTranscoding={transcodeMutation.isPending || creative.transcode_status === 'PROCESSING'}
|
|
491
|
+
>
|
|
492
|
+
<Button
|
|
493
|
+
disabled={transcodeMutation.isPending || creative.transcode_status === 'PROCESSING'}
|
|
494
|
+
variant="outline"
|
|
495
|
+
className="w-full"
|
|
496
|
+
data-testid="button-transcode"
|
|
497
|
+
>
|
|
498
|
+
{transcodeMutation.isPending ? (
|
|
499
|
+
<>
|
|
500
|
+
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
|
501
|
+
Starting...
|
|
502
|
+
</>
|
|
503
|
+
) : creative.transcode_status === 'PROCESSING' ? (
|
|
504
|
+
<>
|
|
505
|
+
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
|
506
|
+
Processing...
|
|
507
|
+
</>
|
|
508
|
+
) : (
|
|
509
|
+
<>
|
|
510
|
+
<PlayCircle className="h-4 w-4 mr-2" />
|
|
511
|
+
{creative.transcode_status === 'COMPLETED' ? 'Retranscode' : 'Start Transcoding'}
|
|
512
|
+
</>
|
|
513
|
+
)}
|
|
514
|
+
</Button>
|
|
515
|
+
</TranscodeDialog>
|
|
516
|
+
|
|
517
|
+
{/* Transcoded Variants */}
|
|
518
|
+
{variants && variants.length > 0 && (
|
|
519
|
+
<div className="space-y-2 mt-4">
|
|
520
|
+
<h4 className="text-xs font-semibold text-mw-gray-600 dark:text-mw-gray-400">Transcoded Variants</h4>
|
|
521
|
+
<div className="space-y-2">
|
|
522
|
+
{variants.map((variant: any) => (
|
|
523
|
+
<div
|
|
524
|
+
key={variant.id}
|
|
525
|
+
className="flex items-center justify-between p-2 rounded-md border bg-muted/30"
|
|
526
|
+
>
|
|
527
|
+
<div className="flex-1 min-w-0">
|
|
528
|
+
<div className="flex items-center gap-2">
|
|
529
|
+
<Badge variant="outline" className="text-xs">
|
|
530
|
+
{variant.format?.toUpperCase()}
|
|
531
|
+
</Badge>
|
|
532
|
+
<Badge variant="secondary" className="text-xs">
|
|
533
|
+
{variant.profile}
|
|
534
|
+
</Badge>
|
|
535
|
+
</div>
|
|
536
|
+
{variant.file_size_bytes && (
|
|
537
|
+
<p className="text-xs text-mw-gray-600 dark:text-mw-gray-400 mt-1">
|
|
538
|
+
{formatFileSize(variant.file_size_bytes)}
|
|
539
|
+
{variant.width && variant.height && ` • ${variant.width}×${variant.height}`}
|
|
540
|
+
</p>
|
|
541
|
+
)}
|
|
542
|
+
</div>
|
|
543
|
+
<Button
|
|
544
|
+
size="sm"
|
|
545
|
+
variant="ghost"
|
|
546
|
+
onClick={() => {
|
|
547
|
+
if (variant.cdn_path) {
|
|
548
|
+
window.open(variant.cdn_path, '_blank');
|
|
549
|
+
}
|
|
550
|
+
}}
|
|
551
|
+
>
|
|
552
|
+
<ExternalLink className="h-3 w-3" />
|
|
553
|
+
</Button>
|
|
554
|
+
</div>
|
|
555
|
+
))}
|
|
556
|
+
</div>
|
|
557
|
+
</div>
|
|
558
|
+
)}
|
|
559
|
+
</div>
|
|
560
|
+
</>
|
|
561
|
+
)}
|
|
562
|
+
|
|
563
|
+
{/* Actions */}
|
|
564
|
+
<Separator />
|
|
565
|
+
<div className="space-y-3">
|
|
566
|
+
<h3 className="text-sm font-semibold">Actions</h3>
|
|
567
|
+
<div className="grid grid-cols-2 gap-2">
|
|
568
|
+
<Button
|
|
569
|
+
onClick={() => setShowApproveDialog(true)}
|
|
570
|
+
disabled={creative.status === 'approved'}
|
|
571
|
+
variant="outline"
|
|
572
|
+
className="w-full"
|
|
573
|
+
data-testid="button-approve"
|
|
574
|
+
>
|
|
575
|
+
<CheckCircle className="h-4 w-4 mr-2" />
|
|
576
|
+
Approve
|
|
577
|
+
</Button>
|
|
578
|
+
<Button
|
|
579
|
+
onClick={() => setShowRejectDialog(true)}
|
|
580
|
+
disabled={creative.status === 'rejected'}
|
|
581
|
+
variant="outline"
|
|
582
|
+
className="w-full"
|
|
583
|
+
data-testid="button-reject"
|
|
584
|
+
>
|
|
585
|
+
<XCircle className="h-4 w-4 mr-2" />
|
|
586
|
+
Reject
|
|
587
|
+
</Button>
|
|
588
|
+
<Button
|
|
589
|
+
onClick={handleDownload}
|
|
590
|
+
variant="outline"
|
|
591
|
+
className="w-full"
|
|
592
|
+
data-testid="button-download"
|
|
593
|
+
>
|
|
594
|
+
<Download className="h-4 w-4 mr-2" />
|
|
595
|
+
Download
|
|
596
|
+
</Button>
|
|
597
|
+
<Button
|
|
598
|
+
onClick={() => setShowDeleteDialog(true)}
|
|
599
|
+
disabled={deleteMutation.isPending}
|
|
600
|
+
variant="outline"
|
|
601
|
+
className="w-full text-destructive hover:bg-destructive/10"
|
|
602
|
+
data-testid="button-delete"
|
|
603
|
+
>
|
|
604
|
+
<Trash2 className="h-4 w-4 mr-2" />
|
|
605
|
+
Delete
|
|
606
|
+
</Button>
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
|
|
610
|
+
{/* Timestamps */}
|
|
611
|
+
<Separator />
|
|
612
|
+
<div className="space-y-2">
|
|
613
|
+
<h3 className="text-sm font-semibold">Timestamps</h3>
|
|
614
|
+
<div className="grid grid-cols-3 gap-2 text-xs text-mw-gray-600 dark:text-mw-gray-400">
|
|
615
|
+
<div>Created</div>
|
|
616
|
+
<div className="col-span-2" data-testid="text-created">
|
|
617
|
+
{new Date(creative.created_at).toLocaleString()}
|
|
618
|
+
</div>
|
|
619
|
+
|
|
620
|
+
{creative.updated_at && (
|
|
621
|
+
<>
|
|
622
|
+
<div>Updated</div>
|
|
623
|
+
<div className="col-span-2" data-testid="text-updated">
|
|
624
|
+
{new Date(creative.updated_at).toLocaleString()}
|
|
625
|
+
</div>
|
|
626
|
+
</>
|
|
627
|
+
)}
|
|
628
|
+
|
|
629
|
+
{creative.approved_at && (
|
|
630
|
+
<>
|
|
631
|
+
<div>Approved</div>
|
|
632
|
+
<div className="col-span-2" data-testid="text-approved">
|
|
633
|
+
{new Date(creative.approved_at).toLocaleString()}
|
|
634
|
+
</div>
|
|
635
|
+
</>
|
|
636
|
+
)}
|
|
637
|
+
|
|
638
|
+
{creative.rejected_at && (
|
|
639
|
+
<>
|
|
640
|
+
<div>Rejected</div>
|
|
641
|
+
<div className="col-span-2" data-testid="text-rejected">
|
|
642
|
+
{new Date(creative.rejected_at).toLocaleString()}
|
|
643
|
+
</div>
|
|
644
|
+
</>
|
|
645
|
+
)}
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
</div>
|
|
649
|
+
</ScrollArea>
|
|
650
|
+
) : (
|
|
651
|
+
<div className="flex items-center justify-center h-96">
|
|
652
|
+
<p className="text-mw-gray-600 dark:text-mw-gray-400">Creative not found</p>
|
|
653
|
+
</div>
|
|
654
|
+
)}
|
|
655
|
+
</SheetContent>
|
|
656
|
+
</Sheet>
|
|
657
|
+
|
|
658
|
+
{creative && (
|
|
659
|
+
<>
|
|
660
|
+
<ApproveDialog
|
|
661
|
+
creativeFilename={creative.filename}
|
|
662
|
+
open={showApproveDialog}
|
|
663
|
+
onOpenChange={setShowApproveDialog}
|
|
664
|
+
onConfirm={handleApprove}
|
|
665
|
+
isPending={approveMutation.isPending}
|
|
666
|
+
/>
|
|
667
|
+
<RejectDialog
|
|
668
|
+
creativeFilename={creative.filename}
|
|
669
|
+
open={showRejectDialog}
|
|
670
|
+
onOpenChange={setShowRejectDialog}
|
|
671
|
+
onConfirm={handleReject}
|
|
672
|
+
isPending={rejectMutation.isPending}
|
|
673
|
+
/>
|
|
674
|
+
<DeleteDialog
|
|
675
|
+
creativeFilename={creative.filename}
|
|
676
|
+
open={showDeleteDialog}
|
|
677
|
+
onOpenChange={setShowDeleteDialog}
|
|
678
|
+
onConfirm={handleDelete}
|
|
679
|
+
isPending={deleteMutation.isPending}
|
|
680
|
+
/>
|
|
681
|
+
</>
|
|
682
|
+
)}
|
|
683
|
+
</>
|
|
684
|
+
);
|
|
685
|
+
}
|