@medusajs/draft-order 2.10.0-snapshot-20250825072447 → 2.10.0-snapshot-20250826181741
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.
|
@@ -7875,6 +7875,13 @@ const AddressField = ({ type, control, setValue }) => {
|
|
|
7875
7875
|
const customerId = reactHookForm.useWatch({ control, name: "customer_id" });
|
|
7876
7876
|
const addressId = reactHookForm.useWatch({ control, name: `${type}_id` });
|
|
7877
7877
|
const sameAsShipping = reactHookForm.useWatch({ control, name: "same_as_shipping" });
|
|
7878
|
+
const { customer } = useCustomer(
|
|
7879
|
+
customerId,
|
|
7880
|
+
{},
|
|
7881
|
+
{
|
|
7882
|
+
enabled: !!customerId
|
|
7883
|
+
}
|
|
7884
|
+
);
|
|
7878
7885
|
const addresses = useComboboxData({
|
|
7879
7886
|
queryFn: async (params) => {
|
|
7880
7887
|
const response = await sdk.client.fetch(
|
|
@@ -7914,7 +7921,11 @@ const AddressField = ({ type, control, setValue }) => {
|
|
|
7914
7921
|
}
|
|
7915
7922
|
);
|
|
7916
7923
|
const address = response.address;
|
|
7917
|
-
setValue(type, {
|
|
7924
|
+
setValue(type, {
|
|
7925
|
+
...address,
|
|
7926
|
+
first_name: address.first_name || (customer == null ? void 0 : customer.first_name),
|
|
7927
|
+
last_name: address.last_name || (customer == null ? void 0 : customer.last_name)
|
|
7928
|
+
});
|
|
7918
7929
|
};
|
|
7919
7930
|
const showFields = type === "billing_address" ? !sameAsShipping : true;
|
|
7920
7931
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
@@ -9301,6 +9312,7 @@ const getStylizedAmount = (amount, currencyCode) => {
|
|
|
9301
9312
|
};
|
|
9302
9313
|
const SummarySection = ({ order }) => {
|
|
9303
9314
|
var _a;
|
|
9315
|
+
const promotions = order.promotions || [];
|
|
9304
9316
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0 overflow-hidden", children: [
|
|
9305
9317
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 py-4 flex items-center justify-between gap-x-4", children: [
|
|
9306
9318
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Summary" }),
|
|
@@ -9348,7 +9360,7 @@ const SummarySection = ({ order }) => {
|
|
|
9348
9360
|
total: order.total,
|
|
9349
9361
|
shippingSubtotal: order.shipping_subtotal,
|
|
9350
9362
|
discountTotal: order.discount_total,
|
|
9351
|
-
promotions
|
|
9363
|
+
promotions,
|
|
9352
9364
|
taxTotal: order.tax_total,
|
|
9353
9365
|
itemSubTotal: order.item_subtotal,
|
|
9354
9366
|
itemCount: ((_a = order.items) == null ? void 0 : _a.reduce((acc, item) => acc + item.quantity, 0)) || 0
|
|
@@ -9402,7 +9414,6 @@ const Total = ({
|
|
|
9402
9414
|
itemSubTotal,
|
|
9403
9415
|
itemCount
|
|
9404
9416
|
}) => {
|
|
9405
|
-
var _a;
|
|
9406
9417
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-6 py-4 gap-y-2", children: [
|
|
9407
9418
|
itemCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-3 items-center justify-between gap-x-4 text-ui-fg-subtle", children: [
|
|
9408
9419
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "Subtotal" }),
|
|
@@ -9424,7 +9435,7 @@ const Total = ({
|
|
|
9424
9435
|
),
|
|
9425
9436
|
children: [
|
|
9426
9437
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "Discount" }),
|
|
9427
|
-
|
|
9438
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end gap-x-2", children: promotions.map((promotion) => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/promotions/${promotion.id}`, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: promotion.code }) }, promotion.id)) }),
|
|
9428
9439
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: getLocaleAmount(discountTotal, currencyCode) }) })
|
|
9429
9440
|
]
|
|
9430
9441
|
}
|
|
@@ -7869,6 +7869,13 @@ const AddressField = ({ type, control, setValue }) => {
|
|
|
7869
7869
|
const customerId = useWatch({ control, name: "customer_id" });
|
|
7870
7870
|
const addressId = useWatch({ control, name: `${type}_id` });
|
|
7871
7871
|
const sameAsShipping = useWatch({ control, name: "same_as_shipping" });
|
|
7872
|
+
const { customer } = useCustomer(
|
|
7873
|
+
customerId,
|
|
7874
|
+
{},
|
|
7875
|
+
{
|
|
7876
|
+
enabled: !!customerId
|
|
7877
|
+
}
|
|
7878
|
+
);
|
|
7872
7879
|
const addresses = useComboboxData({
|
|
7873
7880
|
queryFn: async (params) => {
|
|
7874
7881
|
const response = await sdk.client.fetch(
|
|
@@ -7908,7 +7915,11 @@ const AddressField = ({ type, control, setValue }) => {
|
|
|
7908
7915
|
}
|
|
7909
7916
|
);
|
|
7910
7917
|
const address = response.address;
|
|
7911
|
-
setValue(type, {
|
|
7918
|
+
setValue(type, {
|
|
7919
|
+
...address,
|
|
7920
|
+
first_name: address.first_name || (customer == null ? void 0 : customer.first_name),
|
|
7921
|
+
last_name: address.last_name || (customer == null ? void 0 : customer.last_name)
|
|
7922
|
+
});
|
|
7912
7923
|
};
|
|
7913
7924
|
const showFields = type === "billing_address" ? !sameAsShipping : true;
|
|
7914
7925
|
return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
@@ -9295,6 +9306,7 @@ const getStylizedAmount = (amount, currencyCode) => {
|
|
|
9295
9306
|
};
|
|
9296
9307
|
const SummarySection = ({ order }) => {
|
|
9297
9308
|
var _a;
|
|
9309
|
+
const promotions = order.promotions || [];
|
|
9298
9310
|
return /* @__PURE__ */ jsxs(Container, { className: "p-0 overflow-hidden", children: [
|
|
9299
9311
|
/* @__PURE__ */ jsxs("div", { className: "px-6 py-4 flex items-center justify-between gap-x-4", children: [
|
|
9300
9312
|
/* @__PURE__ */ jsx(Heading, { children: "Summary" }),
|
|
@@ -9342,7 +9354,7 @@ const SummarySection = ({ order }) => {
|
|
|
9342
9354
|
total: order.total,
|
|
9343
9355
|
shippingSubtotal: order.shipping_subtotal,
|
|
9344
9356
|
discountTotal: order.discount_total,
|
|
9345
|
-
promotions
|
|
9357
|
+
promotions,
|
|
9346
9358
|
taxTotal: order.tax_total,
|
|
9347
9359
|
itemSubTotal: order.item_subtotal,
|
|
9348
9360
|
itemCount: ((_a = order.items) == null ? void 0 : _a.reduce((acc, item) => acc + item.quantity, 0)) || 0
|
|
@@ -9396,7 +9408,6 @@ const Total = ({
|
|
|
9396
9408
|
itemSubTotal,
|
|
9397
9409
|
itemCount
|
|
9398
9410
|
}) => {
|
|
9399
|
-
var _a;
|
|
9400
9411
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-6 py-4 gap-y-2", children: [
|
|
9401
9412
|
itemCount > 0 && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 items-center justify-between gap-x-4 text-ui-fg-subtle", children: [
|
|
9402
9413
|
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "Subtotal" }),
|
|
@@ -9418,7 +9429,7 @@ const Total = ({
|
|
|
9418
9429
|
),
|
|
9419
9430
|
children: [
|
|
9420
9431
|
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "Discount" }),
|
|
9421
|
-
|
|
9432
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-end gap-x-2", children: promotions.map((promotion) => /* @__PURE__ */ jsx(Link, { to: `/promotions/${promotion.id}`, children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: promotion.code }) }, promotion.id)) }),
|
|
9422
9433
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: getLocaleAmount(discountTotal, currencyCode) }) })
|
|
9423
9434
|
]
|
|
9424
9435
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.0-snapshot-
|
|
3
|
+
"version": "2.10.0-snapshot-20250826181741",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,13 +27,10 @@
|
|
|
27
27
|
"medusa-plugin",
|
|
28
28
|
"medusa-v2"
|
|
29
29
|
],
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"access": "restricted"
|
|
32
|
-
},
|
|
33
30
|
"dependencies": {
|
|
34
31
|
"@ariakit/react": "^0.4.15",
|
|
35
32
|
"@hookform/resolvers": "3.4.2",
|
|
36
|
-
"@medusajs/js-sdk": "2.10.0-snapshot-
|
|
33
|
+
"@medusajs/js-sdk": "2.10.0-snapshot-20250826181741",
|
|
37
34
|
"@tanstack/react-query": "5.64.2",
|
|
38
35
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
39
36
|
"date-fns": "^3.6.0",
|
|
@@ -42,15 +39,15 @@
|
|
|
42
39
|
"react-hook-form": "7.49.1"
|
|
43
40
|
},
|
|
44
41
|
"devDependencies": {
|
|
45
|
-
"@medusajs/admin-sdk": "2.10.0-snapshot-
|
|
46
|
-
"@medusajs/cli": "2.10.0-snapshot-
|
|
47
|
-
"@medusajs/framework": "2.10.0-snapshot-
|
|
48
|
-
"@medusajs/icons": "2.10.0-snapshot-
|
|
49
|
-
"@medusajs/medusa": "2.10.0-snapshot-
|
|
50
|
-
"@medusajs/test-utils": "2.10.0-snapshot-
|
|
51
|
-
"@medusajs/types": "2.10.0-snapshot-
|
|
52
|
-
"@medusajs/ui": "4.0.20-snapshot-
|
|
53
|
-
"@medusajs/ui-preset": "2.10.0-snapshot-
|
|
42
|
+
"@medusajs/admin-sdk": "2.10.0-snapshot-20250826181741",
|
|
43
|
+
"@medusajs/cli": "2.10.0-snapshot-20250826181741",
|
|
44
|
+
"@medusajs/framework": "2.10.0-snapshot-20250826181741",
|
|
45
|
+
"@medusajs/icons": "2.10.0-snapshot-20250826181741",
|
|
46
|
+
"@medusajs/medusa": "2.10.0-snapshot-20250826181741",
|
|
47
|
+
"@medusajs/test-utils": "2.10.0-snapshot-20250826181741",
|
|
48
|
+
"@medusajs/types": "2.10.0-snapshot-20250826181741",
|
|
49
|
+
"@medusajs/ui": "4.0.20-snapshot-20250826181741",
|
|
50
|
+
"@medusajs/ui-preset": "2.10.0-snapshot-20250826181741",
|
|
54
51
|
"@mikro-orm/cli": "6.4.3",
|
|
55
52
|
"@mikro-orm/core": "6.4.3",
|
|
56
53
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -74,13 +71,13 @@
|
|
|
74
71
|
"yalc": "^1.0.0-pre.53"
|
|
75
72
|
},
|
|
76
73
|
"peerDependencies": {
|
|
77
|
-
"@medusajs/admin-sdk": "2.10.0-snapshot-
|
|
78
|
-
"@medusajs/cli": "2.10.0-snapshot-
|
|
79
|
-
"@medusajs/framework": "2.10.0-snapshot-
|
|
80
|
-
"@medusajs/icons": "2.10.0-snapshot-
|
|
81
|
-
"@medusajs/medusa": "2.10.0-snapshot-
|
|
82
|
-
"@medusajs/test-utils": "2.10.0-snapshot-
|
|
83
|
-
"@medusajs/ui": "4.0.20-snapshot-
|
|
74
|
+
"@medusajs/admin-sdk": "2.10.0-snapshot-20250826181741",
|
|
75
|
+
"@medusajs/cli": "2.10.0-snapshot-20250826181741",
|
|
76
|
+
"@medusajs/framework": "2.10.0-snapshot-20250826181741",
|
|
77
|
+
"@medusajs/icons": "2.10.0-snapshot-20250826181741",
|
|
78
|
+
"@medusajs/medusa": "2.10.0-snapshot-20250826181741",
|
|
79
|
+
"@medusajs/test-utils": "2.10.0-snapshot-20250826181741",
|
|
80
|
+
"@medusajs/ui": "4.0.20-snapshot-20250826181741",
|
|
84
81
|
"@mikro-orm/cli": "6.4.3",
|
|
85
82
|
"@mikro-orm/core": "6.4.3",
|
|
86
83
|
"@mikro-orm/knex": "6.4.3",
|