@drawbridge/components 0.1.40 → 0.1.42
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/dashboard/form-tests.js +38 -7
- package/dist/dashboard/form-tests.mjs +39 -8
- package/dist/dashboard/lib/ab-tests.js +2 -0
- package/dist/dashboard/lib/ab-tests.mjs +1 -0
- package/dist/dashboard/lib/rail.js +4 -1
- package/dist/dashboard/lib/rail.mjs +4 -1
- package/dist/dashboard/template-rail.js +35 -18
- package/dist/dashboard/template-rail.mjs +35 -18
- package/dist/dashboard/template-test-page.js +3 -0
- package/dist/dashboard/template-test-page.mjs +3 -0
- package/package.json +2 -2
- package/types/dashboard/form-tests.d.ts +2 -0
- package/types/dashboard/lib/ab-tests.d.ts +3 -0
|
@@ -110,6 +110,7 @@ const field = ({
|
|
|
110
110
|
control,
|
|
111
111
|
input,
|
|
112
112
|
label,
|
|
113
|
+
message,
|
|
113
114
|
name,
|
|
114
115
|
rules
|
|
115
116
|
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -127,7 +128,8 @@ const field = ({
|
|
|
127
128
|
onChange,
|
|
128
129
|
value
|
|
129
130
|
}),
|
|
130
|
-
label
|
|
131
|
+
label,
|
|
132
|
+
message
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
),
|
|
@@ -136,7 +138,7 @@ const field = ({
|
|
|
136
138
|
},
|
|
137
139
|
name
|
|
138
140
|
);
|
|
139
|
-
const title = (control) => field({
|
|
141
|
+
const title = (control, message) => field({
|
|
140
142
|
control,
|
|
141
143
|
input: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
142
144
|
import_input_text.default,
|
|
@@ -148,6 +150,7 @@ const title = (control) => field({
|
|
|
148
150
|
}
|
|
149
151
|
),
|
|
150
152
|
label: "Title",
|
|
153
|
+
message,
|
|
151
154
|
name: "title",
|
|
152
155
|
rules: {
|
|
153
156
|
required: "Title is required"
|
|
@@ -192,7 +195,7 @@ const FormTest = ({
|
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
197
|
),
|
|
195
|
-
title(control)
|
|
198
|
+
title(control, values.title ? void 0 : 'Name it for what you are testing, such as "Video first"')
|
|
196
199
|
]
|
|
197
200
|
}
|
|
198
201
|
);
|
|
@@ -227,7 +230,7 @@ const FormVariant = ({
|
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
232
|
),
|
|
230
|
-
title(control),
|
|
233
|
+
title(control, 'Name it for the one thing you will change, such as "No video"'),
|
|
231
234
|
pages.length > 1 && field({
|
|
232
235
|
control,
|
|
233
236
|
input: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -442,6 +445,7 @@ const RowVariant = ({
|
|
|
442
445
|
const FormTestRail = ({
|
|
443
446
|
addReason,
|
|
444
447
|
disabled,
|
|
448
|
+
draft,
|
|
445
449
|
notice,
|
|
446
450
|
onAdd,
|
|
447
451
|
onDates,
|
|
@@ -491,6 +495,29 @@ const FormTestRail = ({
|
|
|
491
495
|
});
|
|
492
496
|
}
|
|
493
497
|
);
|
|
498
|
+
const next = notice || (!draft ? null : startsAt && endsAt ? {
|
|
499
|
+
button: {
|
|
500
|
+
disabled,
|
|
501
|
+
element: "button",
|
|
502
|
+
loading: formState.isSubmitting,
|
|
503
|
+
onClick: () => {
|
|
504
|
+
},
|
|
505
|
+
text: "Schedule",
|
|
506
|
+
type: "submit"
|
|
507
|
+
},
|
|
508
|
+
message: "Your test starts on " + (0, import_ab_tests.short)(startsAt),
|
|
509
|
+
title: "Ready to schedule"
|
|
510
|
+
} : {
|
|
511
|
+
button: {
|
|
512
|
+
disabled,
|
|
513
|
+
element: "button",
|
|
514
|
+
onClick: dates,
|
|
515
|
+
text: "Set dates",
|
|
516
|
+
type: "button"
|
|
517
|
+
},
|
|
518
|
+
message: "A test runs from its start date to its end date",
|
|
519
|
+
title: "Set your dates"
|
|
520
|
+
});
|
|
494
521
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
495
522
|
import_form2.default,
|
|
496
523
|
{
|
|
@@ -526,10 +553,10 @@ const FormTestRail = ({
|
|
|
526
553
|
}
|
|
527
554
|
}
|
|
528
555
|
) }),
|
|
529
|
-
|
|
556
|
+
next && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
530
557
|
import_card_task.default,
|
|
531
558
|
{
|
|
532
|
-
...
|
|
559
|
+
...next
|
|
533
560
|
}
|
|
534
561
|
),
|
|
535
562
|
title(control),
|
|
@@ -541,6 +568,7 @@ const FormTestRail = ({
|
|
|
541
568
|
import_button.default,
|
|
542
569
|
{
|
|
543
570
|
...{
|
|
571
|
+
"data-guide": "test-dates",
|
|
544
572
|
icon: import_calendar.default,
|
|
545
573
|
justify: "between",
|
|
546
574
|
onClick: dates,
|
|
@@ -580,6 +608,7 @@ const FormTestRail = ({
|
|
|
580
608
|
{
|
|
581
609
|
...{
|
|
582
610
|
"aria-label": "Add variant",
|
|
611
|
+
"data-guide": "test-add",
|
|
583
612
|
disabled: Boolean(disabled || addReason),
|
|
584
613
|
icon: import_plus.default,
|
|
585
614
|
inline: true,
|
|
@@ -608,7 +637,8 @@ const FormTestRail = ({
|
|
|
608
637
|
"div",
|
|
609
638
|
{
|
|
610
639
|
...{
|
|
611
|
-
className: "divide-y divide-gray"
|
|
640
|
+
className: "divide-y divide-gray",
|
|
641
|
+
"data-guide": "test-split"
|
|
612
642
|
},
|
|
613
643
|
children: pages.map((page) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
614
644
|
RowVariant,
|
|
@@ -656,6 +686,7 @@ const FormTestRail = ({
|
|
|
656
686
|
import_button.default,
|
|
657
687
|
{
|
|
658
688
|
...{
|
|
689
|
+
"data-guide": "test-submit",
|
|
659
690
|
loading: formState.isSubmitting,
|
|
660
691
|
type: "submit"
|
|
661
692
|
},
|
|
@@ -17,7 +17,7 @@ import Dropdown from "./dropdown.mjs";
|
|
|
17
17
|
import Calendar from "../icons/calendar.mjs";
|
|
18
18
|
import Ellipsis from "../icons/ellipsis.mjs";
|
|
19
19
|
import Plus from "../icons/plus.mjs";
|
|
20
|
-
import { even, move, span, WEEK } from "./lib/ab-tests.mjs";
|
|
20
|
+
import { even, move, short, span, WEEK } from "./lib/ab-tests.mjs";
|
|
21
21
|
const Shell = ({
|
|
22
22
|
children,
|
|
23
23
|
disabled,
|
|
@@ -74,6 +74,7 @@ const field = ({
|
|
|
74
74
|
control,
|
|
75
75
|
input,
|
|
76
76
|
label,
|
|
77
|
+
message,
|
|
77
78
|
name,
|
|
78
79
|
rules
|
|
79
80
|
}) => /* @__PURE__ */ jsx(
|
|
@@ -91,7 +92,8 @@ const field = ({
|
|
|
91
92
|
onChange,
|
|
92
93
|
value
|
|
93
94
|
}),
|
|
94
|
-
label
|
|
95
|
+
label,
|
|
96
|
+
message
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
),
|
|
@@ -100,7 +102,7 @@ const field = ({
|
|
|
100
102
|
},
|
|
101
103
|
name
|
|
102
104
|
);
|
|
103
|
-
const title = (control) => field({
|
|
105
|
+
const title = (control, message) => field({
|
|
104
106
|
control,
|
|
105
107
|
input: (props) => /* @__PURE__ */ jsx(
|
|
106
108
|
InputText,
|
|
@@ -112,6 +114,7 @@ const title = (control) => field({
|
|
|
112
114
|
}
|
|
113
115
|
),
|
|
114
116
|
label: "Title",
|
|
117
|
+
message,
|
|
115
118
|
name: "title",
|
|
116
119
|
rules: {
|
|
117
120
|
required: "Title is required"
|
|
@@ -156,7 +159,7 @@ const FormTest = ({
|
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
),
|
|
159
|
-
title(control)
|
|
162
|
+
title(control, values.title ? void 0 : 'Name it for what you are testing, such as "Video first"')
|
|
160
163
|
]
|
|
161
164
|
}
|
|
162
165
|
);
|
|
@@ -191,7 +194,7 @@ const FormVariant = ({
|
|
|
191
194
|
}
|
|
192
195
|
}
|
|
193
196
|
),
|
|
194
|
-
title(control),
|
|
197
|
+
title(control, 'Name it for the one thing you will change, such as "No video"'),
|
|
195
198
|
pages.length > 1 && field({
|
|
196
199
|
control,
|
|
197
200
|
input: (props) => /* @__PURE__ */ jsx(
|
|
@@ -406,6 +409,7 @@ const RowVariant = ({
|
|
|
406
409
|
const FormTestRail = ({
|
|
407
410
|
addReason,
|
|
408
411
|
disabled,
|
|
412
|
+
draft,
|
|
409
413
|
notice,
|
|
410
414
|
onAdd,
|
|
411
415
|
onDates,
|
|
@@ -455,6 +459,29 @@ const FormTestRail = ({
|
|
|
455
459
|
});
|
|
456
460
|
}
|
|
457
461
|
);
|
|
462
|
+
const next = notice || (!draft ? null : startsAt && endsAt ? {
|
|
463
|
+
button: {
|
|
464
|
+
disabled,
|
|
465
|
+
element: "button",
|
|
466
|
+
loading: formState.isSubmitting,
|
|
467
|
+
onClick: () => {
|
|
468
|
+
},
|
|
469
|
+
text: "Schedule",
|
|
470
|
+
type: "submit"
|
|
471
|
+
},
|
|
472
|
+
message: "Your test starts on " + short(startsAt),
|
|
473
|
+
title: "Ready to schedule"
|
|
474
|
+
} : {
|
|
475
|
+
button: {
|
|
476
|
+
disabled,
|
|
477
|
+
element: "button",
|
|
478
|
+
onClick: dates,
|
|
479
|
+
text: "Set dates",
|
|
480
|
+
type: "button"
|
|
481
|
+
},
|
|
482
|
+
message: "A test runs from its start date to its end date",
|
|
483
|
+
title: "Set your dates"
|
|
484
|
+
});
|
|
458
485
|
return /* @__PURE__ */ jsx(
|
|
459
486
|
Form,
|
|
460
487
|
{
|
|
@@ -490,10 +517,10 @@ const FormTestRail = ({
|
|
|
490
517
|
}
|
|
491
518
|
}
|
|
492
519
|
) }),
|
|
493
|
-
|
|
520
|
+
next && /* @__PURE__ */ jsx(
|
|
494
521
|
CardTask,
|
|
495
522
|
{
|
|
496
|
-
...
|
|
523
|
+
...next
|
|
497
524
|
}
|
|
498
525
|
),
|
|
499
526
|
title(control),
|
|
@@ -505,6 +532,7 @@ const FormTestRail = ({
|
|
|
505
532
|
Button,
|
|
506
533
|
{
|
|
507
534
|
...{
|
|
535
|
+
"data-guide": "test-dates",
|
|
508
536
|
icon: Calendar,
|
|
509
537
|
justify: "between",
|
|
510
538
|
onClick: dates,
|
|
@@ -544,6 +572,7 @@ const FormTestRail = ({
|
|
|
544
572
|
{
|
|
545
573
|
...{
|
|
546
574
|
"aria-label": "Add variant",
|
|
575
|
+
"data-guide": "test-add",
|
|
547
576
|
disabled: Boolean(disabled || addReason),
|
|
548
577
|
icon: Plus,
|
|
549
578
|
inline: true,
|
|
@@ -572,7 +601,8 @@ const FormTestRail = ({
|
|
|
572
601
|
"div",
|
|
573
602
|
{
|
|
574
603
|
...{
|
|
575
|
-
className: "divide-y divide-gray"
|
|
604
|
+
className: "divide-y divide-gray",
|
|
605
|
+
"data-guide": "test-split"
|
|
576
606
|
},
|
|
577
607
|
children: pages.map((page) => /* @__PURE__ */ jsx(
|
|
578
608
|
RowVariant,
|
|
@@ -620,6 +650,7 @@ const FormTestRail = ({
|
|
|
620
650
|
Button,
|
|
621
651
|
{
|
|
622
652
|
...{
|
|
653
|
+
"data-guide": "test-submit",
|
|
623
654
|
loading: formState.isSubmitting,
|
|
624
655
|
type: "submit"
|
|
625
656
|
},
|
|
@@ -23,6 +23,7 @@ __export(ab_tests_exports, {
|
|
|
23
23
|
lines: () => lines,
|
|
24
24
|
move: () => move,
|
|
25
25
|
scale: () => scale,
|
|
26
|
+
short: () => short,
|
|
26
27
|
signed: () => signed,
|
|
27
28
|
span: () => span,
|
|
28
29
|
variantAction: () => variantAction,
|
|
@@ -119,6 +120,7 @@ const variantPreview = (campaign) => {
|
|
|
119
120
|
lines,
|
|
120
121
|
move,
|
|
121
122
|
scale,
|
|
123
|
+
short,
|
|
122
124
|
signed,
|
|
123
125
|
span,
|
|
124
126
|
variantAction,
|
|
@@ -58,7 +58,10 @@ const railItems = ({
|
|
|
58
58
|
};
|
|
59
59
|
const railCount = (items = []) => required(items).length;
|
|
60
60
|
const railFirst = (items = []) => required(items)[0];
|
|
61
|
-
const railView = ({ guide, panel, support }) =>
|
|
61
|
+
const railView = ({ guide, opened, panel, path, support }) => {
|
|
62
|
+
if (panel === "guide") return guide && opened === path ? "guide" : null;
|
|
63
|
+
return panel === "support" && !support ? "next" : panel || null;
|
|
64
|
+
};
|
|
62
65
|
const railSupport = ({ organization, params = {}, path = "" }) => Boolean(params.organization && (organization == null ? void 0 : organization.support) === true && !path.startsWith("/admin"));
|
|
63
66
|
const railOverlap = (a, b) => a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
|
|
64
67
|
const railOnScreen = (rect, { height, width }) => rect.bottom > 0 && rect.right > 0 && rect.top < height && rect.left < width;
|
|
@@ -30,7 +30,10 @@ const railItems = ({
|
|
|
30
30
|
};
|
|
31
31
|
const railCount = (items = []) => required(items).length;
|
|
32
32
|
const railFirst = (items = []) => required(items)[0];
|
|
33
|
-
const railView = ({ guide, panel, support }) =>
|
|
33
|
+
const railView = ({ guide, opened, panel, path, support }) => {
|
|
34
|
+
if (panel === "guide") return guide && opened === path ? "guide" : null;
|
|
35
|
+
return panel === "support" && !support ? "next" : panel || null;
|
|
36
|
+
};
|
|
34
37
|
const railSupport = ({ organization, params = {}, path = "" }) => Boolean(params.organization && (organization == null ? void 0 : organization.support) === true && !path.startsWith("/admin"));
|
|
35
38
|
const railOverlap = (a, b) => a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom;
|
|
36
39
|
const railOnScreen = (rect, { height, width }) => rect.bottom > 0 && rect.right > 0 && rect.top < height && rect.left < width;
|
|
@@ -58,8 +58,8 @@ const titles = {
|
|
|
58
58
|
};
|
|
59
59
|
const RING_MS = 3e3;
|
|
60
60
|
const RAIL_MS = 200;
|
|
61
|
-
const useRail = () => {
|
|
62
|
-
var _a;
|
|
61
|
+
const useRail = (path) => {
|
|
62
|
+
var _a, _b;
|
|
63
63
|
const queryClient = (0, import_react_query.useQueryClient)();
|
|
64
64
|
const rail = (0, import_react_query.useQuery)({
|
|
65
65
|
queryFn: () => ({
|
|
@@ -68,11 +68,13 @@ const useRail = () => {
|
|
|
68
68
|
queryKey: ["rail"]
|
|
69
69
|
});
|
|
70
70
|
return {
|
|
71
|
-
|
|
71
|
+
opened: (_a = rail.data) == null ? void 0 : _a.path,
|
|
72
|
+
panel: ((_b = rail.data) == null ? void 0 : _b.panel) || null,
|
|
72
73
|
set: (panel) => queryClient.setQueryData(
|
|
73
74
|
["rail"],
|
|
74
75
|
{
|
|
75
|
-
panel
|
|
76
|
+
panel,
|
|
77
|
+
path
|
|
76
78
|
}
|
|
77
79
|
)
|
|
78
80
|
};
|
|
@@ -223,7 +225,7 @@ const ScreenGuide = ({
|
|
|
223
225
|
},
|
|
224
226
|
key
|
|
225
227
|
)),
|
|
226
|
-
step.target !== "body"
|
|
228
|
+
step.target !== "body" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
227
229
|
import_button.default,
|
|
228
230
|
{
|
|
229
231
|
...{
|
|
@@ -234,14 +236,6 @@ const ScreenGuide = ({
|
|
|
234
236
|
},
|
|
235
237
|
children: "Show me"
|
|
236
238
|
}
|
|
237
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
-
"p",
|
|
239
|
-
{
|
|
240
|
-
...{
|
|
241
|
-
className: "text-sm text-gray-dark"
|
|
242
|
-
},
|
|
243
|
-
children: "Applies to the whole screen"
|
|
244
|
-
}
|
|
245
239
|
)
|
|
246
240
|
]
|
|
247
241
|
}
|
|
@@ -390,7 +384,7 @@ const TemplateRail = ({
|
|
|
390
384
|
path = ""
|
|
391
385
|
}) => {
|
|
392
386
|
const queryClient = (0, import_react_query.useQueryClient)();
|
|
393
|
-
const { panel, set } = useRail();
|
|
387
|
+
const { opened, panel, set } = useRail(path);
|
|
394
388
|
const items = (0, import_rail.railItems)({
|
|
395
389
|
account,
|
|
396
390
|
campaign,
|
|
@@ -406,7 +400,9 @@ const TemplateRail = ({
|
|
|
406
400
|
});
|
|
407
401
|
const view = (0, import_rail.railView)({
|
|
408
402
|
guide,
|
|
403
|
+
opened,
|
|
409
404
|
panel,
|
|
405
|
+
path,
|
|
410
406
|
support
|
|
411
407
|
});
|
|
412
408
|
const [previous, setPrevious] = (0, import_react.useState)(view);
|
|
@@ -427,7 +423,8 @@ const TemplateRail = ({
|
|
|
427
423
|
const toggle = (next) => set(view === next ? null : next);
|
|
428
424
|
const close = () => set(null);
|
|
429
425
|
const aside = (0, import_react.useRef)(null);
|
|
430
|
-
const
|
|
426
|
+
const nav = (0, import_react.useRef)(null);
|
|
427
|
+
const wasOpen = (0, import_react.useRef)(Boolean(view));
|
|
431
428
|
const arrived = (0, import_react.useRef)(Boolean(view));
|
|
432
429
|
if (!view) arrived.current = false;
|
|
433
430
|
const opener = (0, import_react.useRef)(null);
|
|
@@ -487,8 +484,8 @@ const TemplateRail = ({
|
|
|
487
484
|
() => {
|
|
488
485
|
var _a, _b;
|
|
489
486
|
const open = Boolean(view);
|
|
490
|
-
if (open ===
|
|
491
|
-
|
|
487
|
+
if (open === wasOpen.current) return;
|
|
488
|
+
wasOpen.current = open;
|
|
492
489
|
if (open) {
|
|
493
490
|
opener.current = document.activeElement;
|
|
494
491
|
(_a = aside.current) == null ? void 0 : _a.focus();
|
|
@@ -499,6 +496,25 @@ const TemplateRail = ({
|
|
|
499
496
|
},
|
|
500
497
|
[view]
|
|
501
498
|
);
|
|
499
|
+
(0, import_react.useEffect)(
|
|
500
|
+
() => {
|
|
501
|
+
if (view !== "guide") return void 0;
|
|
502
|
+
const onPointerDown = ({ target }) => {
|
|
503
|
+
var _a, _b;
|
|
504
|
+
if (((_a = aside.current) == null ? void 0 : _a.contains(target)) || ((_b = nav.current) == null ? void 0 : _b.contains(target))) return;
|
|
505
|
+
opener.current = null;
|
|
506
|
+
queryClient.setQueryData(
|
|
507
|
+
["rail"],
|
|
508
|
+
{
|
|
509
|
+
panel: null
|
|
510
|
+
}
|
|
511
|
+
);
|
|
512
|
+
};
|
|
513
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
514
|
+
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
515
|
+
},
|
|
516
|
+
[queryClient, view]
|
|
517
|
+
);
|
|
502
518
|
const phone = () => window.matchMedia("(max-width: 767px)").matches;
|
|
503
519
|
(0, import_focus.useTrap)(
|
|
504
520
|
Boolean(view),
|
|
@@ -649,6 +665,7 @@ const TemplateRail = ({
|
|
|
649
665
|
{
|
|
650
666
|
...{
|
|
651
667
|
"aria-label": "Rail",
|
|
668
|
+
ref: nav,
|
|
652
669
|
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"
|
|
653
670
|
},
|
|
654
671
|
children: [
|
|
@@ -709,7 +726,7 @@ const useRailRows = ({
|
|
|
709
726
|
params = {},
|
|
710
727
|
path = ""
|
|
711
728
|
}) => {
|
|
712
|
-
const { set } = useRail();
|
|
729
|
+
const { set } = useRail(path);
|
|
713
730
|
const page = useRailPage({ campaign, params, path });
|
|
714
731
|
const count = (0, import_rail.railCount)((0, import_rail.railItems)({ account, campaign, organization, page, params, path }));
|
|
715
732
|
return [
|
|
@@ -23,8 +23,8 @@ const titles = {
|
|
|
23
23
|
};
|
|
24
24
|
const RING_MS = 3e3;
|
|
25
25
|
const RAIL_MS = 200;
|
|
26
|
-
const useRail = () => {
|
|
27
|
-
var _a;
|
|
26
|
+
const useRail = (path) => {
|
|
27
|
+
var _a, _b;
|
|
28
28
|
const queryClient = useQueryClient();
|
|
29
29
|
const rail = useQuery({
|
|
30
30
|
queryFn: () => ({
|
|
@@ -33,11 +33,13 @@ const useRail = () => {
|
|
|
33
33
|
queryKey: ["rail"]
|
|
34
34
|
});
|
|
35
35
|
return {
|
|
36
|
-
|
|
36
|
+
opened: (_a = rail.data) == null ? void 0 : _a.path,
|
|
37
|
+
panel: ((_b = rail.data) == null ? void 0 : _b.panel) || null,
|
|
37
38
|
set: (panel) => queryClient.setQueryData(
|
|
38
39
|
["rail"],
|
|
39
40
|
{
|
|
40
|
-
panel
|
|
41
|
+
panel,
|
|
42
|
+
path
|
|
41
43
|
}
|
|
42
44
|
)
|
|
43
45
|
};
|
|
@@ -188,7 +190,7 @@ const ScreenGuide = ({
|
|
|
188
190
|
},
|
|
189
191
|
key
|
|
190
192
|
)),
|
|
191
|
-
step.target !== "body"
|
|
193
|
+
step.target !== "body" && /* @__PURE__ */ jsx(
|
|
192
194
|
Button,
|
|
193
195
|
{
|
|
194
196
|
...{
|
|
@@ -199,14 +201,6 @@ const ScreenGuide = ({
|
|
|
199
201
|
},
|
|
200
202
|
children: "Show me"
|
|
201
203
|
}
|
|
202
|
-
) : /* @__PURE__ */ jsx(
|
|
203
|
-
"p",
|
|
204
|
-
{
|
|
205
|
-
...{
|
|
206
|
-
className: "text-sm text-gray-dark"
|
|
207
|
-
},
|
|
208
|
-
children: "Applies to the whole screen"
|
|
209
|
-
}
|
|
210
204
|
)
|
|
211
205
|
]
|
|
212
206
|
}
|
|
@@ -355,7 +349,7 @@ const TemplateRail = ({
|
|
|
355
349
|
path = ""
|
|
356
350
|
}) => {
|
|
357
351
|
const queryClient = useQueryClient();
|
|
358
|
-
const { panel, set } = useRail();
|
|
352
|
+
const { opened, panel, set } = useRail(path);
|
|
359
353
|
const items = railItems({
|
|
360
354
|
account,
|
|
361
355
|
campaign,
|
|
@@ -371,7 +365,9 @@ const TemplateRail = ({
|
|
|
371
365
|
});
|
|
372
366
|
const view = railView({
|
|
373
367
|
guide,
|
|
368
|
+
opened,
|
|
374
369
|
panel,
|
|
370
|
+
path,
|
|
375
371
|
support
|
|
376
372
|
});
|
|
377
373
|
const [previous, setPrevious] = useState(view);
|
|
@@ -392,7 +388,8 @@ const TemplateRail = ({
|
|
|
392
388
|
const toggle = (next) => set(view === next ? null : next);
|
|
393
389
|
const close = () => set(null);
|
|
394
390
|
const aside = useRef(null);
|
|
395
|
-
const
|
|
391
|
+
const nav = useRef(null);
|
|
392
|
+
const wasOpen = useRef(Boolean(view));
|
|
396
393
|
const arrived = useRef(Boolean(view));
|
|
397
394
|
if (!view) arrived.current = false;
|
|
398
395
|
const opener = useRef(null);
|
|
@@ -452,8 +449,8 @@ const TemplateRail = ({
|
|
|
452
449
|
() => {
|
|
453
450
|
var _a, _b;
|
|
454
451
|
const open = Boolean(view);
|
|
455
|
-
if (open ===
|
|
456
|
-
|
|
452
|
+
if (open === wasOpen.current) return;
|
|
453
|
+
wasOpen.current = open;
|
|
457
454
|
if (open) {
|
|
458
455
|
opener.current = document.activeElement;
|
|
459
456
|
(_a = aside.current) == null ? void 0 : _a.focus();
|
|
@@ -464,6 +461,25 @@ const TemplateRail = ({
|
|
|
464
461
|
},
|
|
465
462
|
[view]
|
|
466
463
|
);
|
|
464
|
+
useEffect(
|
|
465
|
+
() => {
|
|
466
|
+
if (view !== "guide") return void 0;
|
|
467
|
+
const onPointerDown = ({ target }) => {
|
|
468
|
+
var _a, _b;
|
|
469
|
+
if (((_a = aside.current) == null ? void 0 : _a.contains(target)) || ((_b = nav.current) == null ? void 0 : _b.contains(target))) return;
|
|
470
|
+
opener.current = null;
|
|
471
|
+
queryClient.setQueryData(
|
|
472
|
+
["rail"],
|
|
473
|
+
{
|
|
474
|
+
panel: null
|
|
475
|
+
}
|
|
476
|
+
);
|
|
477
|
+
};
|
|
478
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
479
|
+
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
480
|
+
},
|
|
481
|
+
[queryClient, view]
|
|
482
|
+
);
|
|
467
483
|
const phone = () => window.matchMedia("(max-width: 767px)").matches;
|
|
468
484
|
useTrap(
|
|
469
485
|
Boolean(view),
|
|
@@ -614,6 +630,7 @@ const TemplateRail = ({
|
|
|
614
630
|
{
|
|
615
631
|
...{
|
|
616
632
|
"aria-label": "Rail",
|
|
633
|
+
ref: nav,
|
|
617
634
|
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"
|
|
618
635
|
},
|
|
619
636
|
children: [
|
|
@@ -674,7 +691,7 @@ const useRailRows = ({
|
|
|
674
691
|
params = {},
|
|
675
692
|
path = ""
|
|
676
693
|
}) => {
|
|
677
|
-
const { set } = useRail();
|
|
694
|
+
const { set } = useRail(path);
|
|
678
695
|
const page = useRailPage({ campaign, params, path });
|
|
679
696
|
const count = railCount(railItems({ account, campaign, organization, page, params, path }));
|
|
680
697
|
return [
|
|
@@ -403,6 +403,9 @@ const TemplateTest = ({
|
|
|
403
403
|
...{
|
|
404
404
|
addReason: running ? "Pause the test to add a variant" : pages.length - 1 >= CAP ? "A test holds five variants" : null,
|
|
405
405
|
disabled,
|
|
406
|
+
// @story ab-tests/schedule
|
|
407
|
+
// A draft with two pages: the form leads it to its dates, then to Schedule.
|
|
408
|
+
draft: status === "drafted" && enabled.length > 1,
|
|
406
409
|
notice,
|
|
407
410
|
onAdd,
|
|
408
411
|
onDates,
|
|
@@ -371,6 +371,9 @@ const TemplateTest = ({
|
|
|
371
371
|
...{
|
|
372
372
|
addReason: running ? "Pause the test to add a variant" : pages.length - 1 >= CAP ? "A test holds five variants" : null,
|
|
373
373
|
disabled,
|
|
374
|
+
// @story ab-tests/schedule
|
|
375
|
+
// A draft with two pages: the form leads it to its dates, then to Schedule.
|
|
376
|
+
draft: status === "drafted" && enabled.length > 1,
|
|
374
377
|
notice,
|
|
375
378
|
onAdd,
|
|
376
379
|
onDates,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawbridge/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./advertisement": {
|
|
6
6
|
"types": "./types/advertisement.d.ts",
|
|
@@ -1954,7 +1954,7 @@
|
|
|
1954
1954
|
"@analytics/google-tag-manager": "0.5.5",
|
|
1955
1955
|
"@drawbridge/drawbridge-agents": "0.1.104",
|
|
1956
1956
|
"@drawbridge/drawbridge-telemetry": "0.0.19",
|
|
1957
|
-
"@drawbridge/drawbridge-utils": "0.0.
|
|
1957
|
+
"@drawbridge/drawbridge-utils": "0.0.238",
|
|
1958
1958
|
"@headlessui/react": "2.2.9",
|
|
1959
1959
|
"@hookform/resolvers": "3.1.1",
|
|
1960
1960
|
"@sentry/nextjs": "10.58.0",
|
|
@@ -56,6 +56,8 @@ export interface FormTestRailProps {
|
|
|
56
56
|
// Why the + is disabled, said when it is pointed at.
|
|
57
57
|
addReason?: string | null;
|
|
58
58
|
disabled?: boolean;
|
|
59
|
+
// A drafted test with two pages: with no notice, the form shows "Set your dates", then "Ready to schedule".
|
|
60
|
+
draft?: boolean;
|
|
59
61
|
// The one card at the top: what the test needs next.
|
|
60
62
|
notice?: CardTaskProps | null;
|
|
61
63
|
onAdd?: () => void;
|
|
@@ -13,6 +13,9 @@ export declare const even: ( ids: string[] ) => Shares;
|
|
|
13
13
|
export declare const move: ( shares: Shares, ids: string[], id: string, value: number ) => Shares;
|
|
14
14
|
|
|
15
15
|
// "Nov 9 – Nov 23", or null without both dates.
|
|
16
|
+
// "Nov 9".
|
|
17
|
+
export declare const short: ( value: string | Date ) => string;
|
|
18
|
+
|
|
16
19
|
export declare const span: ( dates?: { endsAt?: string | Date | null; startsAt?: string | Date | null } ) => string | null;
|
|
17
20
|
|
|
18
21
|
// Whole days until `endsAt`, at least 0.
|