@zaamx/netme-bundle 0.0.2

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.
@@ -0,0 +1,566 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const adminSdk = require("@medusajs/admin-sdk");
4
+ const icons = require("@medusajs/icons");
5
+ const ui = require("@medusajs/ui");
6
+ const reactQuery = require("@tanstack/react-query");
7
+ const react = require("react");
8
+ const Medusa = require("@medusajs/js-sdk");
9
+ const reactRouterDom = require("react-router-dom");
10
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
+ const Medusa__default = /* @__PURE__ */ _interopDefault(Medusa);
12
+ const sdk = new Medusa__default.default({
13
+ baseUrl: "/",
14
+ debug: false,
15
+ auth: {
16
+ type: "session"
17
+ }
18
+ });
19
+ const limit = 15;
20
+ const BundledProductsPage = () => {
21
+ const [page, setPage] = react.useState(0);
22
+ const [openCreateModal, setOpenCreateModal] = react.useState(false);
23
+ const [isEditing, setIsEditing] = react.useState(false);
24
+ const [selectedProductId, setSelectedProductId] = react.useState();
25
+ const [bundleItems, setBundleItems] = react.useState([]);
26
+ const [bundleMeta, setBundleMeta] = react.useState([]);
27
+ const [products, setProducts] = react.useState([]);
28
+ const productsLimit = 15;
29
+ const [currentProductPage, setCurrentProductPage] = react.useState(0);
30
+ const [productsCount, setProductsCount] = react.useState(0);
31
+ const hasNextPage = react.useMemo(
32
+ () => productsCount ? productsCount > productsLimit : true,
33
+ [productsCount, productsLimit]
34
+ );
35
+ const queryClient = reactQuery.useQueryClient();
36
+ const offset = page * limit;
37
+ const { data, isLoading } = reactQuery.useQuery({
38
+ queryKey: ["bundled-products", offset, limit],
39
+ queryFn: () => sdk.client.fetch("/admin/bundled-products", {
40
+ method: "GET",
41
+ query: {
42
+ limit,
43
+ offset
44
+ }
45
+ })
46
+ });
47
+ reactQuery.useQuery({
48
+ queryKey: ["products"],
49
+ queryFn: async () => {
50
+ const { products: products2, count } = await sdk.admin.product.list({
51
+ limit: productsLimit,
52
+ offset: currentProductPage * productsLimit
53
+ });
54
+ setProductsCount(count);
55
+ setProducts((prev) => [...prev, ...products2]);
56
+ return products2;
57
+ },
58
+ enabled: hasNextPage
59
+ });
60
+ const fetchMoreProducts = () => {
61
+ if (!hasNextPage) {
62
+ return;
63
+ }
64
+ setCurrentProductPage(currentProductPage + 1);
65
+ };
66
+ const { mutateAsync: createBundle, isPending: isCreating } = reactQuery.useMutation({
67
+ mutationFn: async (data2) => {
68
+ if (!selectedProductId) throw new Error("No product selected");
69
+ await sdk.client.fetch(`/admin/products/${selectedProductId}/bundle`, {
70
+ method: "POST",
71
+ body: data2
72
+ });
73
+ }
74
+ });
75
+ const { mutateAsync: deleteBundle, isPending: isDeleting } = reactQuery.useMutation({
76
+ mutationFn: async (productId) => {
77
+ await sdk.client.fetch(`/admin/products/${productId}/bundle`, {
78
+ method: "DELETE"
79
+ });
80
+ }
81
+ });
82
+ const handleDeleteBundle = async (productId) => {
83
+ try {
84
+ await deleteBundle(productId);
85
+ ui.toast.success("Bundle deleted successfully");
86
+ queryClient.invalidateQueries({
87
+ queryKey: ["bundled-products"]
88
+ });
89
+ } catch (error) {
90
+ console.error("Error deleting bundle:", error);
91
+ ui.toast.error("Failed to delete bundle");
92
+ }
93
+ };
94
+ const handleEditBundle = (bundle) => {
95
+ setIsEditing(true);
96
+ setSelectedProductId(bundle.product.id);
97
+ setBundleItems(bundle.items.map((item) => ({
98
+ product_id: item.product.id,
99
+ min_quantity: item.min_quantity || 1,
100
+ max_quantity: item.max_quantity || 1,
101
+ default_quantity: item.quantity,
102
+ optional: item.optional || false,
103
+ separate_shipping: item.separate_shipping || false,
104
+ individual_price: item.individual_price || false
105
+ })));
106
+ setBundleMeta(bundle.bundle_meta || []);
107
+ setOpenCreateModal(true);
108
+ };
109
+ const handleCreateBundle = async () => {
110
+ try {
111
+ if (!selectedProductId) {
112
+ ui.toast.error("Please select a product");
113
+ return;
114
+ }
115
+ const validItems = bundleItems.filter((item) => item.product_id);
116
+ if (validItems.length === 0) {
117
+ ui.toast.error("Please add at least one product to the bundle");
118
+ return;
119
+ }
120
+ await createBundle({
121
+ child_product_ids: validItems.map((item) => ({
122
+ id: item.product_id,
123
+ min_quantity: item.min_quantity,
124
+ max_quantity: item.max_quantity,
125
+ default_quantity: item.default_quantity,
126
+ optional: item.optional,
127
+ separate_shipping: item.separate_shipping,
128
+ individual_price: item.individual_price
129
+ })),
130
+ bundle_meta: bundleMeta,
131
+ is_bundle: true
132
+ });
133
+ setOpenCreateModal(false);
134
+ ui.toast.success(isEditing ? "Bundle updated successfully" : "Bundle created successfully");
135
+ queryClient.invalidateQueries({
136
+ queryKey: ["bundled-products"]
137
+ });
138
+ setIsEditing(false);
139
+ setSelectedProductId(void 0);
140
+ setBundleItems([]);
141
+ setBundleMeta([]);
142
+ } catch (error) {
143
+ console.error("Error creating bundle:", error);
144
+ ui.toast.error("Failed to create bundle");
145
+ }
146
+ };
147
+ const addBundleItem = () => {
148
+ setBundleItems([
149
+ ...bundleItems,
150
+ {
151
+ product_id: void 0,
152
+ min_quantity: 1,
153
+ max_quantity: 1,
154
+ default_quantity: 1,
155
+ optional: false,
156
+ separate_shipping: false,
157
+ individual_price: false
158
+ }
159
+ ]);
160
+ };
161
+ const removeBundleItem = (index) => {
162
+ setBundleItems(bundleItems.filter((_, i) => i !== index));
163
+ };
164
+ const updateBundleItem = (index, field, value) => {
165
+ setBundleItems(bundleItems.map(
166
+ (item, i) => i === index ? { ...item, [field]: value } : item
167
+ ));
168
+ };
169
+ const addBundleMeta = () => {
170
+ setBundleMeta([...bundleMeta, { key: "", value: "" }]);
171
+ };
172
+ const removeBundleMeta = (index) => {
173
+ setBundleMeta(bundleMeta.filter((_, i) => i !== index));
174
+ };
175
+ const updateBundleMeta = (index, field, value) => {
176
+ setBundleMeta(bundleMeta.map(
177
+ (item, i) => i === index ? { ...item, [field]: value } : item
178
+ ));
179
+ };
180
+ const totalPages = Math.ceil(((data == null ? void 0 : data.count) || 0) / limit);
181
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
182
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2 md:flex-row md:items-center p-6", children: [
183
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Bundled Products" }),
184
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => setOpenCreateModal(true), children: "Create Bundle" })
185
+ ] }),
186
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading..." }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6", children: [
187
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse border border-gray-200", children: [
188
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "bg-gray-50", children: [
189
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "border border-gray-200 px-4 py-2 text-left", children: "ID" }),
190
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "border border-gray-200 px-4 py-2 text-left", children: "Title" }),
191
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "border border-gray-200 px-4 py-2 text-left", children: "Items" }),
192
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "border border-gray-200 px-4 py-2 text-left", children: "Product" }),
193
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "border border-gray-200 px-4 py-2 text-left", children: "Status" })
194
+ ] }) }),
195
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: data == null ? void 0 : data.bundled_products.map((bundle) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "hover:bg-gray-50", children: [
196
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "border border-gray-200 px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx("code", { className: "text-sm", children: bundle.id }) }),
197
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "border border-gray-200 px-4 py-2", children: bundle.title }),
198
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "border border-gray-200 px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: bundle.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm", children: [
199
+ /* @__PURE__ */ jsxRuntime.jsx(
200
+ reactRouterDom.Link,
201
+ {
202
+ to: `/products/${item.product.id}`,
203
+ className: "text-blue-600 hover:underline",
204
+ children: item.product.title
205
+ }
206
+ ),
207
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-gray-500", children: [
208
+ " x ",
209
+ item.quantity
210
+ ] }),
211
+ item.optional && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { className: "ml-2 bg-gray-100 text-gray-700", children: "Optional" })
212
+ ] }, item.id)) }) }),
213
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "border border-gray-200 px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
214
+ reactRouterDom.Link,
215
+ {
216
+ to: `/products/${bundle.product.id}`,
217
+ className: "text-blue-600 hover:underline",
218
+ children: "View Product"
219
+ }
220
+ ) }),
221
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "border border-gray-200 px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
222
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { className: bundle.is_bundle ? "bg-green-100 text-green-700" : "bg-gray-100 text-gray-700", children: bundle.is_bundle ? "Active" : "Inactive" }),
223
+ /* @__PURE__ */ jsxRuntime.jsx(
224
+ ui.Button,
225
+ {
226
+ variant: "secondary",
227
+ size: "small",
228
+ onClick: () => handleEditBundle(bundle),
229
+ children: "Edit"
230
+ }
231
+ ),
232
+ /* @__PURE__ */ jsxRuntime.jsx(
233
+ ui.Button,
234
+ {
235
+ variant: "secondary",
236
+ size: "small",
237
+ onClick: () => handleDeleteBundle(bundle.id),
238
+ className: "text-red-600 hover:text-red-700",
239
+ children: "Delete"
240
+ }
241
+ )
242
+ ] }) })
243
+ ] }, bundle.id)) })
244
+ ] }) }),
245
+ totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-center gap-2 mt-6", children: [
246
+ /* @__PURE__ */ jsxRuntime.jsx(
247
+ ui.Button,
248
+ {
249
+ variant: "secondary",
250
+ onClick: () => setPage(Math.max(0, page - 1)),
251
+ disabled: page === 0,
252
+ children: "Previous"
253
+ }
254
+ ),
255
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center px-4", children: [
256
+ "Page ",
257
+ page + 1,
258
+ " of ",
259
+ totalPages
260
+ ] }),
261
+ /* @__PURE__ */ jsxRuntime.jsx(
262
+ ui.Button,
263
+ {
264
+ variant: "secondary",
265
+ onClick: () => setPage(Math.min(totalPages - 1, page + 1)),
266
+ disabled: page === totalPages - 1,
267
+ children: "Next"
268
+ }
269
+ )
270
+ ] })
271
+ ] }),
272
+ /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal, { open: openCreateModal, onOpenChange: setOpenCreateModal, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.FocusModal.Content, { children: [
273
+ /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: isEditing ? "Edit Bundle" : "Create Bundle" }) }),
274
+ /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center h-[80vh] overflow-y-auto px-2 py-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-3xl flex flex-col gap-y-8", children: [
275
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
276
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Select Product to Bundle" }),
277
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-gray-600 mb-4", children: "Choose a product that will become a bundle" }),
278
+ /* @__PURE__ */ jsxRuntime.jsxs(
279
+ ui.Select,
280
+ {
281
+ value: selectedProductId,
282
+ onValueChange: setSelectedProductId,
283
+ disabled: isEditing,
284
+ children: [
285
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select a product to bundle" }) }),
286
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: products == null ? void 0 : products.map((product) => /* @__PURE__ */ jsxRuntime.jsx(
287
+ ui.Select.Item,
288
+ {
289
+ value: product.id,
290
+ children: product.title
291
+ },
292
+ product.id
293
+ )) })
294
+ ]
295
+ }
296
+ )
297
+ ] }),
298
+ selectedProductId && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
299
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
300
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Bundle Items" }),
301
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-gray-600 mb-4", children: "Select products to include in this bundle" }),
302
+ bundleItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
303
+ BundleItemForm,
304
+ {
305
+ item,
306
+ index,
307
+ products,
308
+ onUpdate: (field, value) => updateBundleItem(index, field, value),
309
+ onRemove: () => removeBundleItem(index),
310
+ fetchMoreProducts,
311
+ hasNextPage
312
+ },
313
+ index
314
+ )),
315
+ /* @__PURE__ */ jsxRuntime.jsx(
316
+ ui.Button,
317
+ {
318
+ variant: "secondary",
319
+ onClick: addBundleItem,
320
+ className: "mt-4",
321
+ children: "Add Item"
322
+ }
323
+ )
324
+ ] }),
325
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
326
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Bundle Metadata" }),
327
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-gray-600 mb-4", children: "Add custom metadata for this bundle" }),
328
+ bundleMeta.map((meta, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 mb-2", children: [
329
+ /* @__PURE__ */ jsxRuntime.jsx(
330
+ ui.Input,
331
+ {
332
+ placeholder: "Key",
333
+ value: meta.key,
334
+ onChange: (e) => updateBundleMeta(index, "key", e.target.value)
335
+ }
336
+ ),
337
+ /* @__PURE__ */ jsxRuntime.jsx(
338
+ ui.Input,
339
+ {
340
+ placeholder: "Value",
341
+ value: meta.value,
342
+ onChange: (e) => updateBundleMeta(index, "value", e.target.value)
343
+ }
344
+ ),
345
+ /* @__PURE__ */ jsxRuntime.jsx(
346
+ ui.Button,
347
+ {
348
+ variant: "secondary",
349
+ onClick: () => removeBundleMeta(index),
350
+ children: "Remove"
351
+ }
352
+ )
353
+ ] }, index)),
354
+ /* @__PURE__ */ jsxRuntime.jsx(
355
+ ui.Button,
356
+ {
357
+ variant: "secondary",
358
+ onClick: addBundleMeta,
359
+ className: "mt-4",
360
+ children: "Add Metadata"
361
+ }
362
+ )
363
+ ] })
364
+ ] })
365
+ ] }) }) }),
366
+ /* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
367
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => {
368
+ setOpenCreateModal(false);
369
+ setIsEditing(false);
370
+ setSelectedProductId(void 0);
371
+ setBundleItems([]);
372
+ setBundleMeta([]);
373
+ }, children: "Cancel" }),
374
+ /* @__PURE__ */ jsxRuntime.jsx(
375
+ ui.Button,
376
+ {
377
+ variant: "primary",
378
+ onClick: handleCreateBundle,
379
+ isLoading: isCreating,
380
+ disabled: !selectedProductId,
381
+ children: isEditing ? "Update Bundle" : "Create Bundle"
382
+ }
383
+ )
384
+ ] }) })
385
+ ] }) })
386
+ ] });
387
+ };
388
+ const BundleItemForm = ({
389
+ item,
390
+ index,
391
+ products,
392
+ onUpdate,
393
+ onRemove,
394
+ fetchMoreProducts,
395
+ hasNextPage
396
+ }) => {
397
+ const observer = react.useRef(
398
+ new IntersectionObserver(
399
+ (entries) => {
400
+ if (!hasNextPage) {
401
+ return;
402
+ }
403
+ const first = entries[0];
404
+ if (first.isIntersecting) {
405
+ fetchMoreProducts();
406
+ }
407
+ },
408
+ { threshold: 1 }
409
+ )
410
+ );
411
+ const lastOptionRef = react.useCallback(
412
+ (node) => {
413
+ if (!hasNextPage) {
414
+ return;
415
+ }
416
+ if (observer.current) {
417
+ observer.current.disconnect();
418
+ }
419
+ if (node) {
420
+ observer.current.observe(node);
421
+ }
422
+ },
423
+ [hasNextPage]
424
+ );
425
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border rounded-lg p-4 space-y-4", children: [
426
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
427
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { level: "h3", children: [
428
+ "Item ",
429
+ index + 1
430
+ ] }),
431
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: onRemove, children: "Remove" })
432
+ ] }),
433
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
434
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Product" }),
435
+ /* @__PURE__ */ jsxRuntime.jsxs(
436
+ ui.Select,
437
+ {
438
+ value: item.product_id,
439
+ onValueChange: (value) => onUpdate("product_id", value),
440
+ children: [
441
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Select Product" }) }),
442
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: products == null ? void 0 : products.map((product, productIndex) => /* @__PURE__ */ jsxRuntime.jsx(
443
+ ui.Select.Item,
444
+ {
445
+ value: product.id,
446
+ ref: productIndex === products.length - 1 ? lastOptionRef : null,
447
+ children: product.title
448
+ },
449
+ product.id
450
+ )) })
451
+ ]
452
+ }
453
+ )
454
+ ] }),
455
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-4", children: [
456
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
457
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Min Quantity" }),
458
+ /* @__PURE__ */ jsxRuntime.jsx(
459
+ ui.Input,
460
+ {
461
+ type: "number",
462
+ min: 0,
463
+ value: item.min_quantity,
464
+ onChange: (e) => onUpdate("min_quantity", parseInt(e.target.value) || 0)
465
+ }
466
+ )
467
+ ] }),
468
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
469
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Max Quantity" }),
470
+ /* @__PURE__ */ jsxRuntime.jsx(
471
+ ui.Input,
472
+ {
473
+ type: "number",
474
+ min: 0,
475
+ value: item.max_quantity,
476
+ onChange: (e) => onUpdate("max_quantity", parseInt(e.target.value) || 0)
477
+ }
478
+ )
479
+ ] }),
480
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
481
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Default Quantity" }),
482
+ /* @__PURE__ */ jsxRuntime.jsx(
483
+ ui.Input,
484
+ {
485
+ type: "number",
486
+ min: 0,
487
+ value: item.default_quantity,
488
+ onChange: (e) => onUpdate("default_quantity", parseInt(e.target.value) || 0)
489
+ }
490
+ )
491
+ ] })
492
+ ] }),
493
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
494
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
495
+ /* @__PURE__ */ jsxRuntime.jsx(
496
+ ui.Switch,
497
+ {
498
+ checked: item.optional,
499
+ onCheckedChange: (checked) => onUpdate("optional", checked)
500
+ }
501
+ ),
502
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Optional" })
503
+ ] }),
504
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
505
+ /* @__PURE__ */ jsxRuntime.jsx(
506
+ ui.Switch,
507
+ {
508
+ checked: item.separate_shipping,
509
+ onCheckedChange: (checked) => onUpdate("separate_shipping", checked)
510
+ }
511
+ ),
512
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Separate Shipping" })
513
+ ] }),
514
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
515
+ /* @__PURE__ */ jsxRuntime.jsx(
516
+ ui.Switch,
517
+ {
518
+ checked: item.individual_price,
519
+ onCheckedChange: (checked) => onUpdate("individual_price", checked)
520
+ }
521
+ ),
522
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Individual Price" })
523
+ ] })
524
+ ] })
525
+ ] });
526
+ };
527
+ const config = adminSdk.defineRouteConfig({
528
+ label: "Bundled Products",
529
+ icon: icons.CubeSolid
530
+ });
531
+ const i18nTranslations0 = {};
532
+ const widgetModule = { widgets: [] };
533
+ const routeModule = {
534
+ routes: [
535
+ {
536
+ Component: BundledProductsPage,
537
+ path: "/bundled-products"
538
+ }
539
+ ]
540
+ };
541
+ const menuItemModule = {
542
+ menuItems: [
543
+ {
544
+ label: config.label,
545
+ icon: config.icon,
546
+ path: "/bundled-products",
547
+ nested: void 0,
548
+ rank: void 0,
549
+ translationNs: void 0
550
+ }
551
+ ]
552
+ };
553
+ const formModule = { customFields: {} };
554
+ const displayModule = {
555
+ displays: {}
556
+ };
557
+ const i18nModule = { resources: i18nTranslations0 };
558
+ const plugin = {
559
+ widgetModule,
560
+ routeModule,
561
+ menuItemModule,
562
+ formModule,
563
+ displayModule,
564
+ i18nModule
565
+ };
566
+ module.exports = plugin;