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,436 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback } from "react";
|
|
2
|
+
import { ChevronRight, ChevronDown, Search, X, Building2, Train, ShoppingBag, TreeDeciduous, Film, Heart, Stethoscope, Briefcase, GraduationCap } from "lucide-react";
|
|
3
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from "@/components/ui/sheet";
|
|
4
|
+
import { Button } from "@/components/ui/button";
|
|
5
|
+
import { Input } from "@/components/ui/input";
|
|
6
|
+
import { Badge } from "@/components/ui/badge";
|
|
7
|
+
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
8
|
+
import { VENUE_TAXONOMY, VenueTypeNode } from "@shared/schema";
|
|
9
|
+
|
|
10
|
+
interface VenueTypeSelectorProps {
|
|
11
|
+
value: string[];
|
|
12
|
+
onChange: (value: string[]) => void;
|
|
13
|
+
open: boolean;
|
|
14
|
+
onOpenChange: (open: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const CATEGORY_ICONS: Record<string, typeof Building2> = {
|
|
18
|
+
transit: Train,
|
|
19
|
+
retail: ShoppingBag,
|
|
20
|
+
outdoor: TreeDeciduous,
|
|
21
|
+
entertainment: Film,
|
|
22
|
+
health_beauty: Heart,
|
|
23
|
+
point_of_care: Stethoscope,
|
|
24
|
+
office: Briefcase,
|
|
25
|
+
education: GraduationCap,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const COLOR_CLASSES = {
|
|
29
|
+
blue: "bg-blue-500",
|
|
30
|
+
green: "bg-green-500",
|
|
31
|
+
pink: "bg-pink-500",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const LEVEL_BADGES = {
|
|
35
|
+
category: { label: "Category", className: "bg-muted text-muted-foreground" },
|
|
36
|
+
sub: { label: "Sub", className: "bg-muted text-muted-foreground" },
|
|
37
|
+
product: { label: "Product", className: "bg-primary text-primary-foreground" },
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function getAllDescendantIds(node: VenueTypeNode): string[] {
|
|
41
|
+
const ids: string[] = [node.id];
|
|
42
|
+
if (node.children) {
|
|
43
|
+
for (const child of node.children) {
|
|
44
|
+
ids.push(...getAllDescendantIds(child));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return ids;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function findNodeById(nodes: VenueTypeNode[], id: string): VenueTypeNode | null {
|
|
51
|
+
for (const node of nodes) {
|
|
52
|
+
if (node.id === id) return node;
|
|
53
|
+
if (node.children) {
|
|
54
|
+
const found = findNodeById(node.children, id);
|
|
55
|
+
if (found) return found;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getNodePath(nodes: VenueTypeNode[], targetId: string, path: VenueTypeNode[] = []): VenueTypeNode[] | null {
|
|
62
|
+
for (const node of nodes) {
|
|
63
|
+
const newPath = [...path, node];
|
|
64
|
+
if (node.id === targetId) return newPath;
|
|
65
|
+
if (node.children) {
|
|
66
|
+
const found = getNodePath(node.children, targetId, newPath);
|
|
67
|
+
if (found) return found;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function matchesSearch(node: VenueTypeNode, query: string): boolean {
|
|
74
|
+
const lowerQuery = query.toLowerCase();
|
|
75
|
+
if (node.label.toLowerCase().includes(lowerQuery)) return true;
|
|
76
|
+
if (node.description?.toLowerCase().includes(lowerQuery)) return true;
|
|
77
|
+
if (node.children) {
|
|
78
|
+
return node.children.some(child => matchesSearch(child, query));
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface TreeNodeProps {
|
|
84
|
+
node: VenueTypeNode;
|
|
85
|
+
selectedIds: Set<string>;
|
|
86
|
+
expandedIds: Set<string>;
|
|
87
|
+
onToggleExpand: (id: string) => void;
|
|
88
|
+
onToggleSelect: (node: VenueTypeNode) => void;
|
|
89
|
+
depth: number;
|
|
90
|
+
searchQuery: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function TreeNode({ node, selectedIds, expandedIds, onToggleExpand, onToggleSelect, depth, searchQuery }: TreeNodeProps) {
|
|
94
|
+
const hasChildren = node.children && node.children.length > 0;
|
|
95
|
+
const isExpanded = expandedIds.has(node.id);
|
|
96
|
+
const isSelected = selectedIds.has(node.id);
|
|
97
|
+
const Icon = depth === 0 ? CATEGORY_ICONS[node.id] || Building2 : null;
|
|
98
|
+
|
|
99
|
+
if (searchQuery && !matchesSearch(node, searchQuery)) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const visibleChildren = hasChildren && (isExpanded || searchQuery);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div>
|
|
107
|
+
<div
|
|
108
|
+
className={`flex items-center gap-2 py-1.5 px-2 rounded-md cursor-pointer hover-elevate ${isSelected ? "bg-primary/10" : ""}`}
|
|
109
|
+
style={{ paddingLeft: `${depth * 20 + 8}px` }}
|
|
110
|
+
onClick={() => onToggleSelect(node)}
|
|
111
|
+
data-testid={`venue-node-${node.id}`}
|
|
112
|
+
>
|
|
113
|
+
{hasChildren ? (
|
|
114
|
+
<button
|
|
115
|
+
type="button"
|
|
116
|
+
onClick={(e) => {
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
onToggleExpand(node.id);
|
|
119
|
+
}}
|
|
120
|
+
className="p-0.5 hover:bg-muted rounded"
|
|
121
|
+
data-testid={`venue-expand-${node.id}`}
|
|
122
|
+
>
|
|
123
|
+
{isExpanded ? (
|
|
124
|
+
<ChevronDown className="h-4 w-4 text-muted-foreground" />
|
|
125
|
+
) : (
|
|
126
|
+
<ChevronRight className="h-4 w-4 text-muted-foreground" />
|
|
127
|
+
)}
|
|
128
|
+
</button>
|
|
129
|
+
) : (
|
|
130
|
+
<div className="w-5" />
|
|
131
|
+
)}
|
|
132
|
+
|
|
133
|
+
<div className={`w-2.5 h-2.5 rounded-full ${COLOR_CLASSES[node.color]}`} />
|
|
134
|
+
|
|
135
|
+
{Icon && <Icon className="h-4 w-4 text-muted-foreground" />}
|
|
136
|
+
|
|
137
|
+
<div className="flex-1 min-w-0">
|
|
138
|
+
<div className="font-medium text-sm">{node.label}</div>
|
|
139
|
+
{node.description && depth === 0 && (
|
|
140
|
+
<div className="text-xs text-muted-foreground">{node.description}</div>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
{isSelected && (
|
|
145
|
+
<span className="text-xs text-primary font-medium flex items-center gap-1">
|
|
146
|
+
<span className="w-1.5 h-1.5 rounded-full bg-primary" />
|
|
147
|
+
Selected
|
|
148
|
+
</span>
|
|
149
|
+
)}
|
|
150
|
+
|
|
151
|
+
<Badge variant="secondary" className={LEVEL_BADGES[node.level].className}>
|
|
152
|
+
{LEVEL_BADGES[node.level].label}
|
|
153
|
+
</Badge>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
{visibleChildren && node.children && (
|
|
157
|
+
<div>
|
|
158
|
+
{node.children.map((child) => (
|
|
159
|
+
<TreeNode
|
|
160
|
+
key={child.id}
|
|
161
|
+
node={child}
|
|
162
|
+
selectedIds={selectedIds}
|
|
163
|
+
expandedIds={expandedIds}
|
|
164
|
+
onToggleExpand={onToggleExpand}
|
|
165
|
+
onToggleSelect={onToggleSelect}
|
|
166
|
+
depth={depth + 1}
|
|
167
|
+
searchQuery={searchQuery}
|
|
168
|
+
/>
|
|
169
|
+
))}
|
|
170
|
+
</div>
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface SelectedItemDisplayProps {
|
|
177
|
+
node: VenueTypeNode;
|
|
178
|
+
path: VenueTypeNode[];
|
|
179
|
+
onRemove: (id: string) => void;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function SelectedItemDisplay({ node, path, onRemove }: SelectedItemDisplayProps) {
|
|
183
|
+
const Icon = CATEGORY_ICONS[path[0]?.id] || Building2;
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div className="border rounded-lg p-3 mb-2">
|
|
187
|
+
<div className="flex items-start gap-2">
|
|
188
|
+
<div className={`w-2.5 h-2.5 rounded-full mt-1.5 ${COLOR_CLASSES[node.color]}`} />
|
|
189
|
+
{node.level === "category" && <Icon className="h-4 w-4 text-muted-foreground mt-1" />}
|
|
190
|
+
<div className="flex-1 min-w-0">
|
|
191
|
+
{node.level === "category" ? (
|
|
192
|
+
<div className="font-medium">{node.label}</div>
|
|
193
|
+
) : (
|
|
194
|
+
<div>
|
|
195
|
+
{path.length > 1 && (
|
|
196
|
+
<div className="flex items-center gap-1 text-muted-foreground text-xs mb-1">
|
|
197
|
+
{path.slice(0, -1).map((p, i) => (
|
|
198
|
+
<span key={p.id} className="flex items-center gap-1">
|
|
199
|
+
<span className={`w-1.5 h-1.5 rounded-full ${COLOR_CLASSES[p.color]}`} />
|
|
200
|
+
{p.label}
|
|
201
|
+
{i < path.length - 2 && <span className="mx-1">/</span>}
|
|
202
|
+
</span>
|
|
203
|
+
))}
|
|
204
|
+
</div>
|
|
205
|
+
)}
|
|
206
|
+
<div className="font-medium">{node.label}</div>
|
|
207
|
+
</div>
|
|
208
|
+
)}
|
|
209
|
+
<div className="text-xs text-muted-foreground mt-0.5">
|
|
210
|
+
Level {path.length} - {node.level.charAt(0).toUpperCase() + node.level.slice(1)}
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
<button
|
|
214
|
+
type="button"
|
|
215
|
+
onClick={() => onRemove(node.id)}
|
|
216
|
+
className="text-muted-foreground hover:text-destructive p-1"
|
|
217
|
+
data-testid={`remove-venue-${node.id}`}
|
|
218
|
+
>
|
|
219
|
+
<X className="h-4 w-4" />
|
|
220
|
+
</button>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function VenueTypeSelector({ value, onChange, open, onOpenChange }: VenueTypeSelectorProps) {
|
|
227
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
228
|
+
const [expandedIds, setExpandedIds] = useState<Set<string>>(new Set());
|
|
229
|
+
|
|
230
|
+
const selectedIds = useMemo(() => new Set(value), [value]);
|
|
231
|
+
|
|
232
|
+
const handleToggleExpand = useCallback((id: string) => {
|
|
233
|
+
setExpandedIds((prev) => {
|
|
234
|
+
const next = new Set(prev);
|
|
235
|
+
if (next.has(id)) {
|
|
236
|
+
next.delete(id);
|
|
237
|
+
} else {
|
|
238
|
+
next.add(id);
|
|
239
|
+
}
|
|
240
|
+
return next;
|
|
241
|
+
});
|
|
242
|
+
}, []);
|
|
243
|
+
|
|
244
|
+
const handleToggleSelect = useCallback((node: VenueTypeNode) => {
|
|
245
|
+
const descendantIds = getAllDescendantIds(node);
|
|
246
|
+
|
|
247
|
+
if (selectedIds.has(node.id)) {
|
|
248
|
+
const filtered = value.filter(id => !descendantIds.includes(id));
|
|
249
|
+
onChange(filtered);
|
|
250
|
+
} else {
|
|
251
|
+
const toRemove = new Set<string>();
|
|
252
|
+
for (const id of value) {
|
|
253
|
+
if (descendantIds.includes(id)) {
|
|
254
|
+
toRemove.add(id);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const path = getNodePath(VENUE_TAXONOMY, node.id);
|
|
258
|
+
if (path) {
|
|
259
|
+
for (const ancestor of path.slice(0, -1)) {
|
|
260
|
+
toRemove.add(ancestor.id);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const filtered = value.filter(id => !toRemove.has(id));
|
|
264
|
+
filtered.push(node.id);
|
|
265
|
+
onChange(filtered);
|
|
266
|
+
}
|
|
267
|
+
}, [value, selectedIds, onChange]);
|
|
268
|
+
|
|
269
|
+
const handleRemove = useCallback((id: string) => {
|
|
270
|
+
onChange(value.filter(v => v !== id));
|
|
271
|
+
}, [value, onChange]);
|
|
272
|
+
|
|
273
|
+
const handleClearAll = useCallback(() => {
|
|
274
|
+
onChange([]);
|
|
275
|
+
}, [onChange]);
|
|
276
|
+
|
|
277
|
+
const selectedNodes = useMemo(() => {
|
|
278
|
+
return value.map(id => {
|
|
279
|
+
const node = findNodeById(VENUE_TAXONOMY, id);
|
|
280
|
+
const path = getNodePath(VENUE_TAXONOMY, id);
|
|
281
|
+
return { node, path };
|
|
282
|
+
}).filter((item): item is { node: VenueTypeNode; path: VenueTypeNode[] } =>
|
|
283
|
+
item.node !== null && item.path !== null
|
|
284
|
+
);
|
|
285
|
+
}, [value]);
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
289
|
+
<SheetContent side="right" className="w-[600px] sm:max-w-[600px] flex flex-col p-0">
|
|
290
|
+
<SheetHeader className="px-6 py-4 border-b">
|
|
291
|
+
<SheetTitle>Select Venue Types</SheetTitle>
|
|
292
|
+
<SheetDescription>
|
|
293
|
+
Choose from OpenOOH venue taxonomy standards
|
|
294
|
+
</SheetDescription>
|
|
295
|
+
</SheetHeader>
|
|
296
|
+
|
|
297
|
+
<div className="flex flex-col flex-1 overflow-hidden">
|
|
298
|
+
<div className="p-3 border-b">
|
|
299
|
+
<div className="relative">
|
|
300
|
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
301
|
+
<Input
|
|
302
|
+
placeholder="Search venue types..."
|
|
303
|
+
value={searchQuery}
|
|
304
|
+
onChange={(e) => setSearchQuery(e.target.value)}
|
|
305
|
+
className="pl-9"
|
|
306
|
+
data-testid="input-venue-search"
|
|
307
|
+
/>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<ScrollArea className="flex-1">
|
|
312
|
+
<div className="p-2">
|
|
313
|
+
{VENUE_TAXONOMY.map((node) => (
|
|
314
|
+
<TreeNode
|
|
315
|
+
key={node.id}
|
|
316
|
+
node={node}
|
|
317
|
+
selectedIds={selectedIds}
|
|
318
|
+
expandedIds={expandedIds}
|
|
319
|
+
onToggleExpand={handleToggleExpand}
|
|
320
|
+
onToggleSelect={handleToggleSelect}
|
|
321
|
+
depth={0}
|
|
322
|
+
searchQuery={searchQuery}
|
|
323
|
+
/>
|
|
324
|
+
))}
|
|
325
|
+
</div>
|
|
326
|
+
</ScrollArea>
|
|
327
|
+
|
|
328
|
+
{value.length > 0 && (
|
|
329
|
+
<div className="border-t bg-muted/30">
|
|
330
|
+
<div className="p-3 border-b">
|
|
331
|
+
<div className="flex items-center justify-between">
|
|
332
|
+
<div>
|
|
333
|
+
<h3 className="font-semibold text-sm">Selected Venues</h3>
|
|
334
|
+
<p className="text-xs text-muted-foreground">{value.length} selections</p>
|
|
335
|
+
</div>
|
|
336
|
+
<Button
|
|
337
|
+
variant="ghost"
|
|
338
|
+
size="sm"
|
|
339
|
+
className="text-destructive hover:text-destructive"
|
|
340
|
+
onClick={handleClearAll}
|
|
341
|
+
data-testid="button-clear-all-venues"
|
|
342
|
+
>
|
|
343
|
+
Clear All
|
|
344
|
+
</Button>
|
|
345
|
+
</div>
|
|
346
|
+
</div>
|
|
347
|
+
<ScrollArea className="max-h-48 p-3">
|
|
348
|
+
{selectedNodes.map(({ node, path }) => (
|
|
349
|
+
<SelectedItemDisplay
|
|
350
|
+
key={node.id}
|
|
351
|
+
node={node}
|
|
352
|
+
path={path}
|
|
353
|
+
onRemove={handleRemove}
|
|
354
|
+
/>
|
|
355
|
+
))}
|
|
356
|
+
</ScrollArea>
|
|
357
|
+
</div>
|
|
358
|
+
)}
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<div className="px-6 py-4 border-t flex items-center justify-between">
|
|
362
|
+
<span className="text-sm text-muted-foreground">
|
|
363
|
+
{value.length} venue type(s) selected
|
|
364
|
+
</span>
|
|
365
|
+
<Button onClick={() => onOpenChange(false)} data-testid="button-venue-done">
|
|
366
|
+
Done
|
|
367
|
+
</Button>
|
|
368
|
+
</div>
|
|
369
|
+
</SheetContent>
|
|
370
|
+
</Sheet>
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
interface VenueTypeTriggerProps {
|
|
375
|
+
value: string[];
|
|
376
|
+
onChange: (value: string[]) => void;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export function VenueTypeTrigger({ value, onChange }: VenueTypeTriggerProps) {
|
|
380
|
+
const [open, setOpen] = useState(false);
|
|
381
|
+
|
|
382
|
+
const selectedLabels = useMemo(() => {
|
|
383
|
+
return value.map(id => {
|
|
384
|
+
const node = findNodeById(VENUE_TAXONOMY, id);
|
|
385
|
+
return node?.label ?? id;
|
|
386
|
+
});
|
|
387
|
+
}, [value]);
|
|
388
|
+
|
|
389
|
+
const handleRemove = (id: string) => {
|
|
390
|
+
onChange(value.filter(v => v !== id));
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
return (
|
|
394
|
+
<div>
|
|
395
|
+
<div
|
|
396
|
+
className="min-h-10 border rounded-md p-2 cursor-pointer hover:border-primary transition-colors"
|
|
397
|
+
onClick={() => setOpen(true)}
|
|
398
|
+
data-testid="trigger-venue-types"
|
|
399
|
+
>
|
|
400
|
+
{value.length === 0 ? (
|
|
401
|
+
<span className="text-muted-foreground text-sm">Select venue types...</span>
|
|
402
|
+
) : (
|
|
403
|
+
<div className="flex flex-wrap gap-1.5">
|
|
404
|
+
{value.slice(0, 5).map((id) => {
|
|
405
|
+
const node = findNodeById(VENUE_TAXONOMY, id);
|
|
406
|
+
return (
|
|
407
|
+
<Badge
|
|
408
|
+
key={id}
|
|
409
|
+
variant="secondary"
|
|
410
|
+
className="cursor-pointer"
|
|
411
|
+
onClick={(e) => {
|
|
412
|
+
e.stopPropagation();
|
|
413
|
+
handleRemove(id);
|
|
414
|
+
}}
|
|
415
|
+
data-testid={`badge-venue-${id}`}
|
|
416
|
+
>
|
|
417
|
+
{node?.label ?? id}
|
|
418
|
+
<X className="h-3 w-3 ml-1" />
|
|
419
|
+
</Badge>
|
|
420
|
+
);
|
|
421
|
+
})}
|
|
422
|
+
{value.length > 5 && (
|
|
423
|
+
<Badge variant="outline">+{value.length - 5} more</Badge>
|
|
424
|
+
)}
|
|
425
|
+
</div>
|
|
426
|
+
)}
|
|
427
|
+
</div>
|
|
428
|
+
<VenueTypeSelector
|
|
429
|
+
value={value}
|
|
430
|
+
onChange={onChange}
|
|
431
|
+
open={open}
|
|
432
|
+
onOpenChange={setOpen}
|
|
433
|
+
/>
|
|
434
|
+
</div>
|
|
435
|
+
);
|
|
436
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
const MOBILE_BREAKPOINT = 768
|
|
4
|
+
|
|
5
|
+
export function useIsMobile() {
|
|
6
|
+
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
7
|
+
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
|
+
const onChange = () => {
|
|
11
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
+
}
|
|
13
|
+
mql.addEventListener("change", onChange)
|
|
14
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
|
+
return () => mql.removeEventListener("change", onChange)
|
|
16
|
+
}, [])
|
|
17
|
+
|
|
18
|
+
return !!isMobile
|
|
19
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ToastActionElement,
|
|
5
|
+
ToastProps,
|
|
6
|
+
} from "@/components/ui/toast"
|
|
7
|
+
|
|
8
|
+
const TOAST_LIMIT = 1
|
|
9
|
+
const TOAST_REMOVE_DELAY = 1000000
|
|
10
|
+
|
|
11
|
+
type ToasterToast = ToastProps & {
|
|
12
|
+
id: string
|
|
13
|
+
title?: React.ReactNode
|
|
14
|
+
description?: React.ReactNode
|
|
15
|
+
action?: ToastActionElement
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const actionTypes = {
|
|
19
|
+
ADD_TOAST: "ADD_TOAST",
|
|
20
|
+
UPDATE_TOAST: "UPDATE_TOAST",
|
|
21
|
+
DISMISS_TOAST: "DISMISS_TOAST",
|
|
22
|
+
REMOVE_TOAST: "REMOVE_TOAST",
|
|
23
|
+
} as const
|
|
24
|
+
|
|
25
|
+
let count = 0
|
|
26
|
+
|
|
27
|
+
function genId() {
|
|
28
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER
|
|
29
|
+
return count.toString()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type ActionType = typeof actionTypes
|
|
33
|
+
|
|
34
|
+
type Action =
|
|
35
|
+
| {
|
|
36
|
+
type: ActionType["ADD_TOAST"]
|
|
37
|
+
toast: ToasterToast
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
type: ActionType["UPDATE_TOAST"]
|
|
41
|
+
toast: Partial<ToasterToast>
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
type: ActionType["DISMISS_TOAST"]
|
|
45
|
+
toastId?: ToasterToast["id"]
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
type: ActionType["REMOVE_TOAST"]
|
|
49
|
+
toastId?: ToasterToast["id"]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface State {
|
|
53
|
+
toasts: ToasterToast[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
|
|
57
|
+
|
|
58
|
+
const addToRemoveQueue = (toastId: string) => {
|
|
59
|
+
if (toastTimeouts.has(toastId)) {
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const timeout = setTimeout(() => {
|
|
64
|
+
toastTimeouts.delete(toastId)
|
|
65
|
+
dispatch({
|
|
66
|
+
type: "REMOVE_TOAST",
|
|
67
|
+
toastId: toastId,
|
|
68
|
+
})
|
|
69
|
+
}, TOAST_REMOVE_DELAY)
|
|
70
|
+
|
|
71
|
+
toastTimeouts.set(toastId, timeout)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const reducer = (state: State, action: Action): State => {
|
|
75
|
+
switch (action.type) {
|
|
76
|
+
case "ADD_TOAST":
|
|
77
|
+
return {
|
|
78
|
+
...state,
|
|
79
|
+
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
case "UPDATE_TOAST":
|
|
83
|
+
return {
|
|
84
|
+
...state,
|
|
85
|
+
toasts: state.toasts.map((t) =>
|
|
86
|
+
t.id === action.toast.id ? { ...t, ...action.toast } : t
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
case "DISMISS_TOAST": {
|
|
91
|
+
const { toastId } = action
|
|
92
|
+
|
|
93
|
+
// ! Side effects ! - This could be extracted into a dismissToast() action,
|
|
94
|
+
// but I'll keep it here for simplicity
|
|
95
|
+
if (toastId) {
|
|
96
|
+
addToRemoveQueue(toastId)
|
|
97
|
+
} else {
|
|
98
|
+
state.toasts.forEach((toast) => {
|
|
99
|
+
addToRemoveQueue(toast.id)
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
...state,
|
|
105
|
+
toasts: state.toasts.map((t) =>
|
|
106
|
+
t.id === toastId || toastId === undefined
|
|
107
|
+
? {
|
|
108
|
+
...t,
|
|
109
|
+
open: false,
|
|
110
|
+
}
|
|
111
|
+
: t
|
|
112
|
+
),
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
case "REMOVE_TOAST":
|
|
116
|
+
if (action.toastId === undefined) {
|
|
117
|
+
return {
|
|
118
|
+
...state,
|
|
119
|
+
toasts: [],
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
...state,
|
|
124
|
+
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const listeners: Array<(state: State) => void> = []
|
|
130
|
+
|
|
131
|
+
let memoryState: State = { toasts: [] }
|
|
132
|
+
|
|
133
|
+
function dispatch(action: Action) {
|
|
134
|
+
memoryState = reducer(memoryState, action)
|
|
135
|
+
listeners.forEach((listener) => {
|
|
136
|
+
listener(memoryState)
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type Toast = Omit<ToasterToast, "id">
|
|
141
|
+
|
|
142
|
+
function toast({ ...props }: Toast) {
|
|
143
|
+
const id = genId()
|
|
144
|
+
|
|
145
|
+
const update = (props: ToasterToast) =>
|
|
146
|
+
dispatch({
|
|
147
|
+
type: "UPDATE_TOAST",
|
|
148
|
+
toast: { ...props, id },
|
|
149
|
+
})
|
|
150
|
+
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
|
|
151
|
+
|
|
152
|
+
dispatch({
|
|
153
|
+
type: "ADD_TOAST",
|
|
154
|
+
toast: {
|
|
155
|
+
...props,
|
|
156
|
+
id,
|
|
157
|
+
open: true,
|
|
158
|
+
onOpenChange: (open) => {
|
|
159
|
+
if (!open) dismiss()
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
id: id,
|
|
166
|
+
dismiss,
|
|
167
|
+
update,
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function useToast() {
|
|
172
|
+
const [state, setState] = React.useState<State>(memoryState)
|
|
173
|
+
|
|
174
|
+
React.useEffect(() => {
|
|
175
|
+
listeners.push(setState)
|
|
176
|
+
return () => {
|
|
177
|
+
const index = listeners.indexOf(setState)
|
|
178
|
+
if (index > -1) {
|
|
179
|
+
listeners.splice(index, 1)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}, [state])
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
...state,
|
|
186
|
+
toast,
|
|
187
|
+
dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { useToast, toast }
|