@open-mercato/core 0.4.9-develop-ce96cffe00 → 0.4.9-develop-5d884303ad
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/modules/auth/lib/setup-app.js +17 -1
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +23 -12
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/shipping_carriers/api/cancel/route.js +5 -1
- package/dist/modules/shipping_carriers/api/cancel/route.js.map +2 -2
- package/dist/modules/shipping_carriers/api/points/route.js +59 -0
- package/dist/modules/shipping_carriers/api/points/route.js.map +7 -0
- package/dist/modules/shipping_carriers/api/providers/route.js +38 -0
- package/dist/modules/shipping_carriers/api/providers/route.js.map +7 -0
- package/dist/modules/shipping_carriers/backend/shipping-carriers/create/page.js +90 -0
- package/dist/modules/shipping_carriers/backend/shipping-carriers/create/page.js.map +7 -0
- package/dist/modules/shipping_carriers/backend/shipping-carriers/create/page.meta.js +8 -0
- package/dist/modules/shipping_carriers/backend/shipping-carriers/create/page.meta.js.map +7 -0
- package/dist/modules/shipping_carriers/data/validators.js +17 -2
- package/dist/modules/shipping_carriers/data/validators.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/AddressFields.js +76 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/AddressFields.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js +243 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfirmStep.js +134 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfirmStep.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js +70 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ProviderStep.js +32 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ProviderStep.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/WizardNav.js +37 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/WizardNav.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/shipmentApi.js +92 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/shipmentApi.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/useShipmentWizard.js +212 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/useShipmentWizard.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/types.js +1 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/types.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipping-service.js +36 -3
- package/dist/modules/shipping_carriers/lib/shipping-service.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/status-sync.js +7 -0
- package/dist/modules/shipping_carriers/lib/status-sync.js.map +2 -2
- package/package.json +7 -4
- package/src/modules/auth/lib/setup-app.ts +22 -0
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +17 -9
- package/src/modules/shipping_carriers/api/cancel/route.ts +5 -1
- package/src/modules/shipping_carriers/api/points/route.ts +57 -0
- package/src/modules/shipping_carriers/api/providers/route.ts +35 -0
- package/src/modules/shipping_carriers/backend/shipping-carriers/create/page.meta.ts +4 -0
- package/src/modules/shipping_carriers/backend/shipping-carriers/create/page.tsx +93 -0
- package/src/modules/shipping_carriers/data/validators.ts +15 -0
- package/src/modules/shipping_carriers/i18n/de.json +66 -0
- package/src/modules/shipping_carriers/i18n/en.json +66 -0
- package/src/modules/shipping_carriers/i18n/es.json +66 -0
- package/src/modules/shipping_carriers/i18n/pl.json +66 -0
- package/src/modules/shipping_carriers/lib/adapter.ts +20 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/AddressFields.tsx +72 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.tsx +343 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/ConfirmStep.tsx +213 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.tsx +82 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/ProviderStep.tsx +54 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/WizardNav.tsx +46 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/hooks/shipmentApi.ts +153 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/hooks/useShipmentWizard.ts +312 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/types.ts +76 -0
- package/src/modules/shipping_carriers/lib/shipping-service.ts +53 -3
- package/src/modules/shipping_carriers/lib/status-sync.ts +7 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
5
|
+
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
6
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@open-mercato/ui/primitives/card";
|
|
7
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
8
|
+
import { AddressFields } from "./AddressFields.js";
|
|
9
|
+
import { PackageEditor } from "./PackageEditor.js";
|
|
10
|
+
const LABEL_FORMATS = ["pdf", "zpl", "png"];
|
|
11
|
+
const ConfigureStep = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
origin,
|
|
14
|
+
destination,
|
|
15
|
+
packages,
|
|
16
|
+
labelFormat,
|
|
17
|
+
senderContact,
|
|
18
|
+
receiverContact,
|
|
19
|
+
targetPoint,
|
|
20
|
+
c2cSendingMethod,
|
|
21
|
+
isFetchingRates,
|
|
22
|
+
canProceed,
|
|
23
|
+
senderContactErrors,
|
|
24
|
+
receiverContactErrors,
|
|
25
|
+
dropOffPointQuery,
|
|
26
|
+
dropOffPoints,
|
|
27
|
+
isFetchingDropOffPoints,
|
|
28
|
+
dropOffPointsError,
|
|
29
|
+
onOriginChange,
|
|
30
|
+
onDestinationChange,
|
|
31
|
+
onPackagesChange,
|
|
32
|
+
onLabelFormatChange,
|
|
33
|
+
onSenderContactChange,
|
|
34
|
+
onReceiverContactChange,
|
|
35
|
+
onTargetPointChange,
|
|
36
|
+
onC2cSendingMethodChange,
|
|
37
|
+
onSearchDropOffPoints,
|
|
38
|
+
onBack,
|
|
39
|
+
onNext
|
|
40
|
+
} = props;
|
|
41
|
+
const t = useT();
|
|
42
|
+
const [searchInput, setSearchInput] = React.useState(dropOffPointQuery);
|
|
43
|
+
return /* @__PURE__ */ jsxs("section", { className: "space-y-6", children: [
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 lg:grid-cols-2", children: [
|
|
45
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.origin", "Origin address") }) }),
|
|
47
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(AddressFields, { prefix: "origin", address: origin, onChange: onOriginChange, disabled: isFetchingRates }) })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.destination", "Destination address") }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(AddressFields, { prefix: "dest", address: destination, onChange: onDestinationChange, disabled: isFetchingRates }) })
|
|
52
|
+
] })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
55
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.packages", "Packages") }) }),
|
|
56
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(PackageEditor, { packages, onChange: onPackagesChange, disabled: isFetchingRates }) })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 lg:grid-cols-2", children: [
|
|
59
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.senderContact", "Sender contact") }) }),
|
|
61
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
63
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t("shipping_carriers.create.field.phone", "Phone") }),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
"input",
|
|
66
|
+
{
|
|
67
|
+
className: `w-full rounded border bg-background px-2 py-1.5 text-sm ${senderContactErrors.phone ? "border-destructive" : ""}`,
|
|
68
|
+
type: "tel",
|
|
69
|
+
value: senderContact.phone,
|
|
70
|
+
onChange: (e) => onSenderContactChange({ ...senderContact, phone: e.target.value }),
|
|
71
|
+
disabled: isFetchingRates,
|
|
72
|
+
placeholder: "e.g. 500000000"
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
senderContactErrors.phone ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: senderContactErrors.phone }) : null
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t("shipping_carriers.create.field.email", "Email") }),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
"input",
|
|
81
|
+
{
|
|
82
|
+
className: `w-full rounded border bg-background px-2 py-1.5 text-sm ${senderContactErrors.email ? "border-destructive" : ""}`,
|
|
83
|
+
type: "email",
|
|
84
|
+
value: senderContact.email,
|
|
85
|
+
onChange: (e) => onSenderContactChange({ ...senderContact, email: e.target.value }),
|
|
86
|
+
disabled: isFetchingRates,
|
|
87
|
+
placeholder: "e.g. sender@example.com"
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
senderContactErrors.email ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: senderContactErrors.email }) : null
|
|
91
|
+
] })
|
|
92
|
+
] }) })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
95
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.receiverContact", "Receiver contact") }) }),
|
|
96
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
97
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
98
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t("shipping_carriers.create.field.phone", "Phone") }),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
"input",
|
|
101
|
+
{
|
|
102
|
+
className: `w-full rounded border bg-background px-2 py-1.5 text-sm ${receiverContactErrors.phone ? "border-destructive" : ""}`,
|
|
103
|
+
type: "tel",
|
|
104
|
+
value: receiverContact.phone,
|
|
105
|
+
onChange: (e) => onReceiverContactChange({ ...receiverContact, phone: e.target.value }),
|
|
106
|
+
disabled: isFetchingRates,
|
|
107
|
+
placeholder: "e.g. 500000000"
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
receiverContactErrors.phone ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: receiverContactErrors.phone }) : null
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
113
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t("shipping_carriers.create.field.email", "Email") }),
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
"input",
|
|
116
|
+
{
|
|
117
|
+
className: `w-full rounded border bg-background px-2 py-1.5 text-sm ${receiverContactErrors.email ? "border-destructive" : ""}`,
|
|
118
|
+
type: "email",
|
|
119
|
+
value: receiverContact.email,
|
|
120
|
+
onChange: (e) => onReceiverContactChange({ ...receiverContact, email: e.target.value }),
|
|
121
|
+
disabled: isFetchingRates,
|
|
122
|
+
placeholder: "e.g. receiver@example.com"
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
receiverContactErrors.email ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: receiverContactErrors.email }) : null
|
|
126
|
+
] })
|
|
127
|
+
] }) })
|
|
128
|
+
] })
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
131
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.c2cSendingMethod", "C2C sending method") }) }),
|
|
132
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
133
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t("shipping_carriers.create.field.c2cSendingMethod", "Sending method (applies to courier_c2c service only)") }),
|
|
134
|
+
/* @__PURE__ */ jsxs(
|
|
135
|
+
"select",
|
|
136
|
+
{
|
|
137
|
+
className: "w-full rounded border bg-background px-2 py-1.5 text-sm",
|
|
138
|
+
value: c2cSendingMethod,
|
|
139
|
+
onChange: (e) => onC2cSendingMethodChange(e.target.value),
|
|
140
|
+
disabled: isFetchingRates,
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsx("option", { value: "", children: t("shipping_carriers.create.c2cSendingMethod.default", "Dispatch order (default)") }),
|
|
143
|
+
/* @__PURE__ */ jsx("option", { value: "parcel_locker", children: t("shipping_carriers.create.c2cSendingMethod.parcel_locker", "Parcel locker") }),
|
|
144
|
+
/* @__PURE__ */ jsx("option", { value: "pop", children: t("shipping_carriers.create.c2cSendingMethod.pop", "POP (parcel pickup point)") }),
|
|
145
|
+
/* @__PURE__ */ jsx("option", { value: "any_point", children: t("shipping_carriers.create.c2cSendingMethod.any_point", "Any point") })
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
] }) })
|
|
150
|
+
] }),
|
|
151
|
+
(c2cSendingMethod === "parcel_locker" || c2cSendingMethod === "pop") && /* @__PURE__ */ jsxs(Card, { children: [
|
|
152
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.dropOffPoint", "Drop-off / locker point") }) }),
|
|
153
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
154
|
+
targetPoint && /* @__PURE__ */ jsxs("div", { className: "rounded border border-primary bg-primary/5 px-3 py-2 text-sm", children: [
|
|
155
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-xs text-muted-foreground mr-2", children: t("shipping_carriers.create.field.selectedPoint", "Selected:") }),
|
|
156
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: targetPoint }),
|
|
157
|
+
/* @__PURE__ */ jsx(
|
|
158
|
+
Button,
|
|
159
|
+
{
|
|
160
|
+
type: "button",
|
|
161
|
+
variant: "ghost",
|
|
162
|
+
size: "sm",
|
|
163
|
+
className: "ml-2 h-auto py-0 text-xs",
|
|
164
|
+
onClick: () => onTargetPointChange(""),
|
|
165
|
+
disabled: isFetchingRates,
|
|
166
|
+
children: t("shipping_carriers.create.action.clearPoint", "Clear")
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] }),
|
|
170
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
171
|
+
/* @__PURE__ */ jsx(
|
|
172
|
+
"input",
|
|
173
|
+
{
|
|
174
|
+
className: "flex-1 rounded border bg-background px-2 py-1.5 text-sm",
|
|
175
|
+
value: searchInput,
|
|
176
|
+
onChange: (e) => setSearchInput(e.target.value),
|
|
177
|
+
onKeyDown: (e) => {
|
|
178
|
+
if (e.key === "Enter") {
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
onSearchDropOffPoints(searchInput);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
disabled: isFetchingRates,
|
|
184
|
+
placeholder: t("shipping_carriers.create.field.dropOffSearch", "Postal code (e.g. 30-624) or point name (e.g. KRA012)")
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
Button,
|
|
189
|
+
{
|
|
190
|
+
type: "button",
|
|
191
|
+
variant: "outline",
|
|
192
|
+
size: "sm",
|
|
193
|
+
onClick: () => onSearchDropOffPoints(searchInput),
|
|
194
|
+
disabled: isFetchingRates || isFetchingDropOffPoints || searchInput.trim().length === 0,
|
|
195
|
+
children: isFetchingDropOffPoints ? /* @__PURE__ */ jsx(Spinner, { className: "h-4 w-4" }) : t("shipping_carriers.create.action.searchPoints", "Search")
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] }),
|
|
199
|
+
dropOffPointsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: dropOffPointsError }),
|
|
200
|
+
dropOffPoints.length > 0 && /* @__PURE__ */ jsx("ul", { className: "max-h-60 overflow-y-auto divide-y rounded border text-sm", children: dropOffPoints.map((point) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
201
|
+
"button",
|
|
202
|
+
{
|
|
203
|
+
type: "button",
|
|
204
|
+
className: `w-full px-3 py-2 text-left hover:bg-accent ${targetPoint === point.id ? "bg-primary/5 font-medium" : ""}`,
|
|
205
|
+
onClick: () => onTargetPointChange(point.id),
|
|
206
|
+
disabled: isFetchingRates,
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono mr-2", children: point.name }),
|
|
209
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: [point.street, point.city, point.postalCode].filter(Boolean).join(", ") })
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
) }, point.id)) }),
|
|
213
|
+
!isFetchingDropOffPoints && dropOffPoints.length === 0 && dropOffPointQuery && !dropOffPointsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("shipping_carriers.create.dropOffPoints.noResults", "No drop-off points found for this search.") })
|
|
214
|
+
] })
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
217
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.labelFormat", "Label format") }) }),
|
|
218
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: LABEL_FORMATS.map((fmt) => /* @__PURE__ */ jsx(
|
|
219
|
+
Button,
|
|
220
|
+
{
|
|
221
|
+
type: "button",
|
|
222
|
+
variant: labelFormat === fmt ? "default" : "outline",
|
|
223
|
+
size: "sm",
|
|
224
|
+
onClick: () => onLabelFormatChange(fmt),
|
|
225
|
+
disabled: isFetchingRates,
|
|
226
|
+
children: fmt.toUpperCase()
|
|
227
|
+
},
|
|
228
|
+
fmt
|
|
229
|
+
)) }) })
|
|
230
|
+
] }),
|
|
231
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between gap-3", children: [
|
|
232
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onBack, disabled: isFetchingRates, children: t("shipping_carriers.create.back", "Back") }),
|
|
233
|
+
/* @__PURE__ */ jsx(Button, { type: "button", onClick: onNext, disabled: !canProceed || isFetchingRates, children: isFetchingRates ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
234
|
+
/* @__PURE__ */ jsx(Spinner, { className: "mr-2 h-4 w-4" }),
|
|
235
|
+
t("shipping_carriers.create.fetchingRates", "Fetching rates...")
|
|
236
|
+
] }) : t("shipping_carriers.create.getQuotes", "Get quotes") })
|
|
237
|
+
] })
|
|
238
|
+
] });
|
|
239
|
+
};
|
|
240
|
+
export {
|
|
241
|
+
ConfigureStep
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=ConfigureStep.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { Card, CardContent, CardHeader, CardTitle } from '@open-mercato/ui/primitives/card'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { AddressFields } from './AddressFields'\nimport { PackageEditor } from './PackageEditor'\nimport type { Address, PackageDimension, LabelFormat, ContactInfo, DropOffPoint } from '../types'\n\nexport type ConfigureStepProps = {\n origin: Address\n destination: Address\n packages: PackageDimension[]\n labelFormat: LabelFormat\n senderContact: ContactInfo\n receiverContact: ContactInfo\n targetPoint: string\n c2cSendingMethod: string\n isFetchingRates: boolean\n canProceed: boolean\n senderContactErrors: { email: string | null; phone: string | null }\n receiverContactErrors: { email: string | null; phone: string | null }\n dropOffPointQuery: string\n dropOffPoints: DropOffPoint[]\n isFetchingDropOffPoints: boolean\n dropOffPointsError: string | null\n onOriginChange: (address: Address) => void\n onDestinationChange: (address: Address) => void\n onPackagesChange: (packages: PackageDimension[]) => void\n onLabelFormatChange: (format: LabelFormat) => void\n onSenderContactChange: (contact: ContactInfo) => void\n onReceiverContactChange: (contact: ContactInfo) => void\n onTargetPointChange: (point: string) => void\n onC2cSendingMethodChange: (method: string) => void\n onSearchDropOffPoints: (query: string) => void\n onBack: () => void\n onNext: () => void\n}\n\nconst LABEL_FORMATS: LabelFormat[] = ['pdf', 'zpl', 'png']\n\nexport const ConfigureStep = (props: ConfigureStepProps) => {\n const {\n origin, destination, packages, labelFormat,\n senderContact, receiverContact, targetPoint, c2cSendingMethod,\n isFetchingRates, canProceed,\n senderContactErrors, receiverContactErrors,\n dropOffPointQuery, dropOffPoints, isFetchingDropOffPoints, dropOffPointsError,\n onOriginChange, onDestinationChange, onPackagesChange, onLabelFormatChange,\n onSenderContactChange, onReceiverContactChange, onTargetPointChange, onC2cSendingMethodChange,\n onSearchDropOffPoints,\n onBack, onNext,\n } = props\n const t = useT()\n const [searchInput, setSearchInput] = React.useState(dropOffPointQuery)\n\n return (\n <section className=\"space-y-6\">\n <div className=\"grid gap-6 lg:grid-cols-2\">\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.origin', 'Origin address')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <AddressFields prefix=\"origin\" address={origin} onChange={onOriginChange} disabled={isFetchingRates} />\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.destination', 'Destination address')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <AddressFields prefix=\"dest\" address={destination} onChange={onDestinationChange} disabled={isFetchingRates} />\n </CardContent>\n </Card>\n </div>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.packages', 'Packages')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <PackageEditor packages={packages} onChange={onPackagesChange} disabled={isFetchingRates} />\n </CardContent>\n </Card>\n\n <div className=\"grid gap-6 lg:grid-cols-2\">\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.senderContact', 'Sender contact')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"grid gap-4 sm:grid-cols-2\">\n <div className=\"space-y-1\">\n <label className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.field.phone', 'Phone')}\n </label>\n <input\n className={`w-full rounded border bg-background px-2 py-1.5 text-sm ${senderContactErrors.phone ? 'border-destructive' : ''}`}\n type=\"tel\"\n value={senderContact.phone}\n onChange={(e) => onSenderContactChange({ ...senderContact, phone: e.target.value })}\n disabled={isFetchingRates}\n placeholder=\"e.g. 500000000\"\n />\n {senderContactErrors.phone ? (\n <p className=\"text-xs text-destructive\">{senderContactErrors.phone}</p>\n ) : null}\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.field.email', 'Email')}\n </label>\n <input\n className={`w-full rounded border bg-background px-2 py-1.5 text-sm ${senderContactErrors.email ? 'border-destructive' : ''}`}\n type=\"email\"\n value={senderContact.email}\n onChange={(e) => onSenderContactChange({ ...senderContact, email: e.target.value })}\n disabled={isFetchingRates}\n placeholder=\"e.g. sender@example.com\"\n />\n {senderContactErrors.email ? (\n <p className=\"text-xs text-destructive\">{senderContactErrors.email}</p>\n ) : null}\n </div>\n </div>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.receiverContact', 'Receiver contact')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"grid gap-4 sm:grid-cols-2\">\n <div className=\"space-y-1\">\n <label className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.field.phone', 'Phone')}\n </label>\n <input\n className={`w-full rounded border bg-background px-2 py-1.5 text-sm ${receiverContactErrors.phone ? 'border-destructive' : ''}`}\n type=\"tel\"\n value={receiverContact.phone}\n onChange={(e) => onReceiverContactChange({ ...receiverContact, phone: e.target.value })}\n disabled={isFetchingRates}\n placeholder=\"e.g. 500000000\"\n />\n {receiverContactErrors.phone ? (\n <p className=\"text-xs text-destructive\">{receiverContactErrors.phone}</p>\n ) : null}\n </div>\n <div className=\"space-y-1\">\n <label className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.field.email', 'Email')}\n </label>\n <input\n className={`w-full rounded border bg-background px-2 py-1.5 text-sm ${receiverContactErrors.email ? 'border-destructive' : ''}`}\n type=\"email\"\n value={receiverContact.email}\n onChange={(e) => onReceiverContactChange({ ...receiverContact, email: e.target.value })}\n disabled={isFetchingRates}\n placeholder=\"e.g. receiver@example.com\"\n />\n {receiverContactErrors.email ? (\n <p className=\"text-xs text-destructive\">{receiverContactErrors.email}</p>\n ) : null}\n </div>\n </div>\n </CardContent>\n </Card>\n </div>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.c2cSendingMethod', 'C2C sending method')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"space-y-1\">\n <label className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.field.c2cSendingMethod', 'Sending method (applies to courier_c2c service only)')}\n </label>\n <select\n className=\"w-full rounded border bg-background px-2 py-1.5 text-sm\"\n value={c2cSendingMethod}\n onChange={(e) => onC2cSendingMethodChange(e.target.value)}\n disabled={isFetchingRates}\n >\n <option value=\"\">{t('shipping_carriers.create.c2cSendingMethod.default', 'Dispatch order (default)')}</option>\n <option value=\"parcel_locker\">{t('shipping_carriers.create.c2cSendingMethod.parcel_locker', 'Parcel locker')}</option>\n <option value=\"pop\">{t('shipping_carriers.create.c2cSendingMethod.pop', 'POP (parcel pickup point)')}</option>\n <option value=\"any_point\">{t('shipping_carriers.create.c2cSendingMethod.any_point', 'Any point')}</option>\n </select>\n </div>\n </CardContent>\n </Card>\n\n {(c2cSendingMethod === 'parcel_locker' || c2cSendingMethod === 'pop') && (\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.dropOffPoint', 'Drop-off / locker point')}\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {targetPoint && (\n <div className=\"rounded border border-primary bg-primary/5 px-3 py-2 text-sm\">\n <span className=\"font-medium text-xs text-muted-foreground mr-2\">\n {t('shipping_carriers.create.field.selectedPoint', 'Selected:')}\n </span>\n <span className=\"font-mono font-medium\">{targetPoint}</span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"ml-2 h-auto py-0 text-xs\"\n onClick={() => onTargetPointChange('')}\n disabled={isFetchingRates}\n >\n {t('shipping_carriers.create.action.clearPoint', 'Clear')}\n </Button>\n </div>\n )}\n\n <div className=\"flex gap-2\">\n <input\n className=\"flex-1 rounded border bg-background px-2 py-1.5 text-sm\"\n value={searchInput}\n onChange={(e) => setSearchInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault()\n onSearchDropOffPoints(searchInput)\n }\n }}\n disabled={isFetchingRates}\n placeholder={t('shipping_carriers.create.field.dropOffSearch', 'Postal code (e.g. 30-624) or point name (e.g. KRA012)')}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => onSearchDropOffPoints(searchInput)}\n disabled={isFetchingRates || isFetchingDropOffPoints || searchInput.trim().length === 0}\n >\n {isFetchingDropOffPoints ? (\n <Spinner className=\"h-4 w-4\" />\n ) : (\n t('shipping_carriers.create.action.searchPoints', 'Search')\n )}\n </Button>\n </div>\n\n {dropOffPointsError && (\n <p className=\"text-xs text-destructive\">{dropOffPointsError}</p>\n )}\n\n {dropOffPoints.length > 0 && (\n <ul className=\"max-h-60 overflow-y-auto divide-y rounded border text-sm\">\n {dropOffPoints.map((point) => (\n <li key={point.id}>\n <button\n type=\"button\"\n className={`w-full px-3 py-2 text-left hover:bg-accent ${targetPoint === point.id ? 'bg-primary/5 font-medium' : ''}`}\n onClick={() => onTargetPointChange(point.id)}\n disabled={isFetchingRates}\n >\n <span className=\"font-mono mr-2\">{point.name}</span>\n <span className=\"text-muted-foreground text-xs\">\n {[point.street, point.city, point.postalCode].filter(Boolean).join(', ')}\n </span>\n </button>\n </li>\n ))}\n </ul>\n )}\n\n {!isFetchingDropOffPoints && dropOffPoints.length === 0 && dropOffPointQuery && !dropOffPointsError && (\n <p className=\"text-xs text-muted-foreground\">\n {t('shipping_carriers.create.dropOffPoints.noResults', 'No drop-off points found for this search.')}\n </p>\n )}\n </CardContent>\n </Card>\n )}\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.labelFormat', 'Label format')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"flex gap-3\">\n {LABEL_FORMATS.map((fmt) => (\n <Button\n key={fmt}\n type=\"button\"\n variant={labelFormat === fmt ? 'default' : 'outline'}\n size=\"sm\"\n onClick={() => onLabelFormatChange(fmt)}\n disabled={isFetchingRates}\n >\n {fmt.toUpperCase()}\n </Button>\n ))}\n </div>\n </CardContent>\n </Card>\n\n <div className=\"flex justify-between gap-3\">\n <Button type=\"button\" variant=\"outline\" onClick={onBack} disabled={isFetchingRates}>\n {t('shipping_carriers.create.back', 'Back')}\n </Button>\n <Button type=\"button\" onClick={onNext} disabled={!canProceed || isFetchingRates}>\n {isFetchingRates ? (\n <>\n <Spinner className=\"mr-2 h-4 w-4\" />\n {t('shipping_carriers.create.fetchingRates', 'Fetching rates...')}\n </>\n ) : (\n t('shipping_carriers.create.getQuotes', 'Get quotes')\n )}\n </Button>\n </div>\n </section>\n )\n}\n\n"],
|
|
5
|
+
"mappings": ";AA6DQ,SA6QI,UA3QA,KAFJ;AA3DR,YAAY,WAAW;AACvB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,MAAM,aAAa,YAAY,iBAAiB;AACzD,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAiC9B,MAAM,gBAA+B,CAAC,OAAO,OAAO,KAAK;AAElD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,GAAG;AAAA,UACtC,UAAU;AAAA,UAET,cAAI,YAAY;AAAA;AAAA,QAPZ;AAAA,MAQP,CACD,GACH,GACF;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,8BACb;AAAA,0BAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,SAAS,QAAQ,UAAU,iBAChE,YAAE,iCAAiC,MAAM,GAC5C;AAAA,MACA,oBAAC,UAAO,MAAK,UAAS,SAAS,QAAQ,UAAU,CAAC,cAAc,iBAC7D,4BACC,iCACE;AAAA,4BAAC,WAAQ,WAAU,gBAAe;AAAA,QACjC,EAAE,0CAA0C,mBAAmB;AAAA,SAClE,IAEA,EAAE,sCAAsC,YAAY,GAExD;AAAA,OACF;AAAA,KACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
4
|
+
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
5
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@open-mercato/ui/primitives/card";
|
|
6
|
+
import { Badge } from "@open-mercato/ui/primitives/badge";
|
|
7
|
+
import { ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
8
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
9
|
+
import { Package, CheckCircle2 } from "lucide-react";
|
|
10
|
+
const formatAddress = (addr) => [addr.line1, addr.city, addr.postalCode, addr.countryCode].filter(Boolean).join(", ");
|
|
11
|
+
const ConfirmStep = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
rates,
|
|
14
|
+
ratesError,
|
|
15
|
+
selectedRate,
|
|
16
|
+
selectedProvider,
|
|
17
|
+
origin,
|
|
18
|
+
destination,
|
|
19
|
+
packages,
|
|
20
|
+
labelFormat,
|
|
21
|
+
senderContact,
|
|
22
|
+
receiverContact,
|
|
23
|
+
targetPoint,
|
|
24
|
+
c2cSendingMethod,
|
|
25
|
+
isSubmitting,
|
|
26
|
+
onRateSelect,
|
|
27
|
+
onBack,
|
|
28
|
+
onSubmit
|
|
29
|
+
} = props;
|
|
30
|
+
const t = useT();
|
|
31
|
+
return /* @__PURE__ */ jsxs("section", { className: "space-y-6", children: [
|
|
32
|
+
ratesError ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(ErrorMessage, { label: ratesError }),
|
|
34
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onBack, children: t("shipping_carriers.create.action.editConfiguration", "Edit configuration") })
|
|
35
|
+
] }) : null,
|
|
36
|
+
rates.length === 0 && !ratesError ? /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "py-8 text-center text-sm text-muted-foreground", children: t("shipping_carriers.create.noRates", "No rates available for this route and package configuration.") }) }) : /* @__PURE__ */ jsxs(Card, { children: [
|
|
37
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.selectRate", "Select service") }) }),
|
|
38
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "space-y-2", children: rates.map((rate) => {
|
|
39
|
+
const isSelected = selectedRate?.serviceCode === rate.serviceCode;
|
|
40
|
+
return /* @__PURE__ */ jsxs(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
className: `flex w-full cursor-pointer items-center justify-between rounded-lg border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${isSelected ? "border-primary bg-primary/5" : "hover:bg-muted/50"}`,
|
|
45
|
+
onClick: () => onRateSelect(rate),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Package, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
50
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium", children: rate.serviceName }),
|
|
51
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: rate.serviceCode })
|
|
52
|
+
] })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
55
|
+
rate.estimatedDays !== void 0 ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("shipping_carriers.create.estimatedDays", "{days} day(s)", { days: rate.estimatedDays }) }) : null,
|
|
56
|
+
/* @__PURE__ */ jsxs(Badge, { variant: "secondary", children: [
|
|
57
|
+
rate.amount.toFixed(2),
|
|
58
|
+
" ",
|
|
59
|
+
rate.currencyCode
|
|
60
|
+
] }),
|
|
61
|
+
isSelected ? /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 text-primary" }) : null
|
|
62
|
+
] })
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
rate.serviceCode
|
|
66
|
+
);
|
|
67
|
+
}) }) })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: t("shipping_carriers.create.section.summary", "Summary") }) }),
|
|
71
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("dl", { className: "grid gap-2 text-sm sm:grid-cols-2", children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
73
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.carrier", "Carrier") }),
|
|
74
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5 capitalize", children: selectedProvider.replace(/_/g, " ") })
|
|
75
|
+
] }),
|
|
76
|
+
selectedRate ? /* @__PURE__ */ jsxs("div", { children: [
|
|
77
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.service", "Service") }),
|
|
78
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: selectedRate.serviceName })
|
|
79
|
+
] }) : null,
|
|
80
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
81
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.from", "From") }),
|
|
82
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: formatAddress(origin) })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
85
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.to", "To") }),
|
|
86
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: formatAddress(destination) })
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
89
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.packages", "Packages") }),
|
|
90
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: packages.length })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
93
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.labelFormat", "Label format") }),
|
|
94
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5 uppercase", children: labelFormat })
|
|
95
|
+
] }),
|
|
96
|
+
senderContact.phone || senderContact.email ? /* @__PURE__ */ jsxs("div", { children: [
|
|
97
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.senderContact", "Sender contact") }),
|
|
98
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: [senderContact.phone, senderContact.email].filter(Boolean).join(" / ") })
|
|
99
|
+
] }) : null,
|
|
100
|
+
receiverContact.phone || receiverContact.email ? /* @__PURE__ */ jsxs("div", { children: [
|
|
101
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.receiverContact", "Receiver contact") }),
|
|
102
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: [receiverContact.phone, receiverContact.email].filter(Boolean).join(" / ") })
|
|
103
|
+
] }) : null,
|
|
104
|
+
targetPoint ? /* @__PURE__ */ jsxs("div", { children: [
|
|
105
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.targetPoint", "Locker point") }),
|
|
106
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: targetPoint })
|
|
107
|
+
] }) : null,
|
|
108
|
+
c2cSendingMethod ? /* @__PURE__ */ jsxs("div", { children: [
|
|
109
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: t("shipping_carriers.create.summary.c2cSendingMethod", "C2C sending method") }),
|
|
110
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5", children: c2cSendingMethod })
|
|
111
|
+
] }) : null
|
|
112
|
+
] }) })
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between gap-3", children: [
|
|
115
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onBack, disabled: isSubmitting, children: t("shipping_carriers.create.back", "Back") }),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
Button,
|
|
118
|
+
{
|
|
119
|
+
type: "button",
|
|
120
|
+
onClick: onSubmit,
|
|
121
|
+
disabled: !selectedRate || isSubmitting,
|
|
122
|
+
children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
123
|
+
/* @__PURE__ */ jsx(Spinner, { className: "mr-2 h-4 w-4" }),
|
|
124
|
+
t("shipping_carriers.create.submitting", "Creating shipment...")
|
|
125
|
+
] }) : t("shipping_carriers.create.submit", "Create shipment")
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] })
|
|
129
|
+
] });
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
ConfirmStep
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=ConfirmStep.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/shipping_carriers/lib/shipment-wizard/components/ConfirmStep.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { Card, CardContent, CardHeader, CardTitle } from '@open-mercato/ui/primitives/card'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Package, CheckCircle2 } from 'lucide-react'\nimport type { Address, PackageDimension, ShippingRate, LabelFormat, ContactInfo } from '../types'\n\nexport type ConfirmStepProps = {\n rates: ShippingRate[]\n ratesError: string | null\n selectedRate: ShippingRate | null\n selectedProvider: string\n origin: Address\n destination: Address\n packages: PackageDimension[]\n labelFormat: LabelFormat\n senderContact: ContactInfo\n receiverContact: ContactInfo\n targetPoint: string\n c2cSendingMethod: string\n isSubmitting: boolean\n onRateSelect: (rate: ShippingRate) => void\n onBack: () => void\n onSubmit: () => void\n}\n\nconst formatAddress = (addr: Address) =>\n [addr.line1, addr.city, addr.postalCode, addr.countryCode].filter(Boolean).join(', ')\n\nexport const ConfirmStep = (props: ConfirmStepProps) => {\n const {\n rates, ratesError, selectedRate, selectedProvider,\n origin, destination, packages, labelFormat,\n senderContact, receiverContact, targetPoint, c2cSendingMethod,\n isSubmitting, onRateSelect, onBack, onSubmit,\n } = props\n const t = useT()\n\n return (\n <section className=\"space-y-6\">\n {ratesError ? (\n <div className=\"space-y-3\">\n <ErrorMessage label={ratesError} />\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={onBack}>\n {t('shipping_carriers.create.action.editConfiguration', 'Edit configuration')}\n </Button>\n </div>\n ) : null}\n\n {rates.length === 0 && !ratesError ? (\n <Card>\n <CardContent className=\"py-8 text-center text-sm text-muted-foreground\">\n {t('shipping_carriers.create.noRates', 'No rates available for this route and package configuration.')}\n </CardContent>\n </Card>\n ) : (\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.selectRate', 'Select service')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"space-y-2\">\n {rates.map((rate) => {\n const isSelected = selectedRate?.serviceCode === rate.serviceCode\n return (\n <button\n key={rate.serviceCode}\n type=\"button\"\n className={`flex w-full cursor-pointer items-center justify-between rounded-lg border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${\n isSelected ? 'border-primary bg-primary/5' : 'hover:bg-muted/50'\n }`}\n onClick={() => onRateSelect(rate)}\n >\n <div className=\"flex items-center gap-3\">\n <Package className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div>\n <p className=\"font-medium\">{rate.serviceName}</p>\n <p className=\"text-xs text-muted-foreground\">{rate.serviceCode}</p>\n </div>\n </div>\n <div className=\"flex items-center gap-3\">\n {rate.estimatedDays !== undefined ? (\n <span className=\"text-xs text-muted-foreground\">\n {t('shipping_carriers.create.estimatedDays', '{days} day(s)', { days: rate.estimatedDays })}\n </span>\n ) : null}\n <Badge variant=\"secondary\">\n {rate.amount.toFixed(2)} {rate.currencyCode}\n </Badge>\n {isSelected ? <CheckCircle2 className=\"h-4 w-4 text-primary\" /> : null}\n </div>\n </button>\n )\n })}\n </div>\n </CardContent>\n </Card>\n )}\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">\n {t('shipping_carriers.create.section.summary', 'Summary')}\n </CardTitle>\n </CardHeader>\n <CardContent>\n <dl className=\"grid gap-2 text-sm sm:grid-cols-2\">\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.carrier', 'Carrier')}\n </dt>\n <dd className=\"mt-0.5 capitalize\">{selectedProvider.replace(/_/g, ' ')}</dd>\n </div>\n {selectedRate ? (\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.service', 'Service')}\n </dt>\n <dd className=\"mt-0.5\">{selectedRate.serviceName}</dd>\n </div>\n ) : null}\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.from', 'From')}\n </dt>\n <dd className=\"mt-0.5\">{formatAddress(origin)}</dd>\n </div>\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.to', 'To')}\n </dt>\n <dd className=\"mt-0.5\">{formatAddress(destination)}</dd>\n </div>\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.packages', 'Packages')}\n </dt>\n <dd className=\"mt-0.5\">{packages.length}</dd>\n </div>\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.labelFormat', 'Label format')}\n </dt>\n <dd className=\"mt-0.5 uppercase\">{labelFormat}</dd>\n </div>\n {(senderContact.phone || senderContact.email) ? (\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.senderContact', 'Sender contact')}\n </dt>\n <dd className=\"mt-0.5\">\n {[senderContact.phone, senderContact.email].filter(Boolean).join(' / ')}\n </dd>\n </div>\n ) : null}\n {(receiverContact.phone || receiverContact.email) ? (\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.receiverContact', 'Receiver contact')}\n </dt>\n <dd className=\"mt-0.5\">\n {[receiverContact.phone, receiverContact.email].filter(Boolean).join(' / ')}\n </dd>\n </div>\n ) : null}\n {targetPoint ? (\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.targetPoint', 'Locker point')}\n </dt>\n <dd className=\"mt-0.5\">{targetPoint}</dd>\n </div>\n ) : null}\n {c2cSendingMethod ? (\n <div>\n <dt className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {t('shipping_carriers.create.summary.c2cSendingMethod', 'C2C sending method')}\n </dt>\n <dd className=\"mt-0.5\">{c2cSendingMethod}</dd>\n </div>\n ) : null}\n </dl>\n </CardContent>\n </Card>\n\n <div className=\"flex justify-between gap-3\">\n <Button type=\"button\" variant=\"outline\" onClick={onBack} disabled={isSubmitting}>\n {t('shipping_carriers.create.back', 'Back')}\n </Button>\n <Button\n type=\"button\"\n onClick={onSubmit}\n disabled={!selectedRate || isSubmitting}\n >\n {isSubmitting ? (\n <>\n <Spinner className=\"mr-2 h-4 w-4\" />\n {t('shipping_carriers.create.submitting', 'Creating shipment...')}\n </>\n ) : (\n t('shipping_carriers.create.submit', 'Create shipment')\n )}\n </Button>\n </div>\n </section>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA6CQ,SA4JI,UA3JF,KADF;AA3CR,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,MAAM,aAAa,YAAY,iBAAiB;AACzD,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AACrB,SAAS,SAAS,oBAAoB;AAsBtC,MAAM,gBAAgB,CAAC,SACrB,CAAC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AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,UAAU,CAAC,gBAAgB;AAAA,UAE1B,yBACC,iCACE;AAAA,gCAAC,WAAQ,WAAU,gBAAe;AAAA,YACjC,EAAE,uCAAuC,sBAAsB;AAAA,aAClE,IAEA,EAAE,mCAAmC,iBAAiB;AAAA;AAAA,MAE1D;AAAA,OACF;AAAA,KACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
4
|
+
import { Input } from "@open-mercato/ui/primitives/input";
|
|
5
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
6
|
+
const PACKAGE_FIELDS = ["weightKg", "lengthCm", "widthCm", "heightCm"];
|
|
7
|
+
const DEFAULT_PACKAGE = { weightKg: 1, lengthCm: 20, widthCm: 15, heightCm: 10 };
|
|
8
|
+
const PackageEditor = (props) => {
|
|
9
|
+
const { packages, onChange, disabled } = props;
|
|
10
|
+
const t = useT();
|
|
11
|
+
const fieldLabel = (field) => {
|
|
12
|
+
const labels = {
|
|
13
|
+
weightKg: t("shipping_carriers.create.package.weightKg", "Weight (kg)"),
|
|
14
|
+
lengthCm: t("shipping_carriers.create.package.lengthCm", "Length (cm)"),
|
|
15
|
+
widthCm: t("shipping_carriers.create.package.widthCm", "Width (cm)"),
|
|
16
|
+
heightCm: t("shipping_carriers.create.package.heightCm", "Height (cm)")
|
|
17
|
+
};
|
|
18
|
+
return labels[field];
|
|
19
|
+
};
|
|
20
|
+
const updatePackage = (index, field, raw) => {
|
|
21
|
+
const value = parseFloat(raw);
|
|
22
|
+
onChange(packages.map(
|
|
23
|
+
(pkg, idx) => idx === index ? { ...pkg, [field]: Number.isNaN(value) ? 0 : value } : pkg
|
|
24
|
+
));
|
|
25
|
+
};
|
|
26
|
+
const addPackage = () => onChange([...packages, DEFAULT_PACKAGE]);
|
|
27
|
+
const removePackage = (index) => onChange(packages.filter((_, idx) => idx !== index));
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
29
|
+
packages.map((pkg, index) => /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-muted/20 p-3", children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-muted-foreground", children: [
|
|
32
|
+
t("shipping_carriers.create.package.label", "Package"),
|
|
33
|
+
" ",
|
|
34
|
+
index + 1
|
|
35
|
+
] }),
|
|
36
|
+
packages.length > 1 ? /* @__PURE__ */ jsx(
|
|
37
|
+
Button,
|
|
38
|
+
{
|
|
39
|
+
type: "button",
|
|
40
|
+
variant: "ghost",
|
|
41
|
+
size: "sm",
|
|
42
|
+
className: "h-auto px-2 py-0.5 text-xs text-red-600 hover:text-red-700",
|
|
43
|
+
onClick: () => removePackage(index),
|
|
44
|
+
disabled,
|
|
45
|
+
children: t("shipping_carriers.create.package.remove", "Remove")
|
|
46
|
+
}
|
|
47
|
+
) : null
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-3 sm:grid-cols-4", children: PACKAGE_FIELDS.map((field) => /* @__PURE__ */ jsxs("div", { children: [
|
|
50
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-xs font-medium text-muted-foreground", children: fieldLabel(field) }),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
Input,
|
|
53
|
+
{
|
|
54
|
+
type: "number",
|
|
55
|
+
min: "0.01",
|
|
56
|
+
step: "0.01",
|
|
57
|
+
value: pkg[field],
|
|
58
|
+
onChange: (event) => updatePackage(index, field, event.target.value),
|
|
59
|
+
disabled
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] }, field)) })
|
|
63
|
+
] }, index)),
|
|
64
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: addPackage, disabled, children: t("shipping_carriers.create.package.add", "+ Add package") })
|
|
65
|
+
] });
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
PackageEditor
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=PackageEditor.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { PackageDimension, PackageEditorProps } from '../types'\n\nconst PACKAGE_FIELDS = ['weightKg', 'lengthCm', 'widthCm', 'heightCm'] as const\n\nconst DEFAULT_PACKAGE: PackageDimension = { weightKg: 1, lengthCm: 20, widthCm: 15, heightCm: 10 }\n\nexport const PackageEditor = (props: PackageEditorProps) => {\n const { packages, onChange, disabled } = props\n const t = useT()\n\n const fieldLabel = (field: keyof PackageDimension) => {\n const labels: Record<keyof PackageDimension, string> = {\n weightKg: t('shipping_carriers.create.package.weightKg', 'Weight (kg)'),\n lengthCm: t('shipping_carriers.create.package.lengthCm', 'Length (cm)'),\n widthCm: t('shipping_carriers.create.package.widthCm', 'Width (cm)'),\n heightCm: t('shipping_carriers.create.package.heightCm', 'Height (cm)'),\n }\n return labels[field]\n }\n\n const updatePackage = (index: number, field: keyof PackageDimension, raw: string) => {\n const value = parseFloat(raw)\n onChange(packages.map((pkg, idx) =>\n idx === index ? { ...pkg, [field]: Number.isNaN(value) ? 0 : value } : pkg,\n ))\n }\n\n const addPackage = () => onChange([...packages, DEFAULT_PACKAGE])\n\n const removePackage = (index: number) => onChange(packages.filter((_, idx) => idx !== index))\n\n return (\n <div className=\"space-y-3\">\n {packages.map((pkg, index) => (\n <div key={index} className=\"rounded-lg border bg-muted/20 p-3\">\n <div className=\"mb-2 flex items-center justify-between\">\n <span className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.package.label', 'Package')} {index + 1}\n </span>\n {packages.length > 1 ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-auto px-2 py-0.5 text-xs text-red-600 hover:text-red-700\"\n onClick={() => removePackage(index)}\n disabled={disabled}\n >\n {t('shipping_carriers.create.package.remove', 'Remove')}\n </Button>\n ) : null}\n </div>\n <div className=\"grid gap-3 sm:grid-cols-4\">\n {PACKAGE_FIELDS.map((field) => (\n <div key={field}>\n <label className=\"mb-1 block text-xs font-medium text-muted-foreground\">\n {fieldLabel(field)}\n </label>\n <Input\n type=\"number\"\n min=\"0.01\"\n step=\"0.01\"\n value={pkg[field]}\n onChange={(event) => updatePackage(index, field, event.target.value)}\n disabled={disabled}\n />\n </div>\n ))}\n </div>\n </div>\n ))}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={addPackage} disabled={disabled}>\n {t('shipping_carriers.create.package.add', '+ Add package')}\n </Button>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAyCY,SAIE,KAJF;AAvCZ,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,YAAY;AAGrB,MAAM,iBAAiB,CAAC,YAAY,YAAY,WAAW,UAAU;AAErE,MAAM,kBAAoC,EAAE,UAAU,GAAG,UAAU,IAAI,SAAS,IAAI,UAAU,GAAG;AAE1F,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,EAAE,UAAU,UAAU,SAAS,IAAI;AACzC,QAAM,IAAI,KAAK;AAEf,QAAM,aAAa,CAAC,UAAkC;AACpD,UAAM,SAAiD;AAAA,MACrD,UAAU,EAAE,6CAA6C,aAAa;AAAA,MACtE,UAAU,EAAE,6CAA6C,aAAa;AAAA,MACtE,SAAS,EAAE,4CAA4C,YAAY;AA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AAM,OAAO,KAAK;AAAA,YACnE;AAAA;AAAA,QACF;AAAA,WAXQ,KAYV,CACD,GACH;AAAA,SAlCQ,KAmCV,CACD;AAAA,IACD,oBAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,MAAK,MAAK,SAAS,YAAY,UACpE,YAAE,wCAAwC,eAAe,GAC5D;AAAA,KACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { match, P } from "ts-pattern";
|
|
4
|
+
import { Card, CardContent } from "@open-mercato/ui/primitives/card";
|
|
5
|
+
import { ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
6
|
+
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
7
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
8
|
+
import { Truck } from "lucide-react";
|
|
9
|
+
const ProviderStep = (props) => {
|
|
10
|
+
const { providers, onSelect } = props;
|
|
11
|
+
const t = useT();
|
|
12
|
+
return match(props).with({ isLoading: true }, () => /* @__PURE__ */ jsx("div", { className: "flex justify-center py-8", children: /* @__PURE__ */ jsx(Spinner, {}) })).with({ error: P.string }, ({ error }) => /* @__PURE__ */ jsx(ErrorMessage, { label: error })).with({ providers: [] }, () => /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "py-8 text-center text-sm text-muted-foreground", children: t("shipping_carriers.create.noProviders", "No shipping providers are configured. Enable a carrier integration first.") }) })).otherwise(() => /* @__PURE__ */ jsx("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: providers.map((provider) => /* @__PURE__ */ jsxs(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
type: "button",
|
|
16
|
+
className: "flex cursor-pointer items-center gap-3 rounded-lg border bg-card p-4 text-left transition-colors hover:border-primary hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
17
|
+
onClick: () => onSelect(provider.providerKey),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Truck, { className: "h-6 w-6 shrink-0 text-muted-foreground" }),
|
|
20
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium capitalize", children: provider.providerKey.replace(/_/g, " ") }),
|
|
22
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: provider.providerKey })
|
|
23
|
+
] })
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
provider.providerKey
|
|
27
|
+
)) }));
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
ProviderStep
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=ProviderStep.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/shipping_carriers/lib/shipment-wizard/components/ProviderStep.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport { match, P } from 'ts-pattern'\nimport { Card, CardContent } from '@open-mercato/ui/primitives/card'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Truck } from 'lucide-react'\nimport type { Provider } from '../types'\n\nexport type ProviderStepProps = {\n isLoading: boolean\n error: string | null\n providers: Provider[]\n onSelect: (providerKey: string) => void\n}\n\nexport const ProviderStep = (props: ProviderStepProps) => {\n const { providers, onSelect } = props\n const t = useT()\n\n return match(props)\n .with({ isLoading: true }, () => (\n <div className=\"flex justify-center py-8\"><Spinner /></div>\n ))\n .with({ error: P.string }, ({ error }) => (\n <ErrorMessage label={error} />\n ))\n .with({ providers: [] }, () => (\n <Card>\n <CardContent className=\"py-8 text-center text-sm text-muted-foreground\">\n {t('shipping_carriers.create.noProviders', 'No shipping providers are configured. Enable a carrier integration first.')}\n </CardContent>\n </Card>\n ))\n .otherwise(() => (\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {providers.map((provider) => (\n <button\n key={provider.providerKey}\n type=\"button\"\n className=\"flex cursor-pointer items-center gap-3 rounded-lg border bg-card p-4 text-left transition-colors hover:border-primary hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={() => onSelect(provider.providerKey)}\n >\n <Truck className=\"h-6 w-6 shrink-0 text-muted-foreground\" />\n <div>\n <p className=\"font-medium capitalize\">{provider.providerKey.replace(/_/g, ' ')}</p>\n <p className=\"text-xs text-muted-foreground\">{provider.providerKey}</p>\n </div>\n </button>\n ))}\n </div>\n ))\n}\n"],
|
|
5
|
+
"mappings": ";AAuBgD,cAsBpC,YAtBoC;AArBhD,SAAS,OAAO,SAAS;AACzB,SAAS,MAAM,mBAAmB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,aAAa;AAUf,MAAM,eAAe,CAAC,UAA6B;AACxD,QAAM,EAAE,WAAW,SAAS,IAAI;AAChC,QAAM,IAAI,KAAK;AAEf,SAAO,MAAM,KAAK,EACf,KAAK,EAAE,WAAW,KAAK,GAAG,MACzB,oBAAC,SAAI,WAAU,4BAA2B,8BAAC,WAAQ,GAAE,CACtD,EACA,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,EAAE,MAAM,MAClC,oBAAC,gBAAa,OAAO,OAAO,CAC7B,EACA,KAAK,EAAE,WAAW,CAAC,EAAE,GAAG,MACvB,oBAAC,QACC,8BAAC,eAAY,WAAU,kDACpB,YAAE,wCAAwC,2EAA2E,GACxH,GACF,CACD,EACA,UAAU,MACT,oBAAC,SAAI,WAAU,4CACZ,oBAAU,IAAI,CAAC,aACd;AAAA,IAAC;AAAA;AAAA,MAEC,MAAK;AAAA,MACL,WAAU;AAAA,MACV,SAAS,MAAM,SAAS,SAAS,WAAW;AAAA,MAE5C;AAAA,4BAAC,SAAM,WAAU,0CAAyC;AAAA,QAC1D,qBAAC,SACC;AAAA,8BAAC,OAAE,WAAU,0BAA0B,mBAAS,YAAY,QAAQ,MAAM,GAAG,GAAE;AAAA,UAC/E,oBAAC,OAAE,WAAU,iCAAiC,mBAAS,aAAY;AAAA,WACrE;AAAA;AAAA;AAAA,IATK,SAAS;AAAA,EAUhB,CACD,GACH,CACD;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|