@medusajs/draft-order 2.11.3-preview-20251105090148 → 2.11.3

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.
@@ -11164,105 +11164,77 @@ function getHasUneditableRows(metadata) {
11164
11164
  (value) => !EDITABLE_TYPES.includes(typeof value)
11165
11165
  );
11166
11166
  }
11167
- const PROMOTION_QUERY_KEY = "promotions";
11168
- const promotionsQueryKeys = {
11169
- list: (query2) => [
11170
- PROMOTION_QUERY_KEY,
11171
- query2 ? query2 : void 0
11172
- ],
11173
- detail: (id, query2) => [
11174
- PROMOTION_QUERY_KEY,
11175
- id,
11176
- query2 ? query2 : void 0
11177
- ]
11178
- };
11179
- const usePromotions = (query2, options) => {
11180
- const { data, ...rest } = useQuery({
11181
- queryKey: promotionsQueryKeys.list(query2),
11182
- queryFn: async () => sdk.admin.promotion.list(query2),
11183
- ...options
11184
- });
11185
- return { ...data, ...rest };
11186
- };
11187
- const Promotions = () => {
11167
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11168
+ const Shipping = () => {
11169
+ var _a;
11188
11170
  const { id } = useParams();
11171
+ const { order, isPending, isError, error } = useOrder(id, {
11172
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11173
+ });
11189
11174
  const {
11190
11175
  order: preview,
11176
+ isPending: isPreviewPending,
11191
11177
  isError: isPreviewError,
11192
11178
  error: previewError
11193
- } = useOrderPreview(id, void 0);
11179
+ } = useOrderPreview(id);
11194
11180
  useInitiateOrderEdit({ preview });
11195
11181
  const { onCancel } = useCancelOrderEdit({ preview });
11182
+ if (isError) {
11183
+ throw error;
11184
+ }
11196
11185
  if (isPreviewError) {
11197
11186
  throw previewError;
11198
11187
  }
11199
- const isReady = !!preview;
11200
- return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
11201
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
11202
- isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
11203
- ] });
11188
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11189
+ const isReady = preview && !isPreviewPending && order && !isPending;
11190
+ return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11191
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11192
+ /* @__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 px-6 py-16", children: [
11193
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11194
+ /* @__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." }) })
11195
+ ] }) }) }),
11196
+ /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11197
+ ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11198
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11199
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11200
+ ] }) });
11204
11201
  };
11205
- const PromotionForm = ({ preview }) => {
11206
- const { items, shipping_methods } = preview;
11202
+ const ShippingForm = ({ preview, order }) => {
11203
+ var _a;
11204
+ const { setIsOpen } = useStackedModal();
11207
11205
  const [isSubmitting, setIsSubmitting] = useState(false);
11208
- const [comboboxValue, setComboboxValue] = useState("");
11209
- const { handleSuccess } = useRouteModal();
11210
- const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
11211
- const promoIds = getPromotionIds(items, shipping_methods);
11212
- const { promotions, isPending, isError, error } = usePromotions(
11206
+ const [data, setData] = useState(null);
11207
+ const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11208
+ const { shipping_options } = useShippingOptions(
11213
11209
  {
11214
- id: promoIds
11210
+ id: appliedShippingOptionIds,
11211
+ fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11215
11212
  },
11216
11213
  {
11217
- enabled: !!promoIds.length
11214
+ enabled: appliedShippingOptionIds.length > 0
11218
11215
  }
11219
11216
  );
11220
- const comboboxData = useComboboxData({
11221
- queryKey: ["promotions", "combobox", promoIds],
11222
- queryFn: async (params) => {
11223
- return await sdk.admin.promotion.list({
11224
- ...params,
11225
- id: {
11226
- $nin: promoIds
11227
- }
11228
- });
11229
- },
11230
- getOptions: (data) => {
11231
- return data.promotions.map((promotion) => ({
11232
- label: promotion.code,
11233
- value: promotion.code
11234
- }));
11235
- }
11236
- });
11237
- const add = async (value) => {
11238
- if (!value) {
11239
- return;
11240
- }
11241
- addPromotions(
11242
- {
11243
- promo_codes: [value]
11244
- },
11245
- {
11246
- onError: (e) => {
11247
- toast.error(e.message);
11248
- comboboxData.onSearchValueChange("");
11249
- setComboboxValue("");
11250
- },
11251
- onSuccess: () => {
11252
- comboboxData.onSearchValueChange("");
11253
- setComboboxValue("");
11254
- }
11255
- }
11256
- );
11257
- };
11217
+ const uniqueShippingProfiles = useMemo(() => {
11218
+ const profiles = /* @__PURE__ */ new Map();
11219
+ getUniqueShippingProfiles(order.items).forEach((profile) => {
11220
+ profiles.set(profile.id, profile);
11221
+ });
11222
+ shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11223
+ profiles.set(option.shipping_profile_id, option.shipping_profile);
11224
+ });
11225
+ return Array.from(profiles.values());
11226
+ }, [order.items, shipping_options]);
11227
+ const { handleSuccess } = useRouteModal();
11258
11228
  const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11259
