@medusajs/draft-order 2.11.0-snapshot-20250829134337 → 2.11.0-snapshot-20251016104801
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/.medusa/server/src/admin/index.js +270 -257
- package/.medusa/server/src/admin/index.mjs +270 -257
- package/package.json +16 -30
|
@@ -352,7 +352,7 @@ const DataTableAction = ({
|
|
|
352
352
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { ...buttonProps, onClick: props.onClick, children: label });
|
|
353
353
|
};
|
|
354
354
|
const sdk = new Medusa__default.default({
|
|
355
|
-
baseUrl: "/",
|
|
355
|
+
baseUrl: __BACKEND_URL__ || "/",
|
|
356
356
|
auth: {
|
|
357
357
|
type: "session"
|
|
358
358
|
}
|
|
@@ -7573,12 +7573,12 @@ const addressSchema = objectType({
|
|
|
7573
7573
|
first_name: stringType().min(1),
|
|
7574
7574
|
last_name: stringType().min(1),
|
|
7575
7575
|
address_1: stringType().min(1),
|
|
7576
|
-
address_2: stringType().
|
|
7577
|
-
company: stringType().
|
|
7576
|
+
address_2: stringType().nullish(),
|
|
7577
|
+
company: stringType().nullish(),
|
|
7578
7578
|
city: stringType().min(1),
|
|
7579
|
-
province: stringType().
|
|
7579
|
+
province: stringType().nullish(),
|
|
7580
7580
|
postal_code: stringType().min(1),
|
|
7581
|
-
phone: stringType().
|
|
7581
|
+
phone: stringType().nullish()
|
|
7582
7582
|
});
|
|
7583
7583
|
const Create = () => {
|
|
7584
7584
|
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { children: /* @__PURE__ */ jsxRuntime.jsx(CreateForm, {}) });
|
|
@@ -8328,7 +8328,7 @@ const ActivitySection = ({ order, changes }) => {
|
|
|
8328
8328
|
() => getActivityItems(order, changes),
|
|
8329
8329
|
[order, changes]
|
|
8330
8330
|
);
|
|
8331
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0
|
|
8331
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "overflow-hidden p-0", children: [
|
|
8332
8332
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Activity" }) }),
|
|
8333
8333
|
/* @__PURE__ */ jsxRuntime.jsx(ActivityItemList, { items: activityItems })
|
|
8334
8334
|
] });
|
|
@@ -8359,8 +8359,8 @@ const CollapsibleActivityItemList = ({
|
|
|
8359
8359
|
const [open, setOpen] = React.useState(false);
|
|
8360
8360
|
return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Collapsible.Root, { open, onOpenChange: setOpen, children: [
|
|
8361
8361
|
!open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[20px_1fr] items-start gap-2", children: [
|
|
8362
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-ui-border-strong w-px flex-1 bg-[linear-gradient(var(--border-strong)_33%,rgba(255,255,255,0)_0%)] bg-[length:1px_3px] bg-right bg-repeat-y
|
|
8363
|
-
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Collapsible.Trigger, { className: "text-
|
|
8362
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-ui-border-strong w-px flex-1 bg-[linear-gradient(var(--border-strong)_33%,rgba(255,255,255,0)_0%)] bg-[length:1px_3px] bg-clip-content bg-right bg-repeat-y" }) }),
|
|
8363
|
+
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Collapsible.Trigger, { className: "text-ui-fg-muted hover:text-ui-fg-base focus:text-ui-fg-base m-0 p-0 pb-4 text-left outline-none transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", weight: "plus", children: `Show ${items.length} more ${items.length === 1 ? "activity" : "activities"}` }) })
|
|
8364
8364
|
] }),
|
|
8365
8365
|
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Collapsible.Content, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-0.5", children: items.map((item, idx) => {
|
|
8366
8366
|
return /* @__PURE__ */ jsxRuntime.jsx(ActivityItem, { item }, idx);
|
|
@@ -8378,14 +8378,14 @@ const ActivityItem = ({ item, isFirst = false }) => {
|
|
|
8378
8378
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8379
8379
|
"div",
|
|
8380
8380
|
{
|
|
8381
|
-
className: ui.clx("grid grid-cols-[20px_1fr] items-start gap-x-2
|
|
8381
|
+
className: ui.clx("grid w-full grid-cols-[20px_1fr] items-start gap-x-2"),
|
|
8382
8382
|
children: [
|
|
8383
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-0.5
|
|
8384
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5
|
|
8385
|
-
!isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-px
|
|
8383
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col items-center gap-0.5", children: [
|
|
8384
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shadow-borders-base flex size-2.5 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-neutral-icon size-1.5 rounded-full" }) }) }),
|
|
8385
|
+
!isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-border-base h-full w-px" }) })
|
|
8386
8386
|
] }),
|
|
8387
8387
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.clx("flex flex-col", !isFirst && "pb-4"), children: [
|
|
8388
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2
|
|
8388
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
8389
8389
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: item.label }),
|
|
8390
8390
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8391
8391
|
ui.Tooltip,
|
|
@@ -8396,7 +8396,7 @@ const ActivityItem = ({ item, isFirst = false }) => {
|
|
|
8396
8396
|
)
|
|
8397
8397
|
] }),
|
|
8398
8398
|
item.content && renderContent(item.content),
|
|
8399
|
-
item.userId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
8399
|
+
item.userId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-muted pt-2", children: isUserLoaded ? /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-fit items-center gap-x-1.5", children: [
|
|
8400
8400
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "By" }),
|
|
8401
8401
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8402
8402
|
ui.Avatar,
|
|
@@ -8412,8 +8412,8 @@ const ActivityItem = ({ item, isFirst = false }) => {
|
|
|
8412
8412
|
] })
|
|
8413
8413
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-1.5", children: [
|
|
8414
8414
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "By" }),
|
|
8415
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "
|
|
8416
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "w-[75px]
|
|
8415
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-5 w-5 rounded-full" }),
|
|
8416
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-4 w-[75px]" })
|
|
8417
8417
|
] }) })
|
|
8418
8418
|
] })
|
|
8419
8419
|
]
|
|
@@ -8436,7 +8436,12 @@ function getEditActivityItems(change) {
|
|
|
8436
8436
|
promotionsAdded: 0,
|
|
8437
8437
|
promotionsRemoved: 0
|
|
8438
8438
|
};
|
|
8439
|
-
|
|
8439
|
+
const orderedActions = change.actions.sort((a, b) => {
|
|
8440
|
+
return a.ordering - b.ordering;
|
|
8441
|
+
});
|
|
8442
|
+
const addedPromotionMap = /* @__PURE__ */ new Map();
|
|
8443
|
+
const removedPromotionMap = /* @__PURE__ */ new Map();
|
|
8444
|
+
for (const action of orderedActions) {
|
|
8440
8445
|
if (!action.details) {
|
|
8441
8446
|
continue;
|
|
8442
8447
|
}
|
|
@@ -8454,13 +8459,21 @@ function getEditActivityItems(change) {
|
|
|
8454
8459
|
case "SHIPPING_REMOVE":
|
|
8455
8460
|
counts.shippingMethodsRemoved += 1;
|
|
8456
8461
|
break;
|
|
8457
|
-
case "PROMOTION_ADD":
|
|
8458
|
-
|
|
8462
|
+
case "PROMOTION_ADD": {
|
|
8463
|
+
addedPromotionMap.set(action.reference_id, true);
|
|
8459
8464
|
break;
|
|
8460
|
-
|
|
8461
|
-
|
|
8465
|
+
}
|
|
8466
|
+
case "PROMOTION_REMOVE": {
|
|
8467
|
+
if (addedPromotionMap.has(action.reference_id)) {
|
|
8468
|
+
addedPromotionMap.delete(action.reference_id);
|
|
8469
|
+
} else {
|
|
8470
|
+
removedPromotionMap.set(action.reference_id, true);
|
|
8471
|
+
}
|
|
8462
8472
|
break;
|
|
8473
|
+
}
|
|
8463
8474
|
}
|
|
8475
|
+
counts.promotionsAdded = addedPromotionMap.size;
|
|
8476
|
+
counts.promotionsRemoved = removedPromotionMap.size;
|
|
8464
8477
|
}
|
|
8465
8478
|
const createActivityItem = (type, added, removed) => {
|
|
8466
8479
|
if (added === 0 && removed === 0) return;
|
|
@@ -9560,196 +9573,6 @@ const ID = () => {
|
|
|
9560
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9561
9574
|
] });
|
|
9562
9575
|
};
|
|
9563
|
-
const BillingAddress = () => {
|
|
9564
|
-
const { id } = reactRouterDom.useParams();
|
|
9565
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9566
|
-
fields: "+billing_address"
|
|
9567
|
-
});
|
|
9568
|
-
if (isError) {
|
|
9569
|
-
throw error;
|
|
9570
|
-
}
|
|
9571
|
-
const isReady = !isPending && !!order;
|
|
9572
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9573
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9574
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9575
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9576
|
-
] }),
|
|
9577
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9578
|
-
] });
|
|
9579
|
-
};
|
|
9580
|
-
const BillingAddressForm = ({ order }) => {
|
|
9581
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9582
|
-
const form = reactHookForm.useForm({
|
|
9583
|
-
defaultValues: {
|
|
9584
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9585
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9586
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9587
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9588
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9589
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9590
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9591
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9592
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9593
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9594
|
-
},
|
|
9595
|
-
resolver: zod.zodResolver(schema$5)
|
|
9596
|
-
});
|
|
9597
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9598
|
-
const { handleSuccess } = useRouteModal();
|
|
9599
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9600
|
-
await mutateAsync(
|
|
9601
|
-
{ billing_address: data },
|
|
9602
|
-
{
|
|
9603
|
-
onSuccess: () => {
|
|
9604
|
-
handleSuccess();
|
|
9605
|
-
},
|
|
9606
|
-
onError: (error) => {
|
|
9607
|
-
ui.toast.error(error.message);
|
|
9608
|
-
}
|
|
9609
|
-
}
|
|
9610
|
-
);
|
|
9611
|
-
});
|
|
9612
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9613
|
-
KeyboundForm,
|
|
9614
|
-
{
|
|
9615
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9616
|
-
onSubmit,
|
|
9617
|
-
children: [
|
|
9618
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
9619
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9620
|
-
Form$2.Field,
|
|
9621
|
-
{
|
|
9622
|
-
control: form.control,
|
|
9623
|
-
name: "country_code",
|
|
9624
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9625
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9626
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9627
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9628
|
-
] })
|
|
9629
|
-
}
|
|
9630
|
-
),
|
|
9631
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9632
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9633
|
-
Form$2.Field,
|
|
9634
|
-
{
|
|
9635
|
-
control: form.control,
|
|
9636
|
-
name: "first_name",
|
|
9637
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9638
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9639
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9640
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9641
|
-
] })
|
|
9642
|
-
}
|
|
9643
|
-
),
|
|
9644
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9645
|
-
Form$2.Field,
|
|
9646
|
-
{
|
|
9647
|
-
control: form.control,
|
|
9648
|
-
name: "last_name",
|
|
9649
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9650
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9652
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9653
|
-
] })
|
|
9654
|
-
}
|
|
9655
|
-
)
|
|
9656
|
-
] }),
|
|
9657
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9658
|
-
Form$2.Field,
|
|
9659
|
-
{
|
|
9660
|
-
control: form.control,
|
|
9661
|
-
name: "company",
|
|
9662
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9664
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9665
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9666
|
-
] })
|
|
9667
|
-
}
|
|
9668
|
-
),
|
|
9669
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9670
|
-
Form$2.Field,
|
|
9671
|
-
{
|
|
9672
|
-
control: form.control,
|
|
9673
|
-
name: "address_1",
|
|
9674
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9675
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9677
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9678
|
-
] })
|
|
9679
|
-
}
|
|
9680
|
-
),
|
|
9681
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9682
|
-
Form$2.Field,
|
|
9683
|
-
{
|
|
9684
|
-
control: form.control,
|
|
9685
|
-
name: "address_2",
|
|
9686
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9687
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9689
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9690
|
-
] })
|
|
9691
|
-
}
|
|
9692
|
-
),
|
|
9693
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9694
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9695
|
-
Form$2.Field,
|
|
9696
|
-
{
|
|
9697
|
-
control: form.control,
|
|
9698
|
-
name: "postal_code",
|
|
9699
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
9701
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9702
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9703
|
-
] })
|
|
9704
|
-
}
|
|
9705
|
-
),
|
|
9706
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9707
|
-
Form$2.Field,
|
|
9708
|
-
{
|
|
9709
|
-
control: form.control,
|
|
9710
|
-
name: "city",
|
|
9711
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9712
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9714
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9715
|
-
] })
|
|
9716
|
-
}
|
|
9717
|
-
)
|
|
9718
|
-
] }),
|
|
9719
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9720
|
-
Form$2.Field,
|
|
9721
|
-
{
|
|
9722
|
-
control: form.control,
|
|
9723
|
-
name: "province",
|
|
9724
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9726
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9727
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9728
|
-
] })
|
|
9729
|
-
}
|
|
9730
|
-
),
|
|
9731
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9732
|
-
Form$2.Field,
|
|
9733
|
-
{
|
|
9734
|
-
control: form.control,
|
|
9735
|
-
name: "phone",
|
|
9736
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9737
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9739
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9740
|
-
] })
|
|
9741
|
-
}
|
|
9742
|
-
)
|
|
9743
|
-
] }) }),
|
|
9744
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9745
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9746
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9747
|
-
] }) })
|
|
9748
|
-
]
|
|
9749
|
-
}
|
|
9750
|
-
) });
|
|
9751
|
-
};
|
|
9752
|
-
const schema$5 = addressSchema;
|
|
9753
9576
|
const CustomItems = () => {
|
|
9754
9577
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9755
9578
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9758,7 +9581,7 @@ const CustomItems = () => {
|
|
|
9758
9581
|
};
|
|
9759
9582
|
const CustomItemsForm = () => {
|
|
9760
9583
|
const form = reactHookForm.useForm({
|
|
9761
|
-
resolver: zod.zodResolver(schema$
|
|
9584
|
+
resolver: zod.zodResolver(schema$5)
|
|
9762
9585
|
});
|
|
9763
9586
|
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9764
9587
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
@@ -9768,7 +9591,7 @@ const CustomItemsForm = () => {
|
|
|
9768
9591
|
] }) })
|
|
9769
9592
|
] }) });
|
|
9770
9593
|
};
|
|
9771
|
-
const schema$
|
|
9594
|
+
const schema$5 = objectType({
|
|
9772
9595
|
email: stringType().email()
|
|
9773
9596
|
});
|
|
9774
9597
|
const Email = () => {
|
|
@@ -9793,7 +9616,7 @@ const EmailForm = ({ order }) => {
|
|
|
9793
9616
|
defaultValues: {
|
|
9794
9617
|
email: order.email ?? ""
|
|
9795
9618
|
},
|
|
9796
|
-
resolver: zod.zodResolver(schema$
|
|
9619
|
+
resolver: zod.zodResolver(schema$4)
|
|
9797
9620
|
});
|
|
9798
9621
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9799
9622
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9836,7 +9659,7 @@ const EmailForm = ({ order }) => {
|
|
|
9836
9659
|
}
|
|
9837
9660
|
) });
|
|
9838
9661
|
};
|
|
9839
|
-
const schema$
|
|
9662
|
+
const schema$4 = objectType({
|
|
9840
9663
|
email: stringType().email()
|
|
9841
9664
|
});
|
|
9842
9665
|
const NumberInput = React.forwardRef(
|
|
@@ -10122,7 +9945,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
|
|
|
10122
9945
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
|
|
10123
9946
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
10124
9947
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Items" }) }),
|
|
10125
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order
|
|
9948
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order" }) })
|
|
10126
9949
|
] }),
|
|
10127
9950
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
10128
9951
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6", children: [
|
|
@@ -10163,13 +9986,13 @@ const ItemsForm = ({ preview, currencyCode }) => {
|
|
|
10163
9986
|
] })
|
|
10164
9987
|
] }),
|
|
10165
9988
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
|
|
10166
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[
|
|
9989
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-muted grid grid-cols-[2fr_1fr_2fr_28px] gap-3 px-4 py-2", children: [
|
|
10167
9990
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Item" }) }),
|
|
10168
9991
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Quantity" }) }),
|
|
10169
9992
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Price" }) }),
|
|
10170
9993
|
/* @__PURE__ */ jsxRuntime.jsx("div", {})
|
|
10171
9994
|
] }) }),
|
|
10172
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-x-3
|
|
9995
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex flex-col items-center justify-center gap-1 gap-x-3 rounded-lg p-4", children: [
|
|
10173
9996
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: "There are no items in this order" }),
|
|
10174
9997
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Add items to the order to get started." })
|
|
10175
9998
|
] }) : matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10180,7 +10003,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
|
|
|
10180
10003
|
currencyCode
|
|
10181
10004
|
},
|
|
10182
10005
|
item.id
|
|
10183
|
-
)) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-x-3
|
|
10006
|
+
)) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex flex-col items-center justify-center gap-1 gap-x-3 rounded-lg p-4", children: [
|
|
10184
10007
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
|
|
10185
10008
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
10186
10009
|
'No items found for "',
|
|
@@ -10219,7 +10042,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
|
|
|
10219
10042
|
]
|
|
10220
10043
|
}
|
|
10221
10044
|
) }),
|
|
10222
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2
|
|
10045
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
10223
10046
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10224
10047
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10225
10048
|
ui.Button,
|
|
@@ -10295,8 +10118,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
|
|
|
10295
10118
|
}
|
|
10296
10119
|
);
|
|
10297
10120
|
});
|
|
10298
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[minmax(0,
|
|
10299
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3
|
|
10121
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,2fr)_28px] items-center gap-3 rounded-lg px-4 py-2", children: [
|
|
10122
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-x-3", children: [
|
|
10300
10123
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10301
10124
|
Thumbnail,
|
|
10302
10125
|
{
|
|
@@ -10332,7 +10155,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
|
|
|
10332
10155
|
)
|
|
10333
10156
|
] })
|
|
10334
10157
|
] }),
|
|
10335
|
-
editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1
|
|
10158
|
+
editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10336
10159
|
Form$2.Field,
|
|
10337
10160
|
{
|
|
10338
10161
|
control: form.control,
|
|
@@ -10341,8 +10164,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
|
|
|
10341
10164
|
return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field }) }) });
|
|
10342
10165
|
}
|
|
10343
10166
|
}
|
|
10344
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1
|
|
10345
|
-
editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1
|
|
10167
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: item.quantity }) }),
|
|
10168
|
+
editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10346
10169
|
Form$2.Field,
|
|
10347
10170
|
{
|
|
10348
10171
|
control: form.control,
|
|
@@ -10359,7 +10182,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
|
|
|
10359
10182
|
) }) });
|
|
10360
10183
|
}
|
|
10361
10184
|
}
|
|
10362
|
-
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-
|
|
10185
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-1 items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
|
|
10363
10186
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10364
10187
|
ui.IconButton,
|
|
10365
10188
|
{
|
|
@@ -10454,7 +10277,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
|
|
|
10454
10277
|
}
|
|
10455
10278
|
);
|
|
10456
10279
|
});
|
|
10457
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[minmax(0,
|
|
10280
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,2fr)_28px] items-center gap-3 rounded-lg px-4 py-2", children: [
|
|
10458
10281
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
10459
10282
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10460
10283
|
Thumbnail,
|
|
@@ -10501,7 +10324,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
|
|
|
10501
10324
|
) }) });
|
|
10502
10325
|
}
|
|
10503
10326
|
}
|
|
10504
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1
|
|
10327
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
|
|
10505
10328
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10506
10329
|
ui.IconButton,
|
|
10507
10330
|
{
|
|
@@ -10626,7 +10449,7 @@ const ExistingItemsForm = ({ orderId, items }) => {
|
|
|
10626
10449
|
autoFocusSearch: true
|
|
10627
10450
|
}
|
|
10628
10451
|
) }),
|
|
10629
|
-
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2
|
|
10452
|
+
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
10630
10453
|
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10631
10454
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Update items" })
|
|
10632
10455
|
] }) })
|
|
@@ -10794,15 +10617,15 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
|
|
|
10794
10617
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Quantity" }),
|
|
10795
10618
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
|
|
10796
10619
|
] }),
|
|
10797
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1
|
|
10798
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1
|
|
10620
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex-1", children: [
|
|
10621
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field, className: "w-full" }) }) }),
|
|
10799
10622
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10800
10623
|
] })
|
|
10801
10624
|
] }) })
|
|
10802
10625
|
}
|
|
10803
10626
|
)
|
|
10804
10627
|
] }) }) }),
|
|
10805
|
-
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2
|
|
10628
|
+
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
10806
10629
|
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10807
10630
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
|
|
10808
10631
|
] }) })
|
|
@@ -11207,22 +11030,22 @@ const PromotionForm = ({ preview }) => {
|
|
|
11207
11030
|
const [comboboxValue, setComboboxValue] = React.useState("");
|
|
11208
11031
|
const { handleSuccess } = useRouteModal();
|
|
11209
11032
|
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
11210
|
-
const
|
|
11033
|
+
const promoIds = getPromotionIds(items, shipping_methods);
|
|
11211
11034
|
const { promotions, isPending, isError, error } = usePromotions(
|
|
11212
11035
|
{
|
|
11213
|
-
|
|
11036
|
+
id: promoIds
|
|
11214
11037
|
},
|
|
11215
11038
|
{
|
|
11216
|
-
enabled: !!
|
|
11039
|
+
enabled: !!promoIds.length
|
|
11217
11040
|
}
|
|
11218
11041
|
);
|
|
11219
11042
|
const comboboxData = useComboboxData({
|
|
11220
|
-
queryKey: ["promotions", "combobox",
|
|
11043
|
+
queryKey: ["promotions", "combobox", promoIds],
|
|
11221
11044
|
queryFn: async (params) => {
|
|
11222
11045
|
return await sdk.admin.promotion.list({
|
|
11223
11046
|
...params,
|
|
11224
|
-
|
|
11225
|
-
$nin:
|
|
11047
|
+
id: {
|
|
11048
|
+
$nin: promoIds
|
|
11226
11049
|
}
|
|
11227
11050
|
});
|
|
11228
11051
|
},
|
|
@@ -11358,7 +11181,7 @@ const PromotionItem = ({
|
|
|
11358
11181
|
"div",
|
|
11359
11182
|
{
|
|
11360
11183
|
className: ui.clx(
|
|
11361
|
-
"
|
|
11184
|
+
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
11362
11185
|
{
|
|
11363
11186
|
"animate-pulse": isLoading
|
|
11364
11187
|
}
|
|
@@ -11366,7 +11189,7 @@ const PromotionItem = ({
|
|
|
11366
11189
|
children: [
|
|
11367
11190
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11368
11191
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
11369
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5
|
|
11192
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
11370
11193
|
displayValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
11371
11194
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: displayValue }),
|
|
11372
11195
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "·" })
|
|
@@ -11418,13 +11241,13 @@ const formatPercentage = (value, isPercentageValue = false) => {
|
|
|
11418
11241
|
}
|
|
11419
11242
|
return formatter.format(val);
|
|
11420
11243
|
};
|
|
11421
|
-
function
|
|
11422
|
-
const
|
|
11244
|
+
function getPromotionIds(items, shippingMethods) {
|
|
11245
|
+
const promotionIds = /* @__PURE__ */ new Set();
|
|
11423
11246
|
for (const item of items) {
|
|
11424
11247
|
if (item.adjustments) {
|
|
11425
11248
|
for (const adjustment of item.adjustments) {
|
|
11426
|
-
if (adjustment.
|
|
11427
|
-
|
|
11249
|
+
if (adjustment.promotion_id) {
|
|
11250
|
+
promotionIds.add(adjustment.promotion_id);
|
|
11428
11251
|
}
|
|
11429
11252
|
}
|
|
11430
11253
|
}
|
|
@@ -11432,13 +11255,13 @@ function getPromotionCodes(items, shippingMethods) {
|
|
|
11432
11255
|
for (const shippingMethod of shippingMethods) {
|
|
11433
11256
|
if (shippingMethod.adjustments) {
|
|
11434
11257
|
for (const adjustment of shippingMethod.adjustments) {
|
|
11435
|
-
if (adjustment.
|
|
11436
|
-
|
|
11258
|
+
if (adjustment.promotion_id) {
|
|
11259
|
+
promotionIds.add(adjustment.promotion_id);
|
|
11437
11260
|
}
|
|
11438
11261
|
}
|
|
11439
11262
|
}
|
|
11440
11263
|
}
|
|
11441
|
-
return Array.from(
|
|
11264
|
+
return Array.from(promotionIds);
|
|
11442
11265
|
}
|
|
11443
11266
|
const SalesChannel = () => {
|
|
11444
11267
|
const { id } = reactRouterDom.useParams();
|
|
@@ -11468,7 +11291,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11468
11291
|
defaultValues: {
|
|
11469
11292
|
sales_channel_id: order.sales_channel_id || ""
|
|
11470
11293
|
},
|
|
11471
|
-
resolver: zod.zodResolver(schema$
|
|
11294
|
+
resolver: zod.zodResolver(schema$3)
|
|
11472
11295
|
});
|
|
11473
11296
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11474
11297
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11543,7 +11366,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11543
11366
|
}
|
|
11544
11367
|
);
|
|
11545
11368
|
};
|
|
11546
|
-
const schema$
|
|
11369
|
+
const schema$3 = objectType({
|
|
11547
11370
|
sales_channel_id: stringType().min(1)
|
|
11548
11371
|
});
|
|
11549
11372
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12385,7 +12208,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12385
12208
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12386
12209
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12387
12210
|
},
|
|
12388
|
-
resolver: zod.zodResolver(schema$
|
|
12211
|
+
resolver: zod.zodResolver(schema$2)
|
|
12389
12212
|
});
|
|
12390
12213
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12391
12214
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12555,7 +12378,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12555
12378
|
}
|
|
12556
12379
|
) });
|
|
12557
12380
|
};
|
|
12558
|
-
const schema$
|
|
12381
|
+
const schema$2 = addressSchema;
|
|
12559
12382
|
const TransferOwnership = () => {
|
|
12560
12383
|
const { id } = reactRouterDom.useParams();
|
|
12561
12384
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12579,7 +12402,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12579
12402
|
defaultValues: {
|
|
12580
12403
|
customer_id: order.customer_id || ""
|
|
12581
12404
|
},
|
|
12582
|
-
resolver: zod.zodResolver(schema)
|
|
12405
|
+
resolver: zod.zodResolver(schema$1)
|
|
12583
12406
|
});
|
|
12584
12407
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12585
12408
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13029,9 +12852,199 @@ const Illustration = () => {
|
|
|
13029
12852
|
}
|
|
13030
12853
|
);
|
|
13031
12854
|
};
|
|
13032
|
-
const schema = objectType({
|
|
12855
|
+
const schema$1 = objectType({
|
|
13033
12856
|
customer_id: stringType().min(1)
|
|
13034
12857
|
});
|
|
12858
|
+
const BillingAddress = () => {
|
|
12859
|
+
const { id } = reactRouterDom.useParams();
|
|
12860
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12861
|
+
fields: "+billing_address"
|
|
12862
|
+
});
|
|
12863
|
+
if (isError) {
|
|
12864
|
+
throw error;
|
|
12865
|
+
}
|
|
12866
|
+
const isReady = !isPending && !!order;
|
|
12867
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12868
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12869
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
12870
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12871
|
+
] }),
|
|
12872
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
12873
|
+
] });
|
|
12874
|
+
};
|
|
12875
|
+
const BillingAddressForm = ({ order }) => {
|
|
12876
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12877
|
+
const form = reactHookForm.useForm({
|
|
12878
|
+
defaultValues: {
|
|
12879
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12880
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12881
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12882
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12883
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12884
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12885
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12886
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12887
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12888
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12889
|
+
},
|
|
12890
|
+
resolver: zod.zodResolver(schema)
|
|
12891
|
+
});
|
|
12892
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12893
|
+
const { handleSuccess } = useRouteModal();
|
|
12894
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12895
|
+
await mutateAsync(
|
|
12896
|
+
{ billing_address: data },
|
|
12897
|
+
{
|
|
12898
|
+
onSuccess: () => {
|
|
12899
|
+
handleSuccess();
|
|
12900
|
+
},
|
|
12901
|
+
onError: (error) => {
|
|
12902
|
+
ui.toast.error(error.message);
|
|
12903
|
+
}
|
|
12904
|
+
}
|
|
12905
|
+
);
|
|
12906
|
+
});
|
|
12907
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12908
|
+
KeyboundForm,
|
|
12909
|
+
{
|
|
12910
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12911
|
+
onSubmit,
|
|
12912
|
+
children: [
|
|
12913
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
12914
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12915
|
+
Form$2.Field,
|
|
12916
|
+
{
|
|
12917
|
+
control: form.control,
|
|
12918
|
+
name: "country_code",
|
|
12919
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12920
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12921
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12922
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12923
|
+
] })
|
|
12924
|
+
}
|
|
12925
|
+
),
|
|
12926
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12927
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12928
|
+
Form$2.Field,
|
|
12929
|
+
{
|
|
12930
|
+
control: form.control,
|
|
12931
|
+
name: "first_name",
|
|
12932
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12933
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12934
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12935
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12936
|
+
] })
|
|
12937
|
+
}
|
|
12938
|
+
),
|
|
12939
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12940
|
+
Form$2.Field,
|
|
12941
|
+
{
|
|
12942
|
+
control: form.control,
|
|
12943
|
+
name: "last_name",
|
|
12944
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12945
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12946
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12947
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12948
|
+
] })
|
|
12949
|
+
}
|
|
12950
|
+
)
|
|
12951
|
+
] }),
|
|
12952
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12953
|
+
Form$2.Field,
|
|
12954
|
+
{
|
|
12955
|
+
control: form.control,
|
|
12956
|
+
name: "company",
|
|
12957
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12958
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12959
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12960
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12961
|
+
] })
|
|
12962
|
+
}
|
|
12963
|
+
),
|
|
12964
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12965
|
+
Form$2.Field,
|
|
12966
|
+
{
|
|
12967
|
+
control: form.control,
|
|
12968
|
+
name: "address_1",
|
|
12969
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12970
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12971
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12972
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12973
|
+
] })
|
|
12974
|
+
}
|
|
12975
|
+
),
|
|
12976
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12977
|
+
Form$2.Field,
|
|
12978
|
+
{
|
|
12979
|
+
control: form.control,
|
|
12980
|
+
name: "address_2",
|
|
12981
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12982
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12983
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12984
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12985
|
+
] })
|
|
12986
|
+
}
|
|
12987
|
+
),
|
|
12988
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12989
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12990
|
+
Form$2.Field,
|
|
12991
|
+
{
|
|
12992
|
+
control: form.control,
|
|
12993
|
+
name: "postal_code",
|
|
12994
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12995
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12996
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12997
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12998
|
+
] })
|
|
12999
|
+
}
|
|
13000
|
+
),
|
|
13001
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13002
|
+
Form$2.Field,
|
|
13003
|
+
{
|
|
13004
|
+
control: form.control,
|
|
13005
|
+
name: "city",
|
|
13006
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13007
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
13008
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13009
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13010
|
+
] })
|
|
13011
|
+
}
|
|
13012
|
+
)
|
|
13013
|
+
] }),
|
|
13014
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13015
|
+
Form$2.Field,
|
|
13016
|
+
{
|
|
13017
|
+
control: form.control,
|
|
13018
|
+
name: "province",
|
|
13019
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13020
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13021
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13022
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13023
|
+
] })
|
|
13024
|
+
}
|
|
13025
|
+
),
|
|
13026
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13027
|
+
Form$2.Field,
|
|
13028
|
+
{
|
|
13029
|
+
control: form.control,
|
|
13030
|
+
name: "phone",
|
|
13031
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13032
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13033
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13034
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13035
|
+
] })
|
|
13036
|
+
}
|
|
13037
|
+
)
|
|
13038
|
+
] }) }),
|
|
13039
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13040
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13041
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13042
|
+
] }) })
|
|
13043
|
+
]
|
|
13044
|
+
}
|
|
13045
|
+
) });
|
|
13046
|
+
};
|
|
13047
|
+
const schema = addressSchema;
|
|
13035
13048
|
const widgetModule = { widgets: [] };
|
|
13036
13049
|
const routeModule = {
|
|
13037
13050
|
routes: [
|
|
@@ -13052,10 +13065,6 @@ const routeModule = {
|
|
|
13052
13065
|
handle,
|
|
13053
13066
|
loader,
|
|
13054
13067
|
children: [
|
|
13055
|
-
{
|
|
13056
|
-
Component: BillingAddress,
|
|
13057
|
-
path: "/draft-orders/:id/billing-address"
|
|
13058
|
-
},
|
|
13059
13068
|
{
|
|
13060
13069
|
Component: CustomItems,
|
|
13061
13070
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13091,6 +13100,10 @@ const routeModule = {
|
|
|
13091
13100
|
{
|
|
13092
13101
|
Component: TransferOwnership,
|
|
13093
13102
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13103
|
+
},
|
|
13104
|
+
{
|
|
13105
|
+
Component: BillingAddress,
|
|
13106
|
+
path: "/draft-orders/:id/billing-address"
|
|
13094
13107
|
}
|
|
13095
13108
|
]
|
|
13096
13109
|
}
|