@medusajs/draft-order 2.11.3 → 2.11.4-snapshot-20251105174837
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 +778 -778
- package/.medusa/server/src/admin/index.mjs +778 -778
- package/package.json +16 -16
|
@@ -11171,77 +11171,105 @@ function getHasUneditableRows(metadata) {
|
|
|
11171
11171
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11172
11172
|
);
|
|
11173
11173
|
}
|
|
11174
|
-
const
|
|
11175
|
-
const
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11174
|
+
const PROMOTION_QUERY_KEY = "promotions";
|
|
11175
|
+
const promotionsQueryKeys = {
|
|
11176
|
+
list: (query2) => [
|
|
11177
|
+
PROMOTION_QUERY_KEY,
|
|
11178
|
+
query2 ? query2 : void 0
|
|
11179
|
+
],
|
|
11180
|
+
detail: (id, query2) => [
|
|
11181
|
+
PROMOTION_QUERY_KEY,
|
|
11182
|
+
id,
|
|
11183
|
+
query2 ? query2 : void 0
|
|
11184
|
+
]
|
|
11185
|
+
};
|
|
11186
|
+
const usePromotions = (query2, options) => {
|
|
11187
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
11188
|
+
queryKey: promotionsQueryKeys.list(query2),
|
|
11189
|
+
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
11190
|
+
...options
|
|
11180
11191
|
});
|
|
11192
|
+
return { ...data, ...rest };
|
|
11193
|
+
};
|
|
11194
|
+
const Promotions = () => {
|
|
11195
|
+
const { id } = reactRouterDom.useParams();
|
|
11181
11196
|
const {
|
|
11182
11197
|
order: preview,
|
|
11183
|
-
isPending: isPreviewPending,
|
|
11184
11198
|
isError: isPreviewError,
|
|
11185
11199
|
error: previewError
|
|
11186
|
-
} = useOrderPreview(id);
|
|
11200
|
+
} = useOrderPreview(id, void 0);
|
|
11187
11201
|
useInitiateOrderEdit({ preview });
|
|
11188
11202
|
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11189
|
-
if (isError) {
|
|
11190
|
-
throw error;
|
|
11191
|
-
}
|
|
11192
11203
|
if (isPreviewError) {
|
|
11193
11204
|
throw previewError;
|
|
11194
11205
|
}
|
|
11195
|
-
const
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11199
|
-
|
|
11200
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11201
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11202
|
-
] }) }) }),
|
|
11203
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11204
|
-
] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11205
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11206
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11207
|
-
] }) });
|
|
11206
|
+
const isReady = !!preview;
|
|
11207
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
11208
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Promotions" }) }) }),
|
|
11209
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(PromotionForm, { preview })
|
|
11210
|
+
] });
|
|
11208
11211
|
};
|
|
11209
|
-
const
|
|
11210
|
-
|
|
11211
|
-
const { setIsOpen } = useStackedModal();
|
|
11212
|
+
const PromotionForm = ({ preview }) => {
|
|
11213
|
+
const { items, shipping_methods } = preview;
|
|
11212
11214
|
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11213
|
-
const [
|
|
11214
|
-
const
|
|
11215
|
-
const {
|
|
11215
|
+
const [comboboxValue, setComboboxValue] = React.useState("");
|
|
11216
|
+
const { handleSuccess } = useRouteModal();
|
|
11217
|
+
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
11218
|
+
const promoIds = getPromotionIds(items, shipping_methods);
|
|
11219
|
+
const { promotions, isPending, isError, error } = usePromotions(
|
|
11216
11220
|
{
|
|
11217
|
-
id:
|
|
11218
|
-
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11221
|
+
id: promoIds
|
|
11219
11222
|
},
|
|
11220
11223
|
{
|
|
11221
|
-
enabled:
|
|
11224
|
+
enabled: !!promoIds.length
|
|
11222
11225
|
}
|
|
11223
11226
|
);
|
|
11224
|
-
const
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11227
|
+
const comboboxData = useComboboxData({
|
|
11228
|
+
queryKey: ["promotions", "combobox", promoIds],
|
|
11229
|
+
queryFn: async (params) => {
|
|
11230
|
+
return await sdk.admin.promotion.list({
|
|
11231
|
+
...params,
|
|
11232
|
+
id: {
|
|
11233
|
+
$nin: promoIds
|
|
11234
|
+
}
|
|
11235
|
+
});
|
|
11236
|
+
},
|
|
11237
|
+
getOptions: (data) => {
|
|
11238
|
+
return data.promotions.map((promotion) => ({
|
|
11239
|
+
label: promotion.code,
|
|
11240
|
+
value: promotion.code
|
|
11241
|
+
}));
|
|
11242
|
+
}
|
|
11243
|
+
});
|
|
11244
|
+
const add = async (value) => {
|
|
11245
|
+
if (!value) {
|
|
11246
|
+
return;
|
|
11247
|
+
}
|
|
11248
|
+
addPromotions(
|
|
11249
|
+
{
|
|
11250
|
+
promo_codes: [value]
|
|
11251
|
+
},
|
|
11252
|
+
{
|
|
11253
|
+
onError: (e) => {
|
|
11254
|
+
ui.toast.error(e.message);
|
|
11255
|
+
comboboxData.onSearchValueChange("");
|
|
11256
|
+
setComboboxValue("");
|
|
11257
|
+
},
|
|
11258
|
+
onSuccess: () => {
|
|
11259
|
+
comboboxData.onSearchValueChange("");
|
|
11260
|
+
setComboboxValue("");
|
|
11261
|
+
}
|
|
11262
|
+
}
|
|
11263
|
+
);
|
|
11264
|
+
};
|
|
11235
11265
|
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
11236
|
-
const { mutateAsync: requestOrderEdit } =
|
|
11237
|
-
const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
|
|
11238
|
-
const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
|
|
11266
|
+
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
11239
11267
|
const onSubmit = async () => {
|
|
11240
11268
|
setIsSubmitting(true);
|
|
11241
11269
|
let requestSucceeded = false;
|
|
11242
11270
|
await requestOrderEdit(void 0, {
|
|
11243
11271
|
onError: (e) => {
|
|
11244
|
-
ui.toast.error(
|
|
11272
|
+
ui.toast.error(e.message);
|
|
11245
11273
|
},
|
|
11246
11274
|
onSuccess: () => {
|
|
11247
11275
|
requestSucceeded = true;
|
|
@@ -11253,7 +11281,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11253
11281
|
}
|
|
11254
11282
|
await confirmOrderEdit(void 0, {
|
|
11255
11283
|
onError: (e) => {
|
|
11256
|
-
ui.toast.error(
|
|
11284
|
+
ui.toast.error(e.message);
|
|
11257
11285
|
},
|
|
11258
11286
|
onSuccess: () => {
|
|
11259
11287
|
handleSuccess();
|
|
@@ -11263,53 +11291,408 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11263
11291
|
}
|
|
11264
11292
|
});
|
|
11265
11293
|
};
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11294
|
+
if (isError) {
|
|
11295
|
+
throw error;
|
|
11296
|
+
}
|
|
11297
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
11298
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
11299
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
11300
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
11301
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
11302
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
11303
|
+
] }),
|
|
11304
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11305
|
+
Combobox,
|
|
11306
|
+
{
|
|
11307
|
+
id: "promotion-combobox",
|
|
11308
|
+
"aria-describedby": "promotion-combobox-hint",
|
|
11309
|
+
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
11310
|
+
fetchNextPage: comboboxData.fetchNextPage,
|
|
11311
|
+
options: comboboxData.options,
|
|
11312
|
+
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
11313
|
+
searchValue: comboboxData.searchValue,
|
|
11314
|
+
disabled: comboboxData.disabled || isAddingPromotions,
|
|
11315
|
+
onChange: add,
|
|
11316
|
+
value: comboboxValue
|
|
11317
|
+
}
|
|
11318
|
+
)
|
|
11319
|
+
] }),
|
|
11320
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
11321
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11322
|
+
PromotionItem,
|
|
11323
|
+
{
|
|
11324
|
+
promotion,
|
|
11325
|
+
orderId: preview.id,
|
|
11326
|
+
isLoading: isPending
|
|
11327
|
+
},
|
|
11328
|
+
promotion.id
|
|
11329
|
+
)) })
|
|
11330
|
+
] }) }),
|
|
11331
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11332
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11333
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11334
|
+
ui.Button,
|
|
11335
|
+
{
|
|
11336
|
+
size: "small",
|
|
11337
|
+
type: "submit",
|
|
11338
|
+
isLoading: isSubmitting || isAddingPromotions,
|
|
11339
|
+
children: "Save"
|
|
11340
|
+
}
|
|
11341
|
+
)
|
|
11342
|
+
] }) })
|
|
11343
|
+
] });
|
|
11344
|
+
};
|
|
11345
|
+
const PromotionItem = ({
|
|
11346
|
+
promotion,
|
|
11347
|
+
orderId,
|
|
11348
|
+
isLoading
|
|
11349
|
+
}) => {
|
|
11350
|
+
var _a;
|
|
11351
|
+
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
11352
|
+
const onRemove = async () => {
|
|
11353
|
+
removePromotions(
|
|
11354
|
+
{
|
|
11355
|
+
promo_codes: [promotion.code]
|
|
11356
|
+
},
|
|
11357
|
+
{
|
|
11358
|
+
onError: (e) => {
|
|
11359
|
+
ui.toast.error(e.message);
|
|
11271
11360
|
}
|
|
11272
|
-
onSubmit();
|
|
11273
11361
|
}
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
);
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11362
|
+
);
|
|
11363
|
+
};
|
|
11364
|
+
const displayValue = getDisplayValue(promotion);
|
|
11365
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11366
|
+
"div",
|
|
11367
|
+
{
|
|
11368
|
+
className: ui.clx(
|
|
11369
|
+
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
11370
|
+
{
|
|
11371
|
+
"animate-pulse": isLoading
|
|
11372
|
+
}
|
|
11373
|
+
),
|
|
11374
|
+
children: [
|
|
11287
11375
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11288
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11289
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11376
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
11377
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
11378
|
+
displayValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
11379
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: displayValue }),
|
|
11380
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "·" })
|
|
11381
|
+
] }),
|
|
11382
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
11383
|
+
] })
|
|
11290
11384
|
] }),
|
|
11291
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11385
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11386
|
+
ui.IconButton,
|
|
11387
|
+
{
|
|
11388
|
+
size: "small",
|
|
11389
|
+
type: "button",
|
|
11390
|
+
variant: "transparent",
|
|
11391
|
+
onClick: onRemove,
|
|
11392
|
+
isLoading: isPending || isLoading,
|
|
11393
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XMark, {})
|
|
11394
|
+
}
|
|
11395
|
+
)
|
|
11396
|
+
]
|
|
11397
|
+
},
|
|
11398
|
+
promotion.id
|
|
11399
|
+
);
|
|
11400
|
+
};
|
|
11401
|
+
function getDisplayValue(promotion) {
|
|
11402
|
+
var _a, _b, _c, _d;
|
|
11403
|
+
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
11404
|
+
if (!value) {
|
|
11405
|
+
return null;
|
|
11406
|
+
}
|
|
11407
|
+
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
11408
|
+
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
11409
|
+
if (!currency) {
|
|
11410
|
+
return null;
|
|
11411
|
+
}
|
|
11412
|
+
return getLocaleAmount(value, currency);
|
|
11413
|
+
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
11414
|
+
return formatPercentage(value);
|
|
11415
|
+
}
|
|
11416
|
+
return null;
|
|
11417
|
+
}
|
|
11418
|
+
const formatter = new Intl.NumberFormat([], {
|
|
11419
|
+
style: "percent",
|
|
11420
|
+
minimumFractionDigits: 2
|
|
11421
|
+
});
|
|
11422
|
+
const formatPercentage = (value, isPercentageValue = false) => {
|
|
11423
|
+
let val = value || 0;
|
|
11424
|
+
if (!isPercentageValue) {
|
|
11425
|
+
val = val / 100;
|
|
11426
|
+
}
|
|
11427
|
+
return formatter.format(val);
|
|
11428
|
+
};
|
|
11429
|
+
function getPromotionIds(items, shippingMethods) {
|
|
11430
|
+
const promotionIds = /* @__PURE__ */ new Set();
|
|
11431
|
+
for (const item of items) {
|
|
11432
|
+
if (item.adjustments) {
|
|
11433
|
+
for (const adjustment of item.adjustments) {
|
|
11434
|
+
if (adjustment.promotion_id) {
|
|
11435
|
+
promotionIds.add(adjustment.promotion_id);
|
|
11436
|
+
}
|
|
11437
|
+
}
|
|
11438
|
+
}
|
|
11439
|
+
}
|
|
11440
|
+
for (const shippingMethod of shippingMethods) {
|
|
11441
|
+
if (shippingMethod.adjustments) {
|
|
11442
|
+
for (const adjustment of shippingMethod.adjustments) {
|
|
11443
|
+
if (adjustment.promotion_id) {
|
|
11444
|
+
promotionIds.add(adjustment.promotion_id);
|
|
11445
|
+
}
|
|
11446
|
+
}
|
|
11447
|
+
}
|
|
11448
|
+
}
|
|
11449
|
+
return Array.from(promotionIds);
|
|
11450
|
+
}
|
|
11451
|
+
const SalesChannel = () => {
|
|
11452
|
+
const { id } = reactRouterDom.useParams();
|
|
11453
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11454
|
+
id,
|
|
11455
|
+
{
|
|
11456
|
+
fields: "+sales_channel_id"
|
|
11457
|
+
},
|
|
11458
|
+
{
|
|
11459
|
+
enabled: !!id
|
|
11460
|
+
}
|
|
11461
|
+
);
|
|
11462
|
+
if (isError) {
|
|
11463
|
+
throw error;
|
|
11464
|
+
}
|
|
11465
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11466
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11467
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11468
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11469
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11470
|
+
] }),
|
|
11471
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11472
|
+
] });
|
|
11473
|
+
};
|
|
11474
|
+
const SalesChannelForm = ({ order }) => {
|
|
11475
|
+
const form = reactHookForm.useForm({
|
|
11476
|
+
defaultValues: {
|
|
11477
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11478
|
+
},
|
|
11479
|
+
resolver: zod.zodResolver(schema$2)
|
|
11480
|
+
});
|
|
11481
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11482
|
+
const { handleSuccess } = useRouteModal();
|
|
11483
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11484
|
+
await mutateAsync(
|
|
11485
|
+
{
|
|
11486
|
+
sales_channel_id: data.sales_channel_id
|
|
11487
|
+
},
|
|
11488
|
+
{
|
|
11489
|
+
onSuccess: () => {
|
|
11490
|
+
ui.toast.success("Sales channel updated");
|
|
11491
|
+
handleSuccess();
|
|
11492
|
+
},
|
|
11493
|
+
onError: (error) => {
|
|
11494
|
+
ui.toast.error(error.message);
|
|
11495
|
+
}
|
|
11496
|
+
}
|
|
11497
|
+
);
|
|
11498
|
+
});
|
|
11499
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11500
|
+
KeyboundForm,
|
|
11501
|
+
{
|
|
11502
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11503
|
+
onSubmit,
|
|
11504
|
+
children: [
|
|
11505
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11506
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11507
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11508
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11509
|
+
] }) })
|
|
11510
|
+
]
|
|
11511
|
+
}
|
|
11512
|
+
) });
|
|
11513
|
+
};
|
|
11514
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11515
|
+
const salesChannels = useComboboxData({
|
|
11516
|
+
queryFn: async (params) => {
|
|
11517
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11518
|
+
},
|
|
11519
|
+
queryKey: ["sales-channels"],
|
|
11520
|
+
getOptions: (data) => {
|
|
11521
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11522
|
+
label: salesChannel.name,
|
|
11523
|
+
value: salesChannel.id
|
|
11524
|
+
}));
|
|
11525
|
+
},
|
|
11526
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11527
|
+
});
|
|
11528
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11529
|
+
Form$2.Field,
|
|
11530
|
+
{
|
|
11531
|
+
control,
|
|
11532
|
+
name: "sales_channel_id",
|
|
11533
|
+
render: ({ field }) => {
|
|
11534
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11535
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11536
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11537
|
+
Combobox,
|
|
11538
|
+
{
|
|
11539
|
+
options: salesChannels.options,
|
|
11540
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11541
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11542
|
+
searchValue: salesChannels.searchValue,
|
|
11543
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11544
|
+
placeholder: "Select sales channel",
|
|
11545
|
+
...field
|
|
11546
|
+
}
|
|
11547
|
+
) }),
|
|
11548
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11549
|
+
] });
|
|
11550
|
+
}
|
|
11551
|
+
}
|
|
11552
|
+
);
|
|
11553
|
+
};
|
|
11554
|
+
const schema$2 = objectType({
|
|
11555
|
+
sales_channel_id: stringType().min(1)
|
|
11556
|
+
});
|
|
11557
|
+
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11558
|
+
const Shipping = () => {
|
|
11559
|
+
var _a;
|
|
11560
|
+
const { id } = reactRouterDom.useParams();
|
|
11561
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11562
|
+
fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
|
|
11563
|
+
});
|
|
11564
|
+
const {
|
|
11565
|
+
order: preview,
|
|
11566
|
+
isPending: isPreviewPending,
|
|
11567
|
+
isError: isPreviewError,
|
|
11568
|
+
error: previewError
|
|
11569
|
+
} = useOrderPreview(id);
|
|
11570
|
+
useInitiateOrderEdit({ preview });
|
|
11571
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11572
|
+
if (isError) {
|
|
11573
|
+
throw error;
|
|
11574
|
+
}
|
|
11575
|
+
if (isPreviewError) {
|
|
11576
|
+
throw previewError;
|
|
11577
|
+
}
|
|
11578
|
+
const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
|
|
11579
|
+
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11580
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11581
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11582
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
|
|
11583
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11584
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11585
|
+
] }) }) }),
|
|
11586
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
|
|
11587
|
+
] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11588
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
|
|
11589
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
|
|
11590
|
+
] }) });
|
|
11591
|
+
};
|
|
11592
|
+
const ShippingForm = ({ preview, order }) => {
|
|
11593
|
+
var _a;
|
|
11594
|
+
const { setIsOpen } = useStackedModal();
|
|
11595
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11596
|
+
const [data, setData] = React.useState(null);
|
|
11597
|
+
const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
|
|
11598
|
+
const { shipping_options } = useShippingOptions(
|
|
11599
|
+
{
|
|
11600
|
+
id: appliedShippingOptionIds,
|
|
11601
|
+
fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
|
|
11602
|
+
},
|
|
11603
|
+
{
|
|
11604
|
+
enabled: appliedShippingOptionIds.length > 0
|
|
11605
|
+
}
|
|
11606
|
+
);
|
|
11607
|
+
const uniqueShippingProfiles = React.useMemo(() => {
|
|
11608
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
11609
|
+
getUniqueShippingProfiles(order.items).forEach((profile) => {
|
|
11610
|
+
profiles.set(profile.id, profile);
|
|
11611
|
+
});
|
|
11612
|
+
shipping_options == null ? void 0 : shipping_options.forEach((option) => {
|
|
11613
|
+
profiles.set(option.shipping_profile_id, option.shipping_profile);
|
|
11614
|
+
});
|
|
11615
|
+
return Array.from(profiles.values());
|
|
11616
|
+
}, [order.items, shipping_options]);
|
|
11617
|
+
const { handleSuccess } = useRouteModal();
|
|
11618
|
+
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
11619
|
+
const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
|
|
11620
|
+
const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
|
|
11621
|
+
const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
|
|
11622
|
+
const onSubmit = async () => {
|
|
11623
|
+
setIsSubmitting(true);
|
|
11624
|
+
let requestSucceeded = false;
|
|
11625
|
+
await requestOrderEdit(void 0, {
|
|
11626
|
+
onError: (e) => {
|
|
11627
|
+
ui.toast.error(`Failed to request order edit: ${e.message}`);
|
|
11628
|
+
},
|
|
11629
|
+
onSuccess: () => {
|
|
11630
|
+
requestSucceeded = true;
|
|
11631
|
+
}
|
|
11632
|
+
});
|
|
11633
|
+
if (!requestSucceeded) {
|
|
11634
|
+
setIsSubmitting(false);
|
|
11635
|
+
return;
|
|
11636
|
+
}
|
|
11637
|
+
await confirmOrderEdit(void 0, {
|
|
11638
|
+
onError: (e) => {
|
|
11639
|
+
ui.toast.error(`Failed to confirm order edit: ${e.message}`);
|
|
11640
|
+
},
|
|
11641
|
+
onSuccess: () => {
|
|
11642
|
+
handleSuccess();
|
|
11643
|
+
},
|
|
11644
|
+
onSettled: () => {
|
|
11645
|
+
setIsSubmitting(false);
|
|
11646
|
+
}
|
|
11647
|
+
});
|
|
11648
|
+
};
|
|
11649
|
+
const onKeydown = React.useCallback(
|
|
11650
|
+
(e) => {
|
|
11651
|
+
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
|
11652
|
+
if (data || isSubmitting) {
|
|
11653
|
+
return;
|
|
11654
|
+
}
|
|
11655
|
+
onSubmit();
|
|
11656
|
+
}
|
|
11657
|
+
},
|
|
11658
|
+
[data, isSubmitting, onSubmit]
|
|
11659
|
+
);
|
|
11660
|
+
React.useEffect(() => {
|
|
11661
|
+
document.addEventListener("keydown", onKeydown);
|
|
11662
|
+
return () => {
|
|
11663
|
+
document.removeEventListener("keydown", onKeydown);
|
|
11664
|
+
};
|
|
11665
|
+
}, [onKeydown]);
|
|
11666
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
11667
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11668
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
11669
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
|
|
11670
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11671
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11672
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Choose which shipping method(s) to use for the items in the order." }) })
|
|
11673
|
+
] }),
|
|
11674
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
11675
|
+
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
|
|
11676
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2", children: [
|
|
11677
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11678
|
+
ui.Text,
|
|
11679
|
+
{
|
|
11680
|
+
size: "xsmall",
|
|
11681
|
+
weight: "plus",
|
|
11682
|
+
className: "text-ui-fg-muted",
|
|
11683
|
+
children: "Shipping profile"
|
|
11684
|
+
}
|
|
11685
|
+
),
|
|
11686
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11687
|
+
ui.Text,
|
|
11688
|
+
{
|
|
11689
|
+
size: "xsmall",
|
|
11690
|
+
weight: "plus",
|
|
11691
|
+
className: "text-ui-fg-muted",
|
|
11692
|
+
children: "Action"
|
|
11693
|
+
}
|
|
11694
|
+
)
|
|
11695
|
+
] }),
|
|
11313
11696
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[5px] pb-[5px]", children: uniqueShippingProfiles.map((profile) => {
|
|
11314
11697
|
var _a2, _b, _c, _d, _e, _f, _g;
|
|
11315
11698
|
const items = getItemsWithShippingProfile(
|
|
@@ -12001,7 +12384,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12001
12384
|
defaultValues: {
|
|
12002
12385
|
customer_id: order.customer_id || ""
|
|
12003
12386
|
},
|
|
12004
|
-
resolver: zod.zodResolver(schema$
|
|
12387
|
+
resolver: zod.zodResolver(schema$1)
|
|
12005
12388
|
});
|
|
12006
12389
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12007
12390
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12120,722 +12503,339 @@ const Illustration = () => {
|
|
|
12120
12503
|
x: "0.00428286",
|
|
12121
12504
|
y: "-0.742904",
|
|
12122
12505
|
width: "33.5",
|
|
12123
|
-
height: "65.5",
|
|
12124
|
-
rx: "6.75",
|
|
12125
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 189.756 88.438)",
|
|
12126
|
-
fill: "#D4D4D8",
|
|
12127
|
-
stroke: "#52525B",
|
|
12128
|
-
strokeWidth: "1.5"
|
|
12129
|
-
}
|
|
12130
|
-
),
|
|
12131
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12132
|
-
"rect",
|
|
12133
|
-
{
|
|
12134
|
-
x: "0.00428286",
|
|
12135
|
-
y: "-0.742904",
|
|
12136
|
-
width: "33.5",
|
|
12137
|
-
height: "65.5",
|
|
12138
|
-
rx: "6.75",
|
|
12139
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 189.756 85.4381)",
|
|
12140
|
-
fill: "white",
|
|
12141
|
-
stroke: "#52525B",
|
|
12142
|
-
strokeWidth: "1.5"
|
|
12143
|
-
}
|
|
12144
|
-
),
|
|
12145
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12146
|
-
"path",
|
|
12147
|
-
{
|
|
12148
|
-
d: "M180.579 107.142L179.126 107.959",
|
|
12149
|
-
stroke: "#52525B",
|
|
12150
|
-
strokeWidth: "1.5",
|
|
12151
|
-
strokeLinecap: "round",
|
|
12152
|
-
strokeLinejoin: "round"
|
|
12153
|
-
}
|
|
12154
|
-
),
|
|
12155
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12156
|
-
"path",
|
|
12157
|
-
{
|
|
12158
|
-
opacity: "0.88",
|
|
12159
|
-
d: "M182.305 109.546L180.257 109.534",
|
|
12160
|
-
stroke: "#52525B",
|
|
12161
|
-
strokeWidth: "1.5",
|
|
12162
|
-
strokeLinecap: "round",
|
|
12163
|
-
strokeLinejoin: "round"
|
|
12164
|
-
}
|
|
12165
|
-
),
|
|
12166
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12167
|
-
"path",
|
|
12168
|
-
{
|
|
12169
|
-
opacity: "0.75",
|
|
12170
|
-
d: "M180.551 111.93L179.108 111.096",
|
|
12171
|
-
stroke: "#52525B",
|
|
12172
|
-
strokeWidth: "1.5",
|
|
12173
|
-
strokeLinecap: "round",
|
|
12174
|
-
strokeLinejoin: "round"
|
|
12175
|
-
}
|
|
12176
|
-
),
|
|
12177
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12178
|
-
"path",
|
|
12179
|
-
{
|
|
12180
|
-
opacity: "0.63",
|
|
12181
|
-
d: "M176.347 112.897L176.354 111.73",
|
|
12182
|
-
stroke: "#52525B",
|
|
12183
|
-
strokeWidth: "1.5",
|
|
12184
|
-
strokeLinecap: "round",
|
|
12185
|
-
strokeLinejoin: "round"
|
|
12186
|
-
}
|
|
12187
|
-
),
|
|
12188
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12189
|
-
"path",
|
|
12190
|
-
{
|
|
12191
|
-
opacity: "0.5",
|
|
12192
|
-
d: "M172.153 111.881L173.606 111.064",
|
|
12193
|
-
stroke: "#52525B",
|
|
12194
|
-
strokeWidth: "1.5",
|
|
12195
|
-
strokeLinecap: "round",
|
|
12196
|
-
strokeLinejoin: "round"
|
|
12197
|
-
}
|
|
12198
|
-
),
|
|
12199
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12200
|
-
"path",
|
|
12201
|
-
{
|
|
12202
|
-
opacity: "0.38",
|
|
12203
|
-
d: "M170.428 109.478L172.476 109.489",
|
|
12204
|
-
stroke: "#52525B",
|
|
12205
|
-
strokeWidth: "1.5",
|
|
12206
|
-
strokeLinecap: "round",
|
|
12207
|
-
strokeLinejoin: "round"
|
|
12208
|
-
}
|
|
12209
|
-
),
|
|
12210
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12211
|
-
"path",
|
|
12212
|
-
{
|
|
12213
|
-
opacity: "0.25",
|
|
12214
|
-
d: "M172.181 107.094L173.624 107.928",
|
|
12215
|
-
stroke: "#52525B",
|
|
12216
|
-
strokeWidth: "1.5",
|
|
12217
|
-
strokeLinecap: "round",
|
|
12218
|
-
strokeLinejoin: "round"
|
|
12219
|
-
}
|
|
12220
|
-
),
|
|
12221
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12222
|
-
"path",
|
|
12223
|
-
{
|
|
12224
|
-
opacity: "0.13",
|
|
12225
|
-
d: "M176.386 106.126L176.379 107.294",
|
|
12226
|
-
stroke: "#52525B",
|
|
12227
|
-
strokeWidth: "1.5",
|
|
12228
|
-
strokeLinecap: "round",
|
|
12229
|
-
strokeLinejoin: "round"
|
|
12230
|
-
}
|
|
12231
|
-
),
|
|
12232
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12233
|
-
"rect",
|
|
12234
|
-
{
|
|
12235
|
-
width: "12",
|
|
12236
|
-
height: "3",
|
|
12237
|
-
rx: "1.5",
|
|
12238
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 196.447 92.2925)",
|
|
12239
|
-
fill: "#D4D4D8"
|
|
12240
|
-
}
|
|
12241
|
-
),
|
|
12242
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12243
|
-
"rect",
|
|
12244
|
-
{
|
|
12245
|
-
x: "0.00428286",
|
|
12246
|
-
y: "-0.742904",
|
|
12247
|
-
width: "33.5",
|
|
12248
|
-
height: "65.5",
|
|
12249
|
-
rx: "6.75",
|
|
12250
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 117.023 46.4147)",
|
|
12251
|
-
fill: "#D4D4D8",
|
|
12252
|
-
stroke: "#52525B",
|
|
12253
|
-
strokeWidth: "1.5"
|
|
12254
|
-
}
|
|
12255
|
-
),
|
|
12256
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12257
|
-
"rect",
|
|
12258
|
-
{
|
|
12259
|
-
x: "0.00428286",
|
|
12260
|
-
y: "-0.742904",
|
|
12261
|
-
width: "33.5",
|
|
12262
|
-
height: "65.5",
|
|
12263
|
-
rx: "6.75",
|
|
12264
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 117.023 43.4147)",
|
|
12265
|
-
fill: "white",
|
|
12266
|
-
stroke: "#52525B",
|
|
12267
|
-
strokeWidth: "1.5"
|
|
12268
|
-
}
|
|
12269
|
-
),
|
|
12270
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12271
|
-
"rect",
|
|
12272
|
-
{
|
|
12273
|
-
width: "12",
|
|
12274
|
-
height: "3",
|
|
12275
|
-
rx: "1.5",
|
|
12276
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 123.714 50.2691)",
|
|
12277
|
-
fill: "#D4D4D8"
|
|
12278
|
-
}
|
|
12279
|
-
),
|
|
12280
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12281
|
-
"rect",
|
|
12282
|
-
{
|
|
12283
|
-
width: "17",
|
|
12284
|
-
height: "3",
|
|
12285
|
-
rx: "1.5",
|
|
12286
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 97.5557 66.958)",
|
|
12287
|
-
fill: "#D4D4D8"
|
|
12288
|
-
}
|
|
12289
|
-
),
|
|
12290
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12291
|
-
"rect",
|
|
12292
|
-
{
|
|
12293
|
-
width: "12",
|
|
12294
|
-
height: "3",
|
|
12295
|
-
rx: "1.5",
|
|
12296
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 93.1978 69.4093)",
|
|
12297
|
-
fill: "#D4D4D8"
|
|
12298
|
-
}
|
|
12299
|
-
),
|
|
12300
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12301
|
-
"path",
|
|
12302
|
-
{
|
|
12303
|
-
d: "M92.3603 63.9563C90.9277 63.1286 88.59 63.1152 87.148 63.9263C85.7059 64.7374 85.6983 66.0702 87.1308 66.8979C88.5634 67.7256 90.9011 67.7391 92.3432 66.928C93.7852 66.1168 93.7929 64.784 92.3603 63.9563ZM88.4382 66.1625C87.7221 65.7488 87.726 65.0822 88.4468 64.6767C89.1676 64.2713 90.3369 64.278 91.0529 64.6917C91.769 65.1055 91.7652 65.7721 91.0444 66.1775C90.3236 66.583 89.1543 66.5762 88.4382 66.1625Z",
|
|
12304
|
-
fill: "#A1A1AA"
|
|
12305
|
-
}
|
|
12306
|
-
),
|
|
12307
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12308
|
-
"rect",
|
|
12309
|
-
{
|
|
12310
|
-
width: "17",
|
|
12311
|
-
height: "3",
|
|
12312
|
-
rx: "1.5",
|
|
12313
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 109.758 60.0944)",
|
|
12314
|
-
fill: "#A1A1AA"
|
|
12315
|
-
}
|
|
12316
|
-
),
|
|
12317
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12318
|
-
"rect",
|
|
12319
|
-
{
|
|
12320
|
-
width: "12",
|
|
12321
|
-
height: "3",
|
|
12322
|
-
rx: "1.5",
|
|
12323
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 105.4 62.5457)",
|
|
12324
|
-
fill: "#A1A1AA"
|
|
12325
|
-
}
|
|
12326
|
-
),
|
|
12327
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12328
|
-
"path",
|
|
12329
|
-
{
|
|
12330
|
-
d: "M104.562 57.0927C103.13 56.265 100.792 56.2515 99.3501 57.0626C97.9081 57.8738 97.9004 59.2065 99.333 60.0343C100.766 60.862 103.103 60.8754 104.545 60.0643C105.987 59.2532 105.995 57.9204 104.562 57.0927ZM103.858 58.8972L100.815 59.1265C100.683 59.1367 100.55 59.1134 100.449 59.063C100.44 59.0585 100.432 59.0545 100.425 59.05C100.339 59.0005 100.29 58.9336 100.291 58.8637L100.294 58.1201C100.294 57.9752 100.501 57.8585 100.756 57.86C101.01 57.8615 101.217 57.98 101.216 58.1256L101.214 58.5669L103.732 58.3769C103.984 58.3578 104.217 58.4584 104.251 58.603C104.286 58.7468 104.11 58.8788 103.858 58.8977L103.858 58.8972Z",
|
|
12331
|
-
fill: "#52525B"
|
|
12332
|
-
}
|
|
12333
|
-
),
|
|
12334
|
-
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip0_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12335
|
-
"path",
|
|
12336
|
-
{
|
|
12337
|
-
d: "M133.106 81.8022L140.49 81.8447L140.515 77.6349",
|
|
12338
|
-
stroke: "#A1A1AA",
|
|
12339
|
-
strokeWidth: "1.5",
|
|
12340
|
-
strokeLinecap: "round",
|
|
12341
|
-
strokeLinejoin: "round"
|
|
12506
|
+
height: "65.5",
|
|
12507
|
+
rx: "6.75",
|
|
12508
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 189.756 88.438)",
|
|
12509
|
+
fill: "#D4D4D8",
|
|
12510
|
+
stroke: "#52525B",
|
|
12511
|
+
strokeWidth: "1.5"
|
|
12342
12512
|
}
|
|
12343
|
-
)
|
|
12344
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12345
|
-
"
|
|
12513
|
+
),
|
|
12514
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12515
|
+
"rect",
|
|
12346
12516
|
{
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12517
|
+
x: "0.00428286",
|
|
12518
|
+
y: "-0.742904",
|
|
12519
|
+
width: "33.5",
|
|
12520
|
+
height: "65.5",
|
|
12521
|
+
rx: "6.75",
|
|
12522
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 189.756 85.4381)",
|
|
12523
|
+
fill: "white",
|
|
12524
|
+
stroke: "#52525B",
|
|
12525
|
+
strokeWidth: "1.5"
|
|
12352
12526
|
}
|
|
12353
|
-
)
|
|
12354
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12527
|
+
),
|
|
12528
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12355
12529
|
"path",
|
|
12356
12530
|
{
|
|
12357
|
-
d: "
|
|
12358
|
-
stroke: "#
|
|
12531
|
+
d: "M180.579 107.142L179.126 107.959",
|
|
12532
|
+
stroke: "#52525B",
|
|
12359
12533
|
strokeWidth: "1.5",
|
|
12360
12534
|
strokeLinecap: "round",
|
|
12361
12535
|
strokeLinejoin: "round"
|
|
12362
12536
|
}
|
|
12363
|
-
)
|
|
12364
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12537
|
+
),
|
|
12538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12365
12539
|
"path",
|
|
12366
12540
|
{
|
|
12367
|
-
|
|
12368
|
-
|
|
12541
|
+
opacity: "0.88",
|
|
12542
|
+
d: "M182.305 109.546L180.257 109.534",
|
|
12543
|
+
stroke: "#52525B",
|
|
12369
12544
|
strokeWidth: "1.5",
|
|
12370
12545
|
strokeLinecap: "round",
|
|
12371
12546
|
strokeLinejoin: "round"
|
|
12372
12547
|
}
|
|
12373
|
-
)
|
|
12374
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12548
|
+
),
|
|
12549
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12375
12550
|
"path",
|
|
12376
12551
|
{
|
|
12377
|
-
|
|
12378
|
-
|
|
12552
|
+
opacity: "0.75",
|
|
12553
|
+
d: "M180.551 111.93L179.108 111.096",
|
|
12554
|
+
stroke: "#52525B",
|
|
12379
12555
|
strokeWidth: "1.5",
|
|
12380
12556
|
strokeLinecap: "round",
|
|
12381
12557
|
strokeLinejoin: "round"
|
|
12382
12558
|
}
|
|
12383
|
-
)
|
|
12384
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12559
|
+
),
|
|
12560
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12385
12561
|
"path",
|
|
12386
12562
|
{
|
|
12387
|
-
|
|
12388
|
-
|
|
12563
|
+
opacity: "0.63",
|
|
12564
|
+
d: "M176.347 112.897L176.354 111.73",
|
|
12565
|
+
stroke: "#52525B",
|
|
12389
12566
|
strokeWidth: "1.5",
|
|
12390
12567
|
strokeLinecap: "round",
|
|
12391
12568
|
strokeLinejoin: "round"
|
|
12392
|
-
}
|
|
12393
|
-
)
|
|
12394
|
-
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
12395
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12396
|
-
"rect",
|
|
12397
|
-
{
|
|
12398
|
-
width: "12",
|
|
12399
|
-
height: "12",
|
|
12400
|
-
fill: "white",
|
|
12401
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
|
|
12402
|
-
}
|
|
12403
|
-
) }),
|
|
12404
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12405
|
-
"rect",
|
|
12406
|
-
{
|
|
12407
|
-
width: "12",
|
|
12408
|
-
height: "12",
|
|
12409
|
-
fill: "white",
|
|
12410
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
|
|
12411
|
-
}
|
|
12412
|
-
) }),
|
|
12413
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12414
|
-
"rect",
|
|
12415
|
-
{
|
|
12416
|
-
width: "12",
|
|
12417
|
-
height: "12",
|
|
12418
|
-
fill: "white",
|
|
12419
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
|
|
12420
|
-
}
|
|
12421
|
-
) }),
|
|
12422
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12423
|
-
"rect",
|
|
12424
|
-
{
|
|
12425
|
-
width: "12",
|
|
12426
|
-
height: "12",
|
|
12427
|
-
fill: "white",
|
|
12428
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
|
|
12429
|
-
}
|
|
12430
|
-
) }),
|
|
12431
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12432
|
-
"rect",
|
|
12433
|
-
{
|
|
12434
|
-
width: "12",
|
|
12435
|
-
height: "12",
|
|
12436
|
-
fill: "white",
|
|
12437
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
|
|
12438
|
-
}
|
|
12439
|
-
) }),
|
|
12440
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12441
|
-
"rect",
|
|
12442
|
-
{
|
|
12443
|
-
width: "12",
|
|
12444
|
-
height: "12",
|
|
12445
|
-
fill: "white",
|
|
12446
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
|
|
12447
|
-
}
|
|
12448
|
-
) })
|
|
12449
|
-
] })
|
|
12450
|
-
]
|
|
12451
|
-
}
|
|
12452
|
-
);
|
|
12453
|
-
};
|
|
12454
|
-
const schema$2 = objectType({
|
|
12455
|
-
customer_id: stringType().min(1)
|
|
12456
|
-
});
|
|
12457
|
-
const PROMOTION_QUERY_KEY = "promotions";
|
|
12458
|
-
const promotionsQueryKeys = {
|
|
12459
|
-
list: (query2) => [
|
|
12460
|
-
PROMOTION_QUERY_KEY,
|
|
12461
|
-
query2 ? query2 : void 0
|
|
12462
|
-
],
|
|
12463
|
-
detail: (id, query2) => [
|
|
12464
|
-
PROMOTION_QUERY_KEY,
|
|
12465
|
-
id,
|
|
12466
|
-
query2 ? query2 : void 0
|
|
12467
|
-
]
|
|
12468
|
-
};
|
|
12469
|
-
const usePromotions = (query2, options) => {
|
|
12470
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
12471
|
-
queryKey: promotionsQueryKeys.list(query2),
|
|
12472
|
-
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
12473
|
-
...options
|
|
12474
|
-
});
|
|
12475
|
-
return { ...data, ...rest };
|
|
12476
|
-
};
|
|
12477
|
-
const Promotions = () => {
|
|
12478
|
-
const { id } = reactRouterDom.useParams();
|
|
12479
|
-
const {
|
|
12480
|
-
order: preview,
|
|
12481
|
-
isError: isPreviewError,
|
|
12482
|
-
error: previewError
|
|
12483
|
-
} = useOrderPreview(id, void 0);
|
|
12484
|
-
useInitiateOrderEdit({ preview });
|
|
12485
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
12486
|
-
if (isPreviewError) {
|
|
12487
|
-
throw previewError;
|
|
12488
|
-
}
|
|
12489
|
-
const isReady = !!preview;
|
|
12490
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
12491
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Promotions" }) }) }),
|
|
12492
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(PromotionForm, { preview })
|
|
12493
|
-
] });
|
|
12494
|
-
};
|
|
12495
|
-
const PromotionForm = ({ preview }) => {
|
|
12496
|
-
const { items, shipping_methods } = preview;
|
|
12497
|
-
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
12498
|
-
const [comboboxValue, setComboboxValue] = React.useState("");
|
|
12499
|
-
const { handleSuccess } = useRouteModal();
|
|
12500
|
-
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
12501
|
-
const promoIds = getPromotionIds(items, shipping_methods);
|
|
12502
|
-
const { promotions, isPending, isError, error } = usePromotions(
|
|
12503
|
-
{
|
|
12504
|
-
id: promoIds
|
|
12505
|
-
},
|
|
12506
|
-
{
|
|
12507
|
-
enabled: !!promoIds.length
|
|
12508
|
-
}
|
|
12509
|
-
);
|
|
12510
|
-
const comboboxData = useComboboxData({
|
|
12511
|
-
queryKey: ["promotions", "combobox", promoIds],
|
|
12512
|
-
queryFn: async (params) => {
|
|
12513
|
-
return await sdk.admin.promotion.list({
|
|
12514
|
-
...params,
|
|
12515
|
-
id: {
|
|
12516
|
-
$nin: promoIds
|
|
12517
|
-
}
|
|
12518
|
-
});
|
|
12519
|
-
},
|
|
12520
|
-
getOptions: (data) => {
|
|
12521
|
-
return data.promotions.map((promotion) => ({
|
|
12522
|
-
label: promotion.code,
|
|
12523
|
-
value: promotion.code
|
|
12524
|
-
}));
|
|
12525
|
-
}
|
|
12526
|
-
});
|
|
12527
|
-
const add = async (value) => {
|
|
12528
|
-
if (!value) {
|
|
12529
|
-
return;
|
|
12530
|
-
}
|
|
12531
|
-
addPromotions(
|
|
12532
|
-
{
|
|
12533
|
-
promo_codes: [value]
|
|
12534
|
-
},
|
|
12535
|
-
{
|
|
12536
|
-
onError: (e) => {
|
|
12537
|
-
ui.toast.error(e.message);
|
|
12538
|
-
comboboxData.onSearchValueChange("");
|
|
12539
|
-
setComboboxValue("");
|
|
12540
|
-
},
|
|
12541
|
-
onSuccess: () => {
|
|
12542
|
-
comboboxData.onSearchValueChange("");
|
|
12543
|
-
setComboboxValue("");
|
|
12544
|
-
}
|
|
12545
|
-
}
|
|
12546
|
-
);
|
|
12547
|
-
};
|
|
12548
|
-
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
12549
|
-
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
12550
|
-
const onSubmit = async () => {
|
|
12551
|
-
setIsSubmitting(true);
|
|
12552
|
-
let requestSucceeded = false;
|
|
12553
|
-
await requestOrderEdit(void 0, {
|
|
12554
|
-
onError: (e) => {
|
|
12555
|
-
ui.toast.error(e.message);
|
|
12556
|
-
},
|
|
12557
|
-
onSuccess: () => {
|
|
12558
|
-
requestSucceeded = true;
|
|
12559
|
-
}
|
|
12560
|
-
});
|
|
12561
|
-
if (!requestSucceeded) {
|
|
12562
|
-
setIsSubmitting(false);
|
|
12563
|
-
return;
|
|
12564
|
-
}
|
|
12565
|
-
await confirmOrderEdit(void 0, {
|
|
12566
|
-
onError: (e) => {
|
|
12567
|
-
ui.toast.error(e.message);
|
|
12568
|
-
},
|
|
12569
|
-
onSuccess: () => {
|
|
12570
|
-
handleSuccess();
|
|
12571
|
-
},
|
|
12572
|
-
onSettled: () => {
|
|
12573
|
-
setIsSubmitting(false);
|
|
12574
|
-
}
|
|
12575
|
-
});
|
|
12576
|
-
};
|
|
12577
|
-
if (isError) {
|
|
12578
|
-
throw error;
|
|
12579
|
-
}
|
|
12580
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
12581
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
12582
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
12583
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
12584
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
12585
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
12586
|
-
] }),
|
|
12569
|
+
}
|
|
12570
|
+
),
|
|
12587
12571
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12588
|
-
|
|
12572
|
+
"path",
|
|
12589
12573
|
{
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
|
|
12596
|
-
searchValue: comboboxData.searchValue,
|
|
12597
|
-
disabled: comboboxData.disabled || isAddingPromotions,
|
|
12598
|
-
onChange: add,
|
|
12599
|
-
value: comboboxValue
|
|
12574
|
+
opacity: "0.5",
|
|
12575
|
+
d: "M172.153 111.881L173.606 111.064",
|
|
12576
|
+
stroke: "#52525B",
|
|
12577
|
+
strokeWidth: "1.5",
|
|
12578
|
+
strokeLinecap: "round",
|
|
12579
|
+
strokeLinejoin: "round"
|
|
12600
12580
|
}
|
|
12601
|
-
)
|
|
12602
|
-
] }),
|
|
12603
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
12604
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12605
|
-
PromotionItem,
|
|
12606
|
-
{
|
|
12607
|
-
promotion,
|
|
12608
|
-
orderId: preview.id,
|
|
12609
|
-
isLoading: isPending
|
|
12610
|
-
},
|
|
12611
|
-
promotion.id
|
|
12612
|
-
)) })
|
|
12613
|
-
] }) }),
|
|
12614
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12615
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12616
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12617
|
-
ui.Button,
|
|
12618
|
-
{
|
|
12619
|
-
size: "small",
|
|
12620
|
-
type: "submit",
|
|
12621
|
-
isLoading: isSubmitting || isAddingPromotions,
|
|
12622
|
-
children: "Save"
|
|
12623
|
-
}
|
|
12624
|
-
)
|
|
12625
|
-
] }) })
|
|
12626
|
-
] });
|
|
12627
|
-
};
|
|
12628
|
-
const PromotionItem = ({
|
|
12629
|
-
promotion,
|
|
12630
|
-
orderId,
|
|
12631
|
-
isLoading
|
|
12632
|
-
}) => {
|
|
12633
|
-
var _a;
|
|
12634
|
-
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
12635
|
-
const onRemove = async () => {
|
|
12636
|
-
removePromotions(
|
|
12637
|
-
{
|
|
12638
|
-
promo_codes: [promotion.code]
|
|
12639
|
-
},
|
|
12640
|
-
{
|
|
12641
|
-
onError: (e) => {
|
|
12642
|
-
ui.toast.error(e.message);
|
|
12643
|
-
}
|
|
12644
|
-
}
|
|
12645
|
-
);
|
|
12646
|
-
};
|
|
12647
|
-
const displayValue = getDisplayValue(promotion);
|
|
12648
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12649
|
-
"div",
|
|
12650
|
-
{
|
|
12651
|
-
className: ui.clx(
|
|
12652
|
-
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
12653
|
-
{
|
|
12654
|
-
"animate-pulse": isLoading
|
|
12655
|
-
}
|
|
12656
|
-
),
|
|
12657
|
-
children: [
|
|
12658
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
12659
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
12660
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
12661
|
-
displayValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
12662
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: displayValue }),
|
|
12663
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "·" })
|
|
12664
|
-
] }),
|
|
12665
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
12666
|
-
] })
|
|
12667
|
-
] }),
|
|
12581
|
+
),
|
|
12668
12582
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12669
|
-
|
|
12583
|
+
"path",
|
|
12584
|
+
{
|
|
12585
|
+
opacity: "0.38",
|
|
12586
|
+
d: "M170.428 109.478L172.476 109.489",
|
|
12587
|
+
stroke: "#52525B",
|
|
12588
|
+
strokeWidth: "1.5",
|
|
12589
|
+
strokeLinecap: "round",
|
|
12590
|
+
strokeLinejoin: "round"
|
|
12591
|
+
}
|
|
12592
|
+
),
|
|
12593
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12594
|
+
"path",
|
|
12595
|
+
{
|
|
12596
|
+
opacity: "0.25",
|
|
12597
|
+
d: "M172.181 107.094L173.624 107.928",
|
|
12598
|
+
stroke: "#52525B",
|
|
12599
|
+
strokeWidth: "1.5",
|
|
12600
|
+
strokeLinecap: "round",
|
|
12601
|
+
strokeLinejoin: "round"
|
|
12602
|
+
}
|
|
12603
|
+
),
|
|
12604
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12605
|
+
"path",
|
|
12606
|
+
{
|
|
12607
|
+
opacity: "0.13",
|
|
12608
|
+
d: "M176.386 106.126L176.379 107.294",
|
|
12609
|
+
stroke: "#52525B",
|
|
12610
|
+
strokeWidth: "1.5",
|
|
12611
|
+
strokeLinecap: "round",
|
|
12612
|
+
strokeLinejoin: "round"
|
|
12613
|
+
}
|
|
12614
|
+
),
|
|
12615
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12616
|
+
"rect",
|
|
12617
|
+
{
|
|
12618
|
+
width: "12",
|
|
12619
|
+
height: "3",
|
|
12620
|
+
rx: "1.5",
|
|
12621
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 196.447 92.2925)",
|
|
12622
|
+
fill: "#D4D4D8"
|
|
12623
|
+
}
|
|
12624
|
+
),
|
|
12625
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12626
|
+
"rect",
|
|
12627
|
+
{
|
|
12628
|
+
x: "0.00428286",
|
|
12629
|
+
y: "-0.742904",
|
|
12630
|
+
width: "33.5",
|
|
12631
|
+
height: "65.5",
|
|
12632
|
+
rx: "6.75",
|
|
12633
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 117.023 46.4147)",
|
|
12634
|
+
fill: "#D4D4D8",
|
|
12635
|
+
stroke: "#52525B",
|
|
12636
|
+
strokeWidth: "1.5"
|
|
12637
|
+
}
|
|
12638
|
+
),
|
|
12639
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12640
|
+
"rect",
|
|
12641
|
+
{
|
|
12642
|
+
x: "0.00428286",
|
|
12643
|
+
y: "-0.742904",
|
|
12644
|
+
width: "33.5",
|
|
12645
|
+
height: "65.5",
|
|
12646
|
+
rx: "6.75",
|
|
12647
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 117.023 43.4147)",
|
|
12648
|
+
fill: "white",
|
|
12649
|
+
stroke: "#52525B",
|
|
12650
|
+
strokeWidth: "1.5"
|
|
12651
|
+
}
|
|
12652
|
+
),
|
|
12653
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12654
|
+
"rect",
|
|
12655
|
+
{
|
|
12656
|
+
width: "12",
|
|
12657
|
+
height: "3",
|
|
12658
|
+
rx: "1.5",
|
|
12659
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 123.714 50.2691)",
|
|
12660
|
+
fill: "#D4D4D8"
|
|
12661
|
+
}
|
|
12662
|
+
),
|
|
12663
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12664
|
+
"rect",
|
|
12665
|
+
{
|
|
12666
|
+
width: "17",
|
|
12667
|
+
height: "3",
|
|
12668
|
+
rx: "1.5",
|
|
12669
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 97.5557 66.958)",
|
|
12670
|
+
fill: "#D4D4D8"
|
|
12671
|
+
}
|
|
12672
|
+
),
|
|
12673
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12674
|
+
"rect",
|
|
12675
|
+
{
|
|
12676
|
+
width: "12",
|
|
12677
|
+
height: "3",
|
|
12678
|
+
rx: "1.5",
|
|
12679
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 93.1978 69.4093)",
|
|
12680
|
+
fill: "#D4D4D8"
|
|
12681
|
+
}
|
|
12682
|
+
),
|
|
12683
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12684
|
+
"path",
|
|
12685
|
+
{
|
|
12686
|
+
d: "M92.3603 63.9563C90.9277 63.1286 88.59 63.1152 87.148 63.9263C85.7059 64.7374 85.6983 66.0702 87.1308 66.8979C88.5634 67.7256 90.9011 67.7391 92.3432 66.928C93.7852 66.1168 93.7929 64.784 92.3603 63.9563ZM88.4382 66.1625C87.7221 65.7488 87.726 65.0822 88.4468 64.6767C89.1676 64.2713 90.3369 64.278 91.0529 64.6917C91.769 65.1055 91.7652 65.7721 91.0444 66.1775C90.3236 66.583 89.1543 66.5762 88.4382 66.1625Z",
|
|
12687
|
+
fill: "#A1A1AA"
|
|
12688
|
+
}
|
|
12689
|
+
),
|
|
12690
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12691
|
+
"rect",
|
|
12692
|
+
{
|
|
12693
|
+
width: "17",
|
|
12694
|
+
height: "3",
|
|
12695
|
+
rx: "1.5",
|
|
12696
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 109.758 60.0944)",
|
|
12697
|
+
fill: "#A1A1AA"
|
|
12698
|
+
}
|
|
12699
|
+
),
|
|
12700
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12701
|
+
"rect",
|
|
12702
|
+
{
|
|
12703
|
+
width: "12",
|
|
12704
|
+
height: "3",
|
|
12705
|
+
rx: "1.5",
|
|
12706
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 105.4 62.5457)",
|
|
12707
|
+
fill: "#A1A1AA"
|
|
12708
|
+
}
|
|
12709
|
+
),
|
|
12710
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12711
|
+
"path",
|
|
12712
|
+
{
|
|
12713
|
+
d: "M104.562 57.0927C103.13 56.265 100.792 56.2515 99.3501 57.0626C97.9081 57.8738 97.9004 59.2065 99.333 60.0343C100.766 60.862 103.103 60.8754 104.545 60.0643C105.987 59.2532 105.995 57.9204 104.562 57.0927ZM103.858 58.8972L100.815 59.1265C100.683 59.1367 100.55 59.1134 100.449 59.063C100.44 59.0585 100.432 59.0545 100.425 59.05C100.339 59.0005 100.29 58.9336 100.291 58.8637L100.294 58.1201C100.294 57.9752 100.501 57.8585 100.756 57.86C101.01 57.8615 101.217 57.98 101.216 58.1256L101.214 58.5669L103.732 58.3769C103.984 58.3578 104.217 58.4584 104.251 58.603C104.286 58.7468 104.11 58.8788 103.858 58.8977L103.858 58.8972Z",
|
|
12714
|
+
fill: "#52525B"
|
|
12715
|
+
}
|
|
12716
|
+
),
|
|
12717
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip0_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12718
|
+
"path",
|
|
12719
|
+
{
|
|
12720
|
+
d: "M133.106 81.8022L140.49 81.8447L140.515 77.6349",
|
|
12721
|
+
stroke: "#A1A1AA",
|
|
12722
|
+
strokeWidth: "1.5",
|
|
12723
|
+
strokeLinecap: "round",
|
|
12724
|
+
strokeLinejoin: "round"
|
|
12725
|
+
}
|
|
12726
|
+
) }),
|
|
12727
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip1_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12728
|
+
"path",
|
|
12729
|
+
{
|
|
12730
|
+
d: "M143.496 87.8055L150.881 87.8481L150.905 83.6383",
|
|
12731
|
+
stroke: "#A1A1AA",
|
|
12732
|
+
strokeWidth: "1.5",
|
|
12733
|
+
strokeLinecap: "round",
|
|
12734
|
+
strokeLinejoin: "round"
|
|
12735
|
+
}
|
|
12736
|
+
) }),
|
|
12737
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip2_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12738
|
+
"path",
|
|
12739
|
+
{
|
|
12740
|
+
d: "M153.887 93.8088L161.271 93.8514L161.295 89.6416",
|
|
12741
|
+
stroke: "#A1A1AA",
|
|
12742
|
+
strokeWidth: "1.5",
|
|
12743
|
+
strokeLinecap: "round",
|
|
12744
|
+
strokeLinejoin: "round"
|
|
12745
|
+
}
|
|
12746
|
+
) }),
|
|
12747
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip3_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12748
|
+
"path",
|
|
12749
|
+
{
|
|
12750
|
+
d: "M126.114 89.1912L118.729 89.1486L118.705 93.3584",
|
|
12751
|
+
stroke: "#A1A1AA",
|
|
12752
|
+
strokeWidth: "1.5",
|
|
12753
|
+
strokeLinecap: "round",
|
|
12754
|
+
strokeLinejoin: "round"
|
|
12755
|
+
}
|
|
12756
|
+
) }),
|
|
12757
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip4_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12758
|
+
"path",
|
|
12670
12759
|
{
|
|
12671
|
-
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XMark, {})
|
|
12760
|
+
d: "M136.504 95.1945L129.12 95.1519L129.095 99.3617",
|
|
12761
|
+
stroke: "#A1A1AA",
|
|
12762
|
+
strokeWidth: "1.5",
|
|
12763
|
+
strokeLinecap: "round",
|
|
12764
|
+
strokeLinejoin: "round"
|
|
12677
12765
|
}
|
|
12678
|
-
)
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
|
|
12686
|
-
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
if (!currency) {
|
|
12693
|
-
return null;
|
|
12694
|
-
}
|
|
12695
|
-
return getLocaleAmount(value, currency);
|
|
12696
|
-
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
12697
|
-
return formatPercentage(value);
|
|
12698
|
-
}
|
|
12699
|
-
return null;
|
|
12700
|
-
}
|
|
12701
|
-
const formatter = new Intl.NumberFormat([], {
|
|
12702
|
-
style: "percent",
|
|
12703
|
-
minimumFractionDigits: 2
|
|
12704
|
-
});
|
|
12705
|
-
const formatPercentage = (value, isPercentageValue = false) => {
|
|
12706
|
-
let val = value || 0;
|
|
12707
|
-
if (!isPercentageValue) {
|
|
12708
|
-
val = val / 100;
|
|
12709
|
-
}
|
|
12710
|
-
return formatter.format(val);
|
|
12711
|
-
};
|
|
12712
|
-
function getPromotionIds(items, shippingMethods) {
|
|
12713
|
-
const promotionIds = /* @__PURE__ */ new Set();
|
|
12714
|
-
for (const item of items) {
|
|
12715
|
-
if (item.adjustments) {
|
|
12716
|
-
for (const adjustment of item.adjustments) {
|
|
12717
|
-
if (adjustment.promotion_id) {
|
|
12718
|
-
promotionIds.add(adjustment.promotion_id);
|
|
12719
|
-
}
|
|
12720
|
-
}
|
|
12721
|
-
}
|
|
12722
|
-
}
|
|
12723
|
-
for (const shippingMethod of shippingMethods) {
|
|
12724
|
-
if (shippingMethod.adjustments) {
|
|
12725
|
-
for (const adjustment of shippingMethod.adjustments) {
|
|
12726
|
-
if (adjustment.promotion_id) {
|
|
12727
|
-
promotionIds.add(adjustment.promotion_id);
|
|
12728
|
-
}
|
|
12729
|
-
}
|
|
12730
|
-
}
|
|
12731
|
-
}
|
|
12732
|
-
return Array.from(promotionIds);
|
|
12733
|
-
}
|
|
12734
|
-
const SalesChannel = () => {
|
|
12735
|
-
const { id } = reactRouterDom.useParams();
|
|
12736
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12737
|
-
id,
|
|
12738
|
-
{
|
|
12739
|
-
fields: "+sales_channel_id"
|
|
12740
|
-
},
|
|
12741
|
-
{
|
|
12742
|
-
enabled: !!id
|
|
12743
|
-
}
|
|
12744
|
-
);
|
|
12745
|
-
if (isError) {
|
|
12746
|
-
throw error;
|
|
12747
|
-
}
|
|
12748
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12749
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12750
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12751
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12752
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12753
|
-
] }),
|
|
12754
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12755
|
-
] });
|
|
12756
|
-
};
|
|
12757
|
-
const SalesChannelForm = ({ order }) => {
|
|
12758
|
-
const form = reactHookForm.useForm({
|
|
12759
|
-
defaultValues: {
|
|
12760
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12761
|
-
},
|
|
12762
|
-
resolver: zod.zodResolver(schema$1)
|
|
12763
|
-
});
|
|
12764
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12765
|
-
const { handleSuccess } = useRouteModal();
|
|
12766
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12767
|
-
await mutateAsync(
|
|
12768
|
-
{
|
|
12769
|
-
sales_channel_id: data.sales_channel_id
|
|
12770
|
-
},
|
|
12771
|
-
{
|
|
12772
|
-
onSuccess: () => {
|
|
12773
|
-
ui.toast.success("Sales channel updated");
|
|
12774
|
-
handleSuccess();
|
|
12775
|
-
},
|
|
12776
|
-
onError: (error) => {
|
|
12777
|
-
ui.toast.error(error.message);
|
|
12778
|
-
}
|
|
12779
|
-
}
|
|
12780
|
-
);
|
|
12781
|
-
});
|
|
12782
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12783
|
-
KeyboundForm,
|
|
12784
|
-
{
|
|
12785
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12786
|
-
onSubmit,
|
|
12787
|
-
children: [
|
|
12788
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12789
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12790
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12791
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12792
|
-
] }) })
|
|
12793
|
-
]
|
|
12794
|
-
}
|
|
12795
|
-
) });
|
|
12796
|
-
};
|
|
12797
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12798
|
-
const salesChannels = useComboboxData({
|
|
12799
|
-
queryFn: async (params) => {
|
|
12800
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12801
|
-
},
|
|
12802
|
-
queryKey: ["sales-channels"],
|
|
12803
|
-
getOptions: (data) => {
|
|
12804
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12805
|
-
label: salesChannel.name,
|
|
12806
|
-
value: salesChannel.id
|
|
12807
|
-
}));
|
|
12808
|
-
},
|
|
12809
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12810
|
-
});
|
|
12811
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12812
|
-
Form$2.Field,
|
|
12813
|
-
{
|
|
12814
|
-
control,
|
|
12815
|
-
name: "sales_channel_id",
|
|
12816
|
-
render: ({ field }) => {
|
|
12817
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12818
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12819
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12820
|
-
Combobox,
|
|
12766
|
+
) }),
|
|
12767
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12768
|
+
"path",
|
|
12769
|
+
{
|
|
12770
|
+
d: "M146.894 101.198L139.51 101.155L139.486 105.365",
|
|
12771
|
+
stroke: "#A1A1AA",
|
|
12772
|
+
strokeWidth: "1.5",
|
|
12773
|
+
strokeLinecap: "round",
|
|
12774
|
+
strokeLinejoin: "round"
|
|
12775
|
+
}
|
|
12776
|
+
) }),
|
|
12777
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
12778
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12779
|
+
"rect",
|
|
12821
12780
|
{
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12827
|
-
placeholder: "Select sales channel",
|
|
12828
|
-
...field
|
|
12781
|
+
width: "12",
|
|
12782
|
+
height: "12",
|
|
12783
|
+
fill: "white",
|
|
12784
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
|
|
12829
12785
|
}
|
|
12830
12786
|
) }),
|
|
12831
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12832
|
-
|
|
12833
|
-
|
|
12787
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12788
|
+
"rect",
|
|
12789
|
+
{
|
|
12790
|
+
width: "12",
|
|
12791
|
+
height: "12",
|
|
12792
|
+
fill: "white",
|
|
12793
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
|
|
12794
|
+
}
|
|
12795
|
+
) }),
|
|
12796
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12797
|
+
"rect",
|
|
12798
|
+
{
|
|
12799
|
+
width: "12",
|
|
12800
|
+
height: "12",
|
|
12801
|
+
fill: "white",
|
|
12802
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
|
|
12803
|
+
}
|
|
12804
|
+
) }),
|
|
12805
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12806
|
+
"rect",
|
|
12807
|
+
{
|
|
12808
|
+
width: "12",
|
|
12809
|
+
height: "12",
|
|
12810
|
+
fill: "white",
|
|
12811
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
|
|
12812
|
+
}
|
|
12813
|
+
) }),
|
|
12814
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12815
|
+
"rect",
|
|
12816
|
+
{
|
|
12817
|
+
width: "12",
|
|
12818
|
+
height: "12",
|
|
12819
|
+
fill: "white",
|
|
12820
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
|
|
12821
|
+
}
|
|
12822
|
+
) }),
|
|
12823
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12824
|
+
"rect",
|
|
12825
|
+
{
|
|
12826
|
+
width: "12",
|
|
12827
|
+
height: "12",
|
|
12828
|
+
fill: "white",
|
|
12829
|
+
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
|
|
12830
|
+
}
|
|
12831
|
+
) })
|
|
12832
|
+
] })
|
|
12833
|
+
]
|
|
12834
12834
|
}
|
|
12835
12835
|
);
|
|
12836
12836
|
};
|
|
12837
12837
|
const schema$1 = objectType({
|
|
12838
|
-
|
|
12838
|
+
customer_id: stringType().min(1)
|
|
12839
12839
|
});
|
|
12840
12840
|
const ShippingAddress = () => {
|
|
12841
12841
|
const { id } = reactRouterDom.useParams();
|
|
@@ -13080,14 +13080,6 @@ const routeModule = {
|
|
|
13080
13080
|
Component: Metadata,
|
|
13081
13081
|
path: "/draft-orders/:id/metadata"
|
|
13082
13082
|
},
|
|
13083
|
-
{
|
|
13084
|
-
Component: Shipping,
|
|
13085
|
-
path: "/draft-orders/:id/shipping"
|
|
13086
|
-
},
|
|
13087
|
-
{
|
|
13088
|
-
Component: TransferOwnership,
|
|
13089
|
-
path: "/draft-orders/:id/transfer-ownership"
|
|
13090
|
-
},
|
|
13091
13083
|
{
|
|
13092
13084
|
Component: Promotions,
|
|
13093
13085
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13096,6 +13088,14 @@ const routeModule = {
|
|
|
13096
13088
|
Component: SalesChannel,
|
|
13097
13089
|
path: "/draft-orders/:id/sales-channel"
|
|
13098
13090
|
},
|
|
13091
|
+
{
|
|
13092
|
+
Component: Shipping,
|
|
13093
|
+
path: "/draft-orders/:id/shipping"
|
|
13094
|
+
},
|
|
13095
|
+
{
|
|
13096
|
+
Component: TransferOwnership,
|
|
13097
|
+
path: "/draft-orders/:id/transfer-ownership"
|
|
13098
|
+
},
|
|
13099
13099
|
{
|
|
13100
13100
|
Component: ShippingAddress,
|
|
13101
13101
|
path: "/draft-orders/:id/shipping-address"
|