- const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
11229
+ const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11230
+ const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11231
+ const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11260
11232
  const onSubmit = async () => {
11261
11233
  setIsSubmitting(true);
11262
11234
  let requestSucceeded = false;
11263
11235
  await requestOrderEdit(void 0, {
11264
11236
  onError: (e) => {
11265
- toast.error(e.message);
11237
+ toast.error(`Failed to request order edit: ${e.message}`);
11266
11238
  },
11267
11239
  onSuccess: () => {
11268
11240
  requestSucceeded = true;
@@ -11274,7 +11246,7 @@ const PromotionForm = ({ preview }) => {
11274
11246
  }
11275
11247
  await confirmOrderEdit(void 0, {
11276
11248
  onError: (e) => {
11277
- toast.error(e.message);
11249
+ toast.error(`Failed to confirm order edit: ${e.message}`);
11278
11250
  },
11279
11251
  onSuccess: () => {
11280
11252
  handleSuccess();
@@ -11284,371 +11256,16 @@ const PromotionForm = ({ preview }) => {
11284
11256
  }
11285
11257
  });
11286
11258
  };
11287
- if (isError) {
11288
- throw error;
11289
- }
11290
- return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
11291
- /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
11292
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
11293
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
11294
- /* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
11295
- /* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
11296
- ] }),
11297
- /* @__PURE__ */ jsx(
11298
- Combobox,
11299
- {
11300
- id: "promotion-combobox",
11301
- "aria-describedby": "promotion-combobox-hint",
11302
- isFetchingNextPage: comboboxData.isFetchingNextPage,
11303
- fetchNextPage: comboboxData.fetchNextPage,
11304
- options: comboboxData.options,
11305
- onSearchValueChange: comboboxData.onSearchValueChange,
11306
- searchValue: comboboxData.searchValue,
11307
- disabled: comboboxData.disabled || isAddingPromotions,
11308
- onChange: add,
11309
- value: comboboxValue
11310
- }
11311
- )
11312
- ] }),
11313
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
11314
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
11315
- PromotionItem,
11316
- {
11317
- promotion,
11318
- orderId: preview.id,
11319
- isLoading: isPending
11320
- },
11321
- promotion.id
11322
- )) })
11323
- ] }) }),
11324
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11325
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11326
- /* @__PURE__ */ jsx(
11327
- Button,
11328
- {
11329
- size: "small",
11330
- type: "submit",
11331
- isLoading: isSubmitting || isAddingPromotions,
11332
- children: "Save"
11333
- }
11334
- )
11335
- ] }) })
11336
- ] });
11337
- };
11338
- const PromotionItem = ({
11339
- promotion,
11340
- orderId,
11341
- isLoading
11342
- }) => {
11343
- var _a;
11344
- const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
11345
- const onRemove = async () => {
11346
- removePromotions(
11347
- {
11348
- promo_codes: [promotion.code]
11349
- },
11350
- {
11351
- onError: (e) => {
11352
- toast.error(e.message);
11259
+ const onKeydown = useCallback(
11260
+ (e) => {
11261
+ if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
11262
+ if (data || isSubmitting) {
11263
+ return;
11353
11264
  }
11265
+ onSubmit();
11354
11266
  }
11355
- );
11356
- };
11357
- const displayValue = getDisplayValue(promotion);
11358
- return /* @__PURE__ */ jsxs(
11359
- "div",
11360
- {
11361
- className: clx(
11362
- "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
11363
- {
11364
- "animate-pulse": isLoading
11365
- }
11366
- ),
11367
- children: [
11368
- /* @__PURE__ */ jsxs("div", { children: [
11369
- /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
11370
- /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
11371
- displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
11372
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
11373
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
11374
- ] }),
11375
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
11376
- ] })
11377
- ] }),
11378
- /* @__PURE__ */ jsx(
11379
- IconButton,
11380
- {
11381
- size: "small",
11382
- type: "button",
11383
- variant: "transparent",
11384
- onClick: onRemove,
11385
- isLoading: isPending || isLoading,
11386
- children: /* @__PURE__ */ jsx(XMark, {})
11387
- }
11388
- )
11389
- ]
11390
11267
  },
