@lodashventure/medusa-booking-for-pickup 1.4.18 → 1.4.19

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.
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
- const react = require("react");
4
- const lucideReact = require("lucide-react");
5
3
  const adminSdk = require("@medusajs/admin-sdk");
6
4
  const ui = require("@medusajs/ui");
5
+ const react = require("react");
6
+ const lucideReact = require("lucide-react");
7
7
  const icons = require("@medusajs/icons");
8
8
  const reactRouterDom = require("react-router-dom");
9
9
  const Medusa = require("@medusajs/js-sdk");
@@ -69,38 +69,38 @@ const CustomerPickupHistoryWidget = ({ data }) => {
69
69
  canceled: "ยกเลิก",
70
70
  processing: "กำลังดำเนินการ"
71
71
  };
72
- return /* @__PURE__ */ jsxRuntime.jsx(Badge, { color: statusColors[status] || "grey", size: "small", children: statusLabels[status] || status });
72
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: statusColors[status] || "grey", size: "small", children: statusLabels[status] || status });
73
73
  };
74
74
  if (loading) {
75
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { className: "divide-y p-0", children: [
75
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
76
76
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
77
77
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "text-ui-fg-subtle" }),
78
- /* @__PURE__ */ jsxRuntime.jsx(Heading, { level: "h2", children: "ประวัติการจองรับสินค้า" })
78
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "ประวัติการจองรับสินค้า" })
79
79
  ] }) }),
80
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { className: "text-ui-fg-subtle", children: "กำลังโหลด..." }) })
80
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "กำลังโหลด..." }) })
81
81
  ] });
82
82
  }
83
83
  if (error) {
84
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { className: "divide-y p-0", children: [
84
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
85
85
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
86
86
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "text-ui-fg-subtle" }),
87
- /* @__PURE__ */ jsxRuntime.jsx(Heading, { level: "h2", children: "ประวัติการจองรับสินค้า" })
87
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "ประวัติการจองรับสินค้า" })
88
88
  ] }) }),
89
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { className: "text-red-500", children: error }) })
89
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-red-500", children: error }) })
90
90
  ] });
91
91
  }
92
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { className: "divide-y p-0", children: [
92
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
93
93
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
94
94
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
95
95
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "text-ui-fg-subtle" }),
96
- /* @__PURE__ */ jsxRuntime.jsx(Heading, { level: "h2", children: "ประวัติการจองรับสินค้า" }),
97
- pickupHistory.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: "small", children: pickupHistory.length })
96
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "ประวัติการจองรับสินค้า" }),
97
+ pickupHistory.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "small", children: pickupHistory.length })
98
98
  ] }),
99
- /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "small", variant: "transparent", onClick: fetchPickupHistory, children: "รีเฟรช" })
99
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "transparent", onClick: fetchPickupHistory, children: "รีเฟรช" })
100
100
  ] }),
101
101
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: pickupHistory.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
102
102
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Package, { className: "text-ui-fg-muted mb-4", size: 48 }),
103
- /* @__PURE__ */ jsxRuntime.jsx(Text, { className: "text-ui-fg-subtle", children: "ยังไม่มีประวัติการจองรับสินค้า" })
103
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "ยังไม่มีประวัติการจองรับสินค้า" })
104
104
  ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: pickupHistory.map((pickup) => {
105
105
  var _a;
106
106
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -112,22 +112,22 @@ const CustomerPickupHistoryWidget = ({ data }) => {
112
112
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
113
113
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShoppingBag, { className: "text-ui-fg-subtle", size: 20 }),
114
114
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: pickup.order ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
115
- /* @__PURE__ */ jsxRuntime.jsxs(Text, { weight: "plus", size: "small", children: [
115
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { weight: "plus", size: "small", children: [
116
116
  "คำสั่งซื้อ #",
117
117
  pickup.order.display_id
118
118
  ] }),
119
- /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: "xsmall", className: "text-ui-fg-subtle", children: [
119
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", className: "text-ui-fg-subtle", children: [
120
120
  ((_a = pickup.order.items) == null ? void 0 : _a.length) || 0,
121
121
  " รายการ"
122
122
  ] })
123
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(Text, { weight: "plus", size: "small", children: [
123
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { weight: "plus", size: "small", children: [
124
124
  "คำสั่งซื้อ ",
125
125
  pickup.order_id
126
126
  ] }) })
127
127
  ] }),
