@mercurjs/vendor 2.2.0-canary.26 → 2.2.0-canary.28
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/dist/{[id]-GFB3SO6Y.js → [id]-MC5QWEQT.js} +2 -2
- package/dist/{[id]-42TLPYPU.js → [id]-SS3NV6FK.js} +3 -3
- package/dist/{add-promotions-LQ7BVVAF.js → add-promotions-IXXTQTW4.js} +3 -3
- package/dist/{chunk-QL5LNE6F.js → chunk-DBCJVIQE.js} +1 -1
- package/dist/{chunk-SOQUKPIX.js → chunk-DHYGSFT5.js} +1 -1
- package/dist/{chunk-XT5C5SXO.js → chunk-IYQMPM4R.js} +1 -1
- package/dist/{chunk-3IK3GKVK.js → chunk-MNE6KENU.js} +1 -1
- package/dist/{chunk-CTQL7XWU.js → chunk-N53HH6MY.js} +1 -1
- package/dist/{chunk-GVHGOAOZ.js → chunk-QE3D5FBN.js} +2 -2
- package/dist/{chunk-B6RUIW7L.js → chunk-Y24JTPHR.js} +1 -1
- package/dist/{create-4GSWM7HU.js → create-E6RJLNSW.js} +4 -4
- package/dist/{edit-5PYWU2VY.js → edit-UP6IGHIT.js} +2 -2
- package/dist/index.js +17 -17
- package/dist/{media-XSID2F4U.js → media-RCSCTY63.js} +3 -3
- package/dist/{offer-create-page-OC7AJV4K.js → offer-create-page-PX5FOU4L.js} +45 -67
- package/dist/{offer-detail-page-P77ZJIVX.js → offer-detail-page-67SUHYK2.js} +5 -11
- package/dist/{offer-variant-detail-page-FXVMRTZE.js → offer-variant-detail-page-PIGHXN3L.js} +1 -1
- package/dist/pages/index.js +7 -7
- package/dist/{products-XN5PHWIH.js → products-35427OD2.js} +4 -4
- package/dist/{promotions-QVYYXYGX.js → promotions-2WJWDYGI.js} +4 -4
- package/dist/{register-TZJPMDPW.js → register-EE3U4LFH.js} +1 -1
- package/dist/{reset-password-UFJGIA5H.js → reset-password-B5HFAQOB.js} +1 -1
- package/dist/{shipping-W4SPR3JO.js → shipping-H2YMDCES.js} +22 -19
- package/package.json +1 -1
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-BWGPN6XV.js";
|
|
7
7
|
import {
|
|
8
8
|
StatusCell
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-N53HH6MY.js";
|
|
10
10
|
import "./chunk-FMFVTERD.js";
|
|
11
11
|
import "./chunk-DB6ANJBO.js";
|
|
12
12
|
import {
|
|
13
13
|
NoRecords
|
|
14
14
|
} from "./chunk-634XVU3D.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-IYQMPM4R.js";
|
|
16
16
|
import {
|
|
17
17
|
TwoColumnPage
|
|
18
18
|
} from "./chunk-YV6MK4PZ.js";
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
usePromotionTableColumns,
|
|
9
9
|
usePromotionTableQuery
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-DHYGSFT5.js";
|
|
11
|
+
import "./chunk-N53HH6MY.js";
|
|
12
12
|
import "./chunk-JHIMVLB2.js";
|
|
13
13
|
import {
|
|
14
14
|
usePromotionTableFilters
|
|
@@ -27,7 +27,7 @@ import "./chunk-634XVU3D.js";
|
|
|
27
27
|
import {
|
|
28
28
|
currencies
|
|
29
29
|
} from "./chunk-IQPN4PZJ.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-IYQMPM4R.js";
|
|
31
31
|
import {
|
|
32
32
|
TwoColumnPage
|
|
33
33
|
} from "./chunk-YV6MK4PZ.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePromotionTableColumns,
|
|
3
3
|
usePromotionTableQuery
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-DHYGSFT5.js";
|
|
5
|
+
import "./chunk-N53HH6MY.js";
|
|
6
6
|
import "./chunk-JHIMVLB2.js";
|
|
7
7
|
import {
|
|
8
8
|
usePromotionTableFilters
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import "./chunk-YN3FGNJM.js";
|
|
19
19
|
import "./chunk-KCHYLLVG.js";
|
|
20
20
|
import "./chunk-634XVU3D.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-IYQMPM4R.js";
|
|
22
22
|
import "./chunk-TKGWSUEI.js";
|
|
23
23
|
import {
|
|
24
24
|
KeyboundForm
|
|
@@ -10012,7 +10012,7 @@ var en_default = {
|
|
|
10012
10012
|
description: "Adjust filters or search terms."
|
|
10013
10013
|
},
|
|
10014
10014
|
validation: {
|
|
10015
|
-
skuRequired: "SKU is required
|
|
10015
|
+
skuRequired: "SKU is required to publish this row.",
|
|
10016
10016
|
shippingProfileRequired: "Select a shipping profile to publish this row.",
|
|
10017
10017
|
duplicateSku: "Another row in this submission already uses this SKU.",
|
|
10018
10018
|
duplicatePriceRule: "Another price row already has this combination of currency, region, customer group, and quantity bounds.",
|
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
} from "./chunk-OVPAOBZB.js";
|
|
27
27
|
import {
|
|
28
28
|
UploadMediaFormItem
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-DBCJVIQE.js";
|
|
30
30
|
import {
|
|
31
31
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
32
32
|
ProductCreateSchema,
|
|
33
33
|
generateVariantsFromAttributes,
|
|
34
34
|
normalizeProductFormValues
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-Y24JTPHR.js";
|
|
36
36
|
import {
|
|
37
37
|
ChipInput
|
|
38
38
|
} from "./chunk-KDE4HKH2.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProductCreate,
|
|
3
3
|
ProductCreatePage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QE3D5FBN.js";
|
|
5
5
|
import "./chunk-LEWA4BPH.js";
|
|
6
6
|
import "./chunk-TKSKCYM3.js";
|
|
7
7
|
import "./chunk-HJ56YXBU.js";
|
|
@@ -14,20 +14,20 @@ import "./chunk-IQPN4PZJ.js";
|
|
|
14
14
|
import "./chunk-YVCBMOJG.js";
|
|
15
15
|
import "./chunk-J434WDD3.js";
|
|
16
16
|
import "./chunk-OVPAOBZB.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-DBCJVIQE.js";
|
|
18
18
|
import {
|
|
19
19
|
EditProductMediaSchema,
|
|
20
20
|
MediaSchema,
|
|
21
21
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
22
22
|
ProductCreateSchema
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-Y24JTPHR.js";
|
|
24
24
|
import "./chunk-AJLGY3LQ.js";
|
|
25
25
|
import "./chunk-SMQT3ZNO.js";
|
|
26
26
|
import "./chunk-KDE4HKH2.js";
|
|
27
27
|
import "./chunk-4YWKKCTT.js";
|
|
28
28
|
import "./chunk-VBRTC2VU.js";
|
|
29
29
|
import "./chunk-WJ5EU3KW.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-IYQMPM4R.js";
|
|
31
31
|
import "./chunk-TKGWSUEI.js";
|
|
32
32
|
import "./chunk-SITRHMZZ.js";
|
|
33
33
|
import "./chunk-GDWBOQI5.js";
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
FileUpload,
|
|
9
9
|
MediaSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Y24JTPHR.js";
|
|
11
11
|
import "./chunk-AJLGY3LQ.js";
|
|
12
12
|
import "./chunk-SMQT3ZNO.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-IYQMPM4R.js";
|
|
14
14
|
import "./chunk-TKGWSUEI.js";
|
|
15
15
|
import {
|
|
16
16
|
KeyboundForm
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-WJ5EU3KW.js";
|
|
9
9
|
import {
|
|
10
10
|
I18n
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IYQMPM4R.js";
|
|
12
12
|
import "./chunk-TKGWSUEI.js";
|
|
13
13
|
import "./chunk-SITRHMZZ.js";
|
|
14
14
|
import "./chunk-GDWBOQI5.js";
|
|
@@ -2907,7 +2907,7 @@ function getRouteMap({
|
|
|
2907
2907
|
{
|
|
2908
2908
|
path: "",
|
|
2909
2909
|
lazy: async () => {
|
|
2910
|
-
const { ProductListPage } = await import("./products-
|
|
2910
|
+
const { ProductListPage } = await import("./products-35427OD2.js");
|
|
2911
2911
|
return {
|
|
2912
2912
|
Component: ProductListPage
|
|
2913
2913
|
};
|
|
@@ -2916,7 +2916,7 @@ function getRouteMap({
|
|
|
2916
2916
|
{
|
|
2917
2917
|
path: "create",
|
|
2918
2918
|
lazy: async () => {
|
|
2919
|
-
const { ProductCreatePage } = await import("./create-
|
|
2919
|
+
const { ProductCreatePage } = await import("./create-E6RJLNSW.js");
|
|
2920
2920
|
return {
|
|
2921
2921
|
Component: ProductCreatePage
|
|
2922
2922
|
};
|
|
@@ -2965,7 +2965,7 @@ function getRouteMap({
|
|
|
2965
2965
|
},
|
|
2966
2966
|
{
|
|
2967
2967
|
path: "media",
|
|
2968
|
-
lazy: () => import("./media-
|
|
2968
|
+
lazy: () => import("./media-RCSCTY63.js")
|
|
2969
2969
|
},
|
|
2970
2970
|
{
|
|
2971
2971
|
path: "attributes",
|
|
@@ -3348,7 +3348,7 @@ function getRouteMap({
|
|
|
3348
3348
|
children: [
|
|
3349
3349
|
{
|
|
3350
3350
|
path: "create",
|
|
3351
|
-
lazy: () => import("./offer-create-page-
|
|
3351
|
+
lazy: () => import("./offer-create-page-PX5FOU4L.js")
|
|
3352
3352
|
}
|
|
3353
3353
|
]
|
|
3354
3354
|
},
|
|
@@ -3369,7 +3369,7 @@ function getRouteMap({
|
|
|
3369
3369
|
{
|
|
3370
3370
|
path: "",
|
|
3371
3371
|
lazy: async () => {
|
|
3372
|
-
const { OfferDetailPage } = await import("./offer-detail-page-
|
|
3372
|
+
const { OfferDetailPage } = await import("./offer-detail-page-67SUHYK2.js");
|
|
3373
3373
|
return { Component: OfferDetailPage };
|
|
3374
3374
|
},
|
|
3375
3375
|
children: [
|
|
@@ -3400,7 +3400,7 @@ function getRouteMap({
|
|
|
3400
3400
|
{
|
|
3401
3401
|
path: "",
|
|
3402
3402
|
lazy: async () => {
|
|
3403
|
-
const { OfferVariantDetailPage } = await import("./offer-variant-detail-page-
|
|
3403
|
+
const { OfferVariantDetailPage } = await import("./offer-variant-detail-page-PIGHXN3L.js");
|
|
3404
3404
|
return { Component: OfferVariantDetailPage };
|
|
3405
3405
|
},
|
|
3406
3406
|
children: [
|
|
@@ -3410,7 +3410,7 @@ function getRouteMap({
|
|
|
3410
3410
|
},
|
|
3411
3411
|
{
|
|
3412
3412
|
path: "shipping",
|
|
3413
|
-
lazy: () => import("./shipping-
|
|
3413
|
+
lazy: () => import("./shipping-H2YMDCES.js")
|
|
3414
3414
|
},
|
|
3415
3415
|
{
|
|
3416
3416
|
path: "pricing",
|
|
@@ -3511,7 +3511,7 @@ function getRouteMap({
|
|
|
3511
3511
|
{
|
|
3512
3512
|
path: "",
|
|
3513
3513
|
lazy: async () => {
|
|
3514
|
-
const { PromotionListPage } = await import("./promotions-
|
|
3514
|
+
const { PromotionListPage } = await import("./promotions-2WJWDYGI.js");
|
|
3515
3515
|
return {
|
|
3516
3516
|
Component: PromotionListPage
|
|
3517
3517
|
};
|
|
@@ -3526,7 +3526,7 @@ function getRouteMap({
|
|
|
3526
3526
|
{
|
|
3527
3527
|
path: ":id",
|
|
3528
3528
|
lazy: async () => {
|
|
3529
|
-
const { loader } = await import("./[id]-
|
|
3529
|
+
const { loader } = await import("./[id]-MC5QWEQT.js");
|
|
3530
3530
|
const { Breadcrumb } = await import("./breadcrumb-UAUX7XCV.js");
|
|
3531
3531
|
return {
|
|
3532
3532
|
Component: Outlet4,
|
|
@@ -3540,7 +3540,7 @@ function getRouteMap({
|
|
|
3540
3540
|
{
|
|
3541
3541
|
path: "",
|
|
3542
3542
|
lazy: async () => {
|
|
3543
|
-
const { PromotionDetailPage } = await import("./[id]-
|
|
3543
|
+
const { PromotionDetailPage } = await import("./[id]-MC5QWEQT.js");
|
|
3544
3544
|
return {
|
|
3545
3545
|
Component: PromotionDetailPage
|
|
3546
3546
|
};
|
|
@@ -3588,7 +3588,7 @@ function getRouteMap({
|
|
|
3588
3588
|
{
|
|
3589
3589
|
path: ":id",
|
|
3590
3590
|
lazy: async () => {
|
|
3591
|
-
const { loader } = await import("./[id]-
|
|
3591
|
+
const { loader } = await import("./[id]-SS3NV6FK.js");
|
|
3592
3592
|
const { Breadcrumb } = await import("./breadcrumb-F3BN5753.js");
|
|
3593
3593
|
return {
|
|
3594
3594
|
Component: Outlet4,
|
|
@@ -3602,7 +3602,7 @@ function getRouteMap({
|
|
|
3602
3602
|
{
|
|
3603
3603
|
path: "",
|
|
3604
3604
|
lazy: async () => {
|
|
3605
|
-
const { CampaignDetailPage } = await import("./[id]-
|
|
3605
|
+
const { CampaignDetailPage } = await import("./[id]-SS3NV6FK.js");
|
|
3606
3606
|
return {
|
|
3607
3607
|
Component: CampaignDetailPage
|
|
3608
3608
|
};
|
|
@@ -3623,7 +3623,7 @@ function getRouteMap({
|
|
|
3623
3623
|
{
|
|
3624
3624
|
path: "add-promotions",
|
|
3625
3625
|
lazy: async () => {
|
|
3626
|
-
const { AddPromotionsPage } = await import("./add-promotions-
|
|
3626
|
+
const { AddPromotionsPage } = await import("./add-promotions-IXXTQTW4.js");
|
|
3627
3627
|
return {
|
|
3628
3628
|
Component: AddPromotionsPage
|
|
3629
3629
|
};
|
|
@@ -3801,7 +3801,7 @@ function getRouteMap({
|
|
|
3801
3801
|
children: [
|
|
3802
3802
|
{
|
|
3803
3803
|
path: "edit",
|
|
3804
|
-
lazy: () => import("./edit-
|
|
3804
|
+
lazy: () => import("./edit-UP6IGHIT.js")
|
|
3805
3805
|
},
|
|
3806
3806
|
{
|
|
3807
3807
|
path: "address",
|
|
@@ -4214,12 +4214,12 @@ function getRouteMap({
|
|
|
4214
4214
|
},
|
|
4215
4215
|
{
|
|
4216
4216
|
path: "/reset-password",
|
|
4217
|
-
lazy: () => import("./reset-password-
|
|
4217
|
+
lazy: () => import("./reset-password-B5HFAQOB.js")
|
|
4218
4218
|
},
|
|
4219
4219
|
{
|
|
4220
4220
|
path: "/register",
|
|
4221
4221
|
lazy: async () => {
|
|
4222
|
-
const { RegisterPage } = await import("./register-
|
|
4222
|
+
const { RegisterPage } = await import("./register-EE3U4LFH.js");
|
|
4223
4223
|
return { Component: RegisterPage };
|
|
4224
4224
|
}
|
|
4225
4225
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UploadMediaFormItem
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DBCJVIQE.js";
|
|
4
4
|
import {
|
|
5
5
|
EditProductMediaSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Y24JTPHR.js";
|
|
7
7
|
import "./chunk-AJLGY3LQ.js";
|
|
8
8
|
import "./chunk-SMQT3ZNO.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-IYQMPM4R.js";
|
|
10
10
|
import "./chunk-TKGWSUEI.js";
|
|
11
11
|
import {
|
|
12
12
|
KeyboundForm
|
|
@@ -99,7 +99,7 @@ import "./chunk-NBMM2TZK.js";
|
|
|
99
99
|
// src/pages/offers/create/create-offer-form/create-offer-form.tsx
|
|
100
100
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
101
101
|
import { Button, toast } from "@medusajs/ui";
|
|
102
|
-
import { useEffect as
|
|
102
|
+
import { useEffect, useMemo as useMemo3, useState as useState2 } from "react";
|
|
103
103
|
import { useForm } from "react-hook-form";
|
|
104
104
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
105
105
|
|
|
@@ -109,7 +109,7 @@ import { keepPreviousData } from "@tanstack/react-query";
|
|
|
109
109
|
import {
|
|
110
110
|
createColumnHelper
|
|
111
111
|
} from "@tanstack/react-table";
|
|
112
|
-
import {
|
|
112
|
+
import { useMemo, useState } from "react";
|
|
113
113
|
import { useFormContext } from "react-hook-form";
|
|
114
114
|
import { useTranslation } from "react-i18next";
|
|
115
115
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -137,10 +137,15 @@ var Root = () => {
|
|
|
137
137
|
);
|
|
138
138
|
const [rowSelection, setRowSelection] = useState(initialSelection);
|
|
139
139
|
const updater = (fn) => {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
140
|
+
const next = typeof fn === "function" ? fn(rowSelection) : fn;
|
|
141
|
+
const nextIds = Object.keys(next);
|
|
142
|
+
const currentIds = Object.keys(rowSelection);
|
|
143
|
+
const unchanged = nextIds.length === currentIds.length && nextIds.every((id) => rowSelection[id]);
|
|
144
|
+
if (unchanged) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
setRowSelection(next);
|
|
148
|
+
form.setValue("selected_product_ids", nextIds, {
|
|
144
149
|
shouldDirty: true,
|
|
145
150
|
shouldTouch: true,
|
|
146
151
|
shouldValidate: true
|
|
@@ -166,9 +171,6 @@ var Root = () => {
|
|
|
166
171
|
updater
|
|
167
172
|
}
|
|
168
173
|
});
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
void form.trigger("selected_product_ids");
|
|
171
|
-
}, [rowSelection, form]);
|
|
172
174
|
if (isError) {
|
|
173
175
|
throw error;
|
|
174
176
|
}
|
|
@@ -472,30 +474,6 @@ var CreateOfferSchema = z.object({
|
|
|
472
474
|
selected_product_ids: z.array(z.string().min(1)).min(1),
|
|
473
475
|
variants: z.array(VariantRowSchema).min(1)
|
|
474
476
|
});
|
|
475
|
-
var numericOrZero = (v) => {
|
|
476
|
-
if (v === "" || v === null || v === void 0) return 0;
|
|
477
|
-
return Number(v) || 0;
|
|
478
|
-
};
|
|
479
|
-
var isVariantRowPublishable = (row) => {
|
|
480
|
-
const hasSku = !!row.sku && row.sku.trim().length > 0;
|
|
481
|
-
const hasShipping = !!row.shipping_profile_id && row.shipping_profile_id.length > 0;
|
|
482
|
-
const hasEnabledLocation = Object.values(row.inventory ?? {}).some(
|
|
483
|
-
(v) => v.checked
|
|
484
|
-
);
|
|
485
|
-
const hasNonZeroPrice = Object.values(row.prices ?? {}).some(
|
|
486
|
-
(v) => numericOrZero(v) > 0
|
|
487
|
-
);
|
|
488
|
-
return hasSku || hasShipping || hasEnabledLocation || hasNonZeroPrice;
|
|
489
|
-
};
|
|
490
|
-
var variantRowRequiresSku = (row) => {
|
|
491
|
-
const hasEnabledLocation = Object.values(row.inventory ?? {}).some(
|
|
492
|
-
(v) => v.checked
|
|
493
|
-
);
|
|
494
|
-
const hasNonZeroPrice = Object.values(row.prices ?? {}).some(
|
|
495
|
-
(v) => numericOrZero(v) > 0
|
|
496
|
-
);
|
|
497
|
-
return hasEnabledLocation || hasNonZeroPrice;
|
|
498
|
-
};
|
|
499
477
|
|
|
500
478
|
// src/pages/offers/create/create-offer-form/create-offer-form.tsx
|
|
501
479
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -503,7 +481,7 @@ var DEFAULTS = {
|
|
|
503
481
|
selected_product_ids: [],
|
|
504
482
|
variants: []
|
|
505
483
|
};
|
|
506
|
-
var
|
|
484
|
+
var numericOrZero = (v) => {
|
|
507
485
|
if (v === "" || v === null || v === void 0) return 0;
|
|
508
486
|
return Number(v) || 0;
|
|
509
487
|
};
|
|
@@ -549,7 +527,7 @@ var CreateOfferForm = () => {
|
|
|
549
527
|
},
|
|
550
528
|
{ enabled: selectedProductIds.length > 0 }
|
|
551
529
|
);
|
|
552
|
-
|
|
530
|
+
useEffect(() => {
|
|
553
531
|
const locIds = locationsKey ? locationsKey.split(",") : [];
|
|
554
532
|
const emptyPrices = currency_code ? { [currency_code]: "" } : {};
|
|
555
533
|
const emptyInventory = locIds.reduce((acc, locId) => {
|
|
@@ -586,7 +564,10 @@ var CreateOfferForm = () => {
|
|
|
586
564
|
});
|
|
587
565
|
}
|
|
588
566
|
}
|
|
589
|
-
form.
|
|
567
|
+
const prev = form.getValues("variants") ?? [];
|
|
568
|
+
if (JSON.stringify(prev) !== JSON.stringify(next)) {
|
|
569
|
+
form.setValue("variants", next, { shouldDirty: false });
|
|
570
|
+
}
|
|
590
571
|
}, [
|
|
591
572
|
selectedProductIdsKey,
|
|
592
573
|
fetchedProducts,
|
|
@@ -596,33 +577,28 @@ var CreateOfferForm = () => {
|
|
|
596
577
|
]);
|
|
597
578
|
const handleSubmit = form.handleSubmit(async (values) => {
|
|
598
579
|
const variants = values.variants ?? [];
|
|
599
|
-
|
|
600
|
-
if (publishable.length === 0) {
|
|
601
|
-
toast.error(t("offers.validation.noPublishableRows"));
|
|
580
|
+
if (variants.length === 0) {
|
|
602
581
|
return;
|
|
603
582
|
}
|
|
604
583
|
let hasValidationError = false;
|
|
605
584
|
const skuSeen = /* @__PURE__ */ new Map();
|
|
606
585
|
for (let i = 0; i < variants.length; i++) {
|
|
607
586
|
const row = variants[i];
|
|
608
|
-
if (!isVariantRowPublishable(row)) continue;
|
|
609
587
|
const sku = (row.sku ?? "").trim();
|
|
610
|
-
if (
|
|
588
|
+
if (!sku) {
|
|
611
589
|
form.setError(`variants.${i}.sku`, {
|
|
612
590
|
type: "manual",
|
|
613
591
|
message: t("offers.validation.skuRequired")
|
|
614
592
|
});
|
|
615
593
|
hasValidationError = true;
|
|
616
|
-
} else if (sku) {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
skuSeen.set(sku, i);
|
|
625
|
-
}
|
|
594
|
+
} else if (skuSeen.has(sku)) {
|
|
595
|
+
form.setError(`variants.${i}.sku`, {
|
|
596
|
+
type: "manual",
|
|
597
|
+
message: t("offers.validation.duplicateSku")
|
|
598
|
+
});
|
|
599
|
+
hasValidationError = true;
|
|
600
|
+
} else {
|
|
601
|
+
skuSeen.set(sku, i);
|
|
626
602
|
}
|
|
627
603
|
if (!row.shipping_profile_id) {
|
|
628
604
|
form.setError(`variants.${i}.shipping_profile_id`, {
|
|
@@ -634,18 +610,16 @@ var CreateOfferForm = () => {
|
|
|
634
610
|
}
|
|
635
611
|
if (hasValidationError) return;
|
|
636
612
|
setIsSubmitting(true);
|
|
637
|
-
const
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
const payloadOffers = publishableRows.map(({ row, sku }) => {
|
|
613
|
+
const rows = variants.map((row, index) => ({
|
|
614
|
+
row,
|
|
615
|
+
index,
|
|
616
|
+
sku: (row.sku ?? "").trim()
|
|
617
|
+
}));
|
|
618
|
+
const payloadOffers = rows.map(({ row, sku }) => {
|
|
645
619
|
const prices = [];
|
|
646
620
|
if (currency_code) {
|
|
647
621
|
prices.push({
|
|
648
|
-
amount:
|
|
622
|
+
amount: numericOrZero(row.prices?.[currency_code]),
|
|
649
623
|
currency_code
|
|
650
624
|
});
|
|
651
625
|
}
|
|
@@ -654,7 +628,7 @@ var CreateOfferForm = () => {
|
|
|
654
628
|
if (!level?.checked) continue;
|
|
655
629
|
stock_levels.push({
|
|
656
630
|
location_id: locationId,
|
|
657
|
-
stocked_quantity:
|
|
631
|
+
stocked_quantity: numericOrZero(level.quantity)
|
|
658
632
|
});
|
|
659
633
|
}
|
|
660
634
|
return {
|
|
@@ -676,7 +650,7 @@ var CreateOfferForm = () => {
|
|
|
676
650
|
handleSuccess("/offers");
|
|
677
651
|
} catch (err) {
|
|
678
652
|
const message = err instanceof Error ? err.message : "Unknown error";
|
|
679
|
-
const attributed = attachErrorToRow(message,
|
|
653
|
+
const attributed = attachErrorToRow(message, rows, form);
|
|
680
654
|
if (!attributed) {
|
|
681
655
|
toast.error(message);
|
|
682
656
|
}
|
|
@@ -684,7 +658,14 @@ var CreateOfferForm = () => {
|
|
|
684
658
|
setIsSubmitting(false);
|
|
685
659
|
}
|
|
686
660
|
});
|
|
687
|
-
|
|
661
|
+
const tabs = useMemo3(
|
|
662
|
+
() => [
|
|
663
|
+
/* @__PURE__ */ jsx3(CreateOfferCatalogueTab, {}, "catalogue"),
|
|
664
|
+
/* @__PURE__ */ jsx3(CreateOfferStockLevelsAndPricesTab, {}, "stockLevelsAndPrices")
|
|
665
|
+
],
|
|
666
|
+
[]
|
|
667
|
+
);
|
|
668
|
+
return /* @__PURE__ */ jsx3(
|
|
688
669
|
TabbedForm,
|
|
689
670
|
{
|
|
690
671
|
form,
|
|
@@ -716,10 +697,7 @@ var CreateOfferForm = () => {
|
|
|
716
697
|
"next-button"
|
|
717
698
|
)
|
|
718
699
|
] }),
|
|
719
|
-
children:
|
|
720
|
-
/* @__PURE__ */ jsx3(CreateOfferCatalogueTab, {}),
|
|
721
|
-
/* @__PURE__ */ jsx3(CreateOfferStockLevelsAndPricesTab, {})
|
|
722
|
-
]
|
|
700
|
+
children: tabs
|
|
723
701
|
}
|
|
724
702
|
);
|
|
725
703
|
};
|
|
@@ -183,8 +183,6 @@ var inventoryOf = (offer) => {
|
|
|
183
183
|
}
|
|
184
184
|
return {
|
|
185
185
|
hasItems: links.length > 0,
|
|
186
|
-
// More than one backing inventory item ⇒ the offer is an inventory
|
|
187
|
-
// kit; the table marks it with a Component glyph (Figma `40016500:749885`).
|
|
188
186
|
isKit: links.length > 1,
|
|
189
187
|
available,
|
|
190
188
|
locationCount: locations.size
|
|
@@ -216,9 +214,6 @@ var useColumns = ({
|
|
|
216
214
|
const { t } = useTranslation2();
|
|
217
215
|
return useMemo(
|
|
218
216
|
() => [
|
|
219
|
-
// Thumbnail lives inside the Title cell (Figma `40016500:747487`), so
|
|
220
|
-
// the "Title" header sits at the left edge rather than over an empty
|
|
221
|
-
// leading column.
|
|
222
217
|
columnHelper.accessor((row) => row.variant.title ?? "", {
|
|
223
218
|
id: "title",
|
|
224
219
|
header: t("fields.title"),
|
|
@@ -377,11 +372,9 @@ var OfferVariantsSection = ({
|
|
|
377
372
|
return rows;
|
|
378
373
|
}, [allRows, q, created_at, updated_at]);
|
|
379
374
|
const sortedRows = useMemo(() => {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
const desc = order.startsWith("-");
|
|
384
|
-
const key = desc ? order.slice(1) : order;
|
|
375
|
+
const activeOrder = order || "title";
|
|
376
|
+
const desc = activeOrder.startsWith("-");
|
|
377
|
+
const key = desc ? activeOrder.slice(1) : activeOrder;
|
|
385
378
|
const valueOf = (row) => {
|
|
386
379
|
switch (key) {
|
|
387
380
|
case "title":
|
|
@@ -461,7 +454,7 @@ var OfferVariantsSection = ({
|
|
|
461
454
|
getRowId: (row) => row.id,
|
|
462
455
|
prefix: PREFIX
|
|
463
456
|
});
|
|
464
|
-
return /* @__PURE__ */ jsxs2(Container2, { className: "p-0", "data-testid": "offer-variants-section", children: [
|
|
457
|
+
return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", "data-testid": "offer-variants-section", children: [
|
|
465
458
|
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
466
459
|
/* @__PURE__ */ jsx2(Heading2, { level: "h2", children: t("offers.fields.variants") }),
|
|
467
460
|
/* @__PURE__ */ jsx2("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsx2(
|
|
@@ -497,6 +490,7 @@ var OfferVariantsSection = ({
|
|
|
497
490
|
pagination: true,
|
|
498
491
|
search: true,
|
|
499
492
|
orderBy,
|
|
493
|
+
defaultOrderBy: "title",
|
|
500
494
|
filters,
|
|
501
495
|
queryObject: { q, order, created_at, updated_at },
|
|
502
496
|
navigateTo: (row) => `variants/${row.original.id}`,
|
package/dist/{offer-variant-detail-page-FXVMRTZE.js → offer-variant-detail-page-PIGHXN3L.js}
RENAMED
|
@@ -338,7 +338,7 @@ var OfferVariantShippingSection = ({
|
|
|
338
338
|
profile?.name ? /* @__PURE__ */ jsx4("div", { className: "txt-small flex flex-col gap-2 px-2 pb-2", children: /* @__PURE__ */ jsx4(
|
|
339
339
|
Link,
|
|
340
340
|
{
|
|
341
|
-
to: `/settings/shipping-profiles/${profile.id}`,
|
|
341
|
+
to: `/settings/locations/shipping-profiles/${profile.id}`,
|
|
342
342
|
className: "outline-none focus-within:shadow-borders-interactive-with-focus rounded-md [&:hover>div]:bg-ui-bg-component-hover",
|
|
343
343
|
"data-testid": "offer-variant-shipping-link",
|
|
344
344
|
children: /* @__PURE__ */ jsx4("div", { className: "shadow-elevation-card-rest bg-ui-bg-component rounded-md px-4 py-2 transition-colors", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
package/dist/pages/index.js
CHANGED
|
@@ -36,9 +36,9 @@ import {
|
|
|
36
36
|
import "../chunk-7TIZP4YG.js";
|
|
37
37
|
import {
|
|
38
38
|
PromotionListPage
|
|
39
|
-
} from "../chunk-
|
|
40
|
-
import "../chunk-
|
|
41
|
-
import "../chunk-
|
|
39
|
+
} from "../chunk-MNE6KENU.js";
|
|
40
|
+
import "../chunk-DHYGSFT5.js";
|
|
41
|
+
import "../chunk-N53HH6MY.js";
|
|
42
42
|
import {
|
|
43
43
|
InventoryListPage
|
|
44
44
|
} from "../chunk-RBFKFCBD.js";
|
|
@@ -110,7 +110,7 @@ import "../chunk-PHOCVOZ5.js";
|
|
|
110
110
|
import {
|
|
111
111
|
ProductCreate,
|
|
112
112
|
ProductCreatePage
|
|
113
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-QE3D5FBN.js";
|
|
114
114
|
import "../chunk-LEWA4BPH.js";
|
|
115
115
|
import "../chunk-TKSKCYM3.js";
|
|
116
116
|
import "../chunk-HJ56YXBU.js";
|
|
@@ -123,20 +123,20 @@ import "../chunk-IQPN4PZJ.js";
|
|
|
123
123
|
import "../chunk-YVCBMOJG.js";
|
|
124
124
|
import "../chunk-J434WDD3.js";
|
|
125
125
|
import "../chunk-OVPAOBZB.js";
|
|
126
|
-
import "../chunk-
|
|
126
|
+
import "../chunk-DBCJVIQE.js";
|
|
127
127
|
import {
|
|
128
128
|
EditProductMediaSchema,
|
|
129
129
|
MediaSchema,
|
|
130
130
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
131
131
|
ProductCreateSchema
|
|
132
|
-
} from "../chunk-
|
|
132
|
+
} from "../chunk-Y24JTPHR.js";
|
|
133
133
|
import "../chunk-AJLGY3LQ.js";
|
|
134
134
|
import "../chunk-SMQT3ZNO.js";
|
|
135
135
|
import "../chunk-KDE4HKH2.js";
|
|
136
136
|
import "../chunk-4YWKKCTT.js";
|
|
137
137
|
import "../chunk-VBRTC2VU.js";
|
|
138
138
|
import "../chunk-WJ5EU3KW.js";
|
|
139
|
-
import "../chunk-
|
|
139
|
+
import "../chunk-IYQMPM4R.js";
|
|
140
140
|
import "../chunk-TKGWSUEI.js";
|
|
141
141
|
import "../chunk-SITRHMZZ.js";
|
|
142
142
|
import "../chunk-GDWBOQI5.js";
|
|
@@ -12,7 +12,7 @@ import "./chunk-PHOCVOZ5.js";
|
|
|
12
12
|
import {
|
|
13
13
|
ProductCreate,
|
|
14
14
|
ProductCreatePage
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QE3D5FBN.js";
|
|
16
16
|
import "./chunk-LEWA4BPH.js";
|
|
17
17
|
import "./chunk-TKSKCYM3.js";
|
|
18
18
|
import "./chunk-HJ56YXBU.js";
|
|
@@ -25,20 +25,20 @@ import "./chunk-IQPN4PZJ.js";
|
|
|
25
25
|
import "./chunk-YVCBMOJG.js";
|
|
26
26
|
import "./chunk-J434WDD3.js";
|
|
27
27
|
import "./chunk-OVPAOBZB.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-DBCJVIQE.js";
|
|
29
29
|
import {
|
|
30
30
|
EditProductMediaSchema,
|
|
31
31
|
MediaSchema,
|
|
32
32
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
33
33
|
ProductCreateSchema
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-Y24JTPHR.js";
|
|
35
35
|
import "./chunk-AJLGY3LQ.js";
|
|
36
36
|
import "./chunk-SMQT3ZNO.js";
|
|
37
37
|
import "./chunk-KDE4HKH2.js";
|
|
38
38
|
import "./chunk-4YWKKCTT.js";
|
|
39
39
|
import "./chunk-VBRTC2VU.js";
|
|
40
40
|
import "./chunk-WJ5EU3KW.js";
|
|
41
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-IYQMPM4R.js";
|
|
42
42
|
import "./chunk-TKGWSUEI.js";
|
|
43
43
|
import "./chunk-SITRHMZZ.js";
|
|
44
44
|
import "./chunk-GDWBOQI5.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PromotionListPage
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-MNE6KENU.js";
|
|
4
|
+
import "./chunk-DHYGSFT5.js";
|
|
5
|
+
import "./chunk-N53HH6MY.js";
|
|
6
6
|
import "./chunk-JHIMVLB2.js";
|
|
7
7
|
import "./chunk-S2WEYEQR.js";
|
|
8
8
|
import "./chunk-FMFVTERD.js";
|
|
@@ -13,7 +13,7 @@ import "./chunk-XRLRKSND.js";
|
|
|
13
13
|
import "./chunk-YN3FGNJM.js";
|
|
14
14
|
import "./chunk-KCHYLLVG.js";
|
|
15
15
|
import "./chunk-634XVU3D.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-IYQMPM4R.js";
|
|
17
17
|
import "./chunk-YV6MK4PZ.js";
|
|
18
18
|
import "./chunk-THHRRYRS.js";
|
|
19
19
|
import "./chunk-LRD242C7.js";
|
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
useOffer,
|
|
20
20
|
useUpdateOffer
|
|
21
21
|
} from "./chunk-4R5GESED.js";
|
|
22
|
+
import {
|
|
23
|
+
useDocumentDirection
|
|
24
|
+
} from "./chunk-Y7QKP6QU.js";
|
|
22
25
|
import "./chunk-TSTUAL6N.js";
|
|
23
26
|
import "./chunk-A5DJIOHN.js";
|
|
24
27
|
import "./chunk-RHKRREUU.js";
|
|
@@ -28,7 +31,7 @@ import "./chunk-NBMM2TZK.js";
|
|
|
28
31
|
|
|
29
32
|
// src/pages/offers/[id]/variants/[offer_id]/shipping/index.tsx
|
|
30
33
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
31
|
-
import { Button, Heading,
|
|
34
|
+
import { Button, Heading, Select, toast } from "@medusajs/ui";
|
|
32
35
|
import { useForm } from "react-hook-form";
|
|
33
36
|
import { useTranslation } from "react-i18next";
|
|
34
37
|
import { useParams } from "react-router-dom";
|
|
@@ -37,6 +40,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
37
40
|
var Schema = z.object({ shipping_profile_id: z.string().min(1) });
|
|
38
41
|
var EditShippingForm = ({ offer }) => {
|
|
39
42
|
const { t } = useTranslation();
|
|
43
|
+
const direction = useDocumentDirection();
|
|
40
44
|
const { handleSuccess } = useRouteModal();
|
|
41
45
|
const { shipping_profiles } = useShippingProfiles({ limit: 1e3 });
|
|
42
46
|
const form = useForm({
|
|
@@ -68,25 +72,24 @@ var EditShippingForm = ({ offer }) => {
|
|
|
68
72
|
{
|
|
69
73
|
control: form.control,
|
|
70
74
|
name: "shipping_profile_id",
|
|
71
|
-
render: ({ field: { ref
|
|
75
|
+
render: ({ field: { ref, onChange, ...f } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
72
76
|
/* @__PURE__ */ jsx(Form.Label, { children: t("offers.fields.shippingProfile") }),
|
|
73
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
) }),
|
|
77
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...f, onValueChange: onChange, dir: direction, children: [
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
Select.Trigger,
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
"data-testid": "offer-variant-shipping-select",
|
|
83
|
+
children: /* @__PURE__ */ jsx(
|
|
84
|
+
Select.Value,
|
|
85
|
+
{
|
|
86
|
+
placeholder: t("offers.fields.shippingProfile")
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
/* @__PURE__ */ jsx(Select.Content, { children: (shipping_profiles ?? []).map((p) => /* @__PURE__ */ jsx(Select.Item, { value: p.id, children: p.name ?? "" }, p.id)) })
|
|
92
|
+
] }) }),
|
|
90
93
|
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
91
94
|
] })
|
|
92
95
|
}
|