11391
- promotion.id
11392
- );
11393
- };
11394
- function getDisplayValue(promotion) {
11395
- var _a, _b, _c, _d;
11396
- const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
11397
- if (!value) {
11398
- return null;
11399
- }
11400
- if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
11401
- const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
11402
- if (!currency) {
11403
- return null;
11404
- }
11405
- return getLocaleAmount(value, currency);
11406
- } else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
11407
- return formatPercentage(value);
11408
- }
11409
- return null;
11410
- }
11411
- const formatter = new Intl.NumberFormat([], {
11412
- style: "percent",
11413
- minimumFractionDigits: 2
11414
- });
11415
- const formatPercentage = (value, isPercentageValue = false) => {
11416
- let val = value || 0;
11417
- if (!isPercentageValue) {
11418
- val = val / 100;
11419
- }
11420
- return formatter.format(val);
11421
- };
11422
- function getPromotionIds(items, shippingMethods) {
11423
- const promotionIds = /* @__PURE__ */ new Set();
11424
- for (const item of items) {
11425
- if (item.adjustments) {
11426
- for (const adjustment of item.adjustments) {
11427
- if (adjustment.promotion_id) {
11428
- promotionIds.add(adjustment.promotion_id);
11429
- }
11430
- }
11431
- }
11432
- }
11433
- for (const shippingMethod of shippingMethods) {
11434
- if (shippingMethod.adjustments) {
11435
- for (const adjustment of shippingMethod.adjustments) {
11436
- if (adjustment.promotion_id) {
11437
- promotionIds.add(adjustment.promotion_id);
11438
- }
11439
- }
11440
- }
11441
- }
11442
- return Array.from(promotionIds);
11443
- }
11444
- const SalesChannel = () => {
11445
- const { id } = useParams();
11446
- const { draft_order, isPending, isError, error } = useDraftOrder(
11447
- id,
11448
- {
11449
- fields: "+sales_channel_id"
11450
- },
11451
- {
11452
- enabled: !!id
11453
- }
11454
- );
11455
- if (isError) {
11456
- throw error;
11457
- }
11458
- const ISrEADY = !!draft_order && !isPending;
11459
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11460
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11461
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
11462
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11463
- ] }),
11464
- ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
11465
- ] });
11466
- };
11467
- const SalesChannelForm = ({ order }) => {
11468
- const form = useForm({
11469
- defaultValues: {
11470
- sales_channel_id: order.sales_channel_id || ""
11471
- },
11472
- resolver: zodResolver(schema$2)
11473
- });
11474
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11475
- const { handleSuccess } = useRouteModal();
11476
- const onSubmit = form.handleSubmit(async (data) => {
11477
- await mutateAsync(
11478
- {
11479
- sales_channel_id: data.sales_channel_id
11480
- },
11481
- {
11482
- onSuccess: () => {
11483
- toast.success("Sales channel updated");
11484
- handleSuccess();
11485
- },
11486
- onError: (error) => {
11487
- toast.error(error.message);
11488
- }
11489
- }
11490
- );
11491
- });
11492
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11493
- KeyboundForm,
11494
- {
11495
- className: "flex flex-1 flex-col overflow-hidden",
11496
- onSubmit,
11497
- children: [
11498
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
11499
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11500
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11501
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11502
- ] }) })
11503
- ]
11504
- }
11505
- ) });
11506
- };
11507
- const SalesChannelField = ({ control, order }) => {
11508
- const salesChannels = useComboboxData({
11509
- queryFn: async (params) => {
11510
- return await sdk.admin.salesChannel.list(params);
11511
- },
11512
- queryKey: ["sales-channels"],
11513
- getOptions: (data) => {
11514
- return data.sales_channels.map((salesChannel) => ({
11515
- label: salesChannel.name,
11516
- value: salesChannel.id
11517
- }));
11518
- },
11519
- defaultValue: order.sales_channel_id || void 0
11520
- });
11521
- return /* @__PURE__ */ jsx(
11522
- Form$2.Field,
11523
- {
11524
- control,
11525
- name: "sales_channel_id",
11526
- render: ({ field }) => {
11527
- return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11528
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
11529
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
11530
- Combobox,
11531
- {
11532
- options: salesChannels.options,
11533
- fetchNextPage: salesChannels.fetchNextPage,
11534
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11535
- searchValue: salesChannels.searchValue,
11536
- onSearchValueChange: salesChannels.onSearchValueChange,
11537
- placeholder: "Select sales channel",
11538
- ...field
11539
- }
11540
- ) }),
11541
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11542
- ] });
11543
- }
11544
- }
11545
- );
11546
- };
11547
- const schema$2 = objectType({
11548
- sales_channel_id: stringType().min(1)
11549
- });
11550
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11551
- const Shipping = () => {
11552
- var _a;
11553
- const { id } = useParams();
11554
- const { order, isPending, isError, error } = useOrder(id, {
11555
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11556
- });
11557
- const {
11558
- order: preview,
11559
- isPending: isPreviewPending,
11560
- isError: isPreviewError,
11561
- error: previewError
11562
- } = useOrderPreview(id);
11563
- useInitiateOrderEdit({ preview });
11564
- const { onCancel } = useCancelOrderEdit({ preview });
11565
- if (isError) {
11566
- throw error;
11567
- }
11568
- if (isPreviewError) {
11569
- throw previewError;
11570
- }
11571
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11572
- const isReady = preview && !isPreviewPending && order && !isPending;
11573
- return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11574
- /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11575
- /* @__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 px-6 py-16", children: [
11576
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11577
- /* @__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." }) })
11578
- ] }) }) }),
11579
- /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11580
- ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11581
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11582
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11583
- ] }) });
11584
- };
11585
- const ShippingForm = ({ preview, order }) => {
11586
- var _a;
11587
- const { setIsOpen } = useStackedModal();
11588
- const [isSubmitting, setIsSubmitting] = useState(false);
11589
- const [data, setData] = useState(null);
11590
- const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11591
- const { shipping_options } = useShippingOptions(
11592
- {
11593
- id: appliedShippingOptionIds,
11594
- fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11595
- },
11596
- {
11597
- enabled: appliedShippingOptionIds.length > 0
11598
- }
11599
- );
11600
- const uniqueShippingProfiles = useMemo(() => {
11601
- const profiles = /* @__PURE__ */ new Map();
11602
- getUniqueShippingProfiles(order.items).forEach((profile) => {
11603
- profiles.set(profile.id, profile);
11604
- });
11605
- shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11606
- profiles.set(option.shipping_profile_id, option.shipping_profile);
11607
- });
11608
- return Array.from(profiles.values());
11609
- }, [order.items, shipping_options]);
11610
- const { handleSuccess } = useRouteModal();
11611
- const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11612
- const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11613
- const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11614
- const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11615
- const onSubmit = async () => {
11616
- setIsSubmitting(true);
11617
- let requestSucceeded = false;
11618
- await requestOrderEdit(void 0, {
11619
- onError: (e) => {
11620
- toast.error(`Failed to request order edit: ${e.message}`);
11621
- },
11622
- onSuccess: () => {
11623
- requestSucceeded = true;
11624
- }
11625
- });
11626
- if (!requestSucceeded) {
11627
- setIsSubmitting(false);
11628
- return;
11629
- }
11630
- await confirmOrderEdit(void 0, {
11631
- onError: (e) => {
11632
- toast.error(`Failed to confirm order edit: ${e.message}`);
11633
- },
11634
- onSuccess: () => {
11635
- handleSuccess();
11636
- },
11637
- onSettled: () => {
11638
- setIsSubmitting(false);
11639
- }
11640
- });
11641
- };
11642
- const onKeydown = useCallback(
11643
- (e) => {
11644
- if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
11645
- if (data || isSubmitting) {
11646
- return;
11647
- }
11648
- onSubmit();
11649
- }
11650
- },
11651
- [data, isSubmitting, onSubmit]
11268
+ [data, isSubmitting, onSubmit]
11652
11269
  );