128
128
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-end gap-1", children: [
129
129
  pickup.order && getStatusBadge(pickup.order.status),
130
- pickup.order && /* @__PURE__ */ jsxRuntime.jsx(Text, { weight: "plus", size: "small", children: formatCurrency(
130
+ pickup.order && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", children: formatCurrency(
131
131
  pickup.order.total,
132
132
  pickup.order.currency_code
133
133
  ) })
@@ -149,7 +149,7 @@ const CustomerPickupHistoryWidget = ({ data }) => {
149
149
  ] })
150
150
  ] })
151
151
  ] }),
152
- pickup.order && pickup.order.shipping_methods && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 pt-2 border-t", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "xsmall", className: "text-ui-fg-subtle", children: pickup.order.shipping_methods.map((sm) => sm.name).join(", ") }) })
152
+ pickup.order && pickup.order.shipping_methods && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 pt-2 border-t", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-subtle", children: pickup.order.shipping_methods.map((sm) => sm.name).join(", ") }) })
153
153
  ]
154
154
  },
155
155
  pickup.id
@@ -157,7 +157,7 @@ const CustomerPickupHistoryWidget = ({ data }) => {
157
157
  }) }) })
158
158
  ] });
159
159
  };
160
- defineWidgetConfig({
160
+ adminSdk.defineWidgetConfig({
161
161
  zone: "customer.details.after"
162
162
  });
163
163
  const OrderPickupBookingWidget = ({ data }) => {
@@ -1,8 +1,8 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { defineWidgetConfig, defineRouteConfig, useSdk } from "@medusajs/admin-sdk";
3
+ import { Container, Heading, Text, Badge, Button, toast, createDataTableColumnHelper, useDataTable, DataTable, Select, clx, Switch, IconButton } from "@medusajs/ui";
2
4
  import { useState, useEffect, useMemo, useCallback } from "react";
3
5
  import { Calendar, Package, ShoppingBag, Clock, MapPin, RefreshCw, ArrowLeft, Trash2 } from "lucide-react";
4
- import { defineWidgetConfig as defineWidgetConfig$1, defineRouteConfig, useSdk } from "@medusajs/admin-sdk";
5
- import { Container as Container$1, Heading as Heading$1, Text as Text$1, Badge as Badge$1, Button as Button$1, toast, createDataTableColumnHelper, useDataTable, DataTable, Select, clx, Switch, IconButton } from "@medusajs/ui";
6
6
  import { StackPerspective, Plus } from "@medusajs/icons";
7
7
  import { useNavigate, useParams, Navigate } from "react-router-dom";
8
8
  import Medusa from "@medusajs/js-sdk";
@@ -232,46 +232,46 @@ const OrderPickupBookingWidget = ({ data }) => {
232
232
  return { label: "รอรับสินค้า", color: "blue" };
233
233
  };
234
234
  if (loading) {
235
- return /* @__PURE__ */ jsxs(Container$1, { className: "divide-y p-0", children: [
235
+ return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
236
236
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
237
237
  /* @__PURE__ */ jsx(Calendar, { className: "text-ui-fg-subtle" }),
238
- /* @__PURE__ */ jsx(Heading$1, { level: "h2", children: "การจองรับสินค้า" })
238
+ /* @__PURE__ */ jsx(Heading, { level: "h2", children: "การจองรับสินค้า" })
239
239
  ] }) }),
240
- /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(Text$1, { className: "text-ui-fg-subtle", children: "กำลังโหลด..." }) })
240
+ /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle", children: "กำลังโหลด..." }) })
241
241
  ] });
242
242
  }
243
243
  if (error) {
244
- return /* @__PURE__ */ jsxs(Container$1, { className: "divide-y p-0", children: [
244
+ return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
245
245
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
246
246
  /* @__PURE__ */ jsx(Calendar, { className: "text-ui-fg-subtle" }),
247
- /* @__PURE__ */ jsx(Heading$1, { level: "h2", children: "การจองรับสินค้า" })
247
+ /* @__PURE__ */ jsx(Heading, { level: "h2", children: "การจองรับสินค้า" })
248
248
  ] }) }),
