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.
Files changed (525) hide show
  1. package/.ci/staging.yml +191 -0
  2. package/.dockerignore +117 -0
  3. package/.env +40 -0
  4. package/.env.staging +38 -0
  5. package/.gitlab-ci.yml +16 -0
  6. package/DEMO_STATUS.md +579 -0
  7. package/Dockerfile +61 -0
  8. package/Influence-MW-AdServer-12-02-2026/client/index.html +17 -0
  9. package/Influence-MW-AdServer-12-02-2026/client/public/favicon.png +0 -0
  10. package/Influence-MW-AdServer-12-02-2026/client/src/App.tsx +91 -0
  11. package/Influence-MW-AdServer-12-02-2026/client/src/components/advanced-map-drawer.tsx +1131 -0
  12. package/Influence-MW-AdServer-12-02-2026/client/src/components/ai-recommendation-panel.tsx +379 -0
  13. package/Influence-MW-AdServer-12-02-2026/client/src/components/app-sidebar.tsx +183 -0
  14. package/Influence-MW-AdServer-12-02-2026/client/src/components/auto-optimize-button.tsx +184 -0
  15. package/Influence-MW-AdServer-12-02-2026/client/src/components/availability-drawer.tsx +385 -0
  16. package/Influence-MW-AdServer-12-02-2026/client/src/components/brand-insights-panel.tsx +87 -0
  17. package/Influence-MW-AdServer-12-02-2026/client/src/components/create-agency-drawer.tsx +198 -0
  18. package/Influence-MW-AdServer-12-02-2026/client/src/components/create-brand-drawer.tsx +275 -0
  19. package/Influence-MW-AdServer-12-02-2026/client/src/components/creative-assignment.tsx +526 -0
  20. package/Influence-MW-AdServer-12-02-2026/client/src/components/data-table-toolbar.tsx +148 -0
  21. package/Influence-MW-AdServer-12-02-2026/client/src/components/data-table.tsx +158 -0
  22. package/Influence-MW-AdServer-12-02-2026/client/src/components/filter-drawer.tsx +356 -0
  23. package/Influence-MW-AdServer-12-02-2026/client/src/components/form-insights-panel.tsx +82 -0
  24. package/Influence-MW-AdServer-12-02-2026/client/src/components/geography-selector.tsx +699 -0
  25. package/Influence-MW-AdServer-12-02-2026/client/src/components/header-user-menu.tsx +178 -0
  26. package/Influence-MW-AdServer-12-02-2026/client/src/components/history-drawer.tsx +313 -0
  27. package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-availability-section.tsx +176 -0
  28. package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-format-drawer.tsx +173 -0
  29. package/Influence-MW-AdServer-12-02-2026/client/src/components/inventory-selector.tsx +401 -0
  30. package/Influence-MW-AdServer-12-02-2026/client/src/components/manual-inventory-drawer.tsx +368 -0
  31. package/Influence-MW-AdServer-12-02-2026/client/src/components/mapbox-map.tsx +368 -0
  32. package/Influence-MW-AdServer-12-02-2026/client/src/components/market-insights-panel.tsx +202 -0
  33. package/Influence-MW-AdServer-12-02-2026/client/src/components/media-owner-drawer.tsx +217 -0
  34. package/Influence-MW-AdServer-12-02-2026/client/src/components/metric-card.tsx +58 -0
  35. package/Influence-MW-AdServer-12-02-2026/client/src/components/page-header.tsx +27 -0
  36. package/Influence-MW-AdServer-12-02-2026/client/src/components/player-status-indicator.tsx +137 -0
  37. package/Influence-MW-AdServer-12-02-2026/client/src/components/poi-targeting-drawer.tsx +298 -0
  38. package/Influence-MW-AdServer-12-02-2026/client/src/components/recommendation-score-badge.tsx +102 -0
  39. package/Influence-MW-AdServer-12-02-2026/client/src/components/recommended-inventories-panel.tsx +248 -0
  40. package/Influence-MW-AdServer-12-02-2026/client/src/components/searchable-combobox.tsx +134 -0
  41. package/Influence-MW-AdServer-12-02-2026/client/src/components/signal-visualizations.tsx +407 -0
  42. package/Influence-MW-AdServer-12-02-2026/client/src/components/status-badge.tsx +35 -0
  43. package/Influence-MW-AdServer-12-02-2026/client/src/components/theme-provider.tsx +73 -0
  44. package/Influence-MW-AdServer-12-02-2026/client/src/components/theme-toggle.tsx +37 -0
  45. package/Influence-MW-AdServer-12-02-2026/client/src/components/traffic-slider.tsx +75 -0
  46. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/accordion.tsx +56 -0
  47. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/alert-dialog.tsx +139 -0
  48. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/alert.tsx +59 -0
  49. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/aspect-ratio.tsx +5 -0
  50. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/avatar.tsx +51 -0
  51. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/badge.tsx +38 -0
  52. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/breadcrumb.tsx +115 -0
  53. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/button.tsx +62 -0
  54. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/calendar.tsx +68 -0
  55. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/card.tsx +85 -0
  56. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/carousel.tsx +260 -0
  57. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/chart.tsx +365 -0
  58. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/checkbox.tsx +28 -0
  59. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/collapsible.tsx +11 -0
  60. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/command.tsx +151 -0
  61. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/context-menu.tsx +198 -0
  62. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/dialog.tsx +122 -0
  63. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/drawer.tsx +118 -0
  64. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/dropdown-menu.tsx +198 -0
  65. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/form.tsx +178 -0
  66. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/hover-card.tsx +29 -0
  67. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/input-otp.tsx +69 -0
  68. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/input.tsx +23 -0
  69. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/label.tsx +24 -0
  70. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/menubar.tsx +256 -0
  71. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/navigation-menu.tsx +128 -0
  72. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/pagination.tsx +117 -0
  73. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/popover.tsx +29 -0
  74. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/progress.tsx +28 -0
  75. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/radio-group.tsx +42 -0
  76. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/resizable.tsx +45 -0
  77. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/scroll-area.tsx +46 -0
  78. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/select.tsx +160 -0
  79. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/separator.tsx +29 -0
  80. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/sheet.tsx +140 -0
  81. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/sidebar.tsx +727 -0
  82. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/skeleton.tsx +15 -0
  83. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/slider.tsx +26 -0
  84. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/switch.tsx +27 -0
  85. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/table.tsx +117 -0
  86. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/tabs.tsx +53 -0
  87. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/textarea.tsx +22 -0
  88. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toast.tsx +127 -0
  89. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toaster.tsx +33 -0
  90. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toggle-group.tsx +61 -0
  91. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/toggle.tsx +43 -0
  92. package/Influence-MW-AdServer-12-02-2026/client/src/components/ui/tooltip.tsx +30 -0
  93. package/Influence-MW-AdServer-12-02-2026/client/src/components/vendor-stores-modal.tsx +336 -0
  94. package/Influence-MW-AdServer-12-02-2026/client/src/components/venue-type-drawer.tsx +359 -0
  95. package/Influence-MW-AdServer-12-02-2026/client/src/components/venue-type-selector.tsx +436 -0
  96. package/Influence-MW-AdServer-12-02-2026/client/src/hooks/use-mobile.tsx +19 -0
  97. package/Influence-MW-AdServer-12-02-2026/client/src/hooks/use-toast.ts +191 -0
  98. package/Influence-MW-AdServer-12-02-2026/client/src/index.css +244 -0
  99. package/Influence-MW-AdServer-12-02-2026/client/src/lib/queryClient.ts +57 -0
  100. package/Influence-MW-AdServer-12-02-2026/client/src/lib/utils.ts +39 -0
  101. package/Influence-MW-AdServer-12-02-2026/client/src/lib/venue-taxonomy.ts +532 -0
  102. package/Influence-MW-AdServer-12-02-2026/client/src/main.tsx +5 -0
  103. package/Influence-MW-AdServer-12-02-2026/client/src/pages/assign-creative.tsx +781 -0
  104. package/Influence-MW-AdServer-12-02-2026/client/src/pages/content-hub.tsx +995 -0
  105. package/Influence-MW-AdServer-12-02-2026/client/src/pages/custom-pois.tsx +431 -0
  106. package/Influence-MW-AdServer-12-02-2026/client/src/pages/dashboard.tsx +620 -0
  107. package/Influence-MW-AdServer-12-02-2026/client/src/pages/deal-detail.tsx +1062 -0
  108. package/Influence-MW-AdServer-12-02-2026/client/src/pages/deal-form.tsx +1570 -0
  109. package/Influence-MW-AdServer-12-02-2026/client/src/pages/deals.tsx +716 -0
  110. package/Influence-MW-AdServer-12-02-2026/client/src/pages/edit-creative-assignment.tsx +1051 -0
  111. package/Influence-MW-AdServer-12-02-2026/client/src/pages/geotargeting.tsx +675 -0
  112. package/Influence-MW-AdServer-12-02-2026/client/src/pages/integrations.tsx +425 -0
  113. package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-item-creatives.tsx +622 -0
  114. package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-item-form.tsx +3132 -0
  115. package/Influence-MW-AdServer-12-02-2026/client/src/pages/line-items.tsx +530 -0
  116. package/Influence-MW-AdServer-12-02-2026/client/src/pages/not-found.tsx +21 -0
  117. package/Influence-MW-AdServer-12-02-2026/client/src/pages/proof-of-play-upload.tsx +479 -0
  118. package/Influence-MW-AdServer-12-02-2026/client/src/pages/proof-of-play.tsx +880 -0
  119. package/Influence-MW-AdServer-12-02-2026/client/src/pages/reports.tsx +235 -0
  120. package/Influence-MW-AdServer-12-02-2026/client/src/pages/settings.tsx +652 -0
  121. package/Influence-MW-AdServer-12-02-2026/client/src/pages/signal-form.tsx +1117 -0
  122. package/Influence-MW-AdServer-12-02-2026/client/src/pages/signals.tsx +366 -0
  123. package/Influence-MW-AdServer-12-02-2026/client/src/pages/tags.tsx +332 -0
  124. package/Influence-MW-AdServer-12-02-2026/client/src/pages/venues.tsx +381 -0
  125. package/Influence-MW-AdServer-12-02-2026/client/src/types/mapbox-gl-draw.d.ts +37 -0
  126. package/Influence-MW-AdServer-12-02-2026/client/src/types/react-simple-maps.d.ts +57 -0
  127. package/Influence-MW-AdServer-12-02-2026/components.json +20 -0
  128. package/Influence-MW-AdServer-12-02-2026/docs/PRD.md +3373 -0
  129. package/Influence-MW-AdServer-12-02-2026/docs/influence-feature-mapping.csv +498 -0
  130. package/Influence-MW-AdServer-12-02-2026/drizzle.config.ts +14 -0
  131. package/Influence-MW-AdServer-12-02-2026/package-lock.json +9672 -0
  132. package/Influence-MW-AdServer-12-02-2026/package.json +118 -0
  133. package/Influence-MW-AdServer-12-02-2026/postcss.config.js +6 -0
  134. package/Influence-MW-AdServer-12-02-2026/replit.md +91 -0
  135. package/Influence-MW-AdServer-12-02-2026/script/build.ts +67 -0
  136. package/Influence-MW-AdServer-12-02-2026/scripts/create-miro-diagrams.cjs +318 -0
  137. package/Influence-MW-AdServer-12-02-2026/scripts/create-remaining-diagrams.cjs +270 -0
  138. package/Influence-MW-AdServer-12-02-2026/server/index.ts +103 -0
  139. package/Influence-MW-AdServer-12-02-2026/server/recommendation-service.ts +319 -0
  140. package/Influence-MW-AdServer-12-02-2026/server/routes.ts +1890 -0
  141. package/Influence-MW-AdServer-12-02-2026/server/static.ts +19 -0
  142. package/Influence-MW-AdServer-12-02-2026/server/storage.ts +2058 -0
  143. package/Influence-MW-AdServer-12-02-2026/server/vite.ts +58 -0
  144. package/Influence-MW-AdServer-12-02-2026/shared/schema.ts +1595 -0
  145. package/Influence-MW-AdServer-12-02-2026/tailwind.config.ts +107 -0
  146. package/Influence-MW-AdServer-12-02-2026/tsconfig.json +23 -0
  147. package/Influence-MW-AdServer-12-02-2026/vite.config.ts +40 -0
  148. package/LINE_ITEM_BUDGET_FIELD_MAPPING.md +178 -0
  149. package/PCM/.env.example +92 -0
  150. package/PCM/README.md +558 -0
  151. package/PCM/docs/TEST_CASES.md +422 -0
  152. package/PCM/index.js +106 -0
  153. package/PCM/package-lock.json +3282 -0
  154. package/PCM/package.json +32 -0
  155. package/PCM/replit.md +64 -0
  156. package/PCM/schema.sql +495 -0
  157. package/PCM/scripts/export-schema.js +183 -0
  158. package/PCM/scripts/seed-comprehensive.js +631 -0
  159. package/PCM/scripts/seed-production.js +477 -0
  160. package/PCM/src/config/db.js +56 -0
  161. package/PCM/src/config/swagger.js +5975 -0
  162. package/PCM/src/dto/EmailRequestDTO.js +166 -0
  163. package/PCM/src/middleware/errorHandler.js +52 -0
  164. package/PCM/src/middleware/logger.js +26 -0
  165. package/PCM/src/migrations/001_add_campaign_mode_fields.sql +36 -0
  166. package/PCM/src/migrations/002_create_deal_id_counters.sql +22 -0
  167. package/PCM/src/migrations/003_update_publishers_column.sql +15 -0
  168. package/PCM/src/migrations/004_add_direct_dealtype_and_advertiser.sql +5 -0
  169. package/PCM/src/migrations/005_add_programmatic_fields_and_update_enums.sql +31 -0
  170. package/PCM/src/migrations/006_add_line_item_programmatic_fields.sql +12 -0
  171. package/PCM/src/migrations/007_add_line_item_direct_fields.sql +15 -0
  172. package/PCM/src/migrations/008_add_inventory_fields.sql +45 -0
  173. package/PCM/src/migrations/009_move_inventory_fields_to_metadata.sql +32 -0
  174. package/PCM/src/migrations/010_add_draft_status_and_line_items_count.sql +23 -0
  175. package/PCM/src/migrations/011_add_planning_field.sql +21 -0
  176. package/PCM/src/migrations/012_fix_inventory_composite_pk.sql +17 -0
  177. package/PCM/src/migrations/013_make_external_id_optional.sql +3 -0
  178. package/PCM/src/migrations/014_create_change_history.sql +38 -0
  179. package/PCM/src/migrations/016_create_publisher_insertion_orders.sql +33 -0
  180. package/PCM/src/migrations/017_fix_line_item_id_fk_reference.sql +86 -0
  181. package/PCM/src/migrations/018_create_approval_tables.sql +44 -0
  182. package/PCM/src/migrations/019_add_encrypted_token_column.sql +2 -0
  183. package/PCM/src/migrations/020_add_rejection_reason_to_deals.sql +10 -0
  184. package/PCM/src/migrations/021_add_publisher_external_id_to_inventories.sql +12 -0
  185. package/PCM/src/migrations/022_add_line_item_extended_fields.sql +24 -0
  186. package/PCM/src/migrations/023_add_base_price_fields.sql +8 -0
  187. package/PCM/src/migrations/run-migrations.js +46 -0
  188. package/PCM/src/models/ApprovalOTP.js +51 -0
  189. package/PCM/src/models/ApprovalToken.js +79 -0
  190. package/PCM/src/models/ChangeHistory.js +107 -0
  191. package/PCM/src/models/Deal.js +186 -0
  192. package/PCM/src/models/DealIdCounter.js +28 -0
  193. package/PCM/src/models/LineItem.js +227 -0
  194. package/PCM/src/models/LineItemCreative.js +89 -0
  195. package/PCM/src/models/LineItemInventory.js +115 -0
  196. package/PCM/src/models/PublisherInsertionOrder.js +93 -0
  197. package/PCM/src/models/TransactionHistory.js +34 -0
  198. package/PCM/src/models/associations.js +81 -0
  199. package/PCM/src/routes/approval.js +321 -0
  200. package/PCM/src/routes/creatives.js +437 -0
  201. package/PCM/src/routes/deals.js +1638 -0
  202. package/PCM/src/routes/digitalSignage.js +242 -0
  203. package/PCM/src/routes/insertionOrders.js +380 -0
  204. package/PCM/src/routes/lineItems.js +926 -0
  205. package/PCM/src/routes/system.js +384 -0
  206. package/PCM/src/services/ApprovalService.js +885 -0
  207. package/PCM/src/services/CampaignImportConverter.js +631 -0
  208. package/PCM/src/services/CampaignModeService.js +273 -0
  209. package/PCM/src/services/CampaignStatusService.js +395 -0
  210. package/PCM/src/services/ChangeHistoryService.js +316 -0
  211. package/PCM/src/services/DealIdService.js +94 -0
  212. package/PCM/src/services/DealResponseFormatter.js +90 -0
  213. package/PCM/src/services/EmailNotificationService.js +315 -0
  214. package/PCM/src/services/LineItemResponseFormatter.js +122 -0
  215. package/PCM/src/services/LineItemStatusService.js +380 -0
  216. package/PCM/src/tests/comprehensiveTestRunner.js +360 -0
  217. package/PCM/src/tests/comprehensiveTests.js +1277 -0
  218. package/PCM/src/tests/dealTypeUnitTests.js +1058 -0
  219. package/PCM/src/tests/testRunner.js +248 -0
  220. package/PCM/src/utils/caseConverter.js +92 -0
  221. package/PCM/src/utils/dealCalculations.js +206 -0
  222. package/PCM/src/utils/lineItemPayloadNormalizer.js +41 -0
  223. package/PCM/src/utils/payloadNormalizer.js +34 -0
  224. package/PCM/src/utils/sourceNormalizer.js +56 -0
  225. package/PCM/src/validators/creativeValidator.js +27 -0
  226. package/PCM/src/validators/dealValidator.js +203 -0
  227. package/PCM/src/validators/lineItemValidator.js +489 -0
  228. package/PCM/tests/approval-flows.test.js +238 -0
  229. package/PCM/tests/approval-workflow.test.js +291 -0
  230. package/PCM/tests/campaign-import-converter.test.js +543 -0
  231. package/PCM/tests/campaign-import-e2e.test.js +520 -0
  232. package/PCM/tests/campaign-status.test.js +539 -0
  233. package/PCM/tests/direct-publisher-split-reimport.test.js +460 -0
  234. package/PCM/tests/e2e/digital-signage.test.js +145 -0
  235. package/PCM/tests/e2e/search-filter-pagination.test.js +399 -0
  236. package/PCM/tests/e2e-comprehensive.test.js +3446 -0
  237. package/PCM/tests/edge-cases.test.js +340 -0
  238. package/PCM/tests/line-item-status.test.js +340 -0
  239. package/PCM/tests/seller-account-external-ids.test.js +877 -0
  240. package/PCM/tests/source-validation.test.js +324 -0
  241. package/PRD.md +3373 -0
  242. package/README.md +186 -0
  243. package/client/index.html +35 -0
  244. package/client/public/DEMO_STATUS.md +579 -0
  245. package/client/public/img/MW-logo-trans_1754045676555.png +0 -0
  246. package/client/public/locales/ar/approval.json +144 -0
  247. package/client/public/locales/ar/buyer.json +61 -0
  248. package/client/public/locales/ar/campaigns.json +1 -0
  249. package/client/public/locales/ar/common.json +218 -0
  250. package/client/public/locales/ar/contentHub.json +266 -0
  251. package/client/public/locales/ar/creatives.json +79 -0
  252. package/client/public/locales/ar/dashboard.json +57 -0
  253. package/client/public/locales/ar/deals.json +886 -0
  254. package/client/public/locales/ar/dsp.json +131 -0
  255. package/client/public/locales/ar/inventory.json +201 -0
  256. package/client/public/locales/ar/lineItems.json +553 -0
  257. package/client/public/locales/ar/navigation.json +48 -0
  258. package/client/public/locales/ar/wizard.json +1 -0
  259. package/client/public/locales/en/approval.json +144 -0
  260. package/client/public/locales/en/buyer.json +65 -0
  261. package/client/public/locales/en/campaigns.json +1 -0
  262. package/client/public/locales/en/common.json +218 -0
  263. package/client/public/locales/en/contentHub.json +266 -0
  264. package/client/public/locales/en/creatives.json +79 -0
  265. package/client/public/locales/en/dashboard.json +57 -0
  266. package/client/public/locales/en/deals.json +886 -0
  267. package/client/public/locales/en/dsp.json +131 -0
  268. package/client/public/locales/en/inventory.json +201 -0
  269. package/client/public/locales/en/lineItems.json +659 -0
  270. package/client/public/locales/en/navigation.json +48 -0
  271. package/client/public/locales/en/wizard.json +1 -0
  272. package/client/public/locales/ja/approval.json +144 -0
  273. package/client/public/locales/ja/buyer.json +61 -0
  274. package/client/public/locales/ja/campaigns.json +1 -0
  275. package/client/public/locales/ja/common.json +218 -0
  276. package/client/public/locales/ja/contentHub.json +266 -0
  277. package/client/public/locales/ja/creatives.json +79 -0
  278. package/client/public/locales/ja/dashboard.json +57 -0
  279. package/client/public/locales/ja/deals.json +886 -0
  280. package/client/public/locales/ja/dsp.json +131 -0
  281. package/client/public/locales/ja/inventory.json +201 -0
  282. package/client/public/locales/ja/lineItems.json +553 -0
  283. package/client/public/locales/ja/navigation.json +48 -0
  284. package/client/public/locales/ja/wizard.json +1 -0
  285. package/client/public/locales/zh/approval.json +144 -0
  286. package/client/public/locales/zh/buyer.json +61 -0
  287. package/client/public/locales/zh/campaigns.json +1 -0
  288. package/client/public/locales/zh/common.json +218 -0
  289. package/client/public/locales/zh/contentHub.json +266 -0
  290. package/client/public/locales/zh/creatives.json +79 -0
  291. package/client/public/locales/zh/dashboard.json +57 -0
  292. package/client/public/locales/zh/deals.json +886 -0
  293. package/client/public/locales/zh/dsp.json +131 -0
  294. package/client/public/locales/zh/inventory.json +201 -0
  295. package/client/public/locales/zh/lineItems.json +553 -0
  296. package/client/public/locales/zh/navigation.json +48 -0
  297. package/client/public/locales/zh/wizard.json +1 -0
  298. package/client/public/manifest.json +36 -0
  299. package/client/src/App.tsx +464 -0
  300. package/client/src/components/app-sidebar.tsx +312 -0
  301. package/client/src/components/approval/approval-decision-form.test.tsx +294 -0
  302. package/client/src/components/approval/approval-decision-form.tsx +326 -0
  303. package/client/src/components/approval/approval-sheet.tsx +631 -0
  304. package/client/src/components/approval/line-item-details-sheet.tsx +371 -0
  305. package/client/src/components/approval/otp-verification.test.tsx +337 -0
  306. package/client/src/components/approval/otp-verification.tsx +180 -0
  307. package/client/src/components/content-hub/bulk-transcode-dialog.tsx +379 -0
  308. package/client/src/components/content-hub/content-hub-manager-v2.tsx +574 -0
  309. package/client/src/components/content-hub/content-hub-manager.tsx +330 -0
  310. package/client/src/components/content-hub/creative-card.tsx +456 -0
  311. package/client/src/components/content-hub/creative-detail-sheet.tsx +685 -0
  312. package/client/src/components/content-hub/creative-filters.tsx +457 -0
  313. package/client/src/components/content-hub/creative-grid.tsx +329 -0
  314. package/client/src/components/content-hub/creative-selector.tsx +415 -0
  315. package/client/src/components/content-hub/creative-upload.tsx +547 -0
  316. package/client/src/components/content-hub/folder-dialogs.tsx +445 -0
  317. package/client/src/components/content-hub/folder-list.tsx +280 -0
  318. package/client/src/components/content-hub/review-dialogs.tsx +268 -0
  319. package/client/src/components/content-hub/transcode-dialog.tsx +226 -0
  320. package/client/src/components/creative-library/creative-details-view.tsx +446 -0
  321. package/client/src/components/creative-library/creative-filters-panel.tsx +203 -0
  322. package/client/src/components/creative-library/creative-list.tsx +360 -0
  323. package/client/src/components/creative-library/creative-status-badge.tsx +71 -0
  324. package/client/src/components/creative-library/folder-card.tsx +78 -0
  325. package/client/src/components/creative-library/index.ts +27 -0
  326. package/client/src/components/creative-library/new-creative-card.tsx +211 -0
  327. package/client/src/components/creative-library/upload-creative-dialog.tsx +261 -0
  328. package/client/src/components/dashboard-overview.tsx +109 -0
  329. package/client/src/components/deals/approval-history-panel.test.tsx +240 -0
  330. package/client/src/components/deals/approval-history-panel.tsx +156 -0
  331. package/client/src/components/deals/deal-status-badge.tsx +92 -0
  332. package/client/src/components/deals/import-from-planner-dialog.tsx +399 -0
  333. package/client/src/components/deals/market-insights-panel.tsx +237 -0
  334. package/client/src/components/deals/reopen-deal-sheet.tsx +191 -0
  335. package/client/src/components/deals/request-approval-sheet.test.tsx +323 -0
  336. package/client/src/components/deals/request-approval-sheet.tsx +136 -0
  337. package/client/src/components/deals/resend-approval-sheet.tsx +201 -0
  338. package/client/src/components/direct-campaigns/campaign-card.tsx +283 -0
  339. package/client/src/components/direct-campaigns/deal-filter-panel.tsx +325 -0
  340. package/client/src/components/inventory/advanced-filters-panel.tsx +273 -0
  341. package/client/src/components/inventory/csv-upload-modal.tsx +639 -0
  342. package/client/src/components/inventory/inventory-availability-view.tsx +486 -0
  343. package/client/src/components/inventory/inventory-details-sheet.tsx +376 -0
  344. package/client/src/components/inventory/inventory-map-view.tsx +596 -0
  345. package/client/src/components/inventory/inventory-settings-menu.tsx +52 -0
  346. package/client/src/components/language-switcher.tsx +53 -0
  347. package/client/src/components/line-items/campaign-forecast-panel.tsx +138 -0
  348. package/client/src/components/line-items/form-insights.tsx +89 -0
  349. package/client/src/components/line-items/geofencing/LocationCsvUploadDrawer.tsx +100 -0
  350. package/client/src/components/line-items/geofencing/POIDropdown.tsx +379 -0
  351. package/client/src/components/line-items/geofencing/SelectedLocationsSidebar.tsx +436 -0
  352. package/client/src/components/line-items/geofencing/ViewFileLocationDrawer.tsx +199 -0
  353. package/client/src/components/line-items/geofencing/components/ExistingFilesTab.tsx +268 -0
  354. package/client/src/components/line-items/geofencing/components/TemplateDownloadSection.tsx +59 -0
  355. package/client/src/components/line-items/geofencing/components/UploadTab.tsx +215 -0
  356. package/client/src/components/line-items/geofencing-map.tsx +1270 -0
  357. package/client/src/components/line-items/inventory-availability-section.tsx +178 -0
  358. package/client/src/components/line-items/line-item-schedule-manager.tsx +313 -0
  359. package/client/src/components/line-items/manual-inventory-drawer.tsx +346 -0
  360. package/client/src/components/line-items/planner-inventory-card.tsx +495 -0
  361. package/client/src/components/line-items/planner-schedule-grid.tsx +495 -0
  362. package/client/src/components/line-items/schedule-rule-editor.tsx +649 -0
  363. package/client/src/components/line-items/schedule-rule-types.ts +122 -0
  364. package/client/src/components/line-items/steps/creatives-step.tsx +681 -0
  365. package/client/src/components/line-items/steps/inventory-schedule-step.tsx +1596 -0
  366. package/client/src/components/line-items/steps/inventory-step.tsx +1533 -0
  367. package/client/src/components/line-items/steps/line-item-details-step.tsx +916 -0
  368. package/client/src/components/line-items/steps/schedule-step.tsx +273 -0
  369. package/client/src/components/line-items/steps/summary-step.tsx +680 -0
  370. package/client/src/components/line-items/steps/targeting-step.tsx +1708 -0
  371. package/client/src/components/product-switcher.tsx +105 -0
  372. package/client/src/components/protected-route.tsx +49 -0
  373. package/client/src/components/skip-link.tsx +22 -0
  374. package/client/src/components/stat-card.tsx +53 -0
  375. package/client/src/components/status-badge.tsx +96 -0
  376. package/client/src/components/ui/hierarchical-venue-selector.tsx +389 -0
  377. package/client/src/components/ui/toaster.tsx +111 -0
  378. package/client/src/contexts/auth-context.tsx +181 -0
  379. package/client/src/contexts/sidebar-state.tsx +50 -0
  380. package/client/src/contexts/theme-context.tsx +66 -0
  381. package/client/src/data/campaign-data.json +107 -0
  382. package/client/src/data/countries.json +22 -0
  383. package/client/src/hooks/use-approval.ts +366 -0
  384. package/client/src/hooks/use-keyboard-shortcuts.ts +74 -0
  385. package/client/src/hooks/use-media-query.ts +46 -0
  386. package/client/src/hooks/use-mobile.tsx +19 -0
  387. package/client/src/hooks/use-page-title.ts +21 -0
  388. package/client/src/hooks/use-toast.ts +195 -0
  389. package/client/src/index.css +694 -0
  390. package/client/src/lib/__tests__/accessibility.test.ts +104 -0
  391. package/client/src/lib/__tests__/date-utils.test.ts +199 -0
  392. package/client/src/lib/__tests__/dsp-buyer-api.test.ts +127 -0
  393. package/client/src/lib/__tests__/dsp-buyer-integration.test.ts +247 -0
  394. package/client/src/lib/__tests__/storage-utils.test.ts +167 -0
  395. package/client/src/lib/__tests__/utils.test.ts +57 -0
  396. package/client/src/lib/accessibility.ts +141 -0
  397. package/client/src/lib/api-config.ts +9 -0
  398. package/client/src/lib/auth-service.ts +209 -0
  399. package/client/src/lib/campaign-creative-api.ts +82 -0
  400. package/client/src/lib/company-api.ts +61 -0
  401. package/client/src/lib/content-hub-api.ts +407 -0
  402. package/client/src/lib/creative-mapper.ts +61 -0
  403. package/client/src/lib/date-utils.ts +119 -0
  404. package/client/src/lib/deal-helpers.ts +220 -0
  405. package/client/src/lib/dsp-buyer-api.ts +196 -0
  406. package/client/src/lib/geo-import-api.ts +151 -0
  407. package/client/src/lib/google-poi-api.ts +305 -0
  408. package/client/src/lib/i18n/__tests__/formatting.test.ts +202 -0
  409. package/client/src/lib/i18n/formatting.ts +130 -0
  410. package/client/src/lib/i18n/index.ts +8 -0
  411. package/client/src/lib/i18n-compat.ts +76 -0
  412. package/client/src/lib/influence-deals-api.ts +896 -0
  413. package/client/src/lib/inventory-api.ts +399 -0
  414. package/client/src/lib/oauth-service.ts +678 -0
  415. package/client/src/lib/poi-types.ts +75 -0
  416. package/client/src/lib/queryClient.ts +144 -0
  417. package/client/src/lib/recommendation-api.ts +380 -0
  418. package/client/src/lib/storage-utils.ts +104 -0
  419. package/client/src/lib/tolgee.ts +85 -0
  420. package/client/src/lib/utils.ts +0 -0
  421. package/client/src/main.tsx +67 -0
  422. package/client/src/mapbox-draw-modes.d.ts +32 -0
  423. package/client/src/pages/all-folders.tsx +203 -0
  424. package/client/src/pages/auth-callback.tsx +115 -0
  425. package/client/src/pages/buyer-form.tsx +339 -0
  426. package/client/src/pages/buyer-list.tsx +622 -0
  427. package/client/src/pages/content-hub.tsx +1358 -0
  428. package/client/src/pages/create-deal.tsx +2093 -0
  429. package/client/src/pages/creative-assignment-page.tsx +548 -0
  430. package/client/src/pages/creatives.tsx +5 -0
  431. package/client/src/pages/custom-pois.tsx +425 -0
  432. package/client/src/pages/dashboard.tsx +615 -0
  433. package/client/src/pages/deal-history.tsx +434 -0
  434. package/client/src/pages/deal-line-items.tsx +1703 -0
  435. package/client/src/pages/demo-status.tsx +113 -0
  436. package/client/src/pages/direct-campaign-details.tsx +361 -0
  437. package/client/src/pages/direct-campaigns-new.tsx +824 -0
  438. package/client/src/pages/dsp-form.tsx +803 -0
  439. package/client/src/pages/dsp-list.tsx +239 -0
  440. package/client/src/pages/folder-content.tsx +336 -0
  441. package/client/src/pages/integrations.tsx +429 -0
  442. package/client/src/pages/line-item-creatives.tsx +789 -0
  443. package/client/src/pages/line-item-detail-page.tsx +684 -0
  444. package/client/src/pages/line-item-form-page.tsx +3261 -0
  445. package/client/src/pages/line-item-wizard.tsx +1207 -0
  446. package/client/src/pages/login.tsx +154 -0
  447. package/client/src/pages/not-found.tsx +23 -0
  448. package/client/src/pages/proof-of-play.tsx +397 -0
  449. package/client/src/pages/public-approval.tsx +551 -0
  450. package/client/src/pages/reports.tsx +231 -0
  451. package/client/src/pages/settings.tsx +760 -0
  452. package/client/src/pages/signals.tsx +389 -0
  453. package/client/src/pages/tags.tsx +318 -0
  454. package/client/src/pages/test-results.tsx +328 -0
  455. package/client/src/store/hooks.ts +5 -0
  456. package/client/src/store/index.ts +15 -0
  457. package/client/src/store/mapMarkerLocationsSlice.ts +241 -0
  458. package/client/src/styles/design-tokens.css +324 -0
  459. package/client/src/test/setup.ts +261 -0
  460. package/client/src/test/test-utils.tsx +40 -0
  461. package/client/src/types/approval.ts +221 -0
  462. package/client/src/types/content-hub.ts +209 -0
  463. package/client/src/types/geofencing.ts +67 -0
  464. package/client/src/types/transcoding.ts +140 -0
  465. package/client/src/vite-env.d.ts +18 -0
  466. package/components.json +20 -0
  467. package/creative-api.json +1 -0
  468. package/docs/AI_REFERENCE.md +459 -0
  469. package/docs/MWDesign-Prompt.md +132 -0
  470. package/docs/MWDesign-System.md +344 -0
  471. package/docs/test-plan.md +277 -0
  472. package/e2e/AUTONOMOUS-TESTING.md +406 -0
  473. package/e2e/README.md +219 -0
  474. package/e2e/autonomous-flow.spec.ts +308 -0
  475. package/e2e/debug-sso.spec.ts +163 -0
  476. package/e2e/direct-campaigns.spec.ts +219 -0
  477. package/e2e/explore-sso.spec.ts +149 -0
  478. package/e2e/fixtures/auth.ts +26 -0
  479. package/e2e/fixtures/enhanced-test.ts +331 -0
  480. package/e2e/pagination.spec.ts +280 -0
  481. package/e2e/view-toggle.spec.ts +312 -0
  482. package/generated-icon.png +0 -0
  483. package/i18next-scanner.config.cjs +46 -0
  484. package/package.json +141 -0
  485. package/playwright.config.ts +93 -0
  486. package/postcss.config.js +6 -0
  487. package/replit.md +196 -0
  488. package/screenshot-after-login.png +0 -0
  489. package/screenshot-contenthub-grid.png +0 -0
  490. package/screenshot-contenthub-list-fixed.png +0 -0
  491. package/screenshot-contenthub-list.png +0 -0
  492. package/screenshot-create-deal.png +0 -0
  493. package/screenshot-dashboard.png +0 -0
  494. package/screenshot-deals.png +0 -0
  495. package/screenshot-login-filled.png +0 -0
  496. package/screenshot-login.png +0 -0
  497. package/screenshot.mjs +24 -0
  498. package/scripts/deploy-stg.sh +185 -0
  499. package/shared/direct-io-schema.ts +383 -0
  500. package/shared/schema.ts +439 -0
  501. package/shared/screen-types.ts +149 -0
  502. package/springdocDefault.json +1 -0
  503. package/swagger-ui-bundle.js +2 -0
  504. package/swagger-ui-init.js +10316 -0
  505. package/tailwind.config.ts +282 -0
  506. package/terraform/README.md +306 -0
  507. package/terraform/cloudfront.tf +289 -0
  508. package/terraform/ecs.tf +727 -0
  509. package/terraform/environments/dev.tfvars +59 -0
  510. package/terraform/environments/production.tfvars +60 -0
  511. package/terraform/main.tf +47 -0
  512. package/terraform/outputs.tf +145 -0
  513. package/terraform/s3.tf +192 -0
  514. package/terraform/variables.tf +226 -0
  515. package/terraform/waf.tf +165 -0
  516. package/terraform-frontend/.terraform.lock.hcl +25 -0
  517. package/terraform-frontend/README.md +85 -0
  518. package/terraform-frontend/cloudfront.tf +125 -0
  519. package/terraform-frontend/main.tf +31 -0
  520. package/terraform-frontend/outputs.tf +24 -0
  521. package/terraform-frontend/terraform.tfvars +12 -0
  522. package/terraform-frontend/variables.tf +53 -0
  523. package/tsconfig.json +23 -0
  524. package/vite.config.ts +226 -0
  525. package/vitest.config.ts +56 -0