11653
11270
  useEffect(() => {
11654
11271
  document.addEventListener("keydown", onKeydown);
@@ -12354,224 +11971,21 @@ const CustomAmountField = ({
12354
11971
  }
12355
11972
  );
12356
11973
  };
12357
- const ShippingAddress = () => {
11974
+ const TransferOwnership = () => {
12358
11975
  const { id } = useParams();
12359
- const { order, isPending, isError, error } = useOrder(id, {
12360
- fields: "+shipping_address"
11976
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
11977
+ fields: "id,customer_id,customer.*"
12361
11978
  });
12362
11979
  if (isError) {
12363
11980
  throw error;
12364
11981
  }
12365
- const isReady = !isPending && !!order;
11982
+ const isReady = !isPending && !!draft_order;
12366
11983
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12367
11984
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12368
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12369
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11985
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
11986
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12370
11987
  ] }),
12371
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12372
- ] });
12373
- };
12374
- const ShippingAddressForm = ({ order }) => {
12375
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12376
- const form = useForm({
12377
- defaultValues: {
12378
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12379
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12380
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12381
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12382
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12383
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12384
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12385
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12386
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12387
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12388
- },
12389
- resolver: zodResolver(schema$1)
12390
- });
12391
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12392
- const { handleSuccess } = useRouteModal();
12393
- const onSubmit = form.handleSubmit(async (data) => {
12394
- await mutateAsync(
12395
- {
12396
- shipping_address: {
12397
- first_name: data.first_name,
12398
- last_name: data.last_name,
12399
- company: data.company,
12400
- address_1: data.address_1,
12401
- address_2: data.address_2,
12402
- city: data.city,
12403
- province: data.province,
12404
- country_code: data.country_code,
12405
- postal_code: data.postal_code,
12406
- phone: data.phone
12407
- }
12408
- },
12409
- {
12410
- onSuccess: () => {
12411
- handleSuccess();
12412
- },
12413
- onError: (error) => {
12414
- toast.error(error.message);
12415
- }
12416
- }
12417
- );
12418
- });
12419
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12420
- KeyboundForm,
12421
- {
12422
- className: "flex flex-1 flex-col overflow-hidden",
12423
- onSubmit,
12424
- children: [
12425
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12426
- /* @__PURE__ */ jsx(
12427
- Form$2.Field,
12428
- {
12429
- control: form.control,
12430
- name: "country_code",
12431
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12432
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12433
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12434
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12435
- ] })
12436
- }
12437
- ),
12438
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12439
- /* @__PURE__ */ jsx(
12440
- Form$2.Field,
12441
- {
12442
- control: form.control,
12443
- name: "first_name",
12444
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12445
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12446
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12447
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12448
- ] })
12449
- }
12450
- ),
12451
- /* @__PURE__ */ jsx(
12452
- Form$2.Field,
12453
- {
12454
- control: form.control,
12455
- name: "last_name",
12456
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12457
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12458
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12459
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12460
- ] })
12461
- }
12462
- )
12463
- ] }),
12464
- /* @__PURE__ */ jsx(
12465
- Form$2.Field,
12466
- {
12467
- control: form.control,
12468
- name: "company",
12469
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12470
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12471
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12472
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12473
- ] })
12474
- }
12475
- ),
12476
- /* @__PURE__ */ jsx(
12477
- Form$2.Field,
12478
- {
12479
- control: form.control,
12480
- name: "address_1",
12481
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12482
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12483
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12484
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12485
- ] })
12486
- }
12487
- ),
12488
- /* @__PURE__ */ jsx(
12489
- Form$2.Field,
12490
- {
12491
- control: form.control,
12492
- name: "address_2",
12493
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12494
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12495
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12496
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12497
- ] })
12498
- }
12499
- ),
12500
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12501
- /* @__PURE__ */ jsx(
12502
- Form$2.Field,
12503
- {
12504
- control: form.control,
12505
- name: "postal_code",
12506
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12507
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12508
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12509
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12510
- ] })
12511
- }
12512
- ),
12513
- /* @__PURE__ */ jsx(
12514
- Form$2.Field,
12515
- {
12516
- control: form.control,
12517
- name: "city",
12518
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12519
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12520
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12521
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12522
- ] })
12523
- }
12524
- )
12525
- ] }),
12526
- /* @__PURE__ */ jsx(
12527
- Form$2.Field,
12528
- {
12529
- control: form.control,
12530
- name: "province",
12531
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12532
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12533
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12534
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12535
- ] })
12536
- }
12537
- ),
12538
- /* @__PURE__ */ jsx(
12539
- Form$2.Field,
12540
- {
12541
- control: form.control,
12542
- name: "phone",
12543
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12544
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12545
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12546
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12547
- ] })
12548
- }
12549
- )
12550
- ] }) }),
12551
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12552
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12553
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12554
- ] }) })
12555
- ]
12556
- }
12557
- ) });
12558
- };
12559
- const schema$1 = addressSchema;
12560
- const TransferOwnership = () => {
12561
- const { id } = useParams();
12562
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12563
- fields: "id,customer_id,customer.*"
12564
- });
12565
- if (isError) {
12566
- throw error;
12567
- }
12568
- const isReady = !isPending && !!draft_order;
12569
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12570
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12571
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12572
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12573
- ] }),
12574
- isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
11988
+ isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12575
11989
  ] });