249
- /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(Text$1, { className: "text-red-500", children: error }) })
249
+ /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(Text, { className: "text-red-500", children: error }) })
250
250
  ] });
251
251
  }
252
252
  if (!pickupBooking) {
253
- return /* @__PURE__ */ jsxs(Container$1, { className: "divide-y p-0", children: [
253
+ return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
254
254
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
255
255
  /* @__PURE__ */ jsx(Calendar, { className: "text-ui-fg-subtle" }),
256
- /* @__PURE__ */ jsx(Heading$1, { level: "h2", children: "การจองรับสินค้า" })
256
+ /* @__PURE__ */ jsx(Heading, { level: "h2", children: "การจองรับสินค้า" })
257
257
  ] }) }),
258
258
  /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
259
259
  /* @__PURE__ */ jsx(MapPin, { className: "text-ui-fg-muted mb-4", size: 48 }),
260
- /* @__PURE__ */ jsx(Text$1, { className: "text-ui-fg-subtle", children: "คำสั่งซื้อนี้ไม่ได้จองรับสินค้าที่สาขา" }),
261
- /* @__PURE__ */ jsx(Text$1, { size: "xsmall", className: "text-ui-fg-muted mt-2", children: "คำสั่งซื้อนี้อาจเป็นการจัดส่งแบบปกติ" })
260
+ /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle", children: "คำสั่งซื้อนี้ไม่ได้จองรับสินค้าที่สาขา" }),
261
+ /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted mt-2", children: "คำสั่งซื้อนี้อาจเป็นการจัดส่งแบบปกติ" })
262
262
  ] }) })
263
263
  ] });
264
264
  }
265
265
  const status = getPickupStatus();
266
- return /* @__PURE__ */ jsxs(Container$1, { className: "divide-y p-0", children: [
266
+ return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
267
267
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
268
268
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
269
269
  /* @__PURE__ */ jsx(Calendar, { className: "text-ui-fg-subtle" }),
270
- /* @__PURE__ */ jsx(Heading$1, { level: "h2", children: "การจองรับสินค้าที่สาขา" }),
271
- /* @__PURE__ */ jsx(Badge$1, { color: status.color, size: "small", children: status.label })
270
+ /* @__PURE__ */ jsx(Heading, { level: "h2", children: "การจองรับสินค้าที่สาขา" }),
271
+ /* @__PURE__ */ jsx(Badge, { color: status.color, size: "small", children: status.label })
272
272
  ] }),
273
273
  /* @__PURE__ */ jsx(
274
- Button$1,
274
+ Button,
275
275
  {
276
276
  size: "small",
277
277
  variant: "transparent",
@@ -288,25 +288,25 @@ const OrderPickupBookingWidget = ({ data }) => {
288
288
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
289
289
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-ui-fg-subtle", children: [
290
290
  /* @__PURE__ */ jsx(Calendar, { size: 16 }),
291
- /* @__PURE__ */ jsx(Text$1, { size: "xsmall", weight: "plus", children: "วันที่รับสินค้า" })
291
+ /* @__PURE__ */ jsx(Text, { size: "xsmall", weight: "plus", children: "วันที่รับสินค้า" })
292
292
  ] }),
293
- /* @__PURE__ */ jsx(Text$1, { weight: "plus", children: formatDate(pickupBooking.pickup_datetime) })
293
+ /* @__PURE__ */ jsx(Text, { weight: "plus", children: formatDate(pickupBooking.pickup_datetime) })
294
294
  ] }),
295
295
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
296
296
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-ui-fg-subtle", children: [
297
297
  /* @__PURE__ */ jsx(Clock, { size: 16 }),
298
- /* @__PURE__ */ jsx(Text$1, { size: "xsmall", weight: "plus", children: "เวลารับสินค้า" })
298
+ /* @__PURE__ */ jsx(Text, { size: "xsmall", weight: "plus", children: "เวลารับสินค้า" })
299
299
  ] }),
300
- /* @__PURE__ */ jsx(Text$1, { weight: "plus", children: formatTime(pickupBooking.pickup_datetime) })
300
+ /* @__PURE__ */ jsx(Text, { weight: "plus", children: formatTime(pickupBooking.pickup_datetime) })
301
301
  ] })
302
302
  ] }),
