@medusajs/draft-order 2.10.2-snapshot-20250903073427 → 2.10.2-snapshot-20250903100537
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 +930 -930
- package/.medusa/server/src/admin/index.mjs +930 -930
- package/package.json +23 -24
|
@@ -9554,6 +9554,27 @@ const ID = () => {
|
|
|
9554
9554
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9555
9555
|
] });
|
|
9556
9556
|
};
|
|
9557
|
+
const CustomItems = () => {
|
|
9558
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9559
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9560
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9561
|
+
] });
|
|
9562
|
+
};
|
|
9563
|
+
const CustomItemsForm = () => {
|
|
9564
|
+
const form = useForm({
|
|
9565
|
+
resolver: zodResolver(schema$5)
|
|
9566
|
+
});
|
|
9567
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9568
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9569
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9570
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9571
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9572
|
+
] }) })
|
|
9573
|
+
] }) });
|
|
9574
|
+
};
|
|
9575
|
+
const schema$5 = objectType({
|
|
9576
|
+
email: stringType().email()
|
|
9577
|
+
});
|
|
9557
9578
|
const BillingAddress = () => {
|
|
9558
9579
|
const { id } = useParams();
|
|
9559
9580
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9586,7 +9607,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9586
9607
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9587
9608
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9588
9609
|
},
|
|
9589
|
-
resolver: zodResolver(schema$
|
|
9610
|
+
resolver: zodResolver(schema$4)
|
|
9590
9611
|
});
|
|
9591
9612
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9592
9613
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9743,26 +9764,73 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9743
9764
|
}
|
|
9744
9765
|
) });
|
|
9745
9766
|
};
|
|
9746
|
-
const schema$
|
|
9747
|
-
const
|
|
9767
|
+
const schema$4 = addressSchema;
|
|
9768
|
+
const Email = () => {
|
|
9769
|
+
const { id } = useParams();
|
|
9770
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9771
|
+
fields: "+email"
|
|
9772
|
+
});
|
|
9773
|
+
if (isError) {
|
|
9774
|
+
throw error;
|
|
9775
|
+
}
|
|
9776
|
+
const isReady = !isPending && !!order;
|
|
9748
9777
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9749
|
-
/* @__PURE__ */
|
|
9750
|
-
|
|
9778
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9779
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9780
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9781
|
+
] }),
|
|
9782
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9751
9783
|
] });
|
|
9752
9784
|
};
|
|
9753
|
-
const
|
|
9785
|
+
const EmailForm = ({ order }) => {
|
|
9754
9786
|
const form = useForm({
|
|
9755
|
-
|
|
9787
|
+
defaultValues: {
|
|
9788
|
+
email: order.email ?? ""
|
|
9789
|
+
},
|
|
9790
|
+
resolver: zodResolver(schema$3)
|
|
9756
9791
|
});
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9792
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9793
|
+
const { handleSuccess } = useRouteModal();
|
|
9794
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9795
|
+
await mutateAsync(
|
|
9796
|
+
{ email: data.email },
|
|
9797
|
+
{
|
|
9798
|
+
onSuccess: () => {
|
|
9799
|
+
handleSuccess();
|
|
9800
|
+
},
|
|
9801
|
+
onError: (error) => {
|
|
9802
|
+
toast.error(error.message);
|
|
9803
|
+
}
|
|
9804
|
+
}
|
|
9805
|
+
);
|
|
9806
|
+
});
|
|
9807
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9808
|
+
KeyboundForm,
|
|
9809
|
+
{
|
|
9810
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9811
|
+
onSubmit,
|
|
9812
|
+
children: [
|
|
9813
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9814
|
+
Form$2.Field,
|
|
9815
|
+
{
|
|
9816
|
+
control: form.control,
|
|
9817
|
+
name: "email",
|
|
9818
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9819
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9820
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9821
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9822
|
+
] })
|
|
9823
|
+
}
|
|
9824
|
+
) }),
|
|
9825
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9826
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9827
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9828
|
+
] }) })
|
|
9829
|
+
]
|
|
9830
|
+
}
|
|
9831
|
+
) });
|
|
9764
9832
|
};
|
|
9765
|
-
const schema$
|
|
9833
|
+
const schema$3 = objectType({
|
|
9766
9834
|
email: stringType().email()
|
|
9767
9835
|
});
|
|
9768
9836
|
const InlineTip = forwardRef(
|
|
@@ -10115,26 +10183,6 @@ function getHasUneditableRows(metadata) {
|
|
|
10115
10183
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
10116
10184
|
);
|
|
10117
10185
|
}
|
|
10118
|
-
const PROMOTION_QUERY_KEY = "promotions";
|
|
10119
|
-
const promotionsQueryKeys = {
|
|
10120
|
-
list: (query2) => [
|
|
10121
|
-
PROMOTION_QUERY_KEY,
|
|
10122
|
-
query2 ? query2 : void 0
|
|
10123
|
-
],
|
|
10124
|
-
detail: (id, query2) => [
|
|
10125
|
-
PROMOTION_QUERY_KEY,
|
|
10126
|
-
id,
|
|
10127
|
-
query2 ? query2 : void 0
|
|
10128
|
-
]
|
|
10129
|
-
};
|
|
10130
|
-
const usePromotions = (query2, options) => {
|
|
10131
|
-
const { data, ...rest } = useQuery({
|
|
10132
|
-
queryKey: promotionsQueryKeys.list(query2),
|
|
10133
|
-
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
10134
|
-
...options
|
|
10135
|
-
});
|
|
10136
|
-
return { ...data, ...rest };
|
|
10137
|
-
};
|
|
10138
10186
|
const useCancelOrderEdit = ({ preview }) => {
|
|
10139
10187
|
const { mutateAsync: cancelOrderEdit } = useDraftOrderCancelEdit(preview == null ? void 0 : preview.id);
|
|
10140
10188
|
const onCancel = useCallback(async () => {
|
|
@@ -10181,85 +10229,80 @@ const useInitiateOrderEdit = ({
|
|
|
10181
10229
|
run();
|
|
10182
10230
|
}, [preview, navigate, mutateAsync]);
|
|
10183
10231
|
};
|
|
10184
|
-
|
|
10232
|
+
function convertNumber(value) {
|
|
10233
|
+
return typeof value === "string" ? Number(value.replace(",", ".")) : value;
|
|
10234
|
+
}
|
|
10235
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
10236
|
+
const Shipping = () => {
|
|
10237
|
+
var _a;
|
|
10185
10238
|
const { id } = useParams();
|
|
10239
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10240
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
10241
|
+
});
|
|
10186
10242
|
const {
|
|
10187
10243
|
order: preview,
|
|
10244
|
+
isPending: isPreviewPending,
|
|
10188
10245
|
isError: isPreviewError,
|
|
10189
10246
|
error: previewError
|
|
10190
|
-
} = useOrderPreview(id
|
|
10247
|
+
} = useOrderPreview(id);
|
|
10191
10248
|
useInitiateOrderEdit({ preview });
|
|
10192
10249
|
const { onCancel } = useCancelOrderEdit({ preview });
|
|
10250
|
+
if (isError) {
|
|
10251
|
+
throw error;
|
|
10252
|
+
}
|
|
10193
10253
|
if (isPreviewError) {
|
|
10194
10254
|
throw previewError;
|
|
10195
10255
|
}
|
|
10196
|
-
const
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10256
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
10257
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
10258
|
+
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
10259
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
10260
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
10261
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
10262
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
10263
|
+
] }) }) }),
|
|
10264
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
10265
|
+
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
10266
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
10267
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
10268
|
+
] }) });
|
|
10201
10269
|
};
|
|
10202
|
-
const
|
|
10203
|
-
|
|
10270
|
+
const ShippingForm = ({ preview, order }) => {
|
|
10271
|
+
var _a;
|
|
10272
|
+
const { setIsOpen } = useStackedModal();
|
|
10204
10273
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
10205
|
-
const [
|
|
10206
|
-
const
|
|
10207
|
-
const {
|
|
10208
|
-
const promoCodes = getPromotionCodes(items, shipping_methods);
|
|
10209
|
-
const { promotions, isPending, isError, error } = usePromotions(
|
|
10274
|
+
const [data, setData] = useState(null);
|
|
10275
|
+
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
10276
|
+
const { shipping_options } = useShippingOptions(
|
|
10210
10277
|
{
|
|
10211
|
-
|
|
10278
|
+
id: appliedShippingOptionIds,
|
|
10279
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
10212
10280
|
},
|
|
10213
10281
|
{
|
|
10214
|
-
enabled:
|
|
10282
|
+
enabled: appliedShippingOptionIds.length > 0
|
|
10215
10283
|
}
|
|
10216
10284
|
);
|
|
10217
|
-
const
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
return data.promotions.map((promotion) => ({
|
|
10229
|
-
label: promotion.code,
|
|
10230
|
-
value: promotion.code
|
|
10231
|
-
}));
|
|
10232
|
-
}
|
|
10233
|
-
});
|
|
10234
|
-
const add = async (value) => {
|
|
10235
|
-
if (!value) {
|
|
10236
|
-
return;
|
|
10237
|
-
}
|
|
10238
|
-
addPromotions(
|
|
10239
|
-
{
|
|
10240
|
-
promo_codes: [value]
|
|
10241
|
-
},
|
|
10242
|
-
{
|
|
10243
|
-
onError: (e) => {
|
|
10244
|
-
toast.error(e.message);
|
|
10245
|
-
comboboxData.onSearchValueChange("");
|
|
10246
|
-
setComboboxValue("");
|
|
10247
|
-
},
|
|
10248
|
-
onSuccess: () => {
|
|
10249
|
-
comboboxData.onSearchValueChange("");
|
|
10250
|
-
setComboboxValue("");
|
|
10251
|
-
}
|
|
10252
|
-
}
|
|
10253
|
-
);
|
|
10254
|
-
};
|
|
10285
|
+
const uniqueShippingProfiles = useMemo(() => {
|
|
10286
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
10287
|
+
getUniqueShippingProfiles(order.items).forEach((profile) => {
|
|
10288
|
+
profiles.set(profile.id, profile);
|
|
10289
|
+
});
|
|
10290
|
+
shipping_options == null ? void 0 : shipping_options.forEach((option) => {
|
|
10291
|
+
profiles.set(option.shipping_profile_id, option.shipping_profile);
|
|
10292
|
+
});
|
|
10293
|
+
return Array.from(profiles.values());
|
|
10294
|
+
}, [order.items, shipping_options]);
|
|
10295
|
+
const { handleSuccess } = useRouteModal();
|
|
10255
10296
|
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
10256
|
-
const { mutateAsync: requestOrderEdit } =
|
|
10297
|
+
const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
|
|
10298
|
+
const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
|
|
10299
|
+
const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
|
|
10257
10300
|
const onSubmit = async () => {
|
|
10258
10301
|
setIsSubmitting(true);
|
|
10259
10302
|
let requestSucceeded = false;
|
|
10260
10303
|
await requestOrderEdit(void 0, {
|
|
10261
10304
|
onError: (e) => {
|
|
10262
|
-
toast.error(e.message);
|
|
10305
|
+
toast.error(`Failed to request order edit: ${e.message}`);
|
|
10263
10306
|
},
|
|
10264
10307
|
onSuccess: () => {
|
|
10265
10308
|
requestSucceeded = true;
|
|
@@ -10271,7 +10314,7 @@ const PromotionForm = ({ preview }) => {
|
|
|
10271
10314
|
}
|
|
10272
10315
|
await confirmOrderEdit(void 0, {
|
|
10273
10316
|
onError: (e) => {
|
|
10274
|
-
toast.error(e.message);
|
|
10317
|
+
toast.error(`Failed to confirm order edit: ${e.message}`);
|
|
10275
10318
|
},
|
|
10276
10319
|
onSuccess: () => {
|
|
10277
10320
|
handleSuccess();
|
|
@@ -10281,388 +10324,30 @@ const PromotionForm = ({ preview }) => {
|
|
|
10281
10324
|
}
|
|
10282
10325
|
});
|
|
10283
10326
|
};
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
}
|
|
10308
|
-
)
|
|
10309
|
-
] }),
|
|
10310
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10311
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
|
|
10312
|
-
PromotionItem,
|
|
10313
|
-
{
|
|
10314
|
-
promotion,
|
|
10315
|
-
orderId: preview.id,
|
|
10316
|
-
isLoading: isPending
|
|
10317
|
-
},
|
|
10318
|
-
promotion.id
|
|
10319
|
-
)) })
|
|
10320
|
-
] }) }),
|
|
10321
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10322
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10323
|
-
/* @__PURE__ */ jsx(
|
|
10324
|
-
Button,
|
|
10325
|
-
{
|
|
10326
|
-
size: "small",
|
|
10327
|
-
type: "submit",
|
|
10328
|
-
isLoading: isSubmitting || isAddingPromotions,
|
|
10329
|
-
children: "Save"
|
|
10330
|
-
}
|
|
10331
|
-
)
|
|
10332
|
-
] }) })
|
|
10333
|
-
] });
|
|
10334
|
-
};
|
|
10335
|
-
const PromotionItem = ({
|
|
10336
|
-
promotion,
|
|
10337
|
-
orderId,
|
|
10338
|
-
isLoading
|
|
10339
|
-
}) => {
|
|
10340
|
-
var _a;
|
|
10341
|
-
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
10342
|
-
const onRemove = async () => {
|
|
10343
|
-
removePromotions(
|
|
10344
|
-
{
|
|
10345
|
-
promo_codes: [promotion.code]
|
|
10346
|
-
},
|
|
10347
|
-
{
|
|
10348
|
-
onError: (e) => {
|
|
10349
|
-
toast.error(e.message);
|
|
10350
|
-
}
|
|
10351
|
-
}
|
|
10352
|
-
);
|
|
10353
|
-
};
|
|
10354
|
-
const displayValue = getDisplayValue(promotion);
|
|
10355
|
-
return /* @__PURE__ */ jsxs(
|
|
10356
|
-
"div",
|
|
10357
|
-
{
|
|
10358
|
-
className: clx(
|
|
10359
|
-
"px-3 py-2 rounded-lg bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between",
|
|
10360
|
-
{
|
|
10361
|
-
"animate-pulse": isLoading
|
|
10362
|
-
}
|
|
10363
|
-
),
|
|
10364
|
-
children: [
|
|
10365
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10366
|
-
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
10367
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-ui-fg-subtle", children: [
|
|
10368
|
-
displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
10369
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
|
|
10370
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
|
|
10371
|
-
] }),
|
|
10372
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
10373
|
-
] })
|
|
10374
|
-
] }),
|
|
10375
|
-
/* @__PURE__ */ jsx(
|
|
10376
|
-
IconButton,
|
|
10377
|
-
{
|
|
10378
|
-
size: "small",
|
|
10379
|
-
type: "button",
|
|
10380
|
-
variant: "transparent",
|
|
10381
|
-
onClick: onRemove,
|
|
10382
|
-
isLoading: isPending || isLoading,
|
|
10383
|
-
children: /* @__PURE__ */ jsx(XMark, {})
|
|
10384
|
-
}
|
|
10385
|
-
)
|
|
10386
|
-
]
|
|
10387
|
-
},
|
|
10388
|
-
promotion.id
|
|
10389
|
-
);
|
|
10390
|
-
};
|
|
10391
|
-
function getDisplayValue(promotion) {
|
|
10392
|
-
var _a, _b, _c, _d;
|
|
10393
|
-
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
10394
|
-
if (!value) {
|
|
10395
|
-
return null;
|
|
10396
|
-
}
|
|
10397
|
-
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
10398
|
-
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
10399
|
-
if (!currency) {
|
|
10400
|
-
return null;
|
|
10401
|
-
}
|
|
10402
|
-
return getLocaleAmount(value, currency);
|
|
10403
|
-
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
10404
|
-
return formatPercentage(value);
|
|
10405
|
-
}
|
|
10406
|
-
return null;
|
|
10407
|
-
}
|
|
10408
|
-
const formatter = new Intl.NumberFormat([], {
|
|
10409
|
-
style: "percent",
|
|
10410
|
-
minimumFractionDigits: 2
|
|
10411
|
-
});
|
|
10412
|
-
const formatPercentage = (value, isPercentageValue = false) => {
|
|
10413
|
-
let val = value || 0;
|
|
10414
|
-
if (!isPercentageValue) {
|
|
10415
|
-
val = val / 100;
|
|
10416
|
-
}
|
|
10417
|
-
return formatter.format(val);
|
|
10418
|
-
};
|
|
10419
|
-
function getPromotionCodes(items, shippingMethods) {
|
|
10420
|
-
const codes = /* @__PURE__ */ new Set();
|
|
10421
|
-
for (const item of items) {
|
|
10422
|
-
if (item.adjustments) {
|
|
10423
|
-
for (const adjustment of item.adjustments) {
|
|
10424
|
-
if (adjustment.code) {
|
|
10425
|
-
codes.add(adjustment.code);
|
|
10426
|
-
}
|
|
10427
|
-
}
|
|
10428
|
-
}
|
|
10429
|
-
}
|
|
10430
|
-
for (const shippingMethod of shippingMethods) {
|
|
10431
|
-
if (shippingMethod.adjustments) {
|
|
10432
|
-
for (const adjustment of shippingMethod.adjustments) {
|
|
10433
|
-
if (adjustment.code) {
|
|
10434
|
-
codes.add(adjustment.code);
|
|
10435
|
-
}
|
|
10436
|
-
}
|
|
10437
|
-
}
|
|
10438
|
-
}
|
|
10439
|
-
return Array.from(codes);
|
|
10440
|
-
}
|
|
10441
|
-
const SalesChannel = () => {
|
|
10442
|
-
const { id } = useParams();
|
|
10443
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
10444
|
-
id,
|
|
10445
|
-
{
|
|
10446
|
-
fields: "+sales_channel_id"
|
|
10447
|
-
},
|
|
10448
|
-
{
|
|
10449
|
-
enabled: !!id
|
|
10450
|
-
}
|
|
10451
|
-
);
|
|
10452
|
-
if (isError) {
|
|
10453
|
-
throw error;
|
|
10454
|
-
}
|
|
10455
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
10456
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10457
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10458
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
10459
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
10460
|
-
] }),
|
|
10461
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
10462
|
-
] });
|
|
10463
|
-
};
|
|
10464
|
-
const SalesChannelForm = ({ order }) => {
|
|
10465
|
-
const form = useForm({
|
|
10466
|
-
defaultValues: {
|
|
10467
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
10468
|
-
},
|
|
10469
|
-
resolver: zodResolver(schema$3)
|
|
10470
|
-
});
|
|
10471
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10472
|
-
const { handleSuccess } = useRouteModal();
|
|
10473
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10474
|
-
await mutateAsync(
|
|
10475
|
-
{
|
|
10476
|
-
sales_channel_id: data.sales_channel_id
|
|
10477
|
-
},
|
|
10478
|
-
{
|
|
10479
|
-
onSuccess: () => {
|
|
10480
|
-
toast.success("Sales channel updated");
|
|
10481
|
-
handleSuccess();
|
|
10482
|
-
},
|
|
10483
|
-
onError: (error) => {
|
|
10484
|
-
toast.error(error.message);
|
|
10485
|
-
}
|
|
10486
|
-
}
|
|
10487
|
-
);
|
|
10488
|
-
});
|
|
10489
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10490
|
-
KeyboundForm,
|
|
10491
|
-
{
|
|
10492
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10493
|
-
onSubmit,
|
|
10494
|
-
children: [
|
|
10495
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
10496
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10497
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10498
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10499
|
-
] }) })
|
|
10500
|
-
]
|
|
10501
|
-
}
|
|
10502
|
-
) });
|
|
10503
|
-
};
|
|
10504
|
-
const SalesChannelField = ({ control, order }) => {
|
|
10505
|
-
const salesChannels = useComboboxData({
|
|
10506
|
-
queryFn: async (params) => {
|
|
10507
|
-
return await sdk.admin.salesChannel.list(params);
|
|
10508
|
-
},
|
|
10509
|
-
queryKey: ["sales-channels"],
|
|
10510
|
-
getOptions: (data) => {
|
|
10511
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
10512
|
-
label: salesChannel.name,
|
|
10513
|
-
value: salesChannel.id
|
|
10514
|
-
}));
|
|
10515
|
-
},
|
|
10516
|
-
defaultValue: order.sales_channel_id || void 0
|
|
10517
|
-
});
|
|
10518
|
-
return /* @__PURE__ */ jsx(
|
|
10519
|
-
Form$2.Field,
|
|
10520
|
-
{
|
|
10521
|
-
control,
|
|
10522
|
-
name: "sales_channel_id",
|
|
10523
|
-
render: ({ field }) => {
|
|
10524
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10525
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
10526
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10527
|
-
Combobox,
|
|
10528
|
-
{
|
|
10529
|
-
options: salesChannels.options,
|
|
10530
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
10531
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
10532
|
-
searchValue: salesChannels.searchValue,
|
|
10533
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
10534
|
-
placeholder: "Select sales channel",
|
|
10535
|
-
...field
|
|
10536
|
-
}
|
|
10537
|
-
) }),
|
|
10538
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10539
|
-
] });
|
|
10540
|
-
}
|
|
10541
|
-
}
|
|
10542
|
-
);
|
|
10543
|
-
};
|
|
10544
|
-
const schema$3 = objectType({
|
|
10545
|
-
sales_channel_id: stringType().min(1)
|
|
10546
|
-
});
|
|
10547
|
-
function convertNumber(value) {
|
|
10548
|
-
return typeof value === "string" ? Number(value.replace(",", ".")) : value;
|
|
10549
|
-
}
|
|
10550
|
-
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
10551
|
-
const Shipping = () => {
|
|
10552
|
-
var _a;
|
|
10553
|
-
const { id } = useParams();
|
|
10554
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10555
|
-
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
10556
|
-
});
|
|
10557
|
-
const {
|
|
10558
|
-
order: preview,
|
|
10559
|
-
isPending: isPreviewPending,
|
|
10560
|
-
isError: isPreviewError,
|
|
10561
|
-
error: previewError
|
|
10562
|
-
} = useOrderPreview(id);
|
|
10563
|
-
useInitiateOrderEdit({ preview });
|
|
10564
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
10565
|
-
if (isError) {
|
|
10566
|
-
throw error;
|
|
10567
|
-
}
|
|
10568
|
-
if (isPreviewError) {
|
|
10569
|
-
throw previewError;
|
|
10570
|
-
}
|
|
10571
|
-
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
10572
|
-
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
10573
|
-
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
10574
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
10575
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
10576
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
10577
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
10578
|
-
] }) }) }),
|
|
10579
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
10580
|
-
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
10581
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
10582
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
10583
|
-
] }) });
|
|
10584
|
-
};
|
|
10585
|
-
const ShippingForm = ({ preview, order }) => {
|
|
10586
|
-
var _a;
|
|
10587
|
-
const { setIsOpen } = useStackedModal();
|
|
10588
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
10589
|
-
const [data, setData] = useState(null);
|
|
10590
|
-
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
10591
|
-
const { shipping_options } = useShippingOptions(
|
|
10592
|
-
{
|
|
10593
|
-
id: appliedShippingOptionIds,
|
|
10594
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
10595
|
-
},
|
|
10596
|
-
{
|
|
10597
|
-
enabled: appliedShippingOptionIds.length > 0
|
|
10598
|
-
}
|
|
10599
|
-
);
|
|
10600
|
-
const uniqueShippingProfiles = useMemo(() => {
|
|
10601
|
-
const profiles = /* @__PURE__ */ new Map();
|
|
10602
|
-
getUniqueShippingProfiles(order.items).forEach((profile) => {
|
|
10603
|
-
profiles.set(profile.id, profile);
|
|
10604
|
-
});
|
|
10605
|
-
shipping_options == null ? void 0 : shipping_options.forEach((option) => {
|
|
10606
|
-
profiles.set(option.shipping_profile_id, option.shipping_profile);
|
|
10607
|
-
});
|
|
10608
|
-
return Array.from(profiles.values());
|
|
10609
|
-
}, [order.items, shipping_options]);
|
|
10610
|
-
const { handleSuccess } = useRouteModal();
|
|
10611
|
-
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
10612
|
-
const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
|
|
10613
|
-
const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
|
|
10614
|
-
const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
|
|
10615
|
-
const onSubmit = async () => {
|
|
10616
|
-
setIsSubmitting(true);
|
|
10617
|
-
let requestSucceeded = false;
|
|
10618
|
-
await requestOrderEdit(void 0, {
|
|
10619
|
-
onError: (e) => {
|
|
10620
|
-
toast.error(`Failed to request order edit: ${e.message}`);
|
|
10621
|
-
},
|
|
10622
|
-
onSuccess: () => {
|
|
10623
|
-
requestSucceeded = true;
|
|
10624
|
-
}
|
|
10625
|
-
});
|
|
10626
|
-
if (!requestSucceeded) {
|
|
10627
|
-
setIsSubmitting(false);
|
|
10628
|
-
return;
|
|
10629
|
-
}
|
|
10630
|
-
await confirmOrderEdit(void 0, {
|
|
10631
|
-
onError: (e) => {
|
|
10632
|
-
toast.error(`Failed to confirm order edit: ${e.message}`);
|
|
10633
|
-
},
|
|
10634
|
-
onSuccess: () => {
|
|
10635
|
-
handleSuccess();
|
|
10636
|
-
},
|
|
10637
|
-
onSettled: () => {
|
|
10638
|
-
setIsSubmitting(false);
|
|
10639
|
-
}
|
|
10640
|
-
});
|
|
10641
|
-
};
|
|
10642
|
-
const onKeydown = useCallback(
|
|
10643
|
-
(e) => {
|
|
10644
|
-
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
|
10645
|
-
if (data || isSubmitting) {
|
|
10646
|
-
return;
|
|
10647
|
-
}
|
|
10648
|
-
onSubmit();
|
|
10649
|
-
}
|
|
10650
|
-
},
|
|
10651
|
-
[data, isSubmitting, onSubmit]
|
|
10652
|
-
);
|
|
10653
|
-
useEffect(() => {
|
|
10654
|
-
document.addEventListener("keydown", onKeydown);
|
|
10655
|
-
return () => {
|
|
10656
|
-
document.removeEventListener("keydown", onKeydown);
|
|
10657
|
-
};
|
|
10658
|
-
}, [onKeydown]);
|
|
10659
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
10660
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
10661
|
-
/* @__PURE__ */ jsxs(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
10662
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
10663
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10664
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
10665
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Choose which shipping method(s) to use for the items in the order." }) })
|
|
10327
|
+
const onKeydown = useCallback(
|
|
10328
|
+
(e) => {
|
|
10329
|
+
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
|
10330
|
+
if (data || isSubmitting) {
|
|
10331
|
+
return;
|
|
10332
|
+
}
|
|
10333
|
+
onSubmit();
|
|
10334
|
+
}
|
|
10335
|
+
},
|
|
10336
|
+
[data, isSubmitting, onSubmit]
|
|
10337
|
+
);
|
|
10338
|
+
useEffect(() => {
|
|
10339
|
+
document.addEventListener("keydown", onKeydown);
|
|
10340
|
+
return () => {
|
|
10341
|
+
document.removeEventListener("keydown", onKeydown);
|
|
10342
|
+
};
|
|
10343
|
+
}, [onKeydown]);
|
|
10344
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
10345
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
10346
|
+
/* @__PURE__ */ jsxs(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
10347
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
10348
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10349
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
10350
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Choose which shipping method(s) to use for the items in the order." }) })
|
|
10666
10351
|
] }),
|
|
10667
10352
|
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10668
10353
|
/* @__PURE__ */ jsx(Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle rounded-xl shadow-elevation-card-rest", children: [
|
|
@@ -10931,429 +10616,812 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
10931
10616
|
] })
|
|
10932
10617
|
]
|
|
10933
10618
|
},
|
|
10934
|
-
profile.id
|
|
10935
|
-
);
|
|
10936
|
-
}) })
|
|
10937
|
-
] }) })
|
|
10938
|
-
] }) }),
|
|
10939
|
-
/* @__PURE__ */ jsx(
|
|
10940
|
-
StackedFocusModal,
|
|
10941
|
-
{
|
|
10942
|
-
id: STACKED_FOCUS_MODAL_ID,
|
|
10943
|
-
onOpenChangeCallback: (open) => {
|
|
10944
|
-
if (!open) {
|
|
10945
|
-
setData(null);
|
|
10619
|
+
profile.id
|
|
10620
|
+
);
|
|
10621
|
+
}) })
|
|
10622
|
+
] }) })
|
|
10623
|
+
] }) }),
|
|
10624
|
+
/* @__PURE__ */ jsx(
|
|
10625
|
+
StackedFocusModal,
|
|
10626
|
+
{
|
|
10627
|
+
id: STACKED_FOCUS_MODAL_ID,
|
|
10628
|
+
onOpenChangeCallback: (open) => {
|
|
10629
|
+
if (!open) {
|
|
10630
|
+
setData(null);
|
|
10631
|
+
}
|
|
10632
|
+
return open;
|
|
10633
|
+
},
|
|
10634
|
+
children: data && /* @__PURE__ */ jsx(ShippingProfileForm, { data, order, preview })
|
|
10635
|
+
}
|
|
10636
|
+
)
|
|
10637
|
+
] }),
|
|
10638
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-x-2", children: [
|
|
10639
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10640
|
+
/* @__PURE__ */ jsx(
|
|
10641
|
+
Button,
|
|
10642
|
+
{
|
|
10643
|
+
size: "small",
|
|
10644
|
+
type: "button",
|
|
10645
|
+
isLoading: isSubmitting,
|
|
10646
|
+
onClick: onSubmit,
|
|
10647
|
+
children: "Save"
|
|
10648
|
+
}
|
|
10649
|
+
)
|
|
10650
|
+
] }) })
|
|
10651
|
+
] });
|
|
10652
|
+
};
|
|
10653
|
+
const StackedModalTrigger$1 = ({
|
|
10654
|
+
shippingProfileId,
|
|
10655
|
+
shippingOption,
|
|
10656
|
+
shippingMethod,
|
|
10657
|
+
setData,
|
|
10658
|
+
children
|
|
10659
|
+
}) => {
|
|
10660
|
+
const { setIsOpen, getIsOpen } = useStackedModal();
|
|
10661
|
+
const isOpen = getIsOpen(STACKED_FOCUS_MODAL_ID);
|
|
10662
|
+
const onToggle = () => {
|
|
10663
|
+
if (isOpen) {
|
|
10664
|
+
setIsOpen(STACKED_FOCUS_MODAL_ID, false);
|
|
10665
|
+
setData(null);
|
|
10666
|
+
} else {
|
|
10667
|
+
setIsOpen(STACKED_FOCUS_MODAL_ID, true);
|
|
10668
|
+
setData({
|
|
10669
|
+
shippingProfileId,
|
|
10670
|
+
shippingOption,
|
|
10671
|
+
shippingMethod
|
|
10672
|
+
});
|
|
10673
|
+
}
|
|
10674
|
+
};
|
|
10675
|
+
return /* @__PURE__ */ jsx(
|
|
10676
|
+
Button,
|
|
10677
|
+
{
|
|
10678
|
+
size: "small",
|
|
10679
|
+
variant: "secondary",
|
|
10680
|
+
onClick: onToggle,
|
|
10681
|
+
className: "text-ui-fg-primary shrink-0",
|
|
10682
|
+
children
|
|
10683
|
+
}
|
|
10684
|
+
);
|
|
10685
|
+
};
|
|
10686
|
+
const ShippingProfileForm = ({
|
|
10687
|
+
data,
|
|
10688
|
+
order,
|
|
10689
|
+
preview
|
|
10690
|
+
}) => {
|
|
10691
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10692
|
+
const { setIsOpen } = useStackedModal();
|
|
10693
|
+
const form = useForm({
|
|
10694
|
+
resolver: zodResolver(shippingMethodSchema),
|
|
10695
|
+
defaultValues: {
|
|
10696
|
+
location_id: (_d = (_c = (_b = (_a = data.shippingOption) == null ? void 0 : _a.service_zone) == null ? void 0 : _b.fulfillment_set) == null ? void 0 : _c.location) == null ? void 0 : _d.id,
|
|
10697
|
+
shipping_option_id: (_e = data.shippingOption) == null ? void 0 : _e.id,
|
|
10698
|
+
custom_amount: (_f = data.shippingMethod) == null ? void 0 : _f.amount
|
|
10699
|
+
}
|
|
10700
|
+
});
|
|
10701
|
+
const { mutateAsync: addShippingMethod, isPending } = useDraftOrderAddShippingMethod(order.id);
|
|
10702
|
+
const {
|
|
10703
|
+
mutateAsync: updateShippingMethod,
|
|
10704
|
+
isPending: isUpdatingShippingMethod
|
|
10705
|
+
} = useDraftOrderUpdateShippingMethod(order.id);
|
|
10706
|
+
const onSubmit = form.handleSubmit(async (values) => {
|
|
10707
|
+
if (isEqual(values, form.formState.defaultValues)) {
|
|
10708
|
+
setIsOpen(STACKED_FOCUS_MODAL_ID, false);
|
|
10709
|
+
return;
|
|
10710
|
+
}
|
|
10711
|
+
if (data.shippingMethod) {
|
|
10712
|
+
await updateShippingMethod(
|
|
10713
|
+
{
|
|
10714
|
+
method_id: data.shippingMethod.id,
|
|
10715
|
+
shipping_option_id: values.shipping_option_id,
|
|
10716
|
+
custom_amount: values.custom_amount ? convertNumber(values.custom_amount) : void 0
|
|
10717
|
+
},
|
|
10718
|
+
{
|
|
10719
|
+
onError: (e) => {
|
|
10720
|
+
toast.error(e.message);
|
|
10721
|
+
},
|
|
10722
|
+
onSuccess: () => {
|
|
10723
|
+
setIsOpen(STACKED_FOCUS_MODAL_ID, false);
|
|
10724
|
+
}
|
|
10725
|
+
}
|
|
10726
|
+
);
|
|
10727
|
+
return;
|
|
10728
|
+
}
|
|
10729
|
+
await addShippingMethod(
|
|
10730
|
+
{
|
|
10731
|
+
shipping_option_id: values.shipping_option_id,
|
|
10732
|
+
custom_amount: values.custom_amount ? convertNumber(values.custom_amount) : void 0
|
|
10733
|
+
},
|
|
10734
|
+
{
|
|
10735
|
+
onError: (e) => {
|
|
10736
|
+
toast.error(e.message);
|
|
10737
|
+
},
|
|
10738
|
+
onSuccess: () => {
|
|
10739
|
+
setIsOpen(STACKED_FOCUS_MODAL_ID, false);
|
|
10740
|
+
}
|
|
10741
|
+
}
|
|
10742
|
+
);
|
|
10743
|
+
});
|
|
10744
|
+
return /* @__PURE__ */ jsx(StackedFocusModal.Content, { children: /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxs(
|
|
10745
|
+
KeyboundForm,
|
|
10746
|
+
{
|
|
10747
|
+
className: "flex h-full flex-col overflow-hidden",
|
|
10748
|
+
onSubmit,
|
|
10749
|
+
children: [
|
|
10750
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
10751
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
10752
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10753
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
10754
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a shipping method for the selected shipping profile. You can see the items that will be shipped using this method in the preview below." }) })
|
|
10755
|
+
] }),
|
|
10756
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10757
|
+
/* @__PURE__ */ jsx(
|
|
10758
|
+
LocationField,
|
|
10759
|
+
{
|
|
10760
|
+
control: form.control,
|
|
10761
|
+
setValue: form.setValue
|
|
10762
|
+
}
|
|
10763
|
+
),
|
|
10764
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10765
|
+
/* @__PURE__ */ jsx(
|
|
10766
|
+
ShippingOptionField,
|
|
10767
|
+
{
|
|
10768
|
+
shippingProfileId: data.shippingProfileId,
|
|
10769
|
+
preview,
|
|
10770
|
+
control: form.control
|
|
10771
|
+
}
|
|
10772
|
+
),
|
|
10773
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10774
|
+
/* @__PURE__ */ jsx(
|
|
10775
|
+
CustomAmountField,
|
|
10776
|
+
{
|
|
10777
|
+
control: form.control,
|
|
10778
|
+
currencyCode: order.currency_code
|
|
10779
|
+
}
|
|
10780
|
+
),
|
|
10781
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10782
|
+
/* @__PURE__ */ jsx(
|
|
10783
|
+
ItemsPreview,
|
|
10784
|
+
{
|
|
10785
|
+
order,
|
|
10786
|
+
shippingProfileId: data.shippingProfileId
|
|
10787
|
+
}
|
|
10788
|
+
)
|
|
10789
|
+
] }) }) }),
|
|
10790
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-x-2", children: [
|
|
10791
|
+
/* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
10792
|
+
/* @__PURE__ */ jsx(
|
|
10793
|
+
Button,
|
|
10794
|
+
{
|
|
10795
|
+
size: "small",
|
|
10796
|
+
type: "submit",
|
|
10797
|
+
isLoading: isPending || isUpdatingShippingMethod,
|
|
10798
|
+
children: data.shippingMethod ? "Update" : "Add"
|
|
10799
|
+
}
|
|
10800
|
+
)
|
|
10801
|
+
] }) })
|
|
10802
|
+
]
|
|
10803
|
+
}
|
|
10804
|
+
) }) });
|
|
10805
|
+
};
|
|
10806
|
+
const shippingMethodSchema = objectType({
|
|
10807
|
+
location_id: stringType(),
|
|
10808
|
+
shipping_option_id: stringType(),
|
|
10809
|
+
custom_amount: unionType([numberType(), stringType()]).optional()
|
|
10810
|
+
});
|
|
10811
|
+
const ItemsPreview = ({ order, shippingProfileId }) => {
|
|
10812
|
+
const matches = order.items.filter(
|
|
10813
|
+
(item) => {
|
|
10814
|
+
var _a, _b, _c;
|
|
10815
|
+
return ((_c = (_b = (_a = item.variant) == null ? void 0 : _a.product) == null ? void 0 : _b.shipping_profile) == null ? void 0 : _c.id) === shippingProfileId;
|
|
10816
|
+
}
|
|
10817
|
+
);
|
|
10818
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-6", children: [
|
|
10819
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 items-center gap-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
10820
|
+
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: "Items to ship" }),
|
|
10821
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Items with the selected shipping profile." })
|
|
10822
|
+
] }) }),
|
|
10823
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
|
|
10824
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 px-4 py-2 text-ui-fg-muted", children: [
|
|
10825
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: "Item" }) }),
|
|
10826
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: "Quantity" }) })
|
|
10827
|
+
] }),
|
|
10828
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsxs(
|
|
10829
|
+
"div",
|
|
10830
|
+
{
|
|
10831
|
+
className: "grid grid-cols-2 gap-3 px-4 py-2 bg-ui-bg-base shadow-elevation-card-rest rounded-lg items-center",
|
|
10832
|
+
children: [
|
|
10833
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
10834
|
+
/* @__PURE__ */ jsx(
|
|
10835
|
+
Thumbnail,
|
|
10836
|
+
{
|
|
10837
|
+
thumbnail: item.thumbnail,
|
|
10838
|
+
alt: item.product_title ?? void 0
|
|
10839
|
+
}
|
|
10840
|
+
),
|
|
10841
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
10842
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
|
|
10843
|
+
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: item.product_title }),
|
|
10844
|
+
/* @__PURE__ */ jsxs(
|
|
10845
|
+
Text,
|
|
10846
|
+
{
|
|
10847
|
+
size: "small",
|
|
10848
|
+
leading: "compact",
|
|
10849
|
+
className: "text-ui-fg-subtle",
|
|
10850
|
+
children: [
|
|
10851
|
+
"(",
|
|
10852
|
+
item.variant_title,
|
|
10853
|
+
")"
|
|
10854
|
+
]
|
|
10855
|
+
}
|
|
10856
|
+
)
|
|
10857
|
+
] }),
|
|
10858
|
+
/* @__PURE__ */ jsx(
|
|
10859
|
+
Text,
|
|
10860
|
+
{
|
|
10861
|
+
size: "small",
|
|
10862
|
+
leading: "compact",
|
|
10863
|
+
className: "text-ui-fg-subtle",
|
|
10864
|
+
children: item.variant_sku
|
|
10865
|
+
}
|
|
10866
|
+
)
|
|
10867
|
+
] })
|
|
10868
|
+
] }),
|
|
10869
|
+
/* @__PURE__ */ jsxs(
|
|
10870
|
+
Text,
|
|
10871
|
+
{
|
|
10872
|
+
size: "small",
|
|
10873
|
+
leading: "compact",
|
|
10874
|
+
className: "text-ui-fg-subtle",
|
|
10875
|
+
children: [
|
|
10876
|
+
item.quantity,
|
|
10877
|
+
"x"
|
|
10878
|
+
]
|
|
10879
|
+
}
|
|
10880
|
+
)
|
|
10881
|
+
]
|
|
10882
|
+
},
|
|
10883
|
+
item.id
|
|
10884
|
+
)) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-x-3 bg-ui-bg-base rounded-lg p-4 shadow-elevation-card-rest flex-col gap-1", children: [
|
|
10885
|
+
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
|
|
10886
|
+
/* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
10887
|
+
'No items found for "',
|
|
10888
|
+
query,
|
|
10889
|
+
'".'
|
|
10890
|
+
] })
|
|
10891
|
+
] }) })
|
|
10892
|
+
] })
|
|
10893
|
+
] });
|
|
10894
|
+
};
|
|
10895
|
+
const LocationField = ({ control, setValue }) => {
|
|
10896
|
+
const locations = useComboboxData({
|
|
10897
|
+
queryKey: ["locations"],
|
|
10898
|
+
queryFn: async (params) => {
|
|
10899
|
+
return await sdk.admin.stockLocation.list(params);
|
|
10900
|
+
},
|
|
10901
|
+
getOptions: (data) => {
|
|
10902
|
+
return data.stock_locations.map((location) => ({
|
|
10903
|
+
label: location.name,
|
|
10904
|
+
value: location.id
|
|
10905
|
+
}));
|
|
10906
|
+
}
|
|
10907
|
+
});
|
|
10908
|
+
return /* @__PURE__ */ jsx(
|
|
10909
|
+
Form$2.Field,
|
|
10910
|
+
{
|
|
10911
|
+
control,
|
|
10912
|
+
name: "location_id",
|
|
10913
|
+
render: ({ field: { onChange, ...field } }) => {
|
|
10914
|
+
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
10915
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10916
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Location" }),
|
|
10917
|
+
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose where you want to ship the items from." })
|
|
10918
|
+
] }),
|
|
10919
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10920
|
+
Combobox,
|
|
10921
|
+
{
|
|
10922
|
+
options: locations.options,
|
|
10923
|
+
fetchNextPage: locations.fetchNextPage,
|
|
10924
|
+
isFetchingNextPage: locations.isFetchingNextPage,
|
|
10925
|
+
searchValue: locations.searchValue,
|
|
10926
|
+
onSearchValueChange: locations.onSearchValueChange,
|
|
10927
|
+
placeholder: "Select location",
|
|
10928
|
+
onChange: (value) => {
|
|
10929
|
+
setValue("shipping_option_id", "", {
|
|
10930
|
+
shouldDirty: true,
|
|
10931
|
+
shouldTouch: true
|
|
10932
|
+
});
|
|
10933
|
+
onChange(value);
|
|
10934
|
+
},
|
|
10935
|
+
...field
|
|
10946
10936
|
}
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10937
|
+
) })
|
|
10938
|
+
] }) });
|
|
10939
|
+
}
|
|
10940
|
+
}
|
|
10941
|
+
);
|
|
10942
|
+
};
|
|
10943
|
+
const ShippingOptionField = ({
|
|
10944
|
+
shippingProfileId,
|
|
10945
|
+
preview,
|
|
10946
|
+
control
|
|
10947
|
+
}) => {
|
|
10948
|
+
var _a;
|
|
10949
|
+
const locationId = useWatch({ control, name: "location_id" });
|
|
10950
|
+
const shippingOptions = useComboboxData({
|
|
10951
|
+
queryKey: ["shipping_options", locationId, shippingProfileId],
|
|
10952
|
+
queryFn: async (params) => {
|
|
10953
|
+
return await sdk.admin.shippingOption.list({
|
|
10954
|
+
...params,
|
|
10955
|
+
stock_location_id: locationId,
|
|
10956
|
+
shipping_profile_id: shippingProfileId
|
|
10957
|
+
});
|
|
10958
|
+
},
|
|
10959
|
+
getOptions: (data) => {
|
|
10960
|
+
return data.shipping_options.map((option) => {
|
|
10961
|
+
var _a2;
|
|
10962
|
+
if ((_a2 = option.rules) == null ? void 0 : _a2.find(
|
|
10963
|
+
(r) => r.attribute === "is_return" && r.value === "true"
|
|
10964
|
+
)) {
|
|
10965
|
+
return void 0;
|
|
10966
|
+
}
|
|
10967
|
+
return {
|
|
10968
|
+
label: option.name,
|
|
10969
|
+
value: option.id
|
|
10970
|
+
};
|
|
10971
|
+
}).filter(Boolean);
|
|
10972
|
+
},
|
|
10973
|
+
enabled: !!locationId && !!shippingProfileId,
|
|
10974
|
+
defaultValue: ((_a = preview.shipping_methods[0]) == null ? void 0 : _a.shipping_option_id) || void 0
|
|
10975
|
+
});
|
|
10976
|
+
const tooltipContent = !locationId && !shippingProfileId ? "Choose a location and shipping profile first." : !locationId ? "Choose a location first." : "Choose a shipping profile first.";
|
|
10977
|
+
return /* @__PURE__ */ jsx(
|
|
10978
|
+
Form$2.Field,
|
|
10979
|
+
{
|
|
10980
|
+
control,
|
|
10981
|
+
name: "shipping_option_id",
|
|
10982
|
+
render: ({ field }) => {
|
|
10983
|
+
return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
10984
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
10985
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Shipping option" }),
|
|
10986
|
+
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose the shipping option to use." })
|
|
10987
|
+
] }),
|
|
10988
|
+
/* @__PURE__ */ jsx(
|
|
10989
|
+
ConditionalTooltip,
|
|
10990
|
+
{
|
|
10991
|
+
content: tooltipContent,
|
|
10992
|
+
showTooltip: !locationId || !shippingProfileId,
|
|
10993
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
10994
|
+
Combobox,
|
|
10995
|
+
{
|
|
10996
|
+
options: shippingOptions.options,
|
|
10997
|
+
fetchNextPage: shippingOptions.fetchNextPage,
|
|
10998
|
+
isFetchingNextPage: shippingOptions.isFetchingNextPage,
|
|
10999
|
+
searchValue: shippingOptions.searchValue,
|
|
11000
|
+
onSearchValueChange: shippingOptions.onSearchValueChange,
|
|
11001
|
+
placeholder: "Select shipping option",
|
|
11002
|
+
...field,
|
|
11003
|
+
disabled: !locationId || !shippingProfileId
|
|
11004
|
+
}
|
|
11005
|
+
) }) })
|
|
11006
|
+
}
|
|
11007
|
+
)
|
|
11008
|
+
] }) });
|
|
11009
|
+
}
|
|
11010
|
+
}
|
|
11011
|
+
);
|
|
11012
|
+
};
|
|
11013
|
+
const CustomAmountField = ({
|
|
11014
|
+
control,
|
|
11015
|
+
currencyCode
|
|
11016
|
+
}) => {
|
|
11017
|
+
return /* @__PURE__ */ jsx(
|
|
11018
|
+
Form$2.Field,
|
|
11019
|
+
{
|
|
11020
|
+
control,
|
|
11021
|
+
name: "custom_amount",
|
|
11022
|
+
render: ({ field: { onChange, ...field } }) => {
|
|
11023
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
11024
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
11025
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
|
|
11026
|
+
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
|
|
11027
|
+
] }),
|
|
11028
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11029
|
+
CurrencyInput,
|
|
11030
|
+
{
|
|
11031
|
+
...field,
|
|
11032
|
+
onValueChange: (value) => onChange(value),
|
|
11033
|
+
symbol: getNativeSymbol(currencyCode),
|
|
11034
|
+
code: currencyCode
|
|
11035
|
+
}
|
|
11036
|
+
) })
|
|
11037
|
+
] });
|
|
11038
|
+
}
|
|
11039
|
+
}
|
|
11040
|
+
);
|
|
11041
|
+
};
|
|
11042
|
+
const PROMOTION_QUERY_KEY = "promotions";
|
|
11043
|
+
const promotionsQueryKeys = {
|
|
11044
|
+
list: (query2) => [
|
|
11045
|
+
PROMOTION_QUERY_KEY,
|
|
11046
|
+
query2 ? query2 : void 0
|
|
11047
|
+
],
|
|
11048
|
+
detail: (id, query2) => [
|
|
11049
|
+
PROMOTION_QUERY_KEY,
|
|
11050
|
+
id,
|
|
11051
|
+
query2 ? query2 : void 0
|
|
11052
|
+
]
|
|
11053
|
+
};
|
|
11054
|
+
const usePromotions = (query2, options) => {
|
|
11055
|
+
const { data, ...rest } = useQuery({
|
|
11056
|
+
queryKey: promotionsQueryKeys.list(query2),
|
|
11057
|
+
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
11058
|
+
...options
|
|
11059
|
+
});
|
|
11060
|
+
return { ...data, ...rest };
|
|
11061
|
+
};
|
|
11062
|
+
const Promotions = () => {
|
|
11063
|
+
const { id } = useParams();
|
|
11064
|
+
const {
|
|
11065
|
+
order: preview,
|
|
11066
|
+
isError: isPreviewError,
|
|
11067
|
+
error: previewError
|
|
11068
|
+
} = useOrderPreview(id, void 0);
|
|
11069
|
+
useInitiateOrderEdit({ preview });
|
|
11070
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11071
|
+
if (isPreviewError) {
|
|
11072
|
+
throw previewError;
|
|
11073
|
+
}
|
|
11074
|
+
const isReady = !!preview;
|
|
11075
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
11076
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
|
|
11077
|
+
isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
|
|
11078
|
+
] });
|
|
11079
|
+
};
|
|
11080
|
+
const PromotionForm = ({ preview }) => {
|
|
11081
|
+
const { items, shipping_methods } = preview;
|
|
11082
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11083
|
+
const [comboboxValue, setComboboxValue] = useState("");
|
|
11084
|
+
const { handleSuccess } = useRouteModal();
|
|
11085
|
+
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
11086
|
+
const promoCodes = getPromotionCodes(items, shipping_methods);
|
|
11087
|
+
const { promotions, isPending, isError, error } = usePromotions(
|
|
11088
|
+
{
|
|
11089
|
+
code: promoCodes
|
|
11090
|
+
},
|
|
11091
|
+
{
|
|
11092
|
+
enabled: !!promoCodes.length
|
|
11093
|
+
}
|
|
11094
|
+
);
|
|
11095
|
+
const comboboxData = useComboboxData({
|
|
11096
|
+
queryKey: ["promotions", "combobox", promoCodes],
|
|
11097
|
+
queryFn: async (params) => {
|
|
11098
|
+
return await sdk.admin.promotion.list({
|
|
11099
|
+
...params,
|
|
11100
|
+
code: {
|
|
11101
|
+
$nin: promoCodes
|
|
10950
11102
|
}
|
|
10951
|
-
)
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
11103
|
+
});
|
|
11104
|
+
},
|
|
11105
|
+
getOptions: (data) => {
|
|
11106
|
+
return data.promotions.map((promotion) => ({
|
|
11107
|
+
label: promotion.code,
|
|
11108
|
+
value: promotion.code
|
|
11109
|
+
}));
|
|
11110
|
+
}
|
|
11111
|
+
});
|
|
11112
|
+
const add = async (value) => {
|
|
11113
|
+
if (!value) {
|
|
11114
|
+
return;
|
|
11115
|
+
}
|
|
11116
|
+
addPromotions(
|
|
11117
|
+
{
|
|
11118
|
+
promo_codes: [value]
|
|
11119
|
+
},
|
|
11120
|
+
{
|
|
11121
|
+
onError: (e) => {
|
|
11122
|
+
toast.error(e.message);
|
|
11123
|
+
comboboxData.onSearchValueChange("");
|
|
11124
|
+
setComboboxValue("");
|
|
11125
|
+
},
|
|
11126
|
+
onSuccess: () => {
|
|
11127
|
+
comboboxData.onSearchValueChange("");
|
|
11128
|
+
setComboboxValue("");
|
|
11129
|
+
}
|
|
11130
|
+
}
|
|
11131
|
+
);
|
|
11132
|
+
};
|
|
11133
|
+
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
11134
|
+
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
11135
|
+
const onSubmit = async () => {
|
|
11136
|
+
setIsSubmitting(true);
|
|
11137
|
+
let requestSucceeded = false;
|
|
11138
|
+
await requestOrderEdit(void 0, {
|
|
11139
|
+
onError: (e) => {
|
|
11140
|
+
toast.error(e.message);
|
|
11141
|
+
},
|
|
11142
|
+
onSuccess: () => {
|
|
11143
|
+
requestSucceeded = true;
|
|
11144
|
+
}
|
|
11145
|
+
});
|
|
11146
|
+
if (!requestSucceeded) {
|
|
11147
|
+
setIsSubmitting(false);
|
|
11148
|
+
return;
|
|
11149
|
+
}
|
|
11150
|
+
await confirmOrderEdit(void 0, {
|
|
11151
|
+
onError: (e) => {
|
|
11152
|
+
toast.error(e.message);
|
|
11153
|
+
},
|
|
11154
|
+
onSuccess: () => {
|
|
11155
|
+
handleSuccess();
|
|
11156
|
+
},
|
|
11157
|
+
onSettled: () => {
|
|
11158
|
+
setIsSubmitting(false);
|
|
11159
|
+
}
|
|
11160
|
+
});
|
|
11161
|
+
};
|
|
11162
|
+
if (isError) {
|
|
11163
|
+
throw error;
|
|
11164
|
+
}
|
|
11165
|
+
return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
11166
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
11167
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
11168
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
11169
|
+
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
11170
|
+
/* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
11171
|
+
] }),
|
|
11172
|
+
/* @__PURE__ */ jsx(
|
|
11173
|
+
Combobox,
|
|
11174
|
+
{
|
|
11175
|
+
id: "promotion-combobox",
|
|
11176
|
+
"aria-describedby": "promotion-combobox-hint",
|
|
11177
|
+
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
11178
|
+
fetchNextPage: comboboxData.fetchNextPage,
|
|
11179
|
+
options: comboboxData.options,
|
|
11180
|
+
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
11181
|
+
searchValue: comboboxData.searchValue,
|
|
11182
|
+
disabled: comboboxData.disabled || isAddingPromotions,
|
|
11183
|
+
onChange: add,
|
|
11184
|
+
value: comboboxValue
|
|
11185
|
+
}
|
|
11186
|
+
)
|
|
11187
|
+
] }),
|
|
11188
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11189
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
|
|
11190
|
+
PromotionItem,
|
|
11191
|
+
{
|
|
11192
|
+
promotion,
|
|
11193
|
+
orderId: preview.id,
|
|
11194
|
+
isLoading: isPending
|
|
11195
|
+
},
|
|
11196
|
+
promotion.id
|
|
11197
|
+
)) })
|
|
11198
|
+
] }) }),
|
|
11199
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11200
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10955
11201
|
/* @__PURE__ */ jsx(
|
|
10956
11202
|
Button,
|
|
10957
11203
|
{
|
|
10958
11204
|
size: "small",
|
|
10959
|
-
type: "
|
|
10960
|
-
isLoading: isSubmitting,
|
|
10961
|
-
onClick: onSubmit,
|
|
11205
|
+
type: "submit",
|
|
11206
|
+
isLoading: isSubmitting || isAddingPromotions,
|
|
10962
11207
|
children: "Save"
|
|
10963
11208
|
}
|
|
10964
11209
|
)
|
|
10965
11210
|
] }) })
|
|
10966
11211
|
] });
|
|
10967
11212
|
};
|
|
10968
|
-
const
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
setData,
|
|
10973
|
-
children
|
|
11213
|
+
const PromotionItem = ({
|
|
11214
|
+
promotion,
|
|
11215
|
+
orderId,
|
|
11216
|
+
isLoading
|
|
10974
11217
|
}) => {
|
|
10975
|
-
|
|
10976
|
-
const
|
|
10977
|
-
const
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
}
|
|
11218
|
+
var _a;
|
|
11219
|
+
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
11220
|
+
const onRemove = async () => {
|
|
11221
|
+
removePromotions(
|
|
11222
|
+
{
|
|
11223
|
+
promo_codes: [promotion.code]
|
|
11224
|
+
},
|
|
11225
|
+
{
|
|
11226
|
+
onError: (e) => {
|
|
11227
|
+
toast.error(e.message);
|
|
11228
|
+
}
|
|
11229
|
+
}
|
|
11230
|
+
);
|
|
10989
11231
|
};
|
|
10990
|
-
|
|
10991
|
-
|
|
11232
|
+
const displayValue = getDisplayValue(promotion);
|
|
11233
|
+
return /* @__PURE__ */ jsxs(
|
|
11234
|
+
"div",
|
|
10992
11235
|
{
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
onClick: onToggle,
|
|
10996
|
-
className: "text-ui-fg-primary shrink-0",
|
|
10997
|
-
children
|
|
10998
|
-
}
|
|
10999
|
-
);
|
|
11000
|
-
};
|
|
11001
|
-
const ShippingProfileForm = ({
|
|
11002
|
-
data,
|
|
11003
|
-
order,
|
|
11004
|
-
preview
|
|
11005
|
-
}) => {
|
|
11006
|
-
var _a, _b, _c, _d, _e, _f;
|
|
11007
|
-
const { setIsOpen } = useStackedModal();
|
|
11008
|
-
const form = useForm({
|
|
11009
|
-
resolver: zodResolver(shippingMethodSchema),
|
|
11010
|
-
defaultValues: {
|
|
11011
|
-
location_id: (_d = (_c = (_b = (_a = data.shippingOption) == null ? void 0 : _a.service_zone) == null ? void 0 : _b.fulfillment_set) == null ? void 0 : _c.location) == null ? void 0 : _d.id,
|
|
11012
|
-
shipping_option_id: (_e = data.shippingOption) == null ? void 0 : _e.id,
|
|
11013
|
-
custom_amount: (_f = data.shippingMethod) == null ? void 0 : _f.amount
|
|
11014
|
-
}
|
|
11015
|
-
});
|
|
11016
|
-
const { mutateAsync: addShippingMethod, isPending } = useDraftOrderAddShippingMethod(order.id);
|
|
11017
|
-
const {
|
|
11018
|
-
mutateAsync: updateShippingMethod,
|
|
11019
|
-
isPending: isUpdatingShippingMethod
|
|
11020
|
-
} = useDraftOrderUpdateShippingMethod(order.id);
|
|
11021
|
-
const onSubmit = form.handleSubmit(async (values) => {
|
|
11022
|
-
if (isEqual(values, form.formState.defaultValues)) {
|
|
11023
|
-
setIsOpen(STACKED_FOCUS_MODAL_ID, false);
|
|
11024
|
-
return;
|
|
11025
|
-
}
|
|
11026
|
-
if (data.shippingMethod) {
|
|
11027
|
-
await updateShippingMethod(
|
|
11028
|
-
{
|
|
11029
|
-
method_id: data.shippingMethod.id,
|
|
11030
|
-
shipping_option_id: values.shipping_option_id,
|
|
11031
|
-
custom_amount: values.custom_amount ? convertNumber(values.custom_amount) : void 0
|
|
11032
|
-
},
|
|
11236
|
+
className: clx(
|
|
11237
|
+
"px-3 py-2 rounded-lg bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between",
|
|
11033
11238
|
{
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11239
|
+
"animate-pulse": isLoading
|
|
11240
|
+
}
|
|
11241
|
+
),
|
|
11242
|
+
children: [
|
|
11243
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11244
|
+
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
11245
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-ui-fg-subtle", children: [
|
|
11246
|
+
displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
11247
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
|
|
11248
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
|
|
11249
|
+
] }),
|
|
11250
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
11251
|
+
] })
|
|
11252
|
+
] }),
|
|
11253
|
+
/* @__PURE__ */ jsx(
|
|
11254
|
+
IconButton,
|
|
11255
|
+
{
|
|
11256
|
+
size: "small",
|
|
11257
|
+
type: "button",
|
|
11258
|
+
variant: "transparent",
|
|
11259
|
+
onClick: onRemove,
|
|
11260
|
+
isLoading: isPending || isLoading,
|
|
11261
|
+
children: /* @__PURE__ */ jsx(XMark, {})
|
|
11039
11262
|
}
|
|
11263
|
+
)
|
|
11264
|
+
]
|
|
11265
|
+
},
|
|
11266
|
+
promotion.id
|
|
11267
|
+
);
|
|
11268
|
+
};
|
|
11269
|
+
function getDisplayValue(promotion) {
|
|
11270
|
+
var _a, _b, _c, _d;
|
|
11271
|
+
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
11272
|
+
if (!value) {
|
|
11273
|
+
return null;
|
|
11274
|
+
}
|
|
11275
|
+
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
11276
|
+
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
11277
|
+
if (!currency) {
|
|
11278
|
+
return null;
|
|
11279
|
+
}
|
|
11280
|
+
return getLocaleAmount(value, currency);
|
|
11281
|
+
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
11282
|
+
return formatPercentage(value);
|
|
11283
|
+
}
|
|
11284
|
+
return null;
|
|
11285
|
+
}
|
|
11286
|
+
const formatter = new Intl.NumberFormat([], {
|
|
11287
|
+
style: "percent",
|
|
11288
|
+
minimumFractionDigits: 2
|
|
11289
|
+
});
|
|
11290
|
+
const formatPercentage = (value, isPercentageValue = false) => {
|
|
11291
|
+
let val = value || 0;
|
|
11292
|
+
if (!isPercentageValue) {
|
|
11293
|
+
val = val / 100;
|
|
11294
|
+
}
|
|
11295
|
+
return formatter.format(val);
|
|
11296
|
+
};
|
|
11297
|
+
function getPromotionCodes(items, shippingMethods) {
|
|
11298
|
+
const codes = /* @__PURE__ */ new Set();
|
|
11299
|
+
for (const item of items) {
|
|
11300
|
+
if (item.adjustments) {
|
|
11301
|
+
for (const adjustment of item.adjustments) {
|
|
11302
|
+
if (adjustment.code) {
|
|
11303
|
+
codes.add(adjustment.code);
|
|
11040
11304
|
}
|
|
11041
|
-
|
|
11042
|
-
return;
|
|
11305
|
+
}
|
|
11043
11306
|
}
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
onError: (e) => {
|
|
11051
|
-
toast.error(e.message);
|
|
11052
|
-
},
|
|
11053
|
-
onSuccess: () => {
|
|
11054
|
-
setIsOpen(STACKED_FOCUS_MODAL_ID, false);
|
|
11307
|
+
}
|
|
11308
|
+
for (const shippingMethod of shippingMethods) {
|
|
11309
|
+
if (shippingMethod.adjustments) {
|
|
11310
|
+
for (const adjustment of shippingMethod.adjustments) {
|
|
11311
|
+
if (adjustment.code) {
|
|
11312
|
+
codes.add(adjustment.code);
|
|
11055
11313
|
}
|
|
11056
11314
|
}
|
|
11057
|
-
);
|
|
11058
|
-
});
|
|
11059
|
-
return /* @__PURE__ */ jsx(StackedFocusModal.Content, { children: /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxs(
|
|
11060
|
-
KeyboundForm,
|
|
11061
|
-
{
|
|
11062
|
-
className: "flex h-full flex-col overflow-hidden",
|
|
11063
|
-
onSubmit,
|
|
11064
|
-
children: [
|
|
11065
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Header, {}),
|
|
11066
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
|
|
11067
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
11068
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11069
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a shipping method for the selected shipping profile. You can see the items that will be shipped using this method in the preview below." }) })
|
|
11070
|
-
] }),
|
|
11071
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11072
|
-
/* @__PURE__ */ jsx(
|
|
11073
|
-
LocationField,
|
|
11074
|
-
{
|
|
11075
|
-
control: form.control,
|
|
11076
|
-
setValue: form.setValue
|
|
11077
|
-
}
|
|
11078
|
-
),
|
|
11079
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11080
|
-
/* @__PURE__ */ jsx(
|
|
11081
|
-
ShippingOptionField,
|
|
11082
|
-
{
|
|
11083
|
-
shippingProfileId: data.shippingProfileId,
|
|
11084
|
-
preview,
|
|
11085
|
-
control: form.control
|
|
11086
|
-
}
|
|
11087
|
-
),
|
|
11088
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11089
|
-
/* @__PURE__ */ jsx(
|
|
11090
|
-
CustomAmountField,
|
|
11091
|
-
{
|
|
11092
|
-
control: form.control,
|
|
11093
|
-
currencyCode: order.currency_code
|
|
11094
|
-
}
|
|
11095
|
-
),
|
|
11096
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11097
|
-
/* @__PURE__ */ jsx(
|
|
11098
|
-
ItemsPreview,
|
|
11099
|
-
{
|
|
11100
|
-
order,
|
|
11101
|
-
shippingProfileId: data.shippingProfileId
|
|
11102
|
-
}
|
|
11103
|
-
)
|
|
11104
|
-
] }) }) }),
|
|
11105
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-x-2", children: [
|
|
11106
|
-
/* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
11107
|
-
/* @__PURE__ */ jsx(
|
|
11108
|
-
Button,
|
|
11109
|
-
{
|
|
11110
|
-
size: "small",
|
|
11111
|
-
type: "submit",
|
|
11112
|
-
isLoading: isPending || isUpdatingShippingMethod,
|
|
11113
|
-
children: data.shippingMethod ? "Update" : "Add"
|
|
11114
|
-
}
|
|
11115
|
-
)
|
|
11116
|
-
] }) })
|
|
11117
|
-
]
|
|
11118
11315
|
}
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11316
|
+
}
|
|
11317
|
+
return Array.from(codes);
|
|
11318
|
+
}
|
|
11319
|
+
const SalesChannel = () => {
|
|
11320
|
+
const { id } = useParams();
|
|
11321
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11322
|
+
id,
|
|
11323
|
+
{
|
|
11324
|
+
fields: "+sales_channel_id"
|
|
11325
|
+
},
|
|
11326
|
+
{
|
|
11327
|
+
enabled: !!id
|
|
11131
11328
|
}
|
|
11132
11329
|
);
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
/* @__PURE__ */ jsxs(
|
|
11139
|
-
/* @__PURE__ */
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsxs(
|
|
11144
|
-
"div",
|
|
11145
|
-
{
|
|
11146
|
-
className: "grid grid-cols-2 gap-3 px-4 py-2 bg-ui-bg-base shadow-elevation-card-rest rounded-lg items-center",
|
|
11147
|
-
children: [
|
|
11148
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
11149
|
-
/* @__PURE__ */ jsx(
|
|
11150
|
-
Thumbnail,
|
|
11151
|
-
{
|
|
11152
|
-
thumbnail: item.thumbnail,
|
|
11153
|
-
alt: item.product_title ?? void 0
|
|
11154
|
-
}
|
|
11155
|
-
),
|
|
11156
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
11157
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
|
|
11158
|
-
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: item.product_title }),
|
|
11159
|
-
/* @__PURE__ */ jsxs(
|
|
11160
|
-
Text,
|
|
11161
|
-
{
|
|
11162
|
-
size: "small",
|
|
11163
|
-
leading: "compact",
|
|
11164
|
-
className: "text-ui-fg-subtle",
|
|
11165
|
-
children: [
|
|
11166
|
-
"(",
|
|
11167
|
-
item.variant_title,
|
|
11168
|
-
")"
|
|
11169
|
-
]
|
|
11170
|
-
}
|
|
11171
|
-
)
|
|
11172
|
-
] }),
|
|
11173
|
-
/* @__PURE__ */ jsx(
|
|
11174
|
-
Text,
|
|
11175
|
-
{
|
|
11176
|
-
size: "small",
|
|
11177
|
-
leading: "compact",
|
|
11178
|
-
className: "text-ui-fg-subtle",
|
|
11179
|
-
children: item.variant_sku
|
|
11180
|
-
}
|
|
11181
|
-
)
|
|
11182
|
-
] })
|
|
11183
|
-
] }),
|
|
11184
|
-
/* @__PURE__ */ jsxs(
|
|
11185
|
-
Text,
|
|
11186
|
-
{
|
|
11187
|
-
size: "small",
|
|
11188
|
-
leading: "compact",
|
|
11189
|
-
className: "text-ui-fg-subtle",
|
|
11190
|
-
children: [
|
|
11191
|
-
item.quantity,
|
|
11192
|
-
"x"
|
|
11193
|
-
]
|
|
11194
|
-
}
|
|
11195
|
-
)
|
|
11196
|
-
]
|
|
11197
|
-
},
|
|
11198
|
-
item.id
|
|
11199
|
-
)) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-x-3 bg-ui-bg-base rounded-lg p-4 shadow-elevation-card-rest flex-col gap-1", children: [
|
|
11200
|
-
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
|
|
11201
|
-
/* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
11202
|
-
'No items found for "',
|
|
11203
|
-
query,
|
|
11204
|
-
'".'
|
|
11205
|
-
] })
|
|
11206
|
-
] }) })
|
|
11207
|
-
] })
|
|
11330
|
+
if (isError) {
|
|
11331
|
+
throw error;
|
|
11332
|
+
}
|
|
11333
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11334
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11335
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11336
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11337
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11338
|
+
] }),
|
|
11339
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11208
11340
|
] });
|
|
11209
11341
|
};
|
|
11210
|
-
const
|
|
11211
|
-
const
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
return await sdk.admin.stockLocation.list(params);
|
|
11342
|
+
const SalesChannelForm = ({ order }) => {
|
|
11343
|
+
const form = useForm({
|
|
11344
|
+
defaultValues: {
|
|
11345
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11215
11346
|
},
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11347
|
+
resolver: zodResolver(schema$2)
|
|
11348
|
+
});
|
|
11349
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11350
|
+
const { handleSuccess } = useRouteModal();
|
|
11351
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11352
|
+
await mutateAsync(
|
|
11353
|
+
{
|
|
11354
|
+
sales_channel_id: data.sales_channel_id
|
|
11355
|
+
},
|
|
11356
|
+
{
|
|
11357
|
+
onSuccess: () => {
|
|
11358
|
+
toast.success("Sales channel updated");
|
|
11359
|
+
handleSuccess();
|
|
11360
|
+
},
|
|
11361
|
+
onError: (error) => {
|
|
11362
|
+
toast.error(error.message);
|
|
11363
|
+
}
|
|
11364
|
+
}
|
|
11365
|
+
);
|
|
11222
11366
|
});
|
|
11223
|
-
return /* @__PURE__ */ jsx(
|
|
11224
|
-
|
|
11367
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11368
|
+
KeyboundForm,
|
|
11225
11369
|
{
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
Combobox,
|
|
11236
|
-
{
|
|
11237
|
-
options: locations.options,
|
|
11238
|
-
fetchNextPage: locations.fetchNextPage,
|
|
11239
|
-
isFetchingNextPage: locations.isFetchingNextPage,
|
|
11240
|
-
searchValue: locations.searchValue,
|
|
11241
|
-
onSearchValueChange: locations.onSearchValueChange,
|
|
11242
|
-
placeholder: "Select location",
|
|
11243
|
-
onChange: (value) => {
|
|
11244
|
-
setValue("shipping_option_id", "", {
|
|
11245
|
-
shouldDirty: true,
|
|
11246
|
-
shouldTouch: true
|
|
11247
|
-
});
|
|
11248
|
-
onChange(value);
|
|
11249
|
-
},
|
|
11250
|
-
...field
|
|
11251
|
-
}
|
|
11252
|
-
) })
|
|
11253
|
-
] }) });
|
|
11254
|
-
}
|
|
11370
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11371
|
+
onSubmit,
|
|
11372
|
+
children: [
|
|
11373
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11374
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11375
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11376
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11377
|
+
] }) })
|
|
11378
|
+
]
|
|
11255
11379
|
}
|
|
11256
|
-
);
|
|
11380
|
+
) });
|
|
11257
11381
|
};
|
|
11258
|
-
const
|
|
11259
|
-
|
|
11260
|
-
preview,
|
|
11261
|
-
control
|
|
11262
|
-
}) => {
|
|
11263
|
-
var _a;
|
|
11264
|
-
const locationId = useWatch({ control, name: "location_id" });
|
|
11265
|
-
const shippingOptions = useComboboxData({
|
|
11266
|
-
queryKey: ["shipping_options", locationId, shippingProfileId],
|
|
11382
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11383
|
+
const salesChannels = useComboboxData({
|
|
11267
11384
|
queryFn: async (params) => {
|
|
11268
|
-
return await sdk.admin.
|
|
11269
|
-
...params,
|
|
11270
|
-
stock_location_id: locationId,
|
|
11271
|
-
shipping_profile_id: shippingProfileId
|
|
11272
|
-
});
|
|
11385
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11273
11386
|
},
|
|
11387
|
+
queryKey: ["sales-channels"],
|
|
11274
11388
|
getOptions: (data) => {
|
|
11275
|
-
return data.
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
)) {
|
|
11280
|
-
return void 0;
|
|
11281
|
-
}
|
|
11282
|
-
return {
|
|
11283
|
-
label: option.name,
|
|
11284
|
-
value: option.id
|
|
11285
|
-
};
|
|
11286
|
-
}).filter(Boolean);
|
|
11389
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11390
|
+
label: salesChannel.name,
|
|
11391
|
+
value: salesChannel.id
|
|
11392
|
+
}));
|
|
11287
11393
|
},
|
|
11288
|
-
|
|
11289
|
-
defaultValue: ((_a = preview.shipping_methods[0]) == null ? void 0 : _a.shipping_option_id) || void 0
|
|
11394
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11290
11395
|
});
|
|
11291
|
-
const tooltipContent = !locationId && !shippingProfileId ? "Choose a location and shipping profile first." : !locationId ? "Choose a location first." : "Choose a shipping profile first.";
|
|
11292
11396
|
return /* @__PURE__ */ jsx(
|
|
11293
11397
|
Form$2.Field,
|
|
11294
11398
|
{
|
|
11295
11399
|
control,
|
|
11296
|
-
name: "
|
|
11400
|
+
name: "sales_channel_id",
|
|
11297
11401
|
render: ({ field }) => {
|
|
11298
|
-
return /* @__PURE__ */
|
|
11299
|
-
/* @__PURE__ */
|
|
11300
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Shipping option" }),
|
|
11301
|
-
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Choose the shipping option to use." })
|
|
11302
|
-
] }),
|
|
11303
|
-
/* @__PURE__ */ jsx(
|
|
11304
|
-
ConditionalTooltip,
|
|
11305
|
-
{
|
|
11306
|
-
content: tooltipContent,
|
|
11307
|
-
showTooltip: !locationId || !shippingProfileId,
|
|
11308
|
-
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11309
|
-
Combobox,
|
|
11310
|
-
{
|
|
11311
|
-
options: shippingOptions.options,
|
|
11312
|
-
fetchNextPage: shippingOptions.fetchNextPage,
|
|
11313
|
-
isFetchingNextPage: shippingOptions.isFetchingNextPage,
|
|
11314
|
-
searchValue: shippingOptions.searchValue,
|
|
11315
|
-
onSearchValueChange: shippingOptions.onSearchValueChange,
|
|
11316
|
-
placeholder: "Select shipping option",
|
|
11317
|
-
...field,
|
|
11318
|
-
disabled: !locationId || !shippingProfileId
|
|
11319
|
-
}
|
|
11320
|
-
) }) })
|
|
11321
|
-
}
|
|
11322
|
-
)
|
|
11323
|
-
] }) });
|
|
11324
|
-
}
|
|
11325
|
-
}
|
|
11326
|
-
);
|
|
11327
|
-
};
|
|
11328
|
-
const CustomAmountField = ({
|
|
11329
|
-
control,
|
|
11330
|
-
currencyCode
|
|
11331
|
-
}) => {
|
|
11332
|
-
return /* @__PURE__ */ jsx(
|
|
11333
|
-
Form$2.Field,
|
|
11334
|
-
{
|
|
11335
|
-
control,
|
|
11336
|
-
name: "custom_amount",
|
|
11337
|
-
render: ({ field: { onChange, ...field } }) => {
|
|
11338
|
-
return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
11339
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
11340
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
|
|
11341
|
-
/* @__PURE__ */ jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
|
|
11342
|
-
] }),
|
|
11402
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11403
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11343
11404
|
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11344
|
-
|
|
11405
|
+
Combobox,
|
|
11345
11406
|
{
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11407
|
+
options: salesChannels.options,
|
|
11408
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11409
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11410
|
+
searchValue: salesChannels.searchValue,
|
|
11411
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11412
|
+
placeholder: "Select sales channel",
|
|
11413
|
+
...field
|
|
11350
11414
|
}
|
|
11351
|
-
) })
|
|
11415
|
+
) }),
|
|
11416
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11352
11417
|
] });
|
|
11353
11418
|
}
|
|
11354
11419
|
}
|
|
11355
11420
|
);
|
|
11356
11421
|
};
|
|
11422
|
+
const schema$2 = objectType({
|
|
11423
|
+
sales_channel_id: stringType().min(1)
|
|
11424
|
+
});
|
|
11357
11425
|
const ShippingAddress = () => {
|
|
11358
11426
|
const { id } = useParams();
|
|
11359
11427
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -11386,7 +11454,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11386
11454
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11387
11455
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11388
11456
|
},
|
|
11389
|
-
resolver: zodResolver(schema$
|
|
11457
|
+
resolver: zodResolver(schema$1)
|
|
11390
11458
|
});
|
|
11391
11459
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11392
11460
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11556,7 +11624,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11556
11624
|
}
|
|
11557
11625
|
) });
|
|
11558
11626
|
};
|
|
11559
|
-
const schema$
|
|
11627
|
+
const schema$1 = addressSchema;
|
|
11560
11628
|
const TransferOwnership = () => {
|
|
11561
11629
|
const { id } = useParams();
|
|
11562
11630
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -11580,7 +11648,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
11580
11648
|
defaultValues: {
|
|
11581
11649
|
customer_id: order.customer_id || ""
|
|
11582
11650
|
},
|
|
11583
|
-
resolver: zodResolver(schema
|
|
11651
|
+
resolver: zodResolver(schema)
|
|
11584
11652
|
});
|
|
11585
11653
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11586
11654
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12030,76 +12098,8 @@ const Illustration = () => {
|
|
|
12030
12098
|
}
|
|
12031
12099
|
);
|
|
12032
12100
|
};
|
|
12033
|
-
const schema$1 = objectType({
|
|
12034
|
-
customer_id: stringType().min(1)
|
|
12035
|
-
});
|
|
12036
|
-
const Email = () => {
|
|
12037
|
-
const { id } = useParams();
|
|
12038
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12039
|
-
fields: "+email"
|
|
12040
|
-
});
|
|
12041
|
-
if (isError) {
|
|
12042
|
-
throw error;
|
|
12043
|
-
}
|
|
12044
|
-
const isReady = !isPending && !!order;
|
|
12045
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12046
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12047
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12048
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12049
|
-
] }),
|
|
12050
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12051
|
-
] });
|
|
12052
|
-
};
|
|
12053
|
-
const EmailForm = ({ order }) => {
|
|
12054
|
-
const form = useForm({
|
|
12055
|
-
defaultValues: {
|
|
12056
|
-
email: order.email ?? ""
|
|
12057
|
-
},
|
|
12058
|
-
resolver: zodResolver(schema)
|
|
12059
|
-
});
|
|
12060
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12061
|
-
const { handleSuccess } = useRouteModal();
|
|
12062
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12063
|
-
await mutateAsync(
|
|
12064
|
-
{ email: data.email },
|
|
12065
|
-
{
|
|
12066
|
-
onSuccess: () => {
|
|
12067
|
-
handleSuccess();
|
|
12068
|
-
},
|
|
12069
|
-
onError: (error) => {
|
|
12070
|
-
toast.error(error.message);
|
|
12071
|
-
}
|
|
12072
|
-
}
|
|
12073
|
-
);
|
|
12074
|
-
});
|
|
12075
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12076
|
-
KeyboundForm,
|
|
12077
|
-
{
|
|
12078
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12079
|
-
onSubmit,
|
|
12080
|
-
children: [
|
|
12081
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
12082
|
-
Form$2.Field,
|
|
12083
|
-
{
|
|
12084
|
-
control: form.control,
|
|
12085
|
-
name: "email",
|
|
12086
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12087
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
12088
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12089
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12090
|
-
] })
|
|
12091
|
-
}
|
|
12092
|
-
) }),
|
|
12093
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12094
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12095
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12096
|
-
] }) })
|
|
12097
|
-
]
|
|
12098
|
-
}
|
|
12099
|
-
) });
|
|
12100
|
-
};
|
|
12101
12101
|
const schema = objectType({
|
|
12102
|
-
|
|
12102
|
+
customer_id: stringType().min(1)
|
|
12103
12103
|
});
|
|
12104
12104
|
const NumberInput = forwardRef(
|
|
12105
12105
|
({
|
|
@@ -13046,18 +13046,26 @@ const routeModule = {
|
|
|
13046
13046
|
handle,
|
|
13047
13047
|
loader,
|
|
13048
13048
|
children: [
|
|
13049
|
+
{
|
|
13050
|
+
Component: CustomItems,
|
|
13051
|
+
path: "/draft-orders/:id/custom-items"
|
|
13052
|
+
},
|
|
13049
13053
|
{
|
|
13050
13054
|
Component: BillingAddress,
|
|
13051
13055
|
path: "/draft-orders/:id/billing-address"
|
|
13052
13056
|
},
|
|
13053
13057
|
{
|
|
13054
|
-
Component:
|
|
13055
|
-
path: "/draft-orders/:id/
|
|
13058
|
+
Component: Email,
|
|
13059
|
+
path: "/draft-orders/:id/email"
|
|
13056
13060
|
},
|
|
13057
13061
|
{
|
|
13058
13062
|
Component: Metadata,
|
|
13059
13063
|
path: "/draft-orders/:id/metadata"
|
|
13060
13064
|
},
|
|
13065
|
+
{
|
|
13066
|
+
Component: Shipping,
|
|
13067
|
+
path: "/draft-orders/:id/shipping"
|
|
13068
|
+
},
|
|
13061
13069
|
{
|
|
13062
13070
|
Component: Promotions,
|
|
13063
13071
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13066,10 +13074,6 @@ const routeModule = {
|
|
|
13066
13074
|
Component: SalesChannel,
|
|
13067
13075
|
path: "/draft-orders/:id/sales-channel"
|
|
13068
13076
|
},
|
|
13069
|
-
{
|
|
13070
|
-
Component: Shipping,
|
|
13071
|
-
path: "/draft-orders/:id/shipping"
|
|
13072
|
-
},
|
|
13073
13077
|
{
|
|
13074
13078
|
Component: ShippingAddress,
|
|
13075
13079
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -13078,10 +13082,6 @@ const routeModule = {
|
|
|
13078
13082
|
Component: TransferOwnership,
|
|
13079
13083
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13080
13084
|
},
|
|
13081
|
-
{
|
|
13082
|
-
Component: Email,
|
|
13083
|
-
path: "/draft-orders/:id/email"
|
|
13084
|
-
},
|
|
13085
13085
|
{
|
|
13086
13086
|
Component: Items,
|
|
13087
13087
|
path: "/draft-orders/:id/items"
|