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,1058 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deal Type Unit Tests
|
|
3
|
+
* Tests all deal types: GUARANTEED, PREFERRED_DEAL, PRIVATE_AUCTION, EVERGREEN_PMP
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const dealTypeTests = [
|
|
7
|
+
{
|
|
8
|
+
id: 'GUARANTEED_001',
|
|
9
|
+
name: 'GUARANTEED deal with all required fields',
|
|
10
|
+
type: 'GUARANTEED',
|
|
11
|
+
payload: {
|
|
12
|
+
source: 'UNIT_TEST',
|
|
13
|
+
externalId: 'TEST_GUARANTEED_001',
|
|
14
|
+
dealType: 'GUARANTEED',
|
|
15
|
+
name: 'Test GUARANTEED Deal',
|
|
16
|
+
costType: 'CPM',
|
|
17
|
+
currency: 'USD'
|
|
18
|
+
},
|
|
19
|
+
expectedStatus: 201,
|
|
20
|
+
expectedDealIdPrefix: 'GD-I-'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'GUARANTEED_002',
|
|
24
|
+
name: 'GUARANTEED line item with thresholdCountPerDay (valid)',
|
|
25
|
+
type: 'GUARANTEED',
|
|
26
|
+
payload: {
|
|
27
|
+
source: 'UNIT_TEST',
|
|
28
|
+
externalId: 'LI-GUARANTEED-001',
|
|
29
|
+
creativeType: 'VIDEO',
|
|
30
|
+
duration: 15,
|
|
31
|
+
thresholdCountPerDay: 100,
|
|
32
|
+
netCost: 5000,
|
|
33
|
+
deliveryGoal: 10000
|
|
34
|
+
},
|
|
35
|
+
expectedStatus: 201
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'GUARANTEED_003',
|
|
39
|
+
name: 'GUARANTEED line item without thresholdCountPerDay (invalid)',
|
|
40
|
+
type: 'GUARANTEED',
|
|
41
|
+
payload: {
|
|
42
|
+
source: 'UNIT_TEST',
|
|
43
|
+
externalId: 'LI-GUARANTEED-INVALID',
|
|
44
|
+
creativeType: 'VIDEO',
|
|
45
|
+
netCost: 5000
|
|
46
|
+
},
|
|
47
|
+
expectedStatus: 400,
|
|
48
|
+
expectedError: 'thresholdCountPerDay'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'PREFERRED_DEAL_001',
|
|
52
|
+
name: 'PREFERRED_DEAL with valid structure',
|
|
53
|
+
type: 'PREFERRED_DEAL',
|
|
54
|
+
payload: {
|
|
55
|
+
source: 'UNIT_TEST',
|
|
56
|
+
externalId: 'TEST_PREFERRED_001',
|
|
57
|
+
dealType: 'PREFERRED_DEAL',
|
|
58
|
+
name: 'Test PREFERRED_DEAL',
|
|
59
|
+
costType: 'CPM',
|
|
60
|
+
currency: 'USD'
|
|
61
|
+
},
|
|
62
|
+
expectedStatus: 201,
|
|
63
|
+
expectedDealIdPrefix: 'PD-I-'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'PREFERRED_DEAL_002',
|
|
67
|
+
name: 'PREFERRED_DEAL line item without thresholdCountPerDay (valid)',
|
|
68
|
+
type: 'PREFERRED_DEAL',
|
|
69
|
+
payload: {
|
|
70
|
+
source: 'UNIT_TEST',
|
|
71
|
+
externalId: 'LI-PREFERRED-001',
|
|
72
|
+
creativeType: 'DISPLAY',
|
|
73
|
+
duration: 10,
|
|
74
|
+
netCost: 3000,
|
|
75
|
+
deliveryGoal: 5000
|
|
76
|
+
},
|
|
77
|
+
expectedStatus: 201
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'PRIVATE_AUCTION_001',
|
|
81
|
+
name: 'PRIVATE_AUCTION with valid auction type',
|
|
82
|
+
type: 'PRIVATE_AUCTION',
|
|
83
|
+
payload: {
|
|
84
|
+
source: 'UNIT_TEST',
|
|
85
|
+
externalId: 'TEST_PMP_001',
|
|
86
|
+
dealType: 'PRIVATE_AUCTION',
|
|
87
|
+
auctionType: 2,
|
|
88
|
+
name: 'Test Private Auction',
|
|
89
|
+
costType: 'CPM'
|
|
90
|
+
},
|
|
91
|
+
expectedStatus: 201
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'PRIVATE_AUCTION_002',
|
|
95
|
+
name: 'PRIVATE_AUCTION line item with optional fields',
|
|
96
|
+
type: 'PRIVATE_AUCTION',
|
|
97
|
+
payload: {
|
|
98
|
+
source: 'UNIT_TEST',
|
|
99
|
+
externalId: 'LI-PMP-001',
|
|
100
|
+
creativeType: 'VIDEO',
|
|
101
|
+
duration: 20,
|
|
102
|
+
bidFloor: 5.00,
|
|
103
|
+
netCost: 2000
|
|
104
|
+
},
|
|
105
|
+
expectedStatus: 201
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 'EVERGREEN_PMP_001',
|
|
109
|
+
name: 'EVERGREEN_PMP deal creation',
|
|
110
|
+
type: 'EVERGREEN_PMP',
|
|
111
|
+
payload: {
|
|
112
|
+
source: 'UNIT_TEST',
|
|
113
|
+
externalId: 'TEST_EVERGREEN_001',
|
|
114
|
+
dealType: 'EVERGREEN_PMP',
|
|
115
|
+
name: 'Test Evergreen PMP',
|
|
116
|
+
costType: 'CPD'
|
|
117
|
+
},
|
|
118
|
+
expectedStatus: 201
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'EVERGREEN_PMP_002',
|
|
122
|
+
name: 'EVERGREEN_PMP line item with schedule',
|
|
123
|
+
type: 'EVERGREEN_PMP',
|
|
124
|
+
payload: {
|
|
125
|
+
source: 'UNIT_TEST',
|
|
126
|
+
externalId: 'LI-EVERGREEN-001',
|
|
127
|
+
creativeType: 'AUDIO',
|
|
128
|
+
duration: 30,
|
|
129
|
+
schedule: [
|
|
130
|
+
{
|
|
131
|
+
type: 'WEEKDAY',
|
|
132
|
+
hours: [{ start: 9, end: 18 }],
|
|
133
|
+
validity: { startDate: '2025-01-01', endDate: '2025-12-31' }
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
netCost: 1500
|
|
137
|
+
},
|
|
138
|
+
expectedStatus: 201
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: 'NESTED_001',
|
|
142
|
+
name: 'Deal with nested buyers array',
|
|
143
|
+
type: 'NESTED',
|
|
144
|
+
payload: {
|
|
145
|
+
source: 'UNIT_TEST',
|
|
146
|
+
externalId: 'TEST_NESTED_BUYERS',
|
|
147
|
+
dealType: 'PREFERRED_DEAL',
|
|
148
|
+
programmatic: {
|
|
149
|
+
buyers: [
|
|
150
|
+
{ seatId: 'B-001', buyerName: 'Buyer Org 1', dsp: 'DV360' },
|
|
151
|
+
{ seatId: 'B-002', buyerName: 'Buyer Org 2', dsp: 'The Trade Desk' }
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
seller: {
|
|
155
|
+
publisherId: 'S-001',
|
|
156
|
+
publisherName: 'Seller Org',
|
|
157
|
+
account: 'ACC-001'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
expectedStatus: 201
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: 'NESTED_002',
|
|
164
|
+
name: 'Line item with nested schedule (array format)',
|
|
165
|
+
type: 'NESTED',
|
|
166
|
+
payload: {
|
|
167
|
+
source: 'UNIT_TEST',
|
|
168
|
+
externalId: 'LI-NESTED-SCHEDULE',
|
|
169
|
+
creativeType: 'VIDEO',
|
|
170
|
+
duration: 15,
|
|
171
|
+
schedule: [
|
|
172
|
+
{
|
|
173
|
+
type: 'WEEKDAY',
|
|
174
|
+
hours: [{ start: 6, end: 22 }],
|
|
175
|
+
validity: { startDate: '2025-01-01', endDate: '2025-12-31' }
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
netCost: 4000
|
|
179
|
+
},
|
|
180
|
+
expectedStatus: 201
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 'VALIDATION_001',
|
|
184
|
+
name: 'Invalid deal type should fail',
|
|
185
|
+
type: 'VALIDATION',
|
|
186
|
+
payload: {
|
|
187
|
+
source: 'UNIT_TEST',
|
|
188
|
+
externalId: 'TEST_INVALID_TYPE',
|
|
189
|
+
dealType: 'INVALID_TYPE'
|
|
190
|
+
},
|
|
191
|
+
expectedStatus: 400,
|
|
192
|
+
expectedError: 'dealType'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: 'VALIDATION_COST_001',
|
|
196
|
+
name: 'Invalid cost type should fail',
|
|
197
|
+
type: 'VALIDATION',
|
|
198
|
+
payload: {
|
|
199
|
+
source: 'UNIT_TEST',
|
|
200
|
+
externalId: 'TEST_INVALID_COST',
|
|
201
|
+
dealType: 'GUARANTEED',
|
|
202
|
+
costType: 'INVALID'
|
|
203
|
+
},
|
|
204
|
+
expectedStatus: 400,
|
|
205
|
+
expectedError: 'costType'
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 'VALIDATION_AUCTION_001',
|
|
209
|
+
name: 'GUARANTEED with explicit auctionType=1 should fail (must be 3)',
|
|
210
|
+
type: 'VALIDATION',
|
|
211
|
+
payload: {
|
|
212
|
+
source: 'UNIT_TEST',
|
|
213
|
+
externalId: 'TEST_AUCTION_INVALID_1',
|
|
214
|
+
dealType: 'GUARANTEED',
|
|
215
|
+
programmatic: { auctionType: 1, costType: 'CPM' }
|
|
216
|
+
},
|
|
217
|
+
expectedStatus: 400,
|
|
218
|
+
expectedError: 'auctionType'
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
id: 'VALIDATION_AUCTION_002',
|
|
222
|
+
name: 'PREFERRED_DEAL with explicit auctionType=2 should fail (must be 3)',
|
|
223
|
+
type: 'VALIDATION',
|
|
224
|
+
payload: {
|
|
225
|
+
source: 'UNIT_TEST',
|
|
226
|
+
externalId: 'TEST_AUCTION_INVALID_2',
|
|
227
|
+
dealType: 'PREFERRED_DEAL',
|
|
228
|
+
programmatic: { auctionType: 2, costType: 'CPM' }
|
|
229
|
+
},
|
|
230
|
+
expectedStatus: 400,
|
|
231
|
+
expectedError: 'auctionType'
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: 'VALIDATION_AUCTION_003',
|
|
235
|
+
name: 'PRIVATE_AUCTION with explicit auctionType=3 should fail (must be 1 or 2)',
|
|
236
|
+
type: 'VALIDATION',
|
|
237
|
+
payload: {
|
|
238
|
+
source: 'UNIT_TEST',
|
|
239
|
+
externalId: 'TEST_AUCTION_INVALID_3',
|
|
240
|
+
dealType: 'PRIVATE_AUCTION',
|
|
241
|
+
programmatic: { auctionType: 3, costType: 'CPM' }
|
|
242
|
+
},
|
|
243
|
+
expectedStatus: 400,
|
|
244
|
+
expectedError: 'auctionType'
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: 'VALIDATION_AUCTION_004',
|
|
248
|
+
name: 'EVERGREEN_PMP with explicit auctionType=3 should fail (must be 1 or 2)',
|
|
249
|
+
type: 'VALIDATION',
|
|
250
|
+
payload: {
|
|
251
|
+
source: 'UNIT_TEST',
|
|
252
|
+
externalId: 'TEST_AUCTION_INVALID_4',
|
|
253
|
+
dealType: 'EVERGREEN_PMP',
|
|
254
|
+
programmatic: { auctionType: 3, costType: 'CPM' }
|
|
255
|
+
},
|
|
256
|
+
expectedStatus: 400,
|
|
257
|
+
expectedError: 'auctionType'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: 'VALIDATION_CPS_001',
|
|
261
|
+
name: 'GUARANTEED with CPS cost type should fail',
|
|
262
|
+
type: 'VALIDATION',
|
|
263
|
+
payload: {
|
|
264
|
+
source: 'UNIT_TEST',
|
|
265
|
+
externalId: 'TEST_CPS_INVALID_1',
|
|
266
|
+
dealType: 'GUARANTEED',
|
|
267
|
+
programmatic: { costType: 'CPS' }
|
|
268
|
+
},
|
|
269
|
+
expectedStatus: 400,
|
|
270
|
+
expectedError: 'costType'
|
|
271
|
+
},
|
|
272
|
+
// ==================== CAMPAIGN MODE TESTS ====================
|
|
273
|
+
{
|
|
274
|
+
id: 'CAMPAIGN_MODE_001',
|
|
275
|
+
name: 'PROGRAMMATIC mode deal - valid without Direct mode fields',
|
|
276
|
+
type: 'CAMPAIGN_MODE',
|
|
277
|
+
payload: {
|
|
278
|
+
source: 'UNIT_TEST',
|
|
279
|
+
externalId: 'TEST_PROGRAMMATIC_001',
|
|
280
|
+
dealType: 'PREFERRED_DEAL',
|
|
281
|
+
name: 'Programmatic Campaign Deal',
|
|
282
|
+
brand: 'Nike',
|
|
283
|
+
clientType: 'AGENCY',
|
|
284
|
+
mode: 'PROGRAMMATIC',
|
|
285
|
+
costType: 'CPM',
|
|
286
|
+
currency: 'USD'
|
|
287
|
+
},
|
|
288
|
+
expectedStatus: 201
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: 'CAMPAIGN_MODE_002',
|
|
292
|
+
name: 'DIRECT mode deal - valid with all required fields',
|
|
293
|
+
type: 'CAMPAIGN_MODE',
|
|
294
|
+
payload: {
|
|
295
|
+
source: 'UNIT_TEST',
|
|
296
|
+
externalId: 'TEST_DIRECT_001',
|
|
297
|
+
dealType: 'GUARANTEED',
|
|
298
|
+
name: 'Direct Campaign Deal',
|
|
299
|
+
brand: 'Toyota',
|
|
300
|
+
clientType: 'DIRECT_ADVERTISER',
|
|
301
|
+
mode: 'DIRECT',
|
|
302
|
+
approvalEmails: ['approver1@company.com', 'approver2@company.com'],
|
|
303
|
+
marketSelection: {
|
|
304
|
+
country: 'Malaysia',
|
|
305
|
+
currency: 'MYR'
|
|
306
|
+
},
|
|
307
|
+
budgetSetup: {
|
|
308
|
+
currency: 'MYR',
|
|
309
|
+
budgetAmount: 50000,
|
|
310
|
+
budgetType: 'FIXED'
|
|
311
|
+
},
|
|
312
|
+
campaignGoal: {
|
|
313
|
+
type: 'IMPRESSIONS',
|
|
314
|
+
targetValue: 1000000
|
|
315
|
+
},
|
|
316
|
+
costType: 'CPM',
|
|
317
|
+
currency: 'MYR'
|
|
318
|
+
},
|
|
319
|
+
expectedStatus: 201
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
id: 'CAMPAIGN_MODE_003',
|
|
323
|
+
name: 'DIRECT mode deal - missing approvalEmails (invalid)',
|
|
324
|
+
type: 'CAMPAIGN_MODE',
|
|
325
|
+
payload: {
|
|
326
|
+
source: 'UNIT_TEST',
|
|
327
|
+
externalId: 'TEST_DIRECT_INVALID_001',
|
|
328
|
+
dealType: 'PREFERRED_DEAL',
|
|
329
|
+
brand: 'Sony',
|
|
330
|
+
clientType: 'AGENCY',
|
|
331
|
+
mode: 'DIRECT',
|
|
332
|
+
marketSelection: { country: 'Japan', currency: 'JPY' },
|
|
333
|
+
budgetSetup: { currency: 'JPY' },
|
|
334
|
+
campaignGoal: { type: 'REACH' }
|
|
335
|
+
},
|
|
336
|
+
expectedStatus: 400,
|
|
337
|
+
expectedError: 'approvalEmails'
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: 'CAMPAIGN_MODE_004',
|
|
341
|
+
name: 'DIRECT mode deal - missing marketSelection (invalid)',
|
|
342
|
+
type: 'CAMPAIGN_MODE',
|
|
343
|
+
payload: {
|
|
344
|
+
source: 'UNIT_TEST',
|
|
345
|
+
externalId: 'TEST_DIRECT_INVALID_002',
|
|
346
|
+
dealType: 'PREFERRED_DEAL',
|
|
347
|
+
brand: 'LG',
|
|
348
|
+
clientType: 'DIRECT_ADVERTISER',
|
|
349
|
+
mode: 'DIRECT',
|
|
350
|
+
approvalEmails: ['test@company.com'],
|
|
351
|
+
budgetSetup: { currency: 'KRW' },
|
|
352
|
+
campaignGoal: { type: 'IMPRESSIONS' }
|
|
353
|
+
},
|
|
354
|
+
expectedStatus: 400,
|
|
355
|
+
expectedError: 'marketSelection'
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
id: 'CAMPAIGN_MODE_005',
|
|
359
|
+
name: 'DIRECT mode deal - missing budgetSetup (invalid)',
|
|
360
|
+
type: 'CAMPAIGN_MODE',
|
|
361
|
+
payload: {
|
|
362
|
+
source: 'UNIT_TEST',
|
|
363
|
+
externalId: 'TEST_DIRECT_INVALID_003',
|
|
364
|
+
dealType: 'PREFERRED_DEAL',
|
|
365
|
+
brand: 'Samsung',
|
|
366
|
+
clientType: 'AGENCY',
|
|
367
|
+
mode: 'DIRECT',
|
|
368
|
+
approvalEmails: ['test@company.com'],
|
|
369
|
+
marketSelection: { country: 'Korea', currency: 'KRW' },
|
|
370
|
+
campaignGoal: { type: 'SHARE_OF_VOICE' }
|
|
371
|
+
},
|
|
372
|
+
expectedStatus: 400,
|
|
373
|
+
expectedError: 'budgetSetup'
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
id: 'CAMPAIGN_MODE_006',
|
|
377
|
+
name: 'DIRECT mode deal - missing campaignGoal (invalid)',
|
|
378
|
+
type: 'CAMPAIGN_MODE',
|
|
379
|
+
payload: {
|
|
380
|
+
source: 'UNIT_TEST',
|
|
381
|
+
externalId: 'TEST_DIRECT_INVALID_004',
|
|
382
|
+
dealType: 'PREFERRED_DEAL',
|
|
383
|
+
brand: 'Panasonic',
|
|
384
|
+
clientType: 'DIRECT_ADVERTISER',
|
|
385
|
+
mode: 'DIRECT',
|
|
386
|
+
approvalEmails: ['test@company.com'],
|
|
387
|
+
marketSelection: { country: 'Japan', currency: 'JPY' },
|
|
388
|
+
budgetSetup: { currency: 'JPY', budgetAmount: 10000 }
|
|
389
|
+
},
|
|
390
|
+
expectedStatus: 400,
|
|
391
|
+
expectedError: 'campaignGoal'
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: 'CAMPAIGN_MODE_007',
|
|
395
|
+
name: 'DIRECT mode deal - negative budgetAmount (invalid)',
|
|
396
|
+
type: 'CAMPAIGN_MODE',
|
|
397
|
+
payload: {
|
|
398
|
+
source: 'UNIT_TEST',
|
|
399
|
+
externalId: 'TEST_DIRECT_INVALID_005',
|
|
400
|
+
dealType: 'PREFERRED_DEAL',
|
|
401
|
+
brand: 'Honda',
|
|
402
|
+
clientType: 'AGENCY',
|
|
403
|
+
mode: 'DIRECT',
|
|
404
|
+
approvalEmails: ['test@company.com'],
|
|
405
|
+
marketSelection: { country: 'Japan', currency: 'JPY' },
|
|
406
|
+
budgetSetup: { currency: 'JPY', budgetAmount: -5000 },
|
|
407
|
+
campaignGoal: { type: 'IMPRESSIONS' }
|
|
408
|
+
},
|
|
409
|
+
expectedStatus: 400,
|
|
410
|
+
expectedError: 'budgetAmount'
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: 'CAMPAIGN_MODE_008',
|
|
414
|
+
name: 'DIRECT mode deal - invalid clientType value (invalid)',
|
|
415
|
+
type: 'CAMPAIGN_MODE',
|
|
416
|
+
payload: {
|
|
417
|
+
source: 'UNIT_TEST',
|
|
418
|
+
externalId: 'TEST_DIRECT_INVALID_006',
|
|
419
|
+
dealType: 'PREFERRED_DEAL',
|
|
420
|
+
brand: 'Canon',
|
|
421
|
+
clientType: 'BUYER',
|
|
422
|
+
mode: 'DIRECT',
|
|
423
|
+
approvalEmails: ['test@company.com'],
|
|
424
|
+
marketSelection: { country: 'Japan', currency: 'JPY' },
|
|
425
|
+
budgetSetup: { currency: 'JPY' },
|
|
426
|
+
campaignGoal: { type: 'IMPRESSIONS' }
|
|
427
|
+
},
|
|
428
|
+
expectedStatus: 400,
|
|
429
|
+
expectedError: 'clientType'
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
id: 'CAMPAIGN_MODE_011',
|
|
433
|
+
name: 'DIRECT mode deal - missing brand (invalid)',
|
|
434
|
+
type: 'CAMPAIGN_MODE',
|
|
435
|
+
payload: {
|
|
436
|
+
source: 'UNIT_TEST',
|
|
437
|
+
externalId: 'TEST_DIRECT_INVALID_007',
|
|
438
|
+
dealType: 'PREFERRED_DEAL',
|
|
439
|
+
clientType: 'AGENCY',
|
|
440
|
+
mode: 'DIRECT',
|
|
441
|
+
approvalEmails: ['test@company.com'],
|
|
442
|
+
marketSelection: { country: 'Japan', currency: 'JPY' },
|
|
443
|
+
budgetSetup: { currency: 'JPY' },
|
|
444
|
+
campaignGoal: { type: 'IMPRESSIONS' }
|
|
445
|
+
},
|
|
446
|
+
expectedStatus: 400,
|
|
447
|
+
expectedError: 'brand'
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
id: 'CAMPAIGN_MODE_012',
|
|
451
|
+
name: 'DIRECT mode deal - missing clientType (invalid)',
|
|
452
|
+
type: 'CAMPAIGN_MODE',
|
|
453
|
+
payload: {
|
|
454
|
+
source: 'UNIT_TEST',
|
|
455
|
+
externalId: 'TEST_DIRECT_INVALID_008',
|
|
456
|
+
dealType: 'PREFERRED_DEAL',
|
|
457
|
+
brand: 'Fuji',
|
|
458
|
+
mode: 'DIRECT',
|
|
459
|
+
approvalEmails: ['test@company.com'],
|
|
460
|
+
marketSelection: { country: 'Japan', currency: 'JPY' },
|
|
461
|
+
budgetSetup: { currency: 'JPY' },
|
|
462
|
+
campaignGoal: { type: 'IMPRESSIONS' }
|
|
463
|
+
},
|
|
464
|
+
expectedStatus: 400,
|
|
465
|
+
expectedError: 'clientType'
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
id: 'CAMPAIGN_MODE_009',
|
|
469
|
+
name: 'DIRECT mode deal with REACH goal type - valid',
|
|
470
|
+
type: 'CAMPAIGN_MODE',
|
|
471
|
+
payload: {
|
|
472
|
+
source: 'UNIT_TEST',
|
|
473
|
+
externalId: 'TEST_DIRECT_REACH_001',
|
|
474
|
+
dealType: 'PRIVATE_AUCTION',
|
|
475
|
+
name: 'Direct Campaign with Reach Goal',
|
|
476
|
+
brand: 'Adidas',
|
|
477
|
+
clientType: 'AGENCY',
|
|
478
|
+
mode: 'DIRECT',
|
|
479
|
+
auctionType: 2,
|
|
480
|
+
approvalEmails: ['marketing@adidas.com'],
|
|
481
|
+
marketSelection: {
|
|
482
|
+
country: 'Germany',
|
|
483
|
+
currency: 'EUR'
|
|
484
|
+
},
|
|
485
|
+
budgetSetup: {
|
|
486
|
+
currency: 'EUR',
|
|
487
|
+
budgetAmount: 100000
|
|
488
|
+
},
|
|
489
|
+
campaignGoal: {
|
|
490
|
+
type: 'REACH',
|
|
491
|
+
targetValue: 5000000
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
expectedStatus: 201
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
id: 'CAMPAIGN_MODE_010',
|
|
498
|
+
name: 'DIRECT mode deal with SHARE_OF_VOICE goal - valid',
|
|
499
|
+
type: 'CAMPAIGN_MODE',
|
|
500
|
+
payload: {
|
|
501
|
+
source: 'UNIT_TEST',
|
|
502
|
+
externalId: 'TEST_DIRECT_SOV_001',
|
|
503
|
+
dealType: 'EVERGREEN_PMP',
|
|
504
|
+
name: 'Direct Campaign with Share of Voice Goal',
|
|
505
|
+
brand: 'Mercedes',
|
|
506
|
+
clientType: 'DIRECT_ADVERTISER',
|
|
507
|
+
mode: 'DIRECT',
|
|
508
|
+
approvalEmails: ['campaigns@mercedes.com', 'approvals@mercedes.com'],
|
|
509
|
+
marketSelection: {
|
|
510
|
+
country: 'Germany',
|
|
511
|
+
currency: 'EUR'
|
|
512
|
+
},
|
|
513
|
+
budgetSetup: {
|
|
514
|
+
currency: 'EUR',
|
|
515
|
+
budgetAmount: 250000,
|
|
516
|
+
budgetType: 'MONTHLY'
|
|
517
|
+
},
|
|
518
|
+
campaignGoal: {
|
|
519
|
+
type: 'SHARE_OF_VOICE',
|
|
520
|
+
targetValue: 25
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
expectedStatus: 201,
|
|
524
|
+
expectedDealIdPrefix: 'DIR-I-'
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
id: 'DEAL_ID_GEN_001',
|
|
528
|
+
name: 'GUARANTEED deal generates GD-I-XXXXX-XXXXX format',
|
|
529
|
+
type: 'DEAL_ID_GENERATION',
|
|
530
|
+
payload: {
|
|
531
|
+
source: 'UNIT_TEST',
|
|
532
|
+
externalId: 'TEST_DEAL_ID_GEN_GD',
|
|
533
|
+
dealType: 'GUARANTEED',
|
|
534
|
+
name: 'Test GD Deal ID Generation'
|
|
535
|
+
},
|
|
536
|
+
expectedStatus: 201,
|
|
537
|
+
expectedDealIdPrefix: 'GD-I-'
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
id: 'DEAL_ID_GEN_002',
|
|
541
|
+
name: 'PREFERRED_DEAL generates PD-I-XXXXX-XXXXX format',
|
|
542
|
+
type: 'DEAL_ID_GENERATION',
|
|
543
|
+
payload: {
|
|
544
|
+
source: 'UNIT_TEST',
|
|
545
|
+
externalId: 'TEST_DEAL_ID_GEN_PD',
|
|
546
|
+
dealType: 'PREFERRED_DEAL',
|
|
547
|
+
name: 'Test PD Deal ID Generation'
|
|
548
|
+
},
|
|
549
|
+
expectedStatus: 201,
|
|
550
|
+
expectedDealIdPrefix: 'PD-I-'
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
id: 'DEAL_ID_GEN_003',
|
|
554
|
+
name: 'PRIVATE_AUCTION generates PA-I-XXXXX-XXXXX format',
|
|
555
|
+
type: 'DEAL_ID_GENERATION',
|
|
556
|
+
payload: {
|
|
557
|
+
source: 'UNIT_TEST',
|
|
558
|
+
externalId: 'TEST_DEAL_ID_GEN_PA',
|
|
559
|
+
dealType: 'PRIVATE_AUCTION',
|
|
560
|
+
name: 'Test PA Deal ID Generation'
|
|
561
|
+
},
|
|
562
|
+
expectedStatus: 201,
|
|
563
|
+
expectedDealIdPrefix: 'PA-I-'
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
id: 'DEAL_ID_GEN_004',
|
|
567
|
+
name: 'EVERGREEN_PMP generates EG-I-XXXXX-XXXXX format',
|
|
568
|
+
type: 'DEAL_ID_GENERATION',
|
|
569
|
+
payload: {
|
|
570
|
+
source: 'UNIT_TEST',
|
|
571
|
+
externalId: 'TEST_DEAL_ID_GEN_EG',
|
|
572
|
+
dealType: 'EVERGREEN_PMP',
|
|
573
|
+
name: 'Test EG Deal ID Generation'
|
|
574
|
+
},
|
|
575
|
+
expectedStatus: 201,
|
|
576
|
+
expectedDealIdPrefix: 'EG-I-'
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
id: 'DEAL_ID_GEN_005',
|
|
580
|
+
name: 'DIRECT mode generates DIR-I-XXXXX-XXXXX format',
|
|
581
|
+
type: 'DEAL_ID_GENERATION',
|
|
582
|
+
payload: {
|
|
583
|
+
source: 'UNIT_TEST',
|
|
584
|
+
externalId: 'TEST_DEAL_ID_GEN_DIR',
|
|
585
|
+
dealType: 'PREFERRED_DEAL',
|
|
586
|
+
name: 'Test DIR Deal ID Generation',
|
|
587
|
+
brand: 'TestBrand',
|
|
588
|
+
clientType: 'AGENCY',
|
|
589
|
+
mode: 'DIRECT',
|
|
590
|
+
approvalEmails: ['test@test.com'],
|
|
591
|
+
marketSelection: { country: 'USA', currency: 'USD' },
|
|
592
|
+
budgetSetup: { currency: 'USD', budgetAmount: 10000 },
|
|
593
|
+
campaignGoal: { type: 'IMPRESSIONS', targetValue: 100000 }
|
|
594
|
+
},
|
|
595
|
+
expectedStatus: 201,
|
|
596
|
+
expectedDealIdPrefix: 'DIR-I-'
|
|
597
|
+
},
|
|
598
|
+
|
|
599
|
+
// ==================== AUCTION TYPE TESTS (IAB OpenRTB Standard) ====================
|
|
600
|
+
{
|
|
601
|
+
id: 'AUCTION_TYPE_001',
|
|
602
|
+
name: 'GUARANTEED deal auto-sets auctionType=3 (fixed price)',
|
|
603
|
+
type: 'AUCTION_TYPE',
|
|
604
|
+
payload: {
|
|
605
|
+
source: 'UNIT_TEST',
|
|
606
|
+
externalId: 'TEST_AUCTION_GD_001',
|
|
607
|
+
dealType: 'GUARANTEED',
|
|
608
|
+
name: 'Guaranteed Auction Type Test',
|
|
609
|
+
programmatic: { costType: 'CPM', transactionType: 'SPOT' }
|
|
610
|
+
},
|
|
611
|
+
expectedStatus: 201,
|
|
612
|
+
expectedAuctionType: 3
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
id: 'AUCTION_TYPE_002',
|
|
616
|
+
name: 'PREFERRED_DEAL auto-sets auctionType=3 (fixed price)',
|
|
617
|
+
type: 'AUCTION_TYPE',
|
|
618
|
+
payload: {
|
|
619
|
+
source: 'UNIT_TEST',
|
|
620
|
+
externalId: 'TEST_AUCTION_PD_001',
|
|
621
|
+
dealType: 'PREFERRED_DEAL',
|
|
622
|
+
name: 'Preferred Deal Auction Type Test',
|
|
623
|
+
programmatic: { costType: 'CPM', transactionType: 'AUDIENCE' }
|
|
624
|
+
},
|
|
625
|
+
expectedStatus: 201,
|
|
626
|
+
expectedAuctionType: 3
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
id: 'AUCTION_TYPE_003',
|
|
630
|
+
name: 'PRIVATE_AUCTION with auctionType=1 (first price) - valid',
|
|
631
|
+
type: 'AUCTION_TYPE',
|
|
632
|
+
payload: {
|
|
633
|
+
source: 'UNIT_TEST',
|
|
634
|
+
externalId: 'TEST_AUCTION_PA_FIRST',
|
|
635
|
+
dealType: 'PRIVATE_AUCTION',
|
|
636
|
+
name: 'Private Auction First Price',
|
|
637
|
+
programmatic: { auctionType: 1, costType: 'CPM' }
|
|
638
|
+
},
|
|
639
|
+
expectedStatus: 201,
|
|
640
|
+
expectedAuctionType: 1
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
id: 'AUCTION_TYPE_004',
|
|
644
|
+
name: 'PRIVATE_AUCTION with auctionType=2 (second price) - valid',
|
|
645
|
+
type: 'AUCTION_TYPE',
|
|
646
|
+
payload: {
|
|
647
|
+
source: 'UNIT_TEST',
|
|
648
|
+
externalId: 'TEST_AUCTION_PA_SECOND',
|
|
649
|
+
dealType: 'PRIVATE_AUCTION',
|
|
650
|
+
name: 'Private Auction Second Price',
|
|
651
|
+
programmatic: { auctionType: 2, costType: 'CPM' }
|
|
652
|
+
},
|
|
653
|
+
expectedStatus: 201,
|
|
654
|
+
expectedAuctionType: 2
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
id: 'AUCTION_TYPE_005',
|
|
658
|
+
name: 'EVERGREEN_PMP with auctionType=1 (first price) - valid',
|
|
659
|
+
type: 'AUCTION_TYPE',
|
|
660
|
+
payload: {
|
|
661
|
+
source: 'UNIT_TEST',
|
|
662
|
+
externalId: 'TEST_AUCTION_EG_FIRST',
|
|
663
|
+
dealType: 'EVERGREEN_PMP',
|
|
664
|
+
name: 'Evergreen First Price',
|
|
665
|
+
programmatic: { auctionType: 1, costType: 'CPS' }
|
|
666
|
+
},
|
|
667
|
+
expectedStatus: 201,
|
|
668
|
+
expectedAuctionType: 1
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
id: 'AUCTION_TYPE_NEG_001',
|
|
672
|
+
name: 'GUARANTEED with auctionType=1 (invalid - must be 3)',
|
|
673
|
+
type: 'AUCTION_TYPE',
|
|
674
|
+
payload: {
|
|
675
|
+
source: 'UNIT_TEST',
|
|
676
|
+
externalId: 'TEST_AUCTION_GD_INVALID',
|
|
677
|
+
dealType: 'GUARANTEED',
|
|
678
|
+
name: 'Guaranteed Invalid Auction',
|
|
679
|
+
programmatic: { auctionType: 1, costType: 'CPM' }
|
|
680
|
+
},
|
|
681
|
+
expectedStatus: 400,
|
|
682
|
+
expectedError: 'auctionType'
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
id: 'AUCTION_TYPE_NEG_002',
|
|
686
|
+
name: 'PREFERRED_DEAL with auctionType=2 (invalid - must be 3)',
|
|
687
|
+
type: 'AUCTION_TYPE',
|
|
688
|
+
payload: {
|
|
689
|
+
source: 'UNIT_TEST',
|
|
690
|
+
externalId: 'TEST_AUCTION_PD_INVALID',
|
|
691
|
+
dealType: 'PREFERRED_DEAL',
|
|
692
|
+
name: 'Preferred Deal Invalid Auction',
|
|
693
|
+
programmatic: { auctionType: 2, costType: 'CPM' }
|
|
694
|
+
},
|
|
695
|
+
expectedStatus: 400,
|
|
696
|
+
expectedError: 'auctionType'
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
id: 'AUCTION_TYPE_NEG_003',
|
|
700
|
+
name: 'PRIVATE_AUCTION with auctionType=3 (invalid - must be 1 or 2)',
|
|
701
|
+
type: 'AUCTION_TYPE',
|
|
702
|
+
payload: {
|
|
703
|
+
source: 'UNIT_TEST',
|
|
704
|
+
externalId: 'TEST_AUCTION_PA_INVALID',
|
|
705
|
+
dealType: 'PRIVATE_AUCTION',
|
|
706
|
+
name: 'Private Auction Invalid Auction Type',
|
|
707
|
+
programmatic: { auctionType: 3, costType: 'CPM' }
|
|
708
|
+
},
|
|
709
|
+
expectedStatus: 400,
|
|
710
|
+
expectedError: 'auctionType'
|
|
711
|
+
},
|
|
712
|
+
|
|
713
|
+
// ==================== COST TYPE TESTS ====================
|
|
714
|
+
{
|
|
715
|
+
id: 'COST_TYPE_001',
|
|
716
|
+
name: 'GUARANTEED with CPM cost type - valid',
|
|
717
|
+
type: 'COST_TYPE',
|
|
718
|
+
payload: {
|
|
719
|
+
source: 'UNIT_TEST',
|
|
720
|
+
externalId: 'TEST_COST_GD_CPM',
|
|
721
|
+
dealType: 'GUARANTEED',
|
|
722
|
+
programmatic: { costType: 'CPM', transactionType: 'SPOT' }
|
|
723
|
+
},
|
|
724
|
+
expectedStatus: 201
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
id: 'COST_TYPE_002',
|
|
728
|
+
name: 'GUARANTEED with CPD cost type - valid',
|
|
729
|
+
type: 'COST_TYPE',
|
|
730
|
+
payload: {
|
|
731
|
+
source: 'UNIT_TEST',
|
|
732
|
+
externalId: 'TEST_COST_GD_CPD',
|
|
733
|
+
dealType: 'GUARANTEED',
|
|
734
|
+
programmatic: { costType: 'CPD', transactionType: 'SPOT' }
|
|
735
|
+
},
|
|
736
|
+
expectedStatus: 201
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
id: 'COST_TYPE_NEG_001',
|
|
740
|
+
name: 'GUARANTEED with CPS cost type (invalid - CPS not for guaranteed)',
|
|
741
|
+
type: 'COST_TYPE',
|
|
742
|
+
payload: {
|
|
743
|
+
source: 'UNIT_TEST',
|
|
744
|
+
externalId: 'TEST_COST_GD_CPS_INVALID',
|
|
745
|
+
dealType: 'GUARANTEED',
|
|
746
|
+
programmatic: { costType: 'CPS', transactionType: 'SPOT' }
|
|
747
|
+
},
|
|
748
|
+
expectedStatus: 400,
|
|
749
|
+
expectedError: 'costType'
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
id: 'COST_TYPE_003',
|
|
753
|
+
name: 'PREFERRED_DEAL with CPS cost type - valid',
|
|
754
|
+
type: 'COST_TYPE',
|
|
755
|
+
payload: {
|
|
756
|
+
source: 'UNIT_TEST',
|
|
757
|
+
externalId: 'TEST_COST_PD_CPS',
|
|
758
|
+
dealType: 'PREFERRED_DEAL',
|
|
759
|
+
programmatic: { costType: 'CPS', transactionType: 'AUDIENCE' }
|
|
760
|
+
},
|
|
761
|
+
expectedStatus: 201
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
id: 'COST_TYPE_004',
|
|
765
|
+
name: 'PRIVATE_AUCTION with CPS cost type - valid',
|
|
766
|
+
type: 'COST_TYPE',
|
|
767
|
+
payload: {
|
|
768
|
+
source: 'UNIT_TEST',
|
|
769
|
+
externalId: 'TEST_COST_PA_CPS',
|
|
770
|
+
dealType: 'PRIVATE_AUCTION',
|
|
771
|
+
programmatic: { costType: 'CPS', auctionType: 1 }
|
|
772
|
+
},
|
|
773
|
+
expectedStatus: 201
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
id: 'COST_TYPE_005',
|
|
777
|
+
name: 'EVERGREEN_PMP with CPS cost type - valid',
|
|
778
|
+
type: 'COST_TYPE',
|
|
779
|
+
payload: {
|
|
780
|
+
source: 'UNIT_TEST',
|
|
781
|
+
externalId: 'TEST_COST_EG_CPS',
|
|
782
|
+
dealType: 'EVERGREEN_PMP',
|
|
783
|
+
programmatic: { costType: 'CPS', auctionType: 2 }
|
|
784
|
+
},
|
|
785
|
+
expectedStatus: 201
|
|
786
|
+
},
|
|
787
|
+
|
|
788
|
+
// ==================== TRANSACTION TYPE TESTS ====================
|
|
789
|
+
{
|
|
790
|
+
id: 'TRANSACTION_TYPE_001',
|
|
791
|
+
name: 'SPOT transaction type - valid',
|
|
792
|
+
type: 'TRANSACTION_TYPE',
|
|
793
|
+
payload: {
|
|
794
|
+
source: 'UNIT_TEST',
|
|
795
|
+
externalId: 'TEST_TRANS_SPOT',
|
|
796
|
+
dealType: 'PREFERRED_DEAL',
|
|
797
|
+
programmatic: { transactionType: 'SPOT', costType: 'CPM' }
|
|
798
|
+
},
|
|
799
|
+
expectedStatus: 201
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
id: 'TRANSACTION_TYPE_002',
|
|
803
|
+
name: 'AUDIENCE transaction type - valid',
|
|
804
|
+
type: 'TRANSACTION_TYPE',
|
|
805
|
+
payload: {
|
|
806
|
+
source: 'UNIT_TEST',
|
|
807
|
+
externalId: 'TEST_TRANS_AUDIENCE',
|
|
808
|
+
dealType: 'PREFERRED_DEAL',
|
|
809
|
+
programmatic: { transactionType: 'AUDIENCE', costType: 'CPM' }
|
|
810
|
+
},
|
|
811
|
+
expectedStatus: 201
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
id: 'TRANSACTION_TYPE_NEG_001',
|
|
815
|
+
name: 'GUARANTEED transaction type (invalid - removed)',
|
|
816
|
+
type: 'TRANSACTION_TYPE',
|
|
817
|
+
payload: {
|
|
818
|
+
source: 'UNIT_TEST',
|
|
819
|
+
externalId: 'TEST_TRANS_INVALID',
|
|
820
|
+
dealType: 'PREFERRED_DEAL',
|
|
821
|
+
programmatic: { transactionType: 'GUARANTEED', costType: 'CPM' }
|
|
822
|
+
},
|
|
823
|
+
expectedStatus: 400,
|
|
824
|
+
expectedError: 'transactionType'
|
|
825
|
+
},
|
|
826
|
+
|
|
827
|
+
// ==================== NEW PROGRAMMATIC FIELDS TESTS ====================
|
|
828
|
+
{
|
|
829
|
+
id: 'PROG_FIELDS_001',
|
|
830
|
+
name: 'impMultiplierType defaults to MAD',
|
|
831
|
+
type: 'PROGRAMMATIC_FIELDS',
|
|
832
|
+
payload: {
|
|
833
|
+
source: 'UNIT_TEST',
|
|
834
|
+
externalId: 'TEST_IMP_DEFAULT',
|
|
835
|
+
dealType: 'GUARANTEED',
|
|
836
|
+
programmatic: { costType: 'CPM' }
|
|
837
|
+
},
|
|
838
|
+
expectedStatus: 201,
|
|
839
|
+
expectedImpMultiplierType: 'MAD'
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
id: 'PROG_FIELDS_002',
|
|
843
|
+
name: 'impMultiplierType can be set to CUSTOM',
|
|
844
|
+
type: 'PROGRAMMATIC_FIELDS',
|
|
845
|
+
payload: {
|
|
846
|
+
source: 'UNIT_TEST',
|
|
847
|
+
externalId: 'TEST_IMP_CUSTOM',
|
|
848
|
+
dealType: 'GUARANTEED',
|
|
849
|
+
programmatic: { costType: 'CPM', impMultiplierType: 'CUSTOM' }
|
|
850
|
+
},
|
|
851
|
+
expectedStatus: 201,
|
|
852
|
+
expectedImpMultiplierType: 'CUSTOM'
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
id: 'PROG_FIELDS_003',
|
|
856
|
+
name: 'published field - set to true',
|
|
857
|
+
type: 'PROGRAMMATIC_FIELDS',
|
|
858
|
+
payload: {
|
|
859
|
+
source: 'UNIT_TEST',
|
|
860
|
+
externalId: 'TEST_PUBLISHED',
|
|
861
|
+
dealType: 'PREFERRED_DEAL',
|
|
862
|
+
programmatic: { published: true, costType: 'CPM' }
|
|
863
|
+
},
|
|
864
|
+
expectedStatus: 201
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
id: 'PROG_FIELDS_004',
|
|
868
|
+
name: 'nonBillable field - set to true',
|
|
869
|
+
type: 'PROGRAMMATIC_FIELDS',
|
|
870
|
+
payload: {
|
|
871
|
+
source: 'UNIT_TEST',
|
|
872
|
+
externalId: 'TEST_NONBILLABLE',
|
|
873
|
+
dealType: 'PRIVATE_AUCTION',
|
|
874
|
+
programmatic: { nonBillable: true, auctionType: 1, costType: 'CPM' }
|
|
875
|
+
},
|
|
876
|
+
expectedStatus: 201
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
id: 'PROG_FIELDS_005',
|
|
880
|
+
name: 'stopBidRequests field - set to true',
|
|
881
|
+
type: 'PROGRAMMATIC_FIELDS',
|
|
882
|
+
payload: {
|
|
883
|
+
source: 'UNIT_TEST',
|
|
884
|
+
externalId: 'TEST_STOPBID',
|
|
885
|
+
dealType: 'GUARANTEED',
|
|
886
|
+
programmatic: { stopBidRequests: true, costType: 'CPM' }
|
|
887
|
+
},
|
|
888
|
+
expectedStatus: 201
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
id: 'PROG_FIELDS_006',
|
|
892
|
+
name: 'reopened field - set to true',
|
|
893
|
+
type: 'PROGRAMMATIC_FIELDS',
|
|
894
|
+
payload: {
|
|
895
|
+
source: 'UNIT_TEST',
|
|
896
|
+
externalId: 'TEST_REOPENED',
|
|
897
|
+
dealType: 'EVERGREEN_PMP',
|
|
898
|
+
programmatic: { reopened: true, auctionType: 1, costType: 'CPD' }
|
|
899
|
+
},
|
|
900
|
+
expectedStatus: 201
|
|
901
|
+
},
|
|
902
|
+
|
|
903
|
+
// ==================== STATUS TESTS ====================
|
|
904
|
+
{
|
|
905
|
+
id: 'STATUS_001',
|
|
906
|
+
name: 'Default status is GENERATED',
|
|
907
|
+
type: 'STATUS',
|
|
908
|
+
payload: {
|
|
909
|
+
source: 'UNIT_TEST',
|
|
910
|
+
externalId: 'TEST_STATUS_DEFAULT',
|
|
911
|
+
dealType: 'GUARANTEED'
|
|
912
|
+
},
|
|
913
|
+
expectedStatus: 201,
|
|
914
|
+
expectedDealStatus: 'GENERATED'
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
id: 'STATUS_002',
|
|
918
|
+
name: 'Status can be set to PENDING',
|
|
919
|
+
type: 'STATUS',
|
|
920
|
+
payload: {
|
|
921
|
+
source: 'UNIT_TEST',
|
|
922
|
+
externalId: 'TEST_STATUS_PENDING',
|
|
923
|
+
dealType: 'GUARANTEED',
|
|
924
|
+
status: 'PENDING'
|
|
925
|
+
},
|
|
926
|
+
expectedStatus: 201,
|
|
927
|
+
expectedDealStatus: 'PENDING'
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
id: 'STATUS_003',
|
|
931
|
+
name: 'Status can be set to LIVE',
|
|
932
|
+
type: 'STATUS',
|
|
933
|
+
payload: {
|
|
934
|
+
source: 'UNIT_TEST',
|
|
935
|
+
externalId: 'TEST_STATUS_LIVE',
|
|
936
|
+
dealType: 'PREFERRED_DEAL',
|
|
937
|
+
status: 'LIVE'
|
|
938
|
+
},
|
|
939
|
+
expectedStatus: 201,
|
|
940
|
+
expectedDealStatus: 'LIVE'
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
id: 'STATUS_NEG_001',
|
|
944
|
+
name: 'Invalid status value rejected',
|
|
945
|
+
type: 'STATUS',
|
|
946
|
+
payload: {
|
|
947
|
+
source: 'UNIT_TEST',
|
|
948
|
+
externalId: 'TEST_STATUS_INVALID',
|
|
949
|
+
dealType: 'GUARANTEED',
|
|
950
|
+
status: 'RUNNING'
|
|
951
|
+
},
|
|
952
|
+
expectedStatus: 400,
|
|
953
|
+
expectedError: 'status'
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
id: 'INVENTORY_001',
|
|
957
|
+
name: 'Inventory with deviceId and metadata.externalRefIds array',
|
|
958
|
+
type: 'INVENTORY',
|
|
959
|
+
payload: {
|
|
960
|
+
inventories: [
|
|
961
|
+
{
|
|
962
|
+
id: 'inv-unit-test-001',
|
|
963
|
+
deviceId: 'device-test-001',
|
|
964
|
+
name: 'Unit Test Screen',
|
|
965
|
+
size: '1920x1080',
|
|
966
|
+
venueType: 'RETAIL',
|
|
967
|
+
metadata: {
|
|
968
|
+
externalRefIds: [
|
|
969
|
+
{ source: 'LMX', externalRefId: 'lmx-unit-001' },
|
|
970
|
+
{ source: 'BROADSIGN', externalRefId: 'bs-unit-001' }
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
]
|
|
975
|
+
},
|
|
976
|
+
expectedStatus: 201
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
id: 'INVENTORY_002',
|
|
980
|
+
name: 'Inventory with only deviceId, no metadata (valid - metadata is optional)',
|
|
981
|
+
type: 'INVENTORY',
|
|
982
|
+
payload: {
|
|
983
|
+
inventories: [
|
|
984
|
+
{
|
|
985
|
+
id: 'inv-unit-test-002',
|
|
986
|
+
deviceId: 'device-test-002',
|
|
987
|
+
name: 'Screen with Device ID only',
|
|
988
|
+
size: '1280x720'
|
|
989
|
+
}
|
|
990
|
+
]
|
|
991
|
+
},
|
|
992
|
+
expectedStatus: 201
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
id: 'INVENTORY_005',
|
|
996
|
+
name: 'Inventory with no deviceId and no metadata (valid - both are optional)',
|
|
997
|
+
type: 'INVENTORY',
|
|
998
|
+
payload: {
|
|
999
|
+
inventories: [
|
|
1000
|
+
{
|
|
1001
|
+
id: 'inv-unit-test-005',
|
|
1002
|
+
name: 'Basic Screen - No Optional Fields',
|
|
1003
|
+
size: '1920x1080'
|
|
1004
|
+
}
|
|
1005
|
+
]
|
|
1006
|
+
},
|
|
1007
|
+
expectedStatus: 201
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
id: 'INVENTORY_003',
|
|
1011
|
+
name: 'Inventory with single externalRefId entry (valid)',
|
|
1012
|
+
type: 'INVENTORY',
|
|
1013
|
+
payload: {
|
|
1014
|
+
inventories: [
|
|
1015
|
+
{
|
|
1016
|
+
id: 'inv-unit-test-003',
|
|
1017
|
+
name: 'Screen with Single External Ref',
|
|
1018
|
+
size: '1920x1080',
|
|
1019
|
+
metadata: {
|
|
1020
|
+
externalRefIds: [{ source: 'BROADSIGN', externalRefId: 'bs-unit-003' }]
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
]
|
|
1024
|
+
},
|
|
1025
|
+
expectedStatus: 201
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
id: 'INVENTORY_004',
|
|
1029
|
+
name: 'Inventory with invalid externalRefIds (missing required fields)',
|
|
1030
|
+
type: 'INVENTORY',
|
|
1031
|
+
payload: {
|
|
1032
|
+
inventories: [
|
|
1033
|
+
{
|
|
1034
|
+
id: 'inv-unit-test-004',
|
|
1035
|
+
name: 'Invalid External Ref Screen',
|
|
1036
|
+
size: '1920x1080',
|
|
1037
|
+
metadata: {
|
|
1038
|
+
externalRefIds: [{ source: 'LMX' }]
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
]
|
|
1042
|
+
},
|
|
1043
|
+
expectedStatus: 400,
|
|
1044
|
+
expectedError: 'externalRefId'
|
|
1045
|
+
}
|
|
1046
|
+
];
|
|
1047
|
+
|
|
1048
|
+
export const getTestsByType = (type) => {
|
|
1049
|
+
return dealTypeTests.filter(test => test.type === type);
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
export const getTestById = (id) => {
|
|
1053
|
+
return dealTypeTests.find(test => test.id === id);
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
export const getAllTestTypes = () => {
|
|
1057
|
+
return [...new Set(dealTypeTests.map(test => test.type))];
|
|
1058
|
+
};
|