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,916 @@
|
|
|
1
|
+
import { useForm } from "react-hook-form";
|
|
2
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { useTranslation } from "@/lib/i18n";
|
|
6
|
+
import { Button } from "@moving-walls/design-system";
|
|
7
|
+
import {
|
|
8
|
+
Form,
|
|
9
|
+
FormItem,
|
|
10
|
+
FormLabel,
|
|
11
|
+
FormControl,
|
|
12
|
+
FormMessage,
|
|
13
|
+
} from "@moving-walls/design-system";
|
|
14
|
+
import { Input } from "@moving-walls/design-system";
|
|
15
|
+
import {
|
|
16
|
+
SelectRoot,
|
|
17
|
+
SelectContent,
|
|
18
|
+
SelectItem,
|
|
19
|
+
SelectTrigger,
|
|
20
|
+
SelectValue,
|
|
21
|
+
} from "@moving-walls/design-system";
|
|
22
|
+
import { FileText, ChevronRight, ChevronLeft, DollarSign, Target } from "lucide-react";
|
|
23
|
+
import { FormInsights } from "../form-insights";
|
|
24
|
+
import { DateRangePicker } from "@moving-walls/design-system";
|
|
25
|
+
import { cn } from "@moving-walls/design-system";
|
|
26
|
+
import { getTodayDate, toAPIDateString, fromAPIDateString } from "@/lib/date-utils";
|
|
27
|
+
import { useMemo } from "react";
|
|
28
|
+
|
|
29
|
+
interface PacingDeliveryGraphProps {
|
|
30
|
+
pacingType: 'even' | 'asap' | 'front-loaded' | 'back-loaded';
|
|
31
|
+
days?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function PacingDeliveryGraph({ pacingType, days = 30 }: PacingDeliveryGraphProps) {
|
|
35
|
+
const { t } = useTranslation('lineItems');
|
|
36
|
+
const data = useMemo(() => {
|
|
37
|
+
const result: number[] = [];
|
|
38
|
+
for (let i = 0; i < days; i++) {
|
|
39
|
+
if (pacingType === 'even') {
|
|
40
|
+
result.push(50);
|
|
41
|
+
} else if (pacingType === 'asap') {
|
|
42
|
+
const base = 100 - (i * 3.5);
|
|
43
|
+
result.push(Math.max(5, base));
|
|
44
|
+
} else if (pacingType === 'front-loaded') {
|
|
45
|
+
const decay = Math.exp(-i / 12) * 100;
|
|
46
|
+
result.push(Math.max(5, decay));
|
|
47
|
+
} else if (pacingType === 'back-loaded') {
|
|
48
|
+
const growth = (1 - Math.exp(-(i) / 12)) * 100;
|
|
49
|
+
result.push(Math.min(100, Math.max(5, growth)));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}, [pacingType, days]);
|
|
54
|
+
|
|
55
|
+
const maxValue = 100;
|
|
56
|
+
const chartWidth = 420;
|
|
57
|
+
const chartHeight = 100;
|
|
58
|
+
const barWidth = chartWidth / days - 1;
|
|
59
|
+
const yAxisLabels = [100, 75, 50, 25, 0];
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="mt-4 p-4 bg-white dark:bg-mw-neutral-900 rounded-lg border border-mw-neutral-200 dark:border-mw-neutral-700">
|
|
63
|
+
<div className="flex items-center gap-2 mb-3">
|
|
64
|
+
<span className="text-sm font-medium text-mw-neutral-700 dark:text-mw-neutral-300">
|
|
65
|
+
{t('wizard.details.projectedPacingDelivery')}
|
|
66
|
+
</span>
|
|
67
|
+
<span
|
|
68
|
+
className="inline-flex items-center justify-center w-4 h-4 rounded-full border border-mw-neutral-300 text-[10px] text-mw-neutral-400 cursor-help"
|
|
69
|
+
title={t('wizard.details.pacingGraphTooltip')}
|
|
70
|
+
>
|
|
71
|
+
?
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div className="grid grid-cols-[20px_32px_1fr] gap-1">
|
|
76
|
+
<div className="flex items-center justify-center" style={{ height: chartHeight }}>
|
|
77
|
+
<span className="text-[10px] text-mw-neutral-500 -rotate-90 whitespace-nowrap origin-center">
|
|
78
|
+
{t('wizard.details.goalPercentage')}
|
|
79
|
+
</span>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div className="flex flex-col justify-between text-[10px] text-mw-neutral-500 text-right pr-1" style={{ height: chartHeight }}>
|
|
83
|
+
{yAxisLabels.map((label) => (
|
|
84
|
+
<span key={label} className="leading-none">{label}</span>
|
|
85
|
+
))}
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div className="flex-1">
|
|
89
|
+
<svg width="100%" height={chartHeight} viewBox={`0 0 ${chartWidth} ${chartHeight}`} preserveAspectRatio="none">
|
|
90
|
+
{[0, 25, 50, 75, 100].map((y) => (
|
|
91
|
+
<line
|
|
92
|
+
key={y}
|
|
93
|
+
x1={0}
|
|
94
|
+
y1={chartHeight - (y / maxValue) * chartHeight}
|
|
95
|
+
x2={chartWidth}
|
|
96
|
+
y2={chartHeight - (y / maxValue) * chartHeight}
|
|
97
|
+
stroke="#e5e7eb"
|
|
98
|
+
strokeWidth={0.5}
|
|
99
|
+
strokeDasharray={y === 0 ? "0" : "2,2"}
|
|
100
|
+
/>
|
|
101
|
+
))}
|
|
102
|
+
|
|
103
|
+
{data.map((value, index) => {
|
|
104
|
+
const barHeight = (value / maxValue) * chartHeight;
|
|
105
|
+
const x = index * (chartWidth / days);
|
|
106
|
+
return (
|
|
107
|
+
<rect
|
|
108
|
+
key={index}
|
|
109
|
+
x={x}
|
|
110
|
+
y={chartHeight - barHeight}
|
|
111
|
+
width={barWidth}
|
|
112
|
+
height={barHeight}
|
|
113
|
+
fill="#2176cc"
|
|
114
|
+
rx={1}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
})}
|
|
118
|
+
</svg>
|
|
119
|
+
|
|
120
|
+
<div className="flex justify-between text-[10px] text-mw-neutral-500 mt-1">
|
|
121
|
+
<span>0</span>
|
|
122
|
+
{Array.from({ length: 5 }, (_, i) => {
|
|
123
|
+
const step = Math.ceil(days / 5);
|
|
124
|
+
const label = Math.min((i + 1) * step, days);
|
|
125
|
+
return <span key={i}>{label}</span>;
|
|
126
|
+
})}
|
|
127
|
+
</div>
|
|
128
|
+
<div className="text-center text-[10px] text-mw-neutral-500 mt-1">
|
|
129
|
+
{t('wizard.details.numberOfDays')}
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const lineItemDetailsSchema = z.object({
|
|
138
|
+
name: z.string().min(3, "Line item name must be at least 3 characters").max(200, "Line item name must not exceed 200 characters"),
|
|
139
|
+
start_date: z.string().min(1, "Start date is required"),
|
|
140
|
+
end_date: z.string().min(1, "End date is required"),
|
|
141
|
+
budget_amount: z.number().min(0, "Budget amount must be a positive number").nullish(),
|
|
142
|
+
currency: z.string().min(1, "Currency is required"),
|
|
143
|
+
creative_type: z.enum(["DISPLAY", "VIDEO", "AUDIO"], {
|
|
144
|
+
errorMap: () => ({ message: "Please select a creative type" })
|
|
145
|
+
}).default("VIDEO"),
|
|
146
|
+
duration: z.number().min(1, "Duration must be at least 1 second").max(300, "Duration must not exceed 300 seconds").nullish(),
|
|
147
|
+
goal_type: z.enum(["IMPRESSIONS", "REACH", "SHARE_OF_VOICE"], {
|
|
148
|
+
errorMap: () => ({ message: "Please select a goal type" })
|
|
149
|
+
}),
|
|
150
|
+
target_value: z.number().min(0, "Target value must be a positive number").nullish(),
|
|
151
|
+
daily_budget_cap: z.number().min(0, "Daily budget cap must be a positive number").nullish(),
|
|
152
|
+
impressions: z.number().min(0, "Impressions must be a positive number").nullish(),
|
|
153
|
+
pacing_type: z.enum(["asap", "even", "front-loaded", "back-loaded"], {
|
|
154
|
+
errorMap: () => ({ message: "Please select a pacing type" })
|
|
155
|
+
}).default("even"),
|
|
156
|
+
pacing_daily_cap: z.preprocess(
|
|
157
|
+
(val) => (val === "" || val === null || val === undefined || Number.isNaN(val) ? undefined : Number(val)),
|
|
158
|
+
z.number().min(0, "Daily cap must be a positive number").optional()
|
|
159
|
+
),
|
|
160
|
+
pacing_hourly_cap: z.preprocess(
|
|
161
|
+
(val) => (val === "" || val === null || val === undefined || Number.isNaN(val) ? undefined : Number(val)),
|
|
162
|
+
z.number().min(0, "Hourly cap must be a positive number").optional()
|
|
163
|
+
),
|
|
164
|
+
threshold_count_per_day: z.number().min(1, "Threshold count per day must be at least 1").nullish(),
|
|
165
|
+
bid_floor: z.number().min(0, "Bid floor must be a positive number").nullish(),
|
|
166
|
+
net_cost: z.number().min(0, "Net cost must be a positive number").nullish(),
|
|
167
|
+
target_impressions: z.number().min(0, "Target impressions must be a positive number").nullish(),
|
|
168
|
+
imp_multiplier: z.number().min(0, "Impression multiplier must be a positive number").default(1.0).nullish(),
|
|
169
|
+
bid_floor_base: z.number().min(0, "Base bid floor must be a positive number").nullish(),
|
|
170
|
+
cpm_base: z.number().min(0, "Base CPM must be a positive number").nullish(),
|
|
171
|
+
estimated_cost_base: z.number().min(0, "Base estimated cost must be a positive number").nullish(),
|
|
172
|
+
}).refine((data) => {
|
|
173
|
+
return data.end_date > data.start_date;
|
|
174
|
+
}, {
|
|
175
|
+
message: "End date must be after start date",
|
|
176
|
+
path: ["end_date"],
|
|
177
|
+
}).refine((data) => {
|
|
178
|
+
if (data.goal_type === "SHARE_OF_VOICE" && data.target_value != null) {
|
|
179
|
+
return data.target_value >= 0 && data.target_value <= 100;
|
|
180
|
+
}
|
|
181
|
+
return true;
|
|
182
|
+
}, {
|
|
183
|
+
message: "Share of Voice must be between 0 and 100%",
|
|
184
|
+
path: ["target_value"],
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
type LineItemDetailsFormData = z.infer<typeof lineItemDetailsSchema>;
|
|
188
|
+
|
|
189
|
+
interface LineItemDetailsStepProps {
|
|
190
|
+
data?: any;
|
|
191
|
+
dealData?: any;
|
|
192
|
+
onComplete: (data: any) => void;
|
|
193
|
+
onBack?: () => void;
|
|
194
|
+
isLoading?: boolean;
|
|
195
|
+
formId?: string;
|
|
196
|
+
isPlannerRestricted?: boolean;
|
|
197
|
+
dealMode?: "DIRECT" | "PROGRAMMATIC";
|
|
198
|
+
dealType?: "GUARANTEED" | "PREFERRED_DEAL" | "PRIVATE_AUCTION" | "EVERGREEN_PMP" | "DIRECT";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
const GOAL_TYPE_OPTIONS = [
|
|
203
|
+
{ value: "IMPRESSIONS", label: "Impressions" },
|
|
204
|
+
{ value: "REACH", label: "Reach" },
|
|
205
|
+
{ value: "SHARE_OF_VOICE", label: "Share of Voice" },
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
const CREATIVE_TYPE_OPTIONS = [
|
|
209
|
+
{ value: "DISPLAY", label: "Display", description: "Static images and banners" },
|
|
210
|
+
{ value: "VIDEO", label: "Video", description: "Video content and animations" },
|
|
211
|
+
{ value: "AUDIO", label: "Audio", description: "Audio advertisements" },
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
const PACING_OPTIONS = [
|
|
216
|
+
{
|
|
217
|
+
value: "even",
|
|
218
|
+
label: "Even (Default)",
|
|
219
|
+
description: "Budget will be distributed evenly across the entire flight duration."
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
value: "asap",
|
|
223
|
+
label: "ASAP",
|
|
224
|
+
description: "The allocated budget will be fully used to achieve target quantity as soon as possible at the earliest of the flight date."
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
value: "front-loaded",
|
|
228
|
+
label: "Front-Loaded",
|
|
229
|
+
description: "Higher budget allocation at the start of the campaign, tapering off towards the end."
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
value: "back-loaded",
|
|
233
|
+
label: "Back-Loaded",
|
|
234
|
+
description: "Lower budget allocation at the start, increasing towards the end of the campaign."
|
|
235
|
+
},
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
const formatDateForInput = (dateString: string | null | undefined) => {
|
|
239
|
+
if (!dateString) return "";
|
|
240
|
+
return dateString.split('T')[0];
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export function LineItemDetailsStep({ data, dealData, onComplete, onBack, isLoading, formId = "line-item-details-form", isPlannerRestricted = false, dealMode = "DIRECT", dealType }: LineItemDetailsStepProps) {
|
|
244
|
+
const { t } = useTranslation('lineItems');
|
|
245
|
+
const defaultCurrency = dealData?.direct?.budgetSetup?.currency || dealData?.currency || "USD";
|
|
246
|
+
const isProgrammatic = dealMode === "PROGRAMMATIC";
|
|
247
|
+
const isGuaranteed = dealType === "GUARANTEED";
|
|
248
|
+
|
|
249
|
+
const {
|
|
250
|
+
register,
|
|
251
|
+
handleSubmit,
|
|
252
|
+
setValue,
|
|
253
|
+
watch,
|
|
254
|
+
formState: { errors },
|
|
255
|
+
reset,
|
|
256
|
+
} = useForm<LineItemDetailsFormData>({
|
|
257
|
+
resolver: zodResolver(lineItemDetailsSchema),
|
|
258
|
+
defaultValues: {
|
|
259
|
+
name: data?.name || "",
|
|
260
|
+
start_date: formatDateForInput(data?.startDate || data?.start_date || dealData?.start_date),
|
|
261
|
+
end_date: formatDateForInput(data?.endDate || data?.end_date || dealData?.end_date),
|
|
262
|
+
budget_amount: data?.direct?.budgetSetup?.budgetAmount || undefined,
|
|
263
|
+
currency: defaultCurrency,
|
|
264
|
+
creative_type: data?.creativeType || "VIDEO",
|
|
265
|
+
duration: data?.duration || 10,
|
|
266
|
+
goal_type: data?.direct?.campaignGoal?.type || "IMPRESSIONS",
|
|
267
|
+
target_value: data?.direct?.campaignGoal?.targetValue || undefined,
|
|
268
|
+
daily_budget_cap: data?.netCostPerDay || undefined,
|
|
269
|
+
impressions: data?.impressions || undefined,
|
|
270
|
+
pacing_type: (data?.direct?.pacing?.type || "even").toLowerCase(),
|
|
271
|
+
pacing_daily_cap: data?.direct?.pacing?.dailyCap || undefined,
|
|
272
|
+
pacing_hourly_cap: data?.direct?.pacing?.hourlyCap || undefined,
|
|
273
|
+
threshold_count_per_day: data?.thresholdCountPerDay || undefined,
|
|
274
|
+
bid_floor: data?.programmatic?.bidFloor || undefined,
|
|
275
|
+
net_cost: data?.programmatic?.netCost || undefined,
|
|
276
|
+
target_impressions: data?.programmatic?.impressions || undefined,
|
|
277
|
+
imp_multiplier: data?.programmatic?.impMultiplier ?? 1.0,
|
|
278
|
+
bid_floor_base: data?.programmatic?.bidFloorBase || undefined,
|
|
279
|
+
cpm_base: data?.pricing?.cpmBase || undefined,
|
|
280
|
+
estimated_cost_base: data?.pricing?.estimatedCostBase || undefined,
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const currency = watch("currency");
|
|
285
|
+
const creativeType = watch("creative_type");
|
|
286
|
+
const goalType = watch("goal_type");
|
|
287
|
+
const pacingType = watch("pacing_type");
|
|
288
|
+
const targetValue = watch("target_value");
|
|
289
|
+
|
|
290
|
+
// For Planner restricted mode: allow editing budget_amount and target_value if they were originally null/empty/0
|
|
291
|
+
const initialBudgetWasEmpty = useMemo(() => {
|
|
292
|
+
const initialValue = data?.direct?.budgetSetup?.budgetAmount;
|
|
293
|
+
return initialValue === null || initialValue === undefined || initialValue === 0;
|
|
294
|
+
}, [data]);
|
|
295
|
+
|
|
296
|
+
const initialTargetValueWasEmpty = useMemo(() => {
|
|
297
|
+
const initialValue = data?.direct?.campaignGoal?.targetValue;
|
|
298
|
+
return initialValue === null || initialValue === undefined || initialValue === 0;
|
|
299
|
+
}, [data]);
|
|
300
|
+
|
|
301
|
+
// Determine if these specific fields should be disabled (for Planner restricted mode exceptions)
|
|
302
|
+
const isBudgetAmountDisabled = isPlannerRestricted && !initialBudgetWasEmpty;
|
|
303
|
+
const isTargetValueDisabled = isPlannerRestricted && !initialTargetValueWasEmpty;
|
|
304
|
+
|
|
305
|
+
const [dateRange, setDateRange] = useState<{ from: Date | null; to: Date | null }>({ from: null, to: null });
|
|
306
|
+
|
|
307
|
+
// Calculate flight duration in days from selected date range
|
|
308
|
+
const flightDays = useMemo(() => {
|
|
309
|
+
if (dateRange.from && dateRange.to) {
|
|
310
|
+
const diffTime = Math.abs(dateRange.to.getTime() - dateRange.from.getTime());
|
|
311
|
+
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both start and end dates
|
|
312
|
+
return Math.max(1, diffDays);
|
|
313
|
+
}
|
|
314
|
+
return 30; // Default to 30 days if no date range selected
|
|
315
|
+
}, [dateRange.from, dateRange.to]);
|
|
316
|
+
|
|
317
|
+
const [previousGoalType, setPreviousGoalType] = useState(goalType);
|
|
318
|
+
|
|
319
|
+
useEffect(() => {
|
|
320
|
+
if (goalType !== previousGoalType) {
|
|
321
|
+
setValue("target_value", undefined, { shouldValidate: false });
|
|
322
|
+
setPreviousGoalType(goalType);
|
|
323
|
+
}
|
|
324
|
+
}, [goalType, previousGoalType, setValue]);
|
|
325
|
+
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
if (goalType === "SHARE_OF_VOICE" && targetValue != null && targetValue > 100) {
|
|
328
|
+
setValue("target_value", 100, { shouldValidate: true });
|
|
329
|
+
}
|
|
330
|
+
}, [goalType, targetValue, setValue]);
|
|
331
|
+
|
|
332
|
+
useEffect(() => {
|
|
333
|
+
const startDate = watch("start_date");
|
|
334
|
+
const endDate = watch("end_date");
|
|
335
|
+
if (startDate && endDate) {
|
|
336
|
+
try {
|
|
337
|
+
setDateRange({
|
|
338
|
+
from: fromAPIDateString(startDate),
|
|
339
|
+
to: fromAPIDateString(endDate),
|
|
340
|
+
});
|
|
341
|
+
} catch (e) {
|
|
342
|
+
console.error("Error parsing dates:", e);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}, []);
|
|
346
|
+
|
|
347
|
+
useEffect(() => {
|
|
348
|
+
if (data && Object.keys(data).length > 0) {
|
|
349
|
+
const pacingValue = (data?.direct?.pacing?.type || "even").toLowerCase();
|
|
350
|
+
console.log('📋 LineItemDetailsStep received data:', data);
|
|
351
|
+
console.log('📋 Pacing value to set:', pacingValue, 'from:', data?.direct?.pacing);
|
|
352
|
+
reset({
|
|
353
|
+
name: data.name || "",
|
|
354
|
+
start_date: formatDateForInput(data.startDate || data.start_date || dealData?.start_date),
|
|
355
|
+
end_date: formatDateForInput(data.endDate || data.end_date || dealData?.end_date),
|
|
356
|
+
budget_amount: data?.direct?.budgetSetup?.budgetAmount || undefined,
|
|
357
|
+
currency: defaultCurrency,
|
|
358
|
+
creative_type: data?.creativeType || "VIDEO",
|
|
359
|
+
duration: data?.duration || 10,
|
|
360
|
+
goal_type: data?.direct?.campaignGoal?.type || "IMPRESSIONS",
|
|
361
|
+
target_value: data?.direct?.campaignGoal?.targetValue || undefined,
|
|
362
|
+
daily_budget_cap: data?.netCostPerDay || undefined,
|
|
363
|
+
impressions: data?.impressions || undefined,
|
|
364
|
+
pacing_type: pacingValue,
|
|
365
|
+
pacing_daily_cap: data?.direct?.pacing?.dailyCap || undefined,
|
|
366
|
+
pacing_hourly_cap: data?.direct?.pacing?.hourlyCap || undefined,
|
|
367
|
+
threshold_count_per_day: data?.thresholdCountPerDay || undefined,
|
|
368
|
+
bid_floor: data?.programmatic?.bidFloor || undefined,
|
|
369
|
+
net_cost: data?.programmatic?.netCost || undefined,
|
|
370
|
+
target_impressions: data?.programmatic?.impressions || undefined,
|
|
371
|
+
imp_multiplier: data?.programmatic?.impMultiplier ?? 1.0,
|
|
372
|
+
bid_floor_base: data?.programmatic?.bidFloorBase || undefined,
|
|
373
|
+
cpm_base: data?.pricing?.cpmBase || undefined,
|
|
374
|
+
estimated_cost_base: data?.pricing?.estimatedCostBase || undefined,
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
const startDate = data.startDate || data.start_date || dealData?.start_date;
|
|
378
|
+
const endDate = data.endDate || data.end_date || dealData?.end_date;
|
|
379
|
+
if (startDate && endDate) {
|
|
380
|
+
try {
|
|
381
|
+
setDateRange({
|
|
382
|
+
from: fromAPIDateString(formatDateForInput(startDate)),
|
|
383
|
+
to: fromAPIDateString(formatDateForInput(endDate)),
|
|
384
|
+
});
|
|
385
|
+
} catch (e) {
|
|
386
|
+
console.error("Error parsing dates:", e);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}, [data, dealData, reset, defaultCurrency]);
|
|
391
|
+
|
|
392
|
+
const handleDateRangeChange = (value: { from: Date | null; to: Date | null }) => {
|
|
393
|
+
setDateRange(value);
|
|
394
|
+
if (value.from && value.to) {
|
|
395
|
+
setValue("start_date", toAPIDateString(value.from), { shouldValidate: true });
|
|
396
|
+
setValue("end_date", toAPIDateString(value.to), { shouldValidate: true });
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
const onSubmit = (values: LineItemDetailsFormData) => {
|
|
401
|
+
const pacing: any = {
|
|
402
|
+
type: values.pacing_type,
|
|
403
|
+
};
|
|
404
|
+
if (values.pacing_daily_cap) {
|
|
405
|
+
pacing.dailyCap = values.pacing_daily_cap;
|
|
406
|
+
}
|
|
407
|
+
if (values.pacing_hourly_cap) {
|
|
408
|
+
pacing.hourlyCap = values.pacing_hourly_cap;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const apiPayload: any = {
|
|
412
|
+
name: values.name,
|
|
413
|
+
startDate: values.start_date,
|
|
414
|
+
endDate: values.end_date,
|
|
415
|
+
currency: values.currency,
|
|
416
|
+
creativeType: values.creative_type,
|
|
417
|
+
duration: values.duration || 10,
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
if (isProgrammatic) {
|
|
421
|
+
apiPayload.programmatic = {
|
|
422
|
+
bidFloor: values.bid_floor || undefined,
|
|
423
|
+
bidFloorBase: values.bid_floor_base || undefined,
|
|
424
|
+
netCost: values.net_cost || undefined,
|
|
425
|
+
impressions: values.target_impressions || undefined,
|
|
426
|
+
impMultiplier: values.imp_multiplier ?? 1.0,
|
|
427
|
+
};
|
|
428
|
+
if (isGuaranteed && values.threshold_count_per_day) {
|
|
429
|
+
apiPayload.thresholdCountPerDay = values.threshold_count_per_day;
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
apiPayload.pricing = {
|
|
433
|
+
cpmBase: values.cpm_base || undefined,
|
|
434
|
+
estimatedCostBase: values.estimated_cost_base || undefined,
|
|
435
|
+
};
|
|
436
|
+
apiPayload.impressions = values.impressions || undefined;
|
|
437
|
+
apiPayload.netCostPerDay = values.daily_budget_cap || undefined;
|
|
438
|
+
apiPayload.direct = {
|
|
439
|
+
budgetSetup: {
|
|
440
|
+
budgetType: "TOTAL",
|
|
441
|
+
budgetAmount: values.budget_amount,
|
|
442
|
+
currency: values.currency,
|
|
443
|
+
},
|
|
444
|
+
campaignGoal: {
|
|
445
|
+
type: values.goal_type,
|
|
446
|
+
targetValue: values.target_value || 0,
|
|
447
|
+
},
|
|
448
|
+
pacing,
|
|
449
|
+
};
|
|
450
|
+
if (isGuaranteed && values.threshold_count_per_day) {
|
|
451
|
+
apiPayload.thresholdCountPerDay = values.threshold_count_per_day;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
console.log('✅ Line Item Details submitted:', apiPayload);
|
|
456
|
+
onComplete(apiPayload);
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
const dateError = errors.start_date?.message || errors.end_date?.message;
|
|
460
|
+
|
|
461
|
+
return (
|
|
462
|
+
<div className="flex flex-col h-full">
|
|
463
|
+
{/* Main Content Area */}
|
|
464
|
+
<div className="flex-1 flex gap-6">
|
|
465
|
+
<div className="flex-1 min-w-0">
|
|
466
|
+
<form id={formId} onSubmit={handleSubmit(onSubmit)} className="space-y-6">
|
|
467
|
+
{isPlannerRestricted && (
|
|
468
|
+
<div className="mb-4 p-3 bg-purple-50 border border-purple-200 rounded-lg">
|
|
469
|
+
<p className="text-sm text-purple-700 font-medium">{t('wizard.details.restrictedEditMode')}</p>
|
|
470
|
+
<p className="text-xs text-purple-600">{t('wizard.details.restrictedEditModeDesc')}{(initialBudgetWasEmpty || initialTargetValueWasEmpty) && ` ${t('wizard.details.restrictedEditModeWithBudget')}`}</p>
|
|
471
|
+
</div>
|
|
472
|
+
)}
|
|
473
|
+
|
|
474
|
+
<div className="flex items-start gap-3 pb-4 border-b border-mw-neutral-100 dark:border-mw-neutral-800">
|
|
475
|
+
<div className="h-10 w-10 rounded-lg bg-mw-primary-50 dark:bg-mw-primary-900/20 flex items-center justify-center flex-shrink-0">
|
|
476
|
+
<FileText className="h-5 w-5 text-mw-primary-500 dark:text-mw-primary-400" />
|
|
477
|
+
</div>
|
|
478
|
+
<div>
|
|
479
|
+
<h2 className="text-sm font-medium text-mw-neutral-900 dark:text-white">{t('deals:wizard.details.title')}</h2>
|
|
480
|
+
<p className="text-xs text-mw-neutral-500 dark:text-mw-neutral-400">{t('deals:wizard.details.subtitle')}</p>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
|
|
484
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
485
|
+
<FormItem>
|
|
486
|
+
<FormLabel required>{t('deals:wizard.details.lineItemName')}</FormLabel>
|
|
487
|
+
<FormControl>
|
|
488
|
+
<Input
|
|
489
|
+
placeholder={t('deals:wizard.details.enterLineItemName')}
|
|
490
|
+
maxLength={200}
|
|
491
|
+
{...register("name")}
|
|
492
|
+
className={cn("border-mw-neutral-200 dark:border-mw-neutral-700", isPlannerRestricted && "bg-mw-neutral-100 cursor-not-allowed")}
|
|
493
|
+
disabled={isPlannerRestricted}
|
|
494
|
+
/>
|
|
495
|
+
</FormControl>
|
|
496
|
+
{errors.name && <FormMessage>{errors.name.message}</FormMessage>}
|
|
497
|
+
</FormItem>
|
|
498
|
+
|
|
499
|
+
<FormItem>
|
|
500
|
+
<FormLabel required>{t('deals:wizard.details.flightDates')}</FormLabel>
|
|
501
|
+
<DateRangePicker
|
|
502
|
+
value={dateRange}
|
|
503
|
+
onChange={handleDateRangeChange}
|
|
504
|
+
placeholder={t('deals:wizard.details.selectFlightDates')}
|
|
505
|
+
minDate={getTodayDate()}
|
|
506
|
+
format="dd/MM/yyyy"
|
|
507
|
+
numberOfMonths={2}
|
|
508
|
+
disabled={isPlannerRestricted}
|
|
509
|
+
/>
|
|
510
|
+
{dateError && <FormMessage>{dateError}</FormMessage>}
|
|
511
|
+
</FormItem>
|
|
512
|
+
</div>
|
|
513
|
+
|
|
514
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
515
|
+
<FormItem>
|
|
516
|
+
<FormLabel required>{t('deals:wizard.details.creativeType')}</FormLabel>
|
|
517
|
+
<input type="hidden" {...register("creative_type")} />
|
|
518
|
+
<SelectRoot value={creativeType} onValueChange={(value) => setValue("creative_type", value as "DISPLAY" | "VIDEO" | "AUDIO", { shouldValidate: true, shouldDirty: true })} disabled={isPlannerRestricted}>
|
|
519
|
+
<SelectTrigger className={cn("border-mw-neutral-200 dark:border-mw-neutral-700", isPlannerRestricted && "bg-mw-neutral-100 cursor-not-allowed")}>
|
|
520
|
+
<SelectValue placeholder={t('deals:wizard.details.selectCreativeType')} />
|
|
521
|
+
</SelectTrigger>
|
|
522
|
+
<SelectContent>
|
|
523
|
+
{CREATIVE_TYPE_OPTIONS.map((option) => (
|
|
524
|
+
<SelectItem key={option.value} value={option.value}>
|
|
525
|
+
{option.label}
|
|
526
|
+
</SelectItem>
|
|
527
|
+
))}
|
|
528
|
+
</SelectContent>
|
|
529
|
+
</SelectRoot>
|
|
530
|
+
<p className="text-xs text-mw-neutral-500">
|
|
531
|
+
{CREATIVE_TYPE_OPTIONS.find(c => c.value === creativeType)?.description}
|
|
532
|
+
</p>
|
|
533
|
+
{errors.creative_type && <FormMessage>{errors.creative_type.message}</FormMessage>}
|
|
534
|
+
</FormItem>
|
|
535
|
+
|
|
536
|
+
<FormItem>
|
|
537
|
+
<FormLabel>{t('deals:wizard.details.creativeDuration')}</FormLabel>
|
|
538
|
+
<FormControl>
|
|
539
|
+
<Input
|
|
540
|
+
type="number"
|
|
541
|
+
placeholder={t('deals:wizard.details.durationPlaceholder')}
|
|
542
|
+
min={1}
|
|
543
|
+
max={300}
|
|
544
|
+
{...register("duration", { valueAsNumber: true })}
|
|
545
|
+
className={cn("border-mw-neutral-200 dark:border-mw-neutral-700", isPlannerRestricted && "bg-mw-neutral-100 cursor-not-allowed")}
|
|
546
|
+
disabled={isPlannerRestricted}
|
|
547
|
+
/>
|
|
548
|
+
</FormControl>
|
|
549
|
+
<p className="text-xs text-mw-neutral-500">{t('deals:wizard.details.durationOfPlayback')}</p>
|
|
550
|
+
{errors.duration && <FormMessage>{errors.duration.message}</FormMessage>}
|
|
551
|
+
</FormItem>
|
|
552
|
+
|
|
553
|
+
{!isProgrammatic && (
|
|
554
|
+
<FormItem>
|
|
555
|
+
<FormLabel required>{t('deals:wizard.details.budgetAmount')} ({currency})</FormLabel>
|
|
556
|
+
<FormControl>
|
|
557
|
+
<div className="relative">
|
|
558
|
+
<span className="absolute left-3 top-1/2 -translate-y-1/2 text-sm font-medium text-mw-neutral-500">{currency}</span>
|
|
559
|
+
<Input
|
|
560
|
+
type="number"
|
|
561
|
+
min={0}
|
|
562
|
+
placeholder={t('deals:wizard.details.enterAmount')}
|
|
563
|
+
{...register("budget_amount", { valueAsNumber: true })}
|
|
564
|
+
className={cn("pl-14 border-mw-neutral-200 dark:border-mw-neutral-700", isBudgetAmountDisabled && "bg-mw-neutral-100 cursor-not-allowed")}
|
|
565
|
+
disabled={isBudgetAmountDisabled}
|
|
566
|
+
/>
|
|
567
|
+
</div>
|
|
568
|
+
</FormControl>
|
|
569
|
+
<p className="text-xs text-mw-neutral-500">{t('deals:wizard.details.currencyInherited')}</p>
|
|
570
|
+
{isPlannerRestricted && initialBudgetWasEmpty && (
|
|
571
|
+
<p className="text-xs text-orange-600 flex items-center gap-1">
|
|
572
|
+
<span className="inline-block w-1.5 h-1.5 bg-orange-500 rounded-full"></span>
|
|
573
|
+
Expected number, received nan
|
|
574
|
+
</p>
|
|
575
|
+
)}
|
|
576
|
+
{errors.budget_amount && <FormMessage>{errors.budget_amount.message}</FormMessage>}
|
|
577
|
+
</FormItem>
|
|
578
|
+
)}
|
|
579
|
+
</div>
|
|
580
|
+
|
|
581
|
+
{isProgrammatic ? (
|
|
582
|
+
<>
|
|
583
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
584
|
+
<FormItem>
|
|
585
|
+
<FormLabel>Bid Floor ({currency})</FormLabel>
|
|
586
|
+
<FormControl>
|
|
587
|
+
<div className="relative">
|
|
588
|
+
<DollarSign className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mw-neutral-400" />
|
|
589
|
+
<Input
|
|
590
|
+
type="number"
|
|
591
|
+
min={0}
|
|
592
|
+
step="0.01"
|
|
593
|
+
placeholder="Enter bid floor"
|
|
594
|
+
{...register("bid_floor", { valueAsNumber: true })}
|
|
595
|
+
className="pl-9 border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
596
|
+
disabled={isPlannerRestricted}
|
|
597
|
+
/>
|
|
598
|
+
</div>
|
|
599
|
+
</FormControl>
|
|
600
|
+
<p className="text-xs text-mw-neutral-500">Minimum CPM bid for programmatic auctions</p>
|
|
601
|
+
{errors.bid_floor && <FormMessage>{errors.bid_floor.message}</FormMessage>}
|
|
602
|
+
</FormItem>
|
|
603
|
+
|
|
604
|
+
<FormItem>
|
|
605
|
+
<FormLabel>Base Bid Floor ({currency})</FormLabel>
|
|
606
|
+
<FormControl>
|
|
607
|
+
<div className="relative">
|
|
608
|
+
<DollarSign className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mw-neutral-400" />
|
|
609
|
+
<Input
|
|
610
|
+
type="number"
|
|
611
|
+
min={0}
|
|
612
|
+
step="0.01"
|
|
613
|
+
placeholder="Enter base bid floor"
|
|
614
|
+
{...register("bid_floor_base", { valueAsNumber: true })}
|
|
615
|
+
className="pl-9 border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
616
|
+
disabled={isPlannerRestricted}
|
|
617
|
+
/>
|
|
618
|
+
</div>
|
|
619
|
+
</FormControl>
|
|
620
|
+
<p className="text-xs text-mw-neutral-500">Original bid floor before custom fees</p>
|
|
621
|
+
{errors.bid_floor_base && <FormMessage>{errors.bid_floor_base.message}</FormMessage>}
|
|
622
|
+
</FormItem>
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
626
|
+
<FormItem>
|
|
627
|
+
<FormLabel>Net Cost ({currency})</FormLabel>
|
|
628
|
+
<FormControl>
|
|
629
|
+
<div className="relative">
|
|
630
|
+
<DollarSign className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mw-neutral-400" />
|
|
631
|
+
<Input
|
|
632
|
+
type="number"
|
|
633
|
+
min={0}
|
|
634
|
+
step="0.01"
|
|
635
|
+
placeholder="Enter net cost"
|
|
636
|
+
{...register("net_cost", { valueAsNumber: true })}
|
|
637
|
+
className="pl-9 border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
638
|
+
disabled={isPlannerRestricted}
|
|
639
|
+
/>
|
|
640
|
+
</div>
|
|
641
|
+
</FormControl>
|
|
642
|
+
<p className="text-xs text-mw-neutral-500">Total net cost for the line item</p>
|
|
643
|
+
{errors.net_cost && <FormMessage>{errors.net_cost.message}</FormMessage>}
|
|
644
|
+
</FormItem>
|
|
645
|
+
</div>
|
|
646
|
+
|
|
647
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
648
|
+
<FormItem>
|
|
649
|
+
<FormLabel>Target Impressions</FormLabel>
|
|
650
|
+
<FormControl>
|
|
651
|
+
<div className="relative">
|
|
652
|
+
<Target className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mw-neutral-400" />
|
|
653
|
+
<Input
|
|
654
|
+
type="number"
|
|
655
|
+
min={0}
|
|
656
|
+
placeholder="Enter target impressions"
|
|
657
|
+
{...register("target_impressions", { valueAsNumber: true })}
|
|
658
|
+
className="pl-9 border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
659
|
+
disabled={isPlannerRestricted}
|
|
660
|
+
/>
|
|
661
|
+
</div>
|
|
662
|
+
</FormControl>
|
|
663
|
+
<p className="text-xs text-mw-neutral-500">Number of impressions to deliver</p>
|
|
664
|
+
{errors.target_impressions && <FormMessage>{errors.target_impressions.message}</FormMessage>}
|
|
665
|
+
</FormItem>
|
|
666
|
+
|
|
667
|
+
<FormItem>
|
|
668
|
+
<FormLabel>Impression Multiplier</FormLabel>
|
|
669
|
+
<FormControl>
|
|
670
|
+
<Input
|
|
671
|
+
type="number"
|
|
672
|
+
step="0.1"
|
|
673
|
+
min="0"
|
|
674
|
+
placeholder="1.0"
|
|
675
|
+
{...register("imp_multiplier", { valueAsNumber: true })}
|
|
676
|
+
className="border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
677
|
+
disabled={isPlannerRestricted}
|
|
678
|
+
/>
|
|
679
|
+
</FormControl>
|
|
680
|
+
<p className="text-xs text-mw-neutral-500">Multiplier applied to impression counts (default: 1.0)</p>
|
|
681
|
+
{errors.imp_multiplier && <FormMessage>{errors.imp_multiplier.message}</FormMessage>}
|
|
682
|
+
</FormItem>
|
|
683
|
+
</div>
|
|
684
|
+
</>
|
|
685
|
+
) : (
|
|
686
|
+
<>
|
|
687
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
688
|
+
<FormItem>
|
|
689
|
+
<FormLabel>Base CPM ({currency})</FormLabel>
|
|
690
|
+
<FormControl>
|
|
691
|
+
<div className="relative">
|
|
692
|
+
<DollarSign className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mw-neutral-400" />
|
|
693
|
+
<Input
|
|
694
|
+
type="number"
|
|
695
|
+
min={0}
|
|
696
|
+
step="0.01"
|
|
697
|
+
placeholder="Enter base CPM"
|
|
698
|
+
{...register("cpm_base", { valueAsNumber: true })}
|
|
699
|
+
className="pl-9 border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
700
|
+
disabled={isPlannerRestricted}
|
|
701
|
+
/>
|
|
702
|
+
</div>
|
|
703
|
+
</FormControl>
|
|
704
|
+
<p className="text-xs text-mw-neutral-500">Original CPM before custom fees</p>
|
|
705
|
+
{errors.cpm_base && <FormMessage>{errors.cpm_base.message}</FormMessage>}
|
|
706
|
+
</FormItem>
|
|
707
|
+
|
|
708
|
+
<FormItem>
|
|
709
|
+
<FormLabel>Base Estimated Cost ({currency})</FormLabel>
|
|
710
|
+
<FormControl>
|
|
711
|
+
<div className="relative">
|
|
712
|
+
<DollarSign className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mw-neutral-400" />
|
|
713
|
+
<Input
|
|
714
|
+
type="number"
|
|
715
|
+
min={0}
|
|
716
|
+
step="0.01"
|
|
717
|
+
placeholder="Enter base estimated cost"
|
|
718
|
+
{...register("estimated_cost_base", { valueAsNumber: true })}
|
|
719
|
+
className="pl-9 border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
720
|
+
disabled={isPlannerRestricted}
|
|
721
|
+
/>
|
|
722
|
+
</div>
|
|
723
|
+
</FormControl>
|
|
724
|
+
<p className="text-xs text-mw-neutral-500">Original estimated cost before custom fees</p>
|
|
725
|
+
{errors.estimated_cost_base && <FormMessage>{errors.estimated_cost_base.message}</FormMessage>}
|
|
726
|
+
</FormItem>
|
|
727
|
+
</div>
|
|
728
|
+
|
|
729
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
730
|
+
<FormItem>
|
|
731
|
+
<FormLabel required>{t('deals:wizard.details.goalType')}</FormLabel>
|
|
732
|
+
<SelectRoot value={goalType} onValueChange={(value) => setValue("goal_type", value as "IMPRESSIONS" | "REACH" | "SHARE_OF_VOICE")} disabled={isPlannerRestricted}>
|
|
733
|
+
<SelectTrigger className={cn("border-mw-neutral-200 dark:border-mw-neutral-700", isPlannerRestricted && "bg-mw-neutral-100 cursor-not-allowed")}>
|
|
734
|
+
<SelectValue placeholder={t('deals:wizard.details.selectGoalType')} />
|
|
735
|
+
</SelectTrigger>
|
|
736
|
+
<SelectContent>
|
|
737
|
+
{GOAL_TYPE_OPTIONS.map((option) => (
|
|
738
|
+
<SelectItem key={option.value} value={option.value}>
|
|
739
|
+
{option.label}
|
|
740
|
+
</SelectItem>
|
|
741
|
+
))}
|
|
742
|
+
</SelectContent>
|
|
743
|
+
</SelectRoot>
|
|
744
|
+
{errors.goal_type && <FormMessage>{errors.goal_type.message}</FormMessage>}
|
|
745
|
+
</FormItem>
|
|
746
|
+
|
|
747
|
+
<FormItem>
|
|
748
|
+
<FormLabel required>{t('deals:wizard.details.targetValue')}</FormLabel>
|
|
749
|
+
<FormControl>
|
|
750
|
+
<div className="relative">
|
|
751
|
+
{goalType === "SHARE_OF_VOICE" ? (
|
|
752
|
+
<span className="absolute left-3 top-1/2 -translate-y-1/2 text-sm text-mw-neutral-400">%</span>
|
|
753
|
+
) : (
|
|
754
|
+
<Target className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mw-neutral-400" />
|
|
755
|
+
)}
|
|
756
|
+
<Input
|
|
757
|
+
type="number"
|
|
758
|
+
placeholder={
|
|
759
|
+
goalType === "SHARE_OF_VOICE"
|
|
760
|
+
? t('deals:wizard.details.enterPercentage')
|
|
761
|
+
: goalType === "IMPRESSIONS"
|
|
762
|
+
? t('deals:wizard.details.enterImpressions')
|
|
763
|
+
: t('deals:wizard.details.enterUsers')
|
|
764
|
+
}
|
|
765
|
+
min={0}
|
|
766
|
+
max={goalType === "SHARE_OF_VOICE" ? 100 : undefined}
|
|
767
|
+
{...register("target_value", { valueAsNumber: true })}
|
|
768
|
+
className={cn("pl-9 border-mw-neutral-200 dark:border-mw-neutral-700", isTargetValueDisabled && "bg-mw-neutral-100 cursor-not-allowed")}
|
|
769
|
+
disabled={isTargetValueDisabled}
|
|
770
|
+
/>
|
|
771
|
+
</div>
|
|
772
|
+
</FormControl>
|
|
773
|
+
<p className="text-xs text-mw-neutral-500">
|
|
774
|
+
{goalType === "IMPRESSIONS" && t('deals:wizard.details.impressionsDesc')}
|
|
775
|
+
{goalType === "REACH" && t('deals:wizard.details.reachDesc')}
|
|
776
|
+
{goalType === "SHARE_OF_VOICE" && t('deals:wizard.details.sovDesc')}
|
|
777
|
+
</p>
|
|
778
|
+
{isPlannerRestricted && initialTargetValueWasEmpty && (
|
|
779
|
+
<p className="text-xs text-orange-600 flex items-center gap-1">
|
|
780
|
+
<span className="inline-block w-1.5 h-1.5 bg-orange-500 rounded-full"></span>
|
|
781
|
+
Expected number, received nan
|
|
782
|
+
</p>
|
|
783
|
+
)}
|
|
784
|
+
{errors.target_value && <FormMessage>{errors.target_value.message}</FormMessage>}
|
|
785
|
+
</FormItem>
|
|
786
|
+
</div>
|
|
787
|
+
|
|
788
|
+
<FormItem>
|
|
789
|
+
<FormLabel>{t('deals:wizard.details.pacing')}</FormLabel>
|
|
790
|
+
<SelectRoot value={pacingType || "even"} onValueChange={(value) => setValue("pacing_type", value as "asap" | "even" | "front-loaded" | "back-loaded")}>
|
|
791
|
+
<SelectTrigger className="border-mw-neutral-200 dark:border-mw-neutral-700">
|
|
792
|
+
<SelectValue placeholder={t('deals:wizard.details.selectPacing')} />
|
|
793
|
+
</SelectTrigger>
|
|
794
|
+
<SelectContent>
|
|
795
|
+
{PACING_OPTIONS.map((option) => (
|
|
796
|
+
<SelectItem key={option.value} value={option.value}>
|
|
797
|
+
{option.label}
|
|
798
|
+
</SelectItem>
|
|
799
|
+
))}
|
|
800
|
+
</SelectContent>
|
|
801
|
+
</SelectRoot>
|
|
802
|
+
<p className="text-xs text-mw-neutral-500 flex items-start gap-1.5 mt-1">
|
|
803
|
+
<span className="inline-block w-3.5 h-3.5 rounded-full border border-mw-neutral-300 flex-shrink-0 mt-0.5 flex items-center justify-center text-[10px] text-mw-neutral-400">i</span>
|
|
804
|
+
<span>{PACING_OPTIONS.find(p => p.value === (pacingType || "even"))?.description}</span>
|
|
805
|
+
</p>
|
|
806
|
+
{errors.pacing_type && <FormMessage>{errors.pacing_type.message}</FormMessage>}
|
|
807
|
+
</FormItem>
|
|
808
|
+
|
|
809
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
810
|
+
<FormItem>
|
|
811
|
+
<FormLabel>
|
|
812
|
+
{goalType === "IMPRESSIONS" && "Daily Impression Cap"}
|
|
813
|
+
{goalType === "REACH" && "Daily Reach Cap"}
|
|
814
|
+
{goalType === "SHARE_OF_VOICE" && "Daily SOV Cap"}
|
|
815
|
+
{!goalType && "Daily Cap"}
|
|
816
|
+
</FormLabel>
|
|
817
|
+
<FormControl>
|
|
818
|
+
<Input
|
|
819
|
+
type="number"
|
|
820
|
+
min={0}
|
|
821
|
+
placeholder={t('deals:wizard.details.optionalDailyLimit')}
|
|
822
|
+
{...register("pacing_daily_cap", { valueAsNumber: true })}
|
|
823
|
+
className="border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
824
|
+
/>
|
|
825
|
+
</FormControl>
|
|
826
|
+
<p className="text-xs text-mw-neutral-500">
|
|
827
|
+
{goalType === "IMPRESSIONS" && "Maximum impressions per day"}
|
|
828
|
+
{goalType === "REACH" && "Maximum reach per day"}
|
|
829
|
+
{goalType === "SHARE_OF_VOICE" && "Maximum SOV per day"}
|
|
830
|
+
{!goalType && "Maximum per day"}
|
|
831
|
+
</p>
|
|
832
|
+
{errors.pacing_daily_cap && <FormMessage>{errors.pacing_daily_cap.message}</FormMessage>}
|
|
833
|
+
</FormItem>
|
|
834
|
+
|
|
835
|
+
<FormItem>
|
|
836
|
+
<FormLabel>
|
|
837
|
+
{goalType === "IMPRESSIONS" && "Hourly Impression Cap"}
|
|
838
|
+
{goalType === "REACH" && "Hourly Reach Cap"}
|
|
839
|
+
{goalType === "SHARE_OF_VOICE" && "Hourly SOV Cap"}
|
|
840
|
+
{!goalType && "Hourly Cap"}
|
|
841
|
+
</FormLabel>
|
|
842
|
+
<FormControl>
|
|
843
|
+
<Input
|
|
844
|
+
type="number"
|
|
845
|
+
min={0}
|
|
846
|
+
placeholder="Optional hourly limit"
|
|
847
|
+
{...register("pacing_hourly_cap", { valueAsNumber: true })}
|
|
848
|
+
className="border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
849
|
+
/>
|
|
850
|
+
</FormControl>
|
|
851
|
+
<p className="text-xs text-mw-neutral-500">
|
|
852
|
+
{goalType === "IMPRESSIONS" && "Maximum impressions per hour"}
|
|
853
|
+
{goalType === "REACH" && "Maximum reach per hour"}
|
|
854
|
+
{goalType === "SHARE_OF_VOICE" && "Maximum SOV per hour"}
|
|
855
|
+
{!goalType && "Maximum per hour"}
|
|
856
|
+
</p>
|
|
857
|
+
{errors.pacing_hourly_cap && <FormMessage>{errors.pacing_hourly_cap.message}</FormMessage>}
|
|
858
|
+
</FormItem>
|
|
859
|
+
</div>
|
|
860
|
+
|
|
861
|
+
<PacingDeliveryGraph pacingType={pacingType} days={flightDays} />
|
|
862
|
+
</>
|
|
863
|
+
)}
|
|
864
|
+
|
|
865
|
+
{isGuaranteed && (
|
|
866
|
+
<div className="space-y-4">
|
|
867
|
+
<div className="flex items-start gap-3 pb-4 border-b border-mw-neutral-100 dark:border-mw-neutral-800">
|
|
868
|
+
<div className="h-10 w-10 rounded-lg bg-mw-green-50 dark:bg-mw-green-900/20 flex items-center justify-center flex-shrink-0">
|
|
869
|
+
<Target className="h-5 w-5 text-mw-green-500 dark:text-mw-green-400" />
|
|
870
|
+
</div>
|
|
871
|
+
<div>
|
|
872
|
+
<h2 className="text-sm font-medium text-mw-neutral-900 dark:text-white">Guaranteed Delivery Settings</h2>
|
|
873
|
+
<p className="text-xs text-mw-neutral-500 dark:text-mw-neutral-400">Configure guaranteed impression delivery thresholds</p>
|
|
874
|
+
</div>
|
|
875
|
+
</div>
|
|
876
|
+
|
|
877
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
878
|
+
<FormItem>
|
|
879
|
+
<FormLabel required>Threshold Count Per Day</FormLabel>
|
|
880
|
+
<FormControl>
|
|
881
|
+
<Input
|
|
882
|
+
type="number"
|
|
883
|
+
min={1}
|
|
884
|
+
placeholder="Enter daily threshold count"
|
|
885
|
+
{...register("threshold_count_per_day", { valueAsNumber: true })}
|
|
886
|
+
className="border-mw-neutral-200 dark:border-mw-neutral-700"
|
|
887
|
+
/>
|
|
888
|
+
</FormControl>
|
|
889
|
+
<p className="text-xs text-mw-neutral-500">
|
|
890
|
+
Minimum number of impressions to be delivered per day for guaranteed deals
|
|
891
|
+
</p>
|
|
892
|
+
{errors.threshold_count_per_day && <FormMessage>{errors.threshold_count_per_day.message}</FormMessage>}
|
|
893
|
+
</FormItem>
|
|
894
|
+
</div>
|
|
895
|
+
</div>
|
|
896
|
+
)}
|
|
897
|
+
|
|
898
|
+
</form>
|
|
899
|
+
</div>
|
|
900
|
+
|
|
901
|
+
<FormInsights
|
|
902
|
+
insights={[
|
|
903
|
+
{ text: "Line item name should be descriptive for easy identification", color: "green" },
|
|
904
|
+
{ text: "Set realistic campaign dates for better inventory availability", color: "green" },
|
|
905
|
+
{ text: "Selecting a brand helps with targeting recommendations", color: "green" },
|
|
906
|
+
]}
|
|
907
|
+
quickTips={[
|
|
908
|
+
{ text: "Selecting a brand helps with better recommendations", color: "blue" },
|
|
909
|
+
{ text: "Targetting and Signals are set in the next step", color: "green" },
|
|
910
|
+
{ text: "You can always change these details later", color: "blue" },
|
|
911
|
+
]}
|
|
912
|
+
/>
|
|
913
|
+
</div>
|
|
914
|
+
</div>
|
|
915
|
+
);
|
|
916
|
+
}
|