@parallelworks/tandem-web 0.156.0 → 0.157.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.
@@ -0,0 +1,97 @@
1
+ import { api as e, unwrap as t } from "../../../api/client.js";
2
+ import { intercomQuery as n, teamsQuery as r } from "../../../api/queries.js";
3
+ import { CommentIcon as i } from "../../../components/icons.js";
4
+ import { usePeople as a } from "../../../lib/people.js";
5
+ import { useCan as o } from "../../../lib/roles.js";
6
+ import { AdminOnly as s, SettingsPage as c, useFormError as l } from "../../../components/settings.js";
7
+ import { Route as u } from "./intercom.js";
8
+ import { ConnectionCard as d } from "../../../components/ConnectionCard.js";
9
+ import { SettingRow as f, SettingsCard as p, StatusLabel as m, Switch as h, buttonClasses as g } from "@parallelworks/ui";
10
+ import { useFormatter as _, useTranslations as v } from "use-intl";
11
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
12
+ import { useMutation as S, useQueryClient as C, useSuspenseQuery as w } from "@tanstack/react-query";
13
+ // src/routes/$workspace/settings/intercom.tsx?tsr-split=component
14
+ function T() {
15
+ let { workspace: T } = u.useParams(), { data: E } = w(n(T)), { data: D } = w(r(T)), O = o(T, "manage_workspace"), k = v("settingsNav"), A = v("intercom"), j = _(), { person: M } = a(T), N = C(), P = l(), F = S({
16
+ mutationFn: async ({ teamId: n, on: r }) => t(await e.PUT("/api/v1/workspaces/{workspace}/intercom/teams/{teamId}", {
17
+ params: { path: {
18
+ workspace: T,
19
+ teamId: n
20
+ } },
21
+ body: { reopen: r }
22
+ })),
23
+ onMutate: P.clear,
24
+ onSuccess: () => N.invalidateQueries({ queryKey: n(T).queryKey }),
25
+ onError: P.set
26
+ }), I = new Set(E.teams.filter((e) => e.reopen).map((e) => e.teamId));
27
+ return /* @__PURE__ */ x(c, {
28
+ title: k("intercom"),
29
+ description: A("pageDescription"),
30
+ children: [/* @__PURE__ */ b(s, { workspace: T }), E.enabled ? /* @__PURE__ */ x("div", {
31
+ className: "space-y-6",
32
+ children: [
33
+ /* @__PURE__ */ b("p", {
34
+ className: "text-sm text-muted-foreground",
35
+ children: A("managedByHost")
36
+ }),
37
+ /* @__PURE__ */ b(d, {
38
+ icon: /* @__PURE__ */ b(i, { className: "size-6" }),
39
+ name: k("intercom"),
40
+ status: E.connected ? A("connectedTo", {
41
+ account: E.name || E.appId || "",
42
+ person: M(E.connectedBy ?? "").name,
43
+ date: j.dateTime(new Date(E.connectedAt ?? ""), { dateStyle: "medium" })
44
+ }) : A("description"),
45
+ action: /* @__PURE__ */ x(y, { children: [!E.connected && /* @__PURE__ */ b(m, {
46
+ off: !0,
47
+ children: A("notConnected")
48
+ }), O && E.settingsUrl && /* @__PURE__ */ b("a", {
49
+ href: E.settingsUrl,
50
+ className: g({
51
+ variant: "outline",
52
+ size: "sm"
53
+ }),
54
+ children: A("openSettings")
55
+ })] })
56
+ }),
57
+ D.length > 0 && /* @__PURE__ */ b(p, {
58
+ title: A("reopenTitle"),
59
+ description: A("reopenDescription"),
60
+ children: D.map((e) => /* @__PURE__ */ b(f, {
61
+ label: `${e.name} (${e.key})`,
62
+ error: F.variables?.teamId === e.id ? P.error : null,
63
+ children: /* @__PURE__ */ b(h, {
64
+ "aria-label": A("reopenTeam", { team: e.name }),
65
+ checked: I.has(e.id),
66
+ disabled: !O || F.isPending,
67
+ onCheckedChange: (t) => F.mutate({
68
+ teamId: e.id,
69
+ on: t
70
+ })
71
+ })
72
+ }, e.id))
73
+ }),
74
+ /* @__PURE__ */ x("section", {
75
+ className: "space-y-2 text-sm",
76
+ children: [/* @__PURE__ */ b("h2", {
77
+ className: "font-medium",
78
+ children: A("howTitle")
79
+ }), /* @__PURE__ */ x("ol", {
80
+ className: "list-decimal space-y-1.5 pl-5 text-muted-foreground",
81
+ children: [
82
+ /* @__PURE__ */ b("li", { children: A("howFile") }),
83
+ /* @__PURE__ */ b("li", { children: A("howSidebar") }),
84
+ /* @__PURE__ */ b("li", { children: A("howIssue") }),
85
+ /* @__PURE__ */ b("li", { children: A("howClose") }),
86
+ /* @__PURE__ */ b("li", { children: A("howPeople") })
87
+ ]
88
+ })]
89
+ })
90
+ ]
91
+ }) : /* @__PURE__ */ b(p, { children: /* @__PURE__ */ b("p", {
92
+ className: "px-3 py-2 text-sm text-muted-foreground",
93
+ children: A("notConfigured")
94
+ }) })]
95
+ });
96
+ }
97
+ export { T as component };
@@ -0,0 +1,4 @@
1
+ import { intercomQuery as e, teamsQuery as t } from "../../../api/queries.js";
2
+ // src/routes/$workspace/settings/intercom.tsx?tsr-split=loader
3
+ var n = ({ context: { queryClient: n }, params: { workspace: r } }) => Promise.all([n.ensureQueryData(e(r)), n.ensureQueryData(t(r))]);
4
+ export { n as loader };