12576
11990
  };
12577
11991
  const TransferOwnershipForm = ({ order }) => {
@@ -12580,7 +11994,7 @@ const TransferOwnershipForm = ({ order }) => {
12580
11994
  defaultValues: {
12581
11995
  customer_id: order.customer_id || ""
12582
11996
  },
12583
- resolver: zodResolver(schema)
11997
+ resolver: zodResolver(schema$2)
12584
11998
  });
12585
11999
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12586
12000
  const { handleSuccess } = useRouteModal();
@@ -12980,59 +12394,645 @@ const Illustration = () => {
12980
12394
  transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
12981
12395
  }
12982
12396
  ) }),
12983
- /* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
12984
- "rect",
12397
+ /* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
12398
+ "rect",
12399
+ {
12400
+ width: "12",
12401
+ height: "12",
12402
+ fill: "white",
12403
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12404
+ }
12405
+ ) }),
12406
+ /* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
12407
+ "rect",
12408
+ {
12409
+ width: "12",
12410
+ height: "12",
12411
+ fill: "white",
12412
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12413
+ }
12414
+ ) }),
12415
+ /* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
12416
+ "rect",
12417
+ {
12418
+ width: "12",
12419
+ height: "12",
12420
+ fill: "white",
12421
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12422
+ }
12423
+ ) }),
12424
+ /* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
12425
+ "rect",
12426
+ {
12427
+ width: "12",
12428
+ height: "12",
12429
+ fill: "white",
12430
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12431
+ }
12432
+ ) }),
12433
+ /* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
12434
+ "rect",
12435
+ {
12436
+ width: "12",
12437
+ height: "12",
12438
+ fill: "white",
12439
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
12440
+ }
12441
+ ) })
12442
+ ] })
12443
+ ]
12444
+ }
12445
+ );
12446
+ };
12447
+ const schema$2 = objectType({
12448
+ customer_id: stringType().min(1)
12449
+ });
12450
+ const PROMOTION_QUERY_KEY = "promotions";
12451
+ const promotionsQueryKeys = {
12452
+ list: (query2) => [
12453
+ PROMOTION_QUERY_KEY,
12454
+ query2 ? query2 : void 0
12455
+ ],
12456
+ detail: (id, query2) => [
12457
+ PROMOTION_QUERY_KEY,
12458
+ id,
12459
+ query2 ? query2 : void 0
12460
+ ]
12461
+ };
12462
+ const usePromotions = (query2, options) => {
12463
+ const { data, ...rest } = useQuery({
12464
+ queryKey: promotionsQueryKeys.list(query2),
12465
+ queryFn: async () => sdk.admin.promotion.list(query2),
12466
+ ...options
12467
+ });
12468
+ return { ...data, ...rest };
12469
+ };
12470
+ const Promotions = () => {
12471
+ const { id } = useParams();
12472
+ const {
12473
+ order: preview,
12474
+ isError: isPreviewError,
12475
+ error: previewError
12476
+ } = useOrderPreview(id, void 0);
12477
+ useInitiateOrderEdit({ preview });
12478
+ const { onCancel } = useCancelOrderEdit({ preview });
12479
+ if (isPreviewError) {
12480
+ throw previewError;
12481
+ }
12482
+ const isReady = !!preview;
12483
+ return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
12484
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
12485
+ isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
12486
+ ] });
12487
+ };
12488
+ const PromotionForm = ({ preview }) => {
12489
+ const { items, shipping_methods } = preview;
12490
+ const [isSubmitting, setIsSubmitting] = useState(false);
12491
+ const [comboboxValue, setComboboxValue] = useState("");
12492
+ const { handleSuccess } = useRouteModal();
12493
+ const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
12494
+ const promoIds = getPromotionIds(items, shipping_methods);
12495
+ const { promotions, isPending, isError, error } = usePromotions(
12496
+ {
12497
+ id: promoIds
12498
+ },
12499
+ {
12500
+ enabled: !!promoIds.length
12501
+ }
12502
+ );
12503
+ const comboboxData = useComboboxData({
12504
+ queryKey: ["promotions", "combobox", promoIds],
12505
+ queryFn: async (params) => {
12506
+ return await sdk.admin.promotion.list({
12507
+ ...params,
12508
+ id: {
12509
+ $nin: promoIds
12510
+ }
12511
+ });
12512
+ },
12513
+ getOptions: (data) => {
12514
+ return data.promotions.map((promotion) => ({
12515
+ label: promotion.code,
12516
+ value: promotion.code
12517
+ }));
12518
+ }
12519
+ });
12520
+ const add = async (value) => {
12521
+ if (!value) {
12522
+ return;
12523
+ }
12524
+ addPromotions(
12525
+ {
12526
+ promo_codes: [value]
12527
+ },
12528
+ {
12529
+ onError: (e) => {
12530
+ toast.error(e.message);
12531
+ comboboxData.onSearchValueChange("");
12532
+ setComboboxValue("");
12533
+ },
12534
+ onSuccess: () => {
12535
+ comboboxData.onSearchValueChange("");
12536
+ setComboboxValue("");
12537
+ }
12538
+ }
12539
+ );
12540
+ };
12541
+ const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
12542
+ const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
12543
+ const onSubmit = async () => {
12544
+ setIsSubmitting(true);
12545
+ let requestSucceeded = false;
12546
+ await requestOrderEdit(void 0, {
12547
+ onError: (e) => {
12548
+ toast.error(e.message);
12549
+ },
12550
+ onSuccess: () => {
12551
+ requestSucceeded = true;
12552
+ }
12553
+ });
12554
+ if (!requestSucceeded) {
12555
+ setIsSubmitting(false);
12556
+ return;
12557
+ }
12558
+ await confirmOrderEdit(void 0, {
12559
+ onError: (e) => {
12560
+ toast.error(e.message);
12561
+ },
12562
+ onSuccess: () => {
12563
+ handleSuccess();
12564
+ },
12565
+ onSettled: () => {
12566
+ setIsSubmitting(false);
12567
+ }
12568
+ });
12569
+ };
12570
+ if (isError) {
12571
+ throw error;
12572
+ }
12573
+ return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
12574
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
12575
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
12576
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
12577
+ /* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
12578
+ /* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
12579
+ ] }),
12580
+ /* @__PURE__ */ jsx(
12581
+ Combobox,
12582
+ {
12583
+ id: "promotion-combobox",
12584
+ "aria-describedby": "promotion-combobox-hint",
12585
+ isFetchingNextPage: comboboxData.isFetchingNextPage,
12586
+ fetchNextPage: comboboxData.fetchNextPage,
12587
+ options: comboboxData.options,
12588
+ onSearchValueChange: comboboxData.onSearchValueChange,
12589
+ searchValue: comboboxData.searchValue,
12590
+ disabled: comboboxData.disabled || isAddingPromotions,
12591
+ onChange: add,
12592
+ value: comboboxValue
12593
+ }
12594
+ )
12595
+ ] }),
12596
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
12597
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
12598
+ PromotionItem,
12599
+ {
12600
+ promotion,
12601
+ orderId: preview.id,
12602
+ isLoading: isPending
12603
+ },
12604
+ promotion.id
12605
+ )) })
12606
+ ] }) }),
12607
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12608
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12609
+ /* @__PURE__ */ jsx(
12610
+ Button,
12611
+ {
12612
+ size: "small",
12613
+ type: "submit",
12614
+ isLoading: isSubmitting || isAddingPromotions,
12615
+ children: "Save"
12616
+ }
12617
+ )
12618
+ ] }) })
12619
+ ] });
12620
+ };
12621
+ const PromotionItem = ({
12622
+ promotion,
12623
+ orderId,
12624
+ isLoading
12625
+ }) => {
12626
+ var _a;
12627
+ const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
12628
+ const onRemove = async () => {
12629
+ removePromotions(
12630
+ {
12631
+ promo_codes: [promotion.code]
12632
+ },
12633
+ {
12634
+ onError: (e) => {
12635
+ toast.error(e.message);
12636
+ }
12637
+ }
12638
+ );
12639
+ };
12640
+ const displayValue = getDisplayValue(promotion);
12641
+ return /* @__PURE__ */ jsxs(
12642
+ "div",
12643
+ {
12644
+ className: clx(
12645
+ "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
12646
+ {
12647
+ "animate-pulse": isLoading
12648
+ }
12649
+ ),
12650
+ children: [
12651
+ /* @__PURE__ */ jsxs("div", { children: [
12652
+ /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
12653
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
12654
+ displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
12655
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
12656
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
12657
+ ] }),
12658
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
12659
+ ] })
12660
+ ] }),
12661
+ /* @__PURE__ */ jsx(
12662
+ IconButton,
12663
+ {
12664
+ size: "small",
12665
+ type: "button",
12666
+ variant: "transparent",
12667
+ onClick: onRemove,
12668
+ isLoading: isPending || isLoading,
12669
+ children: /* @__PURE__ */ jsx(XMark, {})
12670
+ }
12671
+ )
12672
+ ]
12673
+ },
12674
+ promotion.id
12675
+ );
12676
+ };
12677
+ function getDisplayValue(promotion) {
12678
+ var _a, _b, _c, _d;
12679
+ const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
12680
+ if (!value) {
12681
+ return null;
12682
+ }
12683
+ if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
12684
+ const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
12685
+ if (!currency) {
12686
+ return null;
12687
+ }
12688
+ return getLocaleAmount(value, currency);
12689
+ } else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
12690
+ return formatPercentage(value);
12691
+ }
12692
+ return null;
12693
+ }
12694
+ const formatter = new Intl.NumberFormat([], {
12695
+ style: "percent",
12696
+ minimumFractionDigits: 2
12697
+ });
12698
+ const formatPercentage = (value, isPercentageValue = false) => {
12699
+ let val = value || 0;
12700
+ if (!isPercentageValue) {
12701
+ val = val / 100;
12702
+ }
12703
+ return formatter.format(val);
12704
+ };
12705
+ function getPromotionIds(items, shippingMethods) {
12706
+ const promotionIds = /* @__PURE__ */ new Set();
12707
+ for (const item of items) {
12708
+ if (item.adjustments) {
12709
+ for (const adjustment of item.adjustments) {
12710
+ if (adjustment.promotion_id) {
12711
+ promotionIds.add(adjustment.promotion_id);
12712
+ }
12713
+ }
12714
+ }
12715
+ }
12716
+ for (const shippingMethod of shippingMethods) {
12717
+ if (shippingMethod.adjustments) {
12718
+ for (const adjustment of shippingMethod.adjustments) {
12719
+ if (adjustment.promotion_id) {
12720
+ promotionIds.add(adjustment.promotion_id);
12721
+ }
12722
+ }
12723
+ }
12724
+ }
12725
+ return Array.from(promotionIds);
12726
+ }
12727
+ const SalesChannel = () => {
12728
+ const { id } = useParams();
12729
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12730
+ id,
12731
+ {
12732
+ fields: "+sales_channel_id"
12733
+ },
12734
+ {
12735
+ enabled: !!id
12736
+ }
12737
+ );
12738
+ if (isError) {
12739
+ throw error;
12740
+ }
12741
+ const ISrEADY = !!draft_order && !isPending;
12742
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12743
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12744
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
12745
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12746
+ ] }),
12747
+ ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
12748
+ ] });
12749
+ };
12750
+ const SalesChannelForm = ({ order }) => {
12751
+ const form = useForm({
12752
+ defaultValues: {
12753
+ sales_channel_id: order.sales_channel_id || ""
12754
+ },
12755
+ resolver: zodResolver(schema$1)
12756
+ });
12757
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12758
+ const { handleSuccess } = useRouteModal();
12759
+ const onSubmit = form.handleSubmit(async (data) => {
12760
+ await mutateAsync(
12761
+ {
12762
+ sales_channel_id: data.sales_channel_id
12763
+ },
12764
+ {
12765
+ onSuccess: () => {
12766
+ toast.success("Sales channel updated");
12767
+ handleSuccess();
12768
+ },
12769
+ onError: (error) => {
12770
+ toast.error(error.message);
12771
+ }
12772
+ }
12773
+ );
12774
+ });
12775
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12776
+ KeyboundForm,
12777
+ {
12778
+ className: "flex flex-1 flex-col overflow-hidden",
12779
+ onSubmit,
12780
+ children: [
12781
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
12782
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12783
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12784
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12785
+ ] }) })
12786
+ ]
12787
+ }
12788
+ ) });
12789
+ };
12790
+ const SalesChannelField = ({ control, order }) => {
12791
+ const salesChannels = useComboboxData({
12792
+ queryFn: async (params) => {
12793
+ return await sdk.admin.salesChannel.list(params);
12794
+ },
12795
+ queryKey: ["sales-channels"],
12796
+ getOptions: (data) => {
12797
+ return data.sales_channels.map((salesChannel) => ({
12798
+ label: salesChannel.name,
12799
+ value: salesChannel.id
12800
+ }));
12801
+ },
12802
+ defaultValue: order.sales_channel_id || void 0
12803
+ });
12804
+ return /* @__PURE__ */ jsx(
12805
+ Form$2.Field,
12806
+ {
12807
+ control,
12808
+ name: "sales_channel_id",
12809
+ render: ({ field }) => {
12810
+ return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12811
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
12812
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12813
+ Combobox,
12814
+ {
12815
+ options: salesChannels.options,
12816
+ fetchNextPage: salesChannels.fetchNextPage,
12817
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
12818
+ searchValue: salesChannels.searchValue,
12819
+ onSearchValueChange: salesChannels.onSearchValueChange,
12820
+ placeholder: "Select sales channel",
12821
+ ...field
12822
+ }
12823
+ ) }),
12824
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12825
+ ] });
12826
+ }
12827
+ }
12828
+ );
12829
+ };
12830
+ const schema$1 = objectType({
12831
+ sales_channel_id: stringType().min(1)
12832
+ });
12833
+ const ShippingAddress = () => {
12834
+ const { id } = useParams();
12835
+ const { order, isPending, isError, error } = useOrder(id, {
12836
+ fields: "+shipping_address"
12837
+ });
12838
+ if (isError) {
12839
+ throw error;
12840
+ }
12841
+ const isReady = !isPending && !!order;
12842
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12843
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12844
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12845
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12846
+ ] }),
12847
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12848
+ ] });
12849
+ };
12850
+ const ShippingAddressForm = ({ order }) => {
12851
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12852
+ const form = useForm({
12853
+ defaultValues: {
12854
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12855
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12856
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12857
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12858
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12859
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12860
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12861
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12862
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12863
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12864
+ },
12865
+ resolver: zodResolver(schema)
12866
+ });
12867
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12868
+ const { handleSuccess } = useRouteModal();
12869
+ const onSubmit = form.handleSubmit(async (data) => {
12870
+ await mutateAsync(
12871
+ {
12872
+ shipping_address: {
12873
+ first_name: data.first_name,
12874
+ last_name: data.last_name,
12875
+ company: data.company,
12876
+ address_1: data.address_1,
12877
+ address_2: data.address_2,
12878
+ city: data.city,
12879
+ province: data.province,
12880
+ country_code: data.country_code,
12881
+ postal_code: data.postal_code,
12882
+ phone: data.phone
12883
+ }
12884
+ },
12885
+ {
12886
+ onSuccess: () => {
12887
+ handleSuccess();
12888
+ },
12889
+ onError: (error) => {
12890
+ toast.error(error.message);
12891
+ }
12892
+ }
12893
+ );
12894
+ });
12895
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12896
+ KeyboundForm,
12897
+ {
12898
+ className: "flex flex-1 flex-col overflow-hidden",
12899
+ onSubmit,
12900
+ children: [
12901
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12902
+ /* @__PURE__ */ jsx(
12903
+ Form$2.Field,
12985
12904
  {
12986
- width: "12",
12987
- height: "12",
12988
- fill: "white",
12989
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12905
+ control: form.control,
12906
+ name: "country_code",
12907
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12908
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12909
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12910
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12911
+ ] })
12990
12912
  }
12991
- ) }),
12992
- /* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
12993
- "rect",
12913
+ ),
12914
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12915
+ /* @__PURE__ */ jsx(
12916
+ Form$2.Field,
12917
+ {
12918
+ control: form.control,
12919
+ name: "first_name",
12920
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12921
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12922
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12923
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12924
+ ] })
12925
+ }
12926
+ ),
12927
+ /* @__PURE__ */ jsx(
12928
+ Form$2.Field,
12929
+ {
12930
+ control: form.control,
12931
+ name: "last_name",
12932
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12933
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12934
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12935
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12936
+ ] })
12937
+ }
12938
+ )
12939
+ ] }),
12940
+ /* @__PURE__ */ jsx(
12941
+ Form$2.Field,
12994
12942
  {
12995
- width: "12",
12996
- height: "12",
12997
- fill: "white",
12998
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12943
+ control: form.control,
12944
+ name: "company",
12945
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12946
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12947
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12948
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12949
+ ] })
12999
12950
  }
