@freighttech/shipment-tracking 0.6.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/LICENSE +21 -0
- package/NOTICE +25 -0
- package/dist/generated/entities/bic_config/index.js +21 -0
- package/dist/generated/entities/bic_config/index.js.map +7 -0
- package/dist/generated/entities/carrier_config/index.js +27 -0
- package/dist/generated/entities/carrier_config/index.js.map +7 -0
- package/dist/generated/entities/location_override/index.js +33 -0
- package/dist/generated/entities/location_override/index.js.map +7 -0
- package/dist/generated/entities/shipment/index.js +73 -0
- package/dist/generated/entities/shipment/index.js.map +7 -0
- package/dist/generated/entities/ships_go_config/index.js +31 -0
- package/dist/generated/entities/ships_go_config/index.js.map +7 -0
- package/dist/generated/entities/tracking_event/index.js +101 -0
- package/dist/generated/entities/tracking_event/index.js.map +7 -0
- package/dist/generated/entities/tracking_job/index.js +47 -0
- package/dist/generated/entities/tracking_job/index.js.map +7 -0
- package/dist/generated/entities/webhook/index.js +25 -0
- package/dist/generated/entities/webhook/index.js.map +7 -0
- package/dist/generated/entities/webhook_delivery/index.js +25 -0
- package/dist/generated/entities/webhook_delivery/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +21 -0
- package/dist/generated/entities.ids.generated.js.map +7 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +7 -0
- package/dist/modules/shipment_tracking/acl.js +22 -0
- package/dist/modules/shipment_tracking/acl.js.map +7 -0
- package/dist/modules/shipment_tracking/api/bic-configs/route.js +176 -0
- package/dist/modules/shipment_tracking/api/bic-configs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/bic-configs/test/route.js +95 -0
- package/dist/modules/shipment_tracking/api/bic-configs/test/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/cargo-events/route.js +93 -0
- package/dist/modules/shipment_tracking/api/cargo-events/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/carrier-configs/route.js +139 -0
- package/dist/modules/shipment_tracking/api/carrier-configs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/dashboard/ships-map/route.js +177 -0
- package/dist/modules/shipment_tracking/api/dashboard/ships-map/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/location-overrides/route.js +179 -0
- package/dist/modules/shipment_tracking/api/location-overrides/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/openapi.js +27 -0
- package/dist/modules/shipment_tracking/api/openapi.js.map +7 -0
- package/dist/modules/shipment_tracking/api/shipments/route.js +192 -0
- package/dist/modules/shipment_tracking/api/shipments/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/shipsgo-configs/route.js +185 -0
- package/dist/modules/shipment_tracking/api/shipsgo-configs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/route.js +144 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/sync/route.js +107 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/sync/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/utils.js +12 -0
- package/dist/modules/shipment_tracking/api/utils.js.map +7 -0
- package/dist/modules/shipment_tracking/api/webhooks/deliveries/route.js +76 -0
- package/dist/modules/shipment_tracking/api/webhooks/deliveries/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/webhooks/route.js +135 -0
- package/dist/modules/shipment_tracking/api/webhooks/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/webhooks/test/route.js +71 -0
- package/dist/modules/shipment_tracking/api/webhooks/test/route.js.map +7 -0
- package/dist/modules/shipment_tracking/assets/carriers/cma_cgm.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/cosco.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/evergreen.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/hapag_lloyd.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/maersk.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/msc.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/one.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/oocl.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/yang_ming.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/zim.png +0 -0
- package/dist/modules/shipment_tracking/assets/index.js +52 -0
- package/dist/modules/shipment_tracking/assets/index.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.js +621 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.js +198 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.js +279 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.js +10 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.js +198 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/ce.js +52 -0
- package/dist/modules/shipment_tracking/ce.js.map +7 -0
- package/dist/modules/shipment_tracking/cli.js +229 -0
- package/dist/modules/shipment_tracking/cli.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/bic-configs.js +66 -0
- package/dist/modules/shipment_tracking/commands/bic-configs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/carrier-configs.js +65 -0
- package/dist/modules/shipment_tracking/commands/carrier-configs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/index.js +9 -0
- package/dist/modules/shipment_tracking/commands/index.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/location-overrides.js +93 -0
- package/dist/modules/shipment_tracking/commands/location-overrides.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/shipments.js +200 -0
- package/dist/modules/shipment_tracking/commands/shipments.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/shipsgo-configs.js +75 -0
- package/dist/modules/shipment_tracking/commands/shipsgo-configs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/tracking-jobs.js +120 -0
- package/dist/modules/shipment_tracking/commands/tracking-jobs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/tracking.js +140 -0
- package/dist/modules/shipment_tracking/commands/tracking.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/webhooks.js +115 -0
- package/dist/modules/shipment_tracking/commands/webhooks.js.map +7 -0
- package/dist/modules/shipment_tracking/components/CombinedTimestampCell.js +168 -0
- package/dist/modules/shipment_tracking/components/CombinedTimestampCell.js.map +7 -0
- package/dist/modules/shipment_tracking/components/FacilityLocationInput.js +202 -0
- package/dist/modules/shipment_tracking/components/FacilityLocationInput.js.map +7 -0
- package/dist/modules/shipment_tracking/components/LocationOverrideDrawer.js +501 -0
- package/dist/modules/shipment_tracking/components/LocationOverrideDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/ShipmentDetailsDrawer.js +818 -0
- package/dist/modules/shipment_tracking/components/ShipmentDetailsDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/ShipmentDrawer.js +404 -0
- package/dist/modules/shipment_tracking/components/ShipmentDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/ShipsGoConfigSection.js +200 -0
- package/dist/modules/shipment_tracking/components/ShipsGoConfigSection.js.map +7 -0
- package/dist/modules/shipment_tracking/components/TimestampCell.js +108 -0
- package/dist/modules/shipment_tracking/components/TimestampCell.js.map +7 -0
- package/dist/modules/shipment_tracking/components/TrackingJobDrawer.js +343 -0
- package/dist/modules/shipment_tracking/components/TrackingJobDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/VesselTrackingMap.js +496 -0
- package/dist/modules/shipment_tracking/components/VesselTrackingMap.js.map +7 -0
- package/dist/modules/shipment_tracking/components/WebhookDrawer.js +332 -0
- package/dist/modules/shipment_tracking/components/WebhookDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/data/entities.js +686 -0
- package/dist/modules/shipment_tracking/data/entities.js.map +7 -0
- package/dist/modules/shipment_tracking/data/validators.js +434 -0
- package/dist/modules/shipment_tracking/data/validators.js.map +7 -0
- package/dist/modules/shipment_tracking/di.js +60 -0
- package/dist/modules/shipment_tracking/di.js.map +7 -0
- package/dist/modules/shipment_tracking/encryption.js +12 -0
- package/dist/modules/shipment_tracking/encryption.js.map +7 -0
- package/dist/modules/shipment_tracking/events.js +87 -0
- package/dist/modules/shipment_tracking/events.js.map +7 -0
- package/dist/modules/shipment_tracking/hooks/useVesselTracking.js +137 -0
- package/dist/modules/shipment_tracking/hooks/useVesselTracking.js.map +7 -0
- package/dist/modules/shipment_tracking/i18n/de.json +327 -0
- package/dist/modules/shipment_tracking/i18n/en.json +327 -0
- package/dist/modules/shipment_tracking/i18n/es.json +327 -0
- package/dist/modules/shipment_tracking/i18n/pl.json +327 -0
- package/dist/modules/shipment_tracking/index.js +15 -0
- package/dist/modules/shipment_tracking/index.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/cma-cgm.js +66 -0
- package/dist/modules/shipment_tracking/lib/adapters/cma-cgm.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco-types.js +1 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco-types.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco.js +236 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/evergreen.js +87 -0
- package/dist/modules/shipment_tracking/lib/adapters/evergreen.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/hapag-lloyd.js +68 -0
- package/dist/modules/shipment_tracking/lib/adapters/hapag-lloyd.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/index.js +20 -0
- package/dist/modules/shipment_tracking/lib/adapters/index.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/maersk.js +84 -0
- package/dist/modules/shipment_tracking/lib/adapters/maersk.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/msc.js +170 -0
- package/dist/modules/shipment_tracking/lib/adapters/msc.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/zim.js +85 -0
- package/dist/modules/shipment_tracking/lib/adapters/zim.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/audit-helpers.js +20 -0
- package/dist/modules/shipment_tracking/lib/audit-helpers.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/auth/base64url.js +8 -0
- package/dist/modules/shipment_tracking/lib/auth/base64url.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/auth/oauth-client.js +38 -0
- package/dist/modules/shipment_tracking/lib/auth/oauth-client.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/background.js +15 -0
- package/dist/modules/shipment_tracking/lib/background.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/bic-api-client.js +106 -0
- package/dist/modules/shipment_tracking/lib/bic-api-client.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/carrier-adapter.js +17 -0
- package/dist/modules/shipment_tracking/lib/carrier-adapter.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/current-vessel.js +149 -0
- package/dist/modules/shipment_tracking/lib/current-vessel.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-mapping.js +124 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-mapping.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-parser.js +112 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-parser.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/dcsa-params.js +16 -0
- package/dist/modules/shipment_tracking/lib/dcsa-params.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/empty-return.js +48 -0
- package/dist/modules/shipment_tracking/lib/empty-return.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/location-overrides.js +85 -0
- package/dist/modules/shipment_tracking/lib/location-overrides.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/location-types.js +59 -0
- package/dist/modules/shipment_tracking/lib/location-types.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/logger.js +113 -0
- package/dist/modules/shipment_tracking/lib/logger.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/poi-event-processor.js +183 -0
- package/dist/modules/shipment_tracking/lib/poi-event-processor.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/poi-nats-config.js +52 -0
- package/dist/modules/shipment_tracking/lib/poi-nats-config.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/poi-types.js +43 -0
- package/dist/modules/shipment_tracking/lib/poi-types.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/rate-limiter.js +31 -0
- package/dist/modules/shipment_tracking/lib/rate-limiter.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/route-extraction.js +187 -0
- package/dist/modules/shipment_tracking/lib/route-extraction.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/route-inference.js +106 -0
- package/dist/modules/shipment_tracking/lib/route-inference.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/schedule-generator.js +63 -0
- package/dist/modules/shipment_tracking/lib/schedule-generator.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-client.js +143 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-client.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-mapper.js +204 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-mapper.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/status-machine.js +131 -0
- package/dist/modules/shipment_tracking/lib/status-machine.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/time-extraction.js +41 -0
- package/dist/modules/shipment_tracking/lib/time-extraction.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/timestamp-utils.js +100 -0
- package/dist/modules/shipment_tracking/lib/timestamp-utils.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/vessel-api.js +111 -0
- package/dist/modules/shipment_tracking/lib/vessel-api.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/vessel-cache.js +50 -0
- package/dist/modules/shipment_tracking/lib/vessel-cache.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/vessel-extraction.js +13 -0
- package/dist/modules/shipment_tracking/lib/vessel-extraction.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/webhook-dispatcher.js +62 -0
- package/dist/modules/shipment_tracking/lib/webhook-dispatcher.js.map +7 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.js +48 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.js.map +7 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.js +15 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.js.map +7 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.js +47 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.js.map +7 -0
- package/dist/modules/shipment_tracking/notifications.js +145 -0
- package/dist/modules/shipment_tracking/notifications.js.map +7 -0
- package/dist/modules/shipment_tracking/services/carrierRegistry.js +24 -0
- package/dist/modules/shipment_tracking/services/carrierRegistry.js.map +7 -0
- package/dist/modules/shipment_tracking/services/poiNatsService.js +397 -0
- package/dist/modules/shipment_tracking/services/poiNatsService.js.map +7 -0
- package/dist/modules/shipment_tracking/services/shipsGoProvider.js +163 -0
- package/dist/modules/shipment_tracking/services/shipsGoProvider.js.map +7 -0
- package/dist/modules/shipment_tracking/services/trackingService.js +1283 -0
- package/dist/modules/shipment_tracking/services/trackingService.js.map +7 -0
- package/dist/modules/shipment_tracking/services/webhookService.js +263 -0
- package/dist/modules/shipment_tracking/services/webhookService.js.map +7 -0
- package/dist/modules/shipment_tracking/setup.js +72 -0
- package/dist/modules/shipment_tracking/setup.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/cargo-event-created.js +60 -0
- package/dist/modules/shipment_tracking/subscribers/cargo-event-created.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.js +58 -0
- package/dist/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-notification.js +82 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-notification.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.js +53 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/shipment-status-changed.js +28 -0
- package/dist/modules/shipment_tracking/subscribers/shipment-status-changed.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/terminal-event-ingest.js +67 -0
- package/dist/modules/shipment_tracking/subscribers/terminal-event-ingest.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-initial-poll.js +30 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-initial-poll.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.js +19 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.js.map +7 -0
- package/dist/modules/shipment_tracking/tables/index.js +6 -0
- package/dist/modules/shipment_tracking/tables/index.js.map +7 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.client.js +284 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.client.js.map +7 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.js +36 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.js.map +7 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/config.js +25 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/config.js.map +7 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.js +355 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.js.map +7 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.js +26 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.js.map +7 -0
- package/dist/types/assets.d.js +1 -0
- package/dist/types/assets.d.js.map +7 -0
- package/generated/entities/bic_config/index.ts +20 -0
- package/generated/entities/carrier_config/index.ts +23 -0
- package/generated/entities/location_override/index.ts +26 -0
- package/generated/entities/shipment/index.ts +46 -0
- package/generated/entities/ships_go_config/index.ts +25 -0
- package/generated/entities/tracking_event/index.ts +60 -0
- package/generated/entities/tracking_job/index.ts +33 -0
- package/generated/entities/webhook/index.ts +22 -0
- package/generated/entities/webhook_delivery/index.ts +22 -0
- package/generated/entities.ids.generated.ts +47 -0
- package/package.json +81 -0
- package/src/index.ts +39 -0
- package/src/modules/shipment_tracking/__integration__/TC-TRACK-410-shipsgo-config-api.spec.ts +133 -0
- package/src/modules/shipment_tracking/__integration__/meta.ts +4 -0
- package/src/modules/shipment_tracking/__tests__/empty-return-stop.test.ts +231 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/hapag-lloyd-transship-container.json +702 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/index.ts +434 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/maersk-multi-transship-completed.json +1518 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/maersk-transship-intransit.json +558 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-direct.json +222 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-multi-transship-completed.json +974 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-multi.json +4846 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-transship.json +409 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/poi-events.json +240 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic/index.ts +138 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-eta-updates.json +288 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-route-inference.json +201 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-voyage-progression.json +410 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-air-mapper.test.ts +157 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-client.test.ts +155 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-mapper.test.ts +201 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-poll.test.ts +357 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-provider.test.ts +364 -0
- package/src/modules/shipment_tracking/__tests__/trackingService.integration.test.ts +2248 -0
- package/src/modules/shipment_tracking/__tests__/webhookPayload.test.ts +151 -0
- package/src/modules/shipment_tracking/acl.ts +18 -0
- package/src/modules/shipment_tracking/api/bic-configs/route.ts +206 -0
- package/src/modules/shipment_tracking/api/bic-configs/test/route.ts +108 -0
- package/src/modules/shipment_tracking/api/cargo-events/route.ts +101 -0
- package/src/modules/shipment_tracking/api/carrier-configs/route.ts +142 -0
- package/src/modules/shipment_tracking/api/dashboard/ships-map/route.ts +246 -0
- package/src/modules/shipment_tracking/api/location-overrides/route.ts +185 -0
- package/src/modules/shipment_tracking/api/openapi.ts +28 -0
- package/src/modules/shipment_tracking/api/shipments/route.ts +197 -0
- package/src/modules/shipment_tracking/api/shipsgo-configs/route.ts +215 -0
- package/src/modules/shipment_tracking/api/tracking-jobs/route.ts +149 -0
- package/src/modules/shipment_tracking/api/tracking-jobs/sync/route.ts +116 -0
- package/src/modules/shipment_tracking/api/utils.ts +10 -0
- package/src/modules/shipment_tracking/api/webhooks/deliveries/route.ts +82 -0
- package/src/modules/shipment_tracking/api/webhooks/route.ts +138 -0
- package/src/modules/shipment_tracking/api/webhooks/test/route.ts +84 -0
- package/src/modules/shipment_tracking/assets/carriers/cma_cgm.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/cosco.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/evergreen.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/hapag_lloyd.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/maersk.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/msc.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/one.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/oocl.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/yang_ming.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/zim.png +0 -0
- package/src/modules/shipment_tracking/assets/index.ts +66 -0
- package/src/modules/shipment_tracking/backend/carrier-configs/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/carrier-configs/page.tsx +782 -0
- package/src/modules/shipment_tracking/backend/location-overrides/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/location-overrides/page.tsx +241 -0
- package/src/modules/shipment_tracking/backend/shipment-tracking/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/shipment-tracking/page.tsx +340 -0
- package/src/modules/shipment_tracking/backend/tracking-jobs/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/tracking-jobs/page.tsx +16 -0
- package/src/modules/shipment_tracking/backend/webhooks/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/webhooks/page.tsx +228 -0
- package/src/modules/shipment_tracking/ce.ts +48 -0
- package/src/modules/shipment_tracking/cli.ts +321 -0
- package/src/modules/shipment_tracking/commands/bic-configs.ts +94 -0
- package/src/modules/shipment_tracking/commands/carrier-configs.ts +89 -0
- package/src/modules/shipment_tracking/commands/index.ts +8 -0
- package/src/modules/shipment_tracking/commands/location-overrides.ts +119 -0
- package/src/modules/shipment_tracking/commands/shipments.ts +247 -0
- package/src/modules/shipment_tracking/commands/shipsgo-configs.ts +101 -0
- package/src/modules/shipment_tracking/commands/tracking-jobs.ts +158 -0
- package/src/modules/shipment_tracking/commands/tracking.ts +230 -0
- package/src/modules/shipment_tracking/commands/webhooks.ts +159 -0
- package/src/modules/shipment_tracking/components/CombinedTimestampCell.tsx +236 -0
- package/src/modules/shipment_tracking/components/FacilityLocationInput.tsx +235 -0
- package/src/modules/shipment_tracking/components/LocationOverrideDrawer.tsx +586 -0
- package/src/modules/shipment_tracking/components/ShipmentDetailsDrawer.tsx +1364 -0
- package/src/modules/shipment_tracking/components/ShipmentDrawer.tsx +498 -0
- package/src/modules/shipment_tracking/components/ShipsGoConfigSection.tsx +266 -0
- package/src/modules/shipment_tracking/components/TimestampCell.tsx +146 -0
- package/src/modules/shipment_tracking/components/TrackingJobDrawer.tsx +467 -0
- package/src/modules/shipment_tracking/components/VesselTrackingMap.tsx +761 -0
- package/src/modules/shipment_tracking/components/WebhookDrawer.tsx +434 -0
- package/src/modules/shipment_tracking/data/entities.ts +748 -0
- package/src/modules/shipment_tracking/data/validators.ts +523 -0
- package/src/modules/shipment_tracking/di.ts +73 -0
- package/src/modules/shipment_tracking/encryption.ts +17 -0
- package/src/modules/shipment_tracking/events.ts +122 -0
- package/src/modules/shipment_tracking/hooks/useVesselTracking.ts +297 -0
- package/src/modules/shipment_tracking/i18n/de.json +327 -0
- package/src/modules/shipment_tracking/i18n/en.json +327 -0
- package/src/modules/shipment_tracking/i18n/es.json +327 -0
- package/src/modules/shipment_tracking/i18n/pl.json +327 -0
- package/src/modules/shipment_tracking/index.ts +13 -0
- package/src/modules/shipment_tracking/lib/__tests__/dcsa-event-mapping.test.ts +385 -0
- package/src/modules/shipment_tracking/lib/__tests__/dcsa-event-parser.test.ts +398 -0
- package/src/modules/shipment_tracking/lib/__tests__/empty-return.test.ts +174 -0
- package/src/modules/shipment_tracking/lib/__tests__/poi-event-processor.test.ts +699 -0
- package/src/modules/shipment_tracking/lib/__tests__/route-inference.test.ts +402 -0
- package/src/modules/shipment_tracking/lib/__tests__/status-machine.test.ts +447 -0
- package/src/modules/shipment_tracking/lib/__tests__/time-extraction.test.ts +331 -0
- package/src/modules/shipment_tracking/lib/__tests__/timestamp-utils.test.ts +260 -0
- package/src/modules/shipment_tracking/lib/__tests__/vessel-api.test.ts +125 -0
- package/src/modules/shipment_tracking/lib/__tests__/vessel-extraction.test.ts +108 -0
- package/src/modules/shipment_tracking/lib/adapters/cma-cgm.ts +84 -0
- package/src/modules/shipment_tracking/lib/adapters/cosco-types.ts +145 -0
- package/src/modules/shipment_tracking/lib/adapters/cosco.ts +314 -0
- package/src/modules/shipment_tracking/lib/adapters/evergreen.ts +107 -0
- package/src/modules/shipment_tracking/lib/adapters/hapag-lloyd.ts +88 -0
- package/src/modules/shipment_tracking/lib/adapters/index.ts +18 -0
- package/src/modules/shipment_tracking/lib/adapters/maersk.ts +104 -0
- package/src/modules/shipment_tracking/lib/adapters/msc.ts +223 -0
- package/src/modules/shipment_tracking/lib/adapters/zim.ts +106 -0
- package/src/modules/shipment_tracking/lib/audit-helpers.ts +29 -0
- package/src/modules/shipment_tracking/lib/auth/base64url.ts +4 -0
- package/src/modules/shipment_tracking/lib/auth/oauth-client.ts +53 -0
- package/src/modules/shipment_tracking/lib/background.ts +24 -0
- package/src/modules/shipment_tracking/lib/bic-api-client.ts +199 -0
- package/src/modules/shipment_tracking/lib/carrier-adapter.ts +136 -0
- package/src/modules/shipment_tracking/lib/current-vessel.ts +274 -0
- package/src/modules/shipment_tracking/lib/dcsa-event-mapping.ts +202 -0
- package/src/modules/shipment_tracking/lib/dcsa-event-parser.ts +163 -0
- package/src/modules/shipment_tracking/lib/dcsa-params.ts +14 -0
- package/src/modules/shipment_tracking/lib/empty-return.ts +122 -0
- package/src/modules/shipment_tracking/lib/location-overrides.ts +150 -0
- package/src/modules/shipment_tracking/lib/location-types.ts +154 -0
- package/src/modules/shipment_tracking/lib/logger.ts +195 -0
- package/src/modules/shipment_tracking/lib/poi-event-processor.ts +302 -0
- package/src/modules/shipment_tracking/lib/poi-nats-config.ts +134 -0
- package/src/modules/shipment_tracking/lib/poi-types.ts +198 -0
- package/src/modules/shipment_tracking/lib/rate-limiter.ts +58 -0
- package/src/modules/shipment_tracking/lib/route-extraction.ts +439 -0
- package/src/modules/shipment_tracking/lib/route-inference.ts +238 -0
- package/src/modules/shipment_tracking/lib/schedule-generator.ts +92 -0
- package/src/modules/shipment_tracking/lib/shipsgo-client.ts +350 -0
- package/src/modules/shipment_tracking/lib/shipsgo-mapper.ts +296 -0
- package/src/modules/shipment_tracking/lib/status-machine.ts +230 -0
- package/src/modules/shipment_tracking/lib/time-extraction.ts +85 -0
- package/src/modules/shipment_tracking/lib/timestamp-utils.ts +244 -0
- package/src/modules/shipment_tracking/lib/vessel-api.ts +299 -0
- package/src/modules/shipment_tracking/lib/vessel-cache.ts +102 -0
- package/src/modules/shipment_tracking/lib/vessel-extraction.ts +39 -0
- package/src/modules/shipment_tracking/lib/webhook-dispatcher.ts +93 -0
- package/src/modules/shipment_tracking/migrations/.snapshot-open-mercato.json +2914 -0
- package/src/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.ts +60 -0
- package/src/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.ts +22 -0
- package/src/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.ts +65 -0
- package/src/modules/shipment_tracking/notifications.ts +151 -0
- package/src/modules/shipment_tracking/services/carrierRegistry.ts +29 -0
- package/src/modules/shipment_tracking/services/poiNatsService.ts +526 -0
- package/src/modules/shipment_tracking/services/shipsGoProvider.ts +231 -0
- package/src/modules/shipment_tracking/services/trackingService.ts +1777 -0
- package/src/modules/shipment_tracking/services/webhookService.ts +347 -0
- package/src/modules/shipment_tracking/setup.ts +99 -0
- package/src/modules/shipment_tracking/subscribers/__tests__/terminal-event-ingest.test.ts +141 -0
- package/src/modules/shipment_tracking/subscribers/cargo-event-created.ts +115 -0
- package/src/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.ts +115 -0
- package/src/modules/shipment_tracking/subscribers/poi-event-notification.ts +144 -0
- package/src/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.ts +94 -0
- package/src/modules/shipment_tracking/subscribers/shipment-status-changed.ts +41 -0
- package/src/modules/shipment_tracking/subscribers/terminal-event-ingest.ts +109 -0
- package/src/modules/shipment_tracking/subscribers/tracking-job-initial-poll.ts +53 -0
- package/src/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.ts +50 -0
- package/src/modules/shipment_tracking/tables/index.ts +4 -0
- package/src/modules/shipment_tracking/tables/tracking_job/table.client.tsx +337 -0
- package/src/modules/shipment_tracking/tables/tracking_job/table.ts +34 -0
- package/src/modules/shipment_tracking/widgets/dashboard/ships-map/config.ts +32 -0
- package/src/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.tsx +448 -0
- package/src/modules/shipment_tracking/widgets/dashboard/ships-map/widget.ts +25 -0
- package/src/types/assets.d.ts +5 -0
|
@@ -0,0 +1,818 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useState, useMemo, useCallback } from "react";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import Image from "next/image";
|
|
7
|
+
import {
|
|
8
|
+
Ship,
|
|
9
|
+
MapPin,
|
|
10
|
+
Anchor,
|
|
11
|
+
Calendar,
|
|
12
|
+
Package,
|
|
13
|
+
ChevronDown,
|
|
14
|
+
ChevronUp,
|
|
15
|
+
Clock,
|
|
16
|
+
ArrowRight,
|
|
17
|
+
ExternalLink,
|
|
18
|
+
Navigation,
|
|
19
|
+
Radio,
|
|
20
|
+
Truck,
|
|
21
|
+
Warehouse
|
|
22
|
+
} from "lucide-react";
|
|
23
|
+
import {
|
|
24
|
+
Sheet,
|
|
25
|
+
SheetContent
|
|
26
|
+
} from "@freighttech/ui/primitives/sheet";
|
|
27
|
+
import { Badge } from "@freighttech/ui/primitives/badge";
|
|
28
|
+
import { Spinner } from "@freighttech/ui/primitives/spinner";
|
|
29
|
+
import { apiCall } from "@freighttech/ui/backend/utils/apiCall";
|
|
30
|
+
import { useT, useLocale } from "@open-mercato/shared/lib/i18n/context";
|
|
31
|
+
import { getCarrierLogo } from "../assets/index.js";
|
|
32
|
+
import { VesselTrackingMap } from "./VesselTrackingMap.js";
|
|
33
|
+
import { getCurrentVessel } from "../lib/current-vessel.js";
|
|
34
|
+
function getPrimaryTimestamp(timestamps) {
|
|
35
|
+
if (!timestamps || timestamps.length === 0) return null;
|
|
36
|
+
const latest = timestamps.reduce(
|
|
37
|
+
(best, entry) => entry.updatedAt > best.updatedAt ? entry : best
|
|
38
|
+
);
|
|
39
|
+
return latest.value;
|
|
40
|
+
}
|
|
41
|
+
function formatShortDate(dateString) {
|
|
42
|
+
if (!dateString) return "-";
|
|
43
|
+
const date = new Date(dateString);
|
|
44
|
+
if (Number.isNaN(date.getTime())) return "-";
|
|
45
|
+
return date.toLocaleDateString(void 0, { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit" });
|
|
46
|
+
}
|
|
47
|
+
function formatDateOnly(dateString) {
|
|
48
|
+
if (!dateString) return "-";
|
|
49
|
+
const date = new Date(dateString);
|
|
50
|
+
if (Number.isNaN(date.getTime())) return "-";
|
|
51
|
+
return date.toLocaleDateString(void 0, { day: "2-digit", month: "2-digit" });
|
|
52
|
+
}
|
|
53
|
+
function pickRegionName(event, locale) {
|
|
54
|
+
if (locale === "pl") return event.regionNamePl || event.regionNameEn || null;
|
|
55
|
+
return event.regionNameEn || event.regionNamePl || null;
|
|
56
|
+
}
|
|
57
|
+
function calculateTransitDays(atd, ata, eta) {
|
|
58
|
+
const startDate = atd ? new Date(atd) : null;
|
|
59
|
+
const endDate = ata ? new Date(ata) : eta ? new Date(eta) : null;
|
|
60
|
+
if (!startDate || !endDate) return null;
|
|
61
|
+
if (Number.isNaN(startDate.getTime()) || Number.isNaN(endDate.getTime())) return null;
|
|
62
|
+
const diffMs = endDate.getTime() - startDate.getTime();
|
|
63
|
+
return Math.ceil(diffMs / (1e3 * 60 * 60 * 24));
|
|
64
|
+
}
|
|
65
|
+
function calculateDelayFromHistory(timestamps) {
|
|
66
|
+
if (!timestamps || timestamps.length < 2) return null;
|
|
67
|
+
const sorted = [...timestamps].sort(
|
|
68
|
+
(a, b) => new Date(a.updatedAt).getTime() - new Date(b.updatedAt).getTime()
|
|
69
|
+
);
|
|
70
|
+
const oldest = new Date(sorted[0].value);
|
|
71
|
+
const newest = new Date(sorted[sorted.length - 1].value);
|
|
72
|
+
if (Number.isNaN(oldest.getTime()) || Number.isNaN(newest.getTime())) return null;
|
|
73
|
+
const diffMs = newest.getTime() - oldest.getTime();
|
|
74
|
+
const diffDays = Math.round(diffMs / (1e3 * 60 * 60 * 24));
|
|
75
|
+
return diffDays !== 0 ? diffDays : null;
|
|
76
|
+
}
|
|
77
|
+
function calculateDelayFromPlanned(planned, actual) {
|
|
78
|
+
if (!planned || !actual) return null;
|
|
79
|
+
const plannedDate = new Date(planned);
|
|
80
|
+
const actualDate = new Date(actual);
|
|
81
|
+
if (Number.isNaN(plannedDate.getTime()) || Number.isNaN(actualDate.getTime())) return null;
|
|
82
|
+
const diffMs = actualDate.getTime() - plannedDate.getTime();
|
|
83
|
+
const diffDays = Math.round(diffMs / (1e3 * 60 * 60 * 24));
|
|
84
|
+
return diffDays !== 0 ? diffDays : null;
|
|
85
|
+
}
|
|
86
|
+
function getCarrierTrackingUrl(carrierCode, reference) {
|
|
87
|
+
if (!carrierCode) return null;
|
|
88
|
+
const code = carrierCode.toLowerCase();
|
|
89
|
+
const ref = reference?.trim();
|
|
90
|
+
if ((code === "maeu" || code === "maersk") && ref) {
|
|
91
|
+
return `https://www.maersk.com/tracking/${encodeURIComponent(ref)}`;
|
|
92
|
+
}
|
|
93
|
+
const urls = {
|
|
94
|
+
maeu: "https://www.maersk.com/tracking",
|
|
95
|
+
maersk: "https://www.maersk.com/tracking",
|
|
96
|
+
mscu: "https://www.msc.com/track-a-shipment",
|
|
97
|
+
msc: "https://www.msc.com/track-a-shipment",
|
|
98
|
+
cmdu: "https://www.cma-cgm.com/ebusiness/tracking",
|
|
99
|
+
"cma-cgm": "https://www.cma-cgm.com/ebusiness/tracking",
|
|
100
|
+
hlcu: "https://www.hapag-lloyd.com/en/online-business/track/track-by-container-solution.html",
|
|
101
|
+
"hapag-lloyd": "https://www.hapag-lloyd.com/en/online-business/track/track-by-container-solution.html",
|
|
102
|
+
cosu: "https://elines.coscoshipping.com/ebusiness/cargoTracking",
|
|
103
|
+
cosco: "https://elines.coscoshipping.com/ebusiness/cargoTracking",
|
|
104
|
+
eglv: "https://www.evergreen-line.com/trkc/",
|
|
105
|
+
evergreen: "https://www.evergreen-line.com/trkc/",
|
|
106
|
+
oolu: "https://www.oocl.com/eng/ourservices/eservices/cargotracking",
|
|
107
|
+
oocl: "https://www.oocl.com/eng/ourservices/eservices/cargotracking",
|
|
108
|
+
one: "https://ecomm.one-line.com/ecom/CUP_HOM_3301.do",
|
|
109
|
+
oney: "https://ecomm.one-line.com/ecom/CUP_HOM_3301.do",
|
|
110
|
+
ymlu: "https://www.yangming.com/e-service/Track_Trace/track_trace_cargo_tracking.aspx",
|
|
111
|
+
"yang-ming": "https://www.yangming.com/e-service/Track_Trace/track_trace_cargo_tracking.aspx",
|
|
112
|
+
zimu: "https://www.zim.com/tools/track-a-shipment",
|
|
113
|
+
zim: "https://www.zim.com/tools/track-a-shipment"
|
|
114
|
+
};
|
|
115
|
+
return urls[code] || null;
|
|
116
|
+
}
|
|
117
|
+
function getStatusBadgeVariant(status) {
|
|
118
|
+
switch (status) {
|
|
119
|
+
case "ARRIVED":
|
|
120
|
+
case "DELIVERED":
|
|
121
|
+
return "default";
|
|
122
|
+
case "IN_TRANSIT":
|
|
123
|
+
case "DEPARTED":
|
|
124
|
+
return "secondary";
|
|
125
|
+
case "PENDING":
|
|
126
|
+
case "BOOKED":
|
|
127
|
+
return "outline";
|
|
128
|
+
default:
|
|
129
|
+
return "outline";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function getFacilityLocationType(facilityTypeCode, vesselName) {
|
|
133
|
+
if (facilityTypeCode === "POTE") {
|
|
134
|
+
return "port";
|
|
135
|
+
}
|
|
136
|
+
if (facilityTypeCode === "DEPO" || facilityTypeCode === "CLOC") {
|
|
137
|
+
return "inland";
|
|
138
|
+
}
|
|
139
|
+
if (facilityTypeCode === "INTE") {
|
|
140
|
+
return vesselName ? "port" : "inland";
|
|
141
|
+
}
|
|
142
|
+
return "unknown";
|
|
143
|
+
}
|
|
144
|
+
function getEventIcon(eventCode, facilityTypeCode, vesselName) {
|
|
145
|
+
const locationType = getFacilityLocationType(facilityTypeCode, vesselName);
|
|
146
|
+
if (eventCode === "GTIN") {
|
|
147
|
+
if (locationType === "port") return Anchor;
|
|
148
|
+
if (locationType === "inland") return Warehouse;
|
|
149
|
+
return MapPin;
|
|
150
|
+
}
|
|
151
|
+
if (eventCode === "GTOT") {
|
|
152
|
+
if (locationType === "port") return Ship;
|
|
153
|
+
if (locationType === "inland") return Truck;
|
|
154
|
+
return MapPin;
|
|
155
|
+
}
|
|
156
|
+
switch (eventCode) {
|
|
157
|
+
// Standard DCSA events - check facility type for arrivals/departures
|
|
158
|
+
case "ARRI":
|
|
159
|
+
if (locationType === "port") return Anchor;
|
|
160
|
+
if (locationType === "inland") return Warehouse;
|
|
161
|
+
return MapPin;
|
|
162
|
+
case "DEPA":
|
|
163
|
+
if (locationType === "port") return Ship;
|
|
164
|
+
if (locationType === "inland") return Truck;
|
|
165
|
+
return MapPin;
|
|
166
|
+
case "LOAD":
|
|
167
|
+
case "DISC":
|
|
168
|
+
return Package;
|
|
169
|
+
// POI/AIS events (always at ports/terminals)
|
|
170
|
+
case "PARR":
|
|
171
|
+
// Port Arrival
|
|
172
|
+
case "TARR":
|
|
173
|
+
return Anchor;
|
|
174
|
+
case "PPRD":
|
|
175
|
+
// Port Departure
|
|
176
|
+
case "TPRD":
|
|
177
|
+
return Ship;
|
|
178
|
+
case "PPRA":
|
|
179
|
+
// Port Proximity Arrival
|
|
180
|
+
case "TPRA":
|
|
181
|
+
return Navigation;
|
|
182
|
+
case "WAYR":
|
|
183
|
+
return Radio;
|
|
184
|
+
default:
|
|
185
|
+
return Package;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function useEventLabel() {
|
|
189
|
+
const t = useT();
|
|
190
|
+
return useCallback((eventCode) => {
|
|
191
|
+
const key = `shipment_tracking.event_codes.${eventCode}`;
|
|
192
|
+
const translated = t(key, eventCode.toLowerCase());
|
|
193
|
+
return translated === key ? eventCode.toLowerCase() : translated;
|
|
194
|
+
}, [t]);
|
|
195
|
+
}
|
|
196
|
+
function CollapsibleSection({
|
|
197
|
+
title,
|
|
198
|
+
icon: Icon,
|
|
199
|
+
count,
|
|
200
|
+
defaultOpen = false,
|
|
201
|
+
children
|
|
202
|
+
}) {
|
|
203
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
204
|
+
return /* @__PURE__ */ jsxs("div", { className: "border border-border rounded-lg bg-card overflow-hidden", children: [
|
|
205
|
+
/* @__PURE__ */ jsxs(
|
|
206
|
+
"button",
|
|
207
|
+
{
|
|
208
|
+
type: "button",
|
|
209
|
+
className: "w-full p-3 flex items-center justify-between text-left hover:bg-muted transition-colors",
|
|
210
|
+
onClick: () => setIsOpen(!isOpen),
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
213
|
+
/* @__PURE__ */ jsx(Icon, { className: "w-4 h-4" }),
|
|
214
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: title }),
|
|
215
|
+
count !== void 0 && /* @__PURE__ */ jsx("span", { className: "bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-2 py-0.5 rounded-full text-xs font-medium", children: count })
|
|
216
|
+
] }),
|
|
217
|
+
isOpen ? /* @__PURE__ */ jsx(ChevronUp, { className: "w-4 h-4 text-muted-foreground" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4 text-muted-foreground" })
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
isOpen && /* @__PURE__ */ jsx("div", { className: "border-t border-border", children })
|
|
222
|
+
] });
|
|
223
|
+
}
|
|
224
|
+
function ShipmentCard({ shipment }) {
|
|
225
|
+
const t = useT();
|
|
226
|
+
const carrierLogo = getCarrierLogo(shipment.carrierCode);
|
|
227
|
+
const trackingReference = shipment.bolNumber || shipment.bookingNumber || shipment.containerNumber;
|
|
228
|
+
const trackingUrl = getCarrierTrackingUrl(shipment.carrierCode, trackingReference);
|
|
229
|
+
const atdActual = getPrimaryTimestamp(shipment.atdTimestamps);
|
|
230
|
+
const ataActual = getPrimaryTimestamp(shipment.ataTimestamps);
|
|
231
|
+
const etd = getPrimaryTimestamp(shipment.etdTimestamps);
|
|
232
|
+
const eta = getPrimaryTimestamp(shipment.etaTimestamps);
|
|
233
|
+
const atd = atdActual || etd;
|
|
234
|
+
const ata = ataActual || eta;
|
|
235
|
+
const transitDays = calculateTransitDays(atdActual || etd, ataActual, eta);
|
|
236
|
+
const originName = shipment.originLocation?.name || shipment.originLocation?.unlocode || "-";
|
|
237
|
+
const destinationName = shipment.destinationLocation?.name || shipment.destinationLocation?.unlocode || "-";
|
|
238
|
+
const originFacilityCode = formatFacilityCode(
|
|
239
|
+
shipment.originLocation?.facilityCode,
|
|
240
|
+
shipment.originLocation?.facilityCodeListProvider
|
|
241
|
+
);
|
|
242
|
+
const destinationFacilityCode = formatFacilityCode(
|
|
243
|
+
shipment.destinationLocation?.facilityCode,
|
|
244
|
+
shipment.destinationLocation?.facilityCodeListProvider
|
|
245
|
+
);
|
|
246
|
+
return /* @__PURE__ */ jsx("div", { className: "bg-card border border-border rounded-lg p-4 relative", children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
247
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
248
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-foreground", children: shipment.bolNumber || shipment.bookingNumber || shipment.containerNumber || shipment.id.slice(0, 8) }),
|
|
249
|
+
shipment.containerNumber && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-mono mt-1", children: shipment.containerNumber })
|
|
250
|
+
] }) }),
|
|
251
|
+
carrierLogo && /* @__PURE__ */ jsx("div", { className: "w-12 h-12 flex items-center justify-center absolute top-4 right-4", children: /* @__PURE__ */ jsx(
|
|
252
|
+
Image,
|
|
253
|
+
{
|
|
254
|
+
src: carrierLogo,
|
|
255
|
+
alt: shipment.carrierCode || "Carrier",
|
|
256
|
+
width: 40,
|
|
257
|
+
height: 40,
|
|
258
|
+
className: "object-contain"
|
|
259
|
+
}
|
|
260
|
+
) }),
|
|
261
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
262
|
+
/* @__PURE__ */ jsxs("div", { className: "font-medium text-foreground", children: [
|
|
263
|
+
/* @__PURE__ */ jsx("b", { children: originName }),
|
|
264
|
+
originFacilityCode && /* @__PURE__ */ jsxs("span", { className: "text-xs text-blue-600 dark:text-blue-400 ml-1 font-mono", children: [
|
|
265
|
+
"[",
|
|
266
|
+
originFacilityCode,
|
|
267
|
+
"]"
|
|
268
|
+
] }),
|
|
269
|
+
atd && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
270
|
+
" (",
|
|
271
|
+
formatDateOnly(atd),
|
|
272
|
+
")"
|
|
273
|
+
] })
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "w-4 h-4 text-muted-foreground" }),
|
|
276
|
+
/* @__PURE__ */ jsxs("div", { className: "font-medium text-foreground", children: [
|
|
277
|
+
/* @__PURE__ */ jsx("b", { children: destinationName }),
|
|
278
|
+
destinationFacilityCode && /* @__PURE__ */ jsxs("span", { className: "text-xs text-blue-600 dark:text-blue-400 ml-1 font-mono", children: [
|
|
279
|
+
"[",
|
|
280
|
+
destinationFacilityCode,
|
|
281
|
+
"]"
|
|
282
|
+
] }),
|
|
283
|
+
ata && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
284
|
+
" (",
|
|
285
|
+
formatDateOnly(ata),
|
|
286
|
+
")"
|
|
287
|
+
] })
|
|
288
|
+
] })
|
|
289
|
+
] }),
|
|
290
|
+
shipment.vesselName && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
291
|
+
/* @__PURE__ */ jsx(Ship, { className: "w-4 h-4" }),
|
|
292
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: shipment.vesselName }),
|
|
293
|
+
shipment.vesselImo && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
294
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/70", children: "\u2022" }),
|
|
295
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-xs", children: [
|
|
296
|
+
"IMO: ",
|
|
297
|
+
shipment.vesselImo
|
|
298
|
+
] })
|
|
299
|
+
] })
|
|
300
|
+
] }),
|
|
301
|
+
transitDays !== null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
302
|
+
/* @__PURE__ */ jsx(Clock, { className: "w-4 h-4" }),
|
|
303
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
304
|
+
t("shipment_tracking.details.transitTime", "Transit time"),
|
|
305
|
+
": ",
|
|
306
|
+
transitDays,
|
|
307
|
+
" ",
|
|
308
|
+
t("shipment_tracking.details.days", "days")
|
|
309
|
+
] })
|
|
310
|
+
] }),
|
|
311
|
+
trackingUrl && /* @__PURE__ */ jsxs(
|
|
312
|
+
"a",
|
|
313
|
+
{
|
|
314
|
+
href: trackingUrl,
|
|
315
|
+
target: "_blank",
|
|
316
|
+
rel: "noopener noreferrer",
|
|
317
|
+
className: "inline-flex items-center gap-2 text-sm text-blue-600 hover:text-blue-700 font-medium",
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ jsx("span", { children: t("shipment_tracking.details.verifyOnCarrier", "Verify on carrier website") }),
|
|
320
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "w-4 h-4" })
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] }) });
|
|
325
|
+
}
|
|
326
|
+
function DestinationStatusCard({ shipment }) {
|
|
327
|
+
const t = useT();
|
|
328
|
+
const ata = getPrimaryTimestamp(shipment.ataTimestamps);
|
|
329
|
+
const eta = getPrimaryTimestamp(shipment.etaTimestamps);
|
|
330
|
+
const hasArrived = ata !== null;
|
|
331
|
+
let statusLabel = t("shipment_tracking.details.status.enRoute", "En Route");
|
|
332
|
+
let statusColor = "bg-yellow-600";
|
|
333
|
+
if (shipment.status === "ARRIVED" || hasArrived) {
|
|
334
|
+
statusLabel = t("shipment_tracking.details.status.inPort", "In Port");
|
|
335
|
+
statusColor = "bg-blue-600";
|
|
336
|
+
} else if (shipment.status === "DELIVERED") {
|
|
337
|
+
statusLabel = t("shipment_tracking.details.status.delivered", "Delivered");
|
|
338
|
+
statusColor = "bg-green-600";
|
|
339
|
+
}
|
|
340
|
+
const destLoc = shipment.destinationLocation;
|
|
341
|
+
const destinationName = destLoc?.name || destLoc?.unlocode || "-";
|
|
342
|
+
const facilityCode = formatFacilityCode(destLoc?.facilityCode, destLoc?.facilityCodeListProvider);
|
|
343
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/30 dark:to-indigo-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-4", children: [
|
|
344
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
|
|
345
|
+
/* @__PURE__ */ jsxs("h3", { className: "font-semibold text-foreground flex items-center gap-2", children: [
|
|
346
|
+
/* @__PURE__ */ jsx(MapPin, { className: "w-5 h-5 text-blue-600 dark:text-blue-400" }),
|
|
347
|
+
t("shipment_tracking.details.destinationStatus", "Destination Status")
|
|
348
|
+
] }),
|
|
349
|
+
/* @__PURE__ */ jsx("span", { className: `${statusColor} text-white px-3 py-1 rounded-full text-xs font-medium`, children: statusLabel })
|
|
350
|
+
] }),
|
|
351
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
352
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
353
|
+
/* @__PURE__ */ jsx(Anchor, { className: "w-4 h-4 text-muted-foreground" }),
|
|
354
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: destinationName }),
|
|
355
|
+
facilityCode && /* @__PURE__ */ jsxs("span", { className: "text-xs text-blue-600 dark:text-blue-400 font-mono", children: [
|
|
356
|
+
"[",
|
|
357
|
+
facilityCode,
|
|
358
|
+
"]"
|
|
359
|
+
] })
|
|
360
|
+
] }),
|
|
361
|
+
destLoc?.address && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground ml-6 truncate", title: destLoc.address, children: destLoc.address }),
|
|
362
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
363
|
+
/* @__PURE__ */ jsx(Clock, { className: "w-3 h-3" }),
|
|
364
|
+
/* @__PURE__ */ jsx("span", { children: hasArrived ? `ATA: ${formatShortDate(ata)}` : eta ? `ETA: ${formatShortDate(eta)}` : "-" })
|
|
365
|
+
] })
|
|
366
|
+
] })
|
|
367
|
+
] });
|
|
368
|
+
}
|
|
369
|
+
function getStopColors(type) {
|
|
370
|
+
switch (type) {
|
|
371
|
+
case "origin":
|
|
372
|
+
return {
|
|
373
|
+
bg: "bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 border-green-300 dark:border-green-700",
|
|
374
|
+
badge: "bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400"
|
|
375
|
+
};
|
|
376
|
+
case "destination":
|
|
377
|
+
return {
|
|
378
|
+
bg: "bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 border-blue-300 dark:border-blue-700",
|
|
379
|
+
badge: "bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400"
|
|
380
|
+
};
|
|
381
|
+
case "port_call":
|
|
382
|
+
return {
|
|
383
|
+
bg: "bg-slate-100 dark:bg-slate-800/40 text-slate-700 dark:text-slate-300 border-slate-300 dark:border-slate-600",
|
|
384
|
+
badge: "bg-slate-100 dark:bg-slate-800/40 text-slate-700 dark:text-slate-300"
|
|
385
|
+
};
|
|
386
|
+
case "transshipment":
|
|
387
|
+
default:
|
|
388
|
+
return {
|
|
389
|
+
bg: "bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400 border-yellow-300 dark:border-yellow-700",
|
|
390
|
+
badge: "bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function formatFacilityCode(code, provider) {
|
|
395
|
+
if (!code) return null;
|
|
396
|
+
if (provider) return `${code} (${provider})`;
|
|
397
|
+
return code;
|
|
398
|
+
}
|
|
399
|
+
function getRouteStopIcon(facilityTypeCode, vesselName, stopType) {
|
|
400
|
+
if (facilityTypeCode === "DEPO" || facilityTypeCode === "CLOC") {
|
|
401
|
+
return Warehouse;
|
|
402
|
+
}
|
|
403
|
+
if (facilityTypeCode === "POTE") {
|
|
404
|
+
return Anchor;
|
|
405
|
+
}
|
|
406
|
+
if (facilityTypeCode === "INTE") {
|
|
407
|
+
return vesselName ? Anchor : Warehouse;
|
|
408
|
+
}
|
|
409
|
+
if (stopType === "origin" || stopType === "destination") {
|
|
410
|
+
return Anchor;
|
|
411
|
+
}
|
|
412
|
+
return MapPin;
|
|
413
|
+
}
|
|
414
|
+
function RouteDetails({ stops }) {
|
|
415
|
+
const t = useT();
|
|
416
|
+
if (stops.length === 0) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
const getSegmentStatus = (currentStop, nextStop) => {
|
|
420
|
+
if (!currentStop.atd) return "pending";
|
|
421
|
+
if (nextStop?.ata) return "completed";
|
|
422
|
+
return "in-progress";
|
|
423
|
+
};
|
|
424
|
+
const getSegmentLineColor = (status) => {
|
|
425
|
+
switch (status) {
|
|
426
|
+
case "completed":
|
|
427
|
+
return "bg-green-500 dark:bg-green-400";
|
|
428
|
+
case "in-progress":
|
|
429
|
+
return "bg-blue-500 dark:bg-blue-400";
|
|
430
|
+
default:
|
|
431
|
+
return "bg-border";
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-card border border-border rounded-lg p-4", children: [
|
|
435
|
+
/* @__PURE__ */ jsxs("h3", { className: "font-semibold text-foreground mb-4 flex items-center gap-2", children: [
|
|
436
|
+
/* @__PURE__ */ jsx(MapPin, { className: "w-4 h-4" }),
|
|
437
|
+
t("shipment_tracking.details.routeDetails", "Route Details")
|
|
438
|
+
] }),
|
|
439
|
+
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx("div", { className: "space-y-0", children: stops.map((stop, index) => {
|
|
440
|
+
const colors = getStopColors(stop.type);
|
|
441
|
+
const badgeText = stop.type === "destination" ? t("shipment_tracking.details.destination", "Destination") : stop.type === "transshipment" ? t("shipment_tracking.details.transshipment", "Transshipment") : stop.type === "port_call" ? t("shipment_tracking.details.portCall", "Port call") : t("shipment_tracking.details.origin", "Origin");
|
|
442
|
+
const departureDelay = calculateDelayFromPlanned(stop.etd, stop.atd);
|
|
443
|
+
const arrivalDelay = calculateDelayFromPlanned(stop.eta, stop.ata);
|
|
444
|
+
const facilityDisplay = formatFacilityCode(stop.facilityCode, stop.facilityCodeListProvider);
|
|
445
|
+
const isLastStop = index === stops.length - 1;
|
|
446
|
+
const nextStop = !isLastStop ? stops[index + 1] : void 0;
|
|
447
|
+
const segmentStatus = getSegmentStatus(stop, nextStop);
|
|
448
|
+
const StopIcon = getRouteStopIcon(stop.facilityTypeCode, stop.vesselName, stop.type);
|
|
449
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex items-start gap-3 py-2", children: [
|
|
450
|
+
!isLastStop && /* @__PURE__ */ jsx(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
className: `absolute left-[15px] top-[36px] bottom-[-20px] w-0.5 ${getSegmentLineColor(segmentStatus)}`
|
|
454
|
+
}
|
|
455
|
+
),
|
|
456
|
+
/* @__PURE__ */ jsx("div", { className: `relative z-10 mt-1 p-2 rounded-full ${colors.bg}`, children: /* @__PURE__ */ jsx(StopIcon, { className: "w-4 h-4" }) }),
|
|
457
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 flex items-start justify-between gap-4", children: [
|
|
458
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0", children: [
|
|
459
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
|
|
460
|
+
/* @__PURE__ */ jsx("div", { className: "font-semibold text-foreground", children: stop.location }),
|
|
461
|
+
/* @__PURE__ */ jsx("div", { className: `px-2 py-1 rounded text-xs font-medium whitespace-nowrap ${colors.badge}`, children: badgeText })
|
|
462
|
+
] }),
|
|
463
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground mb-1", children: [
|
|
464
|
+
stop.unlocode && /* @__PURE__ */ jsx("span", { className: "font-mono", children: stop.unlocode }),
|
|
465
|
+
facilityDisplay && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
466
|
+
stop.unlocode && /* @__PURE__ */ jsx("span", { children: "\u2022" }),
|
|
467
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-blue-600 dark:text-blue-400", title: t("shipment_tracking.details.terminalCode", "Terminal Code"), children: facilityDisplay })
|
|
468
|
+
] })
|
|
469
|
+
] }),
|
|
470
|
+
stop.facilityAddress && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground mb-1 max-w-[200px] truncate", title: stop.facilityAddress, children: stop.facilityAddress }),
|
|
471
|
+
stop.coords && /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground/70 mb-1 font-mono", children: [
|
|
472
|
+
stop.coords.latitude.toFixed(4),
|
|
473
|
+
", ",
|
|
474
|
+
stop.coords.longitude.toFixed(4)
|
|
475
|
+
] }),
|
|
476
|
+
stop.vesselName && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
477
|
+
/* @__PURE__ */ jsx(Ship, { className: "w-3 h-3" }),
|
|
478
|
+
/* @__PURE__ */ jsx("span", { children: stop.vesselName })
|
|
479
|
+
] })
|
|
480
|
+
] }),
|
|
481
|
+
/* @__PURE__ */ jsxs("div", { className: "text-right text-sm space-y-2 flex-shrink-0", children: [
|
|
482
|
+
(stop.atd || stop.etd) && /* @__PURE__ */ jsxs("div", { children: [
|
|
483
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-xs", children: stop.atd ? "ATD:" : "ETD:" }),
|
|
484
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: formatShortDate(stop.atd || stop.etd) }),
|
|
485
|
+
departureDelay !== null && /* @__PURE__ */ jsxs("div", { className: `text-xs ${departureDelay > 0 ? "text-red-600 dark:text-red-400" : "text-green-600 dark:text-green-400"}`, children: [
|
|
486
|
+
departureDelay > 0 ? "+" : "",
|
|
487
|
+
departureDelay,
|
|
488
|
+
" ",
|
|
489
|
+
t("shipment_tracking.details.days", "days")
|
|
490
|
+
] })
|
|
491
|
+
] }),
|
|
492
|
+
(stop.ata || stop.eta) && /* @__PURE__ */ jsxs("div", { children: [
|
|
493
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-xs", children: stop.ata ? "ATA:" : "ETA:" }),
|
|
494
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: formatShortDate(stop.ata || stop.eta) }),
|
|
495
|
+
arrivalDelay !== null && /* @__PURE__ */ jsxs("div", { className: `text-xs ${arrivalDelay > 0 ? "text-red-600 dark:text-red-400" : "text-green-600 dark:text-green-400"}`, children: [
|
|
496
|
+
arrivalDelay > 0 ? "+" : "",
|
|
497
|
+
arrivalDelay,
|
|
498
|
+
" ",
|
|
499
|
+
t("shipment_tracking.details.days", "days")
|
|
500
|
+
] })
|
|
501
|
+
] })
|
|
502
|
+
] })
|
|
503
|
+
] })
|
|
504
|
+
] }, `${stop.unlocode || stop.location}-${index}`);
|
|
505
|
+
}) }) })
|
|
506
|
+
] });
|
|
507
|
+
}
|
|
508
|
+
function JourneyTimeline({ events }) {
|
|
509
|
+
const t = useT();
|
|
510
|
+
const locale = useLocale();
|
|
511
|
+
const getEventLabel = useEventLabel();
|
|
512
|
+
const sortedEvents = useMemo(
|
|
513
|
+
() => events.filter((e) => !["WAYR", "PPRA", "TPRA"].includes(e.eventCode)).sort((a, b) => {
|
|
514
|
+
const timeA = new Date(a.eventDateTime).getTime();
|
|
515
|
+
const timeB = new Date(b.eventDateTime).getTime();
|
|
516
|
+
if (timeA !== timeB) return timeA - timeB;
|
|
517
|
+
return a.id.localeCompare(b.id);
|
|
518
|
+
}),
|
|
519
|
+
[events]
|
|
520
|
+
);
|
|
521
|
+
const lastActualIndex = useMemo(() => {
|
|
522
|
+
let last = -1;
|
|
523
|
+
sortedEvents.forEach((e, i) => {
|
|
524
|
+
if (e.eventClassifierCode === "ACT") last = i;
|
|
525
|
+
});
|
|
526
|
+
return last;
|
|
527
|
+
}, [sortedEvents]);
|
|
528
|
+
const getSegmentStatus = (index) => {
|
|
529
|
+
if (index + 1 <= lastActualIndex) return "completed";
|
|
530
|
+
if (index <= lastActualIndex) return "in-progress";
|
|
531
|
+
return "pending";
|
|
532
|
+
};
|
|
533
|
+
const getSegmentLineColor = (status) => {
|
|
534
|
+
switch (status) {
|
|
535
|
+
case "completed":
|
|
536
|
+
return "bg-green-500 dark:bg-green-400";
|
|
537
|
+
case "in-progress":
|
|
538
|
+
return "bg-blue-500 dark:bg-blue-400";
|
|
539
|
+
default:
|
|
540
|
+
return "bg-border";
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
return /* @__PURE__ */ jsx(
|
|
544
|
+
CollapsibleSection,
|
|
545
|
+
{
|
|
546
|
+
title: t("shipment_tracking.details.journeyTimeline", "Journey Timeline"),
|
|
547
|
+
icon: Calendar,
|
|
548
|
+
count: sortedEvents.length,
|
|
549
|
+
defaultOpen: false,
|
|
550
|
+
children: /* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx("div", { className: "space-y-4", children: sortedEvents.map((event, index) => {
|
|
551
|
+
const Icon = getEventIcon(event.eventCode, event.facilityTypeCode, event.vesselName);
|
|
552
|
+
const hasHappened = index <= lastActualIndex;
|
|
553
|
+
const borderColor = hasHappened ? "border-green-300 dark:border-green-700" : "border-blue-300 dark:border-blue-700";
|
|
554
|
+
const bgColor = hasHappened ? "bg-green-100 dark:bg-green-900/30 border-green-300 dark:border-green-700 text-green-800 dark:text-green-300" : "bg-blue-100 dark:bg-blue-900/30 border-blue-300 dark:border-blue-700 text-blue-800 dark:text-blue-300";
|
|
555
|
+
const badgeColor = hasHappened ? "bg-green-200 dark:bg-green-800/50 text-green-800 dark:text-green-300" : "bg-blue-200 dark:bg-blue-800/50 text-blue-800 dark:text-blue-300";
|
|
556
|
+
const isLastEvent = index === sortedEvents.length - 1;
|
|
557
|
+
const segmentStatus = getSegmentStatus(index);
|
|
558
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex items-start gap-4", children: [
|
|
559
|
+
!isLastEvent && /* @__PURE__ */ jsx(
|
|
560
|
+
"div",
|
|
561
|
+
{
|
|
562
|
+
className: `absolute left-[19px] top-[40px] bottom-[-36px] w-0.5 ${getSegmentLineColor(segmentStatus)}`
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
/* @__PURE__ */ jsx("div", { className: `relative z-10 p-2 rounded-full border-2 bg-card ${borderColor}`, children: /* @__PURE__ */ jsx(Icon, { className: `w-5 h-5 ${hasHappened ? "text-green-600 dark:text-green-400" : "text-blue-600 dark:text-blue-400"}` }) }),
|
|
566
|
+
/* @__PURE__ */ jsx("div", { className: `flex-1 border rounded-lg p-3 ${bgColor}`, children: /* @__PURE__ */ jsx("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
567
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
|
|
568
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: getEventLabel(event.eventCode) }),
|
|
569
|
+
/* @__PURE__ */ jsx("span", { className: `px-2 py-0.5 rounded text-xs font-medium ${badgeColor}`, children: event.eventClassifierCode || "N/A" })
|
|
570
|
+
] }),
|
|
571
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium mb-2", children: (() => {
|
|
572
|
+
if (event.locationName) return event.locationName;
|
|
573
|
+
const regionName = pickRegionName(event, locale);
|
|
574
|
+
if (regionName) {
|
|
575
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
576
|
+
regionName,
|
|
577
|
+
event.locationUnlocode && /* @__PURE__ */ jsx("span", { className: "ml-1.5 font-normal opacity-60", children: event.locationUnlocode })
|
|
578
|
+
] });
|
|
579
|
+
}
|
|
580
|
+
return event.locationUnlocode || "-";
|
|
581
|
+
})() }),
|
|
582
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-xs", children: [
|
|
583
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
584
|
+
/* @__PURE__ */ jsx(Calendar, { className: "w-3 h-3" }),
|
|
585
|
+
formatShortDate(event.eventDateTime)
|
|
586
|
+
] }),
|
|
587
|
+
event.vesselName && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
588
|
+
/* @__PURE__ */ jsx(Ship, { className: "w-3 h-3" }),
|
|
589
|
+
event.vesselName
|
|
590
|
+
] })
|
|
591
|
+
] })
|
|
592
|
+
] }) }) })
|
|
593
|
+
] }, event.id);
|
|
594
|
+
}) }) }) })
|
|
595
|
+
}
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
function BookingDetails({ shipment }) {
|
|
599
|
+
const t = useT();
|
|
600
|
+
return /* @__PURE__ */ jsx(
|
|
601
|
+
CollapsibleSection,
|
|
602
|
+
{
|
|
603
|
+
title: t("shipment_tracking.details.bookingDetails", "Booking Details"),
|
|
604
|
+
icon: Package,
|
|
605
|
+
defaultOpen: false,
|
|
606
|
+
children: /* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsxs("div", { className: "bg-muted rounded-lg p-4 space-y-2", children: [
|
|
607
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
608
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.shipments.fields.containerNumber", "Container Number") }),
|
|
609
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-semibold text-foreground", children: shipment.containerNumber || "N/A" })
|
|
610
|
+
] }),
|
|
611
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
612
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.shipments.fields.size", "Size") }),
|
|
613
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-semibold text-foreground", children: shipment.isoEquipmentCode || "N/A" })
|
|
614
|
+
] }),
|
|
615
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
616
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.shipments.fields.bookingNumber", "Booking Number") }),
|
|
617
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-semibold text-foreground", children: shipment.bookingNumber || "N/A" })
|
|
618
|
+
] }),
|
|
619
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
620
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.shipments.fields.bolNumber", "BOL Number") }),
|
|
621
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-semibold text-foreground", children: shipment.bolNumber || "N/A" })
|
|
622
|
+
] }),
|
|
623
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
624
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.shipments.fields.carrierCode", "Carrier Code") }),
|
|
625
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-semibold text-foreground", children: shipment.carrierCode || "N/A" })
|
|
626
|
+
] }),
|
|
627
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
628
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.shipments.fields.seals", "Seals") }),
|
|
629
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-semibold text-foreground", children: shipment.seals?.length ? shipment.seals.map((s) => s.number).join(", ") : "N/A" })
|
|
630
|
+
] }),
|
|
631
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
632
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.shipments.fields.status", "Status") }),
|
|
633
|
+
/* @__PURE__ */ jsx(Badge, { variant: getStatusBadgeVariant(shipment.status), children: shipment.status })
|
|
634
|
+
] })
|
|
635
|
+
] }) })
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
function ShipmentDetailsDrawer({
|
|
640
|
+
open,
|
|
641
|
+
onOpenChange,
|
|
642
|
+
shipmentId
|
|
643
|
+
}) {
|
|
644
|
+
const t = useT();
|
|
645
|
+
const { data: shipment, isLoading: isLoadingShipment } = useQuery({
|
|
646
|
+
queryKey: ["shipment_tracking_shipment_details", shipmentId],
|
|
647
|
+
queryFn: async () => {
|
|
648
|
+
if (!shipmentId) return null;
|
|
649
|
+
const response = await apiCall(
|
|
650
|
+
`/api/shipment_tracking/shipments?id=${shipmentId}`
|
|
651
|
+
);
|
|
652
|
+
if (!response.ok) throw new Error("Failed to load shipment");
|
|
653
|
+
const items = response.result?.items ?? [];
|
|
654
|
+
const item = items.find((i) => i.id === shipmentId) ?? items[0];
|
|
655
|
+
if (!item) return null;
|
|
656
|
+
const trackingJobRaw = item.trackingJob ?? item.tracking_job ?? item.trackingJobId ?? item.tracking_job_id;
|
|
657
|
+
let trackingJobId = null;
|
|
658
|
+
if (trackingJobRaw) {
|
|
659
|
+
if (typeof trackingJobRaw === "string") {
|
|
660
|
+
trackingJobId = trackingJobRaw;
|
|
661
|
+
} else if (typeof trackingJobRaw === "object" && "id" in trackingJobRaw) {
|
|
662
|
+
trackingJobId = trackingJobRaw.id;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
const routeStopsRaw = item.routeStops ?? item.route_stops;
|
|
666
|
+
const routeStops2 = Array.isArray(routeStopsRaw) ? routeStopsRaw.map((stop) => ({
|
|
667
|
+
location: stop.location,
|
|
668
|
+
unlocode: stop.unlocode,
|
|
669
|
+
type: stop.type ?? "transshipment",
|
|
670
|
+
vesselName: stop.vesselName ?? stop.vessel_name,
|
|
671
|
+
vesselImo: stop.vesselImo ?? stop.vessel_imo,
|
|
672
|
+
ata: stop.ata,
|
|
673
|
+
atd: stop.atd,
|
|
674
|
+
eta: stop.eta,
|
|
675
|
+
etd: stop.etd,
|
|
676
|
+
// Facility/terminal details
|
|
677
|
+
facilityCode: stop.facilityCode ?? stop.facility_code,
|
|
678
|
+
facilityCodeListProvider: stop.facilityCodeListProvider ?? stop.facility_code_list_provider,
|
|
679
|
+
facilityTypeCode: stop.facilityTypeCode ?? stop.facility_type_code,
|
|
680
|
+
facilityAddress: stop.facilityAddress ?? stop.facility_address,
|
|
681
|
+
coords: stop.coords ? stop.coords : null
|
|
682
|
+
})) : null;
|
|
683
|
+
const cargoEventsRaw = item.cargoEvents ?? item.cargo_events;
|
|
684
|
+
const cargoEvents = Array.isArray(cargoEventsRaw) ? cargoEventsRaw.map((evt) => ({
|
|
685
|
+
id: evt.id,
|
|
686
|
+
eventType: evt.eventType ?? evt.event_type ?? "",
|
|
687
|
+
eventCode: evt.eventCode ?? evt.event_code ?? "",
|
|
688
|
+
eventClassifierCode: evt.eventClassifierCode ?? evt.event_classifier_code,
|
|
689
|
+
eventDateTime: evt.eventDateTime ?? evt.event_date_time,
|
|
690
|
+
description: evt.description,
|
|
691
|
+
locationName: evt.locationName ?? evt.location_name,
|
|
692
|
+
locationUnlocode: evt.locationUnlocode ?? evt.location_unlocode,
|
|
693
|
+
regionNamePl: evt.regionNamePl ?? evt.region_name_pl,
|
|
694
|
+
regionNameEn: evt.regionNameEn ?? evt.region_name_en,
|
|
695
|
+
vesselName: evt.vesselName ?? evt.vessel_name,
|
|
696
|
+
vesselImo: evt.vesselImo ?? evt.vessel_imo,
|
|
697
|
+
voyageNumber: evt.voyageNumber ?? evt.voyage_number,
|
|
698
|
+
isTransshipmentMove: evt.isTransshipmentMove ?? evt.is_transshipment_move,
|
|
699
|
+
// Facility/terminal details
|
|
700
|
+
facilityCode: evt.facilityCode ?? evt.facility_code,
|
|
701
|
+
facilityCodeListProvider: evt.facilityCodeListProvider ?? evt.facility_code_list_provider,
|
|
702
|
+
facilityTypeCode: evt.facilityTypeCode ?? evt.facility_type_code,
|
|
703
|
+
facilityAddress: evt.facilityAddress ?? evt.facility_address,
|
|
704
|
+
latitude: evt.latitude,
|
|
705
|
+
longitude: evt.longitude
|
|
706
|
+
})) : null;
|
|
707
|
+
const originLocationRaw = item.originLocation ?? item.origin_location;
|
|
708
|
+
const destinationLocationRaw = item.destinationLocation ?? item.destination_location;
|
|
709
|
+
return {
|
|
710
|
+
id: item.id,
|
|
711
|
+
status: item.status ?? "PENDING",
|
|
712
|
+
carrierCode: item.carrierCode ?? item.carrier_code,
|
|
713
|
+
containerNumber: item.containerNumber ?? item.container_number,
|
|
714
|
+
bookingNumber: item.bookingNumber ?? item.booking_number,
|
|
715
|
+
isoEquipmentCode: item.isoEquipmentCode ?? item.iso_equipment_code,
|
|
716
|
+
bolNumber: item.bolNumber ?? item.bol_number,
|
|
717
|
+
etdTimestamps: item.etdTimestamps ?? item.etd_timestamps,
|
|
718
|
+
etaTimestamps: item.etaTimestamps ?? item.eta_timestamps,
|
|
719
|
+
atdTimestamps: item.atdTimestamps ?? item.atd_timestamps,
|
|
720
|
+
ataTimestamps: item.ataTimestamps ?? item.ata_timestamps,
|
|
721
|
+
originLocation: originLocationRaw,
|
|
722
|
+
destinationLocation: destinationLocationRaw,
|
|
723
|
+
vesselName: item.vesselName ?? item.vessel_name,
|
|
724
|
+
vesselImo: item.vesselImo ?? item.vessel_imo,
|
|
725
|
+
voyageNumber: item.voyageNumber ?? item.voyage_number,
|
|
726
|
+
routeStops: routeStops2,
|
|
727
|
+
cargoEvents,
|
|
728
|
+
trackingJob: trackingJobId ? { id: trackingJobId } : null
|
|
729
|
+
};
|
|
730
|
+
},
|
|
731
|
+
enabled: open && !!shipmentId
|
|
732
|
+
});
|
|
733
|
+
const routeStops = shipment?.routeStops ?? [];
|
|
734
|
+
const events = shipment?.cargoEvents ?? [];
|
|
735
|
+
const currentVessel = useMemo(() => {
|
|
736
|
+
return getCurrentVessel(
|
|
737
|
+
shipment?.routeStops,
|
|
738
|
+
shipment?.cargoEvents,
|
|
739
|
+
{ vesselName: shipment?.vesselName, vesselImo: shipment?.vesselImo }
|
|
740
|
+
);
|
|
741
|
+
}, [shipment?.routeStops, shipment?.cargoEvents, shipment?.vesselName, shipment?.vesselImo]);
|
|
742
|
+
const isLoading = isLoadingShipment;
|
|
743
|
+
const handleKeyDown = React.useCallback(
|
|
744
|
+
(e) => {
|
|
745
|
+
if (e.key === "Escape") {
|
|
746
|
+
onOpenChange(false);
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
[onOpenChange]
|
|
750
|
+
);
|
|
751
|
+
return /* @__PURE__ */ jsx(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
|
|
752
|
+
SheetContent,
|
|
753
|
+
{
|
|
754
|
+
className: "flex flex-col p-0 w-full sm:max-w-xl md:max-w-2xl",
|
|
755
|
+
overlayClassName: "backdrop-blur-none",
|
|
756
|
+
onKeyDown: handleKeyDown,
|
|
757
|
+
children: [
|
|
758
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-between px-4 py-6 border-b border-border", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: t("shipment_tracking.details.title", "Shipment Details") }) }) }),
|
|
759
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-48 gap-2", children: [
|
|
760
|
+
/* @__PURE__ */ jsx(Spinner, { className: "h-6 w-6" }),
|
|
761
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.details.loading", "Loading shipment details...") })
|
|
762
|
+
] }) : !shipment ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center h-48 gap-2", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.details.notFound", "Shipment not found") }) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
763
|
+
/* @__PURE__ */ jsx(ShipmentCard, { shipment }),
|
|
764
|
+
/* @__PURE__ */ jsx(DestinationStatusCard, { shipment }),
|
|
765
|
+
routeStops.length > 0 && /* @__PURE__ */ jsx(RouteDetails, { stops: routeStops }),
|
|
766
|
+
currentVessel.status === "delivered" ? (
|
|
767
|
+
// Container delivered - show delivered message instead of map
|
|
768
|
+
/* @__PURE__ */ jsx("div", { className: "relative w-full h-32 border border-green-200 dark:border-green-800 rounded-lg overflow-hidden bg-green-50 dark:bg-green-950/30", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
769
|
+
/* @__PURE__ */ jsx(Package, { className: "w-8 h-8 text-green-500 dark:text-green-400 mx-auto mb-2" }),
|
|
770
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-green-700 dark:text-green-300", children: t("shipment_tracking.map.delivered", "Container delivered") }),
|
|
771
|
+
currentVessel.currentPort && /* @__PURE__ */ jsx("p", { className: "text-xs text-green-600 dark:text-green-400 mt-1", children: currentVessel.currentPort })
|
|
772
|
+
] }) }) })
|
|
773
|
+
) : currentVessel.vesselImo ? (
|
|
774
|
+
// Show map with current or planned vessel
|
|
775
|
+
/* @__PURE__ */ jsx(
|
|
776
|
+
VesselTrackingMap,
|
|
777
|
+
{
|
|
778
|
+
vesselImo: currentVessel.vesselImo,
|
|
779
|
+
vesselName: currentVessel.vesselName,
|
|
780
|
+
height: "250px",
|
|
781
|
+
autoRefresh: true,
|
|
782
|
+
showInfoOverlay: true,
|
|
783
|
+
containerStatus: currentVessel.status,
|
|
784
|
+
currentPort: currentVessel.currentPort,
|
|
785
|
+
isPlannedVessel: currentVessel.isPlannedVessel,
|
|
786
|
+
currentLeg: currentVessel.currentLeg,
|
|
787
|
+
traceFrom: currentVessel.traceFrom
|
|
788
|
+
}
|
|
789
|
+
)
|
|
790
|
+
) : (
|
|
791
|
+
// No vessel IMO available
|
|
792
|
+
/* @__PURE__ */ jsxs("div", { className: "relative w-full h-48 border border-border rounded-lg overflow-hidden bg-muted", children: [
|
|
793
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
794
|
+
/* @__PURE__ */ jsx(Ship, { className: "w-8 h-8 text-muted-foreground mx-auto mb-2" }),
|
|
795
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("shipment_tracking.details.noVesselData", "No vessel data available") })
|
|
796
|
+
] }) }),
|
|
797
|
+
currentVessel.vesselName && /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3 bg-card/95 backdrop-blur-sm rounded-lg shadow-md px-3 py-2 border border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
798
|
+
/* @__PURE__ */ jsx(Ship, { className: "w-4 h-4 text-blue-500 dark:text-blue-400" }),
|
|
799
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
800
|
+
/* @__PURE__ */ jsx("h2", { className: "font-semibold text-sm text-foreground", children: currentVessel.vesselName }),
|
|
801
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("shipment_tracking.details.noImoNumber", "IMO number not available") })
|
|
802
|
+
] })
|
|
803
|
+
] }) })
|
|
804
|
+
] })
|
|
805
|
+
),
|
|
806
|
+
events.length > 0 && /* @__PURE__ */ jsx(JourneyTimeline, { events }),
|
|
807
|
+
/* @__PURE__ */ jsx(BookingDetails, { shipment })
|
|
808
|
+
] }) })
|
|
809
|
+
]
|
|
810
|
+
}
|
|
811
|
+
) });
|
|
812
|
+
}
|
|
813
|
+
var ShipmentDetailsDrawer_default = ShipmentDetailsDrawer;
|
|
814
|
+
export {
|
|
815
|
+
ShipmentDetailsDrawer,
|
|
816
|
+
ShipmentDetailsDrawer_default as default
|
|
817
|
+
};
|
|
818
|
+
//# sourceMappingURL=ShipmentDetailsDrawer.js.map
|