303
303
  pickupBooking.shipping_option && /* @__PURE__ */ jsx("div", { className: "rounded-lg border p-4 bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 mb-2", children: [
304
304
  /* @__PURE__ */ jsx(MapPin, { className: "text-ui-fg-muted mt-1", size: 16 }),
305
305
  /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
306
- /* @__PURE__ */ jsx(Text$1, { weight: "plus", size: "small", className: "mb-1", children: pickupBooking.shipping_option.name }),
306
+ /* @__PURE__ */ jsx(Text, { weight: "plus", size: "small", className: "mb-1", children: pickupBooking.shipping_option.name }),
307
307
  ((_b = (_a = pickupBooking.shipping_option.service_zone) == null ? void 0 : _a.fulfillment_set) == null ? void 0 : _b.location) && /* @__PURE__ */ jsxs(Fragment, { children: [
308
- /* @__PURE__ */ jsx(Text$1, { size: "small", className: "text-ui-fg-subtle", children: pickupBooking.shipping_option.service_zone.fulfillment_set.location.name }),
309
- pickupBooking.shipping_option.service_zone.fulfillment_set.location.address && /* @__PURE__ */ jsxs(Text$1, { size: "xsmall", className: "text-ui-fg-muted mt-1", children: [
308
+ /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: pickupBooking.shipping_option.service_zone.fulfillment_set.location.name }),
309
+ pickupBooking.shipping_option.service_zone.fulfillment_set.location.address && /* @__PURE__ */ jsxs(Text, { size: "xsmall", className: "text-ui-fg-muted mt-1", children: [
310
310
  pickupBooking.shipping_option.service_zone.fulfillment_set.location.address.address_1,
311
311
  pickupBooking.shipping_option.service_zone.fulfillment_set.location.address.address_2 && `, ${pickupBooking.shipping_option.service_zone.fulfillment_set.location.address.address_2}`,
312
312
  /* @__PURE__ */ jsx("br", {}),
@@ -321,22 +321,22 @@ const OrderPickupBookingWidget = ({ data }) => {
321
321
  ] }) }),
322
322
  /* @__PURE__ */ jsx("div", { className: "pt-4 border-t", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
323
323
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
324
- /* @__PURE__ */ jsx(Text$1, { size: "xsmall", className: "text-ui-fg-subtle", children: "จองเมื่อ" }),
325
- /* @__PURE__ */ jsx(Text$1, { size: "small", children: formatDateTime(pickupBooking.created_at) })
324
+ /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-subtle", children: "จองเมื่อ" }),
325
+ /* @__PURE__ */ jsx(Text, { size: "small", children: formatDateTime(pickupBooking.created_at) })
326
326
  ] }),
327
327
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
328
- /* @__PURE__ */ jsx(Text$1, { size: "xsmall", className: "text-ui-fg-subtle", children: "อัปเดตล่าสุด" }),
329
- /* @__PURE__ */ jsx(Text$1, { size: "small", children: formatDateTime(pickupBooking.updated_at) })
328
+ /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-subtle", children: "อัปเดตล่าสุด" }),
329
+ /* @__PURE__ */ jsx(Text, { size: "small", children: formatDateTime(pickupBooking.updated_at) })
330
330
  ] })
331
331
  ] }) }),
332
- /* @__PURE__ */ jsx("div", { className: "pt-4 border-t", children: /* @__PURE__ */ jsxs(Text$1, { size: "xsmall", className: "text-ui-fg-muted", children: [
332
+ /* @__PURE__ */ jsx("div", { className: "pt-4 border-t", children: /* @__PURE__ */ jsxs(Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
333
333
  "Booking ID: ",
334
334
  pickupBooking.id
335
335
  ] }) })
336
336
  ] }) })
337
337
  ] });
338
338
  };
