@cmdoss/walrus-site-builder-react 2.5.0 → 2.6.0

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/index.js CHANGED
@@ -85,8 +85,8 @@ function useSuiNsDomainsQuery(currentAccount, clients) {
85
85
  });
86
86
  console.log("response", response);
87
87
  const domains$1 = response.data.filter((obj) => obj.data?.content?.dataType === "moveObject").map((obj) => {
88
- const content$5 = obj.data?.content;
89
- const fields = content$5 && "fields" in content$5 ? content$5.fields : {};
88
+ const content$6 = obj.data?.content;
89
+ const fields = content$6 && "fields" in content$6 ? content$6.fields : {};
90
90
  return {
91
91
  name: fields?.domain_name || "",
92
92
  objectId: obj.data?.objectId || "",
@@ -315,12 +315,12 @@ function useZenfsFilesQuery(fm, clients) {
315
315
  const files = await fm.listFiles();
316
316
  const assets = [];
317
317
  for (const path of files) {
318
- const content$5 = await fm?.readFile(path);
319
- if (!content$5) continue;
320
- const hashU256 = sha256ToU256(await getSHA256Hash(content$5));
318
+ const content$6 = await fm?.readFile(path);
319
+ if (!content$6) continue;
320
+ const hashU256 = sha256ToU256(await getSHA256Hash(content$6));
321
321
  assets.push({
322
322
  path,
323
- content: content$5,
323
+ content: content$6,
324
324
  hashU256
325
325
  });
326
326
  }
@@ -337,6 +337,7 @@ const isDomainDialogOpen = atom(false);
337
337
  const isAssigningDomain = atom(false);
338
338
  const isRegisterSuiNSDomainDialogOpen = atom(false);
339
339
  const isExtendTimeDialogOpen = atom(false);
340
+ const isUpdateMetadataModalOpen = atom(false);
340
341
 
341
342
  //#endregion
342
343
  //#region src/stores/site-metadata.store.ts
@@ -374,7 +375,7 @@ var SiteMetadata = class {
374
375
  this.originalProjectUrl,
375
376
  this.originalEpochs,
376
377
  this.originalSuiNSUrl
377
- ], (title$5, description$5, iconUrl, link$3, projectUrl, epochs, suiNSUrl, originalTitle, originalDescription, originalIcon, originalLink, originalProjectUrl, originalEpochs, originalSuiNSUrl) => title$5 !== originalTitle || description$5 !== originalDescription || (iconUrl ?? null) !== (originalIcon ?? null) || link$3 !== originalLink || projectUrl !== originalProjectUrl || epochs !== originalEpochs || JSON.stringify(suiNSUrl.sort((a, b) => a.nftId.localeCompare(b.nftId))) !== JSON.stringify(originalSuiNSUrl.sort((a, b) => a.nftId.localeCompare(b.nftId))));
378
+ ], (title$6, description$6, iconUrl, link$3, projectUrl, epochs, suiNSUrl, originalTitle, originalDescription, originalIcon, originalLink, originalProjectUrl, originalEpochs, originalSuiNSUrl) => title$6 !== originalTitle || description$6 !== originalDescription || (iconUrl ?? null) !== (originalIcon ?? null) || link$3 !== originalLink || projectUrl !== originalProjectUrl || epochs !== originalEpochs || JSON.stringify(suiNSUrl.sort((a, b) => a.nftId.localeCompare(b.nftId))) !== JSON.stringify(originalSuiNSUrl.sort((a, b) => a.nftId.localeCompare(b.nftId))));
378
379
  /**
379
380
  * Computed URL for displaying the image preview
380
381
  */
@@ -634,10 +635,10 @@ function useSitePublishing({ siteId, assets, onUpdateSiteMetadata, onAssociatedD
634
635
  const deployStatusText = useStore(sitePublishingStore.deployStatusText);
635
636
  const deployStepIndex = useStore(sitePublishingStore.deploymentStepIndex);
636
637
  const epochs = useStore(siteMetadataStore.epochs);
637
- const title$5 = useStore(siteMetadataStore.title);
638
+ const title$6 = useStore(siteMetadataStore.title);
638
639
  const imageUrl = useStore(siteMetadataStore.imageUrl);
639
640
  const link$3 = useStore(siteMetadataStore.link);
640
- const description$5 = useStore(siteMetadataStore.description);
641
+ const description$6 = useStore(siteMetadataStore.description);
641
642
  const isEditingSiteMetadata = useStore(siteMetadataStore.isDirty);
642
643
  const isSavingSiteMetadata = useStore(siteMetadataStore.loading);
643
644
  const isAssigning = useStore(isAssigningDomain);
@@ -666,8 +667,8 @@ function useSitePublishing({ siteId, assets, onUpdateSiteMetadata, onAssociatedD
666
667
  if (imageUrl instanceof File) return onError?.("Please upload image first.");
667
668
  const siteMetadata = {
668
669
  id: siteId,
669
- title: title$5,
670
- description: description$5,
670
+ title: title$6,
671
+ description: description$6,
671
672
  imageUrl: imageUrl ?? void 0,
672
673
  link: siteMetadataStore.link.get() ?? void 0,
673
674
  projectUrl: siteMetadataStore.projectUrl.get() ?? void 0
@@ -838,9 +839,9 @@ function useSitePublishing({ siteId, assets, onUpdateSiteMetadata, onAssociatedD
838
839
  isWorking,
839
840
  certifiedBlobs,
840
841
  epochs,
841
- title: title$5,
842
+ title: title$6,
842
843
  iconUrl: imageUrl,
843
- description: description$5,
844
+ description: description$6,
844
845
  link: link$3,
845
846
  isEditingSiteMetadata,
846
847
  deployStatus,
@@ -1643,7 +1644,7 @@ var banner = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntim
1643
1644
  defaultVariants: { variant: "info" },
1644
1645
  compoundVariants: []
1645
1646
  });
1646
- var closeButton$1 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
1647
+ var closeButton$2 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
1647
1648
  defaultClassName: "Banner_closeButton__z4crwgx",
1648
1649
  variantClassNames: { variant: {
1649
1650
  info: "Banner_closeButton_variant_info__z4crwgy",
@@ -1656,8 +1657,8 @@ var closeButton$1 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.creat
1656
1657
  compoundVariants: []
1657
1658
  });
1658
1659
  var closeIcon = "Banner_closeIcon__z4crwg13";
1659
- var content$4 = "Banner_content__z4crwg7";
1660
- var description$4 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
1660
+ var content$5 = "Banner_content__z4crwg7";
1661
+ var description$5 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
1661
1662
  defaultClassName: "Banner_description__z4crwgr",
1662
1663
  variantClassNames: { variant: {
1663
1664
  info: "Banner_description_variant_info__z4crwgs",
@@ -1707,7 +1708,7 @@ var link$2 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntim
1707
1708
  compoundVariants: []
1708
1709
  });
1709
1710
  var textContainer = "Banner_textContainer__z4crwgk";
1710
- var title$4 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
1711
+ var title$5 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
1711
1712
  defaultClassName: "Banner_title__z4crwgl",
1712
1713
  variantClassNames: { variant: {
1713
1714
  info: "Banner_title_variant_info__z4crwgm",
@@ -1789,7 +1790,7 @@ const Banner = ({ title: titleText, description: descriptionText, icon: customIc
1789
1790
  })]
1790
1791
  }),
1791
1792
  /* @__PURE__ */ jsxs("div", {
1792
- className: content$4,
1793
+ className: content$5,
1793
1794
  children: [showIcon && /* @__PURE__ */ jsx("div", {
1794
1795
  className: iconContainer({ variant }),
1795
1796
  children: /* @__PURE__ */ jsx("div", {
@@ -1799,10 +1800,10 @@ const Banner = ({ title: titleText, description: descriptionText, icon: customIc
1799
1800
  }), /* @__PURE__ */ jsxs("div", {
1800
1801
  className: textContainer,
1801
1802
  children: [/* @__PURE__ */ jsx("h3", {
1802
- className: title$4({ variant }),
1803
+ className: title$5({ variant }),
1803
1804
  children: titleText
1804
1805
  }), descriptionText && /* @__PURE__ */ jsxs("p", {
1805
- className: description$4({ variant }),
1806
+ className: description$5({ variant }),
1806
1807
  children: [descriptionText, url && urlName && /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("a", {
1807
1808
  href: url,
1808
1809
  target: "_blank",
@@ -1816,7 +1817,7 @@ const Banner = ({ title: titleText, description: descriptionText, icon: customIc
1816
1817
  onClose && /* @__PURE__ */ jsx("button", {
1817
1818
  type: "button",
1818
1819
  onClick: onClose,
1819
- className: closeButton$1({ variant }),
1820
+ className: closeButton$2({ variant }),
1820
1821
  "aria-label": "Close banner",
1821
1822
  children: /* @__PURE__ */ jsx("svg", {
1822
1823
  className: closeIcon,
@@ -2056,7 +2057,7 @@ var stepperWrapper = "Stepper_stepperWrapper__e4qgi2";
2056
2057
 
2057
2058
  //#endregion
2058
2059
  //#region src/components/ui/Stepper.tsx
2059
- const Step = ({ title: title$5, isLoading, isCompleted, isActive, isLast }) => {
2060
+ const Step = ({ title: title$6, isLoading, isCompleted, isActive, isLast }) => {
2060
2061
  return /* @__PURE__ */ jsxs("div", {
2061
2062
  className: stepContainer,
2062
2063
  children: [
@@ -2079,7 +2080,7 @@ const Step = ({ title: title$5, isLoading, isCompleted, isActive, isLast }) => {
2079
2080
  !isLast && /* @__PURE__ */ jsx("div", { className: `${stepLine} ${isCompleted ? stepLineCompleted : stepLinePending}` }),
2080
2081
  /* @__PURE__ */ jsx("span", {
2081
2082
  className: `${stepLabel} ${isActive || isCompleted ? stepLabelActive : stepLabelInactive}`,
2082
- children: title$5
2083
+ children: title$6
2083
2084
  })
2084
2085
  ]
2085
2086
  });
@@ -2103,9 +2104,9 @@ const Stepper = ({ steps, currentStep, isLoading }) => {
2103
2104
 
2104
2105
  //#endregion
2105
2106
  //#region src/components/extend-time-dialog/ExtendTimeDialog.css.ts
2106
- var body$1 = "ExtendTimeDialog_body__1augvc0a";
2107
- var closeButton = "ExtendTimeDialog_closeButton__1augvc09";
2108
- var content$3 = "ExtendTimeDialog_content__1augvc02";
2107
+ var body$2 = "ExtendTimeDialog_body__1augvc0a";
2108
+ var closeButton$1 = "ExtendTimeDialog_closeButton__1augvc09";
2109
+ var content$4 = "ExtendTimeDialog_content__1augvc02";
2109
2110
  var costContent = "ExtendTimeDialog_costContent__1augvc0u";
2110
2111
  var costDivider = "ExtendTimeDialog_costDivider__1augvc011";
2111
2112
  var costError = "ExtendTimeDialog_costError__1augvc0z";
@@ -2117,19 +2118,19 @@ var costSection = "ExtendTimeDialog_costSection__1augvc0s";
2117
2118
  var costValue = "ExtendTimeDialog_costValue__1augvc0x";
2118
2119
  var costWarning = "ExtendTimeDialog_costWarning__1augvc010";
2119
2120
  var dateInputWrapper = "ExtendTimeDialog_dateInputWrapper__1augvc0d";
2120
- var description$3 = "ExtendTimeDialog_description__1augvc08";
2121
- var errorText = "ExtendTimeDialog_errorText__1augvc0h";
2121
+ var description$4 = "ExtendTimeDialog_description__1augvc08";
2122
+ var errorText$1 = "ExtendTimeDialog_errorText__1augvc0h";
2122
2123
  var estimatedBadge = "ExtendTimeDialog_estimatedBadge__1augvc015";
2123
2124
  var fieldGroup = "ExtendTimeDialog_fieldGroup__1augvc0c";
2124
- var footer$1 = "ExtendTimeDialog_footer__1augvc0r";
2125
+ var footer$2 = "ExtendTimeDialog_footer__1augvc0r";
2125
2126
  var formSection = "ExtendTimeDialog_formSection__1augvc0b";
2126
- var header$2 = "ExtendTimeDialog_header__1augvc06";
2127
+ var header$3 = "ExtendTimeDialog_header__1augvc06";
2127
2128
  var infoText = "ExtendTimeDialog_infoText__1augvc0g";
2128
2129
  var inputError = "ExtendTimeDialog_inputError__1augvc0f";
2129
2130
  var loadingContent = "ExtendTimeDialog_loadingContent__1augvc04";
2130
2131
  var loadingOverlay = "ExtendTimeDialog_loadingOverlay__1augvc03";
2131
- var overlay$2 = "ExtendTimeDialog_overlay__1augvc01";
2132
- var spinner$1 = "ExtendTimeDialog_spinner__1augvc05";
2132
+ var overlay$3 = "ExtendTimeDialog_overlay__1augvc01";
2133
+ var spinner$2 = "ExtendTimeDialog_spinner__1augvc05";
2133
2134
  var summaryCard = "ExtendTimeDialog_summaryCard__1augvc0j";
2134
2135
  var summaryContent = "ExtendTimeDialog_summaryContent__1augvc0l";
2135
2136
  var summaryError = "ExtendTimeDialog_summaryError__1augvc0o";
@@ -2137,7 +2138,7 @@ var summaryGrid = "ExtendTimeDialog_summaryGrid__1augvc0i";
2137
2138
  var summaryHeader = "ExtendTimeDialog_summaryHeader__1augvc0k";
2138
2139
  var summarySubtext = "ExtendTimeDialog_summarySubtext__1augvc0n";
2139
2140
  var summaryValue = "ExtendTimeDialog_summaryValue__1augvc0m";
2140
- var title$3 = "ExtendTimeDialog_title__1augvc07";
2141
+ var title$4 = "ExtendTimeDialog_title__1augvc07";
2141
2142
 
2142
2143
  //#endregion
2143
2144
  //#region src/components/extend-time-dialog/ExtendTimeDialog.tsx
@@ -2445,39 +2446,39 @@ const ExtendTimeDialog = ({ siteId, currentAccount, clients: { suiClient, queryC
2445
2446
  return /* @__PURE__ */ jsx(Dialog.Root, {
2446
2447
  open: isOpen,
2447
2448
  onOpenChange: (open) => !open && handleClose(),
2448
- children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay$2 }), /* @__PURE__ */ jsxs(Dialog.Content, {
2449
- className: content$3,
2449
+ children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay$3 }), /* @__PURE__ */ jsxs(Dialog.Content, {
2450
+ className: content$4,
2450
2451
  children: [
2451
2452
  isExtending && /* @__PURE__ */ jsx("div", {
2452
2453
  className: loadingOverlay,
2453
2454
  children: /* @__PURE__ */ jsxs("div", {
2454
2455
  className: loadingContent,
2455
- children: [/* @__PURE__ */ jsx(Loader2, { className: spinner$1 }), /* @__PURE__ */ jsx("p", { children: "Extending storage time..." })]
2456
+ children: [/* @__PURE__ */ jsx(Loader2, { className: spinner$2 }), /* @__PURE__ */ jsx("p", { children: "Extending storage time..." })]
2456
2457
  })
2457
2458
  }),
2458
2459
  /* @__PURE__ */ jsxs("div", {
2459
- className: header$2,
2460
+ className: header$3,
2460
2461
  children: [
2461
2462
  /* @__PURE__ */ jsxs(Dialog.Title, {
2462
- className: title$3,
2463
+ className: title$4,
2463
2464
  children: ["Extend Time for ", siteData.name]
2464
2465
  }),
2465
2466
  /* @__PURE__ */ jsx(Dialog.Description, {
2466
- className: description$3,
2467
+ className: description$4,
2467
2468
  children: "Add epochs to extend the storage time for blobs in this site. Epochs will be added to the current expiration time."
2468
2469
  }),
2469
2470
  /* @__PURE__ */ jsx(Dialog.Close, {
2470
2471
  asChild: true,
2471
2472
  children: /* @__PURE__ */ jsx("button", {
2472
2473
  type: "button",
2473
- className: closeButton,
2474
+ className: closeButton$1,
2474
2475
  children: /* @__PURE__ */ jsx(X, { size: 20 })
2475
2476
  })
2476
2477
  })
2477
2478
  ]
2478
2479
  }),
2479
2480
  /* @__PURE__ */ jsxs("div", {
2480
- className: body$1,
2481
+ className: body$2,
2481
2482
  children: [
2482
2483
  currentEpochsRemaining === 0 && /* @__PURE__ */ jsx(Banner, {
2483
2484
  title: "Site Expired",
@@ -2523,7 +2524,7 @@ const ExtendTimeDialog = ({ siteId, currentAccount, clients: { suiClient, queryC
2523
2524
  ] })]
2524
2525
  }),
2525
2526
  dateError && /* @__PURE__ */ jsx("p", {
2526
- className: errorText,
2527
+ className: errorText$1,
2527
2528
  children: dateError
2528
2529
  })
2529
2530
  ]
@@ -2637,7 +2638,7 @@ const ExtendTimeDialog = ({ siteId, currentAccount, clients: { suiClient, queryC
2637
2638
  className: costLoading,
2638
2639
  children: [/* @__PURE__ */ jsx(Loader2, {
2639
2640
  size: 14,
2640
- className: spinner$1
2641
+ className: spinner$2
2641
2642
  }), /* @__PURE__ */ jsx("span", { children: "Calculating cost..." })]
2642
2643
  }) : storageCostData || estimatedCostData ? /* @__PURE__ */ jsxs(Fragment, { children: [
2643
2644
  totalFileSize === null && estimatedFileSize !== null && /* @__PURE__ */ jsxs("div", {
@@ -2680,7 +2681,7 @@ const ExtendTimeDialog = ({ siteId, currentAccount, clients: { suiClient, queryC
2680
2681
  ]
2681
2682
  }),
2682
2683
  /* @__PURE__ */ jsxs("div", {
2683
- className: footer$1,
2684
+ className: footer$2,
2684
2685
  children: [/* @__PURE__ */ jsx(Button, {
2685
2686
  variant: "outline",
2686
2687
  onClick: handleClose,
@@ -2701,14 +2702,14 @@ var ExtendTimeDialog_default = ExtendTimeDialog;
2701
2702
  //#endregion
2702
2703
  //#region src/components/publish-menu/PublishMenu.css.ts
2703
2704
  var buttonGroup$1 = "PublishMenu_buttonGroup__13o2p6d7";
2704
- var content$2 = "PublishMenu_content__13o2p6d0";
2705
- var description$2 = "PublishMenu_description__13o2p6d4";
2706
- var footer = "PublishMenu_footer__13o2p6d6";
2707
- var header$1 = "PublishMenu_header__13o2p6d2";
2705
+ var content$3 = "PublishMenu_content__13o2p6d0";
2706
+ var description$3 = "PublishMenu_description__13o2p6d4";
2707
+ var footer$1 = "PublishMenu_footer__13o2p6d6";
2708
+ var header$2 = "PublishMenu_header__13o2p6d2";
2708
2709
  var item = "PublishMenu_item__13o2p6d1";
2709
2710
  var link$1 = "PublishMenu_link__13o2p6d5";
2710
2711
  var separator = "PublishMenu_separator__13o2p6d8";
2711
- var title$2 = "PublishMenu_title__13o2p6d3";
2712
+ var title$3 = "PublishMenu_title__13o2p6d3";
2712
2713
 
2713
2714
  //#endregion
2714
2715
  //#region src/components/publish-menu/PublishMenu.tsx
@@ -2726,15 +2727,15 @@ const PublishMenu = ({ children, siteId, onPublishClick, onDomainClick, portalDo
2726
2727
  asChild: true,
2727
2728
  children
2728
2729
  }), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
2729
- className: content$2,
2730
+ className: content$3,
2730
2731
  children: [
2731
2732
  /* @__PURE__ */ jsxs("div", {
2732
- className: header$1,
2733
+ className: header$2,
2733
2734
  children: [/* @__PURE__ */ jsx("h4", {
2734
- className: title$2,
2735
+ className: title$3,
2735
2736
  children: isDeployed ? "Update your Site" : "Publish your Site"
2736
2737
  }), isDeployed && walrusSiteUrl ? associatedDomains.length > 0 && suiNSUrl ? /* @__PURE__ */ jsxs("p", {
2737
- className: description$2,
2738
+ className: description$3,
2738
2739
  children: [
2739
2740
  "Your site is live at",
2740
2741
  " ",
@@ -2748,7 +2749,7 @@ const PublishMenu = ({ children, siteId, onPublishClick, onDomainClick, portalDo
2748
2749
  ". You can update your site to reflect the latest changes."
2749
2750
  ]
2750
2751
  }) : /* @__PURE__ */ jsxs("p", {
2751
- className: description$2,
2752
+ className: description$3,
2752
2753
  children: [
2753
2754
  "Your site is live at",
2754
2755
  " ",
@@ -2767,7 +2768,7 @@ const PublishMenu = ({ children, siteId, onPublishClick, onDomainClick, portalDo
2767
2768
  ". You can link SuiNS domains to view your site in the portal."
2768
2769
  ]
2769
2770
  }) : /* @__PURE__ */ jsxs("p", {
2770
- className: description$2,
2771
+ className: description$3,
2771
2772
  children: [
2772
2773
  "Deploy your app to",
2773
2774
  " ",
@@ -2831,7 +2832,7 @@ const PublishMenu = ({ children, siteId, onPublishClick, onDomainClick, portalDo
2831
2832
  }),
2832
2833
  /* @__PURE__ */ jsx(DropdownMenu.Separator, { className: separator }),
2833
2834
  /* @__PURE__ */ jsxs("div", {
2834
- className: footer,
2835
+ className: footer$1,
2835
2836
  children: [isDeployed && walrusSiteUrl ? /* @__PURE__ */ jsxs("div", {
2836
2837
  className: buttonGroup$1,
2837
2838
  children: [suiNSUrl ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
@@ -2886,9 +2887,9 @@ var PublishMenu_default = PublishMenu;
2886
2887
  //#endregion
2887
2888
  //#region src/components/publish-modal/PublishModal.css.ts
2888
2889
  var buttonGroup = "PublishModal_buttonGroup__m8gxhre";
2889
- var charCount = "PublishModal_charCount__m8gxhr11";
2890
- var content$1 = "PublishModal_content__m8gxhr2";
2891
- var description$1 = "PublishModal_description__m8gxhr4";
2890
+ var charCount$1 = "PublishModal_charCount__m8gxhr11";
2891
+ var content$2 = "PublishModal_content__m8gxhr2";
2892
+ var description$2 = "PublishModal_description__m8gxhr4";
2892
2893
  var dialogBodyTwoColumn = "PublishModal_dialogBodyTwoColumn__m8gxhru";
2893
2894
  var dialogContent = "PublishModal_dialogContent__m8gxhrr";
2894
2895
  var dialogFooter = "PublishModal_dialogFooter__m8gxhrw";
@@ -2896,30 +2897,30 @@ var dialogHeader = "PublishModal_dialogHeader__m8gxhrs";
2896
2897
  var dialogOverlay = "PublishModal_dialogOverlay__m8gxhrq";
2897
2898
  var dialogRightColumn = "PublishModal_dialogRightColumn__m8gxhrv";
2898
2899
  var editButton = "PublishModal_editButton__m8gxhro";
2899
- var fieldLabel = "PublishModal_fieldLabel__m8gxhr10";
2900
+ var fieldLabel$1 = "PublishModal_fieldLabel__m8gxhr10";
2900
2901
  var flickeringGrid = "PublishModal_flickeringGrid__m8gxhri";
2901
2902
  var leftColumn = "PublishModal_leftColumn__m8gxhr8";
2902
2903
  var maskLayer = "PublishModal_maskLayer__m8gxhrj";
2903
2904
  var metadataFields = "PublishModal_metadataFields__m8gxhra";
2904
- var overlay$1 = "PublishModal_overlay__m8gxhr1";
2905
+ var overlay$2 = "PublishModal_overlay__m8gxhr1";
2905
2906
  var placeholderContent = "PublishModal_placeholderContent__m8gxhrk";
2906
2907
  var placeholderIcon = "PublishModal_placeholderIcon__m8gxhrn";
2907
2908
  var previewArea = "PublishModal_previewArea__m8gxhrh";
2908
2909
  var previewContainer = "PublishModal_previewContainer__m8gxhrg";
2909
- var previewImage = "PublishModal_previewImage__m8gxhrm";
2910
+ var previewImage$1 = "PublishModal_previewImage__m8gxhrm";
2910
2911
  var previewImageWrapper = "PublishModal_previewImageWrapper__m8gxhrl";
2911
2912
  var rightColumn = "PublishModal_rightColumn__m8gxhr9";
2912
2913
  var section$1 = "PublishModal_section__m8gxhr6";
2913
- var spinner = "PublishModal_spinner__m8gxhr1e";
2914
+ var spinner$1 = "PublishModal_spinner__m8gxhr1e";
2914
2915
  var storageCostLabel = "PublishModal_storageCostLabel__m8gxhr1a";
2915
2916
  var storageCostSection = "PublishModal_storageCostSection__m8gxhr18";
2916
2917
  var storageCostSummary = "PublishModal_storageCostSummary__m8gxhr19";
2917
2918
  var storageCostValue = "PublishModal_storageCostValue__m8gxhr1b";
2918
2919
  var storageDetailsBox = "PublishModal_storageDetailsBox__m8gxhr1d";
2919
- var title$1 = "PublishModal_title__m8gxhr3";
2920
+ var title$2 = "PublishModal_title__m8gxhr3";
2920
2921
  var twoColumnSection = "PublishModal_twoColumnSection__m8gxhr7";
2921
2922
  var uploadAreaSquare = "PublishModal_uploadAreaSquare__m8gxhry";
2922
- var uploadPlaceholder = "PublishModal_uploadPlaceholder__m8gxhrz";
2923
+ var uploadPlaceholder$1 = "PublishModal_uploadPlaceholder__m8gxhrz";
2923
2924
 
2924
2925
  //#endregion
2925
2926
  //#region src/components/publish-modal/PublishModal.tsx
@@ -2938,8 +2939,8 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
2938
2939
  const epochs = useStore(siteMetadataStore.epochs);
2939
2940
  const isDirty = useStore(siteMetadataStore.isDirty);
2940
2941
  const isLoading = useStore(siteMetadataStore.loading);
2941
- const title$5 = useStore(siteMetadataStore.title);
2942
- const description$5 = useStore(siteMetadataStore.description);
2942
+ const title$6 = useStore(siteMetadataStore.title);
2943
+ const description$6 = useStore(siteMetadataStore.description);
2943
2944
  const { epochDurationMs, getExpirationDate } = useEpochDuration(walrusClient);
2944
2945
  useEffect(() => {
2945
2946
  if (siteId && epochs && previousEpochs === 0) setPreviousEpochs(epochs);
@@ -3029,15 +3030,15 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3029
3030
  return /* @__PURE__ */ jsxs(Dialog.Root, {
3030
3031
  open: isOpen,
3031
3032
  onOpenChange: sitePublishingStore.closePublishDialog,
3032
- children: [/* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay$1 }), /* @__PURE__ */ jsxs(Dialog.Content, {
3033
- className: content$1,
3033
+ children: [/* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay$2 }), /* @__PURE__ */ jsxs(Dialog.Content, {
3034
+ className: content$2,
3034
3035
  children: [
3035
3036
  /* @__PURE__ */ jsx(Dialog.Title, {
3036
- className: title$1,
3037
+ className: title$2,
3037
3038
  children: siteId ? "Edit Site" : "Publish New Site"
3038
3039
  }),
3039
3040
  /* @__PURE__ */ jsx(Dialog.Description, {
3040
- className: description$1,
3041
+ className: description$2,
3041
3042
  children: "Make your project live in the Walrus network."
3042
3043
  }),
3043
3044
  /* @__PURE__ */ jsx(Stepper, {
@@ -3059,7 +3060,7 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3059
3060
  /* @__PURE__ */ jsx("img", {
3060
3061
  src: imageDisplayUrl,
3061
3062
  alt: "Site preview",
3062
- className: previewImage
3063
+ className: previewImage$1
3063
3064
  }),
3064
3065
  /* @__PURE__ */ jsx("div", { style: {
3065
3066
  position: "absolute",
@@ -3067,7 +3068,7 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3067
3068
  background: "linear-gradient(to bottom, transparent 0%, transparent 50%, rgba(0, 0, 0, 0.7) 100%)",
3068
3069
  pointerEvents: "none"
3069
3070
  } }),
3070
- (title$5 || description$5) && /* @__PURE__ */ jsxs("div", {
3071
+ (title$6 || description$6) && /* @__PURE__ */ jsxs("div", {
3071
3072
  style: {
3072
3073
  position: "absolute",
3073
3074
  bottom: 0,
@@ -3077,7 +3078,7 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3077
3078
  color: "white",
3078
3079
  pointerEvents: "none"
3079
3080
  },
3080
- children: [title$5 && /* @__PURE__ */ jsx("h3", {
3081
+ children: [title$6 && /* @__PURE__ */ jsx("h3", {
3081
3082
  style: {
3082
3083
  fontSize: "0.875rem",
3083
3084
  fontWeight: 600,
@@ -3089,8 +3090,8 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3089
3090
  WebkitLineClamp: 2,
3090
3091
  WebkitBoxOrient: "vertical"
3091
3092
  },
3092
- children: title$5
3093
- }), description$5 && /* @__PURE__ */ jsx("p", {
3093
+ children: title$6
3094
+ }), description$6 && /* @__PURE__ */ jsx("p", {
3094
3095
  style: {
3095
3096
  fontSize: "0.75rem",
3096
3097
  opacity: .9,
@@ -3101,7 +3102,7 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3101
3102
  WebkitLineClamp: 2,
3102
3103
  WebkitBoxOrient: "vertical"
3103
3104
  },
3104
- children: description$5
3105
+ children: description$6
3105
3106
  })]
3106
3107
  })
3107
3108
  ]
@@ -3311,9 +3312,9 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3311
3312
  className: dialogRightColumn,
3312
3313
  children: [
3313
3314
  /* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs("div", {
3314
- className: fieldLabel,
3315
+ className: fieldLabel$1,
3315
3316
  children: [/* @__PURE__ */ jsx(Label, { children: "Title" }), /* @__PURE__ */ jsxs("span", {
3316
- className: charCount,
3317
+ className: charCount$1,
3317
3318
  children: [siteMetadataStore.title.get().length, "/120"]
3318
3319
  })]
3319
3320
  }), /* @__PURE__ */ jsx(Input, {
@@ -3322,9 +3323,9 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3322
3323
  placeholder: "Add a title..."
3323
3324
  })] }),
3324
3325
  /* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs("div", {
3325
- className: fieldLabel,
3326
+ className: fieldLabel$1,
3326
3327
  children: [/* @__PURE__ */ jsx(Label, { children: "Description" }), /* @__PURE__ */ jsxs("span", {
3327
- className: charCount,
3328
+ className: charCount$1,
3328
3329
  children: [siteMetadataStore.description.get().length, "/150"]
3329
3330
  })]
3330
3331
  }), /* @__PURE__ */ jsx(Textarea, {
@@ -3346,7 +3347,7 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3346
3347
  })] }),
3347
3348
  !siteId && /* @__PURE__ */ jsxs("fieldset", { children: [
3348
3349
  /* @__PURE__ */ jsxs("div", {
3349
- className: fieldLabel,
3350
+ className: fieldLabel$1,
3350
3351
  children: [/* @__PURE__ */ jsx(Label, { children: "Storage Duration" }), epochs > 0 && /* @__PURE__ */ jsxs("span", {
3351
3352
  style: {
3352
3353
  fontSize: "0.75rem",
@@ -3439,7 +3440,7 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3439
3440
  disabled: isLoading || isExtending,
3440
3441
  children: isLoading || isExtending ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Loader2, {
3441
3442
  size: 16,
3442
- className: spinner
3443
+ className: spinner$1
3443
3444
  }), isExtending ? "Extending Storage..." : "Saving..."] }) : "Save"
3444
3445
  })]
3445
3446
  })
@@ -3460,7 +3461,7 @@ const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs,
3460
3461
  disabled: isWorking,
3461
3462
  children: [isWorking && /* @__PURE__ */ jsx(Loader2, {
3462
3463
  size: 16,
3463
- className: spinner
3464
+ className: spinner$1
3464
3465
  }), deployStatusText]
3465
3466
  })
3466
3467
  }), /* @__PURE__ */ jsx(Banner, {
@@ -3562,7 +3563,7 @@ function MetadataEditDialog({ isOpen, onClose }) {
3562
3563
  className: dialogBodyTwoColumn,
3563
3564
  children: /* @__PURE__ */ jsxs("div", { children: [
3564
3565
  /* @__PURE__ */ jsxs("div", {
3565
- className: fieldLabel,
3566
+ className: fieldLabel$1,
3566
3567
  children: [/* @__PURE__ */ jsx(Label, { children: "Preview Image" }), /* @__PURE__ */ jsx("span", {
3567
3568
  style: {
3568
3569
  fontSize: "0.75rem",
@@ -3631,7 +3632,7 @@ function MetadataEditDialog({ isOpen, onClose }) {
3631
3632
  opacity: isLoading ? .6 : 1
3632
3633
  },
3633
3634
  children: isLoading ? /* @__PURE__ */ jsxs("div", {
3634
- className: uploadPlaceholder,
3635
+ className: uploadPlaceholder$1,
3635
3636
  children: [/* @__PURE__ */ jsx("div", { style: {
3636
3637
  width: "32px",
3637
3638
  height: "32px",
@@ -3658,7 +3659,7 @@ function MetadataEditDialog({ isOpen, onClose }) {
3658
3659
  borderRadius: "0.5rem"
3659
3660
  }
3660
3661
  }) : /* @__PURE__ */ jsxs("div", {
3661
- className: uploadPlaceholder,
3662
+ className: uploadPlaceholder$1,
3662
3663
  children: [
3663
3664
  /* @__PURE__ */ jsx(Upload, {
3664
3665
  size: 32,
@@ -4629,9 +4630,9 @@ var DomainCardSvg_default = DomainCardSvg;
4629
4630
 
4630
4631
  //#endregion
4631
4632
  //#region src/components/suins-modal/SuiNsModal.css.ts
4632
- var body = "SuiNsModal_body__lh8k8k5";
4633
- var content = "SuiNsModal_content__lh8k8k1";
4634
- var description = "SuiNsModal_description__lh8k8k4";
4633
+ var body$1 = "SuiNsModal_body__lh8k8k5";
4634
+ var content$1 = "SuiNsModal_content__lh8k8k1";
4635
+ var description$1 = "SuiNsModal_description__lh8k8k4";
4635
4636
  var domainCard = "SuiNsModal_domainCard__lh8k8kb";
4636
4637
  var domainCardBg = "SuiNsModal_domainCardBg__lh8k8kc";
4637
4638
  var domainCardGrid = "SuiNsModal_domainCardGrid__lh8k8ka";
@@ -4639,13 +4640,13 @@ var domainExpiry = "SuiNsModal_domainExpiry__lh8k8ke";
4639
4640
  var domainItem = "SuiNsModal_domainItem__lh8k8k9";
4640
4641
  var domainList = "SuiNsModal_domainList__lh8k8k8";
4641
4642
  var domainName = "SuiNsModal_domainName__lh8k8kd";
4642
- var header = "SuiNsModal_header__lh8k8k2";
4643
+ var header$1 = "SuiNsModal_header__lh8k8k2";
4643
4644
  var link = "SuiNsModal_link__lh8k8kg";
4644
4645
  var loadingSpinner = "SuiNsModal_loadingSpinner__lh8k8kh";
4645
- var overlay = "SuiNsModal_overlay__lh8k8k0";
4646
+ var overlay$1 = "SuiNsModal_overlay__lh8k8k0";
4646
4647
  var section = "SuiNsModal_section__lh8k8k6";
4647
4648
  var sectionTitle = "SuiNsModal_sectionTitle__lh8k8k7";
4648
- var title = "SuiNsModal_title__lh8k8k3";
4649
+ var title$1 = "SuiNsModal_title__lh8k8k3";
4649
4650
 
4650
4651
  //#endregion
4651
4652
  //#region src/components/suins-modal/RegisterSuiNsDialog.tsx
@@ -4676,13 +4677,13 @@ const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, cl
4676
4677
  open: isOpen,
4677
4678
  onOpenChange: (open) => !open && handleClose(),
4678
4679
  children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, {
4679
- className: overlay,
4680
+ className: overlay$1,
4680
4681
  style: {
4681
4682
  zIndex: 51,
4682
4683
  backgroundColor: "rgba(0, 0, 0, 0.7)"
4683
4684
  }
4684
4685
  }), /* @__PURE__ */ jsxs(Dialog.Content, {
4685
- className: content,
4686
+ className: content$1,
4686
4687
  style: {
4687
4688
  maxWidth: "32rem",
4688
4689
  zIndex: 52
@@ -4722,14 +4723,14 @@ const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, cl
4722
4723
  })
4723
4724
  }),
4724
4725
  /* @__PURE__ */ jsxs("div", {
4725
- className: header,
4726
+ className: header$1,
4726
4727
  children: [
4727
4728
  /* @__PURE__ */ jsx(Dialog.Title, {
4728
- className: title,
4729
+ className: title$1,
4729
4730
  children: "Register SuiNS Domain"
4730
4731
  }),
4731
4732
  /* @__PURE__ */ jsx(Dialog.Description, {
4732
- className: description,
4733
+ className: description$1,
4733
4734
  children: "Search and register a new .sui domain name"
4734
4735
  }),
4735
4736
  /* @__PURE__ */ jsx(Dialog.Close, {
@@ -4760,7 +4761,7 @@ const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, cl
4760
4761
  ]
4761
4762
  }),
4762
4763
  /* @__PURE__ */ jsxs("div", {
4763
- className: body,
4764
+ className: body$1,
4764
4765
  children: [
4765
4766
  /* @__PURE__ */ jsxs("div", {
4766
4767
  style: { marginBottom: "1rem" },
@@ -5136,8 +5137,8 @@ const SuiNsModal = ({ siteId, onAssociateDomain, currentAccount, portalDomain, p
5136
5137
  return /* @__PURE__ */ jsxs(Dialog.Root, {
5137
5138
  open: isOpen,
5138
5139
  onOpenChange: isDomainDialogOpen.set,
5139
- children: [/* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay }), /* @__PURE__ */ jsxs(Dialog.Content, {
5140
- className: content,
5140
+ children: [/* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay$1 }), /* @__PURE__ */ jsxs(Dialog.Content, {
5141
+ className: content$1,
5141
5142
  children: [
5142
5143
  isAssigning && /* @__PURE__ */ jsx("div", {
5143
5144
  style: {
@@ -5173,17 +5174,17 @@ const SuiNsModal = ({ siteId, onAssociateDomain, currentAccount, portalDomain, p
5173
5174
  })
5174
5175
  }),
5175
5176
  /* @__PURE__ */ jsxs("div", {
5176
- className: header,
5177
+ className: header$1,
5177
5178
  children: [/* @__PURE__ */ jsx(Dialog.Title, {
5178
- className: title,
5179
+ className: title$1,
5179
5180
  children: "Customize Domain"
5180
5181
  }), /* @__PURE__ */ jsx(Dialog.Description, {
5181
- className: description,
5182
+ className: description$1,
5182
5183
  children: "Associate your website with a SuiNS domain for easy access"
5183
5184
  })]
5184
5185
  }),
5185
5186
  /* @__PURE__ */ jsxs("div", {
5186
- className: body,
5187
+ className: body$1,
5187
5188
  children: [
5188
5189
  /* @__PURE__ */ jsxs("div", {
5189
5190
  className: section,
@@ -5429,5 +5430,392 @@ const PublishButton = ({ children, siteId, assets, onUpdateSiteMetadata, onAssoc
5429
5430
  var PublishButton_default = PublishButton;
5430
5431
 
5431
5432
  //#endregion
5432
- export { Banner, Button, DeploySteps, DeploymentStatus, FlickeringGrid, Input, Label, PublishButton_default as PublishButton, PublishMenu_default as PublishMenu, PublishModal_default as PublishModal, Stepper, SuiNsModal_default as SuiNsModal, Textarea, isAssigningDomain, isDomainDialogOpen, isExtendTimeDialogOpen, isRegisterSuiNSDomainDialogOpen, siteMetadataStore, sitePublishingStore, useEpochDuration, useSitePublishing, useSuiNsDomainsQuery, useSuiNsRegistration, useTransactionExecutor, useUpdateSiteMetadata, useWalrusSiteQuery, useWalrusSitesQuery, useZenFsWorkspace, useZenfsFilesQuery };
5433
+ //#region src/components/update-metadata-modal/UpdateMetadataModal.css.ts
5434
+ var body = "UpdateMetadataModal_body__1b8g8dv7";
5435
+ var charCount = "UpdateMetadataModal_charCount__1b8g8dvb";
5436
+ var closeButton = "UpdateMetadataModal_closeButton__1b8g8dv6";
5437
+ var content = "UpdateMetadataModal_content__1b8g8dv2";
5438
+ var description = "UpdateMetadataModal_description__1b8g8dv5";
5439
+ var errorBanner = "UpdateMetadataModal_errorBanner__1b8g8dvo";
5440
+ var errorText = "UpdateMetadataModal_errorText__1b8g8dvn";
5441
+ var fieldLabel = "UpdateMetadataModal_fieldLabel__1b8g8dva";
5442
+ var footer = "UpdateMetadataModal_footer__1b8g8dv9";
5443
+ var header = "UpdateMetadataModal_header__1b8g8dv3";
5444
+ var imagePreview = "UpdateMetadataModal_imagePreview__1b8g8dvl";
5445
+ var loadingContainer = "UpdateMetadataModal_loadingContainer__1b8g8dv8";
5446
+ var optionalLabel = "UpdateMetadataModal_optionalLabel__1b8g8dvc";
5447
+ var overlay = "UpdateMetadataModal_overlay__1b8g8dv1";
5448
+ var previewImage = "UpdateMetadataModal_previewImage__1b8g8dvj";
5449
+ var spinner = "UpdateMetadataModal_spinner__1b8g8dvq";
5450
+ var title = "UpdateMetadataModal_title__1b8g8dv4";
5451
+ var uploadArea = "UpdateMetadataModal_uploadArea__1b8g8dvg";
5452
+ var uploadHint = "UpdateMetadataModal_uploadHint__1b8g8dvi";
5453
+ var uploadModeButton = "UpdateMetadataModal_uploadModeButton__1b8g8dve";
5454
+ var uploadModeButtonActive = "UpdateMetadataModal_uploadModeButtonActive__1b8g8dvf";
5455
+ var uploadModeToggle = "UpdateMetadataModal_uploadModeToggle__1b8g8dvd";
5456
+ var uploadPlaceholder = "UpdateMetadataModal_uploadPlaceholder__1b8g8dvh";
5457
+ var urlInputContainer = "UpdateMetadataModal_urlInputContainer__1b8g8dvk";
5458
+ var urlInputWrapper = "UpdateMetadataModal_urlInputWrapper__1b8g8dvm";
5459
+ var warningBanner = "UpdateMetadataModal_warningBanner__1b8g8dvp";
5460
+
5461
+ //#endregion
5462
+ //#region src/components/update-metadata-modal/UpdateMetadataModal.tsx
5463
+ /**
5464
+ * UpdateMetadataModal Component
5465
+ *
5466
+ * A modal dialog component for updating metadata (name, description, project URL, preview image)
5467
+ * of an existing Walrus site on the Sui blockchain.
5468
+ *
5469
+ * ## Features
5470
+ * - Updates site name (max 120 chars), description (max 150 chars), project URL, and preview image
5471
+ * - Supports image upload (max 5MB) or URL input
5472
+ * - Validates wallet connection before allowing submission
5473
+ * - Automatically loads current site metadata when opened
5474
+ * - Shows loading states and error messages
5475
+ *
5476
+ * ## Usage
5477
+ *
5478
+ * ```tsx
5479
+ * import { UpdateMetadataModal, isUpdateMetadataModalOpen } from '@cmdoss/walrus-site-builder-react'
5480
+ * import { useStore } from '@nanostores/react'
5481
+ *
5482
+ * function MyComponent() {
5483
+ * const isOpen = useStore(isUpdateMetadataModalOpen)
5484
+ *
5485
+ * return (
5486
+ * <UpdateMetadataModal
5487
+ * siteId="0x123..."
5488
+ * isOpen={isOpen}
5489
+ * onOpenChange={isUpdateMetadataModalOpen.set}
5490
+ * onSuccess={(digest) => console.log('Updated:', digest)}
5491
+ * clients={{ suiClient, queryClient, walrusClient }}
5492
+ * currentAccount={currentAccount}
5493
+ * signAndExecuteTransaction={signAndExecuteTransaction}
5494
+ * />
5495
+ * )
5496
+ * }
5497
+ * ```
5498
+ *
5499
+ * ## State Management
5500
+ *
5501
+ * The modal visibility is typically controlled via the `isUpdateMetadataModalOpen` atom:
5502
+ *
5503
+ * ```tsx
5504
+ * import { isUpdateMetadataModalOpen } from '@cmdoss/walrus-site-builder-react'
5505
+ *
5506
+ * // Open modal
5507
+ * isUpdateMetadataModalOpen.set(true)
5508
+ *
5509
+ * // Close modal
5510
+ * isUpdateMetadataModalOpen.set(false)
5511
+ * ```
5512
+ *
5513
+ * @see {@link useUpdateSiteMetadata} - The hook used internally for metadata updates
5514
+ * @see {@link useWalrusSiteQuery} - Used to fetch current site data
5515
+ */
5516
+ const UpdateMetadataModal = ({ siteId, isOpen, onOpenChange, onSuccess, onError, clients: { suiClient, queryClient, walrusClient }, currentAccount, signAndExecuteTransaction, sponsorConfig }) => {
5517
+ const [siteName, setSiteName] = useState("");
5518
+ const [description$6, setDescription] = useState("");
5519
+ const [projectUrl, setProjectUrl] = useState("");
5520
+ const [imageUrl, setImageUrl] = useState("");
5521
+ const [uploadMode, setUploadMode] = useState("url");
5522
+ const [urlInput, setUrlInput] = useState("");
5523
+ const [urlError, setUrlError] = useState("");
5524
+ const [fileSizeError, setFileSizeError] = useState("");
5525
+ const fileInputRef = useRef(null);
5526
+ const MAX_FILE_SIZE = 5 * 1024 * 1024;
5527
+ const { data: siteData, isLoading: isLoadingSite } = useWalrusSiteQuery(siteId, {
5528
+ suiClient,
5529
+ queryClient
5530
+ });
5531
+ const { updateSiteMetadata, isUpdating, error } = useUpdateSiteMetadata({
5532
+ siteId,
5533
+ clients: {
5534
+ suiClient,
5535
+ queryClient,
5536
+ walrusClient
5537
+ },
5538
+ currentAccount,
5539
+ signAndExecuteTransaction,
5540
+ sponsorConfig
5541
+ });
5542
+ const isSdkReady = !!currentAccount && !!suiClient && !!walrusClient;
5543
+ useEffect(() => {
5544
+ if (siteData && isOpen) {
5545
+ setSiteName(siteData.name || "");
5546
+ setDescription(siteData.description || "");
5547
+ setProjectUrl(siteData.project_url || "");
5548
+ setImageUrl(siteData.image_url || "");
5549
+ setUrlInput(siteData.image_url || "");
5550
+ }
5551
+ }, [siteData, isOpen]);
5552
+ useEffect(() => {
5553
+ if (!isOpen) {
5554
+ setUrlError("");
5555
+ setFileSizeError("");
5556
+ setUploadMode("url");
5557
+ }
5558
+ }, [isOpen]);
5559
+ const handleImageChange = (e) => {
5560
+ const file = e.target.files?.[0];
5561
+ if (!file) return;
5562
+ if (file.size > MAX_FILE_SIZE) {
5563
+ setFileSizeError(`File size exceeds 5MB limit (${(file.size / 1024 / 1024).toFixed(2)}MB)`);
5564
+ e.target.value = "";
5565
+ return;
5566
+ }
5567
+ setFileSizeError("");
5568
+ const reader = new FileReader();
5569
+ reader.onload = (e$1) => {
5570
+ const result = e$1.target?.result;
5571
+ if (typeof result === "string") setImageUrl(result);
5572
+ };
5573
+ reader.readAsDataURL(file);
5574
+ };
5575
+ const handleUrlSubmit = () => {
5576
+ if (!urlInput.trim()) {
5577
+ setUrlError("Please enter a valid URL");
5578
+ return;
5579
+ }
5580
+ try {
5581
+ new URL(urlInput);
5582
+ setImageUrl(urlInput);
5583
+ setUrlError("");
5584
+ } catch {
5585
+ setUrlError("Please enter a valid URL");
5586
+ }
5587
+ };
5588
+ const handleSubmit = async () => {
5589
+ if (!isSdkReady) {
5590
+ onError?.(/* @__PURE__ */ new Error("Wallet not connected. Please connect your wallet first."));
5591
+ return;
5592
+ }
5593
+ try {
5594
+ const digest = await updateSiteMetadata({
5595
+ siteName,
5596
+ metadata: {
5597
+ description: description$6 || void 0,
5598
+ project_url: projectUrl || void 0,
5599
+ image_url: imageUrl || void 0
5600
+ }
5601
+ });
5602
+ onSuccess?.(digest);
5603
+ onOpenChange(false);
5604
+ } catch (err) {
5605
+ const error$1 = err instanceof Error ? err : /* @__PURE__ */ new Error("Unknown error");
5606
+ onError?.(error$1);
5607
+ }
5608
+ };
5609
+ const hasChanges = siteName !== (siteData?.name || "") || description$6 !== (siteData?.description || "") || projectUrl !== (siteData?.project_url || "") || imageUrl !== (siteData?.image_url || "");
5610
+ const isLoading = isLoadingSite || isUpdating;
5611
+ return /* @__PURE__ */ jsx(Dialog.Root, {
5612
+ open: isOpen,
5613
+ onOpenChange,
5614
+ children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay }), /* @__PURE__ */ jsxs(Dialog.Content, {
5615
+ className: content,
5616
+ children: [
5617
+ /* @__PURE__ */ jsxs("div", {
5618
+ className: header,
5619
+ children: [
5620
+ /* @__PURE__ */ jsx(Dialog.Title, {
5621
+ className: title,
5622
+ children: "Update Site Metadata"
5623
+ }),
5624
+ /* @__PURE__ */ jsx(Dialog.Description, {
5625
+ className: description,
5626
+ children: "Update the metadata for your site"
5627
+ }),
5628
+ /* @__PURE__ */ jsx(Dialog.Close, {
5629
+ asChild: true,
5630
+ children: /* @__PURE__ */ jsx("button", {
5631
+ type: "button",
5632
+ className: closeButton,
5633
+ children: /* @__PURE__ */ jsx(X, { size: 20 })
5634
+ })
5635
+ })
5636
+ ]
5637
+ }),
5638
+ isLoadingSite ? /* @__PURE__ */ jsxs("div", {
5639
+ className: loadingContainer,
5640
+ children: [/* @__PURE__ */ jsx(Loader2, {
5641
+ size: 24,
5642
+ className: spinner
5643
+ }), /* @__PURE__ */ jsx("p", { children: "Loading site data..." })]
5644
+ }) : /* @__PURE__ */ jsxs("div", {
5645
+ className: body,
5646
+ children: [
5647
+ /* @__PURE__ */ jsxs("fieldset", { children: [
5648
+ /* @__PURE__ */ jsxs("div", {
5649
+ className: fieldLabel,
5650
+ children: [/* @__PURE__ */ jsx(Label, { children: "Preview Image" }), /* @__PURE__ */ jsx("span", {
5651
+ className: optionalLabel,
5652
+ children: "Max 5MB"
5653
+ })]
5654
+ }),
5655
+ /* @__PURE__ */ jsxs("div", {
5656
+ className: uploadModeToggle,
5657
+ children: [/* @__PURE__ */ jsx("button", {
5658
+ type: "button",
5659
+ onClick: () => {
5660
+ setUploadMode("file");
5661
+ setUrlError("");
5662
+ },
5663
+ className: uploadMode === "file" ? uploadModeButtonActive : uploadModeButton,
5664
+ children: "Upload File"
5665
+ }), /* @__PURE__ */ jsx("button", {
5666
+ type: "button",
5667
+ onClick: () => {
5668
+ setUploadMode("url");
5669
+ setFileSizeError("");
5670
+ },
5671
+ className: uploadMode === "url" ? uploadModeButtonActive : uploadModeButton,
5672
+ children: "From URL"
5673
+ })]
5674
+ }),
5675
+ uploadMode === "file" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5676
+ /* @__PURE__ */ jsx("div", {
5677
+ className: uploadArea,
5678
+ onClick: () => !isUpdating && fileInputRef.current?.click(),
5679
+ style: {
5680
+ cursor: isUpdating ? "wait" : "pointer",
5681
+ opacity: isUpdating ? .6 : 1
5682
+ },
5683
+ children: imageUrl ? /* @__PURE__ */ jsx("img", {
5684
+ src: imageUrl,
5685
+ alt: "Preview",
5686
+ className: previewImage
5687
+ }) : /* @__PURE__ */ jsxs("div", {
5688
+ className: uploadPlaceholder,
5689
+ children: [
5690
+ /* @__PURE__ */ jsx(Upload, { size: 32 }),
5691
+ /* @__PURE__ */ jsx("p", { children: "Click to upload" }),
5692
+ /* @__PURE__ */ jsx("p", {
5693
+ className: uploadHint,
5694
+ children: "Square image recommended"
5695
+ })
5696
+ ]
5697
+ })
5698
+ }),
5699
+ /* @__PURE__ */ jsx("input", {
5700
+ ref: fileInputRef,
5701
+ type: "file",
5702
+ accept: "image/*",
5703
+ onChange: handleImageChange,
5704
+ style: { display: "none" }
5705
+ }),
5706
+ fileSizeError && /* @__PURE__ */ jsxs("p", {
5707
+ className: errorText,
5708
+ children: [/* @__PURE__ */ jsx(Info, { size: 14 }), fileSizeError]
5709
+ })
5710
+ ] }) : /* @__PURE__ */ jsxs("div", {
5711
+ className: urlInputContainer,
5712
+ children: [
5713
+ imageUrl && /* @__PURE__ */ jsx("div", {
5714
+ className: imagePreview,
5715
+ children: /* @__PURE__ */ jsx("img", {
5716
+ src: imageUrl,
5717
+ alt: "Preview",
5718
+ className: previewImage
5719
+ })
5720
+ }),
5721
+ /* @__PURE__ */ jsxs("div", {
5722
+ className: urlInputWrapper,
5723
+ children: [/* @__PURE__ */ jsx(Input, {
5724
+ value: urlInput,
5725
+ onChange: (e) => {
5726
+ setUrlInput(e.target.value);
5727
+ setUrlError("");
5728
+ },
5729
+ onKeyDown: (e) => {
5730
+ if (e.key === "Enter") handleUrlSubmit();
5731
+ },
5732
+ placeholder: "https://example.com/image.png",
5733
+ disabled: isUpdating
5734
+ }), /* @__PURE__ */ jsx(Button, {
5735
+ onClick: handleUrlSubmit,
5736
+ disabled: isUpdating,
5737
+ style: { flexShrink: 0 },
5738
+ children: "Apply"
5739
+ })]
5740
+ }),
5741
+ urlError && /* @__PURE__ */ jsxs("p", {
5742
+ className: errorText,
5743
+ children: [/* @__PURE__ */ jsx(Info, { size: 14 }), urlError]
5744
+ })
5745
+ ]
5746
+ })
5747
+ ] }),
5748
+ /* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs("div", {
5749
+ className: fieldLabel,
5750
+ children: [/* @__PURE__ */ jsx(Label, { children: "Site Name" }), /* @__PURE__ */ jsxs("span", {
5751
+ className: charCount,
5752
+ children: [siteName.length, "/120"]
5753
+ })]
5754
+ }), /* @__PURE__ */ jsx(Input, {
5755
+ value: siteName,
5756
+ onChange: (e) => setSiteName(e.target.value.slice(0, 120)),
5757
+ placeholder: "Enter site name...",
5758
+ disabled: isUpdating
5759
+ })] }),
5760
+ /* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs("div", {
5761
+ className: fieldLabel,
5762
+ children: [/* @__PURE__ */ jsx(Label, { children: "Description" }), /* @__PURE__ */ jsxs("span", {
5763
+ className: charCount,
5764
+ children: [description$6.length, "/150"]
5765
+ })]
5766
+ }), /* @__PURE__ */ jsx(Textarea, {
5767
+ value: description$6,
5768
+ onChange: (e) => setDescription(e.target.value.slice(0, 150)),
5769
+ placeholder: "Enter description...",
5770
+ rows: 4,
5771
+ disabled: isUpdating
5772
+ })] }),
5773
+ /* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs(Label, { children: ["Project URL", /* @__PURE__ */ jsx("span", {
5774
+ className: optionalLabel,
5775
+ children: " (Optional)"
5776
+ })] }), /* @__PURE__ */ jsx(Input, {
5777
+ value: projectUrl,
5778
+ onChange: (e) => setProjectUrl(e.target.value),
5779
+ placeholder: "https://github.com/username/project",
5780
+ disabled: isUpdating
5781
+ })] }),
5782
+ !isSdkReady && /* @__PURE__ */ jsxs("div", {
5783
+ className: warningBanner,
5784
+ children: [/* @__PURE__ */ jsx(Info, { size: 16 }), /* @__PURE__ */ jsx("span", { children: "Please connect your wallet to update metadata" })]
5785
+ }),
5786
+ error && /* @__PURE__ */ jsxs("div", {
5787
+ className: errorBanner,
5788
+ children: [/* @__PURE__ */ jsx(Info, { size: 16 }), /* @__PURE__ */ jsxs("span", { children: ["Failed to update metadata: ", error.message] })]
5789
+ })
5790
+ ]
5791
+ }),
5792
+ /* @__PURE__ */ jsxs("div", {
5793
+ className: footer,
5794
+ children: [/* @__PURE__ */ jsx(Button, {
5795
+ variant: "outline",
5796
+ onClick: () => onOpenChange(false),
5797
+ disabled: isUpdating,
5798
+ children: "Cancel"
5799
+ }), /* @__PURE__ */ jsxs(Button, {
5800
+ onClick: handleSubmit,
5801
+ disabled: !hasChanges || isLoading || !isSdkReady,
5802
+ style: {
5803
+ display: "flex",
5804
+ alignItems: "center",
5805
+ gap: "0.5rem"
5806
+ },
5807
+ children: [isUpdating && /* @__PURE__ */ jsx(Loader2, {
5808
+ size: 16,
5809
+ className: spinner
5810
+ }), isUpdating ? "Updating..." : !isSdkReady ? "Connect Wallet" : "Update Metadata"]
5811
+ })]
5812
+ })
5813
+ ]
5814
+ })] })
5815
+ });
5816
+ };
5817
+ var UpdateMetadataModal_default = UpdateMetadataModal;
5818
+
5819
+ //#endregion
5820
+ export { Banner, Button, DeploySteps, DeploymentStatus, FlickeringGrid, Input, Label, PublishButton_default as PublishButton, PublishMenu_default as PublishMenu, PublishModal_default as PublishModal, Stepper, SuiNsModal_default as SuiNsModal, Textarea, UpdateMetadataModal_default as UpdateMetadataModal, isAssigningDomain, isDomainDialogOpen, isExtendTimeDialogOpen, isRegisterSuiNSDomainDialogOpen, isUpdateMetadataModalOpen, siteMetadataStore, sitePublishingStore, useEpochDuration, useSitePublishing, useSuiNsDomainsQuery, useSuiNsRegistration, useTransactionExecutor, useUpdateSiteMetadata, useWalrusSiteQuery, useWalrusSitesQuery, useZenFsWorkspace, useZenfsFilesQuery };
5433
5821
  //# sourceMappingURL=index.js.map