@drawbridge/components 0.1.30 → 0.1.32
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/bridge/template-modal.js +2 -1
- package/dist/bridge/template-modal.mjs +2 -1
- package/dist/dashboard/buttons-subscription.js +65 -20
- package/dist/dashboard/buttons-subscription.mjs +64 -20
- package/dist/dashboard/card-payment-method.js +1 -1
- package/dist/dashboard/card-payment-method.mjs +1 -1
- package/dist/dashboard/card-section.js +2 -2
- package/dist/dashboard/card-section.mjs +2 -2
- package/dist/dashboard/card-setting.js +4 -3
- package/dist/dashboard/card-setting.mjs +4 -3
- package/dist/dashboard/card-task.js +22 -4
- package/dist/dashboard/card-task.mjs +22 -4
- package/dist/dashboard/card-tile.js +6 -6
- package/dist/dashboard/card-tile.mjs +6 -6
- package/dist/dashboard/drawer.js +7 -2
- package/dist/dashboard/drawer.mjs +8 -3
- package/dist/dashboard/form-organization-workflow.js +7 -3
- package/dist/dashboard/form-organization-workflow.mjs +7 -3
- package/dist/dashboard/input-combobox.js +7 -2
- package/dist/dashboard/input-combobox.mjs +7 -2
- package/dist/dashboard/lib/escape.js +48 -0
- package/dist/dashboard/lib/escape.mjs +25 -0
- package/dist/dashboard/lib/rail.js +75 -0
- package/dist/dashboard/lib/rail.mjs +46 -0
- package/dist/dashboard/lib/throttle.js +57 -0
- package/dist/dashboard/lib/throttle.mjs +34 -0
- package/dist/dashboard/list.js +1 -1
- package/dist/dashboard/list.mjs +1 -1
- package/dist/dashboard/menu.js +188 -96
- package/dist/dashboard/menu.mjs +189 -97
- package/dist/dashboard/modal.js +9 -3
- package/dist/dashboard/modal.mjs +10 -4
- package/dist/dashboard/notice.js +5 -3
- package/dist/dashboard/notice.mjs +5 -3
- package/dist/dashboard/table-cell-title.js +2 -0
- package/dist/dashboard/table-cell-title.mjs +2 -0
- package/dist/dashboard/table.js +61 -20
- package/dist/dashboard/table.mjs +61 -20
- package/dist/dashboard/template-dashboard.js +35 -133
- package/dist/dashboard/template-dashboard.mjs +36 -134
- package/dist/dashboard/template-rail.js +674 -0
- package/dist/dashboard/template-rail.mjs +640 -0
- package/dist/dashboard/template-socket.js +23 -3
- package/dist/dashboard/template-socket.mjs +23 -3
- package/dist/dashboard/template-ui.js +150 -186
- package/dist/dashboard/template-ui.mjs +151 -187
- package/dist/icons/book-open.js +46 -0
- package/dist/icons/book-open.mjs +27 -0
- package/dist/icons/task.js +46 -0
- package/dist/icons/task.mjs +27 -0
- package/dist/shared/lib/helpers.js +9 -2
- package/dist/shared/lib/helpers.mjs +9 -2
- package/dist/shared/lib/motion.js +27 -0
- package/dist/shared/lib/motion.mjs +4 -0
- package/dist/shared/overlay.js +5 -3
- package/dist/shared/overlay.mjs +5 -3
- package/package.json +28 -13
- package/types/dashboard/card-task.d.ts +5 -1
- package/types/dashboard/lib/rail.d.ts +32 -0
- package/types/dashboard/lib/throttle.d.ts +5 -0
- package/types/dashboard/table.d.ts +3 -1
- package/types/dashboard/template-dashboard.d.ts +4 -1
- package/types/dashboard/template-rail.d.ts +36 -0
- package/types/dashboard/template-ui.d.ts +2 -2
- package/types/icons/book-open.d.ts +5 -0
- package/types/icons/task.d.ts +5 -0
- package/dist/dashboard/guide.js +0 -238
- package/dist/dashboard/guide.mjs +0 -209
- package/types/dashboard/guide.d.ts +0 -23
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { railCount, railItems, railOnScreen, railOverlap, railTabTarget, railView } from "./lib/rail.mjs";
|
|
7
|
+
import CardTask from "./card-task.mjs";
|
|
8
|
+
import Badge from "../shared/badge.mjs";
|
|
9
|
+
import Button from "../shared/button.mjs";
|
|
10
|
+
import Empty from "../shared/empty.mjs";
|
|
11
|
+
import Tooltip from "../shared/tooltip.mjs";
|
|
12
|
+
import BookOpen from "../icons/book-open.mjs";
|
|
13
|
+
import Task from "../icons/task.mjs";
|
|
14
|
+
import Times from "../icons/times.mjs";
|
|
15
|
+
const titles = {
|
|
16
|
+
guide: "Screen guide",
|
|
17
|
+
next: "Next steps"
|
|
18
|
+
};
|
|
19
|
+
const RING_MS = 3e3;
|
|
20
|
+
const useRail = () => {
|
|
21
|
+
var _a;
|
|
22
|
+
const queryClient = useQueryClient();
|
|
23
|
+
const rail = useQuery({
|
|
24
|
+
queryFn: () => ({
|
|
25
|
+
panel: null
|
|
26
|
+
}),
|
|
27
|
+
queryKey: ["rail"]
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
panel: ((_a = rail.data) == null ? void 0 : _a.panel) || null,
|
|
31
|
+
set: (panel) => queryClient.setQueryData(
|
|
32
|
+
["rail"],
|
|
33
|
+
{
|
|
34
|
+
panel
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const Group = ({
|
|
40
|
+
items,
|
|
41
|
+
onFollow,
|
|
42
|
+
title
|
|
43
|
+
}) => items.length > 0 && /* @__PURE__ */ jsxs(
|
|
44
|
+
"section",
|
|
45
|
+
{
|
|
46
|
+
...{
|
|
47
|
+
className: "space-y-3"
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsxs(
|
|
51
|
+
"p",
|
|
52
|
+
{
|
|
53
|
+
...{
|
|
54
|
+
className: "flex items-center gap-2 text-sm text-gray-dark"
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { children: title }),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
Badge,
|
|
60
|
+
{
|
|
61
|
+
...{
|
|
62
|
+
size: "small"
|
|
63
|
+
},
|
|
64
|
+
children: items.length
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
items.map((item, index) => /* @__PURE__ */ jsx(
|
|
71
|
+
CardTask,
|
|
72
|
+
{
|
|
73
|
+
...{
|
|
74
|
+
badge: item.area,
|
|
75
|
+
message: item.why,
|
|
76
|
+
stack: true,
|
|
77
|
+
title: item.title,
|
|
78
|
+
type: item.kind === "required" ? "warning" : "recommended",
|
|
79
|
+
...item.href && {
|
|
80
|
+
button: {
|
|
81
|
+
href: item.href,
|
|
82
|
+
onClick: onFollow,
|
|
83
|
+
text: item.button
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
item.href + item.title + index
|
|
89
|
+
))
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
const NextSteps = ({
|
|
94
|
+
items,
|
|
95
|
+
onFollow
|
|
96
|
+
}) => items.length === 0 ? /* @__PURE__ */ jsx(
|
|
97
|
+
Empty,
|
|
98
|
+
{
|
|
99
|
+
...{
|
|
100
|
+
variant: "secondary"
|
|
101
|
+
},
|
|
102
|
+
children: "Everything is up to date"
|
|
103
|
+
}
|
|
104
|
+
) : /* @__PURE__ */ jsxs(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
...{
|
|
108
|
+
className: "space-y-6"
|
|
109
|
+
},
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
Group,
|
|
113
|
+
{
|
|
114
|
+
...{
|
|
115
|
+
items: items.filter(({ kind }) => kind === "required"),
|
|
116
|
+
onFollow,
|
|
117
|
+
title: "Required"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
Group,
|
|
123
|
+
{
|
|
124
|
+
...{
|
|
125
|
+
items: items.filter(({ kind }) => kind === "recommended"),
|
|
126
|
+
onFollow,
|
|
127
|
+
title: "Recommended"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
const ScreenGuide = ({
|
|
135
|
+
guide,
|
|
136
|
+
onShow
|
|
137
|
+
}) => /* @__PURE__ */ jsx(
|
|
138
|
+
"ol",
|
|
139
|
+
{
|
|
140
|
+
...{
|
|
141
|
+
className: "divide-y divide-gray"
|
|
142
|
+
},
|
|
143
|
+
children: guide.steps.map((step, index) => /* @__PURE__ */ jsxs(
|
|
144
|
+
"li",
|
|
145
|
+
{
|
|
146
|
+
...{
|
|
147
|
+
className: "grid grid-cols-[28px_minmax(0,1fr)] gap-3 py-4 first:pt-0 last:pb-0"
|
|
148
|
+
},
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
Badge,
|
|
152
|
+
{
|
|
153
|
+
...{
|
|
154
|
+
className: "self-start"
|
|
155
|
+
},
|
|
156
|
+
children: index + 1
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsxs(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
...{
|
|
163
|
+
className: "space-y-2 min-w-0"
|
|
164
|
+
},
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx(
|
|
167
|
+
"p",
|
|
168
|
+
{
|
|
169
|
+
...{
|
|
170
|
+
className: "font-medium"
|
|
171
|
+
},
|
|
172
|
+
children: step.title
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
step.content.map((line, key) => /* @__PURE__ */ jsx(
|
|
176
|
+
"p",
|
|
177
|
+
{
|
|
178
|
+
...{
|
|
179
|
+
className: "text-sm"
|
|
180
|
+
},
|
|
181
|
+
children: line
|
|
182
|
+
},
|
|
183
|
+
key
|
|
184
|
+
)),
|
|
185
|
+
step.target !== "body" ? /* @__PURE__ */ jsx(
|
|
186
|
+
Button,
|
|
187
|
+
{
|
|
188
|
+
...{
|
|
189
|
+
inline: true,
|
|
190
|
+
onClick: () => onShow(step.target),
|
|
191
|
+
size: "small",
|
|
192
|
+
variant: "secondary"
|
|
193
|
+
},
|
|
194
|
+
children: "Show me"
|
|
195
|
+
}
|
|
196
|
+
) : /* @__PURE__ */ jsx(
|
|
197
|
+
"p",
|
|
198
|
+
{
|
|
199
|
+
...{
|
|
200
|
+
className: "text-sm text-gray-dark"
|
|
201
|
+
},
|
|
202
|
+
children: "Applies to the whole screen"
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
index
|
|
211
|
+
))
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
const RailButton = ({
|
|
215
|
+
count,
|
|
216
|
+
icon: Icon,
|
|
217
|
+
label,
|
|
218
|
+
onClick,
|
|
219
|
+
pressed
|
|
220
|
+
}) => {
|
|
221
|
+
const [hovered, setHovered] = useState(false);
|
|
222
|
+
const open = hovered && !pressed;
|
|
223
|
+
return /* @__PURE__ */ jsx(
|
|
224
|
+
Tooltip,
|
|
225
|
+
{
|
|
226
|
+
...{
|
|
227
|
+
content: label,
|
|
228
|
+
open,
|
|
229
|
+
placement: "left",
|
|
230
|
+
// Shut is not drawn at all: a closing label faded over the panel.
|
|
231
|
+
...!open && {
|
|
232
|
+
styles: {
|
|
233
|
+
floater: {
|
|
234
|
+
display: "none"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
children: /* @__PURE__ */ jsx(
|
|
240
|
+
Button,
|
|
241
|
+
{
|
|
242
|
+
...{
|
|
243
|
+
"aria-label": count ? label + ", " + count + " required" : label,
|
|
244
|
+
"aria-pressed": pressed,
|
|
245
|
+
inline: true,
|
|
246
|
+
onClick: () => {
|
|
247
|
+
setHovered(false);
|
|
248
|
+
onClick();
|
|
249
|
+
},
|
|
250
|
+
onMouseEnter: () => setHovered(true),
|
|
251
|
+
onMouseLeave: () => setHovered(false),
|
|
252
|
+
variant: "link"
|
|
253
|
+
},
|
|
254
|
+
children: /* @__PURE__ */ jsxs(
|
|
255
|
+
"span",
|
|
256
|
+
{
|
|
257
|
+
...{
|
|
258
|
+
className: "relative flex items-center justify-center w-9 h-9 rounded transition duration-300 " + (pressed ? "bg-gray-light ring-1 ring-gray" : "hover:bg-gray-light")
|
|
259
|
+
},
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsx(
|
|
262
|
+
Icon,
|
|
263
|
+
{
|
|
264
|
+
...{
|
|
265
|
+
className: "w-5 h-5"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
count > 0 && /* @__PURE__ */ jsx(
|
|
270
|
+
Badge,
|
|
271
|
+
{
|
|
272
|
+
...{
|
|
273
|
+
className: "absolute -top-1.5 -right-1 px-1!",
|
|
274
|
+
size: "small",
|
|
275
|
+
type: "warning"
|
|
276
|
+
},
|
|
277
|
+
children: count
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
};
|
|
288
|
+
const Ring = ({
|
|
289
|
+
rect
|
|
290
|
+
}) => rect && createPortal(
|
|
291
|
+
/* @__PURE__ */ jsx(
|
|
292
|
+
"div",
|
|
293
|
+
{
|
|
294
|
+
...{
|
|
295
|
+
"data-rail-ring": true,
|
|
296
|
+
className: "fixed z-[60] rounded pointer-events-none ring-4 ring-green-dark ring-offset-2 ring-offset-white",
|
|
297
|
+
style: {
|
|
298
|
+
height: rect.height,
|
|
299
|
+
left: rect.left,
|
|
300
|
+
top: rect.top,
|
|
301
|
+
width: rect.width
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
document.body
|
|
307
|
+
);
|
|
308
|
+
const scrollBox = (element) => {
|
|
309
|
+
let box = element.parentElement;
|
|
310
|
+
while (box && !(/auto|scroll/.test(getComputedStyle(box).overflowY) && box.scrollHeight > box.clientHeight)) {
|
|
311
|
+
box = box.parentElement;
|
|
312
|
+
}
|
|
313
|
+
;
|
|
314
|
+
return box;
|
|
315
|
+
};
|
|
316
|
+
const scrollTo = (box, element) => {
|
|
317
|
+
const from = box.getBoundingClientRect();
|
|
318
|
+
const to = element.getBoundingClientRect();
|
|
319
|
+
box.scrollTo({
|
|
320
|
+
behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth",
|
|
321
|
+
top: box.scrollTop + to.top - from.top - (box.clientHeight - to.height) / 2
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
const TemplateRail = ({
|
|
325
|
+
account,
|
|
326
|
+
campaign,
|
|
327
|
+
children,
|
|
328
|
+
guide,
|
|
329
|
+
organization,
|
|
330
|
+
params = {},
|
|
331
|
+
path = ""
|
|
332
|
+
}) => {
|
|
333
|
+
const queryClient = useQueryClient();
|
|
334
|
+
const { panel, set } = useRail();
|
|
335
|
+
const page = useQuery({
|
|
336
|
+
enabled: false,
|
|
337
|
+
// the page's builder loads it
|
|
338
|
+
queryKey: ["organization-campaign-page", params]
|
|
339
|
+
});
|
|
340
|
+
const items = railItems({
|
|
341
|
+
account,
|
|
342
|
+
campaign,
|
|
343
|
+
organization,
|
|
344
|
+
page: page.data,
|
|
345
|
+
params,
|
|
346
|
+
path
|
|
347
|
+
});
|
|
348
|
+
const view = railView({
|
|
349
|
+
guide,
|
|
350
|
+
panel
|
|
351
|
+
});
|
|
352
|
+
const toggle = (next) => set(view === next ? null : next);
|
|
353
|
+
const close = () => set(null);
|
|
354
|
+
const aside = useRef(null);
|
|
355
|
+
const opened = useRef(Boolean(view));
|
|
356
|
+
const arrived = useRef(Boolean(view));
|
|
357
|
+
if (!view) arrived.current = false;
|
|
358
|
+
const opener = useRef(null);
|
|
359
|
+
const [ring, setRing] = useState(null);
|
|
360
|
+
const [rect, setRect] = useState(null);
|
|
361
|
+
const [away, setAway] = useState(false);
|
|
362
|
+
useEffect(
|
|
363
|
+
() => {
|
|
364
|
+
if (!ring) return void 0;
|
|
365
|
+
const element = document.querySelector(ring.target);
|
|
366
|
+
const box = element && scrollBox(element);
|
|
367
|
+
const shown = element && element.getClientRects().length > 0 && railOnScreen(
|
|
368
|
+
(box || element).getBoundingClientRect(),
|
|
369
|
+
{
|
|
370
|
+
height: window.innerHeight,
|
|
371
|
+
width: window.innerWidth
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
if (!shown) {
|
|
375
|
+
queryClient.setQueryData(
|
|
376
|
+
["notice"],
|
|
377
|
+
{
|
|
378
|
+
active: true,
|
|
379
|
+
response: {
|
|
380
|
+
message: "That isn't on this page right now"
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
setRing(null);
|
|
385
|
+
return void 0;
|
|
386
|
+
}
|
|
387
|
+
if (box) scrollTo(box, element);
|
|
388
|
+
const end = Date.now() + RING_MS;
|
|
389
|
+
let frame;
|
|
390
|
+
const step = () => {
|
|
391
|
+
if (Date.now() > end || !element.isConnected) {
|
|
392
|
+
setRect(null);
|
|
393
|
+
setAway(false);
|
|
394
|
+
setRing(null);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const box2 = element.getBoundingClientRect();
|
|
398
|
+
setRect(box2);
|
|
399
|
+
setAway(aside.current ? railOverlap(box2, aside.current.getBoundingClientRect()) : false);
|
|
400
|
+
frame = window.requestAnimationFrame(step);
|
|
401
|
+
};
|
|
402
|
+
step();
|
|
403
|
+
return () => {
|
|
404
|
+
window.cancelAnimationFrame(frame);
|
|
405
|
+
setRect(null);
|
|
406
|
+
setAway(false);
|
|
407
|
+
};
|
|
408
|
+
},
|
|
409
|
+
[queryClient, ring]
|
|
410
|
+
);
|
|
411
|
+
useEffect(
|
|
412
|
+
() => {
|
|
413
|
+
var _a, _b;
|
|
414
|
+
const open = Boolean(view);
|
|
415
|
+
if (open === opened.current) return;
|
|
416
|
+
opened.current = open;
|
|
417
|
+
if (open) {
|
|
418
|
+
opener.current = document.activeElement;
|
|
419
|
+
(_a = aside.current) == null ? void 0 : _a.focus();
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if ((_b = opener.current) == null ? void 0 : _b.isConnected) opener.current.focus();
|
|
423
|
+
opener.current = null;
|
|
424
|
+
},
|
|
425
|
+
[view]
|
|
426
|
+
);
|
|
427
|
+
const phone = () => window.matchMedia("(max-width: 767px)").matches;
|
|
428
|
+
const onKeyDown = (event) => {
|
|
429
|
+
if (event.key === "Escape") {
|
|
430
|
+
event.preventDefault();
|
|
431
|
+
close();
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
if (event.key !== "Tab" || !phone()) return;
|
|
435
|
+
const next = railTabTarget({
|
|
436
|
+
active: document.activeElement,
|
|
437
|
+
items: [...aside.current.querySelectorAll("a[href], button:not([disabled])")],
|
|
438
|
+
shift: event.shiftKey
|
|
439
|
+
});
|
|
440
|
+
if (next) {
|
|
441
|
+
event.preventDefault();
|
|
442
|
+
next.focus();
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
const onFollow = () => {
|
|
446
|
+
if (phone()) close();
|
|
447
|
+
};
|
|
448
|
+
const onShow = (target) => setRing({
|
|
449
|
+
nonce: Date.now(),
|
|
450
|
+
target
|
|
451
|
+
});
|
|
452
|
+
return /* @__PURE__ */ jsxs(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
...{
|
|
456
|
+
className: "relative flex h-full w-full min-w-0 md:w-3/4 lg:w-4/5"
|
|
457
|
+
},
|
|
458
|
+
children: [
|
|
459
|
+
/* @__PURE__ */ jsx(
|
|
460
|
+
"div",
|
|
461
|
+
{
|
|
462
|
+
...{
|
|
463
|
+
className: "@container flex flex-col h-full flex-1 min-w-0"
|
|
464
|
+
},
|
|
465
|
+
children
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
view && /* @__PURE__ */ jsxs(
|
|
469
|
+
"aside",
|
|
470
|
+
{
|
|
471
|
+
...{
|
|
472
|
+
"aria-label": titles[view],
|
|
473
|
+
className: "fixed inset-0 z-[35] flex flex-col bg-white outline-none transition duration-200 ease-out motion-reduce:transition-none md:absolute md:inset-auto md:top-0 md:bottom-0 md:right-12 md:z-20 md:w-96 md:border-l md:border-gray 2xl:static 2xl:z-auto 2xl:h-full 2xl:shrink-0 " + (arrived.current ? "" : "starting:opacity-0 starting:translate-x-4 ") + (away ? "opacity-0 pointer-events-none" : ""),
|
|
474
|
+
onKeyDown,
|
|
475
|
+
ref: aside,
|
|
476
|
+
tabIndex: -1
|
|
477
|
+
},
|
|
478
|
+
children: [
|
|
479
|
+
/* @__PURE__ */ jsxs(
|
|
480
|
+
"div",
|
|
481
|
+
{
|
|
482
|
+
...{
|
|
483
|
+
className: "flex items-center justify-between h-14 px-6 shrink-0 border-b border-gray"
|
|
484
|
+
},
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ jsx(
|
|
487
|
+
"span",
|
|
488
|
+
{
|
|
489
|
+
...{
|
|
490
|
+
className: "font-medium"
|
|
491
|
+
},
|
|
492
|
+
children: titles[view]
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
/* @__PURE__ */ jsx(
|
|
496
|
+
"span",
|
|
497
|
+
{
|
|
498
|
+
...{
|
|
499
|
+
className: "flex md:hidden"
|
|
500
|
+
},
|
|
501
|
+
children: /* @__PURE__ */ jsx(
|
|
502
|
+
Button,
|
|
503
|
+
{
|
|
504
|
+
...{
|
|
505
|
+
"aria-label": "Close",
|
|
506
|
+
inline: true,
|
|
507
|
+
onClick: close,
|
|
508
|
+
variant: "link"
|
|
509
|
+
},
|
|
510
|
+
children: /* @__PURE__ */ jsx(
|
|
511
|
+
Times,
|
|
512
|
+
{
|
|
513
|
+
...{
|
|
514
|
+
className: "w-6 h-6"
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
}
|
|
521
|
+
)
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
/* @__PURE__ */ jsxs(
|
|
526
|
+
"div",
|
|
527
|
+
{
|
|
528
|
+
...{
|
|
529
|
+
className: "flex-1 min-h-0 overflow-y-auto p-6"
|
|
530
|
+
},
|
|
531
|
+
children: [
|
|
532
|
+
view === "next" && /* @__PURE__ */ jsx(
|
|
533
|
+
NextSteps,
|
|
534
|
+
{
|
|
535
|
+
...{
|
|
536
|
+
items,
|
|
537
|
+
onFollow
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
view === "guide" && /* @__PURE__ */ jsx(
|
|
542
|
+
ScreenGuide,
|
|
543
|
+
{
|
|
544
|
+
...{
|
|
545
|
+
guide,
|
|
546
|
+
onShow
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
]
|
|
554
|
+
}
|
|
555
|
+
),
|
|
556
|
+
/* @__PURE__ */ jsxs(
|
|
557
|
+
"nav",
|
|
558
|
+
{
|
|
559
|
+
...{
|
|
560
|
+
"aria-label": "Rail",
|
|
561
|
+
className: "hidden md:flex flex-col items-center gap-2 w-12 h-full shrink-0 py-3 bg-white border-l border-gray relative z-20"
|
|
562
|
+
},
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ jsx(
|
|
565
|
+
RailButton,
|
|
566
|
+
{
|
|
567
|
+
...{
|
|
568
|
+
count: railCount(items),
|
|
569
|
+
icon: Task,
|
|
570
|
+
label: titles.next,
|
|
571
|
+
onClick: () => toggle("next"),
|
|
572
|
+
pressed: view === "next"
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
guide && /* @__PURE__ */ jsx(
|
|
577
|
+
RailButton,
|
|
578
|
+
{
|
|
579
|
+
...{
|
|
580
|
+
icon: BookOpen,
|
|
581
|
+
label: titles.guide,
|
|
582
|
+
onClick: () => toggle("guide"),
|
|
583
|
+
pressed: view === "guide"
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ jsx(
|
|
591
|
+
Ring,
|
|
592
|
+
{
|
|
593
|
+
...{
|
|
594
|
+
rect
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
};
|
|
602
|
+
const TemplateRailBook = ({
|
|
603
|
+
guide
|
|
604
|
+
}) => {
|
|
605
|
+
const { set } = useRail();
|
|
606
|
+
if (!guide) return null;
|
|
607
|
+
return /* @__PURE__ */ jsx(
|
|
608
|
+
"div",
|
|
609
|
+
{
|
|
610
|
+
...{
|
|
611
|
+
className: "flex text-white transform duration-300 hover:opacity-70 md:hidden"
|
|
612
|
+
},
|
|
613
|
+
children: /* @__PURE__ */ jsx(
|
|
614
|
+
Button,
|
|
615
|
+
{
|
|
616
|
+
...{
|
|
617
|
+
"aria-label": titles.guide,
|
|
618
|
+
inline: true,
|
|
619
|
+
onClick: () => set("guide"),
|
|
620
|
+
variant: "link"
|
|
621
|
+
},
|
|
622
|
+
children: /* @__PURE__ */ jsx(
|
|
623
|
+
BookOpen,
|
|
624
|
+
{
|
|
625
|
+
...{
|
|
626
|
+
className: "w-6 h-6 shrink-0"
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
)
|
|
630
|
+
}
|
|
631
|
+
)
|
|
632
|
+
}
|
|
633
|
+
);
|
|
634
|
+
};
|
|
635
|
+
var template_rail_default = TemplateRail;
|
|
636
|
+
export {
|
|
637
|
+
TemplateRailBook,
|
|
638
|
+
template_rail_default as default,
|
|
639
|
+
useRail
|
|
640
|
+
};
|
|
@@ -35,9 +35,11 @@ __export(template_socket_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(template_socket_exports);
|
|
37
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var import_react = require("react");
|
|
38
39
|
var import_navigation = require("next/navigation");
|
|
39
40
|
var import_react_query = require("@tanstack/react-query");
|
|
40
41
|
var import_hooks = require("./lib/hooks");
|
|
42
|
+
var import_throttle = require("./lib/throttle");
|
|
41
43
|
var import_helpers = require("../shared/lib/helpers");
|
|
42
44
|
var import_template_suspended = __toESM(require("./template-suspended"));
|
|
43
45
|
const TemplateSocketAccount = ({
|
|
@@ -258,6 +260,15 @@ const TemplateSocketOrganization = ({
|
|
|
258
260
|
}) => {
|
|
259
261
|
const params = (0, import_navigation.useParams)();
|
|
260
262
|
const queryClient = (0, import_react_query.useQueryClient)();
|
|
263
|
+
const [refetchNextSteps] = (0, import_react.useState)(() => (0, import_throttle.trailingThrottle)({
|
|
264
|
+
wait: 1e4
|
|
265
|
+
}));
|
|
266
|
+
const refetchOrganization = () => refetchNextSteps(
|
|
267
|
+
"organization." + params.organization,
|
|
268
|
+
() => queryClient.invalidateQueries({
|
|
269
|
+
queryKey: ["organization", params.organization]
|
|
270
|
+
})
|
|
271
|
+
);
|
|
261
272
|
const { data: organization } = (0, import_react_query.useQuery)({
|
|
262
273
|
enabled: false,
|
|
263
274
|
queryKey: ["organization", params == null ? void 0 : params.organization]
|
|
@@ -322,9 +333,19 @@ const TemplateSocketOrganization = ({
|
|
|
322
333
|
queryClient.invalidateQueries({
|
|
323
334
|
queryKey: ["organization-workflow", params.organization]
|
|
324
335
|
});
|
|
336
|
+
queryClient.invalidateQueries({
|
|
337
|
+
queryKey: ["workflow-email-preview", params.organization]
|
|
338
|
+
});
|
|
325
339
|
queryClient.invalidateQueries({
|
|
326
340
|
queryKey: ["menu", "campaign", params.organization]
|
|
327
341
|
});
|
|
342
|
+
refetchOrganization();
|
|
343
|
+
refetchNextSteps(
|
|
344
|
+
"menu." + params.organization,
|
|
345
|
+
() => queryClient.invalidateQueries({
|
|
346
|
+
queryKey: ["menu", "organization", params.organization]
|
|
347
|
+
})
|
|
348
|
+
);
|
|
328
349
|
queryClient.invalidateQueries({
|
|
329
350
|
queryKey: ["organization-affiliate-campaigns"]
|
|
330
351
|
});
|
|
@@ -479,9 +500,7 @@ const TemplateSocketOrganization = ({
|
|
|
479
500
|
// emits this whenever a count changes. Refetch the authoritative org doc
|
|
480
501
|
// + the usage page / dashboard that display those counts.
|
|
481
502
|
"organization.totals": () => {
|
|
482
|
-
|
|
483
|
-
queryKey: ["organization", params.organization]
|
|
484
|
-
});
|
|
503
|
+
refetchOrganization();
|
|
485
504
|
queryClient.invalidateQueries({
|
|
486
505
|
queryKey: ["organization-usage-chart", params.organization]
|
|
487
506
|
});
|
|
@@ -598,6 +617,7 @@ const TemplateSocketOrganization = ({
|
|
|
598
617
|
["organization-campaign-products", params == null ? void 0 : params.organization],
|
|
599
618
|
["organization-workflows", params == null ? void 0 : params.organization],
|
|
600
619
|
["organization-workflow", params == null ? void 0 : params.organization],
|
|
620
|
+
["workflow-email-preview", params == null ? void 0 : params.organization],
|
|
601
621
|
["organization-workflow-steps"],
|
|
602
622
|
["organization-contacts", params == null ? void 0 : params.organization],
|
|
603
623
|
["organization-exports", params == null ? void 0 : params.organization],
|