@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.
Files changed (121) hide show
  1. package/dist/{[id]-EKLRGVBA.js → [id]-ET35KT2M.js} +3 -3
  2. package/dist/{[id]-A55T2ORL.js → [id]-FALIOGXK.js} +3 -4
  3. package/dist/{[id]-GC3ZYPK4.js → [id]-GY5R652O.js} +5 -6
  4. package/dist/{[id]-GBT6VB4S.js → [id]-IGQTT3AM.js} +4 -5
  5. package/dist/{[id]-SHAJTJNZ.js → [id]-IW2AZE77.js} +5 -6
  6. package/dist/{[id]-FE5GYYVZ.js → [id]-OTK2NOXT.js} +3 -4
  7. package/dist/{[id]-U5KZEQDR.js → [id]-PEUI67SP.js} +2 -2
  8. package/dist/{[id]-T5ECVBPF.js → [id]-RFEYRBLI.js} +4 -5
  9. package/dist/{[id]-B4YZTANM.js → [id]-US6IULL2.js} +205 -484
  10. package/dist/{[id]-QOEO3JOV.js → [id]-YZSVSJWU.js} +3 -4
  11. package/dist/{[id]-QQU5HVFU.js → [id]-ZMLS73X5.js} +4 -5
  12. package/dist/{[province_id]-6GUA4PV5.js → [province_id]-J3OB2LZ4.js} +5 -6
  13. package/dist/{add-NTRYWOJF.js → add-XEUXK63F.js} +6 -7
  14. package/dist/{add-customer-groups-U5RZWW4B.js → add-customer-groups-HZNWWRVG.js} +3 -4
  15. package/dist/{add-products-Q4MMDQKT.js → add-products-E5GULF6B.js} +4 -5
  16. package/dist/{add-promotions-3AYXQXTP.js → add-promotions-KW5YZHLS.js} +3 -3
  17. package/dist/{address-77Y3AOQ3.js → address-6T4H6P7O.js} +3 -4
  18. package/dist/{breadcrumb-EVZIOB2G.js → breadcrumb-5HYIEPCL.js} +3 -4
  19. package/dist/{breadcrumb-TNJSGX4T.js → breadcrumb-HL7NKNX4.js} +3 -4
  20. package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-L3MFH4I2.js} +9 -8
  21. package/dist/{breadcrumb-5NP23D6X.js → breadcrumb-LKLWHB63.js} +4 -5
  22. package/dist/breadcrumb-ZMACILH3.js +28 -0
  23. package/dist/chunk-4WCPN4OA.js +315 -0
  24. package/dist/{chunk-LDZCCWJB.js → chunk-5YCDZ4AU.js} +1 -1
  25. package/dist/{chunk-OYKUQXJX.js → chunk-A6QH53CS.js} +21 -10
  26. package/dist/{chunk-GN6KB75Z.js → chunk-AQTEEQWX.js} +1 -1
  27. package/dist/{chunk-K6LOZ4S3.js → chunk-DEJIBIQZ.js} +1 -1
  28. package/dist/{chunk-4LVP635F.js → chunk-DNEPOMOX.js} +125 -125
  29. package/dist/{chunk-25E4KME5.js → chunk-J7ZU2HZZ.js} +1 -1
  30. package/dist/{chunk-OZ44ATGE.js → chunk-KJWVLGXG.js} +2 -2
  31. package/dist/{chunk-LKUW5SV4.js → chunk-LDX23XPT.js} +1 -1
  32. package/dist/{chunk-XP23ZVQT.js → chunk-MVYAN2RR.js} +4 -4
  33. package/dist/{chunk-TBYCZRZ7.js → chunk-R5QZO3QY.js} +14 -5
  34. package/dist/{chunk-UORPTGV2.js → chunk-SIEEMXNZ.js} +10 -14
  35. package/dist/chunk-SJT6A4AV.js +354 -0
  36. package/dist/{chunk-FWS4YJ4B.js → chunk-STWHJLVV.js} +1 -1
  37. package/dist/{chunk-TYESCFYW.js → chunk-UDOBGAP7.js} +1 -1
  38. package/dist/{chunk-6K6EQOJF.js → chunk-VAOJVT7R.js} +1 -1
  39. package/dist/{chunk-VCOQ7WQ2.js → chunk-VMFC2UDJ.js} +1 -1
  40. package/dist/chunk-XQUF3WIS.js +159 -0
  41. package/dist/{chunk-7IPCLQ5V.js → chunk-YPTJETJQ.js} +2 -2
  42. package/dist/{chunk-X4GWB6AT.js → chunk-ZBSFGCWY.js} +2 -2
  43. package/dist/{chunk-YGJCJBPM.js → chunk-ZPH3WXJ6.js} +1 -1
  44. package/dist/{collections-URH2TCWJ.js → collections-HO2F62RN.js} +4 -5
  45. package/dist/{create-FKRYB7ZS.js → create-7EVR4N6N.js} +1 -1
  46. package/dist/{create-JF2OUZQA.js → create-DB4EYPJ5.js} +3 -4
  47. package/dist/{create-JGYG5SBM.js → create-EFMCNOR5.js} +6 -7
  48. package/dist/{create-MS6KKFSV.js → create-FBPPNBLQ.js} +3 -4
  49. package/dist/{create-ODOFJF5N.js → create-J5OLH7OJ.js} +7 -8
  50. package/dist/{create-O35JRZEF.js → create-QAEOARJO.js} +4 -5
  51. package/dist/{create-HVZYJ3YC.js → create-QZBCYHHQ.js} +8 -9
  52. package/dist/{create-A7B3MLJX.js → create-SLJ2BMH7.js} +5 -6
  53. package/dist/{create-7R6CZU53.js → create-WBZJFMA7.js} +12 -3
  54. package/dist/{create-GGACODDN.js → create-WQ5TM5IZ.js} +1 -1
  55. package/dist/{edit-4G5D7TES.js → edit-3O6WVIMM.js} +5 -6
  56. package/dist/{edit-VVLITC2E.js → edit-G57GESSR.js} +1 -1
  57. package/dist/edit-PUZ23M7V.js +102 -0
  58. package/dist/{edit-G2E5SNGU.js → edit-PVJ3S4TW.js} +3 -4
  59. package/dist/{edit-2R5QCPTB.js → edit-RJE7L3PH.js} +3 -4
  60. package/dist/{edit-HTLLYECP.js → edit-TIRMXOLT.js} +6 -7
  61. package/dist/{edit-5CROKEJE.js → edit-W6WKYNOG.js} +5 -6
  62. package/dist/{edit-OKU6FMHJ.js → edit-WPX2ANVI.js} +3 -4
  63. package/dist/{edit-3E4ZO7HT.js → edit-YW4RBDPH.js} +6 -7
  64. package/dist/edit-price-5ICQPJ42.js +196 -0
  65. package/dist/edit-stock-KS2NFC2Z.js +229 -0
  66. package/dist/{fulfillment-76IVZ266.js → fulfillment-ZV2R43N2.js} +3 -4
  67. package/dist/{fulfillment-providers-G2L6LEVO.js → fulfillment-providers-KKCL25KA.js} +4 -5
  68. package/dist/index.css +6 -6
  69. package/dist/index.js +142 -106
  70. package/dist/{offer-inventory-batch-page-BD6PMDLW.js → inventory-5UNDKYDL.js} +12 -12
  71. package/dist/{invite-2673PU4I.js → invite-KKIJNMER.js} +6 -7
  72. package/dist/{invite-HRXZ5YBP.js → invite-P7I5BGOJ.js} +3 -4
  73. package/dist/loader-UZTTBKYF.js +33 -0
  74. package/dist/loader-WEJZTX5Q.js +34 -0
  75. package/dist/{login-TWUBU6I6.js → login-A65IAXSI.js} +4 -5
  76. package/dist/{media-Z4N5MKFG.js → media-EM3K4AWO.js} +6 -7
  77. package/dist/{metadata-Q74OJWUD.js → metadata-A5XZKPL4.js} +4 -5
  78. package/dist/{metadata-D6M66NQK.js → metadata-JFLFWXOS.js} +3 -4
  79. package/dist/{metadata-YVHJPDLD.js → metadata-SFO3J5O5.js} +3 -4
  80. package/dist/{metadata-NIDIBXJT.js → metadata-USXOQUIX.js} +3 -4
  81. package/dist/{metadata-REQIFWWH.js → metadata-WJ4CNB6I.js} +3 -4
  82. package/dist/{offer-create-page-E4FLSDJQ.js → offer-create-page-3PIJXHWZ.js} +169 -173
  83. package/dist/offer-detail-page-SPHP3XKC.js +580 -0
  84. package/dist/{offer-detail-page-6SIBQTLP.js → offer-variant-detail-page-KTHKV6WW.js} +144 -215
  85. package/dist/offers-GWMIEPCM.js +54 -0
  86. package/dist/{onboarding-MK2RIFD4.js → onboarding-JOGRNDPI.js} +3 -4
  87. package/dist/{orders-TVQDR4OJ.js → orders-Q2IKEJIM.js} +4 -5
  88. package/dist/{organization-XO3T2K2X.js → organization-HRYDC66D.js} +3 -4
  89. package/dist/pages/index.js +25 -27
  90. package/dist/{payment-details-CFTX3QDL.js → payment-details-YLPIR52N.js} +3 -4
  91. package/dist/{pricing-ECXV6K7G.js → pricing-ECJH4VXZ.js} +5 -6
  92. package/dist/{offer-pricing-edit-page-4TINK42V.js → pricing-EPNQ63NT.js} +15 -13
  93. package/dist/{product-tags-5O7ZG6SA.js → product-tags-WMC7G3C4.js} +5 -6
  94. package/dist/{product-variant-detail-PUWOMVHQ.js → product-variant-detail-BQL2NGVE.js} +3 -4
  95. package/dist/{product-variant-edit-WZNO4CQX.js → product-variant-edit-GACQHD46.js} +9 -20
  96. package/dist/{products-CPTRYL2Z.js → products-LGQMESEZ.js} +10 -11
  97. package/dist/{products-BM3IIH5P.js → products-PQ3FG5KC.js} +4 -5
  98. package/dist/{professional-details-ED4HNYXY.js → professional-details-AASVGTUO.js} +3 -4
  99. package/dist/{profile-6TGCNNUU.js → profile-ZNQEDSDM.js} +3 -4
  100. package/dist/{promotions-4336KI7E.js → promotions-MFAFFHF3.js} +4 -4
  101. package/dist/{register-OZ5CRANZ.js → register-3A6G6QNI.js} +5 -6
  102. package/dist/{reset-password-5UHZU4D3.js → reset-password-FV5762CA.js} +1 -1
  103. package/dist/{settings-2GCQQTO6.js → settings-OKNGWUKL.js} +12 -13
  104. package/dist/{shipment-HWQHMX2L.js → shipment-ZF7IRKKS.js} +3 -4
  105. package/dist/shipping-HWJPX34K.js +113 -0
  106. package/dist/{shipping-profile-ZP7M6VSS.js → shipping-profile-3QKTQI6L.js} +2 -6
  107. package/dist/{shipping-profiles-C5WBXWZ2.js → shipping-profiles-FZCKGCBU.js} +3 -4
  108. package/dist/{stock-MQA7PRO6.js → stock-FI5WXVWN.js} +4 -5
  109. package/dist/{store-5ZHZR4JI.js → store-VFRKJYMD.js} +3 -4
  110. package/dist/{store-closure-H5WHV3LA.js → store-closure-WZIWGESD.js} +3 -4
  111. package/dist/{store-select-PZS556FB.js → store-select-GKRDFGEY.js} +4 -5
  112. package/dist/{team-CLKJCZNH.js → team-CXEAYN7O.js} +3 -4
  113. package/package.json +1 -1
  114. package/dist/chunk-27KRIXMQ.js +0 -71
  115. package/dist/chunk-CFRWIQIZ.js +0 -43
  116. package/dist/chunk-RXV7INUV.js +0 -426
  117. package/dist/chunk-T6LHVNWO.js +0 -27
  118. package/dist/loader-VDYPD3RI.js +0 -31
  119. package/dist/offer-edit-page-3MO566RP.js +0 -151
  120. package/dist/offers-GVN5LCK6.js +0 -32
  121. package/dist/{chunk-SPOHNK4X.js → chunk-BPVMJN2D.js} +3 -3
