@burdenoff/microfe-kadaikodi 2026.1126.1 → 2026.1127.1
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/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/kadaikodi/components/CourierLocationSharingCard.d.ts +10 -0
- package/dist/kadaikodi/components/CourierLocationSharingCard.js +52 -0
- package/dist/kadaikodi/components/CourierLocationSharingCard.js.map +1 -0
- package/dist/kadaikodi/components/DropoffPinField.d.ts +16 -0
- package/dist/kadaikodi/components/DropoffPinField.js +67 -0
- package/dist/kadaikodi/components/DropoffPinField.js.map +1 -0
- package/dist/kadaikodi/components/LiveTrackingMap.d.ts +27 -0
- package/dist/kadaikodi/components/LiveTrackingMap.js +74 -0
- package/dist/kadaikodi/components/LiveTrackingMap.js.map +1 -0
- package/dist/kadaikodi/hooks/useAppointmentsApi.js +42 -40
- package/dist/kadaikodi/hooks/useAppointmentsApi.js.map +1 -1
- package/dist/kadaikodi/hooks/useCourierLocationSharing.d.ts +24 -0
- package/dist/kadaikodi/hooks/useCourierLocationSharing.js +54 -0
- package/dist/kadaikodi/hooks/useCourierLocationSharing.js.map +1 -0
- package/dist/kadaikodi/hooks/useTrackingApi.d.ts +63 -0
- package/dist/kadaikodi/hooks/useTrackingApi.js +37 -0
- package/dist/kadaikodi/hooks/useTrackingApi.js.map +1 -0
- package/dist/kadaikodi/pages/customer/CheckoutPage.js +222 -213
- package/dist/kadaikodi/pages/customer/CheckoutPage.js.map +1 -1
- package/dist/kadaikodi/pages/customer/OrderTrackingPage.d.ts +4 -0
- package/dist/kadaikodi/pages/customer/OrderTrackingPage.js +274 -252
- package/dist/kadaikodi/pages/customer/OrderTrackingPage.js.map +1 -1
- package/dist/kadaikodi/pages/customer/shared.d.ts +0 -13
- package/dist/kadaikodi/pages/customer/shared.js +16 -119
- package/dist/kadaikodi/pages/customer/shared.js.map +1 -1
- package/dist/kadaikodi/pages/worker/TaskDetailsPage.d.ts +3 -2
- package/dist/kadaikodi/pages/worker/TaskDetailsPage.js +67 -65
- package/dist/kadaikodi/pages/worker/TaskDetailsPage.js.map +1 -1
- package/dist/kadaikodi/utils/deviceGeolocation.d.ts +46 -0
- package/dist/kadaikodi/utils/deviceGeolocation.js +71 -0
- package/dist/kadaikodi/utils/deviceGeolocation.js.map +1 -0
- package/dist/kadaikodi/utils/leaflet.d.ts +8 -0
- package/dist/kadaikodi/utils/leaflet.js +11 -0
- package/dist/kadaikodi/utils/leaflet.js.map +1 -0
- package/dist/node_modules/leaflet/dist/leaflet-src.js +4535 -0
- package/dist/node_modules/leaflet/dist/leaflet-src.js.map +1 -0
- package/package.json +4 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), s = (e, i, o, s) => {
|
|
3
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
4
|
+
get: ((e) => i[e]).bind(null, d),
|
|
5
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
6
|
+
});
|
|
7
|
+
return e;
|
|
8
|
+
}, c = (n, r, o) => (o = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
9
|
+
value: n,
|
|
10
|
+
enumerable: !0
|
|
11
|
+
}) : o, n));
|
|
12
|
+
export { o as __commonJSMin, c as __toESM };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Courier control for live location sharing on a delivery task (BOFF-3962).
|
|
3
|
+
*
|
|
4
|
+
* Explicit opt-in: the worker starts sharing once the order is out for
|
|
5
|
+
* delivery, and sharing stops when they leave the page, switch it off, or the
|
|
6
|
+
* service stops accepting fixes (order delivered or no longer assigned).
|
|
7
|
+
*/
|
|
8
|
+
export declare function CourierLocationSharingCard({ orderId }: {
|
|
9
|
+
orderId: string;
|
|
10
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useCourierLocationSharing as e } from "../hooks/useCourierLocationSharing.js";
|
|
2
|
+
import { formatRelativeTime as t } from "../utils/formatters.js";
|
|
3
|
+
import { AlertTriangle as n, Loader2 as r, LocateFixed as i, LocateOff as a } from "lucide-react";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
import { GlassCard as c } from "@burdenoff/fe-libs/ui";
|
|
6
|
+
// src/kadaikodi/components/CourierLocationSharingCard.tsx
|
|
7
|
+
function l({ orderId: l }) {
|
|
8
|
+
let { state: u, error: d, lastSentAt: f, start: p, stop: m } = e(l), h = u === "sharing" || u === "starting";
|
|
9
|
+
return /* @__PURE__ */ s(c, {
|
|
10
|
+
className: "p-5",
|
|
11
|
+
"aria-live": "polite",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ s("div", {
|
|
14
|
+
className: "flex flex-wrap items-start justify-between gap-3",
|
|
15
|
+
children: [/* @__PURE__ */ s("div", {
|
|
16
|
+
className: "min-w-0",
|
|
17
|
+
children: [/* @__PURE__ */ o("p", {
|
|
18
|
+
className: "text-sm font-semibold text-text-primary",
|
|
19
|
+
children: "Live location"
|
|
20
|
+
}), /* @__PURE__ */ o("p", {
|
|
21
|
+
className: "mt-0.5 text-xs text-text-secondary",
|
|
22
|
+
children: "Share your position with the customer while this order is out for delivery. It is only sent while this screen is open."
|
|
23
|
+
})]
|
|
24
|
+
}), /* @__PURE__ */ s("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
onClick: h ? m : p,
|
|
27
|
+
className: h ? "inline-flex items-center gap-1.5 rounded-md border border-border-default bg-bg-surface px-3 py-2 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors" : "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-xs font-semibold text-action-primary-text hover:bg-action-primary-bg-hover transition-colors",
|
|
28
|
+
children: [o(h ? a : i, { className: "h-3.5 w-3.5" }), h ? "Stop sharing" : "Share live location"]
|
|
29
|
+
})]
|
|
30
|
+
}),
|
|
31
|
+
u === "starting" && /* @__PURE__ */ s("p", {
|
|
32
|
+
className: "mt-3 inline-flex items-center gap-1.5 text-xs text-text-secondary",
|
|
33
|
+
children: [/* @__PURE__ */ o(r, { className: "h-3.5 w-3.5 animate-spin" }), "Getting your location…"]
|
|
34
|
+
}),
|
|
35
|
+
u === "sharing" && f && /* @__PURE__ */ s("p", {
|
|
36
|
+
className: "mt-3 inline-flex items-center gap-1.5 text-xs text-status-success-text",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ o(i, { className: "h-3.5 w-3.5" }),
|
|
39
|
+
"Sharing · last sent ",
|
|
40
|
+
t(f)
|
|
41
|
+
]
|
|
42
|
+
}),
|
|
43
|
+
u === "error" && d && /* @__PURE__ */ s("p", {
|
|
44
|
+
className: "mt-3 flex items-start gap-1.5 text-xs text-status-error-text",
|
|
45
|
+
children: [/* @__PURE__ */ o(n, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }), d]
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export { l as CourierLocationSharingCard };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=CourierLocationSharingCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CourierLocationSharingCard.js","names":["CourierLocationSharingCard","useCourierLocationSharing","orderId","active","state","GlassCard","stop","start","jsx","LocateOff","LocateFixed","Loader2","lastSentAt","formatRelativeTime","error","AlertTriangle"],"sources":["../../../src/kadaikodi/components/CourierLocationSharingCard.tsx"],"sourcesContent":["/**\n * Courier control for live location sharing on a delivery task (BOFF-3962).\n *\n * Explicit opt-in: the worker starts sharing once the order is out for\n * delivery, and sharing stops when they leave the page, switch it off, or the\n * service stops accepting fixes (order delivered or no longer assigned).\n */\n\nimport { Loader2, LocateFixed, LocateOff, AlertTriangle } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\n\nimport { useCourierLocationSharing } from '../hooks/useCourierLocationSharing';\nimport { formatRelativeTime } from '../utils/formatters';\n\nexport function CourierLocationSharingCard({ orderId }: { orderId: string }) {\n const { state, error, lastSentAt, start, stop } = useCourierLocationSharing(orderId);\n const active = state === 'sharing' || state === 'starting';\n\n return (\n <GlassCard className=\"p-5\" aria-live=\"polite\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold text-text-primary\">Live location</p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n Share your position with the customer while this order is out for delivery. It is only\n sent while this screen is open.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={active ? stop : start}\n className={\n active\n ? 'inline-flex items-center gap-1.5 rounded-md border border-border-default bg-bg-surface px-3 py-2 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors'\n : 'inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-xs font-semibold text-action-primary-text hover:bg-action-primary-bg-hover transition-colors'\n }\n >\n {active ? <LocateOff className=\"h-3.5 w-3.5\" /> : <LocateFixed className=\"h-3.5 w-3.5\" />}\n {active ? 'Stop sharing' : 'Share live location'}\n </button>\n </div>\n\n {state === 'starting' && (\n <p className=\"mt-3 inline-flex items-center gap-1.5 text-xs text-text-secondary\">\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />\n Getting your location…\n </p>\n )}\n {state === 'sharing' && lastSentAt && (\n <p className=\"mt-3 inline-flex items-center gap-1.5 text-xs text-status-success-text\">\n <LocateFixed className=\"h-3.5 w-3.5\" />\n Sharing · last sent {formatRelativeTime(lastSentAt)}\n </p>\n )}\n {state === 'error' && error && (\n <p className=\"mt-3 flex items-start gap-1.5 text-xs text-status-error-text\">\n <AlertTriangle className=\"mt-0.5 h-3.5 w-3.5 shrink-0\" />\n {error}\n </p>\n )}\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;AAcA,SAAgBA,EAA2B,EAAE,cAAgC;CAC3E,IAAM,EAAE,UAAO,UAAO,eAAY,UAAO,YAASC,EAA0BC,CAAO,GAC7EC,IAASC,MAAU,aAAaA,MAAU;CAEhD,OACE,kBAACC,GAAD;EAAW,WAAU;EAAM,aAAU;EAArC,UAAA;GACE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,KAAD;MAAG,WAAU;MAA0C,UAAA;KAAgB,CAAA,GACvE,kBAAC,KAAD;MAAG,WAAU;MAAqC,UAAA;KAG/C,CAAA,CACA;IACL,CAAA,GAAA,kBAAC,UAAD;KACE,MAAK;KACL,SAASF,IAASG,IAAOC;KACzB,WACEJ,IACI,gLACA;KANR,UAAA,CASYK,EAATL,IAAUM,IAAwCC,GAAzC,EAAW,WAAU,cAAe,CAA0C,GACvFP,IAAS,iBAAiB,qBACrB;IACL,CAAA,CAAA;;GAEJC,MAAU,cACT,kBAAC,KAAD;IAAG,WAAU;IAAb,UAAA,CACE,kBAACO,GAAD,EAAS,WAAU,2BAA4B,CAAA,GAAC,wBAE/C;;GAEJP,MAAU,aAAaQ,KACtB,kBAAC,KAAD;IAAG,WAAU;IAAb,UAAA;KACE,kBAACF,GAAD,EAAa,WAAU,cAAe,CAAA;KAAC;KAClBG,EAAmBD,CAAU;IACjD;;GAEJR,MAAU,WAAWU,KACpB,kBAAC,KAAD;IAAG,WAAU;IAAb,UAAA,CACE,kBAACC,GAAD,EAAe,WAAU,8BAA+B,CAAA,GACvDD,CACA;;EAEI;;AAEf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional drop-off pin for a delivery order (BOFF-3962).
|
|
3
|
+
*
|
|
4
|
+
* The customer can pin their current position at checkout; the service uses
|
|
5
|
+
* it only for the live tracking map and the distance-based ETA, and purges it
|
|
6
|
+
* with the rest of the tracking data after delivery.
|
|
7
|
+
*/
|
|
8
|
+
export interface DropoffPin {
|
|
9
|
+
latitude: number;
|
|
10
|
+
longitude: number;
|
|
11
|
+
accuracyMeters: number | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function DropoffPinField({ value, onChange, }: {
|
|
14
|
+
value: DropoffPin | null;
|
|
15
|
+
onChange: (pin: DropoffPin | null) => void;
|
|
16
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { classifyGeolocationError as e, geolocationFailureMessage as t, getDevicePosition as n } from "../utils/deviceGeolocation.js";
|
|
2
|
+
import { useState as r } from "react";
|
|
3
|
+
import { Crosshair as i, Loader2 as a, X as o } from "lucide-react";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
// src/kadaikodi/components/DropoffPinField.tsx
|
|
6
|
+
function l({ value: l, onChange: u }) {
|
|
7
|
+
let [d, f] = r(!1), [p, m] = r(null), h = async () => {
|
|
8
|
+
f(!0), m(null);
|
|
9
|
+
try {
|
|
10
|
+
let e = await n();
|
|
11
|
+
u({
|
|
12
|
+
latitude: e.latitude,
|
|
13
|
+
longitude: e.longitude,
|
|
14
|
+
accuracyMeters: e.accuracyMeters
|
|
15
|
+
});
|
|
16
|
+
} catch (n) {
|
|
17
|
+
m(t(e(n)));
|
|
18
|
+
} finally {
|
|
19
|
+
f(!1);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ c("div", {
|
|
23
|
+
className: "rounded-lg border border-border-subtle bg-bg-sunken p-3",
|
|
24
|
+
children: [l ? /* @__PURE__ */ c("div", {
|
|
25
|
+
className: "flex items-center justify-between gap-3",
|
|
26
|
+
children: [/* @__PURE__ */ c("p", {
|
|
27
|
+
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ s(i, { className: "h-4 w-4 text-status-success-text" }),
|
|
30
|
+
"Drop-off pinned to your current location",
|
|
31
|
+
l.accuracyMeters != null && /* @__PURE__ */ c("span", {
|
|
32
|
+
className: "text-xs text-text-secondary",
|
|
33
|
+
children: [
|
|
34
|
+
"(±",
|
|
35
|
+
Math.round(l.accuracyMeters),
|
|
36
|
+
" m)"
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
}), /* @__PURE__ */ s("button", {
|
|
41
|
+
type: "button",
|
|
42
|
+
onClick: () => u(null),
|
|
43
|
+
"aria-label": "Remove drop-off pin",
|
|
44
|
+
className: "rounded-md p-1.5 text-text-secondary hover:bg-bg-surface hover:text-text-primary transition-colors",
|
|
45
|
+
children: /* @__PURE__ */ s(o, { className: "h-4 w-4" })
|
|
46
|
+
})]
|
|
47
|
+
}) : /* @__PURE__ */ c("div", {
|
|
48
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
49
|
+
children: [/* @__PURE__ */ s("p", {
|
|
50
|
+
className: "text-xs text-text-secondary",
|
|
51
|
+
children: "Optional: pin where you are now so you get a live arrival time while the order is on its way."
|
|
52
|
+
}), /* @__PURE__ */ c("button", {
|
|
53
|
+
type: "button",
|
|
54
|
+
onClick: () => void h(),
|
|
55
|
+
disabled: d,
|
|
56
|
+
className: "inline-flex items-center gap-1.5 rounded-md border border-border-default bg-bg-surface px-3 py-2 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors disabled:cursor-not-allowed disabled:opacity-60",
|
|
57
|
+
children: [d ? /* @__PURE__ */ s(a, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(i, { className: "h-3.5 w-3.5" }), "Pin my current location"]
|
|
58
|
+
})]
|
|
59
|
+
}), p && /* @__PURE__ */ s("p", {
|
|
60
|
+
className: "mt-2 text-xs text-status-error-text",
|
|
61
|
+
children: p
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export { l as DropoffPinField };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=DropoffPinField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropoffPinField.js","names":["DropoffPinField","locating","setLocating","useState","error","setError","pinCurrentLocation","fix","getDevicePosition","e","geolocationFailureMessage","classifyGeolocationError","value","Crosshair","onChange","X","Loader2"],"sources":["../../../src/kadaikodi/components/DropoffPinField.tsx"],"sourcesContent":["/**\n * Optional drop-off pin for a delivery order (BOFF-3962).\n *\n * The customer can pin their current position at checkout; the service uses\n * it only for the live tracking map and the distance-based ETA, and purges it\n * with the rest of the tracking data after delivery.\n */\n\nimport { useState } from 'react';\nimport { Crosshair, Loader2, X } from 'lucide-react';\n\nimport {\n classifyGeolocationError,\n geolocationFailureMessage,\n getDevicePosition,\n} from '../utils/deviceGeolocation';\n\nexport interface DropoffPin {\n latitude: number;\n longitude: number;\n accuracyMeters: number | null;\n}\n\nexport function DropoffPinField({\n value,\n onChange,\n}: {\n value: DropoffPin | null;\n onChange: (pin: DropoffPin | null) => void;\n}) {\n const [locating, setLocating] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const pinCurrentLocation = async () => {\n setLocating(true);\n setError(null);\n try {\n const fix = await getDevicePosition();\n onChange({\n latitude: fix.latitude,\n longitude: fix.longitude,\n accuracyMeters: fix.accuracyMeters,\n });\n } catch (e) {\n setError(geolocationFailureMessage(classifyGeolocationError(e)));\n } finally {\n setLocating(false);\n }\n };\n\n return (\n <div className=\"rounded-lg border border-border-subtle bg-bg-sunken p-3\">\n {value ? (\n <div className=\"flex items-center justify-between gap-3\">\n <p className=\"flex items-center gap-2 text-sm text-text-primary\">\n <Crosshair className=\"h-4 w-4 text-status-success-text\" />\n Drop-off pinned to your current location\n {value.accuracyMeters != null && (\n <span className=\"text-xs text-text-secondary\">\n (±{Math.round(value.accuracyMeters)} m)\n </span>\n )}\n </p>\n <button\n type=\"button\"\n onClick={() => onChange(null)}\n aria-label=\"Remove drop-off pin\"\n className=\"rounded-md p-1.5 text-text-secondary hover:bg-bg-surface hover:text-text-primary transition-colors\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n ) : (\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <p className=\"text-xs text-text-secondary\">\n Optional: pin where you are now so you get a live arrival time while the order is on its\n way.\n </p>\n <button\n type=\"button\"\n onClick={() => void pinCurrentLocation()}\n disabled={locating}\n className=\"inline-flex items-center gap-1.5 rounded-md border border-border-default bg-bg-surface px-3 py-2 text-xs font-medium text-text-primary hover:bg-bg-sunken transition-colors disabled:cursor-not-allowed disabled:opacity-60\"\n >\n {locating ? (\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <Crosshair className=\"h-3.5 w-3.5\" />\n )}\n Pin my current location\n </button>\n </div>\n )}\n {error && <p className=\"mt-2 text-xs text-status-error-text\">{error}</p>}\n </div>\n );\n}\n"],"mappings":";;;;;AAuBA,SAAgBA,EAAgB,EAC9B,UACA,eAIC;CACD,IAAM,CAACC,GAAUC,KAAeC,EAAS,EAAK,GACxC,CAACC,GAAOC,KAAYF,EAAwB,IAAI,GAEhDG,IAAqB,YAAY;EAErC,AADAJ,EAAY,EAAI,GAChBG,EAAS,IAAI;EACb,IAAI;GACF,IAAME,IAAM,MAAMC,EAAkB;GACpC,EAAS;IACP,UAAUD,EAAI;IACd,WAAWA,EAAI;IACf,gBAAgBA,EAAI;GACtB,CAAC;EACH,SAASE,GAAG;GACV,EAASC,EAA0BC,EAAyBF,CAAC,CAAC,CAAC;EACjE,UAAU;GACR,EAAY,EAAK;EACnB;CACF;CAEA,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACGG,IACC,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;IAAb,UAAA;KACE,kBAACC,GAAD,EAAW,WAAU,mCAAoC,CAAA;KAAC;KAEzDD,EAAM,kBAAkB,QACvB,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA;OAA8C;OACzC,KAAK,MAAMA,EAAM,cAAc;OAAE;MAChC;;IAEP;GACH,CAAA,GAAA,kBAAC,UAAD;IACE,MAAK;IACL,eAAeE,EAAS,IAAI;IAC5B,cAAW;IACX,WAAU;IAEV,UAAA,kBAACC,GAAD,EAAG,WAAU,UAAW,CAAA;GAClB,CAAA,CACL;EAEL,CAAA,IAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;IAA8B,UAAA;GAGxC,CAAA,GACH,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,KAAKT,EAAmB;IACvC,UAAUL;IACV,WAAU;IAJZ,UAAA,CAMGA,IACC,kBAACe,GAAD,EAAS,WAAU,2BAA4B,CAAA,IAE/C,kBAACH,GAAD,EAAW,WAAU,cAAe,CAAA,GACpC,yBAEI;GACL,CAAA,CAAA;EAEN,CAAA,GAAAT,KAAS,kBAAC,KAAD;GAAG,WAAU;GAAuC,UAAAA;EAAS,CAAA,CACpE;;AAET"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiveTrackingMap — real map for order tracking (BOFF-3962).
|
|
3
|
+
*
|
|
4
|
+
* An OpenStreetMap base (Leaflet, the map library the sibling MFEs use) with
|
|
5
|
+
* the cart (origin), the customer's drop-off pin and the courier's last-known
|
|
6
|
+
* position from `kadaikodiOrderTracking`. A dashed line joins courier → drop-off
|
|
7
|
+
* (straight line: there is no routing engine, so the line is not a road route).
|
|
8
|
+
* The map is created once and only its overlay layer is redrawn on each poll,
|
|
9
|
+
* so it does not flicker or lose the customer's pan/zoom.
|
|
10
|
+
*/
|
|
11
|
+
export interface MapPoint {
|
|
12
|
+
latitude: number;
|
|
13
|
+
longitude: number;
|
|
14
|
+
}
|
|
15
|
+
export interface LiveTrackingMapProps {
|
|
16
|
+
origin: MapPoint | null;
|
|
17
|
+
destination: MapPoint | null;
|
|
18
|
+
courier: (MapPoint & {
|
|
19
|
+
headingDegrees?: number | null;
|
|
20
|
+
stale?: boolean;
|
|
21
|
+
}) | null;
|
|
22
|
+
originLabel: string;
|
|
23
|
+
destinationLabel: string;
|
|
24
|
+
courierLabel: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function LiveTrackingMap({ origin, destination, courier, originLabel, destinationLabel, courierLabel, className, }: LiveTrackingMapProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_leaflet_src as t } from "../../node_modules/leaflet/dist/leaflet-src.js";
|
|
3
|
+
import { ensureLeafletCss as n, themeColor as r } from "../utils/leaflet.js";
|
|
4
|
+
import { cn as i } from "../utils/cn.js";
|
|
5
|
+
import { useEffect as a, useRef as o } from "react";
|
|
6
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
7
|
+
// src/kadaikodi/components/LiveTrackingMap.tsx
|
|
8
|
+
var c = /* @__PURE__ */ e(t(), 1), l = [20.5937, 78.9629], u = (e) => [e.latitude, e.longitude], d = (e) => e.replace(/[&<>"']/g, (e) => `&#${e.charCodeAt(0)};`);
|
|
9
|
+
function f(e, t, n, r) {
|
|
10
|
+
let i = r == null ? "" : `<span style="position:absolute;inset:0;transform:rotate(${r}deg)"><span style="position:absolute;top:-8px;left:50%;transform:translateX(-50%);width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:7px solid ${t}"></span></span>`;
|
|
11
|
+
return c.default.divIcon({
|
|
12
|
+
className: "kk-tracking-marker",
|
|
13
|
+
html: `<div style="position:relative;width:${n}px;height:${n}px">` + i + `<div style="width:${n}px;height:${n}px;border-radius:9999px;background:${t};color:var(--color-bg-surface);border:2px solid var(--color-bg-surface);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;box-shadow:var(--shadow-elevation-2)">${d(e)}</div></div>`,
|
|
14
|
+
iconSize: [n, n],
|
|
15
|
+
iconAnchor: [n / 2, n / 2]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
var p = (e) => {
|
|
19
|
+
let t = document.createElement("span");
|
|
20
|
+
return t.textContent = e, t;
|
|
21
|
+
};
|
|
22
|
+
function m({ origin: e, destination: t, courier: d, originLabel: m, destinationLabel: h, courierLabel: g, className: _ }) {
|
|
23
|
+
let v = o(null), y = o(null), b = o(null), x = o(!1);
|
|
24
|
+
return a(() => {
|
|
25
|
+
let e = v.current;
|
|
26
|
+
if (!e) return;
|
|
27
|
+
n();
|
|
28
|
+
let t = c.default.map(e, {
|
|
29
|
+
center: l,
|
|
30
|
+
zoom: 4,
|
|
31
|
+
scrollWheelZoom: !1
|
|
32
|
+
});
|
|
33
|
+
c.default.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
34
|
+
attribution: "© OpenStreetMap contributors",
|
|
35
|
+
maxZoom: 19
|
|
36
|
+
}).addTo(t), c.default.control.scale({ imperial: !1 }).addTo(t), b.current = c.default.layerGroup().addTo(t), y.current = t;
|
|
37
|
+
let r = window.setTimeout(() => t.invalidateSize(), 80);
|
|
38
|
+
return () => {
|
|
39
|
+
window.clearTimeout(r), t.remove(), y.current = null, b.current = null, x.current = !1;
|
|
40
|
+
};
|
|
41
|
+
}, []), a(() => {
|
|
42
|
+
let n = y.current, i = b.current;
|
|
43
|
+
if (!n || !i) return;
|
|
44
|
+
i.clearLayers();
|
|
45
|
+
let a = [];
|
|
46
|
+
e && (a.push(u(e)), c.default.marker(u(e), { icon: f("C", "var(--color-text-secondary)", 24) }).bindPopup(p(m)).addTo(i)), t && (a.push(u(t)), c.default.marker(u(t), { icon: f("D", "var(--color-status-success-text)", 24) }).bindPopup(p(h)).addTo(i)), d && (a.push(u(d)), t && c.default.polyline([u(d), u(t)], {
|
|
47
|
+
color: r("--color-accent-primary"),
|
|
48
|
+
weight: 3,
|
|
49
|
+
opacity: .8,
|
|
50
|
+
dashArray: "6 6"
|
|
51
|
+
}).addTo(i), c.default.marker(u(d), {
|
|
52
|
+
icon: f("", d.stale ? "var(--color-text-muted)" : "var(--color-accent-primary)", 20, d.headingDegrees ?? void 0),
|
|
53
|
+
zIndexOffset: 1e3
|
|
54
|
+
}).bindPopup(p(g)).addTo(i)), !x.current && a.length > 0 ? (a.length === 1 ? n.setView(a[0], 15) : n.fitBounds(c.default.latLngBounds(a), {
|
|
55
|
+
padding: [32, 32],
|
|
56
|
+
maxZoom: 16
|
|
57
|
+
}), x.current = !0) : d && !n.getBounds().contains(u(d)) && n.panTo(u(d));
|
|
58
|
+
}, [
|
|
59
|
+
e,
|
|
60
|
+
t,
|
|
61
|
+
d,
|
|
62
|
+
m,
|
|
63
|
+
h,
|
|
64
|
+
g
|
|
65
|
+
]), /* @__PURE__ */ s("div", {
|
|
66
|
+
ref: v,
|
|
67
|
+
role: "region",
|
|
68
|
+
"aria-label": "Live delivery map",
|
|
69
|
+
className: i("relative z-0 w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken", _)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export { m as LiveTrackingMap };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=LiveTrackingMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveTrackingMap.js","names":["L","import_leaflet_src","require_leaflet_src","DEFAULT_CENTER","toLatLng","p","escapeHtml","text","c","dotIcon","pointer","headingDeg","background","size","label","popup","el","LiveTrackingMap","containerRef","useRef","mapRef","overlayRef","fittedRef","useEffect","map","resize","overlay","points","origin","originLabel","destination","destinationLabel","courier","themeColor","courierLabel","cn","className"],"sources":["../../../src/kadaikodi/components/LiveTrackingMap.tsx"],"sourcesContent":["/**\n * LiveTrackingMap — real map for order tracking (BOFF-3962).\n *\n * An OpenStreetMap base (Leaflet, the map library the sibling MFEs use) with\n * the cart (origin), the customer's drop-off pin and the courier's last-known\n * position from `kadaikodiOrderTracking`. A dashed line joins courier → drop-off\n * (straight line: there is no routing engine, so the line is not a road route).\n * The map is created once and only its overlay layer is redrawn on each poll,\n * so it does not flicker or lose the customer's pan/zoom.\n */\n\nimport { useEffect, useRef } from 'react';\nimport L from 'leaflet';\n\nimport { ensureLeafletCss, themeColor } from '../utils/leaflet';\nimport { cn } from '../utils/cn';\n\nexport interface MapPoint {\n latitude: number;\n longitude: number;\n}\n\nexport interface LiveTrackingMapProps {\n origin: MapPoint | null;\n destination: MapPoint | null;\n courier: (MapPoint & { headingDegrees?: number | null; stale?: boolean }) | null;\n originLabel: string;\n destinationLabel: string;\n courierLabel: string;\n className?: string;\n}\n\nconst DEFAULT_CENTER: L.LatLngExpression = [20.5937, 78.9629];\n\nconst toLatLng = (p: MapPoint): L.LatLngTuple => [p.latitude, p.longitude];\n\nconst escapeHtml = (text: string): string =>\n text.replace(/[&<>\"']/g, (c) => `&#${c.charCodeAt(0)};`);\n\n/**\n * A round marker drawn with theme tokens (inline CSS supports var()). When a\n * heading is given, a small pointer on the rim shows the direction of travel.\n */\nfunction dotIcon(label: string, background: string, size: number, headingDeg?: number): L.DivIcon {\n const pointer =\n headingDeg == null\n ? ''\n : `<span style=\"position:absolute;inset:0;transform:rotate(${headingDeg}deg)\">` +\n `<span style=\"position:absolute;top:-8px;left:50%;transform:translateX(-50%);width:0;height:0;` +\n `border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:7px solid ${background}\"></span></span>`;\n return L.divIcon({\n className: 'kk-tracking-marker',\n html:\n `<div style=\"position:relative;width:${size}px;height:${size}px\">` +\n pointer +\n `<div style=\"width:${size}px;height:${size}px;border-radius:9999px;background:${background};` +\n `color:var(--color-bg-surface);border:2px solid var(--color-bg-surface);display:flex;align-items:center;` +\n `justify-content:center;font-size:11px;font-weight:600;box-shadow:var(--shadow-elevation-2)\">` +\n `${escapeHtml(label)}</div></div>`,\n iconSize: [size, size],\n iconAnchor: [size / 2, size / 2],\n });\n}\n\nconst popup = (text: string): HTMLElement => {\n const el = document.createElement('span');\n el.textContent = text;\n return el;\n};\n\nexport function LiveTrackingMap({\n origin,\n destination,\n courier,\n originLabel,\n destinationLabel,\n courierLabel,\n className,\n}: LiveTrackingMapProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const mapRef = useRef<L.Map | null>(null);\n const overlayRef = useRef<L.LayerGroup | null>(null);\n const fittedRef = useRef(false);\n\n // Create the map once.\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return undefined;\n ensureLeafletCss();\n const map = L.map(el, { center: DEFAULT_CENTER, zoom: 4, scrollWheelZoom: false });\n L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors',\n maxZoom: 19,\n }).addTo(map);\n L.control.scale({ imperial: false }).addTo(map);\n overlayRef.current = L.layerGroup().addTo(map);\n mapRef.current = map;\n const resize = window.setTimeout(() => map.invalidateSize(), 80);\n return () => {\n window.clearTimeout(resize);\n map.remove();\n mapRef.current = null;\n overlayRef.current = null;\n fittedRef.current = false;\n };\n }, []);\n\n // Redraw the overlay whenever the tracking data changes.\n useEffect(() => {\n const map = mapRef.current;\n const overlay = overlayRef.current;\n if (!map || !overlay) return;\n overlay.clearLayers();\n\n const accent = 'var(--color-accent-primary)';\n const points: L.LatLngTuple[] = [];\n\n if (origin) {\n points.push(toLatLng(origin));\n L.marker(toLatLng(origin), { icon: dotIcon('C', 'var(--color-text-secondary)', 24) })\n .bindPopup(popup(originLabel))\n .addTo(overlay);\n }\n if (destination) {\n points.push(toLatLng(destination));\n L.marker(toLatLng(destination), {\n icon: dotIcon('D', 'var(--color-status-success-text)', 24),\n })\n .bindPopup(popup(destinationLabel))\n .addTo(overlay);\n }\n if (courier) {\n points.push(toLatLng(courier));\n if (destination) {\n L.polyline([toLatLng(courier), toLatLng(destination)], {\n color: themeColor('--color-accent-primary'),\n weight: 3,\n opacity: 0.8,\n dashArray: '6 6',\n }).addTo(overlay);\n }\n L.marker(toLatLng(courier), {\n icon: dotIcon(\n '',\n courier.stale ? 'var(--color-text-muted)' : accent,\n 20,\n courier.headingDegrees ?? undefined\n ),\n zIndexOffset: 1000,\n })\n .bindPopup(popup(courierLabel))\n .addTo(overlay);\n }\n\n // Frame everything once; afterwards keep the customer's own pan/zoom and\n // only follow the courier if it leaves the visible area.\n if (!fittedRef.current && points.length > 0) {\n if (points.length === 1) {\n map.setView(points[0], 15);\n } else {\n map.fitBounds(L.latLngBounds(points), { padding: [32, 32], maxZoom: 16 });\n }\n fittedRef.current = true;\n } else if (courier && !map.getBounds().contains(toLatLng(courier))) {\n map.panTo(toLatLng(courier));\n }\n }, [origin, destination, courier, originLabel, destinationLabel, courierLabel]);\n\n return (\n <div\n ref={containerRef}\n role=\"region\"\n aria-label=\"Live delivery map\"\n className={cn(\n 'relative z-0 w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken',\n className\n )}\n />\n );\n}\n"],"mappings":"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"}
|
|
@@ -2,18 +2,19 @@ import { useKadaikodi as e } from "../context/KadaikodiContext.js";
|
|
|
2
2
|
import "../context/index.js";
|
|
3
3
|
import { kadaikodiQuery as t } from "./useKadaikodiApi.js";
|
|
4
4
|
import { useMutation as n, useQuery as r, useQueryClient as i } from "@tanstack/react-query";
|
|
5
|
+
import { clearGraphqlFetchResponseCache as a } from "@burdenoff/fe-libs/shared/graphql";
|
|
5
6
|
// src/kadaikodi/hooks/useAppointmentsApi.ts
|
|
6
|
-
var
|
|
7
|
+
var o = "\n id providerId offeringId customerId orderId timing status scheduledAt endsAt durationMinutes\n serviceAddress contactPhone notes rescheduleCount cancellationReason\n offering { id name price }\n", s = "\n providerId slotIntervalMinutes capacityPerSlot bufferMinutes minLeadMinutes advanceBookingDays\n cancellationCutoffHours autoConfirm timezone blackoutDates isCustomized bookableDays\n", c = [
|
|
7
8
|
"BOOKED",
|
|
8
9
|
"CONFIRMED",
|
|
9
10
|
"IN_PROGRESS"
|
|
10
|
-
],
|
|
11
|
+
], l = (e, t, n = {
|
|
11
12
|
hour: "numeric",
|
|
12
13
|
minute: "2-digit"
|
|
13
14
|
}) => new Date(e).toLocaleString("en-IN", {
|
|
14
15
|
...n,
|
|
15
16
|
timeZone: t
|
|
16
|
-
}),
|
|
17
|
+
}), u = (e) => {
|
|
17
18
|
if (!e) return null;
|
|
18
19
|
let t = [
|
|
19
20
|
"street",
|
|
@@ -23,12 +24,12 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
23
24
|
"instructions"
|
|
24
25
|
].map((t) => e[t]).filter((e) => typeof e == "string" && e.trim().length > 0).map((e) => e.trim());
|
|
25
26
|
return t.length > 0 ? t.join(", ") : null;
|
|
26
|
-
},
|
|
27
|
+
}, d = (e, t, n) => e.status !== "BOOKED" && e.status !== "CONFIRMED" ? !1 : e.timing === "COME_NOW" ? e.status === "BOOKED" && n < new Date(e.endsAt).getTime() : n <= new Date(e.scheduledAt).getTime() - t * 36e5, f = (e, t = /* @__PURE__ */ new Date()) => new Intl.DateTimeFormat("en-CA", {
|
|
27
28
|
timeZone: e,
|
|
28
29
|
year: "numeric",
|
|
29
30
|
month: "2-digit",
|
|
30
31
|
day: "2-digit"
|
|
31
|
-
}).format(t),
|
|
32
|
+
}).format(t), p = 3e4, m = 3e4, h = 100, g = 20, _ = (n) => {
|
|
32
33
|
let { apiGatewayUrl: i } = e();
|
|
33
34
|
return r({
|
|
34
35
|
queryKey: [
|
|
@@ -37,11 +38,11 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
37
38
|
n
|
|
38
39
|
],
|
|
39
40
|
queryFn: async () => (await t(`query AppointmentSettings($providerId: ID!) {
|
|
40
|
-
kadaikodiAppointmentSettings(providerId: $providerId) { ${
|
|
41
|
+
kadaikodiAppointmentSettings(providerId: $providerId) { ${s} }
|
|
41
42
|
}`, { providerId: n }, i)).kadaikodiAppointmentSettings,
|
|
42
43
|
enabled: !!n
|
|
43
44
|
});
|
|
44
|
-
},
|
|
45
|
+
}, v = (n, i) => {
|
|
45
46
|
let { apiGatewayUrl: a } = e();
|
|
46
47
|
return r({
|
|
47
48
|
queryKey: [
|
|
@@ -56,7 +57,7 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
56
57
|
}, a)).kadaikodiListAvailableSlots,
|
|
57
58
|
enabled: !!(n && i)
|
|
58
59
|
});
|
|
59
|
-
},
|
|
60
|
+
}, y = (n) => {
|
|
60
61
|
let { apiGatewayUrl: i } = e();
|
|
61
62
|
return r({
|
|
62
63
|
queryKey: [
|
|
@@ -65,15 +66,15 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
65
66
|
n
|
|
66
67
|
],
|
|
67
68
|
queryFn: async () => (await t(`query OrderAppointment($id: ID!) {
|
|
68
|
-
kadaikodiOrder(id: $id) { id appointment { ${
|
|
69
|
+
kadaikodiOrder(id: $id) { id appointment { ${o} } }
|
|
69
70
|
}`, { id: n }, i)).kadaikodiOrder?.appointment ?? null,
|
|
70
71
|
enabled: !!n,
|
|
71
72
|
refetchInterval: (e) => {
|
|
72
73
|
let t = e.state.data;
|
|
73
|
-
return t &&
|
|
74
|
+
return t && c.includes(t.status) ? m : !1;
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
|
-
},
|
|
77
|
+
}, b = (n) => {
|
|
77
78
|
let { apiGatewayUrl: i } = e();
|
|
78
79
|
return r({
|
|
79
80
|
queryKey: [
|
|
@@ -83,34 +84,35 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
83
84
|
],
|
|
84
85
|
queryFn: async () => {
|
|
85
86
|
let e = [];
|
|
86
|
-
for (let r of
|
|
87
|
+
for (let r of c) for (let a = 0; a < g; a++) {
|
|
87
88
|
let s = (await t(`query ProviderAppointments($providerId: ID!, $status: KadaikodiAppointmentStatus, $pagination: KadaikodiPaginationInput) {
|
|
88
89
|
kadaikodiProviderAppointments(providerId: $providerId, status: $status, pagination: $pagination) {
|
|
89
|
-
${
|
|
90
|
+
${o}
|
|
90
91
|
}
|
|
91
92
|
}`, {
|
|
92
93
|
providerId: n,
|
|
93
94
|
status: r,
|
|
94
95
|
pagination: {
|
|
95
|
-
limit:
|
|
96
|
-
offset:
|
|
96
|
+
limit: h,
|
|
97
|
+
offset: a * h
|
|
97
98
|
}
|
|
98
99
|
}, i)).kadaikodiProviderAppointments;
|
|
99
|
-
if (e.push(...s), s.length <
|
|
100
|
+
if (e.push(...s), s.length < h) break;
|
|
100
101
|
}
|
|
101
|
-
let r = (e) =>
|
|
102
|
+
let r = (e) => c.indexOf(e), a = /* @__PURE__ */ new Map();
|
|
102
103
|
for (let t of e) {
|
|
103
|
-
let e =
|
|
104
|
-
(!e || r(t.status) > r(e.status)) &&
|
|
104
|
+
let e = a.get(t.id);
|
|
105
|
+
(!e || r(t.status) > r(e.status)) && a.set(t.id, t);
|
|
105
106
|
}
|
|
106
|
-
return [...
|
|
107
|
+
return [...a.values()].sort((e, t) => new Date(e.scheduledAt).getTime() - new Date(t.scheduledAt).getTime());
|
|
107
108
|
},
|
|
108
109
|
enabled: !!n,
|
|
109
|
-
refetchInterval:
|
|
110
|
+
refetchInterval: p
|
|
110
111
|
});
|
|
111
|
-
},
|
|
112
|
+
}, x = () => {
|
|
112
113
|
let e = i();
|
|
113
114
|
return () => {
|
|
115
|
+
a();
|
|
114
116
|
for (let t of [
|
|
115
117
|
"appointment-slots",
|
|
116
118
|
"order-appointment",
|
|
@@ -119,41 +121,41 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
119
121
|
"order"
|
|
120
122
|
]) e.invalidateQueries({ queryKey: ["kadaikodi", t] });
|
|
121
123
|
};
|
|
122
|
-
},
|
|
123
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
124
|
+
}, S = () => {
|
|
125
|
+
let { apiGatewayUrl: r } = e(), i = x();
|
|
124
126
|
return n({
|
|
125
127
|
mutationFn: async (e) => (await t(`mutation BookAppointment($input: KadaikodiBookAppointmentInput!) {
|
|
126
|
-
kadaikodiBookAppointment(input: $input) { ${
|
|
128
|
+
kadaikodiBookAppointment(input: $input) { ${o} }
|
|
127
129
|
}`, { input: e }, r)).kadaikodiBookAppointment,
|
|
128
130
|
onSuccess: i
|
|
129
131
|
});
|
|
130
|
-
},
|
|
131
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
132
|
+
}, C = () => {
|
|
133
|
+
let { apiGatewayUrl: r } = e(), i = x();
|
|
132
134
|
return n({
|
|
133
135
|
mutationFn: async ({ id: e, scheduledAt: n }) => (await t(`mutation RescheduleAppointment($id: ID!, $scheduledAt: DateTime!) {
|
|
134
|
-
kadaikodiRescheduleAppointment(id: $id, scheduledAt: $scheduledAt) { ${
|
|
136
|
+
kadaikodiRescheduleAppointment(id: $id, scheduledAt: $scheduledAt) { ${o} }
|
|
135
137
|
}`, {
|
|
136
138
|
id: e,
|
|
137
139
|
scheduledAt: n
|
|
138
140
|
}, r)).kadaikodiRescheduleAppointment,
|
|
139
141
|
onSuccess: i
|
|
140
142
|
});
|
|
141
|
-
},
|
|
142
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
143
|
+
}, w = () => {
|
|
144
|
+
let { apiGatewayUrl: r } = e(), i = x();
|
|
143
145
|
return n({
|
|
144
146
|
mutationFn: async ({ id: e, reason: n }) => (await t(`mutation CancelAppointment($id: ID!, $reason: String) {
|
|
145
|
-
kadaikodiCancelAppointment(id: $id, reason: $reason) { ${
|
|
147
|
+
kadaikodiCancelAppointment(id: $id, reason: $reason) { ${o} }
|
|
146
148
|
}`, {
|
|
147
149
|
id: e,
|
|
148
150
|
reason: n
|
|
149
151
|
}, r)).kadaikodiCancelAppointment,
|
|
150
152
|
onSuccess: i
|
|
151
153
|
});
|
|
152
|
-
},
|
|
153
|
-
let { apiGatewayUrl: r } = e(), i =
|
|
154
|
+
}, T = () => {
|
|
155
|
+
let { apiGatewayUrl: r } = e(), i = x();
|
|
154
156
|
return n({
|
|
155
157
|
mutationFn: async ({ id: e, status: n, reason: i }) => (await t(`mutation UpdateAppointmentStatus($id: ID!, $status: KadaikodiAppointmentProviderStatus!, $reason: String) {
|
|
156
|
-
kadaikodiUpdateAppointmentStatus(id: $id, status: $status, reason: $reason) { ${
|
|
158
|
+
kadaikodiUpdateAppointmentStatus(id: $id, status: $status, reason: $reason) { ${o} }
|
|
157
159
|
}`, {
|
|
158
160
|
id: e,
|
|
159
161
|
status: n,
|
|
@@ -161,17 +163,17 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
161
163
|
}, r)).kadaikodiUpdateAppointmentStatus,
|
|
162
164
|
onSuccess: i
|
|
163
165
|
});
|
|
164
|
-
},
|
|
165
|
-
let r = i(), { apiGatewayUrl:
|
|
166
|
+
}, E = () => {
|
|
167
|
+
let r = i(), { apiGatewayUrl: o } = e();
|
|
166
168
|
return n({
|
|
167
169
|
mutationFn: async ({ providerId: e, input: n }) => (await t(`mutation UpsertAppointmentSettings($providerId: ID!, $input: KadaikodiAppointmentSettingsInput!) {
|
|
168
|
-
kadaikodiUpsertAppointmentSettings(providerId: $providerId, input: $input) { ${
|
|
170
|
+
kadaikodiUpsertAppointmentSettings(providerId: $providerId, input: $input) { ${s} }
|
|
169
171
|
}`, {
|
|
170
172
|
providerId: e,
|
|
171
173
|
input: n
|
|
172
|
-
},
|
|
174
|
+
}, o)).kadaikodiUpsertAppointmentSettings,
|
|
173
175
|
onSuccess: (e) => {
|
|
174
|
-
r.setQueryData([
|
|
176
|
+
a(), r.setQueryData([
|
|
175
177
|
"kadaikodi",
|
|
176
178
|
"appointment-settings",
|
|
177
179
|
e.providerId
|
|
@@ -179,6 +181,6 @@ var a = "\n id providerId offeringId customerId orderId timing status scheduled
|
|
|
179
181
|
}
|
|
180
182
|
});
|
|
181
183
|
};
|
|
182
|
-
export {
|
|
184
|
+
export { c as ACTIVE_APPOINTMENT_STATUSES, f as calendarDateIn, d as customerCanChangeAppointment, l as formatAppointmentTime, u as formatServiceAddress, _ as useAppointmentSettings, v as useAvailableSlots, S as useBookAppointment, w as useCancelAppointment, y as useOrderAppointment, b as useProviderAppointments, C as useRescheduleAppointment, T as useUpdateAppointmentStatus, E as useUpsertAppointmentSettings };
|
|
183
185
|
|
|
184
186
|
//# sourceMappingURL=useAppointmentsApi.js.map
|