@drawbridge/components 0.1.37 → 0.1.39
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/components/styles.css +68 -355
- package/dist/advertisement.js +15 -20
- package/dist/advertisement.mjs +15 -20
- package/dist/bridge/advertisements.js +4 -2
- package/dist/bridge/advertisements.mjs +5 -3
- package/dist/bridge/fields.js +89 -6
- package/dist/bridge/fields.mjs +89 -7
- package/dist/bridge/form-subdomain-agreement.js +165 -0
- package/dist/bridge/form-subdomain-agreement.mjs +132 -0
- package/dist/bridge/form-subdomain-embed.js +5 -1
- package/dist/bridge/form-subdomain-embed.mjs +5 -1
- package/dist/bridge/form-subdomain-header.js +21 -14
- package/dist/bridge/form-subdomain-header.mjs +20 -14
- package/dist/bridge/form-subdomain-issue.js +17 -8
- package/dist/bridge/form-subdomain-issue.mjs +17 -8
- package/dist/bridge/form-subdomain-missions.js +58 -52
- package/dist/bridge/form-subdomain-missions.mjs +60 -54
- package/dist/bridge/form-subdomain.js +226 -95
- package/dist/bridge/form-subdomain.mjs +225 -97
- package/dist/bridge/lib/entry.js +71 -6
- package/dist/bridge/lib/entry.mjs +60 -5
- package/dist/bridge/lib/order.js +23 -0
- package/dist/bridge/lib/order.mjs +20 -0
- package/dist/bridge/template-layout.js +5 -2
- package/dist/bridge/template-layout.mjs +6 -3
- package/dist/bridge/template-modal.js +82 -15
- package/dist/bridge/template-modal.mjs +83 -16
- package/dist/bridge/template-subdomain-gallery.js +126 -75
- package/dist/bridge/template-subdomain-gallery.mjs +122 -75
- package/dist/bridge/template-subdomain.js +16 -14
- package/dist/bridge/template-subdomain.mjs +17 -15
- package/dist/dashboard/avatar.js +5 -0
- package/dist/dashboard/avatar.mjs +5 -0
- package/dist/dashboard/campaign-form.js +1815 -0
- package/dist/dashboard/campaign-form.mjs +1786 -0
- package/dist/dashboard/card-affiliate.js +3 -2
- package/dist/dashboard/card-affiliate.mjs +3 -2
- package/dist/dashboard/card-campaign-agreement.js +172 -0
- package/dist/dashboard/card-campaign-agreement.mjs +139 -0
- package/dist/dashboard/card-campaign-switch.js +25 -10
- package/dist/dashboard/card-campaign-switch.mjs +24 -10
- package/dist/dashboard/card-order.js +6 -14
- package/dist/dashboard/card-order.mjs +6 -14
- package/dist/dashboard/card-section.js +69 -26
- package/dist/dashboard/card-section.mjs +65 -26
- package/dist/dashboard/card-shortcut.js +183 -0
- package/dist/dashboard/card-shortcut.mjs +154 -0
- package/dist/dashboard/card-tile.js +3 -35
- package/dist/dashboard/card-tile.mjs +3 -34
- package/dist/dashboard/document-blocks.js +305 -0
- package/dist/dashboard/document-blocks.mjs +270 -0
- package/dist/dashboard/drawer-subscription.js +52 -14
- package/dist/dashboard/drawer-subscription.mjs +52 -14
- package/dist/dashboard/drawer.js +20 -3
- package/dist/dashboard/drawer.mjs +21 -4
- package/dist/dashboard/dropdown.js +6 -2
- package/dist/dashboard/dropdown.mjs +6 -2
- package/dist/dashboard/form-admin-subscription-custom.js +72 -8
- package/dist/dashboard/form-admin-subscription-custom.mjs +72 -8
- package/dist/dashboard/form-ai.js +0 -148
- package/dist/dashboard/form-ai.mjs +1 -148
- package/dist/dashboard/form-filters-analytics.js +86 -38
- package/dist/dashboard/form-filters-analytics.mjs +85 -38
- package/dist/dashboard/form-organization-brand.js +30 -13
- package/dist/dashboard/form-organization-brand.mjs +30 -13
- package/dist/dashboard/form-organization-campaign-advertisement.js +38 -112
- package/dist/dashboard/form-organization-campaign-advertisement.mjs +38 -112
- package/dist/dashboard/form-organization-campaign-advertisements.js +374 -0
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +345 -0
- package/dist/dashboard/form-organization-campaign-agreement.js +402 -210
- package/dist/dashboard/form-organization-campaign-agreement.mjs +398 -211
- package/dist/dashboard/form-organization-campaign-design.js +258 -0
- package/dist/dashboard/form-organization-campaign-design.mjs +223 -0
- package/dist/dashboard/form-organization-campaign-field-item.js +585 -0
- package/dist/dashboard/form-organization-campaign-field-item.mjs +552 -0
- package/dist/dashboard/form-organization-campaign-field-number.js +48 -7
- package/dist/dashboard/form-organization-campaign-field-number.mjs +48 -7
- package/dist/dashboard/form-organization-campaign-field-select.js +15 -4
- package/dist/dashboard/form-organization-campaign-field-select.mjs +15 -4
- package/dist/dashboard/form-organization-campaign-field-skill.js +359 -0
- package/dist/dashboard/form-organization-campaign-field-skill.mjs +330 -0
- package/dist/dashboard/form-organization-campaign-field-text.js +46 -6
- package/dist/dashboard/form-organization-campaign-field-text.mjs +46 -6
- package/dist/dashboard/form-organization-campaign-field-textarea.js +22 -13
- package/dist/dashboard/form-organization-campaign-field-textarea.mjs +22 -13
- package/dist/dashboard/form-organization-campaign-footer.js +178 -0
- package/dist/dashboard/form-organization-campaign-footer.mjs +149 -0
- package/dist/dashboard/form-organization-campaign-integration-age.js +2 -35
- package/dist/dashboard/form-organization-campaign-integration-age.mjs +2 -35
- package/dist/dashboard/form-organization-campaign-integration-geocode.js +4 -1
- package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
- package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
- package/dist/dashboard/form-organization-campaign-page-preview.js +1 -2
- package/dist/dashboard/form-organization-campaign-page-preview.mjs +1 -2
- package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
- package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
- package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
- package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
- package/dist/dashboard/form-organization-campaign-page-slug.js +2 -3
- package/dist/dashboard/form-organization-campaign-page-slug.mjs +2 -3
- package/dist/dashboard/form-organization-campaign-page.js +168 -265
- package/dist/dashboard/form-organization-campaign-page.mjs +170 -266
- package/dist/dashboard/form-organization-campaign-section.js +125 -107
- package/dist/dashboard/form-organization-campaign-section.mjs +121 -107
- package/dist/dashboard/form-organization-campaign.js +119 -9
- package/dist/dashboard/form-organization-campaign.mjs +118 -9
- package/dist/dashboard/form-organization-file-frame.js +7 -1
- package/dist/dashboard/form-organization-file-frame.mjs +7 -1
- package/dist/dashboard/form-organization-workflow.js +587 -530
- package/dist/dashboard/form-organization-workflow.mjs +588 -531
- package/dist/dashboard/form-organization.js +22 -0
- package/dist/dashboard/form-organization.mjs +22 -0
- package/dist/dashboard/form-reposition.js +396 -0
- package/dist/dashboard/form-reposition.mjs +359 -0
- package/dist/dashboard/form-support.js +189 -0
- package/dist/dashboard/form-support.mjs +160 -0
- package/dist/dashboard/form-tests.js +683 -0
- package/dist/dashboard/form-tests.mjs +646 -0
- package/dist/dashboard/form-verify-prize.js +114 -34
- package/dist/dashboard/form-verify-prize.mjs +111 -34
- package/dist/dashboard/google.js +8 -1
- package/dist/dashboard/google.mjs +8 -1
- package/dist/dashboard/input-array.js +2 -0
- package/dist/dashboard/input-array.mjs +2 -0
- package/dist/dashboard/input-editor.js +17 -6
- package/dist/dashboard/input-editor.mjs +17 -6
- package/dist/dashboard/input-fields.js +287 -437
- package/dist/dashboard/input-fields.mjs +287 -436
- package/dist/dashboard/input-file.js +70 -2
- package/dist/dashboard/input-file.mjs +70 -2
- package/dist/dashboard/input-font.js +64 -55
- package/dist/dashboard/input-font.mjs +64 -55
- package/dist/dashboard/input-resource.js +4 -1
- package/dist/dashboard/input-resource.mjs +4 -1
- package/dist/dashboard/lib/ab-tests.js +130 -0
- package/dist/dashboard/lib/ab-tests.mjs +94 -0
- package/dist/dashboard/lib/features.js +1 -1
- package/dist/dashboard/lib/features.mjs +1 -1
- package/dist/dashboard/lib/focus.js +93 -0
- package/dist/dashboard/lib/focus.mjs +69 -0
- package/dist/dashboard/lib/form-page.js +209 -0
- package/dist/dashboard/lib/form-page.mjs +161 -0
- package/dist/dashboard/lib/item-list.js +0 -15
- package/dist/dashboard/lib/item-list.mjs +0 -14
- package/dist/dashboard/lib/rail.js +16 -17
- package/dist/dashboard/lib/rail.mjs +15 -16
- package/dist/dashboard/lib/sms.js +8 -2
- package/dist/dashboard/lib/sms.mjs +6 -1
- package/dist/dashboard/list-resource.js +2 -0
- package/dist/dashboard/list-resource.mjs +2 -0
- package/dist/dashboard/menu.js +54 -5
- package/dist/dashboard/menu.mjs +53 -5
- package/dist/dashboard/modal.js +19 -4
- package/dist/dashboard/modal.mjs +20 -5
- package/dist/dashboard/order-sections.js +4 -0
- package/dist/dashboard/order-sections.mjs +4 -0
- package/dist/dashboard/preview.js +838 -324
- package/dist/dashboard/preview.mjs +826 -324
- package/dist/dashboard/provider-ui.js +20 -12
- package/dist/dashboard/provider-ui.mjs +21 -13
- package/dist/dashboard/recharts.js +53 -28
- package/dist/dashboard/recharts.mjs +53 -28
- package/dist/dashboard/swatch.js +35 -0
- package/dist/dashboard/swatch.mjs +31 -0
- package/dist/dashboard/table-contacts.js +6 -10
- package/dist/dashboard/table-contacts.mjs +6 -10
- package/dist/dashboard/table.js +10 -3
- package/dist/dashboard/table.mjs +9 -3
- package/dist/dashboard/template-dashboard.js +12 -7
- package/dist/dashboard/template-dashboard.mjs +11 -7
- package/dist/dashboard/template-design.js +564 -0
- package/dist/dashboard/template-design.mjs +531 -0
- package/dist/dashboard/template-rail.js +192 -126
- package/dist/dashboard/template-rail.mjs +190 -125
- package/dist/dashboard/template-socket.js +0 -3
- package/dist/dashboard/template-socket.mjs +0 -3
- package/dist/dashboard/template-test-page.js +436 -0
- package/dist/dashboard/template-test-page.mjs +407 -0
- package/dist/dashboard/template-tests.js +141 -0
- package/dist/dashboard/template-tests.mjs +112 -0
- package/dist/dashboard/template-ui.js +20 -11
- package/dist/dashboard/template-ui.mjs +22 -13
- package/dist/dashboard/template-variant.js +185 -0
- package/dist/dashboard/template-variant.mjs +156 -0
- package/dist/icons/arrow-down-long.js +47 -0
- package/dist/icons/arrow-down-long.mjs +28 -0
- package/dist/icons/arrows-pointing-out.js +46 -0
- package/dist/icons/arrows-pointing-out.mjs +27 -0
- package/dist/icons/beaker.js +46 -0
- package/dist/icons/beaker.mjs +27 -0
- package/dist/icons/identification.js +46 -0
- package/dist/icons/identification.mjs +27 -0
- package/dist/icons/lifebuoy.js +46 -0
- package/dist/icons/lifebuoy.mjs +27 -0
- package/dist/icons/rectangle-group.js +46 -0
- package/dist/icons/rectangle-group.mjs +27 -0
- package/dist/icons/rectangle-stack.js +46 -0
- package/dist/icons/rectangle-stack.mjs +27 -0
- package/dist/icons/shopping-bag.js +46 -0
- package/dist/icons/shopping-bag.mjs +27 -0
- package/dist/icons/swatch.js +46 -0
- package/dist/icons/swatch.mjs +27 -0
- package/dist/icons/window.js +46 -0
- package/dist/icons/window.mjs +27 -0
- package/dist/icons/zoom-in.js +46 -0
- package/dist/icons/zoom-in.mjs +27 -0
- package/dist/input-answer.js +60 -0
- package/dist/input-answer.mjs +27 -0
- package/dist/input-checkbox.js +7 -1
- package/dist/input-checkbox.mjs +7 -1
- package/dist/input-name.js +3 -3
- package/dist/input-name.mjs +3 -3
- package/dist/input-select.js +3 -1
- package/dist/input-select.mjs +3 -1
- package/dist/provider-font.js +4 -3
- package/dist/provider-font.mjs +4 -3
- package/dist/shared/badge.js +15 -0
- package/dist/shared/badge.mjs +11 -0
- package/dist/shared/carousel.js +11 -7
- package/dist/shared/carousel.mjs +11 -7
- package/dist/shared/document-pieces.js +295 -0
- package/dist/shared/document-pieces.mjs +260 -0
- package/dist/shared/lib/campaign.js +18 -9
- package/dist/shared/lib/campaign.mjs +17 -9
- package/dist/shared/lib/helpers.js +24 -0
- package/dist/shared/lib/helpers.mjs +22 -0
- package/dist/shared/lib/video.js +6 -0
- package/dist/shared/lib/video.mjs +5 -0
- package/dist/shared/sortable.js +27 -10
- package/dist/shared/sortable.mjs +27 -10
- package/dist/shared/tabs.js +1 -1
- package/dist/shared/tabs.mjs +1 -1
- package/dist/video.js +127 -9
- package/dist/video.mjs +125 -11
- package/package.json +176 -20
- package/types/bridge/fields.d.ts +6 -1
- package/types/bridge/form-subdomain-agreement.d.ts +27 -0
- package/types/bridge/form-subdomain-missions.d.ts +2 -0
- package/types/bridge/form-subdomain.d.ts +62 -3
- package/types/bridge/lib/entry.d.ts +46 -7
- package/types/bridge/lib/order.d.ts +13 -2
- package/types/bridge/subdomain-content.d.ts +1 -0
- package/types/bridge/template-subdomain-gallery.d.ts +13 -1
- package/types/dashboard/campaign-form.d.ts +42 -0
- package/types/dashboard/card-campaign-agreement.d.ts +26 -0
- package/types/dashboard/card-campaign-switch.d.ts +13 -1
- package/types/dashboard/card-order.d.ts +2 -2
- package/types/dashboard/card-section.d.ts +9 -1
- package/types/dashboard/card-shortcut.d.ts +40 -0
- package/types/dashboard/card-tile.d.ts +4 -9
- package/types/dashboard/document-blocks.d.ts +14 -0
- package/types/dashboard/drawer.d.ts +3 -0
- package/types/dashboard/form-ai.d.ts +0 -17
- package/types/dashboard/form-organization-brand.d.ts +3 -0
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +15 -0
- package/types/dashboard/form-organization-campaign-agreement.d.ts +53 -10
- package/types/dashboard/form-organization-campaign-design.d.ts +46 -0
- package/types/dashboard/form-organization-campaign-field-item.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-number.d.ts +4 -1
- package/types/dashboard/form-organization-campaign-field-select.d.ts +6 -1
- package/types/dashboard/form-organization-campaign-field-skill.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-text.d.ts +5 -1
- package/types/dashboard/form-organization-campaign-field-textarea.d.ts +4 -1
- package/types/dashboard/form-organization-campaign-footer.d.ts +23 -0
- package/types/dashboard/form-organization-campaign-integration-age.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +2 -0
- package/types/dashboard/form-organization-campaign-page.d.ts +9 -15
- package/types/dashboard/form-organization-campaign-section.d.ts +24 -8
- package/types/dashboard/form-organization-campaign.d.ts +3 -0
- package/types/dashboard/form-organization-workflow.d.ts +3 -0
- package/types/dashboard/form-organization.d.ts +2 -2
- package/types/dashboard/form-reposition.d.ts +29 -0
- package/types/dashboard/form-support.d.ts +14 -0
- package/types/dashboard/form-tests.d.ts +78 -0
- package/types/dashboard/form-verify-prize.d.ts +30 -3
- package/types/dashboard/input-editor.d.ts +9 -0
- package/types/dashboard/input-fields.d.ts +8 -5
- package/types/dashboard/input-file.d.ts +4 -0
- package/types/dashboard/input-resource.d.ts +1 -0
- package/types/dashboard/lib/ab-tests.d.ts +50 -0
- package/types/dashboard/lib/escape.d.ts +4 -0
- package/types/dashboard/lib/focus.d.ts +16 -0
- package/types/dashboard/lib/form-page.d.ts +25 -0
- package/types/dashboard/lib/item-list.d.ts +10 -5
- package/types/dashboard/lib/rail.d.ts +0 -1
- package/types/dashboard/lib/sms.d.ts +7 -0
- package/types/dashboard/modal.d.ts +3 -1
- package/types/dashboard/preview.d.ts +65 -10
- package/types/dashboard/recharts.d.ts +3 -0
- package/types/dashboard/swatch.d.ts +4 -0
- package/types/dashboard/template-dashboard.d.ts +3 -0
- package/types/dashboard/template-design.d.ts +30 -0
- package/types/dashboard/template-test-page.d.ts +69 -0
- package/types/dashboard/template-tests.d.ts +30 -0
- package/types/dashboard/template-variant.d.ts +18 -0
- package/types/icons/arrow-down-long.d.ts +5 -0
- package/types/icons/arrows-pointing-out.d.ts +5 -0
- package/types/icons/beaker.d.ts +5 -0
- package/types/icons/identification.d.ts +5 -0
- package/types/icons/lifebuoy.d.ts +5 -0
- package/types/icons/rectangle-group.d.ts +5 -0
- package/types/icons/rectangle-stack.d.ts +5 -0
- package/types/icons/shopping-bag.d.ts +5 -0
- package/types/icons/swatch.d.ts +5 -0
- package/types/icons/window.d.ts +5 -0
- package/types/icons/zoom-in.d.ts +5 -0
- package/types/input-answer.d.ts +15 -0
- package/types/input-select.d.ts +2 -0
- package/types/shared/button.d.ts +1 -1
- package/types/shared/document-pieces.d.ts +34 -0
- package/types/shared/lib/campaign.d.ts +11 -0
- package/types/shared/lib/helpers.d.ts +22 -1
- package/types/shared/lib/motion.d.ts +2 -0
- package/types/shared/lib/video.d.ts +3 -0
- package/types/shared/sortable.d.ts +6 -0
- package/types/video.d.ts +18 -2
- package/dist/bridge/template-preview.js +0 -208
- package/dist/bridge/template-preview.mjs +0 -173
- package/dist/dashboard/device.js +0 -95
- package/dist/dashboard/device.mjs +0 -72
- package/dist/dashboard/form-organization-campaign-field-list.js +0 -425
- package/dist/dashboard/form-organization-campaign-field-list.mjs +0 -396
- package/dist/dashboard/item-row.js +0 -92
- package/dist/dashboard/item-row.mjs +0 -63
- package/types/bridge/template-preview.d.ts +0 -10
- package/types/dashboard/device.d.ts +0 -12
- package/types/dashboard/form-organization-campaign-field-list.d.ts +0 -36
- package/types/dashboard/item-row.d.ts +0 -25
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { useForm, Controller } from "../shared/lib/form.mjs";
|
|
4
|
+
import Form from "../shared/form.mjs";
|
|
5
|
+
import Fieldset from "../shared/fieldset.mjs";
|
|
6
|
+
import Button from "../shared/button.mjs";
|
|
7
|
+
import { Disabled } from "../shared/badge.mjs";
|
|
8
|
+
import InputGroup from "../input-group.mjs";
|
|
9
|
+
import InputText from "../input-text.mjs";
|
|
10
|
+
import InputSelect from "../input-select.mjs";
|
|
11
|
+
import InputRange from "../shared/input-range.mjs";
|
|
12
|
+
import Tooltip from "../shared/tooltip.mjs";
|
|
13
|
+
import InputDate from "./input-date.mjs";
|
|
14
|
+
import CardTask from "./card-task.mjs";
|
|
15
|
+
import CardSection from "./card-section.mjs";
|
|
16
|
+
import Dropdown from "./dropdown.mjs";
|
|
17
|
+
import Calendar from "../icons/calendar.mjs";
|
|
18
|
+
import Ellipsis from "../icons/ellipsis.mjs";
|
|
19
|
+
import Plus from "../icons/plus.mjs";
|
|
20
|
+
import { even, move, span, WEEK } from "./lib/ab-tests.mjs";
|
|
21
|
+
const Shell = ({
|
|
22
|
+
children,
|
|
23
|
+
disabled,
|
|
24
|
+
loading,
|
|
25
|
+
onSubmit,
|
|
26
|
+
submit = "Submit"
|
|
27
|
+
}) => /* @__PURE__ */ jsxs(
|
|
28
|
+
Form,
|
|
29
|
+
{
|
|
30
|
+
...{
|
|
31
|
+
className: "relative w-full space-y-6",
|
|
32
|
+
onSubmit
|
|
33
|
+
},
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
Fieldset,
|
|
37
|
+
{
|
|
38
|
+
...{
|
|
39
|
+
disabled: disabled || loading
|
|
40
|
+
},
|
|
41
|
+
children: /* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
...{
|
|
45
|
+
className: "space-y-6"
|
|
46
|
+
},
|
|
47
|
+
children
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
Fieldset,
|
|
54
|
+
{
|
|
55
|
+
...{
|
|
56
|
+
disabled: disabled || loading
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ jsx(
|
|
59
|
+
Button,
|
|
60
|
+
{
|
|
61
|
+
...{
|
|
62
|
+
loading,
|
|
63
|
+
type: "submit"
|
|
64
|
+
},
|
|
65
|
+
children: submit
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
const field = ({
|
|
74
|
+
control,
|
|
75
|
+
input,
|
|
76
|
+
label,
|
|
77
|
+
name,
|
|
78
|
+
rules
|
|
79
|
+
}) => /* @__PURE__ */ jsx(
|
|
80
|
+
Controller,
|
|
81
|
+
{
|
|
82
|
+
...{
|
|
83
|
+
control,
|
|
84
|
+
name,
|
|
85
|
+
render: ({ field: { onChange, value }, fieldState: { error } }) => /* @__PURE__ */ jsx(
|
|
86
|
+
InputGroup,
|
|
87
|
+
{
|
|
88
|
+
...{
|
|
89
|
+
error: error == null ? void 0 : error.message,
|
|
90
|
+
input: input({
|
|
91
|
+
onChange,
|
|
92
|
+
value
|
|
93
|
+
}),
|
|
94
|
+
label
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
rules
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
name
|
|
102
|
+
);
|
|
103
|
+
const title = (control) => field({
|
|
104
|
+
control,
|
|
105
|
+
input: (props) => /* @__PURE__ */ jsx(
|
|
106
|
+
InputText,
|
|
107
|
+
{
|
|
108
|
+
...{
|
|
109
|
+
...props,
|
|
110
|
+
value: props.value || ""
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
label: "Title",
|
|
115
|
+
name: "title",
|
|
116
|
+
rules: {
|
|
117
|
+
required: "Title is required"
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
const submitting = (onSuccess, setError) => async (values) => {
|
|
121
|
+
try {
|
|
122
|
+
await onSuccess(values);
|
|
123
|
+
} catch ({ message }) {
|
|
124
|
+
setError("root", {
|
|
125
|
+
message,
|
|
126
|
+
type: "custom"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const FormTest = ({
|
|
131
|
+
disabled,
|
|
132
|
+
onSuccess,
|
|
133
|
+
submit,
|
|
134
|
+
values = {}
|
|
135
|
+
}) => {
|
|
136
|
+
var _a, _b;
|
|
137
|
+
const { control, formState, handleSubmit, setError } = useForm({
|
|
138
|
+
values
|
|
139
|
+
});
|
|
140
|
+
return /* @__PURE__ */ jsxs(
|
|
141
|
+
Shell,
|
|
142
|
+
{
|
|
143
|
+
...{
|
|
144
|
+
disabled,
|
|
145
|
+
loading: formState.isSubmitting,
|
|
146
|
+
onSubmit: handleSubmit(submitting(onSuccess, setError)),
|
|
147
|
+
submit
|
|
148
|
+
},
|
|
149
|
+
children: [
|
|
150
|
+
((_b = (_a = formState.errors) == null ? void 0 : _a.root) == null ? void 0 : _b.message) && /* @__PURE__ */ jsx(
|
|
151
|
+
CardTask,
|
|
152
|
+
{
|
|
153
|
+
...{
|
|
154
|
+
message: formState.errors.root.message,
|
|
155
|
+
type: "error"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
title(control)
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
const FormVariant = ({
|
|
165
|
+
disabled,
|
|
166
|
+
onSuccess,
|
|
167
|
+
pages = []
|
|
168
|
+
}) => {
|
|
169
|
+
var _a, _b, _c;
|
|
170
|
+
const { control, formState, handleSubmit, setError } = useForm({
|
|
171
|
+
defaultValues: {
|
|
172
|
+
from: (_a = pages[0]) == null ? void 0 : _a.value,
|
|
173
|
+
title: ""
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
return /* @__PURE__ */ jsxs(
|
|
177
|
+
Shell,
|
|
178
|
+
{
|
|
179
|
+
...{
|
|
180
|
+
disabled,
|
|
181
|
+
loading: formState.isSubmitting,
|
|
182
|
+
onSubmit: handleSubmit(submitting(onSuccess, setError))
|
|
183
|
+
},
|
|
184
|
+
children: [
|
|
185
|
+
((_c = (_b = formState.errors) == null ? void 0 : _b.root) == null ? void 0 : _c.message) && /* @__PURE__ */ jsx(
|
|
186
|
+
CardTask,
|
|
187
|
+
{
|
|
188
|
+
...{
|
|
189
|
+
message: formState.errors.root.message,
|
|
190
|
+
type: "error"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
title(control),
|
|
195
|
+
pages.length > 1 && field({
|
|
196
|
+
control,
|
|
197
|
+
input: (props) => /* @__PURE__ */ jsx(
|
|
198
|
+
InputSelect,
|
|
199
|
+
{
|
|
200
|
+
...{
|
|
201
|
+
...props,
|
|
202
|
+
options: pages
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
label: "Start from",
|
|
207
|
+
name: "from"
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
const atLeastAWeek = (value, { startsAt }) => !value || !startsAt || new Date(value) - new Date(startsAt) >= WEEK || "End date must be at least seven days after the start";
|
|
214
|
+
const FormDates = ({
|
|
215
|
+
onSuccess,
|
|
216
|
+
started,
|
|
217
|
+
values = {}
|
|
218
|
+
}) => {
|
|
219
|
+
const { control, formState, handleSubmit } = useForm({
|
|
220
|
+
guard: false,
|
|
221
|
+
values
|
|
222
|
+
});
|
|
223
|
+
return /* @__PURE__ */ jsxs(
|
|
224
|
+
Shell,
|
|
225
|
+
{
|
|
226
|
+
...{
|
|
227
|
+
loading: formState.isSubmitting,
|
|
228
|
+
onSubmit: handleSubmit(onSuccess),
|
|
229
|
+
submit: "Done"
|
|
230
|
+
},
|
|
231
|
+
children: [
|
|
232
|
+
field({
|
|
233
|
+
control,
|
|
234
|
+
input: (props) => /* @__PURE__ */ jsx(
|
|
235
|
+
InputDate,
|
|
236
|
+
{
|
|
237
|
+
...{
|
|
238
|
+
...props,
|
|
239
|
+
disabled: started,
|
|
240
|
+
time: true
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
label: "Start date",
|
|
245
|
+
name: "startsAt",
|
|
246
|
+
rules: {
|
|
247
|
+
required: "Start date is required"
|
|
248
|
+
}
|
|
249
|
+
}),
|
|
250
|
+
field({
|
|
251
|
+
control,
|
|
252
|
+
input: (props) => /* @__PURE__ */ jsx(
|
|
253
|
+
InputDate,
|
|
254
|
+
{
|
|
255
|
+
...{
|
|
256
|
+
...props,
|
|
257
|
+
time: true
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
label: "End date",
|
|
262
|
+
name: "endsAt",
|
|
263
|
+
rules: {
|
|
264
|
+
required: "End date is required",
|
|
265
|
+
validate: atLeastAWeek
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
};
|
|
272
|
+
const Locked = ({
|
|
273
|
+
children,
|
|
274
|
+
reason
|
|
275
|
+
}) => reason ? /* @__PURE__ */ jsx(
|
|
276
|
+
Tooltip,
|
|
277
|
+
{
|
|
278
|
+
...{
|
|
279
|
+
content: reason
|
|
280
|
+
},
|
|
281
|
+
children
|
|
282
|
+
}
|
|
283
|
+
) : children;
|
|
284
|
+
const RowVariant = ({
|
|
285
|
+
conversion,
|
|
286
|
+
disabled,
|
|
287
|
+
items,
|
|
288
|
+
label,
|
|
289
|
+
locked,
|
|
290
|
+
onShare,
|
|
291
|
+
share
|
|
292
|
+
}) => /* @__PURE__ */ jsxs(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
...{
|
|
296
|
+
"aria-label": label,
|
|
297
|
+
className: "py-3 space-y-2 first:pt-0 last:pb-0",
|
|
298
|
+
role: "group"
|
|
299
|
+
},
|
|
300
|
+
children: [
|
|
301
|
+
/* @__PURE__ */ jsxs(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
...{
|
|
305
|
+
className: "flex items-center gap-3 min-h-10"
|
|
306
|
+
},
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsxs(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
...{
|
|
312
|
+
className: "flex-1 min-w-0"
|
|
313
|
+
},
|
|
314
|
+
children: [
|
|
315
|
+
/* @__PURE__ */ jsxs(
|
|
316
|
+
"div",
|
|
317
|
+
{
|
|
318
|
+
...{
|
|
319
|
+
className: "flex items-center gap-2 min-w-0"
|
|
320
|
+
},
|
|
321
|
+
children: [
|
|
322
|
+
/* @__PURE__ */ jsx(
|
|
323
|
+
"p",
|
|
324
|
+
{
|
|
325
|
+
...{
|
|
326
|
+
className: "truncate"
|
|
327
|
+
},
|
|
328
|
+
children: label
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
disabled && /* @__PURE__ */ jsx(Disabled, {})
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
conversion && /* @__PURE__ */ jsx(
|
|
336
|
+
"p",
|
|
337
|
+
{
|
|
338
|
+
...{
|
|
339
|
+
className: "text-sm"
|
|
340
|
+
},
|
|
341
|
+
children: conversion
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
(items == null ? void 0 : items.length) > 0 && /* @__PURE__ */ jsx(
|
|
348
|
+
Dropdown,
|
|
349
|
+
{
|
|
350
|
+
...{
|
|
351
|
+
button: {
|
|
352
|
+
"aria-label": "Manage " + label,
|
|
353
|
+
icon: Ellipsis
|
|
354
|
+
},
|
|
355
|
+
classNameMenu: "w-40",
|
|
356
|
+
items
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
!disabled && /* @__PURE__ */ jsxs(
|
|
364
|
+
"div",
|
|
365
|
+
{
|
|
366
|
+
...{
|
|
367
|
+
className: "flex items-center gap-1 w-full"
|
|
368
|
+
},
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ jsx(
|
|
371
|
+
"div",
|
|
372
|
+
{
|
|
373
|
+
...{
|
|
374
|
+
className: "flex-1 min-w-0"
|
|
375
|
+
},
|
|
376
|
+
children: /* @__PURE__ */ jsx(
|
|
377
|
+
InputRange,
|
|
378
|
+
{
|
|
379
|
+
...{
|
|
380
|
+
"aria-label": "Share of visitors for " + label,
|
|
381
|
+
disabled: locked,
|
|
382
|
+
max: 100,
|
|
383
|
+
min: 1,
|
|
384
|
+
onChange: onShare,
|
|
385
|
+
value: share
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ jsx(
|
|
392
|
+
"span",
|
|
393
|
+
{
|
|
394
|
+
...{
|
|
395
|
+
className: "text-sm"
|
|
396
|
+
},
|
|
397
|
+
children: "%"
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
const FormTestRail = ({
|
|
407
|
+
addReason,
|
|
408
|
+
disabled,
|
|
409
|
+
notice,
|
|
410
|
+
onAdd,
|
|
411
|
+
onDates,
|
|
412
|
+
onSubmit,
|
|
413
|
+
pages = [],
|
|
414
|
+
running,
|
|
415
|
+
schedules = () => false,
|
|
416
|
+
values = {}
|
|
417
|
+
}) => {
|
|
418
|
+
var _a, _b;
|
|
419
|
+
const error = useRef(null);
|
|
420
|
+
const { control, formState, getValues, handleSubmit, reset, setError, setValue, watch } = useForm({
|
|
421
|
+
defaultValues: values
|
|
422
|
+
});
|
|
423
|
+
const shares = watch("shares") || {};
|
|
424
|
+
const [endsAt, startsAt] = watch(["endsAt", "startsAt"]);
|
|
425
|
+
const ids = pages.filter((page) => !page.disabled).map((page) => page.id);
|
|
426
|
+
const locked = Boolean(disabled || running || ids.length < 2);
|
|
427
|
+
const message = (_b = (_a = formState.errors) == null ? void 0 : _a.root) == null ? void 0 : _b.message;
|
|
428
|
+
useEffect(
|
|
429
|
+
() => {
|
|
430
|
+
setValue("shares", values.shares || {});
|
|
431
|
+
},
|
|
432
|
+
[ids.join()]
|
|
433
|
+
);
|
|
434
|
+
useEffect(
|
|
435
|
+
() => {
|
|
436
|
+
var _a2;
|
|
437
|
+
if (message) (_a2 = error.current) == null ? void 0 : _a2.scrollIntoView({
|
|
438
|
+
behavior: "smooth",
|
|
439
|
+
block: "center"
|
|
440
|
+
});
|
|
441
|
+
},
|
|
442
|
+
[message]
|
|
443
|
+
);
|
|
444
|
+
const dates = () => onDates(
|
|
445
|
+
{
|
|
446
|
+
endsAt,
|
|
447
|
+
startsAt
|
|
448
|
+
},
|
|
449
|
+
(picked) => {
|
|
450
|
+
setValue("startsAt", picked.startsAt, {
|
|
451
|
+
shouldDirty: true
|
|
452
|
+
});
|
|
453
|
+
setValue("endsAt", picked.endsAt, {
|
|
454
|
+
shouldDirty: true
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
return /* @__PURE__ */ jsx(
|
|
459
|
+
Form,
|
|
460
|
+
{
|
|
461
|
+
...{
|
|
462
|
+
className: "relative w-full",
|
|
463
|
+
// The saved values are the new baseline: `defaultValues` never
|
|
464
|
+
// re-syncs, so without this Back after Save asks about the save.
|
|
465
|
+
onSubmit: handleSubmit(submitting(async (saved) => {
|
|
466
|
+
await onSubmit(saved);
|
|
467
|
+
reset(getValues());
|
|
468
|
+
}, setError))
|
|
469
|
+
},
|
|
470
|
+
children: /* @__PURE__ */ jsx(
|
|
471
|
+
CardSection,
|
|
472
|
+
{
|
|
473
|
+
...{
|
|
474
|
+
title: "Test"
|
|
475
|
+
},
|
|
476
|
+
children: /* @__PURE__ */ jsxs(
|
|
477
|
+
Fieldset,
|
|
478
|
+
{
|
|
479
|
+
...{
|
|
480
|
+
className: "space-y-6",
|
|
481
|
+
disabled: disabled || formState.isSubmitting
|
|
482
|
+
},
|
|
483
|
+
children: [
|
|
484
|
+
message && /* @__PURE__ */ jsx("div", { ref: error, children: /* @__PURE__ */ jsx(
|
|
485
|
+
CardTask,
|
|
486
|
+
{
|
|
487
|
+
...{
|
|
488
|
+
message,
|
|
489
|
+
type: "error"
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
) }),
|
|
493
|
+
notice && /* @__PURE__ */ jsx(
|
|
494
|
+
CardTask,
|
|
495
|
+
{
|
|
496
|
+
...notice
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
title(control),
|
|
500
|
+
/* @__PURE__ */ jsx(
|
|
501
|
+
InputGroup,
|
|
502
|
+
{
|
|
503
|
+
...{
|
|
504
|
+
input: /* @__PURE__ */ jsx(
|
|
505
|
+
Button,
|
|
506
|
+
{
|
|
507
|
+
...{
|
|
508
|
+
icon: Calendar,
|
|
509
|
+
justify: "between",
|
|
510
|
+
onClick: dates,
|
|
511
|
+
type: "button",
|
|
512
|
+
variant: "secondary"
|
|
513
|
+
},
|
|
514
|
+
children: span({ endsAt, startsAt }) || "Set dates"
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
label: "Dates"
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
),
|
|
521
|
+
/* @__PURE__ */ jsxs(
|
|
522
|
+
"div",
|
|
523
|
+
{
|
|
524
|
+
...{
|
|
525
|
+
className: "space-y-3"
|
|
526
|
+
},
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsxs(
|
|
529
|
+
"div",
|
|
530
|
+
{
|
|
531
|
+
...{
|
|
532
|
+
className: "flex items-center justify-between gap-3"
|
|
533
|
+
},
|
|
534
|
+
children: [
|
|
535
|
+
/* @__PURE__ */ jsx("p", { children: "Variants" }),
|
|
536
|
+
/* @__PURE__ */ jsx(
|
|
537
|
+
Locked,
|
|
538
|
+
{
|
|
539
|
+
...{
|
|
540
|
+
reason: addReason
|
|
541
|
+
},
|
|
542
|
+
children: /* @__PURE__ */ jsx(
|
|
543
|
+
Button,
|
|
544
|
+
{
|
|
545
|
+
...{
|
|
546
|
+
"aria-label": "Add variant",
|
|
547
|
+
disabled: Boolean(disabled || addReason),
|
|
548
|
+
icon: Plus,
|
|
549
|
+
inline: true,
|
|
550
|
+
onClick: onAdd,
|
|
551
|
+
size: "small",
|
|
552
|
+
type: "button",
|
|
553
|
+
variant: "secondary"
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
)
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
/* @__PURE__ */ jsx(
|
|
563
|
+
"p",
|
|
564
|
+
{
|
|
565
|
+
...{
|
|
566
|
+
className: "text-sm"
|
|
567
|
+
},
|
|
568
|
+
children: "Traffic for each page variant is distributed based on the split applied."
|
|
569
|
+
}
|
|
570
|
+
),
|
|
571
|
+
/* @__PURE__ */ jsx(
|
|
572
|
+
"div",
|
|
573
|
+
{
|
|
574
|
+
...{
|
|
575
|
+
className: "divide-y divide-gray"
|
|
576
|
+
},
|
|
577
|
+
children: pages.map((page) => /* @__PURE__ */ jsx(
|
|
578
|
+
RowVariant,
|
|
579
|
+
{
|
|
580
|
+
...{
|
|
581
|
+
conversion: page.conversion,
|
|
582
|
+
disabled: page.disabled,
|
|
583
|
+
items: page.items,
|
|
584
|
+
label: page.label,
|
|
585
|
+
locked,
|
|
586
|
+
onShare: (value) => setValue("shares", move(shares, ids, page.id, value), {
|
|
587
|
+
shouldDirty: true
|
|
588
|
+
}),
|
|
589
|
+
share: shares[page.id]
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
page.id
|
|
593
|
+
))
|
|
594
|
+
}
|
|
595
|
+
)
|
|
596
|
+
]
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ jsxs(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
...{
|
|
603
|
+
className: "space-y-3"
|
|
604
|
+
},
|
|
605
|
+
children: [
|
|
606
|
+
!locked && /* @__PURE__ */ jsx(
|
|
607
|
+
Button,
|
|
608
|
+
{
|
|
609
|
+
...{
|
|
610
|
+
onClick: () => setValue("shares", even(ids), {
|
|
611
|
+
shouldDirty: true
|
|
612
|
+
}),
|
|
613
|
+
type: "button",
|
|
614
|
+
variant: "secondary"
|
|
615
|
+
},
|
|
616
|
+
children: "Split evenly"
|
|
617
|
+
}
|
|
618
|
+
),
|
|
619
|
+
/* @__PURE__ */ jsx(
|
|
620
|
+
Button,
|
|
621
|
+
{
|
|
622
|
+
...{
|
|
623
|
+
loading: formState.isSubmitting,
|
|
624
|
+
type: "submit"
|
|
625
|
+
},
|
|
626
|
+
children: schedules({ endsAt, startsAt }) ? "Schedule" : "Save"
|
|
627
|
+
}
|
|
628
|
+
)
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
)
|
|
632
|
+
]
|
|
633
|
+
}
|
|
634
|
+
)
|
|
635
|
+
}
|
|
636
|
+
)
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
};
|
|
640
|
+
export {
|
|
641
|
+
FormDates,
|
|
642
|
+
FormTest,
|
|
643
|
+
FormTestRail,
|
|
644
|
+
FormVariant,
|
|
645
|
+
RowVariant
|
|
646
|
+
};
|