@@ -0,0 +1,1277 @@
1
+ /**
2
+ * Comprehensive E2E Tests
3
+ *
4
+ * Categories:
5
+ * 1. Deal Types - All supported types + negative tests (7 tests)
6
+ * 2. Schedule Types - ALL_TIME, ON_SCHEDULE + negative tests (7 tests: 2 valid, 5 negative)
7
+ * 3. Line Items - CRUD operations (3 tests)
8
+ * 4. Bulk Import - Valid and invalid data (3 tests)
9
+ * 5. Date Range Validation - start_date < end_date (3 tests)
10
+ * 6. Timezone Consistency - Must be same across line items (2 tests)
11
+ * 7. Aggregation Logic - Deal-level aggregation from line items (3 tests)
12
+ * 8. Validation - Missing required fields (5 tests)
13
+ * 9. Campaign Mode - PROGRAMMATIC and DIRECT workflow tests (10 tests: 5 valid, 5 negative)
14
+ *
15
+ * Total: 43 tests
16
+ */
17
+
18
+ export const comprehensiveTests = [
19
+ // ==================== DEAL TYPE TESTS ====================
20
+
21
+ // POSITIVE: All supported deal types
22
+ {
23
+ id: 'DEAL_TYPE_001',
24
+ name: 'GUARANTEED deal type - valid',
25
+ category: 'DEAL_TYPES',
26
+ endpoint: 'POST /deals',
27
+ payload: {
28
+ source: 'COMP_TEST',
29
+ externalId: 'DT-GUARANTEED',
30
+ dealType: 'GUARANTEED',
31
+ name: 'Guaranteed Deal Test',
32
+ costType: 'CPM',
33
+ currency: 'USD'
34
+ },
35
+ expectedStatus: 201,
36
+ expectedDealIdPrefix: 'GD-I-'
37
+ },
38
+ {
39
+ id: 'DEAL_TYPE_002',
40
+ name: 'PREFERRED_DEAL type - valid',
41
+ category: 'DEAL_TYPES',
42
+ endpoint: 'POST /deals',
43
+ payload: {
44
+ source: 'COMP_TEST',
45
+ externalId: 'DT-PREFERRED',
46
+ dealType: 'PREFERRED_DEAL',
47
+ name: 'Preferred Deal Test'
48
+ },
49
+ expectedStatus: 201,
50
+ expectedDealIdPrefix: 'PD-I-'
51
+ },
52
+ {
53
+ id: 'DEAL_TYPE_003',
54
+ name: 'PRIVATE_AUCTION type - valid',
55
+ category: 'DEAL_TYPES',
56
+ endpoint: 'POST /deals',
57
+ payload: {
58
+ source: 'COMP_TEST',
59
+ externalId: 'DT-PRIVATE',
60
+ dealType: 'PRIVATE_AUCTION',
61
+ auctionType: 2,
62
+ name: 'Private Auction Test'
63
+ },
64
+ expectedStatus: 201,
65
+ expectedDealIdPrefix: 'PA-I-'
66
+ },
67
+ {
68
+ id: 'DEAL_TYPE_004',
69
+ name: 'EVERGREEN_PMP type - valid',
70
+ category: 'DEAL_TYPES',
71
+ endpoint: 'POST /deals',
72
+ payload: {
73
+ source: 'COMP_TEST',
74
+ externalId: 'DT-EVERGREEN',
75
+ dealType: 'EVERGREEN_PMP',
76
+ name: 'Evergreen PMP Test'
77
+ },
78
+ expectedStatus: 201,
79
+ expectedDealIdPrefix: 'EG-I-'
80
+ },
81
+
82
+ // NEGATIVE: Unsupported deal types
83
+ {
84
+ id: 'DEAL_TYPE_NEG_001',
85
+ name: 'Invalid deal type - OPEN_AUCTION (unsupported)',
86
+ category: 'DEAL_TYPES',
87
+ endpoint: 'POST /deals',
88
+ payload: {
89
+ source: 'COMP_TEST',
90
+ externalId: 'DT-INVALID-001',
91
+ dealType: 'OPEN_AUCTION'
92
+ },
93
+ expectedStatus: 400,
94
+ expectedError: 'dealType'
95
+ },
96
+ {
97
+ id: 'DEAL_TYPE_NEG_002',
98
+ name: 'Invalid deal type - PROGRAMMATIC (unsupported)',
99
+ category: 'DEAL_TYPES',
100
+ endpoint: 'POST /deals',
101
+ payload: {
102
+ source: 'COMP_TEST',
103
+ externalId: 'DT-INVALID-002',
104
+ dealType: 'PROGRAMMATIC'
105
+ },
106
+ expectedStatus: 400,
107
+ expectedError: 'dealType'
108
+ },
109
+ {
110
+ id: 'DEAL_TYPE_NEG_003',
111
+ name: 'Missing deal type',
112
+ category: 'DEAL_TYPES',
113
+ endpoint: 'POST /deals',
114
+ payload: {
115
+ source: 'COMP_TEST',
116
+ externalId: 'DT-INVALID-003'
117
+ },
118
+ expectedStatus: 201 // dealType is optional, should succeed
119
+ },
120
+
121
+ // ==================== SCHEDULE TYPE TESTS ====================
122
+
123
+ // POSITIVE: Valid schedule types
124
+ {
125
+ id: 'SCHEDULE_001',
126
+ name: 'Schedule type ALL_TIME - valid',
127
+ category: 'SCHEDULE_TYPES',
128
+ endpoint: 'POST /line-items',
129
+ payload: {
130
+ source: 'COMP_TEST',
131
+ externalId: 'SCH-ALLTIME',
132
+ dealType: 'PREFERRED_DEAL',
133
+ schedule: {
134
+ type: 'ALL_TIME',
135
+ source: 'inventory',
136
+ blocks: [
137
+ { day: 'MONDAY', start: '06:00', end: '23:59' },
138
+ { day: 'TUESDAY', start: '06:00', end: '23:59' },
139
+ { day: 'WEDNESDAY', start: '06:00', end: '23:59' },
140
+ { day: 'THURSDAY', start: '06:00', end: '23:59' },
141
+ { day: 'FRIDAY', start: '06:00', end: '23:59' },
142
+ { day: 'SATURDAY', start: '08:00', end: '22:00' },
143
+ { day: 'SUNDAY', start: '08:00', end: '22:00' }
144
+ ]
145
+ },
146
+ netCost: 1000
147
+ },
148
+ expectedStatus: 201
149
+ },
150
+ {
151
+ id: 'SCHEDULE_002',
152
+ name: 'Schedule type ON_SCHEDULE with all fields - valid',
153
+ category: 'SCHEDULE_TYPES',
154
+ endpoint: 'POST /line-items',
155
+ payload: {
156
+ source: 'COMP_TEST',
157
+ externalId: 'SCH-ONSCHEDULE',
158
+ dealType: 'PREFERRED_DEAL',
159
+ schedule: {
160
+ type: 'ON_SCHEDULE',
161
+ source: 'advertiser',
162
+ blocks: [
163
+ { day: 'MONDAY', start: '17:00', end: '18:00' },
164
+ { day: 'THURSDAY', start: '19:00', end: '20:00' },
165
+ { day: 'FRIDAY', start: '12:00', end: '13:00' }
166
+ ]
167
+ },
168
+ netCost: 2000
169
+ },
170
+ expectedStatus: 201
171
+ },
172
+
173
+ // NEGATIVE: Invalid schedule types
174
+ {
175
+ id: 'SCHEDULE_NEG_001',
176
+ name: 'Invalid schedule type - CUSTOM (unsupported)',
177
+ category: 'SCHEDULE_TYPES',
178
+ endpoint: 'POST /line-items',
179
+ payload: {
180
+ source: 'COMP_TEST',
181
+ externalId: 'SCH-INVALID-001',
182
+ dealType: 'PREFERRED_DEAL',
183
+ schedule: {
184
+ type: 'CUSTOM',
185
+ source: 'advertiser',
186
+ blocks: [{ day: 'MONDAY', start: '09:00', end: '17:00' }]
187
+ },
188
+ netCost: 1000
189
+ },
190
+ expectedStatus: 400,
191
+ expectedError: 'type'
192
+ },
193
+ {
194
+ id: 'SCHEDULE_NEG_002',
195
+ name: 'Invalid schedule type - RECURRING (unsupported)',
196
+ category: 'SCHEDULE_TYPES',
197
+ endpoint: 'POST /line-items',
198
+ payload: {
199
+ source: 'COMP_TEST',
200
+ externalId: 'SCH-INVALID-002',
201
+ dealType: 'PREFERRED_DEAL',
202
+ schedule: {
203
+ type: 'RECURRING',
204
+ source: 'advertiser',
205
+ blocks: [{ day: 'MONDAY', start: '09:00', end: '17:00' }]
206
+ },
207
+ netCost: 1000
208
+ },
209
+ expectedStatus: 400,
210
+ expectedError: 'type'
211
+ },
212
+ {
213
+ id: 'SCHEDULE_NEG_003',
214
+ name: 'Schedule missing source field',
215
+ category: 'SCHEDULE_TYPES',
216
+ endpoint: 'POST /line-items',
217
+ payload: {
218
+ source: 'COMP_TEST',
219
+ externalId: 'SCH-INVALID-003',
220
+ dealType: 'PREFERRED_DEAL',
221
+ schedule: {
222
+ type: 'ON_SCHEDULE',
223
+ blocks: [{ day: 'MONDAY', start: '09:00', end: '17:00' }]
224
+ },
225
+ netCost: 1000
226
+ },
227
+ expectedStatus: 400,
228
+ expectedError: 'source'
229
+ },
230
+ {
231
+ id: 'SCHEDULE_NEG_004',
232
+ name: 'Schedule missing blocks field',
233
+ category: 'SCHEDULE_TYPES',
234
+ endpoint: 'POST /line-items',
235
+ payload: {
236
+ source: 'COMP_TEST',
237
+ externalId: 'SCH-INVALID-004',
238
+ dealType: 'PREFERRED_DEAL',
239
+ schedule: {
240
+ type: 'ON_SCHEDULE',
241
+ source: 'advertiser'
242
+ },
243
+ netCost: 1000
244
+ },
245
+ expectedStatus: 400,
246
+ expectedError: 'blocks'
247
+ },
248
+ {
249
+ id: 'SCHEDULE_NEG_005',
250
+ name: 'Schedule with empty blocks array',
251
+ category: 'SCHEDULE_TYPES',
252
+ endpoint: 'POST /line-items',
253
+ payload: {
254
+ source: 'COMP_TEST',
255
+ externalId: 'SCH-INVALID-005',
256
+ dealType: 'PREFERRED_DEAL',
257
+ schedule: {
258
+ type: 'ON_SCHEDULE',
259
+ source: 'advertiser',
260
+ blocks: []
261
+ },
262
+ netCost: 1000
263
+ },
264
+ expectedStatus: 400,
265
+ expectedError: 'blocks'
266
+ },
267
+
268
+ // ==================== LINE ITEM CRUD TESTS ====================
269
+
270
+ // CREATE
271
+ {
272
+ id: 'CRUD_CREATE_001',
273
+ name: 'Create line item with all required fields',
274
+ category: 'LINE_ITEM_CRUD',
275
+ endpoint: 'POST /line-items',
276
+ payload: {
277
+ source: 'COMP_TEST',
278
+ externalId: 'CRUD-CREATE-001',
279
+ dealType: 'GUARANTEED',
280
+ thresholdCountPerDay: 50,
281
+ netCost: 5000,
282
+ deliveryGoal: 10000,
283
+ impressions: 8000,
284
+ netCostPerDay: 500,
285
+ startDate: '2025-10-01',
286
+ endDate: '2025-10-15',
287
+ timezoneId: 'America/New_York'
288
+ },
289
+ expectedStatus: 201
290
+ },
291
+
292
+ // UPDATE (will be tested via PUT)
293
+ {
294
+ id: 'CRUD_UPDATE_001',
295
+ name: 'Update line item - modify name and status',
296
+ category: 'LINE_ITEM_CRUD',
297
+ endpoint: 'PUT /line-items',
298
+ payload: {
299
+ name: 'Updated Line Item Name',
300
+ status: 'APPROVED'
301
+ },
302
+ expectedStatus: 200
303
+ },
304
+
305
+ // DELETE (will be tested via DELETE)
306
+ {
307
+ id: 'CRUD_DELETE_001',
308
+ name: 'Delete line item - verify removal',
309
+ category: 'LINE_ITEM_CRUD',
310
+ endpoint: 'DELETE /line-items',
311
+ payload: null,
312
+ expectedStatus: 200
313
+ },
314
+
315
+ // ==================== DATE RANGE VALIDATION ====================
316
+
317
+ // POSITIVE: Valid date ranges
318
+ {
319
+ id: 'DATE_RANGE_001',
320
+ name: 'Valid date range - start before end',
321
+ category: 'DATE_VALIDATION',
322
+ endpoint: 'POST /line-items',
323
+ payload: {
324
+ source: 'COMP_TEST',
325
+ externalId: 'DATE-VALID-001',
326
+ dealType: 'PREFERRED_DEAL',
327
+ startDate: '2025-09-01',
328
+ endDate: '2025-09-30',
329
+ netCost: 3000
330
+ },
331
+ expectedStatus: 201
332
+ },
333
+ {
334
+ id: 'DATE_RANGE_002',
335
+ name: 'Valid date range - same day start and end',
336
+ category: 'DATE_VALIDATION',
337
+ endpoint: 'POST /line-items',
338
+ payload: {
339
+ source: 'COMP_TEST',
340
+ externalId: 'DATE-VALID-002',
341
+ dealType: 'PREFERRED_DEAL',
342
+ startDate: '2025-10-15',
343
+ endDate: '2025-10-15',
344
+ netCost: 1000
345
+ },
346
+ expectedStatus: 201
347
+ },
348
+
349
+ // NEGATIVE: Invalid date ranges
350
+ {
351
+ id: 'DATE_RANGE_NEG_001',
352
+ name: 'Invalid date range - end before start',
353
+ category: 'DATE_VALIDATION',
354
+ endpoint: 'POST /line-items',
355
+ payload: {
356
+ source: 'COMP_TEST',
357
+ externalId: 'DATE-INVALID-001',
358
+ dealType: 'PREFERRED_DEAL',
359
+ startDate: '2025-09-30',
360
+ endDate: '2025-09-01',
361
+ netCost: 3000
362
+ },
363
+ expectedStatus: 400,
364
+ expectedError: 'endDate'
365
+ },
366
+
367
+ // ==================== TIMEZONE CONSISTENCY TESTS ====================
368
+
369
+ {
370
+ id: 'TIMEZONE_001',
371
+ name: 'Timezone consistency - first line item sets timezone',
372
+ category: 'TIMEZONE_CONSISTENCY',
373
+ endpoint: 'POST /line-items',
374
+ payload: {
375
+ source: 'COMP_TEST',
376
+ externalId: 'TZ-FIRST',
377
+ dealType: 'GUARANTEED',
378
+ thresholdCountPerDay: 100,
379
+ timezoneId: 'America/New_York',
380
+ netCost: 2000
381
+ },
382
+ expectedStatus: 201
383
+ },
384
+ {
385
+ id: 'TIMEZONE_002',
386
+ name: 'Timezone consistency - second line item same timezone',
387
+ category: 'TIMEZONE_CONSISTENCY',
388
+ endpoint: 'POST /line-items',
389
+ payload: {
390
+ source: 'COMP_TEST',
391
+ externalId: 'TZ-SECOND',
392
+ dealType: 'GUARANTEED',
393
+ thresholdCountPerDay: 50,
394
+ timezoneId: 'America/New_York',
395
+ netCost: 1500
396
+ },
397
+ expectedStatus: 201
398
+ },
399
+
400
+ // ==================== AGGREGATION LOGIC TESTS ====================
401
+
402
+ {
403
+ id: 'AGGREGATION_001',
404
+ name: 'Aggregation - Line Item A (early dates)',
405
+ category: 'AGGREGATION',
406
+ endpoint: 'POST /line-items',
407
+ payload: {
408
+ source: 'COMP_TEST',
409
+ externalId: 'AGG-LI-A',
410
+ dealType: 'GUARANTEED',
411
+ thresholdCountPerDay: 100,
412
+ startDate: '2025-09-01',
413
+ endDate: '2025-09-05',
414
+ netCost: 1000,
415
+ netCostPerDay: 200,
416
+ deliveryGoal: 5000,
417
+ impressions: 4500,
418
+ timezoneId: 'UTC'
419
+ },
420
+ expectedStatus: 201
421
+ },
422
+ {
423
+ id: 'AGGREGATION_002',
424
+ name: 'Aggregation - Line Item B (later dates)',
425
+ category: 'AGGREGATION',
426
+ endpoint: 'POST /line-items',
427
+ payload: {
428
+ source: 'COMP_TEST',
429
+ externalId: 'AGG-LI-B',
430
+ dealType: 'GUARANTEED',
431
+ thresholdCountPerDay: 50,
432
+ startDate: '2025-09-10',
433
+ endDate: '2025-09-30',
434
+ netCost: 4000,
435
+ netCostPerDay: 200,
436
+ deliveryGoal: 10000,
437
+ impressions: 9500,
438
+ timezoneId: 'UTC'
439
+ },
440
+ expectedStatus: 201
441
+ },
442
+ {
443
+ id: 'AGGREGATION_VERIFY_001',
444
+ name: 'Verify aggregation - Check deal totals (in programmatic object)',
445
+ category: 'AGGREGATION',
446
+ endpoint: 'GET /deals',
447
+ expectedStatus: 200,
448
+ expectedResult: {
449
+ startDate: '2025-09-01', // Earliest from line items
450
+ endDate: '2025-09-30', // Latest from line items
451
+ timezoneId: 'UTC' // Consistent timezone
452
+ },
453
+ expectedProgrammatic: {
454
+ netCost: '5000.00', // Sum: 1000 + 4000
455
+ netCostPerDay: '400.00', // Sum: 200 + 200
456
+ deliveryGoal: '15000', // Sum: 5000 + 10000
457
+ impressions: '14000' // Sum: 4500 + 9500
458
+ }
459
+ },
460
+
461
+ // ==================== BULK IMPORT TESTS ====================
462
+
463
+ {
464
+ id: 'BULK_IMPORT_001',
465
+ name: 'Bulk import - valid deal with line items',
466
+ category: 'BULK_IMPORT',
467
+ endpoint: 'POST /deals/sync',
468
+ payload: [
469
+ {
470
+ deal: {
471
+ source: 'COMP_TEST',
472
+ externalId: 'BULK-DEAL-001',
473
+ dealType: 'GUARANTEED',
474
+ name: 'Bulk Import Test Deal'
475
+ },
476
+ line_items: [
477
+ {
478
+ line_item: {
479
+ source: 'COMP_TEST',
480
+ externalId: 'BULK-LI-001',
481
+ dealType: 'GUARANTEED',
482
+ thresholdCountPerDay: 100,
483
+ netCost: 3000,
484
+ deliveryGoal: 6000,
485
+ startDate: '2025-10-01',
486
+ endDate: '2025-10-10'
487
+ }
488
+ },
489
+ {
490
+ line_item: {
491
+ source: 'COMP_TEST',
492
+ externalId: 'BULK-LI-002',
493
+ dealType: 'GUARANTEED',
494
+ thresholdCountPerDay: 75,
495
+ netCost: 2000,
496
+ deliveryGoal: 4000,
497
+ startDate: '2025-10-05',
498
+ endDate: '2025-10-15'
499
+ }
500
+ }
501
+ ]
502
+ }
503
+ ],
504
+ expectedStatus: 200,
505
+ expectedResult: {
506
+ total: 1,
507
+ successful: 1,
508
+ failed: 0
509
+ }
510
+ },
511
+ {
512
+ id: 'BULK_IMPORT_NEG_001',
513
+ name: 'Bulk import - invalid line item missing required field',
514
+ category: 'BULK_IMPORT',
515
+ endpoint: 'POST /deals/sync',
516
+ payload: [
517
+ {
518
+ deal: {
519
+ source: 'COMP_TEST',
520
+ externalId: 'BULK-DEAL-FAIL',
521
+ dealType: 'GUARANTEED'
522
+ },
523
+ line_items: [
524
+ {
525
+ line_item: {
526
+ source: 'COMP_TEST',
527
+ externalId: 'BULK-LI-FAIL',
528
+ dealType: 'GUARANTEED',
529
+ // Missing thresholdCountPerDay - required for GUARANTEED
530
+ netCost: 3000
531
+ }
532
+ }
533
+ ]
534
+ }
535
+ ],
536
+ expectedStatus: 400,
537
+ expectedError: 'thresholdCountPerDay'
538
+ },
539
+ {
540
+ id: 'BULK_IMPORT_002',
541
+ name: 'Bulk import - multiple deals mixed success',
542
+ category: 'BULK_IMPORT',
543
+ endpoint: 'POST /deals/sync',
544
+ payload: [
545
+ {
546
+ deal: {
547
+ source: 'COMP_TEST',
548
+ externalId: 'BULK-DEAL-SUCCESS',
549
+ dealType: 'PREFERRED_DEAL'
550
+ },
551
+ line_items: [
552
+ {
553
+ line_item: {
554
+ source: 'COMP_TEST',
555
+ externalId: 'BULK-LI-SUCCESS',
556
+ dealType: 'PREFERRED_DEAL',
557
+ netCost: 1000
558
+ }
559
+ }
560
+ ]
561
+ },
562
+ {
563
+ deal: {
564
+ source: 'COMP_TEST',
565
+ externalId: 'BULK-DEAL-INVALID',
566
+ dealType: 'INVALID_TYPE' // Invalid deal type
567
+ }
568
+ }
569
+ ],
570
+ expectedStatus: 200,
571
+ expectedResult: {
572
+ total: 2,
573
+ successful: 1,
574
+ failed: 1
575
+ }
576
+ },
577
+ {
578
+ id: 'BULK_IMPORT_003',
579
+ name: 'Bulk import - valid external deal ID format accepted',
580
+ category: 'BULK_IMPORT',
581
+ endpoint: 'POST /deals/sync',
582
+ payload: [
583
+ {
584
+ deal: {
585
+ source: 'COMP_TEST',
586
+ externalId: 'BULK-EXTERNAL-VALID',
587
+ dealId: 'GD-I-99999-00001',
588
+ dealType: 'GUARANTEED',
589
+ name: 'Valid External Deal ID'
590
+ }
591
+ }
592
+ ],
593
+ expectedStatus: 200,
594
+ expectedResult: {
595
+ total: 1,
596
+ successful: 1,
597
+ failed: 0
598
+ }
599
+ },
600
+ {
601
+ id: 'BULK_IMPORT_004',
602
+ name: 'Bulk import - invalid deal ID format rejected',
603
+ category: 'BULK_IMPORT',
604
+ endpoint: 'POST /deals/sync',
605
+ payload: [
606
+ {
607
+ deal: {
608
+ source: 'COMP_TEST',
609
+ externalId: 'BULK-INVALID-FORMAT',
610
+ dealId: 'INVALID-DEAL-ID',
611
+ dealType: 'GUARANTEED'
612
+ }
613
+ }
614
+ ],
615
+ expectedStatus: 400,
616
+ expectedResult: {
617
+ total: 1,
618
+ successful: 0,
619
+ failed: 1
620
+ }
621
+ },
622
+ {
623
+ id: 'BULK_IMPORT_005',
624
+ name: 'Bulk import - nested deal_id injection ignored (Joi strips unknown)',
625
+ category: 'BULK_IMPORT',
626
+ endpoint: 'POST /deals/sync',
627
+ payload: [
628
+ {
629
+ deal: {
630
+ source: 'COMP_TEST',
631
+ externalId: 'NESTED-INJECTION-TEST',
632
+ dealType: 'PREFERRED_DEAL',
633
+ name: 'Nested Injection Test',
634
+ meta: { deal_id: 'PD-I-99999-99999' },
635
+ nested: { deep: { deal_id: 'PD-I-88888-88888' } }
636
+ }
637
+ }
638
+ ],
639
+ expectedStatus: 200,
640
+ expectedResult: {
641
+ total: 1,
642
+ successful: 1,
643
+ failed: 0
644
+ },
645
+ expectedDealIdPrefix: 'PD-I-'
646
+ },
647
+
648
+ // ==================== NEGATIVE TEST - MISSING FIELDS ====================
649
+
650
+ {
651
+ id: 'MISSING_FIELD_001',
652
+ name: 'Missing source uses default "influence"',
653
+ category: 'VALIDATION',
654
+ endpoint: 'POST /deals',
655
+ payload: {
656
+ externalId: 'DEFAULT-SOURCE-TEST',
657
+ dealType: 'GUARANTEED'
658
+ },
659
+ expectedStatus: 201,
660
+ expectedDealIdPrefix: 'GD-I-'
661
+ },
662
+ {
663
+ id: 'MISSING_FIELD_002',
664
+ name: 'Missing required field - externalId',
665
+ category: 'VALIDATION',
666
+ endpoint: 'POST /deals',
667
+ payload: {
668
+ source: 'COMP_TEST',
669
+ dealType: 'GUARANTEED'
670
+ },
671
+ expectedStatus: 400,
672
+ expectedError: 'externalId'
673
+ },
674
+ {
675
+ id: 'MISSING_FIELD_006',
676
+ name: 'Sync endpoint requires source (not optional)',
677
+ category: 'VALIDATION',
678
+ endpoint: 'POST /deals/sync',
679
+ payload: [
680
+ {
681
+ deal: {
682
+ externalId: 'SYNC-NO-SOURCE',
683
+ dealType: 'GUARANTEED'
684
+ }
685
+ }
686
+ ],
687
+ expectedStatus: 400,
688
+ expectedResult: {
689
+ total: 1,
690
+ successful: 0,
691
+ failed: 1
692
+ }
693
+ },
694
+
695
+ // ==================== AUTO-CALCULATED FIELDS REJECTION ====================
696
+
697
+ {
698
+ id: 'AUTO_CALC_NEG_001',
699
+ name: 'Auto-calculated fields in programmatic object are accepted but overwritten',
700
+ category: 'VALIDATION',
701
+ endpoint: 'POST /deals',
702
+ payload: {
703
+ source: 'COMP_TEST',
704
+ externalId: 'AUTO-CALC-ACCEPT-001',
705
+ dealType: 'GUARANTEED',
706
+ programmatic: {
707
+ deliveryGoal: 10000,
708
+ costType: 'CPM'
709
+ }
710
+ },
711
+ expectedStatus: 201
712
+ },
713
+ {
714
+ id: 'AUTO_CALC_NEG_002',
715
+ name: 'Auto-calculated fields at root level are accepted via programmatic flattening',
716
+ category: 'VALIDATION',
717
+ endpoint: 'POST /deals',
718
+ payload: {
719
+ source: 'COMP_TEST',
720
+ externalId: 'AUTO-CALC-ACCEPT-002',
721
+ dealType: 'GUARANTEED',
722
+ programmatic: {
723
+ netCost: 5000,
724
+ costType: 'CPM'
725
+ }
726
+ },
727
+ expectedStatus: 201
728
+ },
729
+ {
730
+ id: 'AUTO_CALC_NEG_003',
731
+ name: 'Reject auto-calculated field - startDate in deal',
732
+ category: 'VALIDATION',
733
+ endpoint: 'POST /deals',
734
+ payload: {
735
+ source: 'COMP_TEST',
736
+ externalId: 'AUTO-CALC-REJECT-003',
737
+ dealType: 'GUARANTEED',
738
+ startDate: '2025-10-01' // Should be rejected
739
+ },
740
+ expectedStatus: 400,
741
+ expectedError: 'startDate'
742
+ },
743
+
744
+ // ==================== CAMPAIGN MODE E2E TESTS ====================
745
+
746
+ // PROGRAMMATIC MODE - Standard workflow
747
+ {
748
+ id: 'CAMPAIGN_E2E_001',
749
+ name: 'PROGRAMMATIC mode - create deal without campaign mode fields',
750
+ category: 'CAMPAIGN_MODE',
751
+ endpoint: 'POST /deals',
752
+ payload: {
753
+ source: 'COMP_TEST',
754
+ externalId: 'E2E-PROGRAMMATIC-001',
755
+ dealType: 'PREFERRED_DEAL',
756
+ name: 'E2E Programmatic Deal Test',
757
+ costType: 'CPM',
758
+ currency: 'USD'
759
+ },
760
+ expectedStatus: 201,
761
+ expectedDealIdPrefix: 'PD-I-'
762
+ },
763
+ {
764
+ id: 'CAMPAIGN_E2E_002',
765
+ name: 'PROGRAMMATIC mode - create deal with nested programmatic object',
766
+ category: 'CAMPAIGN_MODE',
767
+ endpoint: 'POST /deals',
768
+ payload: {
769
+ source: 'COMP_TEST',
770
+ externalId: 'E2E-PROGRAMMATIC-002',
771
+ dealType: 'GUARANTEED',
772
+ name: 'E2E Programmatic Deal with Nested Object',
773
+ mode: 'PROGRAMMATIC',
774
+ currency: 'USD',
775
+ programmatic: {
776
+ buyers: [{ seatId: 'buyer-001', buyerName: 'Test Buyer', dsp: 'DV360' }],
777
+ transactionType: 'SPOT',
778
+ costType: 'CPM'
779
+ }
780
+ },
781
+ expectedStatus: 201,
782
+ expectedDealIdPrefix: 'GD-I-',
783
+ expectedAuctionType: 3
784
+ },
785
+
786
+ // DIRECT MODE - Full workflow with all required fields using nested direct object
787
+ {
788
+ id: 'CAMPAIGN_E2E_003',
789
+ name: 'DIRECT mode - create deal with nested direct object',
790
+ category: 'CAMPAIGN_MODE',
791
+ endpoint: 'POST /deals',
792
+ payload: {
793
+ source: 'COMP_TEST',
794
+ externalId: 'E2E-DIRECT-001',
795
+ dealType: 'PREFERRED_DEAL',
796
+ name: 'E2E Direct Advertiser Campaign',
797
+ mode: 'DIRECT',
798
+ currency: 'JPY',
799
+ direct: {
800
+ brand: 'Toyota',
801
+ clientType: 'DIRECT_ADVERTISER',
802
+ approvalEmails: ['approver@toyota.com', 'marketing@toyota.com'],
803
+ marketSelection: { country: 'Japan', currency: 'JPY' },
804
+ budgetSetup: { currency: 'JPY', budgetAmount: 5000000, budgetType: 'FIXED' },
805
+ campaignGoal: { type: 'IMPRESSIONS', targetValue: 10000000 }
806
+ }
807
+ },
808
+ expectedStatus: 201,
809
+ expectedDealIdPrefix: 'DIR-I-'
810
+ },
811
+ {
812
+ id: 'CAMPAIGN_E2E_004',
813
+ name: 'DIRECT mode - create deal with AGENCY and REACH goal',
814
+ category: 'CAMPAIGN_MODE',
815
+ endpoint: 'POST /deals',
816
+ payload: {
817
+ source: 'COMP_TEST',
818
+ externalId: 'E2E-DIRECT-002',
819
+ dealType: 'PRIVATE_AUCTION',
820
+ auctionType: 2,
821
+ name: 'E2E Agency Campaign with Reach Goal',
822
+ brand: 'Adidas',
823
+ clientType: 'AGENCY',
824
+ mode: 'DIRECT',
825
+ approvalEmails: ['campaigns@mediacom.com'],
826
+ marketSelection: {
827
+ country: 'Germany',
828
+ currency: 'EUR'
829
+ },
830
+ budgetSetup: {
831
+ currency: 'EUR',
832
+ budgetAmount: 250000
833
+ },
834
+ campaignGoal: {
835
+ type: 'REACH',
836
+ targetValue: 5000000
837
+ },
838
+ costType: 'CPM',
839
+ currency: 'EUR'
840
+ },
841
+ expectedStatus: 201,
842
+ expectedDealIdPrefix: 'DIR-I-'
843
+ },
844
+ {
845
+ id: 'CAMPAIGN_E2E_005',
846
+ name: 'DIRECT mode - create deal with SHARE_OF_VOICE goal',
847
+ category: 'CAMPAIGN_MODE',
848
+ endpoint: 'POST /deals',
849
+ payload: {
850
+ source: 'COMP_TEST',
851
+ externalId: 'E2E-DIRECT-003',
852
+ dealType: 'EVERGREEN_PMP',
853
+ name: 'E2E Direct Campaign with SOV Goal',
854
+ brand: 'Mercedes',
855
+ clientType: 'DIRECT_ADVERTISER',
856
+ mode: 'DIRECT',
857
+ approvalEmails: ['marketing@mercedes.com', 'finance@mercedes.com'],
858
+ marketSelection: {
859
+ country: 'Germany',
860
+ currency: 'EUR'
861
+ },
862
+ budgetSetup: {
863
+ currency: 'EUR',
864
+ budgetAmount: 1000000,
865
+ budgetType: 'MONTHLY'
866
+ },
867
+ campaignGoal: {
868
+ type: 'SHARE_OF_VOICE',
869
+ targetValue: 30
870
+ },
871
+ costType: 'CPD',
872
+ currency: 'EUR'
873
+ },
874
+ expectedStatus: 201,
875
+ expectedDealIdPrefix: 'DIR-I-'
876
+ },
877
+
878
+ // DIRECT MODE - Negative tests
879
+ {
880
+ id: 'CAMPAIGN_E2E_NEG_001',
881
+ name: 'DIRECT mode - missing brand (invalid)',
882
+ category: 'CAMPAIGN_MODE',
883
+ endpoint: 'POST /deals',
884
+ payload: {
885
+ source: 'COMP_TEST',
886
+ externalId: 'E2E-DIRECT-NEG-001',
887
+ dealType: 'PREFERRED_DEAL',
888
+ clientType: 'AGENCY',
889
+ mode: 'DIRECT',
890
+ approvalEmails: ['test@company.com'],
891
+ marketSelection: { country: 'Japan', currency: 'JPY' },
892
+ budgetSetup: { currency: 'JPY', budgetAmount: 10000 },
893
+ campaignGoal: { type: 'IMPRESSIONS', targetValue: 100000 }
894
+ },
895
+ expectedStatus: 400,
896
+ expectedError: 'brand'
897
+ },
898
+ {
899
+ id: 'CAMPAIGN_E2E_NEG_002',
900
+ name: 'DIRECT mode - missing clientType (invalid)',
901
+ category: 'CAMPAIGN_MODE',
902
+ endpoint: 'POST /deals',
903
+ payload: {
904
+ source: 'COMP_TEST',
905
+ externalId: 'E2E-DIRECT-NEG-002',
906
+ dealType: 'PREFERRED_DEAL',
907
+ brand: 'Sony',
908
+ mode: 'DIRECT',
909
+ approvalEmails: ['test@company.com'],
910
+ marketSelection: { country: 'Japan', currency: 'JPY' },
911
+ budgetSetup: { currency: 'JPY', budgetAmount: 10000 },
912
+ campaignGoal: { type: 'IMPRESSIONS', targetValue: 100000 }
913
+ },
914
+ expectedStatus: 400,
915
+ expectedError: 'clientType'
916
+ },
917
+ {
918
+ id: 'CAMPAIGN_E2E_NEG_003',
919
+ name: 'DIRECT mode - missing approvalEmails (invalid)',
920
+ category: 'CAMPAIGN_MODE',
921
+ endpoint: 'POST /deals',
922
+ payload: {
923
+ source: 'COMP_TEST',
924
+ externalId: 'E2E-DIRECT-NEG-003',
925
+ dealType: 'PREFERRED_DEAL',
926
+ brand: 'LG',
927
+ clientType: 'DIRECT_ADVERTISER',
928
+ mode: 'DIRECT',
929
+ marketSelection: { country: 'Korea', currency: 'KRW' },
930
+ budgetSetup: { currency: 'KRW', budgetAmount: 50000000 },
931
+ campaignGoal: { type: 'REACH', targetValue: 1000000 }
932
+ },
933
+ expectedStatus: 400,
934
+ expectedError: 'approvalEmails'
935
+ },
936
+ {
937
+ id: 'CAMPAIGN_E2E_NEG_004',
938
+ name: 'DIRECT mode - negative budgetAmount (invalid)',
939
+ category: 'CAMPAIGN_MODE',
940
+ endpoint: 'POST /deals',
941
+ payload: {
942
+ source: 'COMP_TEST',
943
+ externalId: 'E2E-DIRECT-NEG-004',
944
+ dealType: 'PREFERRED_DEAL',
945
+ brand: 'Samsung',
946
+ clientType: 'AGENCY',
947
+ mode: 'DIRECT',
948
+ approvalEmails: ['test@samsung.com'],
949
+ marketSelection: { country: 'Korea', currency: 'KRW' },
950
+ budgetSetup: { currency: 'KRW', budgetAmount: -100000 },
951
+ campaignGoal: { type: 'IMPRESSIONS', targetValue: 500000 }
952
+ },
953
+ expectedStatus: 400,
954
+ expectedError: 'budgetAmount'
955
+ },
956
+ {
957
+ id: 'CAMPAIGN_E2E_NEG_005',
958
+ name: 'DIRECT mode - invalid clientType value (invalid)',
959
+ category: 'CAMPAIGN_MODE',
960
+ endpoint: 'POST /deals',
961
+ payload: {
962
+ source: 'COMP_TEST',
963
+ externalId: 'E2E-DIRECT-NEG-005',
964
+ dealType: 'PREFERRED_DEAL',
965
+ brand: 'Panasonic',
966
+ clientType: 'BUYER',
967
+ mode: 'DIRECT',
968
+ approvalEmails: ['test@panasonic.com'],
969
+ marketSelection: { country: 'Japan', currency: 'JPY' },
970
+ budgetSetup: { currency: 'JPY', budgetAmount: 10000 },
971
+ campaignGoal: { type: 'IMPRESSIONS', targetValue: 100000 }
972
+ },
973
+ expectedStatus: 400,
974
+ expectedError: 'clientType'
975
+ },
976
+ {
977
+ id: 'CAMPAIGN_E2E_006',
978
+ name: 'DIRECT to PROGRAMMATIC mode switch (valid)',
979
+ category: 'CAMPAIGN_MODE',
980
+ endpoint: 'POST /deals',
981
+ payload: {
982
+ source: 'COMP_TEST',
983
+ externalId: 'E2E-MODE-SWITCH-001',
984
+ dealType: 'PREFERRED_DEAL',
985
+ brand: 'Philips',
986
+ clientType: 'DIRECT_ADVERTISER',
987
+ mode: 'DIRECT',
988
+ approvalEmails: ['direct@philips.com'],
989
+ marketSelection: { country: 'Netherlands', currency: 'EUR' },
990
+ budgetSetup: { currency: 'EUR', budgetAmount: 75000 },
991
+ campaignGoal: { type: 'IMPRESSIONS', targetValue: 500000 }
992
+ },
993
+ expectedStatus: 201,
994
+ updatePayload: {
995
+ mode: 'PROGRAMMATIC'
996
+ },
997
+ expectedUpdateStatus: 200,
998
+ cleanup: true
999
+ },
1000
+ {
1001
+ id: 'CAMPAIGN_E2E_007',
1002
+ name: 'DIRECT deal lifecycle - create, update, add line item (valid)',
1003
+ category: 'CAMPAIGN_MODE',
1004
+ endpoint: 'POST /deals',
1005
+ payload: {
1006
+ source: 'COMP_TEST',
1007
+ externalId: 'E2E-LIFECYCLE-001',
1008
+ dealType: 'GUARANTEED',
1009
+ brand: 'Siemens',
1010
+ clientType: 'AGENCY',
1011
+ mode: 'DIRECT',
1012
+ approvalEmails: ['agency@mediacom.com', 'client@siemens.com'],
1013
+ marketSelection: { country: 'Germany', currency: 'EUR' },
1014
+ budgetSetup: { currency: 'EUR', budgetAmount: 200000, budgetType: 'FIXED' },
1015
+ campaignGoal: { type: 'SHARE_OF_VOICE', targetValue: 25 }
1016
+ },
1017
+ expectedStatus: 201,
1018
+ lineItemPayload: {
1019
+ source: 'COMP_TEST',
1020
+ externalId: 'E2E-LIFECYCLE-LI-001',
1021
+ name: 'Siemens Q1 Flight',
1022
+ startDate: '2025-01-15',
1023
+ endDate: '2025-03-31',
1024
+ timezoneId: 'Europe/Berlin',
1025
+ netCost: 80000,
1026
+ deliveryGoal: 1000000,
1027
+ costType: 'CPM',
1028
+ schedule: { type: 'ALL_TIME', source: 'inventory', blocks: [{ day: 'MONDAY', start: '00:00', end: '23:59' }] }
1029
+ },
1030
+ expectedLineItemStatus: 201,
1031
+ cleanup: true
1032
+ },
1033
+
1034
+ // ==================== BUSINESS RULES TESTS (IAB OpenRTB Standard) ====================
1035
+
1036
+ {
1037
+ id: 'BUSINESS_RULE_001',
1038
+ name: 'GUARANTEED deal - auctionType auto-set to 3 (fixed price)',
1039
+ category: 'BUSINESS_RULES',
1040
+ endpoint: 'POST /deals',
1041
+ payload: {
1042
+ source: 'COMP_TEST',
1043
+ externalId: 'BR-AUCTION-GD-001',
1044
+ dealType: 'GUARANTEED',
1045
+ name: 'Guaranteed Fixed Price Test',
1046
+ programmatic: { costType: 'CPM', transactionType: 'SPOT' }
1047
+ },
1048
+ expectedStatus: 201,
1049
+ expectedAuctionType: 3
1050
+ },
1051
+ {
1052
+ id: 'BUSINESS_RULE_002',
1053
+ name: 'PREFERRED_DEAL - auctionType auto-set to 3 (fixed price)',
1054
+ category: 'BUSINESS_RULES',
1055
+ endpoint: 'POST /deals',
1056
+ payload: {
1057
+ source: 'COMP_TEST',
1058
+ externalId: 'BR-AUCTION-PD-001',
1059
+ dealType: 'PREFERRED_DEAL',
1060
+ name: 'Preferred Deal Fixed Price Test',
1061
+ programmatic: { costType: 'CPM' }
1062
+ },
1063
+ expectedStatus: 201,
1064
+ expectedAuctionType: 3
1065
+ },
1066
+ {
1067
+ id: 'BUSINESS_RULE_003',
1068
+ name: 'PRIVATE_AUCTION - auctionType=1 (first price) valid',
1069
+ category: 'BUSINESS_RULES',
1070
+ endpoint: 'POST /deals',
1071
+ payload: {
1072
+ source: 'COMP_TEST',
1073
+ externalId: 'BR-AUCTION-PA-FIRST',
1074
+ dealType: 'PRIVATE_AUCTION',
1075
+ name: 'Private Auction First Price',
1076
+ programmatic: { auctionType: 1, costType: 'CPM' }
1077
+ },
1078
+ expectedStatus: 201,
1079
+ expectedAuctionType: 1
1080
+ },
1081
+ {
1082
+ id: 'BUSINESS_RULE_004',
1083
+ name: 'EVERGREEN_PMP - auctionType=2 (second price) valid',
1084
+ category: 'BUSINESS_RULES',
1085
+ endpoint: 'POST /deals',
1086
+ payload: {
1087
+ source: 'COMP_TEST',
1088
+ externalId: 'BR-AUCTION-EG-SECOND',
1089
+ dealType: 'EVERGREEN_PMP',
1090
+ name: 'Evergreen Second Price',
1091
+ programmatic: { auctionType: 2, costType: 'CPD' }
1092
+ },
1093
+ expectedStatus: 201,
1094
+ expectedAuctionType: 2
1095
+ },
1096
+ {
1097
+ id: 'BUSINESS_RULE_NEG_001',
1098
+ name: 'GUARANTEED with auctionType=1 - invalid (must be 3)',
1099
+ category: 'BUSINESS_RULES',
1100
+ endpoint: 'POST /deals',
1101
+ payload: {
1102
+ source: 'COMP_TEST',
1103
+ externalId: 'BR-AUCTION-GD-INVALID',
1104
+ dealType: 'GUARANTEED',
1105
+ programmatic: { auctionType: 1, costType: 'CPM' }
1106
+ },
1107
+ expectedStatus: 400,
1108
+ expectedError: 'auctionType'
1109
+ },
1110
+ {
1111
+ id: 'BUSINESS_RULE_NEG_002',
1112
+ name: 'PRIVATE_AUCTION with auctionType=3 - invalid (must be 1 or 2)',
1113
+ category: 'BUSINESS_RULES',
1114
+ endpoint: 'POST /deals',
1115
+ payload: {
1116
+ source: 'COMP_TEST',
1117
+ externalId: 'BR-AUCTION-PA-INVALID',
1118
+ dealType: 'PRIVATE_AUCTION',
1119
+ programmatic: { auctionType: 3, costType: 'CPM' }
1120
+ },
1121
+ expectedStatus: 400,
1122
+ expectedError: 'auctionType'
1123
+ },
1124
+ {
1125
+ id: 'BUSINESS_RULE_005',
1126
+ name: 'GUARANTEED with CPS cost type - invalid (CPS not for GUARANTEED)',
1127
+ category: 'BUSINESS_RULES',
1128
+ endpoint: 'POST /deals',
1129
+ payload: {
1130
+ source: 'COMP_TEST',
1131
+ externalId: 'BR-COST-GD-CPS',
1132
+ dealType: 'GUARANTEED',
1133
+ programmatic: { costType: 'CPS' }
1134
+ },
1135
+ expectedStatus: 400,
1136
+ expectedError: 'costType'
1137
+ },
1138
+ {
1139
+ id: 'BUSINESS_RULE_006',
1140
+ name: 'PREFERRED_DEAL with CPS cost type - valid',
1141
+ category: 'BUSINESS_RULES',
1142
+ endpoint: 'POST /deals',
1143
+ payload: {
1144
+ source: 'COMP_TEST',
1145
+ externalId: 'BR-COST-PD-CPS',
1146
+ dealType: 'PREFERRED_DEAL',
1147
+ programmatic: { costType: 'CPS' }
1148
+ },
1149
+ expectedStatus: 201
1150
+ },
1151
+ {
1152
+ id: 'BUSINESS_RULE_007',
1153
+ name: 'PRIVATE_AUCTION with CPS cost type - valid',
1154
+ category: 'BUSINESS_RULES',
1155
+ endpoint: 'POST /deals',
1156
+ payload: {
1157
+ source: 'COMP_TEST',
1158
+ externalId: 'BR-COST-PA-CPS',
1159
+ dealType: 'PRIVATE_AUCTION',
1160
+ programmatic: { auctionType: 1, costType: 'CPS' }
1161
+ },
1162
+ expectedStatus: 201
1163
+ },
1164
+ {
1165
+ id: 'BUSINESS_RULE_008',
1166
+ name: 'impMultiplierType defaults to MAD',
1167
+ category: 'BUSINESS_RULES',
1168
+ endpoint: 'POST /deals',
1169
+ payload: {
1170
+ source: 'COMP_TEST',
1171
+ externalId: 'BR-IMP-DEFAULT',
1172
+ dealType: 'GUARANTEED',
1173
+ programmatic: { costType: 'CPM' }
1174
+ },
1175
+ expectedStatus: 201,
1176
+ expectedImpMultiplierType: 'MAD'
1177
+ },
1178
+ {
1179
+ id: 'BUSINESS_RULE_009',
1180
+ name: 'impMultiplierType can be set to CUSTOM',
1181
+ category: 'BUSINESS_RULES',
1182
+ endpoint: 'POST /deals',
1183
+ payload: {
1184
+ source: 'COMP_TEST',
1185
+ externalId: 'BR-IMP-CUSTOM',
1186
+ dealType: 'PREFERRED_DEAL',
1187
+ programmatic: { costType: 'CPM', impMultiplierType: 'CUSTOM' }
1188
+ },
1189
+ expectedStatus: 201,
1190
+ expectedImpMultiplierType: 'CUSTOM'
1191
+ },
1192
+ {
1193
+ id: 'BUSINESS_RULE_010',
1194
+ name: 'Default status is GENERATED',
1195
+ category: 'BUSINESS_RULES',
1196
+ endpoint: 'POST /deals',
1197
+ payload: {
1198
+ source: 'COMP_TEST',
1199
+ externalId: 'BR-STATUS-DEFAULT',
1200
+ dealType: 'GUARANTEED'
1201
+ },
1202
+ expectedStatus: 201,
1203
+ expectedDealStatus: 'GENERATED'
1204
+ },
1205
+ {
1206
+ id: 'BUSINESS_RULE_011',
1207
+ name: 'Transaction type SPOT - valid',
1208
+ category: 'BUSINESS_RULES',
1209
+ endpoint: 'POST /deals',
1210
+ payload: {
1211
+ source: 'COMP_TEST',
1212
+ externalId: 'BR-TRANS-SPOT',
1213
+ dealType: 'PREFERRED_DEAL',
1214
+ programmatic: { transactionType: 'SPOT', costType: 'CPM' }
1215
+ },
1216
+ expectedStatus: 201
1217
+ },
1218
+ {
1219
+ id: 'BUSINESS_RULE_012',
1220
+ name: 'Transaction type AUDIENCE - valid',
1221
+ category: 'BUSINESS_RULES',
1222
+ endpoint: 'POST /deals',
1223
+ payload: {
1224
+ source: 'COMP_TEST',
1225
+ externalId: 'BR-TRANS-AUDIENCE',
1226
+ dealType: 'EVERGREEN_PMP',
1227
+ programmatic: { auctionType: 1, transactionType: 'AUDIENCE', costType: 'CPD' }
1228
+ },
1229
+ expectedStatus: 201
1230
+ },
1231
+ {
1232
+ id: 'BUSINESS_RULE_NEG_003',
1233
+ name: 'Transaction type GUARANTEED - invalid (removed)',
1234
+ category: 'BUSINESS_RULES',
1235
+ endpoint: 'POST /deals',
1236
+ payload: {
1237
+ source: 'COMP_TEST',
1238
+ externalId: 'BR-TRANS-INVALID',
1239
+ dealType: 'PREFERRED_DEAL',
1240
+ programmatic: { transactionType: 'GUARANTEED', costType: 'CPM' }
1241
+ },
1242
+ expectedStatus: 400,
1243
+ expectedError: 'transactionType'
1244
+ },
1245
+ {
1246
+ id: 'BUSINESS_RULE_013',
1247
+ name: 'New programmatic fields - published, nonBillable, stopBidRequests',
1248
+ category: 'BUSINESS_RULES',
1249
+ endpoint: 'POST /deals',
1250
+ payload: {
1251
+ source: 'COMP_TEST',
1252
+ externalId: 'BR-PROG-FIELDS',
1253
+ dealType: 'GUARANTEED',
1254
+ programmatic: {
1255
+ costType: 'CPM',
1256
+ published: true,
1257
+ nonBillable: false,
1258
+ stopBidRequests: true,
1259
+ reopened: false
1260
+ }
1261
+ },
1262
+ expectedStatus: 201
1263
+ }
1264
+ ];
1265
+
1266
+ // Helper functions to get tests by category
1267
+ export const getTestsByCategory = (category) => {
1268
+ return comprehensiveTests.filter(test => test.category === category);
1269
+ };
1270
+
1271
+ export const getAllCategories = () => {
1272
+ return [...new Set(comprehensiveTests.map(test => test.category))];
1273
+ };
1274
+
1275
+ export const getTestById = (id) => {
1276
+ return comprehensiveTests.find(test => test.id === id);
1277
+ };