@burdenoff/microfe-kadaikodi 2026.1126.2 → 2026.1127.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +12 -0
  2. package/dist/kadaikodi/components/CourierLocationSharingCard.d.ts +10 -0
  3. package/dist/kadaikodi/components/CourierLocationSharingCard.js +52 -0
  4. package/dist/kadaikodi/components/CourierLocationSharingCard.js.map +1 -0
  5. package/dist/kadaikodi/components/DropoffPinField.d.ts +16 -0
  6. package/dist/kadaikodi/components/DropoffPinField.js +67 -0
  7. package/dist/kadaikodi/components/DropoffPinField.js.map +1 -0
  8. package/dist/kadaikodi/components/LiveTrackingMap.d.ts +27 -0
  9. package/dist/kadaikodi/components/LiveTrackingMap.js +74 -0
  10. package/dist/kadaikodi/components/LiveTrackingMap.js.map +1 -0
  11. package/dist/kadaikodi/hooks/useCourierLocationSharing.d.ts +24 -0
  12. package/dist/kadaikodi/hooks/useCourierLocationSharing.js +54 -0
  13. package/dist/kadaikodi/hooks/useCourierLocationSharing.js.map +1 -0
  14. package/dist/kadaikodi/hooks/useTrackingApi.d.ts +63 -0
  15. package/dist/kadaikodi/hooks/useTrackingApi.js +37 -0
  16. package/dist/kadaikodi/hooks/useTrackingApi.js.map +1 -0
  17. package/dist/kadaikodi/pages/customer/CheckoutPage.js +222 -213
  18. package/dist/kadaikodi/pages/customer/CheckoutPage.js.map +1 -1
  19. package/dist/kadaikodi/pages/customer/OrderTrackingPage.d.ts +4 -0
  20. package/dist/kadaikodi/pages/customer/OrderTrackingPage.js +274 -249
  21. package/dist/kadaikodi/pages/customer/OrderTrackingPage.js.map +1 -1
  22. package/dist/kadaikodi/pages/customer/shared.d.ts +0 -13
  23. package/dist/kadaikodi/pages/customer/shared.js +16 -119
  24. package/dist/kadaikodi/pages/customer/shared.js.map +1 -1
  25. package/dist/kadaikodi/pages/worker/TaskDetailsPage.d.ts +3 -2
  26. package/dist/kadaikodi/pages/worker/TaskDetailsPage.js +67 -65
  27. package/dist/kadaikodi/pages/worker/TaskDetailsPage.js.map +1 -1
  28. package/dist/kadaikodi/utils/deviceGeolocation.d.ts +46 -0
  29. package/dist/kadaikodi/utils/deviceGeolocation.js +71 -0
  30. package/dist/kadaikodi/utils/deviceGeolocation.js.map +1 -0
  31. package/dist/kadaikodi/utils/leaflet.d.ts +8 -0
  32. package/dist/kadaikodi/utils/leaflet.js +11 -0
  33. package/dist/kadaikodi/utils/leaflet.js.map +1 -0
  34. package/dist/node_modules/leaflet/dist/leaflet-src.js +4535 -0
  35. package/dist/node_modules/leaflet/dist/leaflet-src.js.map +1 -0
  36. package/package.json +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"OrderTrackingPage.js","names":["statusOrder","statusLabels","statusDescriptions","OrderTrackingPage","useParams","useKadaikodi","order","useOrder","orderId","createReview","useCreateReview","showRateModal","setShowRateModal","useState","rating","setRating","reviewText","setReviewText","statusMessage","setStatusMessage","showStatus","msg","cachedOrder","useKadaikodiStore","s","setLastKnownOrderStatus","hasNotifiedRef","useRef","previousStatus","changed","changeKey","label","notifyOrderStatusChange","handleSubmitRating","currentUser","isLoading","PageLayout","isError","WifiOff","formatDate","StatusBadge","formatCurrency","EmptyState","ShoppingBag","navigateTo","currentStatusIndex","isCancelled","isDelivered","etaMinutes","routeProgress","timelineItems","tone","i","isCurrent","stepStatus","cn","ArrowLeft","PagePurpose","GlassCard","XCircle","CheckCircle2","Clock","StylizedRouteMap","Timeline","item","index","MapPin","Star","Phone","MessageCircle","X","star","Loader2"],"sources":["../../../../src/kadaikodi/pages/customer/OrderTrackingPage.tsx"],"sourcesContent":["/**\n * Order Tracking Page\n * @module kadaikodi/pages/customer\n *\n * Real-time order tracking with status timeline, delivery partner info,\n * price breakdown, Need Help sidebar, and rate order functionality.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ArrowLeft,\n CheckCircle2,\n Clock,\n MapPin,\n Phone,\n Star,\n ShoppingBag,\n WifiOff,\n XCircle,\n MessageCircle,\n Loader2,\n X,\n} from 'lucide-react';\nimport { GlassCard, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { Timeline, type TimelineItem } from '../../components/viz';\nimport { useKadaikodi } from '../../context/KadaikodiContext';\nimport { useOrder, useCreateReview } from '../../hooks/useKadaikodiApi';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatDate } from '../../utils/formatters';\nimport { notifyOrderStatusChange } from '../../utils/orderStatusNotifier';\nimport { useKadaikodiStore } from '../../store';\nimport type { OrderStatus } from '../../types';\nimport { StylizedRouteMap } from './shared';\n\nconst statusOrder: OrderStatus[] = [\n 'pending',\n 'confirmed',\n 'preparing',\n 'ready',\n 'out_for_delivery',\n 'delivered',\n];\n\nconst statusLabels: Record<string, string> = {\n pending: 'Order Placed',\n confirmed: 'Confirmed',\n preparing: 'Preparing',\n ready: 'Ready',\n out_for_delivery: 'Out for Delivery',\n delivered: 'Delivered',\n};\n\nconst statusDescriptions: Record<string, string> = {\n pending: 'Your order has been received',\n confirmed: 'Cart has accepted your order',\n preparing: 'Your food is being prepared',\n ready: 'Order is ready for pickup/delivery',\n out_for_delivery: 'Your order is on the way',\n delivered: 'Order has been delivered',\n};\n\nexport function OrderTrackingPage() {\n const { orderId } = useParams<{ orderId: string }>();\n const { navigateTo, currentUser } = useKadaikodi();\n const { data: order, isLoading, isError } = useOrder(orderId, { pollWhileActive: true });\n const createReview = useCreateReview();\n const [showRateModal, setShowRateModal] = useState(false);\n const [rating, setRating] = useState(5);\n const [reviewText, setReviewText] = useState('');\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n\n const showStatus = (msg: string) => {\n setStatusMessage(msg);\n setTimeout(() => setStatusMessage(null), 3000);\n };\n\n // Offline-cached order status (BOFF-4301). `cachedOrder` is what OS-level\n // notifications and the offline fallback view below both key off; it\n // outlives an app kill/reload because it's persisted, unlike the\n // in-memory react-query cache `order` comes from.\n const cachedOrder = useKadaikodiStore((s) =>\n orderId ? s.lastKnownOrderStatus[orderId] : undefined\n );\n const setLastKnownOrderStatus = useKadaikodiStore((s) => s.setLastKnownOrderStatus);\n const hasNotifiedRef = useRef<Set<string>>(new Set());\n\n useEffect(() => {\n if (!order || !orderId) return;\n const previousStatus = cachedOrder?.status;\n const changed = previousStatus !== undefined && previousStatus !== order.status;\n // De-dupe within a single mount: React Query's polling can re-fire the\n // same status more than once before the store write is observed.\n const changeKey = `${orderId}:${order.status}`;\n if (changed && !hasNotifiedRef.current.has(changeKey)) {\n hasNotifiedRef.current.add(changeKey);\n const label = statusLabels[order.status] ?? order.status;\n showStatus(`Order status updated: ${label}`);\n void notifyOrderStatusChange({\n orderId,\n title: `${order.cartName} — ${label}`,\n body: statusDescriptions[order.status] ?? `Your order is now ${label.toLowerCase()}.`,\n });\n }\n setLastKnownOrderStatus(orderId, {\n status: order.status,\n orderNumber: order.id,\n cartName: order.cartName,\n total: order.total,\n cachedAt: new Date().toISOString(),\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- only order.status changes should re-run this; cachedOrder/setLastKnownOrderStatus would otherwise loop against the write this effect itself performs.\n }, [order?.status, order?.id, orderId]);\n\n const handleSubmitRating = () => {\n if (!order || !currentUser?.id) {\n showStatus('Please sign in to rate this order.');\n return;\n }\n createReview.mutate(\n {\n providerId: order.cartId,\n orderId: order.id,\n customerId: currentUser.id,\n rating,\n review: reviewText.trim() || undefined,\n },\n {\n onSuccess: () => {\n setShowRateModal(false);\n setReviewText('');\n showStatus('Thanks! Your rating has been submitted.');\n },\n onError: () => showStatus('Could not submit your rating. Please try again.'),\n }\n );\n };\n\n if (isLoading) {\n return (\n <PageLayout title=\"Track Order\">\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-foreground mx-auto mb-4\" />\n <p className=\"text-sm text-text-secondary\">Loading order details...</p>\n </div>\n </PageLayout>\n );\n }\n\n if (!order) {\n // BOFF-4301: the live fetch failed (most likely offline) but a\n // previous session cached this order's last-known status on-device —\n // show that instead of a bare \"not found\", which would be misleading\n // (the order does exist; we just can't reach the network right now).\n if (isError && cachedOrder) {\n return (\n <PageLayout title=\"Track Order\">\n <div className=\"mb-4 flex items-start gap-3 rounded-lg border border-status-warning-text/30 bg-status-warning-bg-subtle p-4\">\n <WifiOff className=\"h-5 w-5 text-status-warning-text mt-0.5 shrink-0\" />\n <div>\n <p className=\"text-sm font-medium text-status-warning-text\">\n You&apos;re offline — showing the last known status\n </p>\n <p className=\"text-xs text-status-warning-text/80 mt-0.5\">\n Cached {formatDate(cachedOrder.cachedAt)}. Reconnect to see live updates.\n </p>\n </div>\n </div>\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <div className=\"flex items-center justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">\n Order #{cachedOrder.orderNumber}\n </h2>\n <p className=\"text-sm text-text-secondary\">{cachedOrder.cartName}</p>\n </div>\n <StatusBadge status={cachedOrder.status as OrderStatus} />\n </div>\n <p className=\"mt-3 text-sm text-text-primary\">\n Last known total: {formatCurrency(cachedOrder.total, { minimumFractionDigits: 0 })}\n </p>\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout title=\"Order Not Found\">\n <EmptyState\n icon={<ShoppingBag className=\"h-12 w-12\" />}\n title=\"Order not found\"\n description={`The order you're looking for doesn't exist.`}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/orders')}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n View All Orders\n </button>\n }\n />\n </PageLayout>\n );\n }\n\n const currentStatusIndex = statusOrder.indexOf(order.status);\n const isCancelled = order.status === 'cancelled';\n const isDelivered = order.status === 'delivered';\n\n // Honest ETA: only derived when the backend supplies a real estimated time.\n const etaMinutes = order.estimatedDeliveryTime\n ? Math.max(\n 0,\n Math.round((new Date(order.estimatedDeliveryTime).getTime() - Date.now()) / 60000)\n )\n : null;\n\n // Route progress along the illustrative map (0..1) from the live status index.\n const routeProgress = currentStatusIndex < 0 ? 0 : currentStatusIndex / (statusOrder.length - 1);\n\n const timelineItems: TimelineItem[] = statusOrder.map((stepStatus, i) => {\n const tone = i < currentStatusIndex ? 'success' : i === currentStatusIndex ? 'accent' : 'muted';\n const isCurrent = i === currentStatusIndex;\n return {\n id: stepStatus,\n title: statusLabels[stepStatus],\n tone,\n meta: (\n <span className={cn(isCurrent ? 'text-text-primary' : undefined)}>\n {statusDescriptions[stepStatus]}\n </span>\n ),\n };\n });\n\n return (\n <PageLayout\n title={\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/orders')}\n className=\"rounded-md p-1 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors\"\n >\n <ArrowLeft className=\"h-5 w-5\" />\n </button>\n <span>Track Order</span>\n </div>\n }\n actions={<StatusBadge status={order.status} />}\n >\n <PagePurpose className=\"mb-6\">\n Follow your order in real time — see exactly where it is from kitchen to doorstep, who's\n delivering it, and reach out for help if anything looks off. The live status updates as your\n order moves through each stage.\n </PagePurpose>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Left: Order Details & Timeline */}\n <div className=\"lg:col-span-2 space-y-6\">\n {/* Order Header — the one emphasis zone (live status) */}\n <GlassCard treatment=\"glass\" glow className=\"p-5\">\n <div className=\"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3\">\n <div className=\"flex-1\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Order #{order.id}</h2>\n <p className=\"text-sm text-text-secondary\">{order.cartName}</p>\n <p className=\"text-xs text-text-secondary mt-0.5\">{formatDate(order.orderDate)}</p>\n </div>\n <div className=\"text-left sm:text-right\">\n <p className=\"text-xl font-bold text-text-primary\">\n {formatCurrency(order.total, { minimumFractionDigits: 0 })}\n </p>\n <p className=\"text-xs text-text-secondary uppercase\">{order.paymentMethod}</p>\n </div>\n </div>\n\n {/* Status Banner */}\n {isCancelled ? (\n <div className=\"mt-4 flex items-start gap-3 rounded-lg bg-status-error-bg/10 p-4 border border-status-error-border/20\">\n <XCircle className=\"h-5 w-5 text-status-error-text mt-0.5 shrink-0\" />\n <div>\n <p className=\"font-medium text-status-error-text\">Order Cancelled</p>\n {order.cancellationReason && (\n <p className=\"text-sm text-status-error-text/80 mt-0.5\">\n {order.cancellationReason}\n </p>\n )}\n </div>\n </div>\n ) : (\n <div\n className={cn(\n 'mt-4 flex items-start gap-3 rounded-lg p-4 border',\n isDelivered\n ? 'bg-status-success-bg-subtle border-status-success-text/20'\n : 'bg-[var(--color-accent-soft)] border-border-focus/20'\n )}\n >\n {isDelivered ? (\n <CheckCircle2 className=\"h-5 w-5 text-status-success-text mt-0.5 shrink-0\" />\n ) : (\n <Clock className=\"h-5 w-5 text-text-primary mt-0.5 shrink-0\" />\n )}\n <p\n className={cn(\n 'text-sm font-medium',\n isDelivered ? 'text-status-success-text' : 'text-text-primary'\n )}\n >\n {isDelivered\n ? `Delivered at ${formatDate(order.actualDeliveryTime!)}`\n : order.estimatedDeliveryTime\n ? `Estimated delivery by ${formatDate(order.estimatedDeliveryTime)}`\n : 'Estimated delivery time: TBD'}\n </p>\n </div>\n )}\n </GlassCard>\n\n {/* Live tracking: ETA + stylised route + status timeline */}\n {!isCancelled && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <div className=\"mb-4 flex flex-wrap items-center justify-between gap-2\">\n <h3 className=\"text-base font-semibold text-text-primary\">Order Status</h3>\n {!isDelivered && etaMinutes != null && (\n <span className=\"inline-flex items-center gap-1.5 rounded-full bg-[var(--color-accent-soft)] px-3 py-1 text-sm font-semibold text-accent-primary\">\n <Clock className=\"h-3.5 w-3.5\" />\n Arriving in ~{etaMinutes} min\n </span>\n )}\n </div>\n <StylizedRouteMap\n progress={routeProgress}\n originLabel={order.cartName}\n destinationLabel=\"You\"\n className=\"mb-6 h-44\"\n />\n <Timeline items={timelineItems} />\n </div>\n )}\n\n {/* Order Items & Price Breakdown */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Order Items</h3>\n <div className=\"space-y-2\">\n {order.items.map((item, index) => (\n <div\n key={index}\n className=\"flex justify-between items-start pb-2 border-b border-border-subtle last:border-b-0\"\n >\n <div className=\"flex-1 pr-2\">\n <p className=\"text-sm font-medium text-text-primary\">{item.name}</p>\n {item.customizations && item.customizations.length > 0 && (\n <p className=\"text-xs text-text-secondary\">\n {item.customizations.join(', ')}\n </p>\n )}\n <p className=\"text-xs text-text-secondary\">\n {formatCurrency(item.price, { minimumFractionDigits: 0 })} x {item.quantity}\n </p>\n </div>\n <p className=\"text-sm font-medium text-text-primary\">\n {formatCurrency(item.price * item.quantity, { minimumFractionDigits: 0 })}\n </p>\n </div>\n ))}\n </div>\n\n {/* Price Breakdown */}\n <div className=\"mt-4 pt-4 border-t border-border-subtle space-y-2 text-sm\">\n <div className=\"flex justify-between text-text-secondary\">\n <span>Subtotal</span>\n <span>{formatCurrency(order.subtotal, { minimumFractionDigits: 0 })}</span>\n </div>\n <div className=\"flex justify-between text-text-secondary\">\n <span>Delivery Fee</span>\n <span>\n {order.deliveryFee === 0\n ? 'FREE'\n : formatCurrency(order.deliveryFee, { minimumFractionDigits: 0 })}\n </span>\n </div>\n <div className=\"flex justify-between text-text-secondary\">\n <span>Tax</span>\n <span>{formatCurrency(order.taxes, { minimumFractionDigits: 0 })}</span>\n </div>\n {order.discount && order.discount > 0 && (\n <div className=\"flex justify-between text-status-success-text\">\n <span>Discount</span>\n <span>-{formatCurrency(order.discount, { minimumFractionDigits: 0 })}</span>\n </div>\n )}\n <div className=\"flex justify-between font-semibold pt-2 border-t border-border-subtle text-text-primary\">\n <span>Total</span>\n <span>{formatCurrency(order.total, { minimumFractionDigits: 0 })}</span>\n </div>\n </div>\n </div>\n </div>\n\n {/* Right: Sidebar */}\n <div className=\"lg:col-span-1 space-y-6\">\n {/* Delivery Details */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Delivery Details</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-start gap-2\">\n <MapPin className=\"mt-0.5 h-4 w-4 shrink-0 text-text-secondary\" />\n <div>\n <p className=\"text-xs text-text-secondary\">Delivery Address</p>\n <p className=\"text-sm font-medium text-text-primary\">\n {order.deliveryAddress.street}\n </p>\n <p className=\"text-sm text-text-secondary\">{order.deliveryAddress.area}</p>\n <p className=\"text-sm text-text-secondary\">\n {order.deliveryAddress.city}, {order.deliveryAddress.pincode}\n </p>\n {order.deliveryAddress.landmark && (\n <p className=\"text-xs text-text-secondary mt-0.5\">\n Landmark: {order.deliveryAddress.landmark}\n </p>\n )}\n </div>\n </div>\n\n {/* Customer Notes */}\n {order.customerNotes && (\n <div>\n <p className=\"text-xs text-text-secondary\">Customer Notes</p>\n <p className=\"text-sm text-text-primary\">{order.customerNotes}</p>\n </div>\n )}\n\n {/* Payment */}\n <div>\n <p className=\"text-xs text-text-secondary\">Payment Method</p>\n <p className=\"text-sm font-medium text-text-primary capitalize\">\n {order.paymentMethod}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {order.paymentStatus === 'paid'\n ? 'Paid'\n : order.paymentStatus === 'refunded'\n ? 'Refunded'\n : order.paymentStatus === 'failed'\n ? 'Payment Failed'\n : order.paymentStatus === 'processing'\n ? 'Payment Processing'\n : 'Payment Pending'}\n </p>\n </div>\n </div>\n </div>\n\n {/* Delivery Partner */}\n {order.assignedWorker && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Delivery Partner</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-10 w-10 items-center justify-center rounded-full bg-bg-sunken text-text-secondary\">\n <span className=\"text-sm font-semibold\">\n {order.assignedWorker.name.charAt(0)}\n </span>\n </div>\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium text-text-primary\">\n {order.assignedWorker.name}\n </p>\n <div className=\"flex items-center gap-1.5 mt-0.5\">\n <Star className=\"h-3 w-3 fill-status-warning-text text-status-warning-text\" />\n <span className=\"text-xs text-text-secondary\">\n {order.assignedWorker.rating}/5\n </span>\n </div>\n </div>\n <a\n href={`tel:${order.assignedWorker.phone}`}\n className=\"flex h-9 w-9 items-center justify-center rounded-full bg-bg-sunken text-text-secondary hover:bg-accent hover:text-text-primary transition-colors\"\n >\n <Phone className=\"h-4 w-4\" />\n </a>\n </div>\n <div className=\"grid grid-cols-2 gap-2\">\n <a\n href={`tel:${order.assignedWorker.phone}`}\n className=\"flex items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2.5 text-sm font-semibold text-action-primary-text hover:bg-action-primary-bg-hover transition-colors\"\n >\n <Phone className=\"h-4 w-4\" />\n Call\n </a>\n <button\n type=\"button\"\n disabled\n title=\"In-app chat is coming soon\"\n className=\"flex items-center justify-center gap-2 rounded-lg border border-border-subtle px-3 py-2.5 text-sm font-medium text-text-secondary cursor-not-allowed opacity-70\"\n >\n <MessageCircle className=\"h-4 w-4\" />\n Chat\n </button>\n </div>\n </div>\n </div>\n )}\n\n {/* Need Help */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Need Help?</h3>\n <div className=\"space-y-2\">\n <a\n href=\"mailto:support@kadaikodi.com\"\n className=\"w-full flex items-center justify-center gap-2 rounded-lg border border-border-subtle px-3 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <MessageCircle className=\"h-4 w-4\" />\n Email Support\n </a>\n <button\n type=\"button\"\n onClick={() => (window.location.href = 'tel:7012270561')}\n className=\"w-full flex items-center justify-center gap-2 rounded-lg border border-border-subtle px-3 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <Phone className=\"h-4 w-4\" />\n Call Support\n </button>\n {isDelivered && !order.rating && (\n <button\n type=\"button\"\n onClick={() => setShowRateModal(true)}\n className=\"w-full flex items-center justify-center gap-2 rounded-lg bg-foreground px-3 py-2.5 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n <Star className=\"h-4 w-4\" />\n Rate Order\n </button>\n )}\n </div>\n </div>\n </div>\n </div>\n\n {/* Status message */}\n {statusMessage && (\n <div className=\"fixed bottom-4 left-1/2 z-50 -translate-x-1/2 rounded-lg border border-status-success-text/30 bg-status-success-bg-subtle px-4 py-3 shadow-lg flex items-center gap-2\">\n <CheckCircle2 className=\"h-4 w-4 text-status-success-text shrink-0\" />\n <p className=\"text-sm text-status-success-text\">{statusMessage}</p>\n </div>\n )}\n\n {/* Rate Order Modal */}\n {showRateModal && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4\">\n <div className=\"w-full max-w-md rounded-lg border border-border-subtle bg-bg-surface shadow-lg\">\n <div className=\"p-5\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Rate your order</h3>\n <button\n type=\"button\"\n onClick={() => setShowRateModal(false)}\n className=\"rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n <div className=\"mb-4\">\n <label className=\"block text-sm font-medium text-text-primary mb-2\">\n Your rating\n </label>\n <div className=\"flex items-center gap-1\">\n {[1, 2, 3, 4, 5].map((star) => (\n <button\n key={star}\n type=\"button\"\n onClick={() => setRating(star)}\n className=\"p-0.5\"\n aria-label={`${star} star${star > 1 ? 's' : ''}`}\n >\n <Star\n className={cn(\n 'h-7 w-7',\n star <= rating\n ? 'fill-status-warning-text text-status-warning-text'\n : 'fill-none text-text-secondary/40'\n )}\n />\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"mb-5\">\n <label className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Review <span className=\"text-text-secondary font-normal\">(optional)</span>\n </label>\n <textarea\n rows={4}\n value={reviewText}\n onChange={(e) => setReviewText(e.target.value)}\n placeholder=\"How was your order?\"\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none\"\n />\n </div>\n\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={handleSubmitRating}\n disabled={createReview.isPending}\n className={cn(\n 'flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-foreground px-4 py-2.5 text-sm font-medium text-background transition-opacity',\n createReview.isPending ? 'opacity-60 cursor-not-allowed' : 'hover:opacity-90'\n )}\n >\n {createReview.isPending && <Loader2 className=\"h-4 w-4 animate-spin\" />}\n Submit Rating\n </button>\n <button\n type=\"button\"\n onClick={() => setShowRateModal(false)}\n className=\"rounded-lg border border-border-subtle px-4 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,IAAMA,IAA6B;CACjC;CACA;CACA;CACA;CACA;CACA;AACF,GAEMC,IAAuC;CAC3C,SAAS;CACT,WAAW;CACX,WAAW;CACX,OAAO;CACP,kBAAkB;CAClB,WAAW;AACb,GAEMC,IAA6C;CACjD,SAAS;CACT,WAAW;CACX,WAAW;CACX,OAAO;CACP,kBAAkB;CAClB,WAAW;AACb;AAEA,SAAgBC,IAAoB;CAClC,IAAM,EAAE,eAAYC,EAA+B,GAC7C,EAAE,eAAY,mBAAgBC,EAAa,GAC3C,EAAE,MAAMC,GAAO,cAAW,eAAYC,EAASC,GAAS,EAAE,iBAAiB,GAAK,CAAC,GACjFC,IAAeC,GA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AAA,CACE,kBAAC,SAAD;SAAO,WAAU;SAAmD,UAAA;QAE7D,CAAA,GACP,kBAAC,OAAD;SAAK,WAAU;SACZ,UAAA;UAAC;UAAG;UAAG;UAAG;UAAG;SAAC,CAAC,CAAC,KAAK,MACpB,kBAAC,UAAD;UAEE,MAAK;UACL,eAAevD,EAAUwD,CAAI;UAC7B,WAAU;UACV,cAAY,GAAGA,EAAK,OAAOA,IAAO,IAAI,MAAM;UAE5C,UAAA,kBAACJ,GAAD,EACE,WAAWZ,EACT,WACAgB,KAAQzD,IACJ,sDACA,kCACN,EACD,CAAA;SACK,GAdDyD,CAcC,CACT;QACE,CAAA,CACF;;OAEL,kBAAC,OAAD;QAAK,WAAU;QAAf,UAAA,CACE,kBAAC,SAAD;SAAO,WAAU;SAAjB,UAAA,CAAsE,WAC7D,kBAAC,QAAD;UAAM,WAAU;UAAkC,UAAA;SAAgB,CAAA,CACpE;QACP,CAAA,GAAA,kBAAC,YAAD;SACE,MAAM;SACN,OAAOvD;SACP,WAAW,MAAMC,EAAc,EAAE,OAAO,KAAK;SAC7C,aAAY;SACZ,WAAU;QACX,CAAA,CACE;;OAEL,kBAAC,OAAD;QAAK,WAAU;QAAf,UAAA,CACE,kBAAC,UAAD;SACE,MAAK;SACL,SAASgB;SACT,UAAUxB,EAAa;SACvB,WAAW8C,EACT,oJACA9C,EAAa,YAAY,kCAAkC,kBAC7D;SAPF,UAAA,CASGA,EAAa,aAAa,kBAAC+D,GAAD,EAAS,WAAU,uBAAwB,CAAA,GAAE,eAElE;QACR,CAAA,GAAA,kBAAC,UAAD;SACE,MAAK;SACL,eAAe5D,EAAiB,EAAK;SACrC,WAAU;SACX,UAAA;QAEO,CAAA,CACL;;MACF;;IACF,CAAA;GACF,CAAA;EAEG;;AAEhB"}
1
+ {"version":3,"file":"OrderTrackingPage.js","names":["statusOrder","statusLabels","statusDescriptions","courierContact","live","assigned","deliveryBannerText","delivered","order","formatDate","liveEtaAt","liveLocationCaption","location","updated","formatRelativeTime","OrderTrackingPage","useParams","useKadaikodi","useOrder","orderId","tracking","useOrderTracking","createReview","useCreateReview","showRateModal","setShowRateModal","useState","rating","setRating","reviewText","setReviewText","statusMessage","setStatusMessage","showStatus","msg","cachedOrder","useKadaikodiStore","s","setLastKnownOrderStatus","hasNotifiedRef","useRef","previousStatus","changed","changeKey","label","notifyOrderStatusChange","handleSubmitRating","currentUser","isLoading","PageLayout","isError","WifiOff","StatusBadge","formatCurrency","EmptyState","ShoppingBag","navigateTo","currentStatusIndex","isCancelled","isDelivered","liveTracking","etaMinutes","courierLocation","mapOrigin","mapDestination","hasMapPoints","courier","courierPhone","timelineItems","tone","i","isCurrent","stepStatus","cn","ArrowLeft","PagePurpose","GlassCard","XCircle","CheckCircle2","Clock","LiveTrackingMap","Navigation","formatDistance","Timeline","item","index","MapPin","Star","Phone","MessageCircle","X","star","Loader2"],"sources":["../../../../src/kadaikodi/pages/customer/OrderTrackingPage.tsx"],"sourcesContent":["/**\n * Order Tracking Page\n * @module kadaikodi/pages/customer\n *\n * Real-time order tracking with status timeline, delivery partner info,\n * price breakdown, Need Help sidebar, and rate order functionality.\n *\n * Live courier position, drop-off pin and ETA come from\n * `kadaikodiOrderTracking` (BOFF-3962), polled at the interval the service\n * returns, and are drawn on a real map (LiveTrackingMap).\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ArrowLeft,\n CheckCircle2,\n Clock,\n MapPin,\n Phone,\n Star,\n ShoppingBag,\n WifiOff,\n XCircle,\n MessageCircle,\n Loader2,\n Navigation,\n X,\n} from 'lucide-react';\nimport { GlassCard, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { Timeline, type TimelineItem } from '../../components/viz';\nimport { LiveTrackingMap } from '../../components/LiveTrackingMap';\nimport { useKadaikodi } from '../../context/KadaikodiContext';\nimport { useOrder, useCreateReview } from '../../hooks/useKadaikodiApi';\nimport {\n useOrderTracking,\n type CourierLocation,\n type TrackingCourier,\n} from '../../hooks/useTrackingApi';\nimport { cn } from '../../utils/cn';\nimport {\n formatCurrency,\n formatDate,\n formatDistance,\n formatRelativeTime,\n} from '../../utils/formatters';\nimport { notifyOrderStatusChange } from '../../utils/orderStatusNotifier';\nimport { useKadaikodiStore } from '../../store';\nimport type { MockOrder, OrderStatus } from '../../types';\n\nconst statusOrder: OrderStatus[] = [\n 'pending',\n 'confirmed',\n 'preparing',\n 'ready',\n 'out_for_delivery',\n 'delivered',\n];\n\nconst statusLabels: Record<string, string> = {\n pending: 'Order Placed',\n confirmed: 'Confirmed',\n preparing: 'Preparing',\n ready: 'Ready',\n out_for_delivery: 'Out for Delivery',\n delivered: 'Delivered',\n};\n\nconst statusDescriptions: Record<string, string> = {\n pending: 'Your order has been received',\n confirmed: 'Cart has accepted your order',\n preparing: 'Your food is being prepared',\n ready: 'Order is ready for pickup/delivery',\n out_for_delivery: 'Your order is on the way',\n delivered: 'Order has been delivered',\n};\n\ninterface CourierContact {\n name: string;\n phone?: string;\n rating?: number;\n}\n\n/** Courier contact: the live tracking courier, else the order's assigned worker. */\nfunction courierContact(\n live: TrackingCourier | null,\n assigned: MockOrder['assignedWorker']\n): CourierContact | null {\n if (live) return { name: live.name, phone: live.phone ?? undefined };\n if (assigned) {\n return { name: assigned.name, phone: assigned.phone || undefined, rating: assigned.rating };\n }\n return null;\n}\n\n/**\n * Header banner text. While the courier is on the way the live ETA from\n * kadaikodiOrderTracking wins over the order's static estimate, so the banner\n * never says \"TBD\" next to a live \"Arriving in\" chip.\n */\nfunction deliveryBannerText(\n order: MockOrder,\n delivered: boolean,\n liveEtaAt: string | null\n): string {\n if (delivered) {\n return order.actualDeliveryTime\n ? `Delivered at ${formatDate(order.actualDeliveryTime)}`\n : 'Delivered';\n }\n if (liveEtaAt) return `Estimated arrival by ${formatDate(liveEtaAt)}`;\n if (order.estimatedDeliveryTime) {\n return `Estimated delivery by ${formatDate(order.estimatedDeliveryTime)}`;\n }\n return 'Estimated delivery time: TBD';\n}\n\n/** One line under the map describing what the live location shows. */\nfunction liveLocationCaption(\n location: CourierLocation | null,\n live: boolean,\n delivered: boolean\n): string {\n if (location) {\n const updated = formatRelativeTime(location.recordedAt);\n return location.stale\n ? `Courier location last updated ${updated}`\n : `Live courier location · updated ${updated}`;\n }\n if (live) return \"Waiting for the delivery partner's location…\";\n if (delivered) return '';\n return 'Live courier location is shared while your order is out for delivery.';\n}\n\nexport function OrderTrackingPage() {\n const { orderId } = useParams<{ orderId: string }>();\n const { navigateTo, currentUser } = useKadaikodi();\n const { data: order, isLoading, isError } = useOrder(orderId, { pollWhileActive: true });\n const { data: tracking } = useOrderTracking(orderId);\n const createReview = useCreateReview();\n const [showRateModal, setShowRateModal] = useState(false);\n const [rating, setRating] = useState(5);\n const [reviewText, setReviewText] = useState('');\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n\n const showStatus = (msg: string) => {\n setStatusMessage(msg);\n setTimeout(() => setStatusMessage(null), 3000);\n };\n\n // Offline-cached order status (BOFF-4301). `cachedOrder` is what OS-level\n // notifications and the offline fallback view below both key off; it\n // outlives an app kill/reload because it's persisted, unlike the\n // in-memory react-query cache `order` comes from.\n const cachedOrder = useKadaikodiStore((s) =>\n orderId ? s.lastKnownOrderStatus[orderId] : undefined\n );\n const setLastKnownOrderStatus = useKadaikodiStore((s) => s.setLastKnownOrderStatus);\n const hasNotifiedRef = useRef<Set<string>>(new Set());\n\n useEffect(() => {\n if (!order || !orderId) return;\n const previousStatus = cachedOrder?.status;\n const changed = previousStatus !== undefined && previousStatus !== order.status;\n // De-dupe within a single mount: React Query's polling can re-fire the\n // same status more than once before the store write is observed.\n const changeKey = `${orderId}:${order.status}`;\n if (changed && !hasNotifiedRef.current.has(changeKey)) {\n hasNotifiedRef.current.add(changeKey);\n const label = statusLabels[order.status] ?? order.status;\n showStatus(`Order status updated: ${label}`);\n void notifyOrderStatusChange({\n orderId,\n title: `${order.cartName} — ${label}`,\n body: statusDescriptions[order.status] ?? `Your order is now ${label.toLowerCase()}.`,\n });\n }\n setLastKnownOrderStatus(orderId, {\n status: order.status,\n orderNumber: order.id,\n cartName: order.cartName,\n total: order.total,\n cachedAt: new Date().toISOString(),\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- only order.status changes should re-run this; cachedOrder/setLastKnownOrderStatus would otherwise loop against the write this effect itself performs.\n }, [order?.status, order?.id, orderId]);\n\n const handleSubmitRating = () => {\n if (!order || !currentUser?.id) {\n showStatus('Please sign in to rate this order.');\n return;\n }\n createReview.mutate(\n {\n providerId: order.cartId,\n orderId: order.id,\n customerId: currentUser.id,\n rating,\n review: reviewText.trim() || undefined,\n },\n {\n onSuccess: () => {\n setShowRateModal(false);\n setReviewText('');\n showStatus('Thanks! Your rating has been submitted.');\n },\n onError: () => showStatus('Could not submit your rating. Please try again.'),\n }\n );\n };\n\n if (isLoading) {\n return (\n <PageLayout title=\"Track Order\">\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-foreground mx-auto mb-4\" />\n <p className=\"text-sm text-text-secondary\">Loading order details...</p>\n </div>\n </PageLayout>\n );\n }\n\n if (!order) {\n // BOFF-4301: the live fetch failed (most likely offline) but a\n // previous session cached this order's last-known status on-device —\n // show that instead of a bare \"not found\", which would be misleading\n // (the order does exist; we just can't reach the network right now).\n if (isError && cachedOrder) {\n return (\n <PageLayout title=\"Track Order\">\n <div className=\"mb-4 flex items-start gap-3 rounded-lg border border-status-warning-text/30 bg-status-warning-bg-subtle p-4\">\n <WifiOff className=\"h-5 w-5 text-status-warning-text mt-0.5 shrink-0\" />\n <div>\n <p className=\"text-sm font-medium text-status-warning-text\">\n You&apos;re offline — showing the last known status\n </p>\n <p className=\"text-xs text-status-warning-text/80 mt-0.5\">\n Cached {formatDate(cachedOrder.cachedAt)}. Reconnect to see live updates.\n </p>\n </div>\n </div>\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <div className=\"flex items-center justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">\n Order #{cachedOrder.orderNumber}\n </h2>\n <p className=\"text-sm text-text-secondary\">{cachedOrder.cartName}</p>\n </div>\n <StatusBadge status={cachedOrder.status as OrderStatus} />\n </div>\n <p className=\"mt-3 text-sm text-text-primary\">\n Last known total: {formatCurrency(cachedOrder.total, { minimumFractionDigits: 0 })}\n </p>\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout title=\"Order Not Found\">\n <EmptyState\n icon={<ShoppingBag className=\"h-12 w-12\" />}\n title=\"Order not found\"\n description={`The order you're looking for doesn't exist.`}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/orders')}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n View All Orders\n </button>\n }\n />\n </PageLayout>\n );\n }\n\n const currentStatusIndex = statusOrder.indexOf(order.status);\n const isCancelled = order.status === 'cancelled';\n const isDelivered = order.status === 'delivered';\n\n // ETA: the service's live, distance-based estimate while the courier is on\n // the way; otherwise only a real estimated time from the backend.\n const liveTracking = tracking?.active ? tracking : null;\n const etaMinutes =\n liveTracking?.etaMinutes ??\n (order.estimatedDeliveryTime\n ? Math.max(\n 0,\n Math.round((new Date(order.estimatedDeliveryTime).getTime() - Date.now()) / 60000)\n )\n : null);\n const courierLocation = liveTracking?.location ?? null;\n const mapOrigin = tracking?.origin ?? null;\n const mapDestination = liveTracking?.destination ?? null;\n const hasMapPoints = Boolean(mapOrigin || mapDestination || courierLocation);\n\n const courier = courierContact(tracking?.courier ?? null, order.assignedWorker);\n const courierPhone = courier?.phone?.replace(/\\s/g, '');\n\n const timelineItems: TimelineItem[] = statusOrder.map((stepStatus, i) => {\n const tone = i < currentStatusIndex ? 'success' : i === currentStatusIndex ? 'accent' : 'muted';\n const isCurrent = i === currentStatusIndex;\n return {\n id: stepStatus,\n title: statusLabels[stepStatus],\n tone,\n meta: (\n <span className={cn(isCurrent ? 'text-text-primary' : undefined)}>\n {statusDescriptions[stepStatus]}\n </span>\n ),\n };\n });\n\n return (\n <PageLayout\n title={\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/orders')}\n className=\"rounded-md p-1 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors\"\n >\n <ArrowLeft className=\"h-5 w-5\" />\n </button>\n <span>Track Order</span>\n </div>\n }\n actions={<StatusBadge status={order.status} />}\n >\n <PagePurpose className=\"mb-6\">\n Follow your order in real time — see exactly where it is from kitchen to doorstep, who's\n delivering it, and reach out for help if anything looks off. The live status updates as your\n order moves through each stage.\n </PagePurpose>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Left: Order Details & Timeline */}\n <div className=\"lg:col-span-2 space-y-6\">\n {/* Order Header — the one emphasis zone (live status) */}\n <GlassCard treatment=\"glass\" glow className=\"p-5\">\n <div className=\"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3\">\n <div className=\"flex-1\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Order #{order.id}</h2>\n <p className=\"text-sm text-text-secondary\">{order.cartName}</p>\n <p className=\"text-xs text-text-secondary mt-0.5\">{formatDate(order.orderDate)}</p>\n </div>\n <div className=\"text-left sm:text-right\">\n <p className=\"text-xl font-bold text-text-primary\">\n {formatCurrency(order.total, { minimumFractionDigits: 0 })}\n </p>\n <p className=\"text-xs text-text-secondary uppercase\">{order.paymentMethod}</p>\n </div>\n </div>\n\n {/* Status Banner */}\n {isCancelled ? (\n <div className=\"mt-4 flex items-start gap-3 rounded-lg bg-status-error-bg/10 p-4 border border-status-error-border/20\">\n <XCircle className=\"h-5 w-5 text-status-error-text mt-0.5 shrink-0\" />\n <div>\n <p className=\"font-medium text-status-error-text\">Order Cancelled</p>\n {order.cancellationReason && (\n <p className=\"text-sm text-status-error-text/80 mt-0.5\">\n {order.cancellationReason}\n </p>\n )}\n </div>\n </div>\n ) : (\n <div\n className={cn(\n 'mt-4 flex items-start gap-3 rounded-lg p-4 border',\n isDelivered\n ? 'bg-status-success-bg-subtle border-status-success-text/20'\n : 'bg-[var(--color-accent-soft)] border-border-focus/20'\n )}\n >\n {isDelivered ? (\n <CheckCircle2 className=\"h-5 w-5 text-status-success-text mt-0.5 shrink-0\" />\n ) : (\n <Clock className=\"h-5 w-5 text-text-primary mt-0.5 shrink-0\" />\n )}\n <p\n className={cn(\n 'text-sm font-medium',\n isDelivered ? 'text-status-success-text' : 'text-text-primary'\n )}\n >\n {deliveryBannerText(order, isDelivered, liveTracking?.etaAt ?? null)}\n </p>\n </div>\n )}\n </GlassCard>\n\n {/* Live tracking: ETA + live map + status timeline */}\n {!isCancelled && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <div className=\"mb-4 flex flex-wrap items-center justify-between gap-2\">\n <h3 className=\"text-base font-semibold text-text-primary\">Order Status</h3>\n {!isDelivered && etaMinutes != null && (\n <span className=\"inline-flex items-center gap-1.5 rounded-full bg-[var(--color-accent-soft)] px-3 py-1 text-sm font-semibold text-accent-primary\">\n <Clock className=\"h-3.5 w-3.5\" />\n {etaMinutes === 0 ? 'Arriving now' : `Arriving in ~${etaMinutes} min`}\n </span>\n )}\n </div>\n {hasMapPoints ? (\n <LiveTrackingMap\n origin={mapOrigin}\n destination={mapDestination}\n courier={courierLocation}\n originLabel={order.cartName}\n destinationLabel=\"Your drop-off point\"\n courierLabel={courier ? `${courier.name} (delivery partner)` : 'Delivery partner'}\n className=\"h-64\"\n />\n ) : (\n <div className=\"flex h-32 items-center justify-center rounded-lg border border-border-subtle bg-bg-sunken px-4 text-center text-sm text-text-secondary\">\n The live map appears once your order is on its way.\n </div>\n )}\n <div className=\"mb-6 mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-text-secondary\">\n <span\n className={cn(\n 'inline-flex items-center gap-1',\n courierLocation?.stale && 'text-status-warning-text'\n )}\n >\n {courierLocation && <Navigation className=\"h-3 w-3\" />}\n {liveLocationCaption(courierLocation, Boolean(liveTracking), isDelivered)}\n </span>\n {liveTracking?.distanceMeters != null && (\n <span>{formatDistance(liveTracking.distanceMeters / 1000)} away</span>\n )}\n </div>\n <Timeline items={timelineItems} />\n </div>\n )}\n\n {/* Order Items & Price Breakdown */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Order Items</h3>\n <div className=\"space-y-2\">\n {order.items.map((item, index) => (\n <div\n key={index}\n className=\"flex justify-between items-start pb-2 border-b border-border-subtle last:border-b-0\"\n >\n <div className=\"flex-1 pr-2\">\n <p className=\"text-sm font-medium text-text-primary\">{item.name}</p>\n {item.customizations && item.customizations.length > 0 && (\n <p className=\"text-xs text-text-secondary\">\n {item.customizations.join(', ')}\n </p>\n )}\n <p className=\"text-xs text-text-secondary\">\n {formatCurrency(item.price, { minimumFractionDigits: 0 })} x {item.quantity}\n </p>\n </div>\n <p className=\"text-sm font-medium text-text-primary\">\n {formatCurrency(item.price * item.quantity, { minimumFractionDigits: 0 })}\n </p>\n </div>\n ))}\n </div>\n\n {/* Price Breakdown */}\n <div className=\"mt-4 pt-4 border-t border-border-subtle space-y-2 text-sm\">\n <div className=\"flex justify-between text-text-secondary\">\n <span>Subtotal</span>\n <span>{formatCurrency(order.subtotal, { minimumFractionDigits: 0 })}</span>\n </div>\n <div className=\"flex justify-between text-text-secondary\">\n <span>Delivery Fee</span>\n <span>\n {order.deliveryFee === 0\n ? 'FREE'\n : formatCurrency(order.deliveryFee, { minimumFractionDigits: 0 })}\n </span>\n </div>\n <div className=\"flex justify-between text-text-secondary\">\n <span>Tax</span>\n <span>{formatCurrency(order.taxes, { minimumFractionDigits: 0 })}</span>\n </div>\n {order.discount && order.discount > 0 && (\n <div className=\"flex justify-between text-status-success-text\">\n <span>Discount</span>\n <span>-{formatCurrency(order.discount, { minimumFractionDigits: 0 })}</span>\n </div>\n )}\n <div className=\"flex justify-between font-semibold pt-2 border-t border-border-subtle text-text-primary\">\n <span>Total</span>\n <span>{formatCurrency(order.total, { minimumFractionDigits: 0 })}</span>\n </div>\n </div>\n </div>\n </div>\n\n {/* Right: Sidebar */}\n <div className=\"lg:col-span-1 space-y-6\">\n {/* Delivery Details */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Delivery Details</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-start gap-2\">\n <MapPin className=\"mt-0.5 h-4 w-4 shrink-0 text-text-secondary\" />\n <div>\n <p className=\"text-xs text-text-secondary\">Delivery Address</p>\n <p className=\"text-sm font-medium text-text-primary\">\n {order.deliveryAddress.street}\n </p>\n <p className=\"text-sm text-text-secondary\">{order.deliveryAddress.area}</p>\n <p className=\"text-sm text-text-secondary\">\n {order.deliveryAddress.city}, {order.deliveryAddress.pincode}\n </p>\n {order.deliveryAddress.landmark && (\n <p className=\"text-xs text-text-secondary mt-0.5\">\n Landmark: {order.deliveryAddress.landmark}\n </p>\n )}\n </div>\n </div>\n\n {/* Customer Notes */}\n {order.customerNotes && (\n <div>\n <p className=\"text-xs text-text-secondary\">Customer Notes</p>\n <p className=\"text-sm text-text-primary\">{order.customerNotes}</p>\n </div>\n )}\n\n {/* Payment */}\n <div>\n <p className=\"text-xs text-text-secondary\">Payment Method</p>\n <p className=\"text-sm font-medium text-text-primary capitalize\">\n {order.paymentMethod}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {order.paymentStatus === 'paid'\n ? 'Paid'\n : order.paymentStatus === 'refunded'\n ? 'Refunded'\n : order.paymentStatus === 'failed'\n ? 'Payment Failed'\n : order.paymentStatus === 'processing'\n ? 'Payment Processing'\n : 'Payment Pending'}\n </p>\n </div>\n </div>\n </div>\n\n {/* Delivery Partner */}\n {courier && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Delivery Partner</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-10 w-10 items-center justify-center rounded-full bg-bg-sunken text-text-secondary\">\n <span className=\"text-sm font-semibold\">{courier.name.charAt(0)}</span>\n </div>\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium text-text-primary\">{courier.name}</p>\n {courier.rating != null ? (\n <div className=\"flex items-center gap-1.5 mt-0.5\">\n <Star className=\"h-3 w-3 fill-status-warning-text text-status-warning-text\" />\n <span className=\"text-xs text-text-secondary\">{courier.rating}/5</span>\n </div>\n ) : courierPhone ? (\n <p className=\"text-xs text-text-secondary mt-0.5\">{courier.phone}</p>\n ) : null}\n </div>\n </div>\n {courierPhone ? (\n <div className=\"grid grid-cols-2 gap-2\">\n <a\n href={`tel:${courierPhone}`}\n className=\"flex items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2.5 text-sm font-semibold text-action-primary-text hover:bg-action-primary-bg-hover transition-colors\"\n >\n <Phone className=\"h-4 w-4\" />\n Call\n </a>\n <a\n href={`sms:${courierPhone}`}\n className=\"flex items-center justify-center gap-2 rounded-lg border border-border-subtle px-3 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <MessageCircle className=\"h-4 w-4\" />\n Message\n </a>\n </div>\n ) : (\n <p className=\"text-xs text-text-secondary\">\n The cart has not shared a contact number for this delivery partner.\n </p>\n )}\n </div>\n </div>\n )}\n\n {/* Need Help */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-5\">\n <h3 className=\"text-base font-semibold text-text-primary mb-3\">Need Help?</h3>\n <div className=\"space-y-2\">\n <a\n href=\"mailto:support@kadaikodi.com\"\n className=\"w-full flex items-center justify-center gap-2 rounded-lg border border-border-subtle px-3 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <MessageCircle className=\"h-4 w-4\" />\n Email Support\n </a>\n <button\n type=\"button\"\n onClick={() => (window.location.href = 'tel:7012270561')}\n className=\"w-full flex items-center justify-center gap-2 rounded-lg border border-border-subtle px-3 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <Phone className=\"h-4 w-4\" />\n Call Support\n </button>\n {isDelivered && !order.rating && (\n <button\n type=\"button\"\n onClick={() => setShowRateModal(true)}\n className=\"w-full flex items-center justify-center gap-2 rounded-lg bg-foreground px-3 py-2.5 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n <Star className=\"h-4 w-4\" />\n Rate Order\n </button>\n )}\n </div>\n </div>\n </div>\n </div>\n\n {/* Status message */}\n {statusMessage && (\n <div className=\"fixed bottom-4 left-1/2 z-50 -translate-x-1/2 rounded-lg border border-status-success-text/30 bg-status-success-bg-subtle px-4 py-3 shadow-lg flex items-center gap-2\">\n <CheckCircle2 className=\"h-4 w-4 text-status-success-text shrink-0\" />\n <p className=\"text-sm text-status-success-text\">{statusMessage}</p>\n </div>\n )}\n\n {/* Rate Order Modal */}\n {showRateModal && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4\">\n <div className=\"w-full max-w-md rounded-lg border border-border-subtle bg-bg-surface shadow-lg\">\n <div className=\"p-5\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Rate your order</h3>\n <button\n type=\"button\"\n onClick={() => setShowRateModal(false)}\n className=\"rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n <div className=\"mb-4\">\n <label className=\"block text-sm font-medium text-text-primary mb-2\">\n Your rating\n </label>\n <div className=\"flex items-center gap-1\">\n {[1, 2, 3, 4, 5].map((star) => (\n <button\n key={star}\n type=\"button\"\n onClick={() => setRating(star)}\n className=\"p-0.5\"\n aria-label={`${star} star${star > 1 ? 's' : ''}`}\n >\n <Star\n className={cn(\n 'h-7 w-7',\n star <= rating\n ? 'fill-status-warning-text text-status-warning-text'\n : 'fill-none text-text-secondary/40'\n )}\n />\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"mb-5\">\n <label className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Review <span className=\"text-text-secondary font-normal\">(optional)</span>\n </label>\n <textarea\n rows={4}\n value={reviewText}\n onChange={(e) => setReviewText(e.target.value)}\n placeholder=\"How was your order?\"\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none\"\n />\n </div>\n\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={handleSubmitRating}\n disabled={createReview.isPending}\n className={cn(\n 'flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-foreground px-4 py-2.5 text-sm font-medium text-background transition-opacity',\n createReview.isPending ? 'opacity-60 cursor-not-allowed' : 'hover:opacity-90'\n )}\n >\n {createReview.isPending && <Loader2 className=\"h-4 w-4 animate-spin\" />}\n Submit Rating\n </button>\n <button\n type=\"button\"\n onClick={() => setShowRateModal(false)}\n className=\"rounded-lg border border-border-subtle px-4 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqDA,IAAMA,IAA6B;CACjC;CACA;CACA;CACA;CACA;CACA;AACF,GAEMC,IAAuC;CAC3C,SAAS;CACT,WAAW;CACX,WAAW;CACX,OAAO;CACP,kBAAkB;CAClB,WAAW;AACb,GAEMC,IAA6C;CACjD,SAAS;CACT,WAAW;CACX,WAAW;CACX,OAAO;CACP,kBAAkB;CAClB,WAAW;AACb;AASA,SAASC,GACP,GACA,GACuB;CAKvB,OAJIC,IAAa;EAAE,MAAMA,EAAK;EAAM,OAAOA,EAAK,SAAS,KAAA;CAAU,IAC/DC,IACK;EAAE,MAAMA,EAAS;EA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,CAAA;EAEG;;AAEhB"}
@@ -22,17 +22,4 @@ export declare function useFavorites(): {
22
22
  toggle: (id: string) => void;
23
23
  isLoading: boolean;
24
24
  };
25
- interface StylizedRouteMapProps {
26
- /** 0–1 progress of the courier along the illustrative route. */
27
- progress?: number;
28
- originLabel?: string;
29
- destinationLabel?: string;
30
- className?: string;
31
- }
32
- /**
33
- * A tokenized, animated-dashed SVG "route" between the cart and the delivery
34
- * address. It is explicitly labelled as illustrative — Kadaikodi has no live-GPS
35
- * feed, so this never pretends to show a real courier position.
36
- */
37
- export declare function StylizedRouteMap({ progress, originLabel, destinationLabel, className, }: StylizedRouteMapProps): import('react').JSX.Element;
38
25
  export {};
@@ -1,45 +1,45 @@
1
1
  import { cn as e } from "../../utils/cn.js";
2
2
  import { useMyFavoriteProviderIds as t, useToggleFavorite as n } from "../../hooks/useKadaikodiApi.js";
3
3
  import { useCallback as r, useState as i } from "react";
4
- import { Home as a, MapPin as o, Navigation as s, Store as c } from "lucide-react";
5
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
4
+ import { Store as a } from "lucide-react";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
6
  // src/kadaikodi/pages/customer/shared.tsx
7
- function d({ src: t, alt: n, seed: r, className: a, icon: o }) {
8
- let [s, d] = i(!1);
9
- if (t && !s) return /* @__PURE__ */ l("img", {
7
+ function c({ src: t, alt: n, seed: r, className: c, icon: l }) {
8
+ let [u, d] = i(!1);
9
+ if (t && !u) return /* @__PURE__ */ o("img", {
10
10
  src: t,
11
11
  alt: n,
12
12
  loading: "lazy",
13
13
  onError: () => d(!0),
14
- className: e("h-full w-full object-cover", a)
14
+ className: e("h-full w-full object-cover", c)
15
15
  });
16
16
  let f = (r ?? n).trim().charAt(0).toUpperCase() || "?";
17
- return /* @__PURE__ */ l("div", {
17
+ return /* @__PURE__ */ o("div", {
18
18
  "aria-label": n,
19
19
  role: "img",
20
- className: e("flex h-full w-full items-center justify-center bg-gradient-to-br from-accent-primary/25 via-accent-primary/10 to-bg-sunken", a),
21
- children: /* @__PURE__ */ u("div", {
20
+ className: e("flex h-full w-full items-center justify-center bg-gradient-to-br from-accent-primary/25 via-accent-primary/10 to-bg-sunken", c),
21
+ children: /* @__PURE__ */ s("div", {
22
22
  className: "flex flex-col items-center gap-1 text-accent-primary/70",
23
- children: [o ?? /* @__PURE__ */ l(c, {
23
+ children: [l ?? /* @__PURE__ */ o(a, {
24
24
  className: "h-6 w-6",
25
25
  "aria-hidden": "true"
26
- }), /* @__PURE__ */ l("span", {
26
+ }), /* @__PURE__ */ o("span", {
27
27
  className: "text-lg font-bold leading-none",
28
28
  children: f
29
29
  })]
30
30
  })
31
31
  });
32
32
  }
33
- function f(e) {
34
- return /* @__PURE__ */ l(d, {
33
+ function l(e) {
34
+ return /* @__PURE__ */ o(c, {
35
35
  ...e,
36
- icon: /* @__PURE__ */ l(c, {
36
+ icon: /* @__PURE__ */ o(a, {
37
37
  className: "h-6 w-6",
38
38
  "aria-hidden": "true"
39
39
  })
40
40
  });
41
41
  }
42
- function p() {
42
+ function u() {
43
43
  let { data: e = [], isLoading: i } = t(), a = n();
44
44
  return {
45
45
  ids: e,
@@ -50,109 +50,6 @@ function p() {
50
50
  isLoading: i
51
51
  };
52
52
  }
53
- function m({ progress: t = .5, originLabel: n = "Cart", destinationLabel: r = "You", className: i }) {
54
- let c = Math.min(1, Math.max(0, t)), d = {
55
- x: 60,
56
- y: 168
57
- }, f = {
58
- x: 340,
59
- y: 56
60
- }, p = {
61
- x: 150,
62
- y: 60
63
- }, m = {
64
- x: 250,
65
- y: 200
66
- }, h = c, g = 1 - h, _ = g * g * g * d.x + 3 * g * g * h * p.x + 3 * g * h * h * m.x + h * h * h * f.x, v = g * g * g * d.y + 3 * g * g * h * p.y + 3 * g * h * h * m.y + h * h * h * f.y;
67
- return /* @__PURE__ */ u("div", {
68
- className: e("relative overflow-hidden rounded-xl border border-border-subtle bg-bg-sunken", i),
69
- children: [
70
- /* @__PURE__ */ u("svg", {
71
- viewBox: "0 0 400 220",
72
- className: "h-full w-full",
73
- role: "img",
74
- "aria-label": "Illustrative delivery route",
75
- children: [
76
- /* @__PURE__ */ u("g", {
77
- stroke: "var(--color-border-subtle)",
78
- strokeWidth: "1",
79
- opacity: "0.6",
80
- children: [/* @__PURE__ */ l("path", { d: "M0 40 H400 M0 90 H400 M0 140 H400 M0 190 H400" }), /* @__PURE__ */ l("path", { d: "M70 0 V220 M150 0 V220 M230 0 V220 M310 0 V220" })]
81
- }),
82
- /* @__PURE__ */ l("path", {
83
- d: `M${d.x} ${d.y} C ${p.x} ${p.y}, ${m.x} ${m.y}, ${f.x} ${f.y}`,
84
- fill: "none",
85
- stroke: "var(--color-accent-primary)",
86
- strokeWidth: "3",
87
- strokeLinecap: "round",
88
- strokeDasharray: "2 8",
89
- opacity: "0.9"
90
- }),
91
- /* @__PURE__ */ l("circle", {
92
- cx: d.x,
93
- cy: d.y,
94
- r: "16",
95
- fill: "var(--color-accent-primary)",
96
- opacity: "0.12"
97
- }),
98
- /* @__PURE__ */ l("circle", {
99
- cx: d.x,
100
- cy: d.y,
101
- r: "6",
102
- fill: "var(--color-accent-primary)"
103
- }),
104
- /* @__PURE__ */ l("circle", {
105
- cx: f.x,
106
- cy: f.y,
107
- r: "9",
108
- fill: "var(--color-status-success-text)"
109
- }),
110
- /* @__PURE__ */ l("circle", {
111
- cx: _,
112
- cy: v,
113
- r: "12",
114
- fill: "var(--color-accent-primary)",
115
- opacity: "0.18",
116
- children: /* @__PURE__ */ l("animate", {
117
- attributeName: "r",
118
- values: "10;16;10",
119
- dur: "2.4s",
120
- repeatCount: "indefinite"
121
- })
122
- }),
123
- /* @__PURE__ */ l("circle", {
124
- cx: _,
125
- cy: v,
126
- r: "6",
127
- fill: "var(--color-accent-primary)",
128
- stroke: "var(--color-bg-surface)",
129
- strokeWidth: "2"
130
- })
131
- ]
132
- }),
133
- /* @__PURE__ */ u("span", {
134
- className: "absolute bottom-2 left-2 inline-flex items-center gap-1 rounded-full bg-bg-surface/80 px-2 py-0.5 text-[10px] font-medium text-text-secondary backdrop-blur-sm",
135
- children: [
136
- /* @__PURE__ */ l(o, { className: "h-3 w-3 text-accent-primary" }),
137
- " ",
138
- n
139
- ]
140
- }),
141
- /* @__PURE__ */ u("span", {
142
- className: "absolute right-2 top-2 inline-flex items-center gap-1 rounded-full bg-bg-surface/80 px-2 py-0.5 text-[10px] font-medium text-text-secondary backdrop-blur-sm",
143
- children: [
144
- /* @__PURE__ */ l(a, { className: "h-3 w-3 text-status-success-text" }),
145
- " ",
146
- r
147
- ]
148
- }),
149
- /* @__PURE__ */ u("span", {
150
- className: "absolute right-2 bottom-2 inline-flex items-center gap-1 rounded-full bg-bg-surface/70 px-2 py-0.5 text-[10px] text-text-muted backdrop-blur-sm",
151
- children: [/* @__PURE__ */ l(s, { className: "h-3 w-3" }), " Illustrative route"]
152
- })
153
- ]
154
- });
155
- }
156
- export { d as ImageWithFallback, f as ProviderImage, m as StylizedRouteMap, p as useFavorites };
53
+ export { c as ImageWithFallback, l as ProviderImage, u as useFavorites };
157
54
 
158
55
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","names":["ImageWithFallback","failed","setFailed","useState","src","cn","className","initial","seed","alt","icon","Store","ProviderImage","props","useFavorites","ids","useMyFavoriteProviderIds","toggleMutation","useToggleFavorite","useCallback","id","StylizedRouteMap","clamped","progress","start","end","c1","c2","t","mt","cx","cy","MapPin","originLabel","Home","destinationLabel","Navigation"],"sources":["../../../../src/kadaikodi/pages/customer/shared.tsx"],"sourcesContent":["/**\n * Shared presentational helpers for the customer pages.\n * @module kadaikodi/pages/customer\n *\n * - `ProviderImage` / `OfferingImage`: render a real media image when the\n * backend supplies one, otherwise a tokenized, themeable placeholder (never a\n * broken <img> and never a fabricated stock photo).\n * - `useFavorites`: a real, user-owned favorites store persisted server-side\n * (self-scoped `kadaikodiMyFavoriteProviderIds` / `kadaikodiToggleFavorite`)\n * and shared reactively across the customer pages via the React Query cache\n * (Discover adds, Favorites reads). This is genuine user data — nothing is\n * fabricated.\n * - `StylizedRouteMap`: an honest, clearly-labelled illustrative route panel for\n * order tracking (there is no live-GPS backend, so we never fake live coords).\n */\n\nimport { useCallback, useState, type ReactNode } from 'react';\nimport { Store, MapPin, Navigation, Home } from 'lucide-react';\nimport { cn } from '../../utils/cn';\nimport { useMyFavoriteProviderIds, useToggleFavorite } from '../../hooks/useKadaikodiApi';\n\n// ============================================================================\n// Media with graceful, tokenized fallback\n// ============================================================================\n\ninterface ImageWithFallbackProps {\n src?: string | null;\n alt: string;\n /** Seed text for the placeholder initial (usually the name). */\n seed?: string;\n className?: string;\n /** Icon shown in the placeholder (defaults to a storefront). */\n icon?: ReactNode;\n}\n\n/**\n * Renders `src` when present and loadable; otherwise a tokenized accent-gradient\n * placeholder with the seed's initial. Fills its positioned parent.\n */\nexport function ImageWithFallback({ src, alt, seed, className, icon }: ImageWithFallbackProps) {\n const [failed, setFailed] = useState(false);\n const showImage = Boolean(src) && !failed;\n\n if (showImage) {\n return (\n <img\n src={src as string}\n alt={alt}\n loading=\"lazy\"\n onError={() => setFailed(true)}\n className={cn('h-full w-full object-cover', className)}\n />\n );\n }\n\n const initial = (seed ?? alt).trim().charAt(0).toUpperCase() || '?';\n return (\n <div\n aria-label={alt}\n role=\"img\"\n className={cn(\n 'flex h-full w-full items-center justify-center bg-gradient-to-br from-accent-primary/25 via-accent-primary/10 to-bg-sunken',\n className\n )}\n >\n <div className=\"flex flex-col items-center gap-1 text-accent-primary/70\">\n {icon ?? <Store className=\"h-6 w-6\" aria-hidden=\"true\" />}\n <span className=\"text-lg font-bold leading-none\">{initial}</span>\n </div>\n </div>\n );\n}\n\n/** Convenience wrapper for provider/cart imagery. */\nexport function ProviderImage(props: Omit<ImageWithFallbackProps, 'icon'>) {\n return <ImageWithFallback {...props} icon={<Store className=\"h-6 w-6\" aria-hidden=\"true\" />} />;\n}\n\n// ============================================================================\n// Favorites — server-persisted (self-scoped), reactive across pages via\n// the shared React Query cache key ['kadaikodi', 'my-favorite-provider-ids']\n// ============================================================================\n\n/** Reactive access to the customer's saved-provider ids. */\nexport function useFavorites(): {\n ids: string[];\n has: (id: string) => boolean;\n toggle: (id: string) => void;\n isLoading: boolean;\n} {\n const { data: ids = [], isLoading } = useMyFavoriteProviderIds();\n const toggleMutation = useToggleFavorite();\n const has = useCallback((id: string) => ids.includes(id), [ids]);\n const toggle = useCallback(\n (id: string) => {\n toggleMutation.mutate(id);\n },\n [toggleMutation]\n );\n return { ids, has, toggle, isLoading };\n}\n\n// ============================================================================\n// Stylised route map (honest illustration — no live GPS backend)\n// ============================================================================\n\ninterface StylizedRouteMapProps {\n /** 0–1 progress of the courier along the illustrative route. */\n progress?: number;\n originLabel?: string;\n destinationLabel?: string;\n className?: string;\n}\n\n/**\n * A tokenized, animated-dashed SVG \"route\" between the cart and the delivery\n * address. It is explicitly labelled as illustrative — Kadaikodi has no live-GPS\n * feed, so this never pretends to show a real courier position.\n */\nexport function StylizedRouteMap({\n progress = 0.5,\n originLabel = 'Cart',\n destinationLabel = 'You',\n className,\n}: StylizedRouteMapProps) {\n const clamped = Math.min(1, Math.max(0, progress));\n // Path points in the 0..400 x 0..220 viewBox.\n const start = { x: 60, y: 168 };\n const end = { x: 340, y: 56 };\n const c1 = { x: 150, y: 60 };\n const c2 = { x: 250, y: 200 };\n const t = clamped;\n const mt = 1 - t;\n // Cubic bezier point at t for the courier marker.\n const cx =\n mt * mt * mt * start.x + 3 * mt * mt * t * c1.x + 3 * mt * t * t * c2.x + t * t * t * end.x;\n const cy =\n mt * mt * mt * start.y + 3 * mt * mt * t * c1.y + 3 * mt * t * t * c2.y + t * t * t * end.y;\n\n return (\n <div\n className={cn(\n 'relative overflow-hidden rounded-xl border border-border-subtle bg-bg-sunken',\n className\n )}\n >\n <svg\n viewBox=\"0 0 400 220\"\n className=\"h-full w-full\"\n role=\"img\"\n aria-label=\"Illustrative delivery route\"\n >\n {/* Faint \"streets\" grid */}\n <g stroke=\"var(--color-border-subtle)\" strokeWidth=\"1\" opacity=\"0.6\">\n <path d=\"M0 40 H400 M0 90 H400 M0 140 H400 M0 190 H400\" />\n <path d=\"M70 0 V220 M150 0 V220 M230 0 V220 M310 0 V220\" />\n </g>\n {/* Route */}\n <path\n d={`M${start.x} ${start.y} C ${c1.x} ${c1.y}, ${c2.x} ${c2.y}, ${end.x} ${end.y}`}\n fill=\"none\"\n stroke=\"var(--color-accent-primary)\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeDasharray=\"2 8\"\n opacity=\"0.9\"\n />\n {/* Origin (cart) */}\n <circle\n cx={start.x}\n cy={start.y}\n r=\"16\"\n fill=\"var(--color-accent-primary)\"\n opacity=\"0.12\"\n />\n <circle cx={start.x} cy={start.y} r=\"6\" fill=\"var(--color-accent-primary)\" />\n {/* Destination (home) */}\n <circle cx={end.x} cy={end.y} r=\"9\" fill=\"var(--color-status-success-text)\" />\n {/* Courier marker */}\n <circle cx={cx} cy={cy} r=\"12\" fill=\"var(--color-accent-primary)\" opacity=\"0.18\">\n <animate attributeName=\"r\" values=\"10;16;10\" dur=\"2.4s\" repeatCount=\"indefinite\" />\n </circle>\n <circle\n cx={cx}\n cy={cy}\n r=\"6\"\n fill=\"var(--color-accent-primary)\"\n stroke=\"var(--color-bg-surface)\"\n strokeWidth=\"2\"\n />\n </svg>\n\n {/* Corner labels */}\n <span className=\"absolute bottom-2 left-2 inline-flex items-center gap-1 rounded-full bg-bg-surface/80 px-2 py-0.5 text-[10px] font-medium text-text-secondary backdrop-blur-sm\">\n <MapPin className=\"h-3 w-3 text-accent-primary\" /> {originLabel}\n </span>\n <span className=\"absolute right-2 top-2 inline-flex items-center gap-1 rounded-full bg-bg-surface/80 px-2 py-0.5 text-[10px] font-medium text-text-secondary backdrop-blur-sm\">\n <Home className=\"h-3 w-3 text-status-success-text\" /> {destinationLabel}\n </span>\n <span className=\"absolute right-2 bottom-2 inline-flex items-center gap-1 rounded-full bg-bg-surface/70 px-2 py-0.5 text-[10px] text-text-muted backdrop-blur-sm\">\n <Navigation className=\"h-3 w-3\" /> Illustrative route\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;AAuCA,SAAgBA,EAAkB,EAAE,QAAK,QAAK,SAAM,cAAW,WAAgC;CAC7F,IAAM,CAACC,GAAQC,KAAaC,EAAS,EAAK;CAG1C,IAF0BC,KAAQ,CAACH,GAGjC,OACE,kBAAC,OAAD;EACO;EACA;EACL,SAAQ;EACR,eAAeC,EAAU,EAAI;EAC7B,WAAWG,EAAG,8BAA8BC,CAAS;CACtD,CAAA;CAIL,IAAMC,KAAWC,KAAQC,EAAA,CAAK,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,KAAK;CAChE,OACE,kBAAC,OAAD;EACE,cAAYA;EACZ,MAAK;EACL,WAAWJ,EACT,8HACAC,CACF;EAEA,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACGI,KAAQ,kBAACC,GAAD;IAAO,WAAU;IAAU,eAAY;GAAQ,CAAA,GACxD,kBAAC,QAAD;IAAM,WAAU;IAAkC,UAAAJ;GAAc,CAAA,CAC7D;;CACF,CAAA;AAET;AAGA,SAAgBK,EAAc,GAA6C;CACzE,OAAO,kBAACZ,GAAD;EAAmB,GAAIa;EAAO,MAAM,kBAACF,GAAD;GAAO,WAAU;GAAU,eAAY;EAAQ,CAAA;CAAI,CAAA;AAChG;AAQA,SAAgBG,IAKd;CACA,IAAM,EAAE,MAAMC,IAAM,CAAC,GAAG,iBAAcC,EAAyB,GACzDC,IAAiBC,EAAkB;CAQzC,OAAO;EAAE;EAAK,KAPFC,GAAa,MAAeJ,EAAI,SAASK,CAAE,GAAG,CAACL,CAAG,CAOhD;EAAK,QANJI,GACZ,MAAe;GACd,EAAe,OAAOC,CAAE;EAC1B,GACA,CAACH,CAAc,CAEE;EAAQ;CAAU;AACvC;AAmBA,SAAgBI,EAAiB,EAC/B,cAAW,IACX,iBAAc,QACd,s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AAM;MACV,GAAE;MACF,MAAK;MACL,SAAQ;KACT,CAAA;KACD,kBAAC,UAAD;MAAQ,IAAIA,EAAM;MAAG,IAAIA,EAAM;MAAG,GAAE;MAAI,MAAK;KAA+B,CAAA;KAE5E,kBAAC,UAAD;MAAQ,IAAIC,EAAI;MAAG,IAAIA,EAAI;MAAG,GAAE;MAAI,MAAK;KAAoC,CAAA;KAE7E,kBAAC,UAAD;MAAY;MAAQ;MAAI,GAAE;MAAK,MAAK;MAA8B,SAAQ;MACxE,UAAA,kBAAC,WAAD;OAAS,eAAc;OAAI,QAAO;OAAW,KAAI;OAAO,aAAY;MAAc,CAAA;KAC5E,CAAA;KACR,kBAAC,UAAD;MACM;MACA;MACJ,GAAE;MACF,MAAK;MACL,QAAO;MACP,aAAY;KACb,CAAA;IACE;;GAGL,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA;KACE,kBAACO,GAAD,EAAQ,WAAU,8BAA+B,CAAA;KAAC;KAAEC;IAChD;;GACN,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA;KACE,kBAACC,GAAD,EAAM,WAAU,mCAAoC,CAAA;KAAC;KAAEC;IACnD;;GACN,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,kBAACC,GAAD,EAAY,WAAU,UAAW,CAAA,GAAC,qBAC9B;;EACH;;AAET"}
1
+ {"version":3,"file":"shared.js","names":["ImageWithFallback","failed","setFailed","useState","src","cn","className","initial","seed","alt","icon","Store","ProviderImage","props","useFavorites","ids","useMyFavoriteProviderIds","toggleMutation","useToggleFavorite","useCallback","id"],"sources":["../../../../src/kadaikodi/pages/customer/shared.tsx"],"sourcesContent":["/**\n * Shared presentational helpers for the customer pages.\n * @module kadaikodi/pages/customer\n *\n * - `ProviderImage` / `OfferingImage`: render a real media image when the\n * backend supplies one, otherwise a tokenized, themeable placeholder (never a\n * broken <img> and never a fabricated stock photo).\n * - `useFavorites`: a real, user-owned favorites store persisted server-side\n * (self-scoped `kadaikodiMyFavoriteProviderIds` / `kadaikodiToggleFavorite`)\n * and shared reactively across the customer pages via the React Query cache\n * (Discover adds, Favorites reads). This is genuine user data — nothing is\n * fabricated.\n */\n\nimport { useCallback, useState, type ReactNode } from 'react';\nimport { Store } from 'lucide-react';\nimport { cn } from '../../utils/cn';\nimport { useMyFavoriteProviderIds, useToggleFavorite } from '../../hooks/useKadaikodiApi';\n\n// ============================================================================\n// Media with graceful, tokenized fallback\n// ============================================================================\n\ninterface ImageWithFallbackProps {\n src?: string | null;\n alt: string;\n /** Seed text for the placeholder initial (usually the name). */\n seed?: string;\n className?: string;\n /** Icon shown in the placeholder (defaults to a storefront). */\n icon?: ReactNode;\n}\n\n/**\n * Renders `src` when present and loadable; otherwise a tokenized accent-gradient\n * placeholder with the seed's initial. Fills its positioned parent.\n */\nexport function ImageWithFallback({ src, alt, seed, className, icon }: ImageWithFallbackProps) {\n const [failed, setFailed] = useState(false);\n const showImage = Boolean(src) && !failed;\n\n if (showImage) {\n return (\n <img\n src={src as string}\n alt={alt}\n loading=\"lazy\"\n onError={() => setFailed(true)}\n className={cn('h-full w-full object-cover', className)}\n />\n );\n }\n\n const initial = (seed ?? alt).trim().charAt(0).toUpperCase() || '?';\n return (\n <div\n aria-label={alt}\n role=\"img\"\n className={cn(\n 'flex h-full w-full items-center justify-center bg-gradient-to-br from-accent-primary/25 via-accent-primary/10 to-bg-sunken',\n className\n )}\n >\n <div className=\"flex flex-col items-center gap-1 text-accent-primary/70\">\n {icon ?? <Store className=\"h-6 w-6\" aria-hidden=\"true\" />}\n <span className=\"text-lg font-bold leading-none\">{initial}</span>\n </div>\n </div>\n );\n}\n\n/** Convenience wrapper for provider/cart imagery. */\nexport function ProviderImage(props: Omit<ImageWithFallbackProps, 'icon'>) {\n return <ImageWithFallback {...props} icon={<Store className=\"h-6 w-6\" aria-hidden=\"true\" />} />;\n}\n\n// ============================================================================\n// Favorites — server-persisted (self-scoped), reactive across pages via\n// the shared React Query cache key ['kadaikodi', 'my-favorite-provider-ids']\n// ============================================================================\n\n/** Reactive access to the customer's saved-provider ids. */\nexport function useFavorites(): {\n ids: string[];\n has: (id: string) => boolean;\n toggle: (id: string) => void;\n isLoading: boolean;\n} {\n const { data: ids = [], isLoading } = useMyFavoriteProviderIds();\n const toggleMutation = useToggleFavorite();\n const has = useCallback((id: string) => ids.includes(id), [ids]);\n const toggle = useCallback(\n (id: string) => {\n toggleMutation.mutate(id);\n },\n [toggleMutation]\n );\n return { ids, has, toggle, isLoading };\n}\n"],"mappings":";;;;;;AAqCA,SAAgBA,EAAkB,EAAE,QAAK,QAAK,SAAM,cAAW,WAAgC;CAC7F,IAAM,CAACC,GAAQC,KAAaC,EAAS,EAAK;CAG1C,IAF0BC,KAAQ,CAACH,GAGjC,OACE,kBAAC,OAAD;EACO;EACA;EACL,SAAQ;EACR,eAAeC,EAAU,EAAI;EAC7B,WAAWG,EAAG,8BAA8BC,CAAS;CACtD,CAAA;CAIL,IAAMC,KAAWC,KAAQC,EAAA,CAAK,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,KAAK;CAChE,OACE,kBAAC,OAAD;EACE,cAAYA;EACZ,MAAK;EACL,WAAWJ,EACT,8HACAC,CACF;EAEA,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACGI,KAAQ,kBAACC,GAAD;IAAO,WAAU;IAAU,eAAY;GAAQ,CAAA,GACxD,kBAAC,QAAD;IAAM,WAAU;IAAkC,UAAAJ;GAAc,CAAA,CAC7D;;CACF,CAAA;AAET;AAGA,SAAgBK,EAAc,GAA6C;CACzE,OAAO,kBAACZ,GAAD;EAAmB,GAAIa;EAAO,MAAM,kBAACF,GAAD;GAAO,WAAU;GAAU,eAAY;EAAQ,CAAA;CAAI,CAAA;AAChG;AAQA,SAAgBG,IAKd;CACA,IAAM,EAAE,MAAMC,IAAM,CAAC,GAAG,iBAAcC,EAAyB,GACzDC,IAAiBC,EAAkB;CAQzC,OAAO;EAAE;EAAK,KAPFC,GAAa,MAAeJ,EAAI,SAASK,CAAE,GAAG,CAACL,CAAG,CAOhD;EAAK,QANJI,GACZ,MAAe;GACd,EAAe,OAAOC,CAAE;EAC1B,GACA,CAACH,CAAc,CAEE;EAAQ;CAAU;AACvC"}
@@ -11,8 +11,9 @@
11
11
  * useUpdateWorkerTaskStatus; the delivery note uses useUpdateWorkerTask. The
12
12
  * order summary (line items, total, payment state, order number) comes from
13
13
  * `KadaikodiWorkerTask.order`, whose resolver admits the assigned worker.
14
- * Nothing is fabricated — there is still no geo data behind the route panel, so
15
- * it stays a labelled schematic.
14
+ * Nothing is fabricated — the route panel stays a labelled schematic; the
15
+ * courier's real position is shared with the customer through the live
16
+ * location card (BOFF-3962) once the order is out for delivery.
16
17
  *
17
18
  * @module kadaikodi/pages/worker
18
19
  */