@fayz-ai/admin 0.55.0 → 0.57.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
@@ -20579,10 +20579,10 @@ function ConsentBody({
20579
20579
  )
20580
20580
  ] }),
20581
20581
  access.entities && access.entities.length > 0 && /* @__PURE__ */ jsx("ul", { className: "mt-4 space-y-2 rounded-lg border border-border bg-muted/30 p-3", children: access.entities.map((entity) => {
20582
- const writes = entity.operations.some((operation) => operation !== "read");
20582
+ const writes2 = entity.operations.some((operation) => operation !== "read");
20583
20583
  return /* @__PURE__ */ jsxs("li", { className: "text-sm", children: [
20584
20584
  /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: entity.label }),
20585
- /* @__PURE__ */ jsx("span", { className: "ml-2 text-xs text-muted-foreground", children: writes ? "ler e escrever" : "somente ler" }),
20585
+ /* @__PURE__ */ jsx("span", { className: "ml-2 text-xs text-muted-foreground", children: writes2 ? "ler e escrever" : "somente ler" }),
20586
20586
  /* @__PURE__ */ jsx("span", { className: "block text-xs text-muted-foreground", children: entity.reason })
20587
20587
  ] }, entity.label);
20588
20588
  }) }),
@@ -21417,6 +21417,10 @@ function pick(all, keys) {
21417
21417
  return out;
21418
21418
  }
21419
21419
  var same = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
21420
+ var writes = new EventTarget();
21421
+ function announce(detail) {
21422
+ writes.dispatchEvent(new CustomEvent("write", { detail }));
21423
+ }
21420
21424
  function useSettingKeys(keys, unitId = null) {
21421
21425
  const client3 = React142.useMemo(() => getSupabaseClientOptional(), []);
21422
21426
  const supported = !!client3;
@@ -21453,6 +21457,16 @@ function useSettingKeys(keys, unitId = null) {
21453
21457
  cancelled = true;
21454
21458
  };
21455
21459
  }, [client3, keyList, unitId]);
21460
+ React142.useEffect(() => {
21461
+ const listener = (event) => {
21462
+ const { key, value, unitId: at } = event.detail;
21463
+ if (at !== unitId || !keyList.split("|").includes(key)) return;
21464
+ setValues((cur) => same(cur[key], value) ? cur : { ...cur, [key]: value });
21465
+ if (!unitId) setHouse((cur) => same(cur[key], value) ? cur : { ...cur, [key]: value });
21466
+ };
21467
+ writes.addEventListener("write", listener);
21468
+ return () => writes.removeEventListener("write", listener);
21469
+ }, [keyList, unitId]);
21456
21470
  const pendingRef = React142.useRef({});
21457
21471
  const timerRef = React142.useRef(null);
21458
21472
  React142.useEffect(() => () => {
@@ -21473,6 +21487,7 @@ function useSettingKeys(keys, unitId = null) {
21473
21487
  if (e) throw e;
21474
21488
  setValues((cur) => ({ ...cur, [k]: data }));
21475
21489
  if (!unitId) setHouse((cur) => ({ ...cur, [k]: data }));
21490
+ announce({ key: k, value: data, unitId });
21476
21491
  })
21477
21492
  )
21478
21493
  ).catch((e) => setError(message(e))).finally(() => setSaving(false));
@@ -21481,6 +21496,7 @@ function useSettingKeys(keys, unitId = null) {
21481
21496
  const set = React142.useCallback((key, value) => {
21482
21497
  setValues((cur) => ({ ...cur, [key]: value }));
21483
21498
  if (!unitId) setHouse((cur) => ({ ...cur, [key]: value }));
21499
+ announce({ key, value, unitId });
21484
21500
  write4(key, value);
21485
21501
  }, [write4, unitId]);
21486
21502
  const reset = React142.useCallback((key) => {