@@ -1,426 +0,0 @@
1
- import {
2
- useDeleteOfferAction
3
- } from "./chunk-CFRWIQIZ.js";
4
- import {
5
- OFFERS_PAGE_SIZE,
6
- OFFER_LIST_FIELDS
7
- } from "./chunk-27KRIXMQ.js";
8
- import {
9
- CategoryCell,
10
- CategoryHeader,
11
- ProductStatusCell,
12
- ProductStatusHeader
13
- } from "./chunk-U5G3AVED.js";
14
- import {
15
- PlaceholderCell
16
- } from "./chunk-PHOCVOZ5.js";
17
- import {
18
- _DataTable,
19
- useDataTable
20
- } from "./chunk-SSUUT5LK.js";
21
- import {
22
- SingleColumnPage
23
- } from "./chunk-YV6MK4PZ.js";
24
- import {
25
- useQueryParams
26
- } from "./chunk-THHRRYRS.js";
27
- import {
28
- Thumbnail
29
- } from "./chunk-WIYFXWRI.js";
30
- import {
31
- useShippingProfiles
32
- } from "./chunk-IQWK723D.js";
33
- import {
34
- useBulkDeleteOffers,
35
- useOffers
36
- } from "./chunk-UORPTGV2.js";
37
- import {
38
- ActionMenu
39
- } from "./chunk-BDGZ4EQO.js";
40
-
41
- // src/pages/offers/offer-list-page.tsx
42
- import { Children as Children2 } from "react";
43
-
44
- // src/pages/offers/_components/offer-list-table.tsx
45
- import { Container } from "@medusajs/ui";
46
- import { Children } from "react";
47
- import { Outlet } from "react-router-dom";
48
-
49
- // src/pages/offers/_components/offer-list-data-table.tsx
50
- import { keepPreviousData } from "@tanstack/react-query";
51
- import { useState } from "react";
52
- import { useTranslation as useTranslation4 } from "react-i18next";
53
- import { toast, usePrompt } from "@medusajs/ui";
54
-
55
- // src/pages/offers/_components/use-offer-table-columns.tsx
56
- import { Checkbox, Text } from "@medusajs/ui";
57
- import { createColumnHelper } from "@tanstack/react-table";
58
- import { useMemo } from "react";
59
- import { useTranslation as useTranslation2 } from "react-i18next";
60
-
61
- // src/pages/offers/_components/offer-actions.tsx
62
- import { Buildings, CurrencyDollar, PencilSquare, Trash } from "@medusajs/icons";
63
- import { useTranslation } from "react-i18next";
64
- import { jsx } from "react/jsx-runtime";
65
- var OfferActions = ({ offer }) => {
66
- const { t } = useTranslation();
67
- const handleDelete = useDeleteOfferAction({ id: offer.id, sku: offer.sku });
68
- return /* @__PURE__ */ jsx(
69
- ActionMenu,
70
- {
71
- groups: [
72
- {
73
- actions: [
74
- {
75
- icon: /* @__PURE__ */ jsx(PencilSquare, {}),
76
- label: t("actions.edit"),
77
- to: `${offer.id}/edit`
78
- },
79
- {
80
- icon: /* @__PURE__ */ jsx(CurrencyDollar, {}),
81
- label: t("offers.actions.manage_prices"),
82
- to: `${offer.id}/pricing`
83
- },
84
- {
85
- icon: /* @__PURE__ */ jsx(Buildings, {}),
86
- label: t("offers.actions.manage_inventory"),
87
- to: `${offer.id}/inventory`
88
- }
89
- ]
90
- },
91
- {
92
- actions: [
93
- {
94
- icon: /* @__PURE__ */ jsx(Trash, {}),
95
- label: t("actions.delete"),
96
- onClick: handleDelete
97
- }
98
- ]
99
- }
100
- ]
101
- }
102
- );
103
- };
104
-
105
- // src/pages/offers/_components/use-offer-table-columns.tsx
106
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
107
- var columnHelper = createColumnHelper();
108
- var useOfferTableColumns = () => {
109
- const { t } = useTranslation2();
110
- return useMemo(
111
- () => [
112
- columnHelper.display({
113
- id: "select",
114
- header: ({ table }) => /* @__PURE__ */ jsx2(
115
- Checkbox,
116
- {
117
- checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
118
- onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
119
- }
120
- ),
121
- cell: ({ row }) => /* @__PURE__ */ jsx2(
122
- Checkbox,
123
- {
124
- checked: row.getIsSelected(),
125
- onCheckedChange: (value) => row.toggleSelected(!!value),
126
- onClick: (e) => e.stopPropagation()
127
- }
128
- )
129
- }),
130
- columnHelper.display({
131
- id: "title",
132
- header: t("fields.title"),
133
- cell: ({ row }) => {
134
- const variant = row.original.product_variant;
135
- const title = variant?.title ?? "";
136
- if (!title) {
137
- return /* @__PURE__ */ jsx2(PlaceholderCell, {});
138
- }
139
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full max-w-[250px] items-center gap-x-3 overflow-hidden", children: [
140
- /* @__PURE__ */ jsx2("div", { className: "w-fit flex-shrink-0", children: /* @__PURE__ */ jsx2(Thumbnail, { src: variant?.product?.thumbnail }) }),
141
- /* @__PURE__ */ jsx2("span", { title: variant?.product?.title, className: "truncate", children: variant?.title })
142
- ] });
143
- }
144
- }),
145
- columnHelper.display({
146
- id: "categories",
147
- header: () => /* @__PURE__ */ jsx2(CategoryHeader, {}),
148
- cell: ({ row }) => /* @__PURE__ */ jsx2(
149
- CategoryCell,
150
- {
151
- categories: row.original.product_variant?.product?.categories
152
- }
153
- )
154
- }),
155
- columnHelper.accessor("sku", {
156
- header: t("offers.fields.sku"),
157
- cell: ({ getValue }) => {
158
- const sku = getValue();
159
- if (!sku) return /* @__PURE__ */ jsx2(PlaceholderCell, {});
160
- return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "truncate", children: sku });
161
- }
162
- }),
163
- columnHelper.display({
164
- id: "shipping_profile",
165
- header: t("shippingProfile.domain"),
166
- cell: ({ row }) => {
167
- const name = row.original.shipping_profile?.name;
168
- if (!name) return /* @__PURE__ */ jsx2(PlaceholderCell, {});
169
- return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "truncate", children: name });
170
- }
171
- }),
172
- columnHelper.display({
173
- id: "status",
174
- header: () => /* @__PURE__ */ jsx2(ProductStatusHeader, {}),
175
- cell: ({ row }) => {
176
- const status = row.original.product_variant?.product?.status;
177
- if (!status) return /* @__PURE__ */ jsx2(PlaceholderCell, {});
178
- return /* @__PURE__ */ jsx2(ProductStatusCell, { status });
179
- }
180
- }),
181
- columnHelper.display({
182
- id: "actions",
183
- cell: ({ row }) => /* @__PURE__ */ jsx2(
184
- OfferActions,
185
- {
186
- offer: {
187
- id: row.original.id,
188
- sku: row.original.sku ?? ""
189
- }
190
- }
191
- )
192
- })
193
- ],
194
- [t]
195
- );
196
- };
197
-
198
- // src/pages/offers/_components/use-offer-table-filters.tsx
199
- import { useTranslation as useTranslation3 } from "react-i18next";
200
- var useOfferTableFilters = () => {
201
- const { t } = useTranslation3();
202
- const { shipping_profiles } = useShippingProfiles({ limit: 1e3 });
203
- const filters = [];
204
- if (shipping_profiles && shipping_profiles.length > 0) {
205
- filters.push({
206
- type: "select",
207
- key: "shipping_profile_id",
208
- label: t("shippingProfile.domain"),
209
- multiple: true,
210
- searchable: true,
211
- options: shipping_profiles.map((p) => ({
212
- label: p.name ?? p.id,
213
- value: p.id
214
- }))
215
- });
216
- }
217
- filters.push({
218
- type: "string",
219
- key: "sku",
220
- label: t("offers.fields.sku")
221
- });
222
- filters.push({
223
- type: "date",
224
- key: "created_at",
225
- label: t("fields.createdAt")
226
- });
227
- filters.push({
228
- type: "date",
229
- key: "updated_at",
230
- label: t("fields.updatedAt")
231
- });
232
- return filters;
233
- };
234
-
235
- // src/pages/offers/_components/use-offer-table-query.tsx
236
- var useOfferTableQuery = ({
237
- pageSize = 20,
238
- prefix
239
- }) => {
240
- const raw = useQueryParams(
241
- [
242
- "q",
243
- "order",
244
- "offset",
245
- "sku",
246
- "shipping_profile_id",
247
- "variant_id",
248
- "created_at",
249
- "updated_at"
250
- ],
251
- prefix
252
- );
253
- const { offset, created_at, updated_at, shipping_profile_id, variant_id, ...rest } = raw;
254
- const searchParams = {
255
- limit: pageSize,
256
- offset: offset ? parseInt(offset, 10) : void 0,
257
- order: rest.order ?? "-updated_at",
258
- q: rest.q,
259
- sku: rest.sku,
260
- shipping_profile_id: shipping_profile_id ? shipping_profile_id.split(",") : void 0,
261
- variant_id: variant_id ? variant_id.split(",") : void 0,
262
- created_at: created_at ? JSON.parse(created_at) : void 0,
263
- updated_at: updated_at ? JSON.parse(updated_at) : void 0
264
- };
265
- return {
266
- searchParams,
267
- raw
268
- };
269
- };
270
-
271
- // src/pages/offers/_components/offer-list-data-table.tsx
272
- import { jsx as jsx3 } from "react/jsx-runtime";
273
- var OfferListDataTable = () => {
274
- const { t } = useTranslation4();
275
- const prompt = usePrompt();
276
- const [selection, setSelection] = useState({});
277
- const { raw, searchParams } = useOfferTableQuery({
278
- pageSize: OFFERS_PAGE_SIZE
279
- });
280
- const {
281
- offers,
282
- count,
283
- isPending: isLoading,
284
- isError,
285
- error
286
- } = useOffers(
287
- { ...searchParams, fields: OFFER_LIST_FIELDS },
288
- { placeholderData: keepPreviousData }
289
- );
290
- const rows = offers ?? [];
291
- const filters = useOfferTableFilters();
292
- const columns = useOfferTableColumns();
293
- const { mutateAsync: bulkDelete } = useBulkDeleteOffers();
294
- const { table } = useDataTable({
295
- data: rows,
296
- columns,
297
- count,
298
- enablePagination: true,
299
- getRowId: (row) => row.id,
300
- pageSize: OFFERS_PAGE_SIZE,
301
- enableRowSelection: true,
302
- rowSelection: {
303
- state: selection,
304
- updater: setSelection
305
- }
306
- });
307
- if (isError) {
308
- throw error;
309
- }
310
- return /* @__PURE__ */ jsx3(
311
- _DataTable,
312
- {
313
- table,
314
- columns,
315
- pageSize: OFFERS_PAGE_SIZE,
316
- count,
317
- isLoading,
318
- pagination: true,
319
- search: true,
320
- filters,
321
- queryObject: raw,
322
- orderBy: [
323
- { key: "title", label: t("fields.title") },
324
- { key: "created_at", label: t("fields.createdAt") },
325
- { key: "updated_at", label: t("fields.updatedAt") }
326
- ],
327
- navigateTo: (row) => `${row.id}`,
328
- noRecords: {
329
- title: t("offers.empty.heading"),
330
- message: t("offers.empty.description"),
331
- action: {
332
- to: "create",
333
- label: t("offers.actions.create")
334
- }
335
- },
336
- commands: [
337
- {
338
- label: t("offers.actions.bulkDelete"),
339
- shortcut: "d",
340
- action: async (currentSelection) => {
341
- const ids = Object.keys(currentSelection);
342
- if (ids.length === 0) return;
343
- const confirmed = await prompt({
344
- title: t("general.areYouSure"),
345
- description: t("offers.bulkDelete.description", {
346
- count: ids.length
347
- }),
348
- confirmText: t("actions.delete"),
349
- cancelText: t("actions.cancel"),
350
- variant: "danger"
351
- });
352
- if (!confirmed) return;
353
- const result = await bulkDelete(ids);
354
- const succeededCount = result.succeeded.length;
355
- const failedCount = result.failed.length;
356
- if (failedCount === 0) {
357
- toast.success(
358
- t("offers.bulkDelete.successToast", { count: succeededCount })
359
- );
360
- setSelection({});
361
- } else {
362
- toast.warning(
363
- t("offers.bulkDelete.partialToast", {
364
- succeeded: succeededCount,
365
- total: ids.length,
366
- failed: failedCount
367
- })
368
- );
369
- const failedIds = new Set(result.failed.map((f) => f.id));
370
- setSelection((prev) => {
371
- const next = {};
372
- for (const id of Object.keys(prev)) {
373
- if (failedIds.has(id)) next[id] = true;
374
- }
375
- return next;
376
- });
377
- }
378
- }
379
- }
380
- ]
381
- }
382
- );
383
- };
384
-
385
- // src/pages/offers/_components/offer-list-header.tsx
386
- import { Button, Heading } from "@medusajs/ui";
387
- import { useTranslation as useTranslation5 } from "react-i18next";
388
- import { Link } from "react-router-dom";
389
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
390
- var OfferListTitle = () => {
391
- const { t } = useTranslation5();
392
- return /* @__PURE__ */ jsx4(Heading, { children: t("offers.domain") });
393
- };
394
- var OfferListActions = () => {
395
- const { t } = useTranslation5();
396
- return /* @__PURE__ */ jsx4(Button, { size: "small", variant: "primary", asChild: true, children: /* @__PURE__ */ jsx4(Link, { to: "create", "data-testid": "offer-list-create-button", children: t("offers.actions.create") }) });
397
- };
398
- var OfferListHeader = () => /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4", children: [
399
- /* @__PURE__ */ jsx4(OfferListTitle, {}),
400
- /* @__PURE__ */ jsx4(OfferListActions, {})
401
- ] });
402
-
403
- // src/pages/offers/_components/offer-list-table.tsx
404
- import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
405
- var OfferListTable = ({ children }) => /* @__PURE__ */ jsxs3(Container, { className: "divide-y p-0", "data-testid": "offer-list-table", children: [
406
- Children.count(children) > 0 ? children : /* @__PURE__ */ jsxs3(Fragment, { children: [
407
- /* @__PURE__ */ jsx5(OfferListHeader, {}),
408
- /* @__PURE__ */ jsx5(OfferListDataTable, {})
409
- ] }),
410
- /* @__PURE__ */ jsx5(Outlet, {})
411
- ] });
412
-
413
- // src/pages/offers/offer-list-page.tsx
414
- import { jsx as jsx6 } from "react/jsx-runtime";
415
- var Root = ({ children }) => /* @__PURE__ */ jsx6(SingleColumnPage, { children: Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx6(OfferListTable, {}) });
416
- var OfferListPage = Object.assign(Root, {
417
- Table: OfferListTable,
418
- Header: OfferListHeader,
419
- HeaderTitle: OfferListTitle,
420
- HeaderActions: OfferListActions,
421
- DataTable: OfferListDataTable
422
- });
423
-
424
- export {
425
- OfferListPage
426
- };
@@ -1,27 +0,0 @@
1
- import {
2
- queryKeysFactory
3
- } from "./chunk-ZA2KFUFR.js";
4
- import {
5
- sdk
6
- } from "./chunk-RIN4CBRB.js";
7
-
8
- // src/hooks/api/product-variants.tsx
9
- import {
10
- useQuery
11
- } from "@tanstack/react-query";
12
- var PRODUCT_VARIANT_QUERY_KEY = "product_variant";
13
- var productVariantQueryKeys = queryKeysFactory(
14
- PRODUCT_VARIANT_QUERY_KEY
15
- );
16
- var useVariants = (query, options) => {
17
- const { data, ...rest } = useQuery({
18
- queryFn: () => sdk.vendor.productVariants.query({ ...query }),
19
- queryKey: productVariantQueryKeys.list(query),
20
- ...options
21
- });
22
- return { ...data, ...rest };
23
- };
24
-
25
- export {
26
- useVariants
27
- };
@@ -1,31 +0,0 @@
1
- import {
2
- OFFER_DETAIL_FIELDS
3
- } from "./chunk-27KRIXMQ.js";
4
- import {
5
- offerQueryKeys
6
- } from "./chunk-UORPTGV2.js";
7
- import {
8
- queryClient
9
- } from "./chunk-RHKRREUU.js";
10
- import "./chunk-ZA2KFUFR.js";
11
- import {
12
- fetchQuery
13
- } from "./chunk-RIN4CBRB.js";
14
- import "./chunk-NBMM2TZK.js";
15
-
16
- // src/pages/offers/[id]/loader.ts
17
- var offerDetailQuery = (id) => ({
18
- queryKey: offerQueryKeys.detail(id),
19
- queryFn: async () => fetchQuery(`/vendor/offers/${id}`, {
20
- method: "GET",
21
- query: { fields: OFFER_DETAIL_FIELDS }
22
- })
23
- });
24
- var loader = async ({ params }) => {
25
- const id = params.id;
26
- const query = offerDetailQuery(id);
27
- return queryClient.ensureQueryData(query);
28
- };
29
- export {
30
- loader
31
- };
@@ -1,151 +0,0 @@
1
- import {
2
- OFFER_DETAIL_FIELDS
3
- } from "./chunk-27KRIXMQ.js";
4
- import "./chunk-TKGWSUEI.js";
5
- import {
6
- KeyboundForm
7
- } from "./chunk-U2ZFCAPX.js";
8
- import {
9
- RouteDrawer,
10
- useRouteModal
11
- } from "./chunk-GDWBOQI5.js";
12
- import {
13
- Form
14
- } from "./chunk-3QSRE5LS.js";
15
- import {
16
- useShippingProfiles
17
- } from "./chunk-IQWK723D.js";
18
- import {
19
- useOffer,
20
- useUpdateOffer
21
- } from "./chunk-UORPTGV2.js";
22
- import {
23
- useDocumentDirection
24
- } from "./chunk-Y7QKP6QU.js";
25
- import "./chunk-RHKRREUU.js";
26
- import "./chunk-ZA2KFUFR.js";
27
- import "./chunk-RIN4CBRB.js";
28
- import "./chunk-NBMM2TZK.js";
29
-
30
- // src/pages/offers/[id]/edit/offer-edit-page.tsx
31
- import { Heading } from "@medusajs/ui";
32
- import { useTranslation as useTranslation2 } from "react-i18next";
33
- import { useParams } from "react-router-dom";
34
-
35
- // src/pages/offers/[id]/edit/edit-offer-form/edit-offer-form.tsx
36
- import { zodResolver } from "@hookform/resolvers/zod";
37
- import { Button, Input, Select, toast } from "@medusajs/ui";
38
- import { useForm } from "react-hook-form";
39
- import { useTranslation } from "react-i18next";
40
-
41
- // src/pages/offers/[id]/edit/edit-offer-form/schema.ts
42
- import { z } from "zod";
43
- var EditOfferSchema = z.object({
44
- sku: z.string().min(1).max(64),
45
- shipping_profile_id: z.string().min(1),
46
- metadata: z.record(z.string(), z.unknown()).nullish()
47
- });
48
-
49
- // src/pages/offers/[id]/edit/edit-offer-form/edit-offer-form.tsx
50
- import { jsx, jsxs } from "react/jsx-runtime";
51
- var EditOfferForm = ({ offer }) => {
52
- const { t } = useTranslation();
53
- const dir = useDocumentDirection();
54
- const { handleSuccess } = useRouteModal();
55
- const { shipping_profiles } = useShippingProfiles({ limit: 1e3 });
56
- const form = useForm({
57
- defaultValues: {
58
- sku: offer.sku ?? "",
59
- shipping_profile_id: offer.shipping_profile_id ?? "",
60
- metadata: offer.metadata ?? null
61
- },
62
- resolver: zodResolver(EditOfferSchema)
63
- });
64
- const { mutateAsync, isPending } = useUpdateOffer(offer.id);
65
- const handleSubmit = form.handleSubmit(async (values) => {
66
- await mutateAsync(
67
- {
68
- sku: values.sku,
69
- shipping_profile_id: values.shipping_profile_id,
70
- metadata: values.metadata ?? void 0
71
- },
72
- {
73
- onSuccess: () => {
74
- toast.success(t("offers.edit.successToast"));
75
- handleSuccess();
76
- },
77
- onError: (error) => toast.error(error.message)
78
- }
79
- );
80
- });
81
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
82
- KeyboundForm,
83
- {
84
- onSubmit: handleSubmit,
85
- className: "flex flex-1 flex-col overflow-hidden",
86
- "data-testid": "offer-edit-form",
87
- children: [
88
- /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-4 overflow-auto", children: [
89
- /* @__PURE__ */ jsx(
90
- Form.Field,
91
- {
92
- control: form.control,
93
- name: "sku",
94
- render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
95
- /* @__PURE__ */ jsx(Form.Label, { children: t("offers.fields.sku") }),
96
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { maxLength: 64, autoComplete: "off", ...field }) }),
97
- /* @__PURE__ */ jsx(Form.ErrorMessage, {})
98
- ] })
99
- }
100
- ),
101
- /* @__PURE__ */ jsx(
102
- Form.Field,
103
- {
104
- control: form.control,
105
- name: "shipping_profile_id",
106
- render: ({ field: { ref: _r, onChange, ...f } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
107
- /* @__PURE__ */ jsx(Form.Label, { children: t("offers.fields.shippingProfile") }),
108
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...f, onValueChange: onChange, dir, children: [
109
- /* @__PURE__ */ jsx(Select.Trigger, { ref: _r, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
110
- /* @__PURE__ */ jsx(Select.Content, { children: (shipping_profiles ?? []).map((p) => /* @__PURE__ */ jsx(Select.Item, { value: p.id, children: p.name }, p.id)) })
111
- ] }) }),
112
- /* @__PURE__ */ jsx(Form.ErrorMessage, {})
113
- ] })
114
- }
115
- )
116
- ] }),
117
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
118
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", children: t("actions.cancel") }) }),
119
- /* @__PURE__ */ jsx(Button, { type: "submit", size: "small", isLoading: isPending, children: t("actions.save") })
120
- ] }) })
121
- ]
122
- }
123
- ) });
124
- };
125
-
126
- // src/pages/offers/[id]/edit/offer-edit-page.tsx
127
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
128
- var OfferEditPage = () => {
129
- const { id } = useParams();
130
- const { t } = useTranslation2();
131
- const {
132
- offer,
133
- isPending,
134
- isError,
135
- error
136
- } = useOffer(id, { fields: OFFER_DETAIL_FIELDS });
137
- if (isError) throw error;
138
- const ready = !isPending && !!offer;
139
- return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
140
- /* @__PURE__ */ jsxs2(RouteDrawer.Header, { children: [
141
- /* @__PURE__ */ jsx2(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx2(Heading, { children: t("offers.edit.header") }) }),
142
- /* @__PURE__ */ jsx2(RouteDrawer.Description, { className: "sr-only", children: t("offers.edit.description") })
143
- ] }),
144
- ready && /* @__PURE__ */ jsx2(EditOfferForm, { offer })
145
- ] });
146
- };
147
- var Component = OfferEditPage;
148
- export {
149
- Component,
150
- OfferEditPage
151
- };
@@ -1,32 +0,0 @@
1
- import {
2
- OfferListPage
3
- } from "./chunk-RXV7INUV.js";
4
- import "./chunk-CFRWIQIZ.js";
5
- import "./chunk-27KRIXMQ.js";
6
- import "./chunk-U5G3AVED.js";
7
- import "./chunk-FQERBIVS.js";
8
- import "./chunk-DB6ANJBO.js";
9
- import "./chunk-PHOCVOZ5.js";
10
- import "./chunk-SSUUT5LK.js";
11
- import "./chunk-YN3FGNJM.js";
12
- import "./chunk-6OUPJNYO.js";
13
- import "./chunk-3EF54XFY.js";
14
- import "./chunk-YV6MK4PZ.js";
15
- import "./chunk-THHRRYRS.js";
16
- import "./chunk-LRD242C7.js";
17
- import "./chunk-UCYSCKZV.js";
18
- import "./chunk-WIYFXWRI.js";
19
- import "./chunk-INNFZYX2.js";
20
- import "./chunk-IQWK723D.js";
21
- import "./chunk-UORPTGV2.js";
22
- import "./chunk-BDGZ4EQO.js";
23
- import "./chunk-LAVHRER2.js";
24
- import "./chunk-QHQWEERJ.js";
25
- import "./chunk-Y7QKP6QU.js";
26
- import "./chunk-RHKRREUU.js";
27
- import "./chunk-ZA2KFUFR.js";
28
- import "./chunk-RIN4CBRB.js";
29
- import "./chunk-NBMM2TZK.js";
30
- export {
31
- OfferListPage
32
- };
@@ -1,10 +1,10 @@
1
- import {
2
- TaxRateRuleReferenceType
3
- } from "./chunk-Q4UVXS46.js";
4
1
  import {
5
2
  LocalizedTablePagination,
6
3
  useDeleteTaxRateAction
7
4
  } from "./chunk-E2HQPY32.js";
5
+ import {
6
+ TaxRateRuleReferenceType
7
+ } from "./chunk-Q4UVXS46.js";
8
8
  import {
9
9
  formatPercentage
10
10
  } from "./chunk-QDPLZDMX.js";