@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,621 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useCallback, useMemo, useState } from "react";
|
|
5
|
+
import { Page, PageBody } from "@freighttech/ui/backend/Page";
|
|
6
|
+
import { BooleanIcon } from "@freighttech/ui/backend/ValueIcons";
|
|
7
|
+
import {
|
|
8
|
+
DynamicTable,
|
|
9
|
+
TableSkeleton,
|
|
10
|
+
useDynamicTablePage
|
|
11
|
+
} from "@freighttech/ui/backend/dynamic-table";
|
|
12
|
+
import { apiCallOrThrow } from "@freighttech/ui/backend/utils/apiCall";
|
|
13
|
+
import { flash } from "@freighttech/ui/backend/FlashMessages";
|
|
14
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
15
|
+
import {
|
|
16
|
+
Dialog,
|
|
17
|
+
DialogContent,
|
|
18
|
+
DialogHeader,
|
|
19
|
+
DialogTitle,
|
|
20
|
+
DialogFooter
|
|
21
|
+
} from "@freighttech/ui/primitives/dialog";
|
|
22
|
+
import { Button } from "@freighttech/ui/primitives/button";
|
|
23
|
+
import { Button as ButtonV2 } from "@freighttech/ui/primitives-v2";
|
|
24
|
+
import { Input } from "@freighttech/ui/primitives/input";
|
|
25
|
+
import { Label } from "@freighttech/ui/primitives/label";
|
|
26
|
+
import { Checkbox } from "@freighttech/ui/primitives/checkbox";
|
|
27
|
+
import { Textarea } from "@freighttech/ui/primitives/textarea";
|
|
28
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@freighttech/ui/primitives/card";
|
|
29
|
+
import { Badge } from "@freighttech/ui/primitives/badge";
|
|
30
|
+
import { Loader2, CheckCircle2, XCircle, Shield, Plus } from "lucide-react";
|
|
31
|
+
import { ShipsGoConfigSection } from "../../components/ShipsGoConfigSection.js";
|
|
32
|
+
function mapItem(item) {
|
|
33
|
+
const id = typeof item.id === "string" ? item.id : null;
|
|
34
|
+
if (!id) return null;
|
|
35
|
+
return {
|
|
36
|
+
id,
|
|
37
|
+
carrierCode: item.carrierCode ?? "",
|
|
38
|
+
apiEndpoint: item.apiEndpoint ?? null,
|
|
39
|
+
authConfig: item.authConfig ?? null,
|
|
40
|
+
rateLimitRequests: typeof item.rateLimitRequests === "number" ? item.rateLimitRequests : 60,
|
|
41
|
+
rateLimitWindowSeconds: typeof item.rateLimitWindowSeconds === "number" ? item.rateLimitWindowSeconds : 60,
|
|
42
|
+
isActive: item.isActive === true,
|
|
43
|
+
createdAt: item.createdAt ?? null
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const emptyForm = {
|
|
47
|
+
carrierCode: "",
|
|
48
|
+
apiEndpoint: "",
|
|
49
|
+
authConfig: "",
|
|
50
|
+
rateLimitRequests: 60,
|
|
51
|
+
rateLimitWindowSeconds: 60,
|
|
52
|
+
isActive: true
|
|
53
|
+
};
|
|
54
|
+
function rowToForm(row) {
|
|
55
|
+
return {
|
|
56
|
+
carrierCode: row.carrierCode,
|
|
57
|
+
apiEndpoint: row.apiEndpoint ?? "",
|
|
58
|
+
authConfig: row.authConfig ? JSON.stringify(row.authConfig, null, 2) : "",
|
|
59
|
+
rateLimitRequests: row.rateLimitRequests,
|
|
60
|
+
rateLimitWindowSeconds: row.rateLimitWindowSeconds,
|
|
61
|
+
isActive: row.isActive
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const emptyBicForm = {
|
|
65
|
+
isEnabled: false,
|
|
66
|
+
username: "",
|
|
67
|
+
password: "",
|
|
68
|
+
baseUrl: "https://api.bic-code.org"
|
|
69
|
+
};
|
|
70
|
+
function BicConfigSection() {
|
|
71
|
+
const t = useT();
|
|
72
|
+
const [config, setConfig] = React.useState(null);
|
|
73
|
+
const [form, setForm] = React.useState(emptyBicForm);
|
|
74
|
+
const [loading, setLoading] = React.useState(true);
|
|
75
|
+
const [saving, setSaving] = React.useState(false);
|
|
76
|
+
const [testing, setTesting] = React.useState(false);
|
|
77
|
+
const [testResult, setTestResult] = React.useState(null);
|
|
78
|
+
const fetchConfig = React.useCallback(async () => {
|
|
79
|
+
setLoading(true);
|
|
80
|
+
try {
|
|
81
|
+
const { result } = await apiCallOrThrow("/api/shipment_tracking/bic-configs");
|
|
82
|
+
setConfig(result?.config ?? null);
|
|
83
|
+
if (result?.config) {
|
|
84
|
+
setForm({
|
|
85
|
+
isEnabled: result.config.isEnabled,
|
|
86
|
+
username: result.config.username,
|
|
87
|
+
password: "",
|
|
88
|
+
// Password is never returned from API
|
|
89
|
+
baseUrl: result.config.baseUrl
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
setForm(emptyBicForm);
|
|
93
|
+
}
|
|
94
|
+
} catch {
|
|
95
|
+
setConfig(null);
|
|
96
|
+
setForm(emptyBicForm);
|
|
97
|
+
} finally {
|
|
98
|
+
setLoading(false);
|
|
99
|
+
}
|
|
100
|
+
}, []);
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
fetchConfig();
|
|
103
|
+
}, [fetchConfig]);
|
|
104
|
+
const handleTest = React.useCallback(async () => {
|
|
105
|
+
if (!form.username || !form.password) {
|
|
106
|
+
flash(t("shipment_tracking.bic_config.validation.usernameRequired", "Username is required"), "error");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
setTesting(true);
|
|
110
|
+
setTestResult(null);
|
|
111
|
+
try {
|
|
112
|
+
const { result } = await apiCallOrThrow(
|
|
113
|
+
"/api/shipment_tracking/bic-configs/test",
|
|
114
|
+
{
|
|
115
|
+
method: "POST",
|
|
116
|
+
body: JSON.stringify({
|
|
117
|
+
username: form.username,
|
|
118
|
+
password: form.password,
|
|
119
|
+
baseUrl: form.baseUrl
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
setTestResult(result ?? { success: false, message: "Unknown error" });
|
|
124
|
+
if (result?.success) {
|
|
125
|
+
flash(t("shipment_tracking.bic_config.flash.testSuccess", "BIC API connection successful"), "success");
|
|
126
|
+
} else {
|
|
127
|
+
flash(result?.message ?? t("shipment_tracking.bic_config.flash.testFailed", "BIC API connection failed"), "error");
|
|
128
|
+
}
|
|
129
|
+
} catch (err) {
|
|
130
|
+
const message = err instanceof Error ? err.message : "Connection test failed";
|
|
131
|
+
setTestResult({ success: false, message });
|
|
132
|
+
flash(message, "error");
|
|
133
|
+
} finally {
|
|
134
|
+
setTesting(false);
|
|
135
|
+
}
|
|
136
|
+
}, [form, t]);
|
|
137
|
+
const handleSave = React.useCallback(async () => {
|
|
138
|
+
if (!form.username) {
|
|
139
|
+
flash(t("shipment_tracking.bic_config.validation.usernameRequired", "Username is required"), "error");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (!config && !form.password) {
|
|
143
|
+
flash(t("shipment_tracking.bic_config.validation.passwordRequired", "Password is required"), "error");
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
setSaving(true);
|
|
147
|
+
try {
|
|
148
|
+
const body = {
|
|
149
|
+
isEnabled: form.isEnabled,
|
|
150
|
+
username: form.username,
|
|
151
|
+
baseUrl: form.baseUrl || "https://api.bic-code.org"
|
|
152
|
+
};
|
|
153
|
+
if (form.password) {
|
|
154
|
+
body.password = form.password;
|
|
155
|
+
} else if (config) {
|
|
156
|
+
body.password = "__UNCHANGED__";
|
|
157
|
+
}
|
|
158
|
+
await apiCallOrThrow("/api/shipment_tracking/bic-configs", {
|
|
159
|
+
method: "PUT",
|
|
160
|
+
body: JSON.stringify(body)
|
|
161
|
+
});
|
|
162
|
+
flash(t("shipment_tracking.bic_config.flash.saved", "BIC configuration saved"), "success");
|
|
163
|
+
fetchConfig();
|
|
164
|
+
} catch (err) {
|
|
165
|
+
const message = err instanceof Error ? err.message : "Failed to save";
|
|
166
|
+
flash(message, "error");
|
|
167
|
+
} finally {
|
|
168
|
+
setSaving(false);
|
|
169
|
+
}
|
|
170
|
+
}, [form, config, t, fetchConfig]);
|
|
171
|
+
const handleKeyDown = React.useCallback(
|
|
172
|
+
(event) => {
|
|
173
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
handleSave();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
[handleSave]
|
|
179
|
+
);
|
|
180
|
+
if (loading) {
|
|
181
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
182
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2", children: [
|
|
183
|
+
/* @__PURE__ */ jsx(Shield, { className: "h-5 w-5" }),
|
|
184
|
+
t("shipment_tracking.bic_config.title", "BIC Facility API")
|
|
185
|
+
] }) }),
|
|
186
|
+
/* @__PURE__ */ jsx(CardContent, { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) })
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
190
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
191
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
192
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
193
|
+
/* @__PURE__ */ jsx(Shield, { className: "h-5 w-5" }),
|
|
194
|
+
/* @__PURE__ */ jsx(CardTitle, { children: t("shipment_tracking.bic_config.title", "BIC Facility API") })
|
|
195
|
+
] }),
|
|
196
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: config ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
197
|
+
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: t("shipment_tracking.bic_config.status.configured", "Configured") }),
|
|
198
|
+
/* @__PURE__ */ jsx(Badge, { variant: config.isEnabled ? "default" : "secondary", children: config.isEnabled ? t("shipment_tracking.bic_config.status.enabled", "Enabled") : t("shipment_tracking.bic_config.status.disabled", "Disabled") })
|
|
199
|
+
] }) : /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: t("shipment_tracking.bic_config.status.notConfigured", "Not Configured") }) })
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ jsx(CardDescription, { children: t(
|
|
202
|
+
"shipment_tracking.bic_config.description",
|
|
203
|
+
"Configure BIC Facility Code API credentials to enrich shipment tracking locations with coordinates, addresses, and terminal operator information."
|
|
204
|
+
) })
|
|
205
|
+
] }),
|
|
206
|
+
/* @__PURE__ */ jsx(CardContent, { onKeyDown: handleKeyDown, children: /* @__PURE__ */ jsxs("div", { className: "grid gap-4", children: [
|
|
207
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
208
|
+
/* @__PURE__ */ jsx(
|
|
209
|
+
Checkbox,
|
|
210
|
+
{
|
|
211
|
+
id: "bicEnabled",
|
|
212
|
+
checked: form.isEnabled,
|
|
213
|
+
onCheckedChange: (checked) => setForm((prev) => ({ ...prev, isEnabled: checked === true }))
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "bicEnabled", className: "cursor-pointer font-medium", children: t("shipment_tracking.bic_config.fields.isEnabled", "Enable BIC Enrichment") })
|
|
217
|
+
] }),
|
|
218
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
219
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
220
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "bicUsername", children: t("shipment_tracking.bic_config.fields.username", "Username") }),
|
|
221
|
+
/* @__PURE__ */ jsx(
|
|
222
|
+
Input,
|
|
223
|
+
{
|
|
224
|
+
id: "bicUsername",
|
|
225
|
+
value: form.username,
|
|
226
|
+
onChange: (e) => setForm((prev) => ({ ...prev, username: e.target.value })),
|
|
227
|
+
placeholder: "your-bic-username"
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
] }),
|
|
231
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
232
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "bicPassword", children: t("shipment_tracking.bic_config.fields.password", "Password") }),
|
|
233
|
+
/* @__PURE__ */ jsx(
|
|
234
|
+
Input,
|
|
235
|
+
{
|
|
236
|
+
id: "bicPassword",
|
|
237
|
+
type: "password",
|
|
238
|
+
value: form.password,
|
|
239
|
+
onChange: (e) => setForm((prev) => ({ ...prev, password: e.target.value })),
|
|
240
|
+
placeholder: config ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "your-bic-password"
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t(
|
|
244
|
+
"shipment_tracking.bic_config.hints.password",
|
|
245
|
+
"Your password will be encrypted and stored securely."
|
|
246
|
+
) })
|
|
247
|
+
] })
|
|
248
|
+
] }),
|
|
249
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
250
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "bicBaseUrl", children: t("shipment_tracking.bic_config.fields.baseUrl", "API Base URL") }),
|
|
251
|
+
/* @__PURE__ */ jsx(
|
|
252
|
+
Input,
|
|
253
|
+
{
|
|
254
|
+
id: "bicBaseUrl",
|
|
255
|
+
value: form.baseUrl,
|
|
256
|
+
onChange: (e) => setForm((prev) => ({ ...prev, baseUrl: e.target.value })),
|
|
257
|
+
placeholder: "https://api.bic-code.org"
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("shipment_tracking.bic_config.hints.baseUrl", "Default: https://api.bic-code.org") })
|
|
261
|
+
] }),
|
|
262
|
+
testResult && /* @__PURE__ */ jsxs(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
className: `flex items-center gap-2 rounded-md p-3 text-sm ${testResult.success ? "bg-green-50 text-green-700 dark:bg-green-900/20 dark:text-green-400" : "bg-red-50 text-red-700 dark:bg-red-900/20 dark:text-red-400"}`,
|
|
266
|
+
children: [
|
|
267
|
+
testResult.success ? /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4" }),
|
|
268
|
+
/* @__PURE__ */ jsx("span", { children: testResult.message })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pt-2", children: [
|
|
273
|
+
/* @__PURE__ */ jsxs(
|
|
274
|
+
Button,
|
|
275
|
+
{
|
|
276
|
+
variant: "outline",
|
|
277
|
+
onClick: handleTest,
|
|
278
|
+
disabled: testing || !form.username || !form.password,
|
|
279
|
+
children: [
|
|
280
|
+
testing && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
281
|
+
t("shipment_tracking.bic_config.actions.testConnection", "Test Connection")
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
/* @__PURE__ */ jsxs(Button, { onClick: handleSave, disabled: saving, children: [
|
|
286
|
+
saving && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
287
|
+
t("shipment_tracking.bic_config.actions.save", "Save Configuration")
|
|
288
|
+
] })
|
|
289
|
+
] })
|
|
290
|
+
] }) })
|
|
291
|
+
] });
|
|
292
|
+
}
|
|
293
|
+
function TrackingAuthConfigPage() {
|
|
294
|
+
const t = useT();
|
|
295
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
296
|
+
const [editingId, setEditingId] = useState(null);
|
|
297
|
+
const [form, setForm] = useState(emptyForm);
|
|
298
|
+
const [submitting, setSubmitting] = useState(false);
|
|
299
|
+
const isEdit = editingId !== null;
|
|
300
|
+
const columns = useMemo(
|
|
301
|
+
() => [
|
|
302
|
+
{
|
|
303
|
+
data: "carrierCode",
|
|
304
|
+
title: t("shipment_tracking.carrier_configs.fields.carrierCode", "Carrier Code"),
|
|
305
|
+
width: 150,
|
|
306
|
+
readOnly: true,
|
|
307
|
+
renderer: (value) => /* @__PURE__ */ jsx("span", { className: "font-medium", children: String(value ?? "") })
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
data: "apiEndpoint",
|
|
311
|
+
title: t("shipment_tracking.carrier_configs.fields.apiEndpoint", "API Endpoint"),
|
|
312
|
+
width: 280,
|
|
313
|
+
readOnly: true,
|
|
314
|
+
renderer: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm truncate max-w-[260px] block", children: String(value || "-") })
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
data: "rateLimit",
|
|
318
|
+
title: t("shipment_tracking.carrier_configs.fields.rateLimit", "Rate Limit"),
|
|
319
|
+
width: 120,
|
|
320
|
+
readOnly: true,
|
|
321
|
+
renderer: (_value, rowData) => /* @__PURE__ */ jsxs("span", { className: "text-sm", children: [
|
|
322
|
+
String(rowData.rateLimitRequests ?? 60),
|
|
323
|
+
" / ",
|
|
324
|
+
String(rowData.rateLimitWindowSeconds ?? 60),
|
|
325
|
+
"s"
|
|
326
|
+
] })
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
data: "isActive",
|
|
330
|
+
title: t("shipment_tracking.carrier_configs.fields.isActive", "Active"),
|
|
331
|
+
width: 80,
|
|
332
|
+
readOnly: true,
|
|
333
|
+
renderer: (value) => /* @__PURE__ */ jsx(BooleanIcon, { value: value === true || value === "true" })
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
[t]
|
|
337
|
+
);
|
|
338
|
+
const openCreateDialog = useCallback(() => {
|
|
339
|
+
setEditingId(null);
|
|
340
|
+
setForm(emptyForm);
|
|
341
|
+
setDialogOpen(true);
|
|
342
|
+
}, []);
|
|
343
|
+
const addButton = useMemo(
|
|
344
|
+
() => /* @__PURE__ */ jsx(ButtonV2, { variant: "primary", size: "sm", icon: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }), onClick: openCreateDialog, children: t("shipment_tracking.carrier_configs.create", "Add Carrier Config") }),
|
|
345
|
+
[openCreateDialog, t]
|
|
346
|
+
);
|
|
347
|
+
const table = useDynamicTablePage({
|
|
348
|
+
source: "/api/shipment_tracking/carrier-configs",
|
|
349
|
+
// Saved views. Without this the perspective tab strip auto-hides
|
|
350
|
+
// (hidePerspectiveTabs ?? !hasPerspectives), so users cannot save or
|
|
351
|
+
// switch a view on this list at all.
|
|
352
|
+
perspectives: "shipment_tracking_carrier_configs",
|
|
353
|
+
columns,
|
|
354
|
+
tableName: t("shipment_tracking.carrier_configs.title", "Carrier Configs"),
|
|
355
|
+
defaultPageSize: 20,
|
|
356
|
+
mapApiItem: mapItem,
|
|
357
|
+
cellEdit: false,
|
|
358
|
+
tableProps: {
|
|
359
|
+
height: "100%",
|
|
360
|
+
uiConfig: {
|
|
361
|
+
readOnlyStyle: "normal",
|
|
362
|
+
hideAddRowButton: true,
|
|
363
|
+
searchBarEnd: addButton
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
const openEditDialog = useCallback(
|
|
368
|
+
(id) => {
|
|
369
|
+
const items = table.query.data?.items ?? [];
|
|
370
|
+
const mapped = items.map(mapItem).filter((x) => x !== null);
|
|
371
|
+
const row = mapped.find((r) => r.id === id);
|
|
372
|
+
if (!row) return;
|
|
373
|
+
setEditingId(id);
|
|
374
|
+
setForm(rowToForm(row));
|
|
375
|
+
setDialogOpen(true);
|
|
376
|
+
},
|
|
377
|
+
[table.query.data]
|
|
378
|
+
);
|
|
379
|
+
const handleSubmit = useCallback(async () => {
|
|
380
|
+
if (submitting) return;
|
|
381
|
+
if (!isEdit && !form.carrierCode.trim()) {
|
|
382
|
+
flash(t("shipment_tracking.carrier_configs.validation.carrierCodeRequired", "Carrier code is required"), "error");
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (form.authConfig.trim()) {
|
|
386
|
+
try {
|
|
387
|
+
JSON.parse(form.authConfig);
|
|
388
|
+
} catch {
|
|
389
|
+
flash(t("shipment_tracking.carrier_configs.validation.authConfigInvalidJson", "Auth config must be valid JSON"), "error");
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (form.apiEndpoint.trim()) {
|
|
394
|
+
try {
|
|
395
|
+
new URL(form.apiEndpoint.trim());
|
|
396
|
+
} catch {
|
|
397
|
+
flash(t("shipment_tracking.carrier_configs.validation.apiEndpointInvalidUrl", "API endpoint must be a valid URL"), "error");
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
setSubmitting(true);
|
|
402
|
+
try {
|
|
403
|
+
const authConfig = form.authConfig.trim() ? JSON.parse(form.authConfig) : void 0;
|
|
404
|
+
if (isEdit) {
|
|
405
|
+
const body = { id: editingId };
|
|
406
|
+
if (form.apiEndpoint.trim()) body.apiEndpoint = form.apiEndpoint.trim();
|
|
407
|
+
else body.apiEndpoint = null;
|
|
408
|
+
body.authConfig = authConfig ?? null;
|
|
409
|
+
body.rateLimitRequests = form.rateLimitRequests;
|
|
410
|
+
body.rateLimitWindowSeconds = form.rateLimitWindowSeconds;
|
|
411
|
+
body.isActive = form.isActive;
|
|
412
|
+
await apiCallOrThrow("/api/shipment_tracking/carrier-configs", {
|
|
413
|
+
method: "PUT",
|
|
414
|
+
body: JSON.stringify(body)
|
|
415
|
+
});
|
|
416
|
+
flash(t("shipment_tracking.carrier_configs.flash.updated", "Carrier config updated"), "success");
|
|
417
|
+
} else {
|
|
418
|
+
const body = {
|
|
419
|
+
carrierCode: form.carrierCode.trim(),
|
|
420
|
+
rateLimitRequests: form.rateLimitRequests,
|
|
421
|
+
rateLimitWindowSeconds: form.rateLimitWindowSeconds,
|
|
422
|
+
isActive: form.isActive
|
|
423
|
+
};
|
|
424
|
+
if (form.apiEndpoint.trim()) body.apiEndpoint = form.apiEndpoint.trim();
|
|
425
|
+
if (authConfig) body.authConfig = authConfig;
|
|
426
|
+
await apiCallOrThrow("/api/shipment_tracking/carrier-configs", {
|
|
427
|
+
method: "POST",
|
|
428
|
+
body: JSON.stringify(body)
|
|
429
|
+
});
|
|
430
|
+
flash(t("shipment_tracking.carrier_configs.flash.created", "Carrier config created"), "success");
|
|
431
|
+
}
|
|
432
|
+
setDialogOpen(false);
|
|
433
|
+
table.refresh();
|
|
434
|
+
} catch {
|
|
435
|
+
flash(isEdit ? t("shipment_tracking.carrier_configs.flash.updateFailed", "Failed to update carrier config") : t("shipment_tracking.carrier_configs.flash.createFailed", "Failed to create carrier config"), "error");
|
|
436
|
+
} finally {
|
|
437
|
+
setSubmitting(false);
|
|
438
|
+
}
|
|
439
|
+
}, [form, isEdit, editingId, submitting, table.refresh, t]);
|
|
440
|
+
const handleDialogKeyDown = useCallback(
|
|
441
|
+
(event) => {
|
|
442
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
443
|
+
event.preventDefault();
|
|
444
|
+
handleSubmit();
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
[handleSubmit]
|
|
448
|
+
);
|
|
449
|
+
const handleDelete = useCallback(
|
|
450
|
+
async (id) => {
|
|
451
|
+
if (!confirm(t("shipment_tracking.carrier_configs.confirmDelete", "Delete this carrier config?"))) return;
|
|
452
|
+
try {
|
|
453
|
+
await apiCallOrThrow("/api/shipment_tracking/carrier-configs", {
|
|
454
|
+
method: "DELETE",
|
|
455
|
+
body: JSON.stringify({ id })
|
|
456
|
+
});
|
|
457
|
+
flash(t("shipment_tracking.carrier_configs.flash.deleted", "Carrier config deleted"), "success");
|
|
458
|
+
table.refresh();
|
|
459
|
+
} catch {
|
|
460
|
+
flash(t("shipment_tracking.carrier_configs.flash.deleteFailed", "Failed to delete carrier config"), "error");
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
[table.refresh, t]
|
|
464
|
+
);
|
|
465
|
+
const rowActions = useCallback(
|
|
466
|
+
(rowData) => {
|
|
467
|
+
if (!rowData?.id) return [];
|
|
468
|
+
return [
|
|
469
|
+
{ id: "edit", label: t("common.edit", "Edit") },
|
|
470
|
+
{ id: "delete", label: t("common.delete", "Delete") }
|
|
471
|
+
];
|
|
472
|
+
},
|
|
473
|
+
[t]
|
|
474
|
+
);
|
|
475
|
+
const handleRowAction = useCallback(
|
|
476
|
+
(actionId, rowData) => {
|
|
477
|
+
const id = rowData?.id;
|
|
478
|
+
if (!id) return;
|
|
479
|
+
if (actionId === "edit") openEditDialog(id);
|
|
480
|
+
else if (actionId === "delete") handleDelete(id);
|
|
481
|
+
},
|
|
482
|
+
[openEditDialog, handleDelete]
|
|
483
|
+
);
|
|
484
|
+
const tableHeight = useMemo(() => {
|
|
485
|
+
const rowH = 40;
|
|
486
|
+
const headerH = 40;
|
|
487
|
+
const toolbarH = 50;
|
|
488
|
+
const minHeight = 200;
|
|
489
|
+
const maxHeight = 400;
|
|
490
|
+
const rowCount = table.query.data?.total ?? 0;
|
|
491
|
+
const contentHeight = toolbarH + headerH + rowCount * rowH + 20;
|
|
492
|
+
return Math.min(Math.max(contentHeight, minHeight), maxHeight);
|
|
493
|
+
}, [table.query.data]);
|
|
494
|
+
if (table.isLoading) {
|
|
495
|
+
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsxs(PageBody, { className: "space-y-6", children: [
|
|
496
|
+
/* @__PURE__ */ jsx(BicConfigSection, {}),
|
|
497
|
+
/* @__PURE__ */ jsx(ShipsGoConfigSection, {}),
|
|
498
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
499
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: t("shipment_tracking.carrier_configs.title", "Carrier Configs") }) }),
|
|
500
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(TableSkeleton, { rows: 5, columns: 4 }) })
|
|
501
|
+
] })
|
|
502
|
+
] }) });
|
|
503
|
+
}
|
|
504
|
+
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsxs(PageBody, { className: "space-y-6", children: [
|
|
505
|
+
/* @__PURE__ */ jsx(BicConfigSection, {}),
|
|
506
|
+
/* @__PURE__ */ jsx(ShipsGoConfigSection, {}),
|
|
507
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
508
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
509
|
+
/* @__PURE__ */ jsx(CardTitle, { children: t("shipment_tracking.carrier_configs.title", "Carrier Configs") }),
|
|
510
|
+
/* @__PURE__ */ jsx(CardDescription, { children: t(
|
|
511
|
+
"shipment_tracking.auth_config.description",
|
|
512
|
+
"Configure authentication for carrier tracking APIs and facility enrichment services."
|
|
513
|
+
) })
|
|
514
|
+
] }),
|
|
515
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { style: { height: tableHeight }, children: /* @__PURE__ */ jsx(
|
|
516
|
+
DynamicTable,
|
|
517
|
+
{
|
|
518
|
+
...table.props,
|
|
519
|
+
striped: true,
|
|
520
|
+
density: "md",
|
|
521
|
+
rowActions,
|
|
522
|
+
onRowAction: handleRowAction
|
|
523
|
+
}
|
|
524
|
+
) }) })
|
|
525
|
+
] }),
|
|
526
|
+
/* @__PURE__ */ jsx(Dialog, { open: dialogOpen, onOpenChange: setDialogOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-lg", onKeyDown: handleDialogKeyDown, children: [
|
|
527
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: isEdit ? t("shipment_tracking.carrier_configs.edit", "Edit Carrier Config") : t("shipment_tracking.carrier_configs.create", "Add Carrier Config") }) }),
|
|
528
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 py-2", children: [
|
|
529
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
530
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "carrierCode", children: t("shipment_tracking.carrier_configs.fields.carrierCode", "Carrier Code") }),
|
|
531
|
+
/* @__PURE__ */ jsx(
|
|
532
|
+
Input,
|
|
533
|
+
{
|
|
534
|
+
id: "carrierCode",
|
|
535
|
+
value: form.carrierCode,
|
|
536
|
+
onChange: (event) => setForm((prev) => ({ ...prev, carrierCode: event.target.value })),
|
|
537
|
+
placeholder: "e.g. maersk, msc, cma-cgm",
|
|
538
|
+
disabled: isEdit,
|
|
539
|
+
autoFocus: !isEdit
|
|
540
|
+
}
|
|
541
|
+
)
|
|
542
|
+
] }),
|
|
543
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
544
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "apiEndpoint", children: t("shipment_tracking.carrier_configs.fields.apiEndpoint", "API Endpoint") }),
|
|
545
|
+
/* @__PURE__ */ jsx(
|
|
546
|
+
Input,
|
|
547
|
+
{
|
|
548
|
+
id: "apiEndpoint",
|
|
549
|
+
value: form.apiEndpoint,
|
|
550
|
+
onChange: (event) => setForm((prev) => ({ ...prev, apiEndpoint: event.target.value })),
|
|
551
|
+
placeholder: "https://api.example.com/tracking"
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
] }),
|
|
555
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
556
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "authConfig", children: t("shipment_tracking.carrier_configs.fields.authConfig", "Auth Config (JSON)") }),
|
|
557
|
+
/* @__PURE__ */ jsx(
|
|
558
|
+
Textarea,
|
|
559
|
+
{
|
|
560
|
+
id: "authConfig",
|
|
561
|
+
value: form.authConfig,
|
|
562
|
+
onChange: (event) => setForm((prev) => ({ ...prev, authConfig: event.target.value })),
|
|
563
|
+
placeholder: '{"apiKey": "..."}',
|
|
564
|
+
rows: 3,
|
|
565
|
+
className: "font-mono text-xs"
|
|
566
|
+
}
|
|
567
|
+
)
|
|
568
|
+
] }),
|
|
569
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
570
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
571
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "rateLimitRequests", children: t("shipment_tracking.carrier_configs.fields.rateLimitRequests", "Rate Limit (requests)") }),
|
|
572
|
+
/* @__PURE__ */ jsx(
|
|
573
|
+
Input,
|
|
574
|
+
{
|
|
575
|
+
id: "rateLimitRequests",
|
|
576
|
+
type: "number",
|
|
577
|
+
min: 1,
|
|
578
|
+
max: 1e4,
|
|
579
|
+
value: form.rateLimitRequests,
|
|
580
|
+
onChange: (event) => setForm((prev) => ({ ...prev, rateLimitRequests: Number(event.target.value) || 60 }))
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
585
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "rateLimitWindowSeconds", children: t("shipment_tracking.carrier_configs.fields.rateLimitWindowSeconds", "Window (seconds)") }),
|
|
586
|
+
/* @__PURE__ */ jsx(
|
|
587
|
+
Input,
|
|
588
|
+
{
|
|
589
|
+
id: "rateLimitWindowSeconds",
|
|
590
|
+
type: "number",
|
|
591
|
+
min: 1,
|
|
592
|
+
max: 86400,
|
|
593
|
+
value: form.rateLimitWindowSeconds,
|
|
594
|
+
onChange: (event) => setForm((prev) => ({ ...prev, rateLimitWindowSeconds: Number(event.target.value) || 60 }))
|
|
595
|
+
}
|
|
596
|
+
)
|
|
597
|
+
] })
|
|
598
|
+
] }),
|
|
599
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
600
|
+
/* @__PURE__ */ jsx(
|
|
601
|
+
Checkbox,
|
|
602
|
+
{
|
|
603
|
+
id: "isActive",
|
|
604
|
+
checked: form.isActive,
|
|
605
|
+
onCheckedChange: (checked) => setForm((prev) => ({ ...prev, isActive: checked === true }))
|
|
606
|
+
}
|
|
607
|
+
),
|
|
608
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "isActive", className: "cursor-pointer", children: t("shipment_tracking.carrier_configs.fields.isActive", "Active") })
|
|
609
|
+
] })
|
|
610
|
+
] }),
|
|
611
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
612
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setDialogOpen(false), disabled: submitting, children: t("common.cancel", "Cancel") }),
|
|
613
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleSubmit, disabled: submitting, children: submitting ? t("common.saving", "Saving...") : isEdit ? t("common.save", "Save") : t("common.create", "Create") })
|
|
614
|
+
] })
|
|
615
|
+
] }) })
|
|
616
|
+
] }) });
|
|
617
|
+
}
|
|
618
|
+
export {
|
|
619
|
+
TrackingAuthConfigPage as default
|
|
620
|
+
};
|
|
621
|
+
//# sourceMappingURL=page.js.map
|