@drawbridge/components 0.1.22 → 0.1.23
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 +2 -2
- package/dist/dashboard/form-organization-workflow.mjs +2 -2
- 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 +19 -3
- package/dist/dashboard/template-socket.mjs +19 -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 +27 -12
- 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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
3
4
|
import { useParams } from "next/navigation";
|
|
4
5
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
6
|
import { useSocketRoom } from "./lib/hooks.mjs";
|
|
7
|
+
import { trailingThrottle } from "./lib/throttle.mjs";
|
|
6
8
|
import { isAdmin } from "../shared/lib/helpers.mjs";
|
|
7
9
|
import TemplateSuspended from "./template-suspended.mjs";
|
|
8
10
|
const TemplateSocketAccount = ({
|
|
@@ -201,6 +203,15 @@ const TemplateSocketOrganization = ({
|
|
|
201
203
|
}) => {
|
|
202
204
|
const params = useParams();
|
|
203
205
|
const queryClient = useQueryClient();
|
|
206
|
+
const [refetchNextSteps] = useState(() => trailingThrottle({
|
|
207
|
+
wait: 1e4
|
|
208
|
+
}));
|
|
209
|
+
const refetchOrganization = () => refetchNextSteps(
|
|
210
|
+
"organization." + params.organization,
|
|
211
|
+
() => queryClient.invalidateQueries({
|
|
212
|
+
queryKey: ["organization", params.organization]
|
|
213
|
+
})
|
|
214
|
+
);
|
|
204
215
|
const { data: organization } = useQuery({
|
|
205
216
|
enabled: false,
|
|
206
217
|
queryKey: ["organization", params == null ? void 0 : params.organization]
|
|
@@ -268,6 +279,13 @@ const TemplateSocketOrganization = ({
|
|
|
268
279
|
queryClient.invalidateQueries({
|
|
269
280
|
queryKey: ["menu", "campaign", params.organization]
|
|
270
281
|
});
|
|
282
|
+
refetchOrganization();
|
|
283
|
+
refetchNextSteps(
|
|
284
|
+
"menu." + params.organization,
|
|
285
|
+
() => queryClient.invalidateQueries({
|
|
286
|
+
queryKey: ["menu", "organization", params.organization]
|
|
287
|
+
})
|
|
288
|
+
);
|
|
271
289
|
queryClient.invalidateQueries({
|
|
272
290
|
queryKey: ["organization-affiliate-campaigns"]
|
|
273
291
|
});
|
|
@@ -419,9 +437,7 @@ const TemplateSocketOrganization = ({
|
|
|
419
437
|
// emits this whenever a count changes. Refetch the authoritative org doc
|
|
420
438
|
// + the usage page / dashboard that display those counts.
|
|
421
439
|
"organization.totals": () => {
|
|
422
|
-
|
|
423
|
-
queryKey: ["organization", params.organization]
|
|
424
|
-
});
|
|
440
|
+
refetchOrganization();
|
|
425
441
|
queryClient.invalidateQueries({
|
|
426
442
|
queryKey: ["organization-usage-chart", params.organization]
|
|
427
443
|
});
|
|
@@ -37,7 +37,7 @@ var import_navigation = require("next/navigation");
|
|
|
37
37
|
var import_react_query = require("@tanstack/react-query");
|
|
38
38
|
var import_hooks = require("./lib/hooks");
|
|
39
39
|
var import_wrapper_gradient = __toESM(require("../wrapper-gradient"));
|
|
40
|
-
var
|
|
40
|
+
var import_template_rail = __toESM(require("./template-rail"));
|
|
41
41
|
var import_menu = require("./menu");
|
|
42
42
|
var import_menu2 = __toESM(require("../icons/menu"));
|
|
43
43
|
var import_switch = __toESM(require("../icons/switch"));
|
|
@@ -52,7 +52,6 @@ const offsets = {
|
|
|
52
52
|
paddingTop: "pt-16 md:pt-0"
|
|
53
53
|
};
|
|
54
54
|
const isAccountPath = (path) => path === "/account" || path.startsWith("/account/");
|
|
55
|
-
let timeout;
|
|
56
55
|
const TemplateUIHeaderBack = ({
|
|
57
56
|
href,
|
|
58
57
|
icon: Icon = import_arrow_left.default,
|
|
@@ -124,6 +123,7 @@ const TemplateUiHeader = ({
|
|
|
124
123
|
active,
|
|
125
124
|
campaign = {},
|
|
126
125
|
className,
|
|
126
|
+
guide,
|
|
127
127
|
organization = {},
|
|
128
128
|
params,
|
|
129
129
|
path
|
|
@@ -187,6 +187,14 @@ const TemplateUiHeader = ({
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
),
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
191
|
+
import_template_rail.TemplateRailBook,
|
|
192
|
+
{
|
|
193
|
+
...{
|
|
194
|
+
guide
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
),
|
|
190
198
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
191
199
|
"div",
|
|
192
200
|
{
|
|
@@ -287,21 +295,11 @@ const TemplateUi = ({
|
|
|
287
295
|
queryKey: ["campaign", params.campaign]
|
|
288
296
|
});
|
|
289
297
|
const guide = (_b = (_a = account == null ? void 0 : account.data) == null ? void 0 : _a.guide) == null ? void 0 : _b[guideId];
|
|
290
|
-
const [run, setRun] = (0, import_react.useState)(false);
|
|
291
298
|
const modal = (0, import_hooks.useModal)({
|
|
292
299
|
queryClient
|
|
293
300
|
});
|
|
294
301
|
const actions = (0, import_react.useMemo)(
|
|
295
302
|
() => {
|
|
296
|
-
const reset = () => {
|
|
297
|
-
modal.close();
|
|
298
|
-
queryClient.setQueryData(
|
|
299
|
-
["menu"],
|
|
300
|
-
{
|
|
301
|
-
active: false
|
|
302
|
-
}
|
|
303
|
-
);
|
|
304
|
-
};
|
|
305
303
|
const menu2 = () => {
|
|
306
304
|
queryClient.setQueryData(
|
|
307
305
|
["menu"],
|
|
@@ -311,10 +309,6 @@ const TemplateUi = ({
|
|
|
311
309
|
);
|
|
312
310
|
};
|
|
313
311
|
return {
|
|
314
|
-
guide: () => {
|
|
315
|
-
reset();
|
|
316
|
-
setRun(true);
|
|
317
|
-
},
|
|
318
312
|
signout: () => {
|
|
319
313
|
modal.open({
|
|
320
314
|
message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -351,188 +345,158 @@ const TemplateUi = ({
|
|
|
351
345
|
},
|
|
352
346
|
[queryClient, modal]
|
|
353
347
|
);
|
|
354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
{
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
() => {
|
|
374
|
-
setRun(true);
|
|
375
|
-
},
|
|
376
|
-
step.data[key].timeout
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
if (type === "tour:end") {
|
|
381
|
-
setRun(false);
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
run
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
),
|
|
388
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
389
|
-
"div",
|
|
390
|
-
{
|
|
391
|
-
...{
|
|
392
|
-
className: "flex flex-col h-dvh overflow-hidden md:flex-row " + offsets.paddingTop
|
|
393
|
-
},
|
|
394
|
-
children: [
|
|
395
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
396
|
-
TemplateUiHeader,
|
|
397
|
-
{
|
|
398
|
-
...{
|
|
399
|
-
actions,
|
|
400
|
-
active: (_c = menu == null ? void 0 : menu.data) == null ? void 0 : _c.active,
|
|
401
|
-
campaign: campaign == null ? void 0 : campaign.data,
|
|
402
|
-
className: "z-30 fixed top-0 left-0 md:hidden",
|
|
403
|
-
organization: organization == null ? void 0 : organization.data,
|
|
404
|
-
params,
|
|
405
|
-
path
|
|
406
|
-
}
|
|
348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
349
|
+
"div",
|
|
350
|
+
{
|
|
351
|
+
...{
|
|
352
|
+
className: "flex flex-col h-dvh overflow-hidden md:flex-row " + offsets.paddingTop
|
|
353
|
+
},
|
|
354
|
+
children: [
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
356
|
+
TemplateUiHeader,
|
|
357
|
+
{
|
|
358
|
+
...{
|
|
359
|
+
actions,
|
|
360
|
+
active: (_c = menu == null ? void 0 : menu.data) == null ? void 0 : _c.active,
|
|
361
|
+
campaign: campaign == null ? void 0 : campaign.data,
|
|
362
|
+
className: "z-30 fixed top-0 left-0 md:hidden",
|
|
363
|
+
guide,
|
|
364
|
+
organization: organization == null ? void 0 : organization.data,
|
|
365
|
+
params,
|
|
366
|
+
path
|
|
407
367
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
371
|
+
"div",
|
|
372
|
+
{
|
|
373
|
+
...{
|
|
374
|
+
className: "z-[25] fixed top-0 left-0 w-full flex flex-col justify-between bg-black h-full transition duration-200 ease-out motion-reduce:transition-none md:z-0 md:relative md:w-1/3 lg:w-1/4 xl:w-1/5 " + (((_d = menu == null ? void 0 : menu.data) == null ? void 0 : _d.active) ? "translate-y-0 " + offsets.paddingTop : "-translate-y-full md:translate-y-0")
|
|
375
|
+
},
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
378
|
+
TemplateUiHeader,
|
|
379
|
+
{
|
|
380
|
+
...{
|
|
381
|
+
actions,
|
|
382
|
+
active: (_e = menu == null ? void 0 : menu.data) == null ? void 0 : _e.active,
|
|
383
|
+
campaign: campaign == null ? void 0 : campaign.data,
|
|
384
|
+
className: "hidden md:flex border-b border-gray-dark relative z-[3]",
|
|
385
|
+
organization: organization == null ? void 0 : organization.data,
|
|
386
|
+
params,
|
|
387
|
+
path
|
|
428
388
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
(params == null ? void 0 : params.organization) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
392
|
+
TemplateUiBand,
|
|
393
|
+
{
|
|
394
|
+
...{
|
|
395
|
+
record: params.campaign ? campaign == null ? void 0 : campaign.data : organization == null ? void 0 : organization.data
|
|
436
396
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
},
|
|
457
|
-
params.organization + "-" + params.campaign
|
|
458
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
459
|
-
import_menu.MenuOrganization,
|
|
460
|
-
{
|
|
461
|
-
...{
|
|
462
|
-
onClick: actions.menu,
|
|
463
|
-
organization: params.organization,
|
|
464
|
-
path
|
|
465
|
-
}
|
|
466
|
-
},
|
|
467
|
-
params.organization
|
|
468
|
-
) }),
|
|
469
|
-
!(params == null ? void 0 : params.organization) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
470
|
-
import_menu.MenuApp,
|
|
471
|
-
{
|
|
472
|
-
...{
|
|
473
|
-
onClick: actions.menu,
|
|
474
|
-
path
|
|
475
|
-
}
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
400
|
+
import_wrapper_gradient.default,
|
|
401
|
+
{
|
|
402
|
+
...{
|
|
403
|
+
className: "flex-1 min-h-0",
|
|
404
|
+
classNameGradient: "from-black to-transparent h-10",
|
|
405
|
+
classNameScroll: "h-full"
|
|
406
|
+
},
|
|
407
|
+
children: [
|
|
408
|
+
(params == null ? void 0 : params.organization) && !(organization == null ? void 0 : organization.isLoading) && (organization == null ? void 0 : organization.data) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: params.organization && params.campaign ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
409
|
+
import_menu.MenuCampaign,
|
|
410
|
+
{
|
|
411
|
+
...{
|
|
412
|
+
campaign: params.campaign,
|
|
413
|
+
onClick: actions.menu,
|
|
414
|
+
organization: params.organization,
|
|
415
|
+
path
|
|
476
416
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
417
|
+
},
|
|
418
|
+
params.organization + "-" + params.campaign
|
|
419
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
420
|
+
import_menu.MenuOrganization,
|
|
421
|
+
{
|
|
422
|
+
...{
|
|
423
|
+
onClick: actions.menu,
|
|
424
|
+
organization: params.organization,
|
|
425
|
+
path
|
|
485
426
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
427
|
+
},
|
|
428
|
+
params.organization
|
|
429
|
+
) }),
|
|
430
|
+
!(params == null ? void 0 : params.organization) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
431
|
+
import_menu.MenuApp,
|
|
432
|
+
{
|
|
433
|
+
...{
|
|
434
|
+
onClick: actions.menu,
|
|
435
|
+
path
|
|
494
436
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
440
|
+
import_menu.MenuAdmin,
|
|
441
|
+
{
|
|
442
|
+
...{
|
|
443
|
+
onClick: actions.menu,
|
|
444
|
+
path
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
),
|
|
448
|
+
isAccountPath(path) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
449
|
+
import_menu.MenuAccount,
|
|
507
450
|
{
|
|
508
451
|
...{
|
|
509
|
-
actions,
|
|
510
|
-
account,
|
|
511
|
-
balance,
|
|
512
|
-
guide,
|
|
513
|
-
modal,
|
|
514
452
|
onClick: actions.menu,
|
|
515
453
|
path
|
|
516
454
|
}
|
|
517
455
|
}
|
|
518
456
|
)
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
),
|
|
460
|
+
!isAccountPath(path) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
461
|
+
"div",
|
|
462
|
+
{
|
|
463
|
+
...{
|
|
464
|
+
className: "relative z-[3]"
|
|
465
|
+
},
|
|
466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
467
|
+
import_menu.MenuAccountDropdown,
|
|
468
|
+
{
|
|
469
|
+
...{
|
|
470
|
+
actions,
|
|
471
|
+
account,
|
|
472
|
+
balance,
|
|
473
|
+
modal,
|
|
474
|
+
onClick: actions.menu,
|
|
475
|
+
path
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
)
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
485
|
+
import_template_rail.default,
|
|
486
|
+
{
|
|
487
|
+
...{
|
|
488
|
+
account: account == null ? void 0 : account.data,
|
|
489
|
+
campaign: campaign == null ? void 0 : campaign.data,
|
|
490
|
+
guide,
|
|
491
|
+
organization: organization == null ? void 0 : organization.data,
|
|
492
|
+
params,
|
|
493
|
+
path
|
|
494
|
+
},
|
|
495
|
+
children
|
|
496
|
+
}
|
|
497
|
+
)
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
);
|
|
537
501
|
};
|
|
538
502
|
var template_ui_default = TemplateUi;
|