@chaibuilder/sdk 2.3.4 → 2.3.5

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/core.d.ts CHANGED
@@ -702,6 +702,7 @@ export declare const useRightPanel: () => ["block" | "theme" | "ai" | "settings"
702
702
 
703
703
  export declare const useSavePage: () => {
704
704
  savePage: ThrottledFunction<(autoSave?: boolean) => Promise<boolean>>;
705
+ savePageAsync: () => Promise<boolean>;
705
706
  saveState: "SAVED" | "SAVING" | "UNSAVED";
706
707
  setSaveState: (args_0: "SAVED" | "SAVING" | "UNSAVED" | ((prev: "SAVED" | "SAVING" | "UNSAVED") => "SAVED" | "SAVING" | "UNSAVED")) => void;
707
708
  };
package/dist/core.js CHANGED
@@ -728,17 +728,17 @@ const useBrandingOptions = () => {
728
728
  }, rightPanelAtom = atom("block"), useRightPanel = () => useAtom$1(rightPanelAtom), builderSaveStateAtom = atom("SAVED");
729
729
  builderSaveStateAtom.debugLabel = "builderSaveStateAtom";
730
730
  const useSavePage = () => {
731
- const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (p) => {
731
+ const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (u) => {
732
732
  }), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = useTheme(), { hasPermission: c } = usePermissions();
733
733
  return { savePage: useThrottledCallback(
734
- async (p = !1) => {
734
+ async (u = !1) => {
735
735
  if (!c("save_page"))
736
736
  return;
737
737
  n("SAVING"), a("SAVING");
738
- const u = l();
738
+ const g = l();
739
739
  return await r({
740
- autoSave: p,
741
- blocks: u.blocks,
740
+ autoSave: u,
741
+ blocks: g.blocks,
742
742
  theme: i
743
743
  }), setTimeout(() => {
744
744
  n("SAVED"), a("SAVED");
@@ -747,7 +747,19 @@ const useSavePage = () => {
747
747
  [l, n, i, r, a],
748
748
  3e3
749
749
  // save only every 5 seconds
750
- ), saveState: o, setSaveState: n };
750
+ ), savePageAsync: async () => {
751
+ if (!c("save_page"))
752
+ return;
753
+ n("SAVING"), a("SAVING");
754
+ const u = l();
755
+ return await r({
756
+ autoSave: !0,
757
+ blocks: u.blocks,
758
+ theme: i
759
+ }), setTimeout(() => {
760
+ n("SAVED"), a("SAVED");
761
+ }, 100), !0;
762
+ }, saveState: o, setSaveState: n };
751
763
  }, undoManager = new UndoManager();
752
764
  undoManager.setLimit(50);
753
765
  const undoRedoStateAtom = atom({
@@ -9364,7 +9376,7 @@ const AiAssistant = () => {
9364
9376
  "button",
9365
9377
  {
9366
9378
  type: "button",
9367
- className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
9379
+ className: " p-0.5 rounded-sm hover:bg-gray-300",
9368
9380
  onClick: (r) => r.stopPropagation(),
9369
9381
  children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
9370
9382
  }
@@ -9426,10 +9438,10 @@ const SettingsPanel = () => {
9426
9438
  ] }) }) : /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxs(Tabs, { defaultValue: "settings", className: "flex flex-1 flex-col", children: [
9427
9439
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(TabsList, { className: "grid h-auto w-full grid-cols-2 p-1 py-1", children: [
9428
9440
  /* @__PURE__ */ jsx(TabsTrigger, { value: "settings", className: "text-xs", children: "Settings" }),
9429
- /* @__PURE__ */ jsxs(TabsTrigger, { value: "styles", className: "flex items-center justify-between text-xs", children: [
9430
- "Styles",
9431
- /* @__PURE__ */ jsx(ResetStylesButton, {})
9432
- ] })
9441
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "styles", className: "text-xs", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
9442
+ /* @__PURE__ */ jsx("span", { className: "w-[90%] text-center", children: "Styles" }),
9443
+ /* @__PURE__ */ jsx("span", { className: "w-[10%]", children: /* @__PURE__ */ jsx(ResetStylesButton, {}) })
9444
+ ] }) })
9433
9445
  ] }) }),
9434
9446
  /* @__PURE__ */ jsxs(TabsContent, { value: "settings", className: "no-scrollbar h-full max-h-min overflow-y-auto", children: [
9435
9447
  /* @__PURE__ */ jsx(BlockSettings, {}),
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Suraj Air",
6
6
  "license": "BSD-3-Clause",
7
7
  "homepage": "https://chaibuilder.com",
8
- "version": "2.3.4",
8
+ "version": "2.3.5",
9
9
  "type": "module",
10
10
  "repository": {
11
11
  "type": "git",