@chaibuilder/sdk 0.1.1 → 0.1.3

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 (82) hide show
  1. package/dist/AddBlocks-0916e841.cjs +3 -0
  2. package/dist/AddBlocks-c195f577.js +258 -0
  3. package/dist/{BrandingOptions-77957074.cjs → BrandingOptions-742992b6.cjs} +1 -1
  4. package/dist/{BrandingOptions-86dc389a.js → BrandingOptions-766c19c6.js} +27 -27
  5. package/dist/{CanvasArea-29d479f2.js → CanvasArea-25800a3e.js} +19 -18
  6. package/dist/CanvasArea-e855c4a2.cjs +60 -0
  7. package/dist/Class-7d6aadbc.cjs +1 -0
  8. package/dist/{Class-e6b07b79.js → Class-e34b2337.js} +9 -9
  9. package/dist/{ImagesPanel-6595528d.js → ImagesPanel-8ccab6d9.js} +1 -1
  10. package/dist/{ImagesPanel-5cde797f.cjs → ImagesPanel-addb2bf9.cjs} +1 -1
  11. package/dist/{Layers-3a270af5.cjs → Layers-a2169d0b.cjs} +1 -1
  12. package/dist/{Layers-81832d92.js → Layers-f7e792f6.js} +3 -3
  13. package/dist/{MarkAsGlobalBlock-f2186631.cjs → MarkAsGlobalBlock-6187e6fd.cjs} +1 -1
  14. package/dist/{MarkAsGlobalBlock-a1b5646c.js → MarkAsGlobalBlock-6bac1842.js} +2 -2
  15. package/dist/PagesPanel-0827c264.js +46 -0
  16. package/dist/PagesPanel-5698953d.cjs +1 -0
  17. package/dist/ProjectPanel-a3cb7396.cjs +1 -0
  18. package/dist/ProjectPanel-e577029a.js +66 -0
  19. package/dist/{Settings-a8cea8ee.js → Settings-b214f859.js} +25 -24
  20. package/dist/Settings-bee21026.cjs +1 -0
  21. package/dist/{SidePanels-1dcabe54.js → SidePanels-03fa10e8.js} +20 -18
  22. package/dist/SidePanels-934159a4.cjs +1 -0
  23. package/dist/{Topbar-ce65bdce.js → Topbar-9bc8c9cf.js} +2 -2
  24. package/dist/{Topbar-00cfceeb.cjs → Topbar-c083cc2a.cjs} +1 -1
  25. package/dist/UnsplashImages-68492dc9.cjs +1 -0
  26. package/dist/{UnsplashImages-43ec34a9.js → UnsplashImages-afaa7706.js} +19 -28
  27. package/dist/add-page-modal-63858244.js +92 -0
  28. package/dist/add-page-modal-cb367c9d.cjs +1 -0
  29. package/dist/alert-dialog-4ce6ed22.cjs +1 -0
  30. package/dist/alert-dialog-ee98f47e.js +64 -0
  31. package/dist/confirm-alert-4f50caa7.cjs +1 -0
  32. package/dist/confirm-alert-f2a47cc7.js +36 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.d.ts +20 -12
  35. package/dist/core.js +53 -52
  36. package/dist/delete-page-modal-1e3914e3.cjs +1 -0
  37. package/dist/delete-page-modal-def9012d.js +64 -0
  38. package/dist/dropdown-menu-84b2439e.cjs +1 -0
  39. package/dist/dropdown-menu-ae3ed09b.js +164 -0
  40. package/dist/form-5d5c5c9e.js +125 -0
  41. package/dist/form-6eac0287.cjs +1 -0
  42. package/dist/{html-to-json-fecbbe16.js → html-to-json-9304dbda.js} +47 -47
  43. package/dist/html-to-json-9c9961da.cjs +1 -0
  44. package/dist/index-207f2cbf.cjs +2 -0
  45. package/dist/index-390f7bef.js +4749 -0
  46. package/dist/index-824a7bd0.js +188 -0
  47. package/dist/index-ebd86d7f.cjs +2 -0
  48. package/dist/input-42acea7e.cjs +1 -0
  49. package/dist/input-a0ea2bc7.js +19 -0
  50. package/dist/lib.cjs +1 -1
  51. package/dist/lib.js +3 -3
  52. package/dist/link-86c532b5.cjs +1 -0
  53. package/dist/{link-0bfd8606.js → link-f80a947d.js} +52 -68
  54. package/dist/mockServiceWorker.js +292 -0
  55. package/dist/page-viewer-41cbb548.js +88 -0
  56. package/dist/page-viewer-83ce2c70.cjs +1 -0
  57. package/dist/project-general-setting-0262fe62.js +65 -0
  58. package/dist/project-general-setting-2c8bed74.cjs +1 -0
  59. package/dist/project-seo-setting-01536592.js +67 -0
  60. package/dist/project-seo-setting-e3924578.cjs +1 -0
  61. package/dist/single-page-detail-924d57fc.js +206 -0
  62. package/dist/single-page-detail-cfeae896.cjs +1 -0
  63. package/dist/ui.cjs +1 -1
  64. package/dist/ui.js +124 -122
  65. package/dist/usePageActions-3bed2330.cjs +1 -0
  66. package/dist/usePageActions-f86f6f65.js +36 -0
  67. package/dist/useProjectActions-1de05f63.js +17 -0
  68. package/dist/useProjectActions-5092ed79.cjs +1 -0
  69. package/package.json +14 -1
  70. package/dist/AddBlocks-52d9b4d7.cjs +0 -3
  71. package/dist/AddBlocks-e047b93d.js +0 -260
  72. package/dist/CanvasArea-9ce217a4.cjs +0 -60
  73. package/dist/Class-0801d193.cjs +0 -1
  74. package/dist/Settings-6a3f0f70.cjs +0 -1
  75. package/dist/SidePanels-7fe6bebe.cjs +0 -1
  76. package/dist/UnsplashImages-1b2310ad.cjs +0 -1
  77. package/dist/dropdown-menu-a9b096f9.cjs +0 -1
  78. package/dist/dropdown-menu-d912a52e.js +0 -223
  79. package/dist/html-to-json-d8ac554d.cjs +0 -1
  80. package/dist/index-32d7b6e5.js +0 -2657
  81. package/dist/index-506fb888.cjs +0 -2
  82. package/dist/link-158970ee.cjs +0 -1
