@medusajs/draft-order 2.11.2-preview-20251027180157 → 2.11.2-preview-20251027210155
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 +575 -575
- package/.medusa/server/src/admin/index.mjs +575 -575
- package/package.json +16 -16
|
@@ -9755,27 +9755,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9755
9755
|
) });
|
|
9756
9756
|
};
|
|
9757
9757
|
const schema$5 = addressSchema;
|
|
9758
|
-
const CustomItems = () => {
|
|
9759
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9760
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9761
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9762
|
-
] });
|
|
9763
|
-
};
|
|
9764
|
-
const CustomItemsForm = () => {
|
|
9765
|
-
const form = useForm({
|
|
9766
|
-
resolver: zodResolver(schema$4)
|
|
9767
|
-
});
|
|
9768
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9769
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9770
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9771
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9772
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9773
|
-
] }) })
|
|
9774
|
-
] }) });
|
|
9775
|
-
};
|
|
9776
|
-
const schema$4 = objectType({
|
|
9777
|
-
email: stringType().email()
|
|
9778
|
-
});
|
|
9779
9758
|
const Email = () => {
|
|
9780
9759
|
const { id } = useParams();
|
|
9781
9760
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9798,7 +9777,7 @@ const EmailForm = ({ order }) => {
|
|
|
9798
9777
|
defaultValues: {
|
|
9799
9778
|
email: order.email ?? ""
|
|
9800
9779
|
},
|
|
9801
|
-
resolver: zodResolver(schema$
|
|
9780
|
+
resolver: zodResolver(schema$4)
|
|
9802
9781
|
});
|
|
9803
9782
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9804
9783
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9841,6 +9820,27 @@ const EmailForm = ({ order }) => {
|
|
|
9841
9820
|
}
|
|
9842
9821
|
) });
|
|
9843
9822
|
};
|
|
9823
|
+
const schema$4 = objectType({
|
|
9824
|
+
email: stringType().email()
|
|
9825
|
+
});
|
|
9826
|
+
const CustomItems = () => {
|
|
9827
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9828
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9829
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9830
|
+
] });
|
|
9831
|
+
};
|
|
9832
|
+
const CustomItemsForm = () => {
|
|
9833
|
+
const form = useForm({
|
|
9834
|
+
resolver: zodResolver(schema$3)
|
|
9835
|
+
});
|
|
9836
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9837
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9838
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9839
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9840
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9841
|
+
] }) })
|
|
9842
|
+
] }) });
|
|
9843
|
+
};
|
|
9844
9844
|
const schema$3 = objectType({
|
|
9845
9845
|
email: stringType().email()
|
|
9846
9846
|
});
|
|
@@ -11168,193 +11168,470 @@ function getHasUneditableRows(metadata) {
|
|
|
11168
11168
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11169
11169
|
);
|
|
11170
11170
|
}
|
|
11171
|
-
const
|
|
11172
|
-
|
|
11173
|
-
|
|
11171
|
+
const PROMOTION_QUERY_KEY = "promotions";
|
|
11172
|
+
const promotionsQueryKeys = {
|
|
11173
|
+
list: (query2) => [
|
|
11174
|
+
PROMOTION_QUERY_KEY,
|
|
11175
|
+
query2 ? query2 : void 0
|
|
11176
|
+
],
|
|
11177
|
+
detail: (id, query2) => [
|
|
11178
|
+
PROMOTION_QUERY_KEY,
|
|
11174
11179
|
id,
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
},
|
|
11178
|
-
{
|
|
11179
|
-
enabled: !!id
|
|
11180
|
-
}
|
|
11181
|
-
);
|
|
11182
|
-
if (isError) {
|
|
11183
|
-
throw error;
|
|
11184
|
-
}
|
|
11185
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
11186
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11187
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11188
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11189
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11190
|
-
] }),
|
|
11191
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11192
|
-
] });
|
|
11193
|
-
};
|
|
11194
|
-
const SalesChannelForm = ({ order }) => {
|
|
11195
|
-
const form = useForm({
|
|
11196
|
-
defaultValues: {
|
|
11197
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
11198
|
-
},
|
|
11199
|
-
resolver: zodResolver(schema$2)
|
|
11200
|
-
});
|
|
11201
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11202
|
-
const { handleSuccess } = useRouteModal();
|
|
11203
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11204
|
-
await mutateAsync(
|
|
11205
|
-
{
|
|
11206
|
-
sales_channel_id: data.sales_channel_id
|
|
11207
|
-
},
|
|
11208
|
-
{
|
|
11209
|
-
onSuccess: () => {
|
|
11210
|
-
toast.success("Sales channel updated");
|
|
11211
|
-
handleSuccess();
|
|
11212
|
-
},
|
|
11213
|
-
onError: (error) => {
|
|
11214
|
-
toast.error(error.message);
|
|
11215
|
-
}
|
|
11216
|
-
}
|
|
11217
|
-
);
|
|
11218
|
-
});
|
|
11219
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11220
|
-
KeyboundForm,
|
|
11221
|
-
{
|
|
11222
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11223
|
-
onSubmit,
|
|
11224
|
-
children: [
|
|
11225
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11226
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11227
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11228
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11229
|
-
] }) })
|
|
11230
|
-
]
|
|
11231
|
-
}
|
|
11232
|
-
) });
|
|
11180
|
+
query2 ? query2 : void 0
|
|
11181
|
+
]
|
|
11233
11182
|
};
|
|
11234
|
-
const
|
|
11235
|
-
const
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
queryKey: ["sales-channels"],
|
|
11240
|
-
getOptions: (data) => {
|
|
11241
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11242
|
-
label: salesChannel.name,
|
|
11243
|
-
value: salesChannel.id
|
|
11244
|
-
}));
|
|
11245
|
-
},
|
|
11246
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11183
|
+
const usePromotions = (query2, options) => {
|
|
11184
|
+
const { data, ...rest } = useQuery({
|
|
11185
|
+
queryKey: promotionsQueryKeys.list(query2),
|
|
11186
|
+
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
11187
|
+
...options
|
|
11247
11188
|
});
|
|
11248
|
-
return
|
|
11249
|
-
Form$2.Field,
|
|
11250
|
-
{
|
|
11251
|
-
control,
|
|
11252
|
-
name: "sales_channel_id",
|
|
11253
|
-
render: ({ field }) => {
|
|
11254
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11255
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11256
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11257
|
-
Combobox,
|
|
11258
|
-
{
|
|
11259
|
-
options: salesChannels.options,
|
|
11260
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11261
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11262
|
-
searchValue: salesChannels.searchValue,
|
|
11263
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11264
|
-
placeholder: "Select sales channel",
|
|
11265
|
-
...field
|
|
11266
|
-
}
|
|
11267
|
-
) }),
|
|
11268
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11269
|
-
] });
|
|
11270
|
-
}
|
|
11271
|
-
}
|
|
11272
|
-
);
|
|
11189
|
+
return { ...data, ...rest };
|
|
11273
11190
|
};
|
|
11274
|
-
const
|
|
11275
|
-
sales_channel_id: stringType().min(1)
|
|
11276
|
-
});
|
|
11277
|
-
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11278
|
-
const Shipping = () => {
|
|
11279
|
-
var _a;
|
|
11191
|
+
const Promotions = () => {
|
|
11280
11192
|
const { id } = useParams();
|
|
11281
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11282
|
-
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11283
|
-
});
|
|
11284
11193
|
const {
|
|
11285
11194
|
order: preview,
|
|
11286
|
-
isPending: isPreviewPending,
|
|
11287
11195
|
isError: isPreviewError,
|
|
11288
11196
|
error: previewError
|
|
11289
|
-
} = useOrderPreview(id);
|
|
11197
|
+
} = useOrderPreview(id, void 0);
|
|
11290
11198
|
useInitiateOrderEdit({ preview });
|
|
11291
11199
|
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11292
|
-
if (isError) {
|
|
11293
|
-
throw error;
|
|
11294
|
-
}
|
|
11295
11200
|
if (isPreviewError) {
|
|
11296
11201
|
throw previewError;
|
|
11297
11202
|
}
|
|
11298
|
-
const
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
/* @__PURE__ */ jsx(
|
|
11302
|
-
|
|
11303
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11304
|
-
/* @__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." }) })
|
|
11305
|
-
] }) }) }),
|
|
11306
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11307
|
-
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
11308
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11309
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11310
|
-
] }) });
|
|
11203
|
+
const isReady = !!preview;
|
|
11204
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
11205
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
|
|
11206
|
+
isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
|
|
11207
|
+
] });
|
|
11311
11208
|
};
|
|
11312
|
-
const
|
|
11313
|
-
|
|
11314
|
-
const { setIsOpen } = useStackedModal();
|
|
11209
|
+
const PromotionForm = ({ preview }) => {
|
|
11210
|
+
const { items, shipping_methods } = preview;
|
|
11315
11211
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11316
|
-
const [
|
|
11317
|
-
const
|
|
11318
|
-
const {
|
|
11212
|
+
const [comboboxValue, setComboboxValue] = useState("");
|
|
11213
|
+
const { handleSuccess } = useRouteModal();
|
|
11214
|
+
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
11215
|
+
const promoIds = getPromotionIds(items, shipping_methods);
|
|
11216
|
+
const { promotions, isPending, isError, error } = usePromotions(
|
|
11319
11217
|
{
|
|
11320
|
-
id:
|
|
11321
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11218
|
+
id: promoIds
|
|
11322
11219
|
},
|
|
11323
11220
|
{
|
|
11324
|
-
enabled:
|
|
11221
|
+
enabled: !!promoIds.length
|
|
11325
11222
|
}
|
|
11326
11223
|
);
|
|
11327
|
-
const
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
const onSubmit = async () => {
|
|
11343
|
-
setIsSubmitting(true);
|
|
11344
|
-
let requestSucceeded = false;
|
|
11345
|
-
await requestOrderEdit(void 0, {
|
|
11346
|
-
onError: (e) => {
|
|
11347
|
-
toast.error(`Failed to request order edit: ${e.message}`);
|
|
11348
|
-
},
|
|
11349
|
-
onSuccess: () => {
|
|
11350
|
-
requestSucceeded = true;
|
|
11351
|
-
}
|
|
11352
|
-
});
|
|
11353
|
-
if (!requestSucceeded) {
|
|
11354
|
-
setIsSubmitting(false);
|
|
11355
|
-
return;
|
|
11224
|
+
const comboboxData = useComboboxData({
|
|
11225
|
+
queryKey: ["promotions", "combobox", promoIds],
|
|
11226
|
+
queryFn: async (params) => {
|
|
11227
|
+
return await sdk.admin.promotion.list({
|
|
11228
|
+
...params,
|
|
11229
|
+
id: {
|
|
11230
|
+
$nin: promoIds
|
|
11231
|
+
}
|
|
11232
|
+
});
|
|
11233
|
+
},
|
|
11234
|
+
getOptions: (data) => {
|
|
11235
|
+
return data.promotions.map((promotion) => ({
|
|
11236
|
+
label: promotion.code,
|
|
11237
|
+
value: promotion.code
|
|
11238
|
+
}));
|
|
11356
11239
|
}
|
|
11357
|
-
|
|
11240
|
+
});
|
|
11241
|
+
const add = async (value) => {
|
|
11242
|
+
if (!value) {
|
|
11243
|
+
return;
|
|
11244
|
+
}
|
|
11245
|
+
addPromotions(
|
|
11246
|
+
{
|
|
11247
|
+
promo_codes: [value]
|
|
11248
|
+
},
|
|
11249
|
+
{
|
|
11250
|
+
onError: (e) => {
|
|
11251
|
+
toast.error(e.message);
|
|
11252
|
+
comboboxData.onSearchValueChange("");
|
|
11253
|
+
setComboboxValue("");
|
|
11254
|
+
},
|
|
11255
|
+
onSuccess: () => {
|
|
11256
|
+
comboboxData.onSearchValueChange("");
|
|
11257
|
+
setComboboxValue("");
|
|
11258
|
+
}
|
|
11259
|
+
}
|
|
11260
|
+
);
|
|
11261
|
+
};
|
|
11262
|
+
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
11263
|
+
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
11264
|
+
const onSubmit = async () => {
|
|
11265
|
+
setIsSubmitting(true);
|
|
11266
|
+
let requestSucceeded = false;
|
|
11267
|
+
await requestOrderEdit(void 0, {
|
|
11268
|
+
onError: (e) => {
|
|
11269
|
+
toast.error(e.message);
|
|
11270
|
+
},
|
|
11271
|
+
onSuccess: () => {
|
|
11272
|
+
requestSucceeded = true;
|
|
11273
|
+
}
|
|
11274
|
+
});
|
|
11275
|
+
if (!requestSucceeded) {
|
|
11276
|
+
setIsSubmitting(false);
|
|
11277
|
+
return;
|
|
11278
|
+
}
|
|
11279
|
+
await confirmOrderEdit(void 0, {
|
|
11280
|
+
onError: (e) => {
|
|
11281
|
+
toast.error(e.message);
|
|
11282
|
+
},
|
|
11283
|
+
onSuccess: () => {
|
|
11284
|
+
handleSuccess();
|
|
11285
|
+
},
|
|
11286
|
+
onSettled: () => {
|
|
11287
|
+
setIsSubmitting(false);
|
|
11288
|
+
}
|
|
11289
|
+
});
|
|
11290
|
+
};
|
|
11291
|
+
if (isError) {
|
|
11292
|
+
throw error;
|
|
11293
|
+
}
|
|
11294
|
+
return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
11295
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
11296
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
11297
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
11298
|
+
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
11299
|
+
/* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
11300
|
+
] }),
|
|
11301
|
+
/* @__PURE__ */ jsx(
|
|
11302
|
+
Combobox,
|
|
11303
|
+
{
|
|
11304
|
+
id: "promotion-combobox",
|
|
11305
|
+
"aria-describedby": "promotion-combobox-hint",
|
|
11306
|
+
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
11307
|
+
fetchNextPage: comboboxData.fetchNextPage,
|
|
11308
|
+
options: comboboxData.options,
|
|
11309
|
+
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
11310
|
+
searchValue: comboboxData.searchValue,
|
|
11311
|
+
disabled: comboboxData.disabled || isAddingPromotions,
|
|
11312
|
+
onChange: add,
|
|
11313
|
+
value: comboboxValue
|
|
11314
|
+
}
|
|
11315
|
+
)
|
|
11316
|
+
] }),
|
|
11317
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
11318
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
|
|
11319
|
+
PromotionItem,
|
|
11320
|
+
{
|
|
11321
|
+
promotion,
|
|
11322
|
+
orderId: preview.id,
|
|
11323
|
+
isLoading: isPending
|
|
11324
|
+
},
|
|
11325
|
+
promotion.id
|
|
11326
|
+
)) })
|
|
11327
|
+
] }) }),
|
|
11328
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11329
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11330
|
+
/* @__PURE__ */ jsx(
|
|
11331
|
+
Button,
|
|
11332
|
+
{
|
|
11333
|
+
size: "small",
|
|
11334
|
+
type: "submit",
|
|
11335
|
+
isLoading: isSubmitting || isAddingPromotions,
|
|
11336
|
+
children: "Save"
|
|
11337
|
+
}
|
|
11338
|
+
)
|
|
11339
|
+
] }) })
|
|
11340
|
+
] });
|
|
11341
|
+
};
|
|
11342
|
+
const PromotionItem = ({
|
|
11343
|
+
promotion,
|
|
11344
|
+
orderId,
|
|
11345
|
+
isLoading
|
|
11346
|
+
}) => {
|
|
11347
|
+
var _a;
|
|
11348
|
+
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
11349
|
+
const onRemove = async () => {
|
|
11350
|
+
removePromotions(
|
|
11351
|
+
{
|
|
11352
|
+
promo_codes: [promotion.code]
|
|
11353
|
+
},
|
|
11354
|
+
{
|
|
11355
|
+
onError: (e) => {
|
|
11356
|
+
toast.error(e.message);
|
|
11357
|
+
}
|
|
11358
|
+
}
|
|
11359
|
+
);
|
|
11360
|
+
};
|
|
11361
|
+
const displayValue = getDisplayValue(promotion);
|
|
11362
|
+
return /* @__PURE__ */ jsxs(
|
|
11363
|
+
"div",
|
|
11364
|
+
{
|
|
11365
|
+
className: clx(
|
|
11366
|
+
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
11367
|
+
{
|
|
11368
|
+
"animate-pulse": isLoading
|
|
11369
|
+
}
|
|
11370
|
+
),
|
|
11371
|
+
children: [
|
|
11372
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11373
|
+
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
11374
|
+
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
11375
|
+
displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
11376
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
|
|
11377
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
|
|
11378
|
+
] }),
|
|
11379
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
11380
|
+
] })
|
|
11381
|
+
] }),
|
|
11382
|
+
/* @__PURE__ */ jsx(
|
|
11383
|
+
IconButton,
|
|
11384
|
+
{
|
|
11385
|
+
size: "small",
|
|
11386
|
+
type: "button",
|
|
11387
|
+
variant: "transparent",
|
|
11388
|
+
onClick: onRemove,
|
|
11389
|
+
isLoading: isPending || isLoading,
|
|
11390
|
+
children: /* @__PURE__ */ jsx(XMark, {})
|
|
11391
|
+
}
|
|
11392
|
+
)
|
|
11393
|
+
]
|
|
11394
|
+
},
|
|
11395
|
+
promotion.id
|
|
11396
|
+
);
|
|
11397
|
+
};
|
|
11398
|
+
function getDisplayValue(promotion) {
|
|
11399
|
+
var _a, _b, _c, _d;
|
|
11400
|
+
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
11401
|
+
if (!value) {
|
|
11402
|
+
return null;
|
|
11403
|
+
}
|
|
11404
|
+
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
11405
|
+
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
11406
|
+
if (!currency) {
|
|
11407
|
+
return null;
|
|
11408
|
+
}
|
|
11409
|
+
return getLocaleAmount(value, currency);
|
|
11410
|
+
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
11411
|
+
return formatPercentage(value);
|
|
11412
|
+
}
|
|
11413
|
+
return null;
|
|
11414
|
+
}
|
|
11415
|
+
const formatter = new Intl.NumberFormat([], {
|
|
11416
|
+
style: "percent",
|
|
11417
|
+
minimumFractionDigits: 2
|
|
11418
|
+
});
|
|
11419
|
+
const formatPercentage = (value, isPercentageValue = false) => {
|
|
11420
|
+
let val = value || 0;
|
|
11421
|
+
if (!isPercentageValue) {
|
|
11422
|
+
val = val / 100;
|
|
11423
|
+
}
|
|
11424
|
+
return formatter.format(val);
|
|
11425
|
+
};
|
|
11426
|
+
function getPromotionIds(items, shippingMethods) {
|
|
11427
|
+
const promotionIds = /* @__PURE__ */ new Set();
|
|
11428
|
+
for (const item of items) {
|
|
11429
|
+
if (item.adjustments) {
|
|
11430
|
+
for (const adjustment of item.adjustments) {
|
|
11431
|
+
if (adjustment.promotion_id) {
|
|
11432
|
+
promotionIds.add(adjustment.promotion_id);
|
|
11433
|
+
}
|
|
11434
|
+
}
|
|
11435
|
+
}
|
|
11436
|
+
}
|
|
11437
|
+
for (const shippingMethod of shippingMethods) {
|
|
11438
|
+
if (shippingMethod.adjustments) {
|
|
11439
|
+
for (const adjustment of shippingMethod.adjustments) {
|
|
11440
|
+
if (adjustment.promotion_id) {
|
|
11441
|
+
promotionIds.add(adjustment.promotion_id);
|
|
11442
|
+
}
|
|
11443
|
+
}
|
|
11444
|
+
}
|
|
11445
|
+
}
|
|
11446
|
+
return Array.from(promotionIds);
|
|
11447
|
+
}
|
|
11448
|
+
const SalesChannel = () => {
|
|
11449
|
+
const { id } = useParams();
|
|
11450
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11451
|
+
id,
|
|
11452
|
+
{
|
|
11453
|
+
fields: "+sales_channel_id"
|
|
11454
|
+
},
|
|
11455
|
+
{
|
|
11456
|
+
enabled: !!id
|
|
11457
|
+
}
|
|
11458
|
+
);
|
|
11459
|
+
if (isError) {
|
|
11460
|
+
throw error;
|
|
11461
|
+
}
|
|
11462
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11463
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11464
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11465
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11466
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11467
|
+
] }),
|
|
11468
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11469
|
+
] });
|
|
11470
|
+
};
|
|
11471
|
+
const SalesChannelForm = ({ order }) => {
|
|
11472
|
+
const form = useForm({
|
|
11473
|
+
defaultValues: {
|
|
11474
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11475
|
+
},
|
|
11476
|
+
resolver: zodResolver(schema$2)
|
|
11477
|
+
});
|
|
11478
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11479
|
+
const { handleSuccess } = useRouteModal();
|
|
11480
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11481
|
+
await mutateAsync(
|
|
11482
|
+
{
|
|
11483
|
+
sales_channel_id: data.sales_channel_id
|
|
11484
|
+
},
|
|
11485
|
+
{
|
|
11486
|
+
onSuccess: () => {
|
|
11487
|
+
toast.success("Sales channel updated");
|
|
11488
|
+
handleSuccess();
|
|
11489
|
+
},
|
|
11490
|
+
onError: (error) => {
|
|
11491
|
+
toast.error(error.message);
|
|
11492
|
+
}
|
|
11493
|
+
}
|
|
11494
|
+
);
|
|
11495
|
+
});
|
|
11496
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11497
|
+
KeyboundForm,
|
|
11498
|
+
{
|
|
11499
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11500
|
+
onSubmit,
|
|
11501
|
+
children: [
|
|
11502
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11503
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11504
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11505
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11506
|
+
] }) })
|
|
11507
|
+
]
|
|
11508
|
+
}
|
|
11509
|
+
) });
|
|
11510
|
+
};
|
|
11511
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11512
|
+
const salesChannels = useComboboxData({
|
|
11513
|
+
queryFn: async (params) => {
|
|
11514
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11515
|
+
},
|
|
11516
|
+
queryKey: ["sales-channels"],
|
|
11517
|
+
getOptions: (data) => {
|
|
11518
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11519
|
+
label: salesChannel.name,
|
|
11520
|
+
value: salesChannel.id
|
|
11521
|
+
}));
|
|
11522
|
+
},
|
|
11523
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11524
|
+
});
|
|
11525
|
+
return /* @__PURE__ */ jsx(
|
|
11526
|
+
Form$2.Field,
|
|
11527
|
+
{
|
|
11528
|
+
control,
|
|
11529
|
+
name: "sales_channel_id",
|
|
11530
|
+
render: ({ field }) => {
|
|
11531
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11532
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11533
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11534
|
+
Combobox,
|
|
11535
|
+
{
|
|
11536
|
+
options: salesChannels.options,
|
|
11537
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11538
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11539
|
+
searchValue: salesChannels.searchValue,
|
|
11540
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11541
|
+
placeholder: "Select sales channel",
|
|
11542
|
+
...field
|
|
11543
|
+
}
|
|
11544
|
+
) }),
|
|
11545
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11546
|
+
] });
|
|
11547
|
+
}
|
|
11548
|
+
}
|
|
11549
|
+
);
|
|
11550
|
+
};
|
|
11551
|
+
const schema$2 = objectType({
|
|
11552
|
+
sales_channel_id: stringType().min(1)
|
|
11553
|
+
});
|
|
11554
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11555
|
+
const Shipping = () => {
|
|
11556
|
+
var _a;
|
|
11557
|
+
const { id } = useParams();
|
|
11558
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11559
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11560
|
+
});
|
|
11561
|
+
const {
|
|
11562
|
+
order: preview,
|
|
11563
|
+
isPending: isPreviewPending,
|
|
11564
|
+
isError: isPreviewError,
|
|
11565
|
+
error: previewError
|
|
11566
|
+
} = useOrderPreview(id);
|
|
11567
|
+
useInitiateOrderEdit({ preview });
|
|
11568
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11569
|
+
if (isError) {
|
|
11570
|
+
throw error;
|
|
11571
|
+
}
|
|
11572
|
+
if (isPreviewError) {
|
|
11573
|
+
throw previewError;
|
|
11574
|
+
}
|
|
11575
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11576
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11577
|
+
return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11578
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
11579
|
+
/* @__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: [
|
|
11580
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
|
|
11581
|
+
/* @__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." }) })
|
|
11582
|
+
] }) }) }),
|
|
11583
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11584
|
+
] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
11585
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11586
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11587
|
+
] }) });
|
|
11588
|
+
};
|
|
11589
|
+
const ShippingForm = ({ preview, order }) => {
|
|
11590
|
+
var _a;
|
|
11591
|
+
const { setIsOpen } = useStackedModal();
|
|
11592
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
11593
|
+
const [data, setData] = useState(null);
|
|
11594
|
+
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11595
|
+
const { shipping_options } = useShippingOptions(
|
|
11596
|
+
{
|
|
11597
|
+
id: appliedShippingOptionIds,
|
|
11598
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11599
|
+
},
|
|
11600
|
+
{
|
|
11601
|
+
enabled: appliedShippingOptionIds.length > 0
|
|
11602
|
+
}
|
|
11603
|
+
);
|
|
11604
|
+
const uniqueShippingProfiles = useMemo(() => {
|
|
11605
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
11606
|
+
getUniqueShippingProfiles(order.items).forEach((profile) => {
|
|
11607
|
+
profiles.set(profile.id, profile);
|
|
11608
|
+
});
|
|
11609
|
+
shipping_options == null ? void 0 : shipping_options.forEach((option) => {
|
|
11610
|
+
profiles.set(option.shipping_profile_id, option.shipping_profile);
|
|
11611
|
+
});
|
|
11612
|
+
return Array.from(profiles.values());
|
|
11613
|
+
}, [order.items, shipping_options]);
|
|
11614
|
+
const { handleSuccess } = useRouteModal();
|
|
11615
|
+
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
11616
|
+
const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
|
|
11617
|
+
const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
|
|
11618
|
+
const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
|
|
11619
|
+
const onSubmit = async () => {
|
|
11620
|
+
setIsSubmitting(true);
|
|
11621
|
+
let requestSucceeded = false;
|
|
11622
|
+
await requestOrderEdit(void 0, {
|
|
11623
|
+
onError: (e) => {
|
|
11624
|
+
toast.error(`Failed to request order edit: ${e.message}`);
|
|
11625
|
+
},
|
|
11626
|
+
onSuccess: () => {
|
|
11627
|
+
requestSucceeded = true;
|
|
11628
|
+
}
|
|
11629
|
+
});
|
|
11630
|
+
if (!requestSucceeded) {
|
|
11631
|
+
setIsSubmitting(false);
|
|
11632
|
+
return;
|
|
11633
|
+
}
|
|
11634
|
+
await confirmOrderEdit(void 0, {
|
|
11358
11635
|
onError: (e) => {
|
|
11359
11636
|
toast.error(`Failed to confirm order edit: ${e.message}`);
|
|
11360
11637
|
},
|
|
@@ -12650,393 +12927,116 @@ const Illustration = () => {
|
|
|
12650
12927
|
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip1_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12651
12928
|
"path",
|
|
12652
12929
|
{
|
|
12653
|
-
d: "M143.496 87.8055L150.881 87.8481L150.905 83.6383",
|
|
12654
|
-
stroke: "#A1A1AA",
|
|
12655
|
-
strokeWidth: "1.5",
|
|
12656
|
-
strokeLinecap: "round",
|
|
12657
|
-
strokeLinejoin: "round"
|
|
12658
|
-
}
|
|
12659
|
-
) }),
|
|
12660
|
-
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip2_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12661
|
-
"path",
|
|
12662
|
-
{
|
|
12663
|
-
d: "M153.887 93.8088L161.271 93.8514L161.295 89.6416",
|
|
12664
|
-
stroke: "#A1A1AA",
|
|
12665
|
-
strokeWidth: "1.5",
|
|
12666
|
-
strokeLinecap: "round",
|
|
12667
|
-
strokeLinejoin: "round"
|
|
12668
|
-
}
|
|
12669
|
-
) }),
|
|
12670
|
-
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip3_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12671
|
-
"path",
|
|
12672
|
-
{
|
|
12673
|
-
d: "M126.114 89.1912L118.729 89.1486L118.705 93.3584",
|
|
12674
|
-
stroke: "#A1A1AA",
|
|
12675
|
-
strokeWidth: "1.5",
|
|
12676
|
-
strokeLinecap: "round",
|
|
12677
|
-
strokeLinejoin: "round"
|
|
12678
|
-
}
|
|
12679
|
-
) }),
|
|
12680
|
-
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip4_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12681
|
-
"path",
|
|
12682
|
-
{
|
|
12683
|
-
d: "M136.504 95.1945L129.12 95.1519L129.095 99.3617",
|
|
12684
|
-
stroke: "#A1A1AA",
|
|
12685
|
-
strokeWidth: "1.5",
|
|
12686
|
-
strokeLinecap: "round",
|
|
12687
|
-
strokeLinejoin: "round"
|
|
12688
|
-
}
|
|
12689
|
-
) }),
|
|
12690
|
-
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12691
|
-
"path",
|
|
12692
|
-
{
|
|
12693
|
-
d: "M146.894 101.198L139.51 101.155L139.486 105.365",
|
|
12694
|
-
stroke: "#A1A1AA",
|
|
12695
|
-
strokeWidth: "1.5",
|
|
12696
|
-
strokeLinecap: "round",
|
|
12697
|
-
strokeLinejoin: "round"
|
|
12698
|
-
}
|
|
12699
|
-
) }),
|
|
12700
|
-
/* @__PURE__ */ jsxs("defs", { children: [
|
|
12701
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12702
|
-
"rect",
|
|
12703
|
-
{
|
|
12704
|
-
width: "12",
|
|
12705
|
-
height: "12",
|
|
12706
|
-
fill: "white",
|
|
12707
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
|
|
12708
|
-
}
|
|
12709
|
-
) }),
|
|
12710
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12711
|
-
"rect",
|
|
12712
|
-
{
|
|
12713
|
-
width: "12",
|
|
12714
|
-
height: "12",
|
|
12715
|
-
fill: "white",
|
|
12716
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
|
|
12717
|
-
}
|
|
12718
|
-
) }),
|
|
12719
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12720
|
-
"rect",
|
|
12721
|
-
{
|
|
12722
|
-
width: "12",
|
|
12723
|
-
height: "12",
|
|
12724
|
-
fill: "white",
|
|
12725
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
|
|
12726
|
-
}
|
|
12727
|
-
) }),
|
|
12728
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12729
|
-
"rect",
|
|
12730
|
-
{
|
|
12731
|
-
width: "12",
|
|
12732
|
-
height: "12",
|
|
12733
|
-
fill: "white",
|
|
12734
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
|
|
12735
|
-
}
|
|
12736
|
-
) }),
|
|
12737
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12738
|
-
"rect",
|
|
12739
|
-
{
|
|
12740
|
-
width: "12",
|
|
12741
|
-
height: "12",
|
|
12742
|
-
fill: "white",
|
|
12743
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
|
|
12744
|
-
}
|
|
12745
|
-
) }),
|
|
12746
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12747
|
-
"rect",
|
|
12748
|
-
{
|
|
12749
|
-
width: "12",
|
|
12750
|
-
height: "12",
|
|
12751
|
-
fill: "white",
|
|
12752
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
|
|
12753
|
-
}
|
|
12754
|
-
) })
|
|
12755
|
-
] })
|
|
12756
|
-
]
|
|
12757
|
-
}
|
|
12758
|
-
);
|
|
12759
|
-
};
|
|
12760
|
-
const schema = objectType({
|
|
12761
|
-
customer_id: stringType().min(1)
|
|
12762
|
-
});
|
|
12763
|
-
const PROMOTION_QUERY_KEY = "promotions";
|
|
12764
|
-
const promotionsQueryKeys = {
|
|
12765
|
-
list: (query2) => [
|
|
12766
|
-
PROMOTION_QUERY_KEY,
|
|
12767
|
-
query2 ? query2 : void 0
|
|
12768
|
-
],
|
|
12769
|
-
detail: (id, query2) => [
|
|
12770
|
-
PROMOTION_QUERY_KEY,
|
|
12771
|
-
id,
|
|
12772
|
-
query2 ? query2 : void 0
|
|
12773
|
-
]
|
|
12774
|
-
};
|
|
12775
|
-
const usePromotions = (query2, options) => {
|
|
12776
|
-
const { data, ...rest } = useQuery({
|
|
12777
|
-
queryKey: promotionsQueryKeys.list(query2),
|
|
12778
|
-
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
12779
|
-
...options
|
|
12780
|
-
});
|
|
12781
|
-
return { ...data, ...rest };
|
|
12782
|
-
};
|
|
12783
|
-
const Promotions = () => {
|
|
12784
|
-
const { id } = useParams();
|
|
12785
|
-
const {
|
|
12786
|
-
order: preview,
|
|
12787
|
-
isError: isPreviewError,
|
|
12788
|
-
error: previewError
|
|
12789
|
-
} = useOrderPreview(id, void 0);
|
|
12790
|
-
useInitiateOrderEdit({ preview });
|
|
12791
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
12792
|
-
if (isPreviewError) {
|
|
12793
|
-
throw previewError;
|
|
12794
|
-
}
|
|
12795
|
-
const isReady = !!preview;
|
|
12796
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
12797
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
|
|
12798
|
-
isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
|
|
12799
|
-
] });
|
|
12800
|
-
};
|
|
12801
|
-
const PromotionForm = ({ preview }) => {
|
|
12802
|
-
const { items, shipping_methods } = preview;
|
|
12803
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
12804
|
-
const [comboboxValue, setComboboxValue] = useState("");
|
|
12805
|
-
const { handleSuccess } = useRouteModal();
|
|
12806
|
-
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
12807
|
-
const promoIds = getPromotionIds(items, shipping_methods);
|
|
12808
|
-
const { promotions, isPending, isError, error } = usePromotions(
|
|
12809
|
-
{
|
|
12810
|
-
id: promoIds
|
|
12811
|
-
},
|
|
12812
|
-
{
|
|
12813
|
-
enabled: !!promoIds.length
|
|
12814
|
-
}
|
|
12815
|
-
);
|
|
12816
|
-
const comboboxData = useComboboxData({
|
|
12817
|
-
queryKey: ["promotions", "combobox", promoIds],
|
|
12818
|
-
queryFn: async (params) => {
|
|
12819
|
-
return await sdk.admin.promotion.list({
|
|
12820
|
-
...params,
|
|
12821
|
-
id: {
|
|
12822
|
-
$nin: promoIds
|
|
12823
|
-
}
|
|
12824
|
-
});
|
|
12825
|
-
},
|
|
12826
|
-
getOptions: (data) => {
|
|
12827
|
-
return data.promotions.map((promotion) => ({
|
|
12828
|
-
label: promotion.code,
|
|
12829
|
-
value: promotion.code
|
|
12830
|
-
}));
|
|
12831
|
-
}
|
|
12832
|
-
});
|
|
12833
|
-
const add = async (value) => {
|
|
12834
|
-
if (!value) {
|
|
12835
|
-
return;
|
|
12836
|
-
}
|
|
12837
|
-
addPromotions(
|
|
12838
|
-
{
|
|
12839
|
-
promo_codes: [value]
|
|
12840
|
-
},
|
|
12841
|
-
{
|
|
12842
|
-
onError: (e) => {
|
|
12843
|
-
toast.error(e.message);
|
|
12844
|
-
comboboxData.onSearchValueChange("");
|
|
12845
|
-
setComboboxValue("");
|
|
12846
|
-
},
|
|
12847
|
-
onSuccess: () => {
|
|
12848
|
-
comboboxData.onSearchValueChange("");
|
|
12849
|
-
setComboboxValue("");
|
|
12850
|
-
}
|
|
12851
|
-
}
|
|
12852
|
-
);
|
|
12853
|
-
};
|
|
12854
|
-
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
12855
|
-
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
12856
|
-
const onSubmit = async () => {
|
|
12857
|
-
setIsSubmitting(true);
|
|
12858
|
-
let requestSucceeded = false;
|
|
12859
|
-
await requestOrderEdit(void 0, {
|
|
12860
|
-
onError: (e) => {
|
|
12861
|
-
toast.error(e.message);
|
|
12862
|
-
},
|
|
12863
|
-
onSuccess: () => {
|
|
12864
|
-
requestSucceeded = true;
|
|
12865
|
-
}
|
|
12866
|
-
});
|
|
12867
|
-
if (!requestSucceeded) {
|
|
12868
|
-
setIsSubmitting(false);
|
|
12869
|
-
return;
|
|
12870
|
-
}
|
|
12871
|
-
await confirmOrderEdit(void 0, {
|
|
12872
|
-
onError: (e) => {
|
|
12873
|
-
toast.error(e.message);
|
|
12874
|
-
},
|
|
12875
|
-
onSuccess: () => {
|
|
12876
|
-
handleSuccess();
|
|
12877
|
-
},
|
|
12878
|
-
onSettled: () => {
|
|
12879
|
-
setIsSubmitting(false);
|
|
12880
|
-
}
|
|
12881
|
-
});
|
|
12882
|
-
};
|
|
12883
|
-
if (isError) {
|
|
12884
|
-
throw error;
|
|
12885
|
-
}
|
|
12886
|
-
return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
12887
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
12888
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
12889
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
12890
|
-
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
12891
|
-
/* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
12892
|
-
] }),
|
|
12893
|
-
/* @__PURE__ */ jsx(
|
|
12894
|
-
Combobox,
|
|
12895
|
-
{
|
|
12896
|
-
id: "promotion-combobox",
|
|
12897
|
-
"aria-describedby": "promotion-combobox-hint",
|
|
12898
|
-
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
12899
|
-
fetchNextPage: comboboxData.fetchNextPage,
|
|
12900
|
-
options: comboboxData.options,
|
|
12901
|
-
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
12902
|
-
searchValue: comboboxData.searchValue,
|
|
12903
|
-
disabled: comboboxData.disabled || isAddingPromotions,
|
|
12904
|
-
onChange: add,
|
|
12905
|
-
value: comboboxValue
|
|
12930
|
+
d: "M143.496 87.8055L150.881 87.8481L150.905 83.6383",
|
|
12931
|
+
stroke: "#A1A1AA",
|
|
12932
|
+
strokeWidth: "1.5",
|
|
12933
|
+
strokeLinecap: "round",
|
|
12934
|
+
strokeLinejoin: "round"
|
|
12906
12935
|
}
|
|
12907
|
-
)
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
|
|
12911
|
-
PromotionItem,
|
|
12912
|
-
{
|
|
12913
|
-
promotion,
|
|
12914
|
-
orderId: preview.id,
|
|
12915
|
-
isLoading: isPending
|
|
12916
|
-
},
|
|
12917
|
-
promotion.id
|
|
12918
|
-
)) })
|
|
12919
|
-
] }) }),
|
|
12920
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12921
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12922
|
-
/* @__PURE__ */ jsx(
|
|
12923
|
-
Button,
|
|
12924
|
-
{
|
|
12925
|
-
size: "small",
|
|
12926
|
-
type: "submit",
|
|
12927
|
-
isLoading: isSubmitting || isAddingPromotions,
|
|
12928
|
-
children: "Save"
|
|
12929
|
-
}
|
|
12930
|
-
)
|
|
12931
|
-
] }) })
|
|
12932
|
-
] });
|
|
12933
|
-
};
|
|
12934
|
-
const PromotionItem = ({
|
|
12935
|
-
promotion,
|
|
12936
|
-
orderId,
|
|
12937
|
-
isLoading
|
|
12938
|
-
}) => {
|
|
12939
|
-
var _a;
|
|
12940
|
-
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
12941
|
-
const onRemove = async () => {
|
|
12942
|
-
removePromotions(
|
|
12943
|
-
{
|
|
12944
|
-
promo_codes: [promotion.code]
|
|
12945
|
-
},
|
|
12946
|
-
{
|
|
12947
|
-
onError: (e) => {
|
|
12948
|
-
toast.error(e.message);
|
|
12949
|
-
}
|
|
12950
|
-
}
|
|
12951
|
-
);
|
|
12952
|
-
};
|
|
12953
|
-
const displayValue = getDisplayValue(promotion);
|
|
12954
|
-
return /* @__PURE__ */ jsxs(
|
|
12955
|
-
"div",
|
|
12956
|
-
{
|
|
12957
|
-
className: clx(
|
|
12958
|
-
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
12959
|
-
{
|
|
12960
|
-
"animate-pulse": isLoading
|
|
12961
|
-
}
|
|
12962
|
-
),
|
|
12963
|
-
children: [
|
|
12964
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
12965
|
-
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
12966
|
-
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
12967
|
-
displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
12968
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
|
|
12969
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
|
|
12970
|
-
] }),
|
|
12971
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
12972
|
-
] })
|
|
12973
|
-
] }),
|
|
12974
|
-
/* @__PURE__ */ jsx(
|
|
12975
|
-
IconButton,
|
|
12936
|
+
) }),
|
|
12937
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip2_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12938
|
+
"path",
|
|
12976
12939
|
{
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
children: /* @__PURE__ */ jsx(XMark, {})
|
|
12940
|
+
d: "M153.887 93.8088L161.271 93.8514L161.295 89.6416",
|
|
12941
|
+
stroke: "#A1A1AA",
|
|
12942
|
+
strokeWidth: "1.5",
|
|
12943
|
+
strokeLinecap: "round",
|
|
12944
|
+
strokeLinejoin: "round"
|
|
12983
12945
|
}
|
|
12984
|
-
)
|
|
12946
|
+
) }),
|
|
12947
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip3_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12948
|
+
"path",
|
|
12949
|
+
{
|
|
12950
|
+
d: "M126.114 89.1912L118.729 89.1486L118.705 93.3584",
|
|
12951
|
+
stroke: "#A1A1AA",
|
|
12952
|
+
strokeWidth: "1.5",
|
|
12953
|
+
strokeLinecap: "round",
|
|
12954
|
+
strokeLinejoin: "round"
|
|
12955
|
+
}
|
|
12956
|
+
) }),
|
|
12957
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip4_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12958
|
+
"path",
|
|
12959
|
+
{
|
|
12960
|
+
d: "M136.504 95.1945L129.12 95.1519L129.095 99.3617",
|
|
12961
|
+
stroke: "#A1A1AA",
|
|
12962
|
+
strokeWidth: "1.5",
|
|
12963
|
+
strokeLinecap: "round",
|
|
12964
|
+
strokeLinejoin: "round"
|
|
12965
|
+
}
|
|
12966
|
+
) }),
|
|
12967
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsx(
|
|
12968
|
+
"path",
|
|
12969
|
+
{
|
|
12970
|
+
d: "M146.894 101.198L139.51 101.155L139.486 105.365",
|
|
12971
|
+
stroke: "#A1A1AA",
|
|
12972
|
+
strokeWidth: "1.5",
|
|
12973
|
+
strokeLinecap: "round",
|
|
12974
|
+
strokeLinejoin: "round"
|
|
12975
|
+
}
|
|
12976
|
+
) }),
|
|
12977
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
12978
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12979
|
+
"rect",
|
|
12980
|
+
{
|
|
12981
|
+
width: "12",
|
|
12982
|
+
height: "12",
|
|
12983
|
+
fill: "white",
|
|
12984
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
|
|
12985
|
+
}
|
|
12986
|
+
) }),
|
|
12987
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12988
|
+
"rect",
|
|
12989
|
+
{
|
|
12990
|
+
width: "12",
|
|
12991
|
+
height: "12",
|
|
12992
|
+
fill: "white",
|
|
12993
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
|
|
12994
|
+
}
|
|
12995
|
+
) }),
|
|
12996
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
|
|
12997
|
+
"rect",
|
|
12998
|
+
{
|
|
12999
|
+
width: "12",
|
|
13000
|
+
height: "12",
|
|
13001
|
+
fill: "white",
|
|
13002
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
|
|
13003
|
+
}
|
|
13004
|
+
) }),
|
|
13005
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
|
|
13006
|
+
"rect",
|
|
13007
|
+
{
|
|
13008
|
+
width: "12",
|
|
13009
|
+
height: "12",
|
|
13010
|
+
fill: "white",
|
|
13011
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
|
|
13012
|
+
}
|
|
13013
|
+
) }),
|
|
13014
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
|
|
13015
|
+
"rect",
|
|
13016
|
+
{
|
|
13017
|
+
width: "12",
|
|
13018
|
+
height: "12",
|
|
13019
|
+
fill: "white",
|
|
13020
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
|
|
13021
|
+
}
|
|
13022
|
+
) }),
|
|
13023
|
+
/* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
|
|
13024
|
+
"rect",
|
|
13025
|
+
{
|
|
13026
|
+
width: "12",
|
|
13027
|
+
height: "12",
|
|
13028
|
+
fill: "white",
|
|
13029
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
|
|
13030
|
+
}
|
|
13031
|
+
) })
|
|
13032
|
+
] })
|
|
12985
13033
|
]
|
|
12986
|
-
}
|
|
12987
|
-
promotion.id
|
|
13034
|
+
}
|
|
12988
13035
|
);
|
|
12989
13036
|
};
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
12993
|
-
if (!value) {
|
|
12994
|
-
return null;
|
|
12995
|
-
}
|
|
12996
|
-
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
12997
|
-
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
12998
|
-
if (!currency) {
|
|
12999
|
-
return null;
|
|
13000
|
-
}
|
|
13001
|
-
return getLocaleAmount(value, currency);
|
|
13002
|
-
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
13003
|
-
return formatPercentage(value);
|
|
13004
|
-
}
|
|
13005
|
-
return null;
|
|
13006
|
-
}
|
|
13007
|
-
const formatter = new Intl.NumberFormat([], {
|
|
13008
|
-
style: "percent",
|
|
13009
|
-
minimumFractionDigits: 2
|
|
13037
|
+
const schema = objectType({
|
|
13038
|
+
customer_id: stringType().min(1)
|
|
13010
13039
|
});
|
|
13011
|
-
const formatPercentage = (value, isPercentageValue = false) => {
|
|
13012
|
-
let val = value || 0;
|
|
13013
|
-
if (!isPercentageValue) {
|
|
13014
|
-
val = val / 100;
|
|
13015
|
-
}
|
|
13016
|
-
return formatter.format(val);
|
|
13017
|
-
};
|
|
13018
|
-
function getPromotionIds(items, shippingMethods) {
|
|
13019
|
-
const promotionIds = /* @__PURE__ */ new Set();
|
|
13020
|
-
for (const item of items) {
|
|
13021
|
-
if (item.adjustments) {
|
|
13022
|
-
for (const adjustment of item.adjustments) {
|
|
13023
|
-
if (adjustment.promotion_id) {
|
|
13024
|
-
promotionIds.add(adjustment.promotion_id);
|
|
13025
|
-
}
|
|
13026
|
-
}
|
|
13027
|
-
}
|
|
13028
|
-
}
|
|
13029
|
-
for (const shippingMethod of shippingMethods) {
|
|
13030
|
-
if (shippingMethod.adjustments) {
|
|
13031
|
-
for (const adjustment of shippingMethod.adjustments) {
|
|
13032
|
-
if (adjustment.promotion_id) {
|
|
13033
|
-
promotionIds.add(adjustment.promotion_id);
|
|
13034
|
-
}
|
|
13035
|
-
}
|
|
13036
|
-
}
|
|
13037
|
-
}
|
|
13038
|
-
return Array.from(promotionIds);
|
|
13039
|
-
}
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
13042
13042
|
routes: [
|
|
@@ -13061,14 +13061,14 @@ const routeModule = {
|
|
|
13061
13061
|
Component: BillingAddress,
|
|
13062
13062
|
path: "/draft-orders/:id/billing-address"
|
|
13063
13063
|
},
|
|
13064
|
-
{
|
|
13065
|
-
Component: CustomItems,
|
|
13066
|
-
path: "/draft-orders/:id/custom-items"
|
|
13067
|
-
},
|
|
13068
13064
|
{
|
|
13069
13065
|
Component: Email,
|
|
13070
13066
|
path: "/draft-orders/:id/email"
|
|
13071
13067
|
},
|
|
13068
|
+
{
|
|
13069
|
+
Component: CustomItems,
|
|
13070
|
+
path: "/draft-orders/:id/custom-items"
|
|
13071
|
+
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Items,
|
|
13074
13074
|
path: "/draft-orders/:id/items"
|
|
@@ -13077,6 +13077,10 @@ const routeModule = {
|
|
|
13077
13077
|
Component: Metadata,
|
|
13078
13078
|
path: "/draft-orders/:id/metadata"
|
|
13079
13079
|
},
|
|
13080
|
+
{
|
|
13081
|
+
Component: Promotions,
|
|
13082
|
+
path: "/draft-orders/:id/promotions"
|
|
13083
|
+
},
|
|
13080
13084
|
{
|
|
13081
13085
|
Component: SalesChannel,
|
|
13082
13086
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -13092,10 +13096,6 @@ const routeModule = {
|
|
|
13092
13096
|
{
|
|
13093
13097
|
Component: TransferOwnership,
|
|
13094
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
|
-
},
|
|
13096
|
-
{
|
|
13097
|
-
Component: Promotions,
|
|
13098
|
-
path: "/draft-orders/:id/promotions"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|