@declarion/react 0.6.5 → 0.6.6
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-lib/index.js +72 -68
- package/dist-lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist-lib/index.js
CHANGED
|
@@ -433,48 +433,81 @@ function ir(e, t) {
|
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
435
|
//#endregion
|
|
436
|
-
//#region src/embed/
|
|
437
|
-
var ar =
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
436
|
+
//#region src/embed/embed-dirty.ts
|
|
437
|
+
var ar = mn((e) => ({
|
|
438
|
+
isDirty: !1,
|
|
439
|
+
setDirty: (t) => e((e) => e.isDirty === t ? e : { isDirty: t })
|
|
440
|
+
}));
|
|
441
|
+
function or(e, t) {
|
|
442
|
+
let n = ar((e) => e.setDirty);
|
|
443
|
+
K(() => {
|
|
444
|
+
t && n(e);
|
|
445
|
+
}, [
|
|
446
|
+
t,
|
|
447
|
+
e,
|
|
448
|
+
n
|
|
449
|
+
]), K(() => {
|
|
450
|
+
if (t) return () => n(!1);
|
|
451
|
+
}, [t, n]);
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/embed/embed-nav-guard.ts
|
|
455
|
+
var sr = mn((e, t) => ({
|
|
456
|
+
pendingNavigation: null,
|
|
457
|
+
requestNavigation: (t) => e({ pendingNavigation: t }),
|
|
458
|
+
confirmNavigation: () => {
|
|
459
|
+
let n = t().pendingNavigation;
|
|
460
|
+
e({ pendingNavigation: null }), n?.();
|
|
461
|
+
},
|
|
462
|
+
cancelNavigation: () => e({ pendingNavigation: null })
|
|
463
|
+
})), cr = 2e4;
|
|
464
|
+
function lr() {
|
|
465
|
+
let e = nr(), t = en(), n = Qt(), r = p((e) => e.setUser), [i, a] = Y("pending"), o = J(!1), s = J(n.pathname);
|
|
466
|
+
return s.current = n.pathname, K(() => {
|
|
441
467
|
if (!e.enabled) return;
|
|
442
468
|
mt(e.parentOrigin);
|
|
443
|
-
let
|
|
469
|
+
let n = st(() => {
|
|
444
470
|
Tt(e.parentOrigin, ct.reloadRequired, { reason: "embed session terminated" });
|
|
445
|
-
}),
|
|
446
|
-
if (!
|
|
447
|
-
|
|
471
|
+
}), i = async () => {
|
|
472
|
+
if (!o.current) {
|
|
473
|
+
o.current = !0;
|
|
448
474
|
try {
|
|
449
475
|
let e = await y();
|
|
450
|
-
|
|
476
|
+
r(e, e.tenant ?? void 0), a("authenticated");
|
|
451
477
|
} catch {
|
|
452
|
-
|
|
478
|
+
a("error");
|
|
453
479
|
}
|
|
454
480
|
}
|
|
455
|
-
},
|
|
481
|
+
}, c = e.parentOrigin ? ir(e.parentOrigin, {
|
|
456
482
|
onAuth: (e) => {
|
|
457
|
-
xt(e),
|
|
483
|
+
xt(e), o.current || i();
|
|
458
484
|
},
|
|
459
485
|
onNavigate: (n) => {
|
|
460
|
-
|
|
486
|
+
let r = () => {
|
|
487
|
+
t(e.appendEmbedParams(n.route));
|
|
488
|
+
}, i = n.route.split(/[?#]/)[0];
|
|
489
|
+
if (ar.getState().isDirty && i !== s.current) {
|
|
490
|
+
sr.getState().requestNavigation(r);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
r();
|
|
461
494
|
},
|
|
462
495
|
onTheme: (e) => {
|
|
463
496
|
Xn(e.theme);
|
|
464
497
|
}
|
|
465
498
|
}) : null;
|
|
466
|
-
|
|
467
|
-
let
|
|
468
|
-
|
|
469
|
-
},
|
|
499
|
+
c && window.addEventListener("message", c), Tt(e.parentOrigin, ct.ready, {});
|
|
500
|
+
let l = window.setTimeout(() => {
|
|
501
|
+
o.current || a("error");
|
|
502
|
+
}, cr);
|
|
470
503
|
return () => {
|
|
471
|
-
|
|
504
|
+
c && window.removeEventListener("message", c), window.clearTimeout(l), st(n);
|
|
472
505
|
};
|
|
473
506
|
}, [
|
|
474
507
|
e,
|
|
475
508
|
t,
|
|
476
|
-
|
|
477
|
-
]), !e.enabled ||
|
|
509
|
+
r
|
|
510
|
+
]), !e.enabled || i !== "error" ? null : /* @__PURE__ */ Z("div", {
|
|
478
511
|
role: "alert",
|
|
479
512
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-background p-6 text-center text-sm text-muted-foreground",
|
|
480
513
|
children: /* @__PURE__ */ Z("p", { children: "This embedded view could not authenticate. The host application did not provide a session." })
|
|
@@ -482,12 +515,12 @@ function or() {
|
|
|
482
515
|
}
|
|
483
516
|
//#endregion
|
|
484
517
|
//#region src/embed/EmbedResizeReporter.tsx
|
|
485
|
-
var
|
|
486
|
-
function
|
|
518
|
+
var ur = "app-embed";
|
|
519
|
+
function dr() {
|
|
487
520
|
let e = nr(), t = e.enabled && e.parentOrigin !== null;
|
|
488
521
|
return K(() => {
|
|
489
522
|
if (!t || typeof window > "u" || typeof ResizeObserver > "u") return;
|
|
490
|
-
let n = document.getElementById(
|
|
523
|
+
let n = document.getElementById(ur);
|
|
491
524
|
if (!n) return;
|
|
492
525
|
let r = null, i = -1, a = () => {
|
|
493
526
|
r = null;
|
|
@@ -502,27 +535,9 @@ function cr() {
|
|
|
502
535
|
}, [t, e.parentOrigin]), null;
|
|
503
536
|
}
|
|
504
537
|
//#endregion
|
|
505
|
-
//#region src/embed/embed-dirty.ts
|
|
506
|
-
var lr = mn((e) => ({
|
|
507
|
-
isDirty: !1,
|
|
508
|
-
setDirty: (t) => e((e) => e.isDirty === t ? e : { isDirty: t })
|
|
509
|
-
}));
|
|
510
|
-
function ur(e, t) {
|
|
511
|
-
let n = lr((e) => e.setDirty);
|
|
512
|
-
K(() => {
|
|
513
|
-
t && n(e);
|
|
514
|
-
}, [
|
|
515
|
-
t,
|
|
516
|
-
e,
|
|
517
|
-
n
|
|
518
|
-
]), K(() => {
|
|
519
|
-
if (t) return () => n(!1);
|
|
520
|
-
}, [t, n]);
|
|
521
|
-
}
|
|
522
|
-
//#endregion
|
|
523
538
|
//#region src/embed/EmbedDirtyReporter.tsx
|
|
524
|
-
function
|
|
525
|
-
let e = nr(), t =
|
|
539
|
+
function fr() {
|
|
540
|
+
let e = nr(), t = ar((e) => e.isDirty), n = e.enabled && e.parentOrigin !== null;
|
|
526
541
|
return K(() => {
|
|
527
542
|
n && Tt(e.parentOrigin, ct.dirtyChanged, { dirty: t });
|
|
528
543
|
}, [
|
|
@@ -533,18 +548,18 @@ function dr() {
|
|
|
533
548
|
}
|
|
534
549
|
//#endregion
|
|
535
550
|
//#region src/embed/screen-location.ts
|
|
536
|
-
function
|
|
551
|
+
function pr(e) {
|
|
537
552
|
let t = e.replace(/\/+$/, "").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
538
553
|
return RegExp("^" + t.join("/") + "$");
|
|
539
554
|
}
|
|
540
|
-
function
|
|
555
|
+
function mr(e, t) {
|
|
541
556
|
let n = e.replace(/\/+$/, "") || "/";
|
|
542
557
|
if (!t) return {
|
|
543
558
|
matched: !1,
|
|
544
559
|
payload: { route: e }
|
|
545
560
|
};
|
|
546
561
|
let r, i, a, o;
|
|
547
|
-
for (let [e, s] of Object.entries(t)) if (s.route &&
|
|
562
|
+
for (let [e, s] of Object.entries(t)) if (s.route && pr(s.route).test(n)) if (s.route.includes("/:")) a || (a = s, o = e);
|
|
548
563
|
else {
|
|
549
564
|
r = s, i = e;
|
|
550
565
|
break;
|
|
@@ -569,21 +584,10 @@ function pr(e, t) {
|
|
|
569
584
|
payload: l
|
|
570
585
|
};
|
|
571
586
|
}
|
|
572
|
-
function
|
|
573
|
-
return
|
|
587
|
+
function hr(e, t) {
|
|
588
|
+
return mr(e, t).payload;
|
|
574
589
|
}
|
|
575
590
|
//#endregion
|
|
576
|
-
//#region src/embed/embed-nav-guard.ts
|
|
577
|
-
var hr = mn((e, t) => ({
|
|
578
|
-
pendingNavigation: null,
|
|
579
|
-
requestNavigation: (t) => e({ pendingNavigation: t }),
|
|
580
|
-
confirmNavigation: () => {
|
|
581
|
-
let n = t().pendingNavigation;
|
|
582
|
-
e({ pendingNavigation: null }), n?.();
|
|
583
|
-
},
|
|
584
|
-
cancelNavigation: () => e({ pendingNavigation: null })
|
|
585
|
-
}));
|
|
586
|
-
//#endregion
|
|
587
591
|
//#region src/embed/useEmbedNavigate.ts
|
|
588
592
|
function gr(e) {
|
|
589
593
|
let t = e.search(/[?#]/);
|
|
@@ -593,7 +597,7 @@ function _r() {
|
|
|
593
597
|
let e = en(), t = Qt(), n = nr(), { data: r } = oe();
|
|
594
598
|
return G((i, a) => {
|
|
595
599
|
if (!n.enabled) return e(i, a), !0;
|
|
596
|
-
let o = r?.screens, s =
|
|
600
|
+
let o = r?.screens, s = mr(gr(i), o), c = ar.getState().isDirty && gr(i) !== t.pathname;
|
|
597
601
|
if (o && !s.matched) return Tt(n.parentOrigin, ct.navigationFailed, {
|
|
598
602
|
route: gr(i),
|
|
599
603
|
reason: "unresolved"
|
|
@@ -602,12 +606,12 @@ function _r() {
|
|
|
602
606
|
let e = () => {
|
|
603
607
|
Tt(n.parentOrigin, ct.navigationRequested, s.payload);
|
|
604
608
|
};
|
|
605
|
-
return c ? (
|
|
609
|
+
return c ? (sr.getState().requestNavigation(e), !1) : (e(), !1);
|
|
606
610
|
}
|
|
607
611
|
let l = () => {
|
|
608
612
|
e(n.appendEmbedParams(i), a);
|
|
609
613
|
};
|
|
610
|
-
return c ? (
|
|
614
|
+
return c ? (sr.getState().requestNavigation(l), !1) : (l(), !0);
|
|
611
615
|
}, [
|
|
612
616
|
e,
|
|
613
617
|
t.pathname,
|
|
@@ -702,7 +706,7 @@ function Or() {
|
|
|
702
706
|
let a = `${t.pathname}${t.search}`;
|
|
703
707
|
if (r.current === a) return;
|
|
704
708
|
r.current = a;
|
|
705
|
-
let o =
|
|
709
|
+
let o = hr(t.pathname, n?.screens);
|
|
706
710
|
Tt(e.parentOrigin, ct.navigated, o);
|
|
707
711
|
}, [
|
|
708
712
|
i,
|
|
@@ -816,7 +820,7 @@ function kr({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
|
|
|
816
820
|
//#endregion
|
|
817
821
|
//#region src/embed/EmbedUnsavedGuard.tsx
|
|
818
822
|
function Ar() {
|
|
819
|
-
let e =
|
|
823
|
+
let e = sr((e) => e.pendingNavigation), t = sr((e) => e.confirmNavigation), n = sr((e) => e.cancelNavigation);
|
|
820
824
|
return e === null ? null : /* @__PURE__ */ Z(kr, {
|
|
821
825
|
open: !0,
|
|
822
826
|
onOpenChange: (e) => {
|
|
@@ -6375,8 +6379,8 @@ function Fo() {
|
|
|
6375
6379
|
return i.enabled ? /* @__PURE__ */ Q(_o, { children: [
|
|
6376
6380
|
/* @__PURE__ */ Z(Or, {}),
|
|
6377
6381
|
/* @__PURE__ */ Z(Ar, {}),
|
|
6382
|
+
/* @__PURE__ */ Z(fr, {}),
|
|
6378
6383
|
/* @__PURE__ */ Z(dr, {}),
|
|
6379
|
-
/* @__PURE__ */ Z(cr, {}),
|
|
6380
6384
|
/* @__PURE__ */ Z("div", {
|
|
6381
6385
|
id: "app-embed",
|
|
6382
6386
|
className: "flex h-screen min-h-0 flex-col overflow-auto",
|
|
@@ -18224,7 +18228,7 @@ function jf({ screenCode: e }) {
|
|
|
18224
18228
|
]), S = q(() => {
|
|
18225
18229
|
if (x) return typeof x == "string" ? x : Qe(x);
|
|
18226
18230
|
}, [x]), { data: C, isLoading: w } = Gu(d, x), T = Ds(d ?? ""), E = Os(d ?? ""), D = ks(d ?? ""), O = As(d ?? ""), k = Object.keys(u?.status_groups ?? {}).length > 0, A = C?.data, j = A?.$statuses, M = A?.$properties, N = r.get("edit") === "true", [ee, P] = Y(b || N), [F, I] = Y({}), [te, re] = Y({}), [L, ie] = Y({}), [R, ae] = Y(void 0), [se, ce] = Y(!1), [z, le] = Y(void 0), [ue, de] = Y({ show: !1 }), [fe, H] = Y(!1), pe = b ? f : m, me = ee && pe, he = nr();
|
|
18227
|
-
|
|
18231
|
+
or(me && !b, he.enabled);
|
|
18228
18232
|
let [ve, be] = Y(() => {
|
|
18229
18233
|
let e = parseInt(c?.sidebar_width || "380", 10);
|
|
18230
18234
|
return isNaN(e) ? 380 : e;
|
|
@@ -19774,7 +19778,7 @@ function rp() {
|
|
|
19774
19778
|
Wf();
|
|
19775
19779
|
let e = L((e) => e.toastPosition);
|
|
19776
19780
|
return /* @__PURE__ */ Q(Gt, { children: [
|
|
19777
|
-
/* @__PURE__ */ Z(
|
|
19781
|
+
/* @__PURE__ */ Z(lr, {}),
|
|
19778
19782
|
/* @__PURE__ */ Z(np, {}),
|
|
19779
19783
|
/* @__PURE__ */ Z(fn, {
|
|
19780
19784
|
position: e,
|