@@ -1,38 +1,23 @@
1
1
  import { j as e } from "./jsx-runtime-944c88e2.js";
2
- import * as u from "react";
3
- import { useState as m, useEffect as x } from "react";
4
- import { c as g } from "./utils-ac68b2c8.js";
5
- import h, { IconPickerItem as f } from "react-icons-picker";
6
- import b from "react-dom";
7
- import { isEmpty as j, map as k } from "lodash";
8
- import { D as v, b as y, a as w } from "./dialog-3d4e82ed.js";
9
- import I from "./ImagesPanel-6595528d.js";
10
- import N from "react-quill";
2
+ import x, { IconPickerItem as m } from "react-icons-picker";
3
+ import g from "react-dom";
4
+ import { isEmpty as h, map as f } from "lodash";
5
+ import { useState as u, useEffect as j } from "react";
6
+ import { D as b, b as k, a as v } from "./dialog-3d4e82ed.js";
7
+ import y from "./ImagesPanel-8ccab6d9.js";
8
+ import w from "react-quill";
11
9
  import "react-i18next";
12
- import { u as B } from "./useBuilderProp-81a14920.js";
13
- const P = u.forwardRef(({ className: t, type: r, ...s }, o) => /* @__PURE__ */ e.jsx(
14
- "input",
15
- {
16
- type: r,
17
- className: g(
18
- "flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
19
- t
20
- ),
21
- ref: o,
22
- ...s
23
- }
24
- ));
25
- P.displayName = "Input";
26
- const C = (t) => {
27
- const r = document.getElementById("icon-picker-field"), s = document.createElement("div");
28
- b.render(/* @__PURE__ */ e.jsx(f, { value: t }), s), r.appendChild(s), s.hidden = !0;
29
- const o = s.innerHTML;
30
- return setTimeout(() => r.removeChild(s), 1e3), o;
31
- }, R = ({ value: t, onChange: r, onBlur: s, id: o }) => {
32
- const i = (n) => {
10
+ import { u as N } from "./useBuilderProp-81a14920.js";
11
+ const B = (t) => {
12
+ const r = document.getElementById("icon-picker-field"), l = document.createElement("div");
13
+ g.render(/* @__PURE__ */ e.jsx(m, { value: t }), l), r.appendChild(l), l.hidden = !0;
14
+ const n = l.innerHTML;
15
+ return setTimeout(() => r.removeChild(l), 1e3), n;
16
+ }, F = ({ value: t, onChange: r, onBlur: l, id: n }) => {
17
+ const i = (o) => {
33
18
  r("<svg />");
34
- const a = C(n);
35
- r(a), s(o, a);
19
+ const a = B(o);
20
+ r(a), l(n, a);
36
21
  };
37
22
  return /* @__PURE__ */ e.jsxs("div", { className: "mt-1 flex h-20 items-center gap-x-2", id: "icon-picker-field", children: [
38
23
  /* @__PURE__ */ e.jsxs("div", { className: "relative h-12 w-12", children: [
@@ -44,7 +29,7 @@ const C = (t) => {
44
29
  }
45
30
  ),
46
31
  /* @__PURE__ */ e.jsx(
47
- h,
32
+ x,
48
33
  {
49
34
  value: t ? "BiSolidGrid" : null,
50
35
  onChange: i,
@@ -71,24 +56,24 @@ const C = (t) => {
71
56
  "textarea",
72
57
  {
73
58
  value: t,
74
- onChange: (n) => r(n.target.value),
59
+ onChange: (o) => r(o.target.value),
75
60
  className: "h-full w-full rounded-sm border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",
76
61
  placeholder: "Choose icon or enter svg"
77
62
  }
78
63
  )
79
64
  ] });
80
- }, z = R, E = ({ children: t, onSelect: r }) => {
81
- const [s, o] = m(!1), i = (...n) => {
82
- r.call(void 0, ...n), o(!1);
65
+ }, C = ({ children: t, onSelect: r }) => {
66
+ const [l, n] = u(!1), i = (...o) => {
67
+ r.call(void 0, ...o), n(!1);
83
68
  };
84
- return /* @__PURE__ */ e.jsxs(v, { open: s, onOpenChange: (n) => o(n), children: [
85
- /* @__PURE__ */ e.jsx(y, { asChild: !0, children: t }),
86
- /* @__PURE__ */ e.jsx(w, { className: "flex h-3/4 max-w-5xl", children: /* @__PURE__ */ e.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ e.jsx(I, { isModalView: !0, onSelect: i }) }) })
69
+ return /* @__PURE__ */ e.jsxs(b, { open: l, onOpenChange: (o) => n(o), children: [
70
+ /* @__PURE__ */ e.jsx(k, { asChild: !0, children: t }),
71
+ /* @__PURE__ */ e.jsx(v, { className: "flex h-3/4 max-w-5xl", children: /* @__PURE__ */ e.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ e.jsx(y, { isModalView: !0, onSelect: i }) }) })
87
72
  ] });
88
- }, p = E, S = ({ value: t, onChange: r, id: s, onBlur: o }) => /* @__PURE__ */ e.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
73
+ }, p = C, A = ({ value: t, onChange: r, id: l, onBlur: n }) => /* @__PURE__ */ e.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
89
74
  t ? /* @__PURE__ */ e.jsx("img", { src: t, className: "h-20 w-20 overflow-hidden rounded-md border object-cover", alt: "" }) : /* @__PURE__ */ e.jsx(p, { onSelect: r, children: /* @__PURE__ */ e.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400" }) }),
90
75
  /* @__PURE__ */ e.jsxs("div", { className: "flex w-3/5 flex-col", children: [
91
- /* @__PURE__ */ e.jsx(p, { onSelect: r, children: /* @__PURE__ */ e.jsx("small", { className: "cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: t || !j(t) ? "Replace Image" : "Choose Image" }) }),
76
+ /* @__PURE__ */ e.jsx(p, { onSelect: r, children: /* @__PURE__ */ e.jsx("small", { className: "cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: t || !h(t) ? "Replace Image" : "Choose Image" }) }),
92
77
  /* @__PURE__ */ e.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" }),
93
78
  /* @__PURE__ */ e.jsx(
94
79
  "input",
@@ -97,13 +82,13 @@ const C = (t) => {
97
82
  className: "text-xs",
98
83
  placeholder: "Enter image URL",
99
84
  value: t,
100
- onBlur: ({ target: { value: i } }) => o(s, i),
85
+ onBlur: ({ target: { value: i } }) => n(l, i),
101
86
  onChange: (i) => r(i.target.value)
102
87
  }
103
88
  )
104
89
  ] })
105
- ] }), G = S, _ = ({ id: t, placeholder: r, value: s, onChange: o, onBlur: i }) => {
106
- const n = {
90
+ ] }), U = ({ id: t, placeholder: r, value: l, onChange: n, onBlur: i }) => {
91
+ const o = {
107
92
  toolbar: [
108
93
  ["bold", "italic", "underline", "strike", "blockquote"],
109
94
  [{ list: "ordered" }, { list: "bullet" }],
@@ -125,27 +110,27 @@ const C = (t) => {
125
110
  "link",
126
111
  "image"
127
112
  ];
128
- return /* @__PURE__ */ e.jsx(
129
- N,
113
+ return typeof window > "u" ? null : /* @__PURE__ */ e.jsx(
114
+ w,
130
115
  {
131
116
  id: t,
132
- value: s,
117
+ value: l,
133
118
  onBlur: (c) => i(t, c),
134
- onChange: (c) => o(c),
135
- modules: n,
119
+ onChange: (c) => n(c),
120
+ modules: o,
136
121
  formats: a,
137
122
  placeholder: r,
138
123
  className: "mt-1 rounded-md"
139
124
  }
140
125
  );
141
- }, Q = _, L = ({ schema: t, formData: r, onChange: s }) => {
142
- const [o, i] = m([]), n = B("getPages", () => []), { type: a = "page", href: c = "", target: d = "self" } = r;
143
- return x(() => {
126
+ }, V = ({ schema: t, formData: r, onChange: l }) => {
127
+ const [n, i] = u([]), o = N("getPages", () => []), { type: a = "page", href: c = "", target: d = "self" } = r;
128
+ return j(() => {
144
129
  (async () => {
145
- const l = await n();
146
- i(l);
130
+ const s = await o();
131
+ i(s);
147
132
  })();
148
- }, [n]), /* @__PURE__ */ e.jsxs("div", { children: [
133
+ }, [o]), /* @__PURE__ */ e.jsxs("div", { children: [
149
134
  /* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium", children: (t == null ? void 0 : t.title) ?? "Link" }),
150
135
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
151
136
  /* @__PURE__ */ e.jsx(
@@ -154,14 +139,14 @@ const C = (t) => {
154
139
  name: "type",
155
140
  defaultValue: "page",
156
141
  value: a,
157
- onChange: (l) => s({ ...r, type: l.target.value }),
142
+ onChange: (s) => l({ ...r, type: s.target.value }),
158
143
  children: [
159
144
  { const: "page", title: "Open Page" },
160
145
  { const: "url", title: "Open URL" },
161
146
  { const: "email", title: "Compose Email" },
162
147
  { const: "telephone", title: "Call Phone" },
163
148
  { const: "scroll", title: "Scroll to element" }
164
- ].map((l) => /* @__PURE__ */ e.jsx("option", { value: l.const, children: l.title }, l.const))
149
+ ].map((s) => /* @__PURE__ */ e.jsx("option", { value: s.const, children: s.title }, s.const))
165
150
  }
166
151
  ),
167
152
  a === "page" ? /* @__PURE__ */ e.jsxs(
@@ -171,10 +156,10 @@ const C = (t) => {
171
156
  defaultValue: "",
172
157
  placeholder: "Choose Page",
173
158
  value: c,
174
- onChange: (l) => s({ ...r, href: l.target.value }),
159
+ onChange: (s) => l({ ...r, href: s.target.value }),
175
160
  children: [
176
161
  /* @__PURE__ */ e.jsx("option", { value: "", children: "Choose page" }),
177
- k(o, (l) => /* @__PURE__ */ e.jsx("option", { value: l.slug, children: l.page_name }, l.uuid))
162
+ f(n, (s) => /* @__PURE__ */ e.jsx("option", { value: s.slug, children: s.page_name }, s.uuid))
178
163
  ]
179
164
  }
180
165
  ) : /* @__PURE__ */ e.jsx(
@@ -183,7 +168,7 @@ const C = (t) => {
183
168
  name: "href",
184
169
  type: "text",
185
170
  value: c,
186
- onChange: (l) => s({ ...r, href: l.target.value }),
171
+ onChange: (s) => l({ ...r, href: s.target.value }),
187
172
  placeholder: a === "page" || a === "url" ? "Enter URL" : a === "scroll" ? "#ElementID" : "Enter detail"
188
173
  }
189
174
  ),
@@ -194,18 +179,17 @@ const C = (t) => {
194
179
  type: "checkbox",
195
180
  defaultChecked: d === "_blank",
196
181
  className: "cursor-pointer rounded-md border border-border",
197
- onChange: () => s({ ...r, target: d === "_blank" ? "_self" : "_blank" })
182
+ onChange: () => l({ ...r, target: d === "_blank" ? "_self" : "_blank" })
198
183
  }
199
184
  ),
200
185
  /* @__PURE__ */ e.jsx("span", { className: "pt-1 text-xs", children: "Open in new tab" })
201
186
  ] })
202
187
  ] })
203
188
  ] });
204
- }, J = L;
189
+ };
205
190
  export {
206
- P as I,
207
- J as L,
208
- Q as R,
209
- z as a,
210
- G as b
191
+ F as I,
192
+ V as L,
193
+ U as R,
194
+ A as a
211
195
  };
@@ -0,0 +1,292 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+
4
+ /**
5
+ * Mock Service Worker (2.0.8).
6
+ * @see https://github.com/mswjs/msw
7
+ * - Please do NOT modify this file.
8
+ * - Please do NOT serve this file on production.
9
+ */
10
+
11
+ const INTEGRITY_CHECKSUM = '0877fcdc026242810f5bfde0d7178db4'
12
+ const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
13
+ const activeClientIds = new Set()
14
+
15
+ self.addEventListener('install', function () {
16
+ self.skipWaiting()
17
+ })
18
+
19
+ self.addEventListener('activate', function (event) {
20
+ event.waitUntil(self.clients.claim())
21
+ })
22
+
23
+ self.addEventListener('message', async function (event) {
24
+ const clientId = event.source.id
25
+
26
+ if (!clientId || !self.clients) {
27
+ return
28
+ }
29
+
30
+ const client = await self.clients.get(clientId)
31
+
32
+ if (!client) {
33
+ return
34
+ }
35
+
36
+ const allClients = await self.clients.matchAll({
37
+ type: 'window',
38
+ })
39
+
40
+ switch (event.data) {
41
+ case 'KEEPALIVE_REQUEST': {
42
+ sendToClient(client, {
43
+ type: 'KEEPALIVE_RESPONSE',
44
+ })
45
+ break
46
+ }
47
+
48
+ case 'INTEGRITY_CHECK_REQUEST': {
49
+ sendToClient(client, {
50
+ type: 'INTEGRITY_CHECK_RESPONSE',
51
+ payload: INTEGRITY_CHECKSUM,
52
+ })
53
+ break
54
+ }
55
+
56
+ case 'MOCK_ACTIVATE': {
57
+ activeClientIds.add(clientId)
58
+
59
+ sendToClient(client, {
60
+ type: 'MOCKING_ENABLED',
61
+ payload: true,
62
+ })
63
+ break
64
+ }
65
+
66
+ case 'MOCK_DEACTIVATE': {
67
+ activeClientIds.delete(clientId)
68
+ break
69
+ }
70
+
71
+ case 'CLIENT_CLOSED': {
72
+ activeClientIds.delete(clientId)
73
+
74
+ const remainingClients = allClients.filter((client) => {
75
+ return client.id !== clientId
76
+ })
77
+
78
+ // Unregister itself when there are no more clients
79
+ if (remainingClients.length === 0) {
80
+ self.registration.unregister()
81
+ }
82
+
83
+ break
84
+ }
85
+ }
86
+ })
87
+
88
+ self.addEventListener('fetch', function (event) {
89
+ const { request } = event
90
+
91
+ // Bypass navigation requests.
92
+ if (request.mode === 'navigate') {
93
+ return
94
+ }
95
+
96
+ // Opening the DevTools triggers the "only-if-cached" request
97
+ // that cannot be handled by the worker. Bypass such requests.
98
+ if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
99
+ return
100
+ }
101
+
102
+ // Bypass all requests when there are no active clients.
103
+ // Prevents the self-unregistered worked from handling requests
104
+ // after it's been deleted (still remains active until the next reload).
105
+ if (activeClientIds.size === 0) {
106
+ return
107
+ }
108
+
109
+ // Generate unique request ID.
110
+ const requestId = crypto.randomUUID()
111
+ event.respondWith(handleRequest(event, requestId))
112
+ })
113
+
114
+ async function handleRequest(event, requestId) {
115
+ const client = await resolveMainClient(event)
116
+ const response = await getResponse(event, client, requestId)
117
+
118
+ // Send back the response clone for the "response:*" life-cycle events.
119
+ // Ensure MSW is active and ready to handle the message, otherwise
120
+ // this message will pend indefinitely.
121
+ if (client && activeClientIds.has(client.id)) {
122
+ ;(async function () {
123
+ const responseClone = response.clone()
124
+ // When performing original requests, response body will
125
+ // always be a ReadableStream, even for 204 responses.
126
+ // But when creating a new Response instance on the client,
127
+ // the body for a 204 response must be null.
128
+ const responseBody = response.status === 204 ? null : responseClone.body
129
+
130
+ sendToClient(
131
+ client,
132
+ {
133
+ type: 'RESPONSE',
134
+ payload: {
135
+ requestId,
136
+ isMockedResponse: IS_MOCKED_RESPONSE in response,
137
+ type: responseClone.type,
138
+ status: responseClone.status,
139
+ statusText: responseClone.statusText,
140
+ body: responseBody,
141
+ headers: Object.fromEntries(responseClone.headers.entries()),
142
+ },
143
+ },
144
+ [responseBody],
145
+ )
146
+ })()
147
+ }
148
+
149
+ return response
150
+ }
151
+
152
+ // Resolve the main client for the given event.
153
+ // Client that issues a request doesn't necessarily equal the client
154
+ // that registered the worker. It's with the latter the worker should
155
+ // communicate with during the response resolving phase.
156
+ async function resolveMainClient(event) {
157
+ const client = await self.clients.get(event.clientId)
158
+
159
+ if (client?.frameType === 'top-level') {
160
+ return client
161
+ }
162
+
163
+ const allClients = await self.clients.matchAll({
164
+ type: 'window',
165
+ })
166
+
167
+ return allClients
168
+ .filter((client) => {
169
+ // Get only those clients that are currently visible.
170
+ return client.visibilityState === 'visible'
171
+ })
172
+ .find((client) => {
173
+ // Find the client ID that's recorded in the
174
+ // set of clients that have registered the worker.
175
+ return activeClientIds.has(client.id)
176
+ })
177
+ }
178
+
179
+ async function getResponse(event, client, requestId) {
180
+ const { request } = event
181
+
182
+ // Clone the request because it might've been already used
183
+ // (i.e. its body has been read and sent to the client).
184
+ const requestClone = request.clone()
185
+
186
+ function passthrough() {
187
+ const headers = Object.fromEntries(requestClone.headers.entries())
188
+
189
+ // Remove internal MSW request header so the passthrough request
190
+ // complies with any potential CORS preflight checks on the server.
191
+ // Some servers forbid unknown request headers.
192
+ delete headers['x-msw-intention']
193
+
194
+ return fetch(requestClone, { headers })
195
+ }
196
+
197
+ // Bypass mocking when the client is not active.
198
+ if (!client) {
199
+ return passthrough()
200
+ }
201
+
202
+ // Bypass initial page load requests (i.e. static assets).
203
+ // The absence of the immediate/parent client in the map of the active clients
204
+ // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
205
+ // and is not ready to handle requests.
206
+ if (!activeClientIds.has(client.id)) {
207
+ return passthrough()
208
+ }
209
+
210
+ // Bypass requests with the explicit bypass header.
211
+ // Such requests can be issued by "ctx.fetch()".
212
+ const mswIntention = request.headers.get('x-msw-intention')
213
+ if (['bypass', 'passthrough'].includes(mswIntention)) {
214
+ return passthrough()
215
+ }
216
+
217
+ // Notify the client that a request has been intercepted.
218
+ const requestBuffer = await request.arrayBuffer()
219
+ const clientMessage = await sendToClient(
220
+ client,
221
+ {
222
+ type: 'REQUEST',
223
+ payload: {
224
+ id: requestId,
225
+ url: request.url,
226
+ mode: request.mode,
227
+ method: request.method,
228
+ headers: Object.fromEntries(request.headers.entries()),
229
+ cache: request.cache,
230
+ credentials: request.credentials,
231
+ destination: request.destination,
232
+ integrity: request.integrity,
233
+ redirect: request.redirect,
234
+ referrer: request.referrer,
235
+ referrerPolicy: request.referrerPolicy,
236
+ body: requestBuffer,
237
+ keepalive: request.keepalive,
238
+ },
239
+ },
240
+ [requestBuffer],
241
+ )
242
+
243
+ switch (clientMessage.type) {
244
+ case 'MOCK_RESPONSE': {
245
+ return respondWithMock(clientMessage.data)
246
+ }
247
+
248
+ case 'MOCK_NOT_FOUND': {
249
+ return passthrough()
250
+ }
251
+ }
252
+
253
+ return passthrough()
254
+ }
255
+
256
+ function sendToClient(client, message, transferrables = []) {
257
+ return new Promise((resolve, reject) => {
258
+ const channel = new MessageChannel()
259
+
260
+ channel.port1.onmessage = (event) => {
261
+ if (event.data && event.data.error) {
262
+ return reject(event.data.error)
263
+ }
264
+
265
+ resolve(event.data)
266
+ }
267
+
268
+ client.postMessage(
269
+ message,
270
+ [channel.port2].concat(transferrables.filter(Boolean)),
271
+ )
272
+ })
273
+ }
274
+
275
+ async function respondWithMock(response) {
276
+ // Setting response status code to 0 is a no-op.
277
+ // However, when responding with a "Response.error()", the produced Response
278
+ // instance will have status code set to 0. Since it's not possible to create
279
+ // a Response instance with status code 0, handle that use-case separately.
280
+ if (response.status === 0) {
281
+ return Response.error()
282
+ }
283
+
284
+ const mockedResponse = new Response(response.body, response)
285
+
286
+ Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
287
+ value: true,
288
+ enumerable: true,
289
+ })
290
+
291
+ return mockedResponse
292
+ }
@@ -0,0 +1,88 @@
1
+ import { j as e } from "./jsx-runtime-944c88e2.js";
2
+ import o, { useState as c, Suspense as m } from "react";
3
+ import { HomeIcon as p, FileTextIcon as u, ChevronRightIcon as d, GearIcon as x } from "@radix-ui/react-icons";
4
+ import { P as g, a as h, b as f } from "./popover-f7addcf4.js";
5
+ import { O as j } from "./index-390f7bef.js";
6
+ import "@radix-ui/react-popover";
7
+ import "./utils-ac68b2c8.js";
8
+ import "clsx";
9
+ import "tailwind-merge";
10
+ import "i18next";
11
+ import "react-i18next";
12
+ import "flagged";
13
+ import "react-dnd";
14
+ import "lodash";
15
+ import "@minoru/react-dnd-treeview";
16
+ import "./useBuilderProp-81a14920.js";
17
+ import "@radix-ui/react-slot";
18
+ import "class-variance-authority";
19
+ import "@radix-ui/react-tooltip";
20
+ import "@radix-ui/react-toast";
21
+ import "jotai";
22
+ import "react-hotkeys-hook";
23
+ import "flat-to-nested";
24
+ import "./Class-e34b2337.js";
25
+ import "redux-undo";
26
+ import "@react-hookz/web";
27
+ import "@chaibuilder/blocks";
28
+ import "./CONTROLS-442caee5.js";
29
+ const N = o.lazy(() => import("./single-page-detail-924d57fc.js")), b = ({ pageData: t }) => {
30
+ const [s, r] = c("CLOSE");
31
+ return /* @__PURE__ */ e.jsxs(
32
+ g,
33
+ {
34
+ open: s === "OPEN" || s === "ALERT" || s === "PENDING",
35
+ onOpenChange: (i) => {
36
+ r(s === "PENDING" ? "ALERT" : i ? "OPEN" : "CLOSE");
37
+ },
38
+ children: [
39
+ /* @__PURE__ */ e.jsx(
40
+ h,
41
+ {
42
+ asChild: !0,
43
+ onClick: (i) => {
44
+ i.stopPropagation(), r("OPEN");
45
+ },
46
+ children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between", children: s === "OPEN" || s === "ALERT" || s === "PENDING" ? /* @__PURE__ */ e.jsx(d, {}) : /* @__PURE__ */ e.jsx("div", { className: "hidden hover:text-blue-600 group-hover:flex", children: /* @__PURE__ */ e.jsx(x, {}) }) })
47
+ }
48
+ ),
49
+ /* @__PURE__ */ e.jsx(f, { side: "right", align: "start", alignOffset: -35, className: "h-screen w-96", children: /* @__PURE__ */ e.jsx(
50
+ m,
51
+ {
52
+ fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex w-full animate-pulse flex-col gap-y-3", children: [
53
+ /* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-6 w-1/2" }),
54
+ /* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-20 w-full" }),
55
+ /* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-20 w-full" })
56
+ ] }),
57
+ children: /* @__PURE__ */ e.jsx(N, { pageData: t, open: s, setOpen: r })
58
+ }
59
+ ) })
60
+ ]
61
+ }
62
+ );
63
+ }, v = (t) => {
64
+ const [s] = ["123"], { data: r } = j(), i = {}, a = (r == null ? void 0 : r.homepage) === t.uuid, n = s === t.uuid, l = () => i(t);
65
+ return r ? /* @__PURE__ */ e.jsxs(
66
+ "button",
67
+ {
68
+ className: `group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${n ? "bg-blue-200 " : ""}`,
69
+ onClick: l,
70
+ type: "button",
71
+ children: [
72
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-1.5", children: [
73
+ a ? /* @__PURE__ */ e.jsx(p, {}) : /* @__PURE__ */ e.jsx(u, {}),
74
+ " ",
75
+ t.name
76
+ ] }),
77
+ /* @__PURE__ */ e.jsx(b, { pageData: t })
78
+ ]
79
+ }
80
+ ) : null;
81
+ }, W = ({ pages: t, isLoading: s }) => s ? /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-1 px-2.5 pt-2", children: [
82
+ /* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
83
+ /* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
84
+ /* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" })
85
+ ] }) : t.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "px-2.5 pb-2 pt-4", children: "No pages" }) : /* @__PURE__ */ e.jsx("div", { className: "-mb-2", children: o.Children.toArray(t.map((r) => /* @__PURE__ */ e.jsx(v, { ...r }))) });
86
+ export {
87
+ W as default
88
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),u=require("@radix-ui/react-icons"),o=require("./popover-7cb9079b.cjs"),c=require("./index-ebd86d7f.cjs");require("@radix-ui/react-popover");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-7d6aadbc.cjs");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("./CONTROLS-031e1de3.cjs");const j=n.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-cfeae896.cjs"))),m=({pageData:r})=>{const[s,t]=n.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:s==="OPEN"||s==="ALERT"||s==="PENDING",onOpenChange:i=>{t(s==="PENDING"?"ALERT":i?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:i=>{i.stopPropagation(),t("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:s==="OPEN"||s==="ALERT"||s==="PENDING"?e.jsxRuntimeExports.jsx(u.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(u.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full animate-pulse flex-col gap-y-3",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-6 w-1/2"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"})]}),children:e.jsxRuntimeExports.jsx(j,{pageData:r,open:s,setOpen:t})})})]})},p=r=>{const[s]=["123"],{data:t}=c.useProject(),i={},x=(t==null?void 0:t.homepage)===r.uuid,l=s===r.uuid,a=()=>i(r);return t?e.jsxRuntimeExports.jsxs("button",{className:`group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${l?"bg-blue-200 ":""}`,onClick:a,type:"button",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[x?e.jsxRuntimeExports.jsx(u.HomeIcon,{}):e.jsxRuntimeExports.jsx(u.FileTextIcon,{})," ",r.name]}),e.jsxRuntimeExports.jsx(m,{pageData:r})]}):null},d=({pages:r,isLoading:s})=>s?e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-1 px-2.5 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"})]}):r.length===0?e.jsxRuntimeExports.jsx("div",{className:"px-2.5 pb-2 pt-4",children:"No pages"}):e.jsxRuntimeExports.jsx("div",{className:"-mb-2",children:n.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(p,{...t})))});exports.default=d;
@@ -0,0 +1,65 @@
1
+ import { j as i } from "./jsx-runtime-944c88e2.js";
2
+ import * as n from "react";
3
+ import { S as f } from "./scroll-area-9f64a082.js";
4
+ import { SingleLineText as c, Image as d } from "@chaibuilder/blocks";
5
+ import { F as u } from "./form-5d5c5c9e.js";
6
+ import { O as x } from "./index-390f7bef.js";
7
+ import "@radix-ui/react-scroll-area";
8
+ import "./utils-ac68b2c8.js";
9
+ import "clsx";
10
+ import "tailwind-merge";
11
+ import "@rjsf/core";
12
+ import "@rjsf/validator-ajv8";
13
+ import "lodash";
14
+ import "./link-f80a947d.js";
15
+ import "react-icons-picker";
16
+ import "react-dom";
17
+ import "./dialog-3d4e82ed.js";
18
+ import "@radix-ui/react-dialog";
19
+ import "@radix-ui/react-icons";
20
+ import "./ImagesPanel-8ccab6d9.js";
21
+ import "./tabs-85caa1e8.js";
22
+ import "@radix-ui/react-tabs";
23
+ import "react-quill";
24
+ import "react-i18next";
25
+ import "./useBuilderProp-81a14920.js";
26
+ import "@radix-ui/react-slot";
27
+ import "class-variance-authority";
28
+ import "@radix-ui/react-tooltip";
29
+ import "@radix-ui/react-toast";
30
+ import "jotai";
31
+ import "i18next";
32
+ import "flagged";
33
+ import "react-dnd";
34
+ import "@minoru/react-dnd-treeview";
35
+ import "react-hotkeys-hook";
36
+ import "flat-to-nested";
37
+ import "./Class-e34b2337.js";
38
+ import "redux-undo";
39
+ import "@react-hookz/web";
40
+ import "./CONTROLS-442caee5.js";
41
+ const to = ({
42
+ _projectData: m,
43
+ seany: t
44
+ }) => {
45
+ const { data: o, isLoading: p } = x();
46
+ n.useEffect(() => {
47
+ o && t(o);
48
+ }, [o, t]);
49
+ const e = ({ formData: s }, r) => {
50
+ t((l) => ({
51
+ ...l,
52
+ [r]: s[r]
53
+ }));
54
+ }, a = {
55
+ name: c({
56
+ title: "Project Name",
57
+ default: o == null ? void 0 : o.name
58
+ }),
59
+ favicon: d({ title: "Favicon", default: o == null ? void 0 : o.favicon })
60
+ };
61
+ return /* @__PURE__ */ i.jsx(f, { className: "flex h-full select-none flex-col", children: /* @__PURE__ */ i.jsx(u, { properties: a, disabled: p, formData: m, onChange: e }) });
62
+ };
63
+ export {
64
+ to as default
65
+ };