339
- defineWidgetConfig$1({
339
+ defineWidgetConfig({
340
340
  zone: "order.details.after"
341
341
  });
342
342
  const sdk = new Medusa({
@@ -431,8 +431,8 @@ const ShippingOptionList = () => {
431
431
  navigate(`/pickup-shipping/${row.id}`);
432
432
  }
433
433
  });
434
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Container$1, { className: "flex flex-col p-0 overflow-hidden", children: /* @__PURE__ */ jsxs(DataTable, { instance: table, children: [
435
- /* @__PURE__ */ jsx(DataTable.Toolbar, { className: "flex flex-col items-start justify-between gap-2 md:flex-row md:items-center", children: /* @__PURE__ */ jsx(Heading$1, { children: "Pickup Shipping Options" }) }),
434
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Container, { className: "flex flex-col p-0 overflow-hidden", children: /* @__PURE__ */ jsxs(DataTable, { instance: table, children: [
435
+ /* @__PURE__ */ jsx(DataTable.Toolbar, { className: "flex flex-col items-start justify-between gap-2 md:flex-row md:items-center", children: /* @__PURE__ */ jsx(Heading, { children: "Pickup Shipping Options" }) }),
436
436
  /* @__PURE__ */ jsx(DataTable.Table, {})
437
437
  ] }) }) });
438
438
  };
@@ -567,10 +567,10 @@ function TimeTable({
567
567
  });
568
568
  };
569
569
  if (timeSlots.length === 0) return null;
570
- return /* @__PURE__ */ jsxs(Container$1, { className: "p-4 overflow-x-auto", children: [
571
- /* @__PURE__ */ jsx(Heading$1, { className: "text-xl font-bold mb-4", children: "Pickup Hours Schedule" }),
570
+ return /* @__PURE__ */ jsxs(Container, { className: "p-4 overflow-x-auto", children: [
571
+ /* @__PURE__ */ jsx(Heading, { className: "text-xl font-bold mb-4", children: "Pickup Hours Schedule" }),
572
572
  /* @__PURE__ */ jsxs("div", { className: "min-w-full flex", children: [
573
- /* @__PURE__ */ jsx("div", { className: "ml-2 mt-7 flex flex-col items-end", children: timeSlots.map((timeSlot) => /* @__PURE__ */ jsx(Text$1, { className: "h-8", children: timeSlot }, timeSlot)) }),
573
+ /* @__PURE__ */ jsx("div", { className: "ml-2 mt-7 flex flex-col items-end", children: timeSlots.map((timeSlot) => /* @__PURE__ */ jsx(Text, { className: "h-8", children: timeSlot }, timeSlot)) }),
574
574
  /* @__PURE__ */ jsxs("table", { className: "ml-2 w-full border-collapse", children: [
575
575
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: days.map((day) => /* @__PURE__ */ jsx(
576
576
  "th",
@@ -760,22 +760,22 @@ function ShippingOptionDetails() {
760
760
  return /* @__PURE__ */ jsx(Navigate, { to: "/pickup-shipping" });
761
761
  }
762
762
  return /* @__PURE__ */ jsxs(Fragment, { children: [
763
- /* @__PURE__ */ jsxs(Container$1, { className: "p-4 ", children: [
763
+ /* @__PURE__ */ jsxs(Container, { className: "p-4 ", children: [
764
764
  /* @__PURE__ */ jsxs(
765
- Button$1,
765
+ Button,
766
766
  {
767
767
  onClick: () => navigate("/pickup-shipping"),
768
768
  variant: "transparent",
769
769
  className: "p-0 mb-4",
770
770
  children: [
771
771
  /* @__PURE__ */ jsx(ArrowLeft, { size: 20 }),
772
- /* @__PURE__ */ jsx(Text$1, { className: "ml-2", children: "Back" })
772
+ /* @__PURE__ */ jsx(Text, { className: "ml-2", children: "Back" })
773
773
  ]
774
774
  }
775
775
  ),
776
776
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 mb-4", children: [
777
- /* @__PURE__ */ jsx(Heading$1, { className: "text-xl font-bold", children: "Pickup Hours" }),
778
- /* @__PURE__ */ jsx(Button$1, { onClick: handleUpdateSchedules, children: "Save" })
777
+ /* @__PURE__ */ jsx(Heading, { className: "text-xl font-bold", children: "Pickup Hours" }),
778
+ /* @__PURE__ */ jsx(Button, { onClick: handleUpdateSchedules, children: "Save" })
779
779
  ] }),
780
780
  /* @__PURE__ */ jsx("div", { className: "space-y-4", children: Object.entries(schedule).map(([day, { enabled, timeSlots }]) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
781
781
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 mb-2 h-8", children: [
@@ -787,7 +787,7 @@ function ShippingOptionDetails() {
787
787
  },
788
788
  `switch-${day}`
789
789
  ),
790
- /* @__PURE__ */ jsx(Text$1, { className: "capitalize", children: day }),
790
+ /* @__PURE__ */ jsx(Text, { className: "capitalize", children: day }),
791
791
  enabled && /* @__PURE__ */ jsx(
792
792
  IconButton,
793
793
  {
@@ -812,7 +812,7 @@ function ShippingOptionDetails() {
812
812
  maxTime: slot.end
813
813
  }
814
814
  ),
815
- /* @__PURE__ */ jsx(Text$1, { className: "text-gray-400", children: "-" }),
815
+ /* @__PURE__ */ jsx(Text, { className: "text-gray-400", children: "-" }),
816
816
  /* @__PURE__ */ jsx(
817
817
  TimeSelect,
818
818
  {
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ /**
6
+ * GET /store/customers/me/pickup-history
7
+ * Returns pickup history for the authenticated customer
8
+ */
9
+ const GET = async (req, res) => {
10
+ const customer_id = req.auth_context.actor_id;
11
+ const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
12
+ try {
13
+ // Query pickup dates for orders associated with this customer
14
+ const result = await query.graph({
15
+ entity: "pickup_date",
16
+ fields: [
17
+ "id",
18
+ "pickup_datetime",
19
+ "order_id",
20
+ "created_at",
21
+ "updated_at",
22
+ ],
23
+ filters: {
24
+ order: {
25
+ customer_id: customer_id,
26
+ },
27
+ },
28
+ pagination: {
29
+ order: {
30
+ created_at: "DESC",
31
+ },
32
+ },
33
+ });
34
+ // Enrich with order details
35
+ const pickupDates = result.data || [];
36
+ if (pickupDates.length > 0) {
37
+ // Get order details for each pickup
38
+ const orderIds = pickupDates.map((pd) => pd.order_id).filter(Boolean);
39
+ if (orderIds.length > 0) {
40
+ const orders = await query.graph({
41
+ entity: "order",
42
+ fields: [
43
+ "id",
44
+ "display_id",
45
+ "status",
46
+ "created_at",
47
+ "total",
48
+ "currency_code",
49
+ "items.*",
50
+ "shipping_methods.*",
51
+ ],
52
+ filters: {
53
+ id: orderIds,
54
+ },
55
+ });
56
+ // Map orders to pickup dates
57
+ const orderMap = new Map(orders.data.map((order) => [order.id, order]));
58
+ const enrichedPickups = pickupDates.map((pickup) => ({
59
+ ...pickup,
60
+ order: orderMap.get(pickup.order_id) || null,
61
+ }));
62
+ return res.status(200).json({
63
+ pickup_history: enrichedPickups,
64
+ count: enrichedPickups.length,
65
+ });
66
+ }
67
+ }
68
+ return res.status(200).json({
69
+ pickup_history: [],
70
+ count: 0,
71
+ });
72
+ }
73
+ catch (error) {
74
+ console.error("Error fetching pickup history:", error);
75
+ return res.status(500).json({
76
+ error: error.message || "Failed to fetch pickup history",
77
+ });
78
+ }
79
+ };
80
+ exports.GET = GET;
81
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3N0b3JlL2N1c3RvbWVycy9tZS9waWNrdXAtaGlzdG9yeS9yb3V0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSxxREFBc0U7QUFFdEU7OztHQUdHO0FBQ0ksTUFBTSxHQUFHLEdBQUcsS0FBSyxFQUN0QixHQUErQixFQUMvQixHQUFtQixFQUNuQixFQUFFO0lBQ0YsTUFBTSxXQUFXLEdBQUcsR0FBRyxDQUFDLFlBQVksQ0FBQyxRQUFRLENBQUM7SUFDOUMsTUFBTSxLQUFLLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsaUNBQXlCLENBQUMsS0FBSyxDQUFDLENBQUM7SUFFakUsSUFBSSxDQUFDO1FBQ0gsOERBQThEO1FBQzlELE1BQU0sTUFBTSxHQUFHLE1BQU0sS0FBSyxDQUFDLEtBQUssQ0FBQztZQUMvQixNQUFNLEVBQUUsYUFBYTtZQUNyQixNQUFNLEVBQUU7Z0JBQ04sSUFBSTtnQkFDSixpQkFBaUI7Z0JBQ2pCLFVBQVU7Z0JBQ1YsWUFBWTtnQkFDWixZQUFZO2FBQ2I7WUFDRCxPQUFPLEVBQUU7Z0JBQ1AsS0FBSyxFQUFFO29CQUNMLFdBQVcsRUFBRSxXQUFXO2lCQUN6QjthQUNGO1lBQ0QsVUFBVSxFQUFFO2dCQUNWLEtBQUssRUFBRTtvQkFDTCxVQUFVLEVBQUUsTUFBTTtpQkFDbkI7YUFDRjtTQUNGLENBQUMsQ0FBQztRQUVILDRCQUE0QjtRQUM1QixNQUFNLFdBQVcsR0FBRyxNQUFNLENBQUMsSUFBSSxJQUFJLEVBQUUsQ0FBQztRQUV0QyxJQUFJLFdBQVcsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxFQUFFLENBQUM7WUFDM0Isb0NBQW9DO1lBQ3BDLE1BQU0sUUFBUSxHQUFHLFdBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQyxFQUFPLEVBQUUsRUFBRSxDQUFDLEVBQUUsQ0FBQyxRQUFRLENBQUMsQ0FBQyxNQUFNLENBQUMsT0FBTyxDQUFDLENBQUM7WUFFM0UsSUFBSSxRQUFRLENBQUMsTUFBTSxHQUFHLENBQUMsRUFBRSxDQUFDO2dCQUN4QixNQUFNLE1BQU0sR0FBRyxNQUFNLEtBQUssQ0FBQyxLQUFLLENBQUM7b0JBQy9CLE1BQU0sRUFBRSxPQUFPO29CQUNmLE1BQU0sRUFBRTt3QkFDTixJQUFJO3dCQUNKLFlBQVk7d0JBQ1osUUFBUTt3QkFDUixZQUFZO3dCQUNaLE9BQU87d0JBQ1AsZUFBZTt3QkFDZixTQUFTO3dCQUNULG9CQUFvQjtxQkFDckI7b0JBQ0QsT0FBTyxFQUFFO3dCQUNQLEVBQUUsRUFBRSxRQUFRO3FCQUNiO2lCQUNGLENBQUMsQ0FBQztnQkFFSCw2QkFBNkI7Z0JBQzdCLE1BQU0sUUFBUSxHQUFHLElBQUksR0FBRyxDQUN0QixNQUFNLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLEtBQVUsRUFBRSxFQUFFLENBQUMsQ0FBQyxLQUFLLENBQUMsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDLENBQ25ELENBQUM7Z0JBRUYsTUFBTSxlQUFlLEdBQUcsV0FBVyxDQUFDLEdBQUcsQ0FBQyxDQUFDLE1BQVcsRUFBRSxFQUFFLENBQUMsQ0FBQztvQkFDeEQsR0FBRyxNQUFNO29CQUNULEtBQUssRUFBRSxRQUFRLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxJQUFJO2lCQUM3QyxDQUFDLENBQUMsQ0FBQztnQkFFSixPQUFPLEdBQUcsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxDQUFDO29CQUMxQixjQUFjLEVBQUUsZUFBZTtvQkFDL0IsS0FBSyxFQUFFLGVBQWUsQ0FBQyxNQUFNO2lCQUM5QixDQUFDLENBQUM7WUFDTCxDQUFDO1FBQ0gsQ0FBQztRQUVELE9BQU8sR0FBRyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUM7WUFDMUIsY0FBYyxFQUFFLEVBQUU7WUFDbEIsS0FBSyxFQUFFLENBQUM7U0FDVCxDQUFDLENBQUM7SUFDTCxDQUFDO0lBQUMsT0FBTyxLQUFVLEVBQUUsQ0FBQztRQUNwQixPQUFPLENBQUMsS0FBSyxDQUFDLGdDQUFnQyxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBQ3ZELE9BQU8sR0FBRyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUM7WUFDMUIsS0FBSyxFQUFFLEtBQUssQ0FBQyxPQUFPLElBQUksZ0NBQWdDO1NBQ3pELENBQUMsQ0FBQztJQUNMLENBQUM7QUFDSCxDQUFDLENBQUM7QUFsRlcsUUFBQSxHQUFHLE9Ba0ZkIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodashventure/medusa-booking-for-pickup",
3
- "version": "1.4.18",
3
+ "version": "1.4.19",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",