13000
- ) }),
13001
- /* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
13002
- "rect",
12951
+ ),
12952
+ /* @__PURE__ */ jsx(
12953
+ Form$2.Field,
13003
12954
  {
13004
- width: "12",
13005
- height: "12",
13006
- fill: "white",
13007
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12955
+ control: form.control,
12956
+ name: "address_1",
12957
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12958
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12959
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12960
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12961
+ ] })
13008
12962
  }
13009
- ) }),
13010
- /* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
13011
- "rect",
12963
+ ),
12964
+ /* @__PURE__ */ jsx(
12965
+ Form$2.Field,
13012
12966
  {
13013
- width: "12",
13014
- height: "12",
13015
- fill: "white",
13016
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12967
+ control: form.control,
12968
+ name: "address_2",
12969
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12970
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12971
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12972
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12973
+ ] })
13017
12974
  }
13018
- ) }),
13019
- /* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
13020
- "rect",
12975
+ ),
12976
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12977
+ /* @__PURE__ */ jsx(
12978
+ Form$2.Field,
12979
+ {
12980
+ control: form.control,
12981
+ name: "postal_code",
12982
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12983
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12984
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12985
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12986
+ ] })
12987
+ }
12988
+ ),
12989
+ /* @__PURE__ */ jsx(
12990
+ Form$2.Field,
12991
+ {
12992
+ control: form.control,
12993
+ name: "city",
12994
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12995
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12996
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12997
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12998
+ ] })
12999
+ }
13000
+ )
13001
+ ] }),
13002
+ /* @__PURE__ */ jsx(
13003
+ Form$2.Field,
13021
13004
  {
13022
- width: "12",
13023
- height: "12",
13024
- fill: "white",
13025
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
13005
+ control: form.control,
13006
+ name: "province",
13007
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13008
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13009
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13010
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13011
+ ] })
13026
13012
  }
