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,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Campaign Mode Service
|
|
3
|
+
* Utility service for handling PROGRAMMATIC vs DIRECT campaign workflows
|
|
4
|
+
* Centralizes mode-specific validation, defaults, and business logic
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const CAMPAIGN_MODES = {
|
|
8
|
+
PROGRAMMATIC: 'PROGRAMMATIC',
|
|
9
|
+
DIRECT: 'DIRECT'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const CLIENT_TYPES = {
|
|
13
|
+
DIRECT_ADVERTISER: 'DIRECT_ADVERTISER',
|
|
14
|
+
AGENCY: 'AGENCY'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const CAMPAIGN_GOAL_TYPES = {
|
|
18
|
+
IMPRESSIONS: 'IMPRESSIONS',
|
|
19
|
+
REACH: 'REACH',
|
|
20
|
+
SHARE_OF_VOICE: 'SHARE_OF_VOICE'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const DEAL_TYPES = {
|
|
24
|
+
GUARANTEED: 'GUARANTEED',
|
|
25
|
+
PREFERRED_DEAL: 'PREFERRED_DEAL',
|
|
26
|
+
PRIVATE_AUCTION: 'PRIVATE_AUCTION',
|
|
27
|
+
EVERGREEN_PMP: 'EVERGREEN_PMP',
|
|
28
|
+
DIRECT: 'DIRECT'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const AUCTION_TYPES = {
|
|
32
|
+
FIRST_PRICE: 1,
|
|
33
|
+
SECOND_PRICE: 2,
|
|
34
|
+
FIXED_PRICE: 3
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export class CampaignModeService {
|
|
38
|
+
static isDirectMode(mode) {
|
|
39
|
+
return mode === CAMPAIGN_MODES.DIRECT;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static isProgrammaticMode(mode) {
|
|
43
|
+
return mode === CAMPAIGN_MODES.PROGRAMMATIC || !mode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static getRequiredFieldsForMode(mode) {
|
|
47
|
+
if (this.isDirectMode(mode)) {
|
|
48
|
+
return {
|
|
49
|
+
required: ['brand', 'clientType', 'marketSelection', 'budgetSetup', 'campaignGoal'],
|
|
50
|
+
optional: ['approvalEmails']
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
required: [],
|
|
55
|
+
optional: ['brand', 'clientType', 'approvalEmails', 'marketSelection', 'budgetSetup', 'campaignGoal']
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static validateDirectModeFields(data) {
|
|
60
|
+
const errors = [];
|
|
61
|
+
|
|
62
|
+
if (!this.isDirectMode(data.mode)) {
|
|
63
|
+
return { valid: true, errors: [] };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!data.brand) {
|
|
67
|
+
errors.push({ field: 'brand', message: 'Brand is required for DIRECT mode' });
|
|
68
|
+
}
|
|
69
|
+
if (!data.clientType) {
|
|
70
|
+
errors.push({ field: 'clientType', message: 'Client type is required for DIRECT mode' });
|
|
71
|
+
}
|
|
72
|
+
if (!data.marketSelection) {
|
|
73
|
+
errors.push({ field: 'marketSelection', message: 'Market selection is required for DIRECT mode' });
|
|
74
|
+
}
|
|
75
|
+
if (!data.budgetSetup) {
|
|
76
|
+
errors.push({ field: 'budgetSetup', message: 'Budget setup is required for DIRECT mode' });
|
|
77
|
+
}
|
|
78
|
+
if (!data.campaignGoal) {
|
|
79
|
+
errors.push({ field: 'campaignGoal', message: 'Campaign goal is required for DIRECT mode' });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
valid: errors.length === 0,
|
|
84
|
+
errors
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static applyDefaults(data) {
|
|
89
|
+
const result = { ...data };
|
|
90
|
+
|
|
91
|
+
if (!result.mode) {
|
|
92
|
+
result.mode = CAMPAIGN_MODES.PROGRAMMATIC;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (this.isDirectMode(result.mode)) {
|
|
96
|
+
result.dealType = 'DIRECT';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!result.status) {
|
|
100
|
+
result.status = 'GENERATED';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (this.isProgrammaticMode(result.mode) && result.dealType) {
|
|
104
|
+
result.auctionType = this.getDefaultAuctionType(result.dealType, result.auctionType);
|
|
105
|
+
|
|
106
|
+
if (result.impMultiplierType === undefined) {
|
|
107
|
+
result.impMultiplierType = 'MAD';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (result.budgetSetup && result.budgetSetup.budgetAmount === undefined) {
|
|
112
|
+
result.budgetSetup.budgetAmount = null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (result.campaignGoal && result.campaignGoal.targetValue === undefined) {
|
|
116
|
+
result.campaignGoal.targetValue = null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static getDefaultAuctionType(dealType, providedAuctionType) {
|
|
123
|
+
if (dealType === DEAL_TYPES.GUARANTEED || dealType === DEAL_TYPES.PREFERRED_DEAL) {
|
|
124
|
+
return AUCTION_TYPES.FIXED_PRICE;
|
|
125
|
+
}
|
|
126
|
+
if (dealType === DEAL_TYPES.PRIVATE_AUCTION || dealType === DEAL_TYPES.EVERGREEN_PMP) {
|
|
127
|
+
return providedAuctionType || AUCTION_TYPES.FIRST_PRICE;
|
|
128
|
+
}
|
|
129
|
+
return providedAuctionType;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static validateAuctionType(dealType, auctionType) {
|
|
133
|
+
if (dealType === DEAL_TYPES.GUARANTEED || dealType === DEAL_TYPES.PREFERRED_DEAL) {
|
|
134
|
+
if (auctionType && auctionType !== AUCTION_TYPES.FIXED_PRICE) {
|
|
135
|
+
return { valid: false, error: 'Auction type must be 3 (fixed price) for GUARANTEED and PREFERRED_DEAL deals' };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (dealType === DEAL_TYPES.PRIVATE_AUCTION || dealType === DEAL_TYPES.EVERGREEN_PMP) {
|
|
139
|
+
if (auctionType && auctionType !== AUCTION_TYPES.FIRST_PRICE && auctionType !== AUCTION_TYPES.SECOND_PRICE) {
|
|
140
|
+
return { valid: false, error: 'Auction type must be 1 (first price) or 2 (second price) for PRIVATE_AUCTION and EVERGREEN_PMP deals' };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { valid: true };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static validateCostType(dealType, costType) {
|
|
147
|
+
if (costType === 'CPS' && dealType === DEAL_TYPES.GUARANTEED) {
|
|
148
|
+
return { valid: false, error: 'CPS cost type is not available for GUARANTEED deals' };
|
|
149
|
+
}
|
|
150
|
+
return { valid: true };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static buildAdvertiserFromClientType(data) {
|
|
154
|
+
if (!this.isDirectMode(data.mode) || data.source !== 'influence') {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
id: '',
|
|
160
|
+
seatId: '',
|
|
161
|
+
name: data.brand || ''
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
static sanitizeForUpdate(existingData, updateData, newMode = null) {
|
|
166
|
+
const result = { ...updateData };
|
|
167
|
+
|
|
168
|
+
const resultingMode = newMode || updateData.mode || existingData.mode;
|
|
169
|
+
|
|
170
|
+
if (existingData.mode === CAMPAIGN_MODES.DIRECT && resultingMode === CAMPAIGN_MODES.PROGRAMMATIC) {
|
|
171
|
+
result.brand = result.brand !== undefined ? result.brand : null;
|
|
172
|
+
result.clientType = result.clientType !== undefined ? result.clientType : null;
|
|
173
|
+
result.approvalEmails = null;
|
|
174
|
+
result.marketSelection = null;
|
|
175
|
+
result.budgetSetup = null;
|
|
176
|
+
result.campaignGoal = null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
static getWorkflowInfo(mode) {
|
|
183
|
+
if (this.isDirectMode(mode)) {
|
|
184
|
+
return {
|
|
185
|
+
mode: CAMPAIGN_MODES.DIRECT,
|
|
186
|
+
description: 'Traditional direct campaign with approval workflow',
|
|
187
|
+
requiredFields: ['brand', 'clientType', 'approvalEmails', 'marketSelection', 'budgetSetup', 'campaignGoal'],
|
|
188
|
+
features: ['Approval workflow', 'Budget planning', 'Market targeting', 'Goal tracking']
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
mode: CAMPAIGN_MODES.PROGRAMMATIC,
|
|
193
|
+
description: 'Standard programmatic deal workflow',
|
|
194
|
+
requiredFields: ['source', 'externalId'],
|
|
195
|
+
features: ['Programmatic buying', 'Real-time bidding', 'Automated delivery']
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
static validateCampaignGoal(campaignGoal) {
|
|
200
|
+
if (!campaignGoal) return { valid: true, errors: [] };
|
|
201
|
+
|
|
202
|
+
const errors = [];
|
|
203
|
+
const validTypes = Object.values(CAMPAIGN_GOAL_TYPES);
|
|
204
|
+
|
|
205
|
+
if (!campaignGoal.type) {
|
|
206
|
+
errors.push({ field: 'campaignGoal.type', message: 'Goal type is required' });
|
|
207
|
+
} else if (!validTypes.includes(campaignGoal.type)) {
|
|
208
|
+
errors.push({
|
|
209
|
+
field: 'campaignGoal.type',
|
|
210
|
+
message: `Goal type must be one of: ${validTypes.join(', ')}`
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (campaignGoal.targetValue !== undefined && campaignGoal.targetValue !== null) {
|
|
215
|
+
if (typeof campaignGoal.targetValue !== 'number' || campaignGoal.targetValue < 0) {
|
|
216
|
+
errors.push({
|
|
217
|
+
field: 'campaignGoal.targetValue',
|
|
218
|
+
message: 'Target value must be a non-negative number'
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
valid: errors.length === 0,
|
|
225
|
+
errors
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
static validateBudgetSetup(budgetSetup) {
|
|
230
|
+
if (!budgetSetup) return { valid: true, errors: [] };
|
|
231
|
+
|
|
232
|
+
const errors = [];
|
|
233
|
+
|
|
234
|
+
if (!budgetSetup.currency) {
|
|
235
|
+
errors.push({ field: 'budgetSetup.currency', message: 'Currency is required' });
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (budgetSetup.budgetAmount !== undefined && budgetSetup.budgetAmount !== null) {
|
|
239
|
+
if (typeof budgetSetup.budgetAmount !== 'number' || budgetSetup.budgetAmount < 0) {
|
|
240
|
+
errors.push({
|
|
241
|
+
field: 'budgetSetup.budgetAmount',
|
|
242
|
+
message: 'Budget amount must be a non-negative number'
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return {
|
|
248
|
+
valid: errors.length === 0,
|
|
249
|
+
errors
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
static validateMarketSelection(marketSelection) {
|
|
254
|
+
if (!marketSelection) return { valid: true, errors: [] };
|
|
255
|
+
|
|
256
|
+
const errors = [];
|
|
257
|
+
|
|
258
|
+
if (!marketSelection.country) {
|
|
259
|
+
errors.push({ field: 'marketSelection.country', message: 'Country is required' });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!marketSelection.currency) {
|
|
263
|
+
errors.push({ field: 'marketSelection.currency', message: 'Currency is required' });
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return {
|
|
267
|
+
valid: errors.length === 0,
|
|
268
|
+
errors
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export default CampaignModeService;
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { normalizeSource, SOURCE_TYPES as NORMALIZED_SOURCE_TYPES } from '../utils/sourceNormalizer.js';
|
|
2
|
+
|
|
3
|
+
export const CAMPAIGN_STATUSES = {
|
|
4
|
+
GENERATED: 'GENERATED',
|
|
5
|
+
REQUESTED: 'REQUESTED',
|
|
6
|
+
PENDING: 'PENDING',
|
|
7
|
+
APPROVED: 'APPROVED',
|
|
8
|
+
LIVE: 'LIVE',
|
|
9
|
+
COMPLETED: 'COMPLETED',
|
|
10
|
+
EXPIRED: 'EXPIRED',
|
|
11
|
+
REJECTED: 'REJECTED',
|
|
12
|
+
ARCHIVED: 'ARCHIVED',
|
|
13
|
+
REOPENED: 'REOPENED'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const WORKFLOW_TYPES = {
|
|
17
|
+
DIRECT: 'DIRECT',
|
|
18
|
+
PROGRAMMATIC: 'PROGRAMMATIC'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const SOURCE_TYPES = {
|
|
22
|
+
INTERNAL: 'INTERNAL',
|
|
23
|
+
EXTERNAL: 'EXTERNAL'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const TRANSITION_OWNERS = {
|
|
27
|
+
USER: 'USER',
|
|
28
|
+
DSP: 'DSP',
|
|
29
|
+
MQ_WORKER: 'MQ_WORKER',
|
|
30
|
+
SCHEDULER: 'SCHEDULER',
|
|
31
|
+
ADMIN: 'ADMIN'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const VALID_TRANSITIONS = {
|
|
35
|
+
[CAMPAIGN_STATUSES.GENERATED]: [
|
|
36
|
+
CAMPAIGN_STATUSES.REQUESTED,
|
|
37
|
+
CAMPAIGN_STATUSES.PENDING,
|
|
38
|
+
CAMPAIGN_STATUSES.APPROVED,
|
|
39
|
+
CAMPAIGN_STATUSES.REJECTED,
|
|
40
|
+
CAMPAIGN_STATUSES.ARCHIVED
|
|
41
|
+
],
|
|
42
|
+
[CAMPAIGN_STATUSES.REQUESTED]: [
|
|
43
|
+
CAMPAIGN_STATUSES.PENDING,
|
|
44
|
+
CAMPAIGN_STATUSES.APPROVED,
|
|
45
|
+
CAMPAIGN_STATUSES.REJECTED,
|
|
46
|
+
CAMPAIGN_STATUSES.ARCHIVED
|
|
47
|
+
],
|
|
48
|
+
[CAMPAIGN_STATUSES.PENDING]: [
|
|
49
|
+
CAMPAIGN_STATUSES.APPROVED,
|
|
50
|
+
CAMPAIGN_STATUSES.REJECTED,
|
|
51
|
+
CAMPAIGN_STATUSES.ARCHIVED
|
|
52
|
+
],
|
|
53
|
+
[CAMPAIGN_STATUSES.APPROVED]: [
|
|
54
|
+
CAMPAIGN_STATUSES.LIVE,
|
|
55
|
+
CAMPAIGN_STATUSES.EXPIRED,
|
|
56
|
+
CAMPAIGN_STATUSES.REJECTED,
|
|
57
|
+
CAMPAIGN_STATUSES.ARCHIVED,
|
|
58
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
59
|
+
],
|
|
60
|
+
[CAMPAIGN_STATUSES.LIVE]: [
|
|
61
|
+
CAMPAIGN_STATUSES.COMPLETED,
|
|
62
|
+
CAMPAIGN_STATUSES.ARCHIVED,
|
|
63
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
64
|
+
],
|
|
65
|
+
[CAMPAIGN_STATUSES.COMPLETED]: [
|
|
66
|
+
CAMPAIGN_STATUSES.ARCHIVED,
|
|
67
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
68
|
+
],
|
|
69
|
+
[CAMPAIGN_STATUSES.EXPIRED]: [
|
|
70
|
+
CAMPAIGN_STATUSES.ARCHIVED,
|
|
71
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
72
|
+
],
|
|
73
|
+
[CAMPAIGN_STATUSES.REJECTED]: [
|
|
74
|
+
CAMPAIGN_STATUSES.ARCHIVED,
|
|
75
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
76
|
+
],
|
|
77
|
+
[CAMPAIGN_STATUSES.ARCHIVED]: [
|
|
78
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
79
|
+
],
|
|
80
|
+
[CAMPAIGN_STATUSES.REOPENED]: [
|
|
81
|
+
CAMPAIGN_STATUSES.PENDING,
|
|
82
|
+
CAMPAIGN_STATUSES.APPROVED,
|
|
83
|
+
CAMPAIGN_STATUSES.LIVE,
|
|
84
|
+
CAMPAIGN_STATUSES.ARCHIVED
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const STATUSES_ALLOWING_REOPEN = [
|
|
89
|
+
CAMPAIGN_STATUSES.APPROVED,
|
|
90
|
+
CAMPAIGN_STATUSES.LIVE,
|
|
91
|
+
CAMPAIGN_STATUSES.COMPLETED,
|
|
92
|
+
CAMPAIGN_STATUSES.EXPIRED,
|
|
93
|
+
CAMPAIGN_STATUSES.REJECTED,
|
|
94
|
+
CAMPAIGN_STATUSES.ARCHIVED
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const EDITABLE_STATUSES = [
|
|
98
|
+
CAMPAIGN_STATUSES.GENERATED,
|
|
99
|
+
CAMPAIGN_STATUSES.REQUESTED,
|
|
100
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
const PACING_EDITABLE_STATUSES = [
|
|
104
|
+
CAMPAIGN_STATUSES.GENERATED,
|
|
105
|
+
CAMPAIGN_STATUSES.REQUESTED,
|
|
106
|
+
CAMPAIGN_STATUSES.REOPENED,
|
|
107
|
+
CAMPAIGN_STATUSES.APPROVED,
|
|
108
|
+
CAMPAIGN_STATUSES.LIVE
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
const BUDGET_EDITABLE_STATUSES = [
|
|
112
|
+
CAMPAIGN_STATUSES.GENERATED,
|
|
113
|
+
CAMPAIGN_STATUSES.REQUESTED,
|
|
114
|
+
CAMPAIGN_STATUSES.REOPENED,
|
|
115
|
+
CAMPAIGN_STATUSES.APPROVED
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
const STRUCTURE_EDITABLE_STATUSES = [
|
|
119
|
+
CAMPAIGN_STATUSES.GENERATED,
|
|
120
|
+
CAMPAIGN_STATUSES.REQUESTED,
|
|
121
|
+
CAMPAIGN_STATUSES.REOPENED
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
class CampaignStatusService {
|
|
125
|
+
isValidTransition(fromStatus, toStatus) {
|
|
126
|
+
const validNextStatuses = VALID_TRANSITIONS[fromStatus];
|
|
127
|
+
if (!validNextStatuses) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
return validNextStatuses.includes(toStatus);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
getValidTransitions(currentStatus) {
|
|
134
|
+
return VALID_TRANSITIONS[currentStatus] || [];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
canReopen(currentStatus) {
|
|
138
|
+
return STATUSES_ALLOWING_REOPEN.includes(currentStatus);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
canEditPacing(status, source = SOURCE_TYPES.INTERNAL) {
|
|
142
|
+
if (source === SOURCE_TYPES.EXTERNAL) {
|
|
143
|
+
return [CAMPAIGN_STATUSES.APPROVED, CAMPAIGN_STATUSES.LIVE].includes(status);
|
|
144
|
+
}
|
|
145
|
+
return PACING_EDITABLE_STATUSES.includes(status);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
canEditBudget(status, source = SOURCE_TYPES.INTERNAL) {
|
|
149
|
+
if (source === SOURCE_TYPES.EXTERNAL) {
|
|
150
|
+
return status === CAMPAIGN_STATUSES.APPROVED;
|
|
151
|
+
}
|
|
152
|
+
return BUDGET_EDITABLE_STATUSES.includes(status);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
canEditStructure(status, source = SOURCE_TYPES.INTERNAL) {
|
|
156
|
+
if (source === SOURCE_TYPES.EXTERNAL) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
return STRUCTURE_EDITABLE_STATUSES.includes(status);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
getEditableFields(status, source = SOURCE_TYPES.INTERNAL, workflow = WORKFLOW_TYPES.DIRECT) {
|
|
163
|
+
const fields = {
|
|
164
|
+
pacing: this.canEditPacing(status, source),
|
|
165
|
+
budget: this.canEditBudget(status, source),
|
|
166
|
+
structure: this.canEditStructure(status, source),
|
|
167
|
+
inventory: this.canEditStructure(status, source),
|
|
168
|
+
lineItems: this.canEditStructure(status, source),
|
|
169
|
+
dates: this.canEditStructure(status, source),
|
|
170
|
+
creatives: this.canEditStructure(status, source),
|
|
171
|
+
commercialTerms: this.canEditStructure(status, source)
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
return fields;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
validateTransition(campaign, toStatus, context = {}) {
|
|
178
|
+
const { owner = TRANSITION_OWNERS.USER, source, workflow } = context;
|
|
179
|
+
const currentStatus = campaign.status;
|
|
180
|
+
const rawSource = source || campaign.source;
|
|
181
|
+
const campaignSource = (rawSource === SOURCE_TYPES.INTERNAL || rawSource === SOURCE_TYPES.EXTERNAL)
|
|
182
|
+
? rawSource
|
|
183
|
+
: normalizeSource(rawSource);
|
|
184
|
+
const campaignWorkflow = workflow || campaign.mode || WORKFLOW_TYPES.DIRECT;
|
|
185
|
+
|
|
186
|
+
const errors = [];
|
|
187
|
+
|
|
188
|
+
if (!this.isValidTransition(currentStatus, toStatus)) {
|
|
189
|
+
errors.push({
|
|
190
|
+
code: 'INVALID_TRANSITION',
|
|
191
|
+
message: `Cannot transition from ${currentStatus} to ${toStatus}`,
|
|
192
|
+
allowedTransitions: this.getValidTransitions(currentStatus)
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (toStatus === CAMPAIGN_STATUSES.REOPENED && !this.canReopen(currentStatus)) {
|
|
197
|
+
errors.push({
|
|
198
|
+
code: 'REOPEN_NOT_ALLOWED',
|
|
199
|
+
message: `Cannot reopen campaign from status ${currentStatus}. Allowed from: ${STATUSES_ALLOWING_REOPEN.join(', ')}`
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (toStatus === CAMPAIGN_STATUSES.LIVE) {
|
|
204
|
+
if (owner !== TRANSITION_OWNERS.MQ_WORKER) {
|
|
205
|
+
errors.push({
|
|
206
|
+
code: 'LIVE_REQUIRES_DELIVERY',
|
|
207
|
+
message: 'LIVE status can only be set by MQ_WORKER when delivery is confirmed (first ad play or first bid win).',
|
|
208
|
+
allowedOwner: TRANSITION_OWNERS.MQ_WORKER
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (toStatus === CAMPAIGN_STATUSES.COMPLETED || toStatus === CAMPAIGN_STATUSES.EXPIRED) {
|
|
214
|
+
if (owner !== TRANSITION_OWNERS.SCHEDULER) {
|
|
215
|
+
errors.push({
|
|
216
|
+
code: 'SCHEDULER_ONLY',
|
|
217
|
+
message: `${toStatus} status can only be set by SCHEDULER based on end date or delivery events.`,
|
|
218
|
+
allowedOwner: TRANSITION_OWNERS.SCHEDULER
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (campaignWorkflow === WORKFLOW_TYPES.PROGRAMMATIC && campaignSource === SOURCE_TYPES.EXTERNAL) {
|
|
224
|
+
if (toStatus === CAMPAIGN_STATUSES.APPROVED) {
|
|
225
|
+
if (owner !== TRANSITION_OWNERS.DSP && owner !== TRANSITION_OWNERS.MQ_WORKER) {
|
|
226
|
+
errors.push({
|
|
227
|
+
code: 'DSP_APPROVAL_REQUIRED',
|
|
228
|
+
message: 'External PROGRAMMATIC deals require buyer acceptance from DSP for APPROVED status.',
|
|
229
|
+
allowedOwners: [TRANSITION_OWNERS.DSP, TRANSITION_OWNERS.MQ_WORKER]
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (toStatus === CAMPAIGN_STATUSES.REJECTED) {
|
|
234
|
+
if (owner !== TRANSITION_OWNERS.DSP && owner !== TRANSITION_OWNERS.MQ_WORKER) {
|
|
235
|
+
errors.push({
|
|
236
|
+
code: 'DSP_REJECTION_REQUIRED',
|
|
237
|
+
message: 'External PROGRAMMATIC deals can only be rejected by DSP.',
|
|
238
|
+
allowedOwners: [TRANSITION_OWNERS.DSP, TRANSITION_OWNERS.MQ_WORKER]
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
valid: errors.length === 0,
|
|
246
|
+
errors,
|
|
247
|
+
fromStatus: currentStatus,
|
|
248
|
+
toStatus,
|
|
249
|
+
workflow: campaignWorkflow,
|
|
250
|
+
source: campaignSource
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
validateUpdate(campaign, updateData, context = {}) {
|
|
255
|
+
const { source, workflow } = context;
|
|
256
|
+
const campaignSource = source || campaign.source || SOURCE_TYPES.INTERNAL;
|
|
257
|
+
const campaignWorkflow = workflow || campaign.mode || WORKFLOW_TYPES.DIRECT;
|
|
258
|
+
const status = campaign.status;
|
|
259
|
+
|
|
260
|
+
const errors = [];
|
|
261
|
+
const warnings = [];
|
|
262
|
+
|
|
263
|
+
const editableFields = this.getEditableFields(status, campaignSource, campaignWorkflow);
|
|
264
|
+
|
|
265
|
+
const structuralFields = ['lineItems', 'inventories', 'dates', 'creatives', 'startDate', 'endDate'];
|
|
266
|
+
const budgetFields = ['budget', 'budgetSetup', 'budgetAmount', 'budgetType'];
|
|
267
|
+
const pacingFields = ['pacing', 'pacingType', 'dailyCap', 'hourlyCap'];
|
|
268
|
+
|
|
269
|
+
for (const field of Object.keys(updateData)) {
|
|
270
|
+
if (structuralFields.includes(field) && !editableFields.structure) {
|
|
271
|
+
errors.push({
|
|
272
|
+
code: 'FIELD_NOT_EDITABLE',
|
|
273
|
+
field,
|
|
274
|
+
message: `Cannot modify ${field} when status is ${status}${campaignSource === SOURCE_TYPES.EXTERNAL ? ' (external source)' : ''}`
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (budgetFields.includes(field) && !editableFields.budget) {
|
|
279
|
+
errors.push({
|
|
280
|
+
code: 'FIELD_NOT_EDITABLE',
|
|
281
|
+
field,
|
|
282
|
+
message: `Cannot modify ${field} when status is ${status}${campaignSource === SOURCE_TYPES.EXTERNAL ? ' (external source)' : ''}`
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
for (const field of Object.keys(updateData)) {
|
|
288
|
+
if (pacingFields.includes(field) && !editableFields.pacing) {
|
|
289
|
+
warnings.push({
|
|
290
|
+
code: 'PACING_NOT_EDITABLE',
|
|
291
|
+
field,
|
|
292
|
+
message: `Pacing updates are restricted for status ${status}`
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return {
|
|
298
|
+
valid: errors.length === 0,
|
|
299
|
+
errors,
|
|
300
|
+
warnings,
|
|
301
|
+
editableFields,
|
|
302
|
+
status,
|
|
303
|
+
source: campaignSource,
|
|
304
|
+
workflow: campaignWorkflow
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
getStatusDefinition(status, workflow = WORKFLOW_TYPES.DIRECT) {
|
|
309
|
+
const definitions = {
|
|
310
|
+
[CAMPAIGN_STATUSES.GENERATED]: {
|
|
311
|
+
[WORKFLOW_TYPES.DIRECT]: 'AdOps creates draft from IO / sales request',
|
|
312
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'Media Owner creates deal via UI/API'
|
|
313
|
+
},
|
|
314
|
+
[CAMPAIGN_STATUSES.REQUESTED]: {
|
|
315
|
+
[WORKFLOW_TYPES.DIRECT]: 'Planner pushes draft for review (rare)',
|
|
316
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'DSP sends structured deal request'
|
|
317
|
+
},
|
|
318
|
+
[CAMPAIGN_STATUSES.PENDING]: {
|
|
319
|
+
[WORKFLOW_TYPES.DIRECT]: 'Approval emails done, IO sent, waiting for signed IO. Validation required: inventory, budget, schedule',
|
|
320
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'Deal pushed to DSP, awaiting buyer acceptance'
|
|
321
|
+
},
|
|
322
|
+
[CAMPAIGN_STATUSES.APPROVED]: {
|
|
323
|
+
[WORKFLOW_TYPES.DIRECT]: 'Signed IO received, AdOps approves',
|
|
324
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'Buyer accepts deal in DSP, inventory hard reserved'
|
|
325
|
+
},
|
|
326
|
+
[CAMPAIGN_STATUSES.LIVE]: {
|
|
327
|
+
[WORKFLOW_TYPES.DIRECT]: 'Start date reached + first CMS ad play confirmed',
|
|
328
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'First valid bid request/win received'
|
|
329
|
+
},
|
|
330
|
+
[CAMPAIGN_STATUSES.COMPLETED]: {
|
|
331
|
+
[WORKFLOW_TYPES.DIRECT]: 'End date reached OR goal met',
|
|
332
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'End date reached OR goal met'
|
|
333
|
+
},
|
|
334
|
+
[CAMPAIGN_STATUSES.EXPIRED]: {
|
|
335
|
+
[WORKFLOW_TYPES.DIRECT]: 'Start date passed, no creative or play',
|
|
336
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'Approved deal, no bids received'
|
|
337
|
+
},
|
|
338
|
+
[CAMPAIGN_STATUSES.REJECTED]: {
|
|
339
|
+
[WORKFLOW_TYPES.DIRECT]: 'Client withdrew or IO not signed',
|
|
340
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'Buyer rejected deal in DSP'
|
|
341
|
+
},
|
|
342
|
+
[CAMPAIGN_STATUSES.ARCHIVED]: {
|
|
343
|
+
[WORKFLOW_TYPES.DIRECT]: 'Campaign moved to cold storage after validity period',
|
|
344
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'Campaign moved to cold storage after validity period'
|
|
345
|
+
},
|
|
346
|
+
[CAMPAIGN_STATUSES.REOPENED]: {
|
|
347
|
+
[WORKFLOW_TYPES.DIRECT]: 'Closed campaign reopened - allows modification of dates, inventory, floor rates',
|
|
348
|
+
[WORKFLOW_TYPES.PROGRAMMATIC]: 'Closed campaign reopened - allows modification of dates, inventory, floor rates'
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
return definitions[status]?.[workflow] || 'Unknown status';
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
getTransitionOwnership() {
|
|
356
|
+
return {
|
|
357
|
+
[TRANSITION_OWNERS.USER]: 'Manual approval via User / UI',
|
|
358
|
+
[TRANSITION_OWNERS.DSP]: 'Buyer accept/reject from DSP',
|
|
359
|
+
[TRANSITION_OWNERS.MQ_WORKER]: 'Delivery confirmation (first play/bid)',
|
|
360
|
+
[TRANSITION_OWNERS.SCHEDULER]: 'End date checks, expiration',
|
|
361
|
+
[TRANSITION_OWNERS.ADMIN]: 'Archival, reopening'
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
getWorkflowRules() {
|
|
366
|
+
return {
|
|
367
|
+
sameDayApproval: {
|
|
368
|
+
description: 'When campaign is APPROVED on the same date as start date',
|
|
369
|
+
rules: [
|
|
370
|
+
'APPROVED does not automatically mean LIVE',
|
|
371
|
+
'Campaign stays in APPROVED until delivery confirmation',
|
|
372
|
+
'LIVE transition requires first ad play (Direct) or first bid win (Programmatic)',
|
|
373
|
+
'Between APPROVED → LIVE: pacing updates allowed, budget allocation allowed'
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
externalSource: {
|
|
377
|
+
description: 'Externally sourced campaigns are execution-only',
|
|
378
|
+
cannotModify: [
|
|
379
|
+
'Campaign structure',
|
|
380
|
+
'Line items',
|
|
381
|
+
'Inventory',
|
|
382
|
+
'Dates',
|
|
383
|
+
'Creatives',
|
|
384
|
+
'Commercial terms'
|
|
385
|
+
],
|
|
386
|
+
canModify: {
|
|
387
|
+
APPROVED: ['Pacing', 'Budget allocation'],
|
|
388
|
+
LIVE: ['Pacing only']
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export default new CampaignStatusService();
|