@mercurjs/vendor 2.2.0-canary.11 → 2.2.0-canary.13
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]-EKLRGVBA.js → [id]-ET35KT2M.js} +3 -3
- package/dist/{[id]-A55T2ORL.js → [id]-FALIOGXK.js} +3 -4
- package/dist/{[id]-GC3ZYPK4.js → [id]-GY5R652O.js} +5 -6
- package/dist/{[id]-GBT6VB4S.js → [id]-IGQTT3AM.js} +4 -5
- package/dist/{[id]-SHAJTJNZ.js → [id]-IW2AZE77.js} +5 -6
- package/dist/{[id]-FE5GYYVZ.js → [id]-OTK2NOXT.js} +3 -4
- package/dist/{[id]-U5KZEQDR.js → [id]-PEUI67SP.js} +2 -2
- package/dist/{[id]-T5ECVBPF.js → [id]-RFEYRBLI.js} +4 -5
- package/dist/{[id]-B4YZTANM.js → [id]-US6IULL2.js} +205 -484
- package/dist/{[id]-QOEO3JOV.js → [id]-YZSVSJWU.js} +3 -4
- package/dist/{[id]-QQU5HVFU.js → [id]-ZMLS73X5.js} +4 -5
- package/dist/{[province_id]-6GUA4PV5.js → [province_id]-J3OB2LZ4.js} +5 -6
- package/dist/{add-NTRYWOJF.js → add-XEUXK63F.js} +6 -7
- package/dist/{add-customer-groups-U5RZWW4B.js → add-customer-groups-HZNWWRVG.js} +3 -4
- package/dist/{add-products-Q4MMDQKT.js → add-products-E5GULF6B.js} +4 -5
- package/dist/{add-promotions-3AYXQXTP.js → add-promotions-KW5YZHLS.js} +3 -3
- package/dist/{address-77Y3AOQ3.js → address-6T4H6P7O.js} +3 -4
- package/dist/{breadcrumb-EVZIOB2G.js → breadcrumb-5HYIEPCL.js} +3 -4
- package/dist/{breadcrumb-TNJSGX4T.js → breadcrumb-HL7NKNX4.js} +3 -4
- package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-L3MFH4I2.js} +9 -8
- package/dist/{breadcrumb-5NP23D6X.js → breadcrumb-LKLWHB63.js} +4 -5
- package/dist/breadcrumb-ZMACILH3.js +28 -0
- package/dist/chunk-4WCPN4OA.js +315 -0
- package/dist/{chunk-LDZCCWJB.js → chunk-5YCDZ4AU.js} +1 -1
- package/dist/{chunk-OYKUQXJX.js → chunk-A6QH53CS.js} +21 -10
- package/dist/{chunk-GN6KB75Z.js → chunk-AQTEEQWX.js} +1 -1
- package/dist/{chunk-K6LOZ4S3.js → chunk-DEJIBIQZ.js} +1 -1
- package/dist/{chunk-4LVP635F.js → chunk-DNEPOMOX.js} +125 -125
- package/dist/{chunk-25E4KME5.js → chunk-J7ZU2HZZ.js} +1 -1
- package/dist/{chunk-OZ44ATGE.js → chunk-KJWVLGXG.js} +2 -2
- package/dist/{chunk-LKUW5SV4.js → chunk-LDX23XPT.js} +1 -1
- package/dist/{chunk-XP23ZVQT.js → chunk-MVYAN2RR.js} +4 -4
- package/dist/{chunk-TBYCZRZ7.js → chunk-R5QZO3QY.js} +14 -5
- package/dist/{chunk-UORPTGV2.js → chunk-SIEEMXNZ.js} +10 -14
- package/dist/chunk-SJT6A4AV.js +354 -0
- package/dist/{chunk-FWS4YJ4B.js → chunk-STWHJLVV.js} +1 -1
- package/dist/{chunk-TYESCFYW.js → chunk-UDOBGAP7.js} +1 -1
- package/dist/{chunk-6K6EQOJF.js → chunk-VAOJVT7R.js} +1 -1
- package/dist/{chunk-VCOQ7WQ2.js → chunk-VMFC2UDJ.js} +1 -1
- package/dist/chunk-XQUF3WIS.js +159 -0
- package/dist/{chunk-7IPCLQ5V.js → chunk-YPTJETJQ.js} +2 -2
- package/dist/{chunk-X4GWB6AT.js → chunk-ZBSFGCWY.js} +2 -2
- package/dist/{chunk-YGJCJBPM.js → chunk-ZPH3WXJ6.js} +1 -1
- package/dist/{collections-URH2TCWJ.js → collections-HO2F62RN.js} +4 -5
- package/dist/{create-FKRYB7ZS.js → create-7EVR4N6N.js} +1 -1
- package/dist/{create-JF2OUZQA.js → create-DB4EYPJ5.js} +3 -4
- package/dist/{create-JGYG5SBM.js → create-EFMCNOR5.js} +6 -7
- package/dist/{create-MS6KKFSV.js → create-FBPPNBLQ.js} +3 -4
- package/dist/{create-ODOFJF5N.js → create-J5OLH7OJ.js} +7 -8
- package/dist/{create-O35JRZEF.js → create-QAEOARJO.js} +4 -5
- package/dist/{create-HVZYJ3YC.js → create-QZBCYHHQ.js} +8 -9
- package/dist/{create-A7B3MLJX.js → create-SLJ2BMH7.js} +5 -6
- package/dist/{create-7R6CZU53.js → create-WBZJFMA7.js} +12 -3
- package/dist/{create-GGACODDN.js → create-WQ5TM5IZ.js} +1 -1
- package/dist/{edit-4G5D7TES.js → edit-3O6WVIMM.js} +5 -6
- package/dist/{edit-VVLITC2E.js → edit-G57GESSR.js} +1 -1
- package/dist/edit-PUZ23M7V.js +102 -0
- package/dist/{edit-G2E5SNGU.js → edit-PVJ3S4TW.js} +3 -4
- package/dist/{edit-2R5QCPTB.js → edit-RJE7L3PH.js} +3 -4
- package/dist/{edit-HTLLYECP.js → edit-TIRMXOLT.js} +6 -7
- package/dist/{edit-5CROKEJE.js → edit-W6WKYNOG.js} +5 -6
- package/dist/{edit-OKU6FMHJ.js → edit-WPX2ANVI.js} +3 -4
- package/dist/{edit-3E4ZO7HT.js → edit-YW4RBDPH.js} +6 -7
- package/dist/edit-price-5ICQPJ42.js +196 -0
- package/dist/edit-stock-KS2NFC2Z.js +229 -0
- package/dist/{fulfillment-76IVZ266.js → fulfillment-ZV2R43N2.js} +3 -4
- package/dist/{fulfillment-providers-G2L6LEVO.js → fulfillment-providers-KKCL25KA.js} +4 -5
- package/dist/index.css +6 -6
- package/dist/index.js +142 -106
- package/dist/{offer-inventory-batch-page-BD6PMDLW.js → inventory-5UNDKYDL.js} +12 -12
- package/dist/{invite-2673PU4I.js → invite-KKIJNMER.js} +6 -7
- package/dist/{invite-HRXZ5YBP.js → invite-P7I5BGOJ.js} +3 -4
- package/dist/loader-UZTTBKYF.js +33 -0
- package/dist/loader-WEJZTX5Q.js +34 -0
- package/dist/{login-TWUBU6I6.js → login-A65IAXSI.js} +4 -5
- package/dist/{media-Z4N5MKFG.js → media-EM3K4AWO.js} +6 -7
- package/dist/{metadata-Q74OJWUD.js → metadata-A5XZKPL4.js} +4 -5
- package/dist/{metadata-D6M66NQK.js → metadata-JFLFWXOS.js} +3 -4
- package/dist/{metadata-YVHJPDLD.js → metadata-SFO3J5O5.js} +3 -4
- package/dist/{metadata-NIDIBXJT.js → metadata-USXOQUIX.js} +3 -4
- package/dist/{metadata-REQIFWWH.js → metadata-WJ4CNB6I.js} +3 -4
- package/dist/{offer-create-page-E4FLSDJQ.js → offer-create-page-3PIJXHWZ.js} +169 -173
- package/dist/offer-detail-page-SPHP3XKC.js +580 -0
- package/dist/{offer-detail-page-6SIBQTLP.js → offer-variant-detail-page-KTHKV6WW.js} +144 -215
- package/dist/offers-GWMIEPCM.js +54 -0
- package/dist/{onboarding-MK2RIFD4.js → onboarding-JOGRNDPI.js} +3 -4
- package/dist/{orders-TVQDR4OJ.js → orders-Q2IKEJIM.js} +4 -5
- package/dist/{organization-XO3T2K2X.js → organization-HRYDC66D.js} +3 -4
- package/dist/pages/index.js +25 -27
- package/dist/{payment-details-CFTX3QDL.js → payment-details-YLPIR52N.js} +3 -4
- package/dist/{pricing-ECXV6K7G.js → pricing-ECJH4VXZ.js} +5 -6
- package/dist/{offer-pricing-edit-page-4TINK42V.js → pricing-EPNQ63NT.js} +15 -13
- package/dist/{product-tags-5O7ZG6SA.js → product-tags-WMC7G3C4.js} +5 -6
- package/dist/{product-variant-detail-PUWOMVHQ.js → product-variant-detail-BQL2NGVE.js} +3 -4
- package/dist/{product-variant-edit-WZNO4CQX.js → product-variant-edit-GACQHD46.js} +9 -20
- package/dist/{products-CPTRYL2Z.js → products-LGQMESEZ.js} +10 -11
- package/dist/{products-BM3IIH5P.js → products-PQ3FG5KC.js} +4 -5
- package/dist/{professional-details-ED4HNYXY.js → professional-details-AASVGTUO.js} +3 -4
- package/dist/{profile-6TGCNNUU.js → profile-ZNQEDSDM.js} +3 -4
- package/dist/{promotions-4336KI7E.js → promotions-MFAFFHF3.js} +4 -4
- package/dist/{register-OZ5CRANZ.js → register-3A6G6QNI.js} +5 -6
- package/dist/{reset-password-5UHZU4D3.js → reset-password-FV5762CA.js} +1 -1
- package/dist/{settings-2GCQQTO6.js → settings-OKNGWUKL.js} +12 -13
- package/dist/{shipment-HWQHMX2L.js → shipment-ZF7IRKKS.js} +3 -4
- package/dist/shipping-HWJPX34K.js +113 -0
- package/dist/{shipping-profile-ZP7M6VSS.js → shipping-profile-3QKTQI6L.js} +2 -6
- package/dist/{shipping-profiles-C5WBXWZ2.js → shipping-profiles-FZCKGCBU.js} +3 -4
- package/dist/{stock-MQA7PRO6.js → stock-FI5WXVWN.js} +4 -5
- package/dist/{store-5ZHZR4JI.js → store-VFRKJYMD.js} +3 -4
- package/dist/{store-closure-H5WHV3LA.js → store-closure-WZIWGESD.js} +3 -4
- package/dist/{store-select-PZS556FB.js → store-select-GKRDFGEY.js} +4 -5
- package/dist/{team-CLKJCZNH.js → team-CXEAYN7O.js} +3 -4
- package/package.json +1 -1
- package/dist/chunk-27KRIXMQ.js +0 -71
- package/dist/chunk-CFRWIQIZ.js +0 -43
- package/dist/chunk-RXV7INUV.js +0 -426
- package/dist/chunk-T6LHVNWO.js +0 -27
- package/dist/loader-VDYPD3RI.js +0 -31
- package/dist/offer-edit-page-3MO566RP.js +0 -151
- package/dist/offers-GVN5LCK6.js +0 -32
- package/dist/{chunk-SPOHNK4X.js → chunk-BPVMJN2D.js} +3 -3
|
@@ -4,7 +4,17 @@ import {
|
|
|
4
4
|
ProductStatusCell,
|
|
5
5
|
ProductStatusHeader
|
|
6
6
|
} from "./chunk-U5G3AVED.js";
|
|
7
|
+
import {
|
|
8
|
+
useProductTableQuery
|
|
9
|
+
} from "./chunk-MJCL3WID.js";
|
|
10
|
+
import {
|
|
11
|
+
ProductCell,
|
|
12
|
+
ProductHeader
|
|
13
|
+
} from "./chunk-FWPGOIFA.js";
|
|
7
14
|
import "./chunk-FQERBIVS.js";
|
|
15
|
+
import {
|
|
16
|
+
useProductTableFilters
|
|
17
|
+
} from "./chunk-DEJIBIQZ.js";
|
|
8
18
|
import "./chunk-DB6ANJBO.js";
|
|
9
19
|
import {
|
|
10
20
|
PlaceholderCell
|
|
@@ -21,7 +31,7 @@ import {
|
|
|
21
31
|
createDataGridHelper,
|
|
22
32
|
createDataGridLocationStockColumns,
|
|
23
33
|
createDataGridPriceColumns
|
|
24
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-DNEPOMOX.js";
|
|
25
35
|
import {
|
|
26
36
|
defineTabMeta
|
|
27
37
|
} from "./chunk-LEWA4BPH.js";
|
|
@@ -36,36 +46,50 @@ import {
|
|
|
36
46
|
useRouteModal
|
|
37
47
|
} from "./chunk-GDWBOQI5.js";
|
|
38
48
|
import "./chunk-3QSRE5LS.js";
|
|
39
|
-
import
|
|
40
|
-
useQueryParams
|
|
41
|
-
} from "./chunk-THHRRYRS.js";
|
|
49
|
+
import "./chunk-THHRRYRS.js";
|
|
42
50
|
import "./chunk-LRD242C7.js";
|
|
43
51
|
import "./chunk-UCYSCKZV.js";
|
|
44
52
|
import {
|
|
45
53
|
Thumbnail
|
|
46
54
|
} from "./chunk-WIYFXWRI.js";
|
|
47
55
|
import "./chunk-INNFZYX2.js";
|
|
56
|
+
import "./chunk-R5QZO3QY.js";
|
|
57
|
+
import "./chunk-F4OJN2F2.js";
|
|
58
|
+
import "./chunk-LRARA622.js";
|
|
59
|
+
import "./chunk-M6N4ISXL.js";
|
|
60
|
+
import "./chunk-S7EKBD2C.js";
|
|
61
|
+
import "./chunk-VV6IKGCN.js";
|
|
62
|
+
import "./chunk-BXRNZS5K.js";
|
|
63
|
+
import "./chunk-BOZJOOGW.js";
|
|
48
64
|
import {
|
|
49
|
-
|
|
50
|
-
} from "./chunk-
|
|
65
|
+
useShippingProfiles
|
|
66
|
+
} from "./chunk-IQWK723D.js";
|
|
51
67
|
import {
|
|
52
68
|
usePricePreferences
|
|
53
69
|
} from "./chunk-4S6XGIC6.js";
|
|
54
70
|
import {
|
|
55
71
|
useCurrentSeller
|
|
56
72
|
} from "./chunk-S23FD6FA.js";
|
|
57
|
-
import
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
import "./chunk-DDJQRV6E.js";
|
|
74
|
+
import "./chunk-LWJF63JW.js";
|
|
75
|
+
import "./chunk-VXWN37PT.js";
|
|
76
|
+
import "./chunk-5QI3NDJG.js";
|
|
77
|
+
import "./chunk-VZUA5SRD.js";
|
|
78
|
+
import "./chunk-VXMOPVRH.js";
|
|
60
79
|
import {
|
|
61
80
|
useStockLocations
|
|
62
81
|
} from "./chunk-NBPMNUKZ.js";
|
|
63
82
|
import {
|
|
64
83
|
useBulkCreateOffers
|
|
65
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-SIEEMXNZ.js";
|
|
85
|
+
import "./chunk-Y2MQ5EMD.js";
|
|
86
|
+
import "./chunk-3B34B2M2.js";
|
|
66
87
|
import "./chunk-LAVHRER2.js";
|
|
67
88
|
import "./chunk-QHQWEERJ.js";
|
|
68
89
|
import "./chunk-Y7QKP6QU.js";
|
|
90
|
+
import {
|
|
91
|
+
useProducts
|
|
92
|
+
} from "./chunk-JAUZ73XE.js";
|
|
69
93
|
import "./chunk-A5DJIOHN.js";
|
|
70
94
|
import "./chunk-RHKRREUU.js";
|
|
71
95
|
import "./chunk-ZA2KFUFR.js";
|
|
@@ -80,7 +104,7 @@ import { useForm } from "react-hook-form";
|
|
|
80
104
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
81
105
|
|
|
82
106
|
// src/pages/offers/create/create-offer-form/create-offer-catalogue.tsx
|
|
83
|
-
import { Checkbox } from "@medusajs/ui";
|
|
107
|
+
import { Checkbox, Text } from "@medusajs/ui";
|
|
84
108
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
85
109
|
import {
|
|
86
110
|
createColumnHelper
|
|
@@ -88,81 +112,23 @@ import {
|
|
|
88
112
|
import { useEffect, useMemo, useState } from "react";
|
|
89
113
|
import { useFormContext } from "react-hook-form";
|
|
90
114
|
import { useTranslation } from "react-i18next";
|
|
91
|
-
|
|
92
|
-
// src/hooks/table/query/use-product-variants-table-query.tsx
|
|
93
|
-
var DEFAULT_FIELDS = "*options,*inventory_items,*inventory_items.inventory,*inventory_items.inventory.location_levels";
|
|
94
|
-
var useProductVariantsTableQuery = ({
|
|
95
|
-
prefix,
|
|
96
|
-
pageSize = 10
|
|
97
|
-
}) => {
|
|
98
|
-
const queryObject = useQueryParams(
|
|
99
|
-
[
|
|
100
|
-
"offset",
|
|
101
|
-
"order",
|
|
102
|
-
"q",
|
|
103
|
-
"id",
|
|
104
|
-
"sku",
|
|
105
|
-
"title",
|
|
106
|
-
"manage_inventory",
|
|
107
|
-
"allow_backorder",
|
|
108
|
-
"created_at",
|
|
109
|
-
"updated_at"
|
|
110
|
-
],
|
|
111
|
-
prefix
|
|
112
|
-
);
|
|
113
|
-
const {
|
|
114
|
-
offset,
|
|
115
|
-
order,
|
|
116
|
-
q,
|
|
117
|
-
id,
|
|
118
|
-
sku,
|
|
119
|
-
title,
|
|
120
|
-
manage_inventory,
|
|
121
|
-
allow_backorder,
|
|
122
|
-
created_at,
|
|
123
|
-
updated_at
|
|
124
|
-
} = queryObject;
|
|
125
|
-
const searchParams = {
|
|
126
|
-
limit: pageSize,
|
|
127
|
-
offset: offset ? Number(offset) : 0,
|
|
128
|
-
fields: DEFAULT_FIELDS,
|
|
129
|
-
order,
|
|
130
|
-
q,
|
|
131
|
-
id: id ? id.split(",") : void 0,
|
|
132
|
-
sku: sku ? sku.split(",") : void 0,
|
|
133
|
-
title: title ? title.split(",") : void 0,
|
|
134
|
-
manage_inventory: manage_inventory ? manage_inventory === "true" : void 0,
|
|
135
|
-
allow_backorder: allow_backorder ? allow_backorder === "true" : void 0,
|
|
136
|
-
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
137
|
-
updated_at: updated_at ? JSON.parse(updated_at) : void 0
|
|
138
|
-
};
|
|
139
|
-
return {
|
|
140
|
-
searchParams,
|
|
141
|
-
raw: queryObject
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// src/pages/offers/create/create-offer-form/create-offer-catalogue.tsx
|
|
146
115
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
147
116
|
var PAGE_SIZE = 10;
|
|
148
117
|
var FIELDS = [
|
|
149
118
|
"id",
|
|
150
119
|
"title",
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"product.status",
|
|
159
|
-
"product.categories.id",
|
|
160
|
-
"product.categories.name"
|
|
120
|
+
"handle",
|
|
121
|
+
"status",
|
|
122
|
+
"thumbnail",
|
|
123
|
+
"*collection",
|
|
124
|
+
"categories.id",
|
|
125
|
+
"categories.name",
|
|
126
|
+
"variants.id"
|
|
161
127
|
].join(",");
|
|
162
128
|
var Root = () => {
|
|
163
129
|
const { t } = useTranslation();
|
|
164
130
|
const form = useFormContext();
|
|
165
|
-
const initialSelection = (form.getValues("
|
|
131
|
+
const initialSelection = (form.getValues("selected_product_ids") ?? []).reduce(
|
|
166
132
|
(acc, id) => {
|
|
167
133
|
acc[id] = true;
|
|
168
134
|
return acc;
|
|
@@ -174,28 +140,21 @@ var Root = () => {
|
|
|
174
140
|
const state = typeof fn === "function" ? fn(rowSelection) : fn;
|
|
175
141
|
setRowSelection(state);
|
|
176
142
|
const ids = Object.keys(state);
|
|
177
|
-
form.setValue("
|
|
143
|
+
form.setValue("selected_product_ids", ids, {
|
|
178
144
|
shouldDirty: true,
|
|
179
145
|
shouldTouch: true,
|
|
180
146
|
shouldValidate: true
|
|
181
147
|
});
|
|
182
148
|
};
|
|
183
|
-
const { searchParams, raw } =
|
|
184
|
-
|
|
185
|
-
});
|
|
186
|
-
const {
|
|
187
|
-
variants,
|
|
188
|
-
count,
|
|
189
|
-
isPending: isLoading,
|
|
190
|
-
isError,
|
|
191
|
-
error
|
|
192
|
-
} = useVariants(
|
|
149
|
+
const { searchParams, raw } = useProductTableQuery({ pageSize: PAGE_SIZE });
|
|
150
|
+
const { products, count, isLoading, isError, error } = useProducts(
|
|
193
151
|
{ ...searchParams, fields: FIELDS },
|
|
194
152
|
{ placeholderData: keepPreviousData }
|
|
195
153
|
);
|
|
154
|
+
const filters = useProductTableFilters();
|
|
196
155
|
const columns = useColumns();
|
|
197
156
|
const { table } = useDataTable({
|
|
198
|
-
data:
|
|
157
|
+
data: products ?? [],
|
|
199
158
|
columns,
|
|
200
159
|
enablePagination: true,
|
|
201
160
|
enableRowSelection: true,
|
|
@@ -208,7 +167,7 @@ var Root = () => {
|
|
|
208
167
|
}
|
|
209
168
|
});
|
|
210
169
|
useEffect(() => {
|
|
211
|
-
void form.trigger("
|
|
170
|
+
void form.trigger("selected_product_ids");
|
|
212
171
|
}, [rowSelection, form]);
|
|
213
172
|
if (isError) {
|
|
214
173
|
throw error;
|
|
@@ -227,6 +186,7 @@ var Root = () => {
|
|
|
227
186
|
columns,
|
|
228
187
|
pageSize: PAGE_SIZE,
|
|
229
188
|
isLoading,
|
|
189
|
+
filters,
|
|
230
190
|
orderBy: [
|
|
231
191
|
{ key: "title", label: t("fields.title") },
|
|
232
192
|
{ key: "created_at", label: t("fields.createdAt") },
|
|
@@ -238,7 +198,11 @@ var Root = () => {
|
|
|
238
198
|
search: "autofocus"
|
|
239
199
|
}
|
|
240
200
|
),
|
|
241
|
-
/* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle
|
|
201
|
+
/* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle border-t px-6 py-4", children: /* @__PURE__ */ jsxs("p", { className: "border-ui-border-strong txt-small text-ui-fg-subtle border-l-2 pl-3", children: [
|
|
202
|
+
/* @__PURE__ */ jsx("span", { className: "text-ui-fg-base font-medium", children: t("offers.create.tipLabel") }),
|
|
203
|
+
" ",
|
|
204
|
+
t("offers.create.tip")
|
|
205
|
+
] }) })
|
|
242
206
|
]
|
|
243
207
|
}
|
|
244
208
|
);
|
|
@@ -269,52 +233,44 @@ var useColumns = () => {
|
|
|
269
233
|
)
|
|
270
234
|
}),
|
|
271
235
|
columnHelper.display({
|
|
272
|
-
id: "
|
|
273
|
-
header:
|
|
274
|
-
cell: ({ row }) =>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
236
|
+
id: "product",
|
|
237
|
+
header: () => /* @__PURE__ */ jsx(ProductHeader, {}),
|
|
238
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(
|
|
239
|
+
ProductCell,
|
|
240
|
+
{
|
|
241
|
+
product: {
|
|
242
|
+
title: row.original.title ?? "",
|
|
243
|
+
thumbnail: row.original.thumbnail ?? null
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
)
|
|
283
247
|
}),
|
|
284
248
|
columnHelper.display({
|
|
285
249
|
id: "categories",
|
|
286
250
|
header: () => /* @__PURE__ */ jsx(CategoryHeader, {}),
|
|
287
|
-
cell: ({ row }) => /* @__PURE__ */ jsx(CategoryCell, { categories: row.original.
|
|
251
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(CategoryCell, { categories: row.original.categories })
|
|
288
252
|
}),
|
|
289
|
-
columnHelper.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}),
|
|
297
|
-
columnHelper.accessor("ean", {
|
|
298
|
-
header: t("offers.fields.ean"),
|
|
299
|
-
cell: ({ getValue }) => {
|
|
300
|
-
const value = getValue();
|
|
301
|
-
if (!value) return /* @__PURE__ */ jsx(PlaceholderCell, {});
|
|
302
|
-
return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: value }) });
|
|
253
|
+
columnHelper.display({
|
|
254
|
+
id: "collection",
|
|
255
|
+
header: t("fields.collection"),
|
|
256
|
+
cell: ({ row }) => {
|
|
257
|
+
const title = row.original.collection?.title;
|
|
258
|
+
if (!title) return /* @__PURE__ */ jsx(PlaceholderCell, {});
|
|
259
|
+
return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: title });
|
|
303
260
|
}
|
|
304
261
|
}),
|
|
305
|
-
columnHelper.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
262
|
+
columnHelper.display({
|
|
263
|
+
id: "variants",
|
|
264
|
+
header: t("offers.fields.variants"),
|
|
265
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: t("offers.fields.variantsCount", {
|
|
266
|
+
count: row.original.variants?.length ?? 0
|
|
267
|
+
}) })
|
|
312
268
|
}),
|
|
313
269
|
columnHelper.display({
|
|
314
270
|
id: "status",
|
|
315
271
|
header: () => /* @__PURE__ */ jsx(ProductStatusHeader, {}),
|
|
316
272
|
cell: ({ row }) => {
|
|
317
|
-
const status = row.original.
|
|
273
|
+
const status = row.original.status;
|
|
318
274
|
if (!status) return /* @__PURE__ */ jsx(PlaceholderCell, {});
|
|
319
275
|
return /* @__PURE__ */ jsx(ProductStatusCell, { status });
|
|
320
276
|
}
|
|
@@ -326,7 +282,7 @@ var useColumns = () => {
|
|
|
326
282
|
Root._tabMeta = defineTabMeta({
|
|
327
283
|
id: "catalogue",
|
|
328
284
|
labelKey: "offers.create.tabs.catalogue",
|
|
329
|
-
validationFields: ["
|
|
285
|
+
validationFields: ["selected_product_ids"]
|
|
330
286
|
});
|
|
331
287
|
var CreateOfferCatalogueTab = Root;
|
|
332
288
|
|
|
@@ -335,6 +291,7 @@ import { useMemo as useMemo2 } from "react";
|
|
|
335
291
|
import { useFormContext as useFormContext2, useWatch } from "react-hook-form";
|
|
336
292
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
337
293
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
294
|
+
var isGroup = (row) => row.__group === true;
|
|
338
295
|
var Root2 = () => {
|
|
339
296
|
const form = useFormContext2();
|
|
340
297
|
const { setCloseOnEscape } = useRouteModal();
|
|
@@ -346,6 +303,22 @@ var Root2 = () => {
|
|
|
346
303
|
control: form.control,
|
|
347
304
|
name: "variants"
|
|
348
305
|
});
|
|
306
|
+
const gridData = useMemo2(() => {
|
|
307
|
+
const rows = [];
|
|
308
|
+
let lastProductId;
|
|
309
|
+
(variants ?? []).forEach((variant, index) => {
|
|
310
|
+
if (variant.product_id !== lastProductId) {
|
|
311
|
+
rows.push({
|
|
312
|
+
__group: true,
|
|
313
|
+
id: `group-${variant.product_id}`,
|
|
314
|
+
product_title: variant.product_title
|
|
315
|
+
});
|
|
316
|
+
lastProductId = variant.product_id;
|
|
317
|
+
}
|
|
318
|
+
rows.push({ ...variant, __group: false, __formIndex: index });
|
|
319
|
+
});
|
|
320
|
+
return rows;
|
|
321
|
+
}, [variants]);
|
|
349
322
|
const columns = useColumns2({
|
|
350
323
|
currencyCode: currency_code,
|
|
351
324
|
stockLocations: stock_locations,
|
|
@@ -361,7 +334,7 @@ var Root2 = () => {
|
|
|
361
334
|
DataGrid,
|
|
362
335
|
{
|
|
363
336
|
columns,
|
|
364
|
-
data:
|
|
337
|
+
data: gridData,
|
|
365
338
|
state: form,
|
|
366
339
|
onEditingChange: (editing) => setCloseOnEscape(!editing)
|
|
367
340
|
}
|
|
@@ -388,10 +361,20 @@ var useColumns2 = ({
|
|
|
388
361
|
id: "title",
|
|
389
362
|
header: t("fields.title"),
|
|
390
363
|
cell: (context) => {
|
|
391
|
-
const
|
|
392
|
-
|
|
364
|
+
const row = context.row.original;
|
|
365
|
+
if (isGroup(row)) {
|
|
366
|
+
return /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsx2(
|
|
367
|
+
"span",
|
|
368
|
+
{
|
|
369
|
+
className: "text-ui-fg-subtle truncate font-medium",
|
|
370
|
+
title: row.product_title,
|
|
371
|
+
children: row.product_title
|
|
372
|
+
}
|
|
373
|
+
) });
|
|
374
|
+
}
|
|
375
|
+
const title = row.variant_title || "";
|
|
393
376
|
return /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsxs2("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
|
|
394
|
-
/* @__PURE__ */ jsx2(Thumbnail, { src:
|
|
377
|
+
/* @__PURE__ */ jsx2(Thumbnail, { src: row.product_thumbnail ?? null }),
|
|
395
378
|
/* @__PURE__ */ jsx2("span", { className: "truncate", title, children: title })
|
|
396
379
|
] }) });
|
|
397
380
|
},
|
|
@@ -401,40 +384,52 @@ var useColumns2 = ({
|
|
|
401
384
|
id: "sku",
|
|
402
385
|
name: t("fields.sku"),
|
|
403
386
|
header: t("fields.sku"),
|
|
404
|
-
field: (context) =>
|
|
387
|
+
field: (context) => {
|
|
388
|
+
const row = context.row.original;
|
|
389
|
+
return isGroup(row) ? null : `variants.${row.__formIndex}.sku`;
|
|
390
|
+
},
|
|
405
391
|
type: "text",
|
|
406
|
-
cell: (context) => /* @__PURE__ */ jsx2(DataGrid.TextCell, { context })
|
|
392
|
+
cell: (context) => isGroup(context.row.original) ? /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context }) : /* @__PURE__ */ jsx2(DataGrid.TextCell, { context })
|
|
407
393
|
}),
|
|
408
394
|
columnHelper2.column({
|
|
409
395
|
id: "shipping_profile",
|
|
410
|
-
name: t("shippingProfile
|
|
411
|
-
header: t("shippingProfile
|
|
412
|
-
field: (context) =>
|
|
396
|
+
name: t("offers.fields.shippingProfile"),
|
|
397
|
+
header: t("offers.fields.shippingProfile"),
|
|
398
|
+
field: (context) => {
|
|
399
|
+
const row = context.row.original;
|
|
400
|
+
return isGroup(row) ? null : `variants.${row.__formIndex}.shipping_profile_id`;
|
|
401
|
+
},
|
|
413
402
|
type: "select",
|
|
414
|
-
cell: (context) => /* @__PURE__ */ jsx2(
|
|
403
|
+
cell: (context) => isGroup(context.row.original) ? /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context }) : /* @__PURE__ */ jsx2(
|
|
415
404
|
DataGrid.SelectCell,
|
|
416
405
|
{
|
|
417
406
|
context,
|
|
418
407
|
options: shippingProfileOptions,
|
|
419
|
-
placeholder:
|
|
408
|
+
placeholder: ""
|
|
420
409
|
}
|
|
421
410
|
)
|
|
422
411
|
}),
|
|
423
412
|
...createDataGridLocationStockColumns({
|
|
424
413
|
stockLocations,
|
|
414
|
+
isReadyOnly: (context) => isGroup(context.row.original),
|
|
425
415
|
getFieldName: (context, index) => {
|
|
416
|
+
const row = context.row.original;
|
|
417
|
+
if (isGroup(row)) return null;
|
|
426
418
|
const location = stockLocations[index];
|
|
427
419
|
if (!location) return null;
|
|
428
|
-
return `variants.${
|
|
420
|
+
return `variants.${row.__formIndex}.inventory.${location.id}`;
|
|
429
421
|
},
|
|
430
422
|
t
|
|
431
423
|
}),
|
|
432
424
|
...createDataGridPriceColumns({
|
|
433
425
|
currencies,
|
|
434
426
|
pricePreferences,
|
|
427
|
+
isReadyOnly: (context) => isGroup(context.row.original),
|
|
435
428
|
getFieldName: (context, value) => {
|
|
429
|
+
const row = context.row.original;
|
|
430
|
+
if (isGroup(row)) return null;
|
|
436
431
|
if (context.column.id?.startsWith("currency_prices")) {
|
|
437
|
-
return `variants.${
|
|
432
|
+
return `variants.${row.__formIndex}.prices.${value}`;
|
|
438
433
|
}
|
|
439
434
|
return null;
|
|
440
435
|
},
|
|
@@ -471,7 +466,9 @@ var VariantRowSchema = z.object({
|
|
|
471
466
|
).default({})
|
|
472
467
|
});
|
|
473
468
|
var CreateOfferSchema = z.object({
|
|
474
|
-
|
|
469
|
+
// The catalogue tab selects whole products (SPEC-009); the stock &
|
|
470
|
+
// prices tab fans them out to their variants.
|
|
471
|
+
selected_product_ids: z.array(z.string().min(1)).min(1),
|
|
475
472
|
variants: z.array(VariantRowSchema).min(1)
|
|
476
473
|
});
|
|
477
474
|
var numericOrZero = (v) => {
|
|
@@ -502,7 +499,7 @@ var variantRowRequiresSku = (row) => {
|
|
|
502
499
|
// src/pages/offers/create/create-offer-form/create-offer-form.tsx
|
|
503
500
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
504
501
|
var DEFAULTS = {
|
|
505
|
-
|
|
502
|
+
selected_product_ids: [],
|
|
506
503
|
variants: []
|
|
507
504
|
};
|
|
508
505
|
var numericOrZero2 = (v) => {
|
|
@@ -540,19 +537,18 @@ var CreateOfferForm = () => {
|
|
|
540
537
|
const { currency_code } = useCurrentSeller();
|
|
541
538
|
const { stock_locations } = useStockLocations({ limit: 100 });
|
|
542
539
|
const locationIds = (stock_locations ?? []).map((l) => l.id);
|
|
543
|
-
const
|
|
544
|
-
const
|
|
540
|
+
const selectedProductIds = form.watch("selected_product_ids") ?? [];
|
|
541
|
+
const selectedProductIdsKey = selectedProductIds.join(",");
|
|
545
542
|
const locationsKey = locationIds.join(",");
|
|
546
|
-
const {
|
|
543
|
+
const { products: fetchedProducts } = useProducts(
|
|
547
544
|
{
|
|
548
|
-
id:
|
|
549
|
-
limit:
|
|
550
|
-
fields: "id,title,
|
|
545
|
+
id: selectedProductIds,
|
|
546
|
+
limit: selectedProductIds.length || 1,
|
|
547
|
+
fields: "id,title,thumbnail,variants.id,variants.title,variants.sku"
|
|
551
548
|
},
|
|
552
|
-
{ enabled:
|
|
549
|
+
{ enabled: selectedProductIds.length > 0 }
|
|
553
550
|
);
|
|
554
551
|
useEffect2(() => {
|
|
555
|
-
const ids = selectedVariantIdsKey ? selectedVariantIdsKey.split(",") : [];
|
|
556
552
|
const locIds = locationsKey ? locationsKey.split(",") : [];
|
|
557
553
|
const emptyPrices = currency_code ? { [currency_code]: "" } : {};
|
|
558
554
|
const emptyInventory = locIds.reduce((acc, locId) => {
|
|
@@ -564,35 +560,35 @@ var CreateOfferForm = () => {
|
|
|
564
560
|
existing.map((row) => [row.variant_id, row])
|
|
565
561
|
);
|
|
566
562
|
const next = [];
|
|
567
|
-
for (const
|
|
568
|
-
const
|
|
569
|
-
|
|
563
|
+
for (const product of fetchedProducts ?? []) {
|
|
564
|
+
for (const variant of product.variants ?? []) {
|
|
565
|
+
const previous = existingByVariantId.get(variant.id);
|
|
566
|
+
if (previous) {
|
|
567
|
+
next.push({
|
|
568
|
+
...previous,
|
|
569
|
+
prices: { ...emptyPrices, ...previous.prices ?? {} },
|
|
570
|
+
inventory: { ...emptyInventory, ...previous.inventory ?? {} }
|
|
571
|
+
});
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
570
574
|
next.push({
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
575
|
+
variant_id: variant.id,
|
|
576
|
+
product_id: product.id ?? "",
|
|
577
|
+
product_title: product.title ?? "",
|
|
578
|
+
variant_title: variant.title ?? variant.id,
|
|
579
|
+
product_thumbnail: product.thumbnail ?? null,
|
|
580
|
+
variant_sku: variant.sku ?? null,
|
|
581
|
+
sku: variant.sku ?? "",
|
|
582
|
+
shipping_profile_id: "",
|
|
583
|
+
prices: { ...emptyPrices },
|
|
584
|
+
inventory: { ...emptyInventory }
|
|
574
585
|
});
|
|
575
|
-
continue;
|
|
576
586
|
}
|
|
577
|
-
const fetched = (fetchedVariants ?? []).find((v) => v.id === variantId);
|
|
578
|
-
if (!fetched) continue;
|
|
579
|
-
next.push({
|
|
580
|
-
variant_id: variantId,
|
|
581
|
-
product_id: fetched.product_id ?? fetched.product?.id ?? "",
|
|
582
|
-
product_title: fetched.product?.title ?? "",
|
|
583
|
-
variant_title: fetched.title ?? variantId,
|
|
584
|
-
product_thumbnail: fetched.product?.thumbnail ?? null,
|
|
585
|
-
variant_sku: fetched.sku ?? null,
|
|
586
|
-
sku: fetched.sku ?? "",
|
|
587
|
-
shipping_profile_id: "",
|
|
588
|
-
prices: { ...emptyPrices },
|
|
589
|
-
inventory: { ...emptyInventory }
|
|
590
|
-
});
|
|
591
587
|
}
|
|
592
588
|
form.setValue("variants", next, { shouldDirty: false });
|
|
593
589
|
}, [
|
|
594
|
-
|
|
595
|
-
|
|
590
|
+
selectedProductIdsKey,
|
|
591
|
+
fetchedProducts,
|
|
596
592
|
currency_code,
|
|
597
593
|
locationsKey,
|
|
598
594
|
form
|
|
@@ -715,7 +711,7 @@ var CreateOfferForm = () => {
|
|
|
715
711
|
variant: "primary",
|
|
716
712
|
size: "small",
|
|
717
713
|
onClick: () => onNext(),
|
|
718
|
-
disabled: (form.watch("
|
|
714
|
+
disabled: (form.watch("selected_product_ids")?.length ?? 0) === 0,
|
|
719
715
|
children: t("actions.continue")
|
|
720
716
|
},
|
|
721
717
|
"next-button"
|