13027
- ) })
13028
- ] })
13013
+ ),
13014
+ /* @__PURE__ */ jsx(
13015
+ Form$2.Field,
13016
+ {
13017
+ control: form.control,
13018
+ name: "phone",
13019
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13020
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13021
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13022
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13023
+ ] })
13024
+ }
13025
+ )
13026
+ ] }) }),
13027
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13028
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13029
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13030
+ ] }) })
13029
13031
  ]
13030
13032
  }
13031
- );
13033
+ ) });
13032
13034
  };
13033
- const schema = objectType({
13034
- customer_id: stringType().min(1)
13035
- });
13035
+ const schema = addressSchema;
13036
13036
  const widgetModule = { widgets: [] };
13037
13037
  const routeModule = {
13038
13038
  routes: [
@@ -13073,6 +13073,14 @@ const routeModule = {
13073
13073
  Component: Metadata,
13074
13074
  path: "/draft-orders/:id/metadata"
13075
13075
  },
13076
+ {
13077
+ Component: Shipping,
13078
+ path: "/draft-orders/:id/shipping"
13079
+ },
13080
+ {
13081
+ Component: TransferOwnership,
13082
+ path: "/draft-orders/:id/transfer-ownership"
13083
+ },
13076
13084
  {
13077
13085
  Component: Promotions,
13078
13086
  path: "/draft-orders/:id/promotions"
@@ -13081,17 +13089,9 @@ const routeModule = {
13081
13089
  Component: SalesChannel,
13082
13090
  path: "/draft-orders/:id/sales-channel"
13083
13091
  },
13084
- {
13085
- Component: Shipping,
13086
- path: "/draft-orders/:id/shipping"
13087
- },
13088
13092
  {
13089
13093
  Component: ShippingAddress,
13090
13094
  path: "/draft-orders/:id/shipping-address"
13091
- },
13092
- {
13093
- Component: TransferOwnership,
13094
- path: "/draft-orders/:id/transfer-ownership"
13095
13095
  }
13096
13096
  ]
13097
13097
  }