@drawbridge/components 0.1.37 → 0.1.38
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 +223 -94
- package/dist/bridge/form-subdomain.mjs +222 -96
- package/dist/bridge/lib/entry.js +61 -6
- package/dist/bridge/lib/entry.mjs +51 -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 +1798 -0
- package/dist/dashboard/campaign-form.mjs +1769 -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 +34 -9
- package/dist/dashboard/card-campaign-switch.mjs +32 -8
- 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 +181 -0
- package/dist/dashboard/card-shortcut.mjs +152 -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 +203 -0
- package/dist/dashboard/lib/form-page.mjs +155 -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 +198 -126
- package/dist/dashboard/template-rail.mjs +196 -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 +3 -9
- package/dist/shared/lib/campaign.mjs +3 -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 +44 -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 +20 -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 +38 -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/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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatDateString } from "@drawbridge/drawbridge-utils";
|
|
2
3
|
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
3
4
|
import { useForm, Controller } from "../shared/lib/form.mjs";
|
|
4
5
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
@@ -6,6 +7,7 @@ import Form from "../shared/form.mjs";
|
|
|
6
7
|
import Fieldset from "../shared/fieldset.mjs";
|
|
7
8
|
import InputGroup from "../input-group.mjs";
|
|
8
9
|
import InputNumber from "../input-number.mjs";
|
|
10
|
+
import InputSelect from "../input-select.mjs";
|
|
9
11
|
import InputText from "../input-text.mjs";
|
|
10
12
|
import InputSwitch from "../shared/input-switch.mjs";
|
|
11
13
|
import { featureLabel, grantableFeatures } from "./lib/features.mjs";
|
|
@@ -13,14 +15,26 @@ import { overageFromForm, overageToForm } from "./lib/overage.mjs";
|
|
|
13
15
|
import Button from "../shared/button.mjs";
|
|
14
16
|
const gigabyte = 1024 * 1024 * 1024;
|
|
15
17
|
const blank = (value, original) => original === "" || original === null || original === void 0 ? null : value;
|
|
18
|
+
const cents = (value) => value == null || Math.abs(value * 100 - Math.round(value * 100)) < 1e-6;
|
|
19
|
+
const day = (date) => formatDateString({
|
|
20
|
+
date,
|
|
21
|
+
options: {
|
|
22
|
+
day: "numeric",
|
|
23
|
+
month: "short",
|
|
24
|
+
year: "numeric"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const monthsLabel = (months) => months + (months === 1 ? " month" : " months");
|
|
16
28
|
const FormAdminSubscriptionCustom = ({
|
|
17
29
|
onSuccess,
|
|
18
30
|
onError,
|
|
19
31
|
values
|
|
20
32
|
}) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
22
34
|
const custom = (values == null ? void 0 : values.custom) || {};
|
|
23
|
-
const
|
|
35
|
+
const active = (values == null ? void 0 : values.status) === "active";
|
|
36
|
+
const locked = active || Boolean((_a = custom == null ? void 0 : custom.setup) == null ? void 0 : _a.billedAt);
|
|
37
|
+
const { control, handleSubmit, formState, watch } = useForm({
|
|
24
38
|
resolver: resolver(
|
|
25
39
|
// Required here mirrors the API's availability gate. A custom plan is
|
|
26
40
|
// self-describing, so an unset term resolves to NOTHING rather than to
|
|
@@ -39,6 +53,15 @@ const FormAdminSubscriptionCustom = ({
|
|
|
39
53
|
conversion: yup.number().transform(blank).nullable().label("Conversion rate").min(0).max(100).required(),
|
|
40
54
|
members: yup.number().transform(blank).nullable().label("Members").min(0),
|
|
41
55
|
storage: yup.number().transform(blank).nullable().label("Storage").min(0),
|
|
56
|
+
setup: yup.number().transform(blank).nullable().label("Setup fee").min(0).test("cents", "Setup fee must be dollars and cents", cents),
|
|
57
|
+
support: yup.boolean().label("Support"),
|
|
58
|
+
lasts: yup.string().oneOf(["forever", "months"]).label("Support lasts"),
|
|
59
|
+
// Asked for only when support is on and lasts a number of months.
|
|
60
|
+
// Checked only while shown, so a hidden value never blocks Submit.
|
|
61
|
+
months: yup.number().transform(blank).nullable().label("Months").when(["support", "lasts"], {
|
|
62
|
+
is: (support, lasts) => support && lasts === "months",
|
|
63
|
+
then: (schema) => schema.integer().min(1).max(120).required()
|
|
64
|
+
}),
|
|
42
65
|
overages: yup.number().transform(blank).nullable().label("Actions overage").min(0).required(),
|
|
43
66
|
available: yup.boolean().label("Available"),
|
|
44
67
|
features: yup.array().of(yup.string()).label("Features"),
|
|
@@ -46,20 +69,24 @@ const FormAdminSubscriptionCustom = ({
|
|
|
46
69
|
})
|
|
47
70
|
),
|
|
48
71
|
values: {
|
|
49
|
-
actions: ((
|
|
72
|
+
actions: ((_c = (_b = custom == null ? void 0 : custom.limits) == null ? void 0 : _b.organization) == null ? void 0 : _c.actions) ?? "",
|
|
50
73
|
available: Boolean(custom == null ? void 0 : custom.available),
|
|
51
|
-
features: ((
|
|
52
|
-
amount: Number.isFinite((
|
|
74
|
+
features: ((_d = custom == null ? void 0 : custom.features) == null ? void 0 : _d.granted) || [],
|
|
75
|
+
amount: Number.isFinite((_e = custom == null ? void 0 : custom.data) == null ? void 0 : _e.amount) ? custom.data.amount / 100 : "",
|
|
53
76
|
conversion: (custom == null ? void 0 : custom.conversion) ?? "",
|
|
54
|
-
members: ((
|
|
55
|
-
|
|
77
|
+
members: ((_g = (_f = custom == null ? void 0 : custom.limits) == null ? void 0 : _f.organization) == null ? void 0 : _g.members) ?? "",
|
|
78
|
+
setup: Number.isFinite((_h = custom == null ? void 0 : custom.setup) == null ? void 0 : _h.amount) ? custom.setup.amount / 100 : "",
|
|
79
|
+
support: ((_i = custom == null ? void 0 : custom.support) == null ? void 0 : _i.enabled) === true,
|
|
80
|
+
lasts: ((_j = custom == null ? void 0 : custom.support) == null ? void 0 : _j.months) ? "months" : "forever",
|
|
81
|
+
months: ((_k = custom == null ? void 0 : custom.support) == null ? void 0 : _k.months) ?? "",
|
|
82
|
+
storage: Number.isFinite((_m = (_l = custom == null ? void 0 : custom.limits) == null ? void 0 : _l.organization) == null ? void 0 : _m.storage) ? custom.limits.organization.storage / gigabyte : "",
|
|
56
83
|
// Stored as CENTS per action; edited in dollars, like `amount`. The
|
|
57
84
|
// conversion pair lives in lib/overage.js with the float-dust rounding.
|
|
58
85
|
overages: overageToForm(custom == null ? void 0 : custom.overages),
|
|
59
86
|
title: (custom == null ? void 0 : custom.title) ?? ""
|
|
60
87
|
}
|
|
61
88
|
});
|
|
62
|
-
const onSubmit = async ({ actions, available, amount, conversion, features, members, overages, storage, title }) => {
|
|
89
|
+
const onSubmit = async ({ actions, available, amount, conversion, features, lasts, members, months, overages, setup, storage, support, title }) => {
|
|
63
90
|
try {
|
|
64
91
|
const response = await request({
|
|
65
92
|
body: {
|
|
@@ -71,6 +98,13 @@ const FormAdminSubscriptionCustom = ({
|
|
|
71
98
|
...Number.isFinite(amount) && { data: { amount: Math.round(amount * 100) } },
|
|
72
99
|
...Number.isFinite(conversion) && { conversion },
|
|
73
100
|
...Number.isFinite(overages) && { overages: overageFromForm(overages) },
|
|
101
|
+
// Whole cents, converted here as the price is. Empty or 0 is no fee.
|
|
102
|
+
...Number.isFinite(setup) && setup > 0 && { setup: { amount: Math.round(setup * 100) } },
|
|
103
|
+
// Off keeps the stored months and date; forever sends no months.
|
|
104
|
+
support: {
|
|
105
|
+
enabled: Boolean(support),
|
|
106
|
+
...support && lasts === "months" && Number.isFinite(months) && { months }
|
|
107
|
+
},
|
|
74
108
|
limits: {
|
|
75
109
|
organization: {
|
|
76
110
|
...Number.isFinite(actions) && { actions },
|
|
@@ -137,6 +171,15 @@ const FormAdminSubscriptionCustom = ({
|
|
|
137
171
|
(value) => Number.isFinite(value) ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Applies immediately only if this is the plan they are billing on." : "The organization is billed this each period.",
|
|
138
172
|
({ onChange, value }) => /* @__PURE__ */ jsx(InputNumber, { ...{ min: 1, onChange, placeholder: "2499.00", step: 0.01, type: "number", value: value ?? "" } })
|
|
139
173
|
),
|
|
174
|
+
field(
|
|
175
|
+
"setup",
|
|
176
|
+
"Setup fee ($)",
|
|
177
|
+
(value) => {
|
|
178
|
+
var _a2;
|
|
179
|
+
return locked ? ((_a2 = custom == null ? void 0 : custom.setup) == null ? void 0 : _a2.billedAt) ? "Billed on " + day(custom.setup.billedAt) + "." : "They are on this plan, so a fee can no longer be added." : value > 0 ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Billed once, on their first invoice." : "Billed once, on their first invoice. Leave empty for no fee.";
|
|
180
|
+
},
|
|
181
|
+
({ onChange, value }) => /* @__PURE__ */ jsx(InputNumber, { ...{ disabled: locked, min: 0, onChange, placeholder: locked ? "None" : "2500.00", step: 0.01, type: "number", value: value ?? "" } })
|
|
182
|
+
),
|
|
140
183
|
field(
|
|
141
184
|
"actions",
|
|
142
185
|
"Actions included",
|
|
@@ -219,6 +262,27 @@ const FormAdminSubscriptionCustom = ({
|
|
|
219
262
|
}
|
|
220
263
|
}
|
|
221
264
|
),
|
|
265
|
+
field(
|
|
266
|
+
"support",
|
|
267
|
+
"Support",
|
|
268
|
+
"On: members see a Support button in their dashboard and can send us a message.",
|
|
269
|
+
({ onChange, value }) => /* @__PURE__ */ jsx(InputSwitch, { ...{ onChange, value: value || false } })
|
|
270
|
+
),
|
|
271
|
+
watch("support") && field(
|
|
272
|
+
"lasts",
|
|
273
|
+
"Support lasts",
|
|
274
|
+
(value) => value === "months" ? null : "For as long as they are on this plan.",
|
|
275
|
+
({ onChange, value }) => /* @__PURE__ */ jsx(InputSelect, { ...{ onChange, options: [{ label: "Forever", value: "forever" }, { label: "A number of months", value: "months" }], value: value || "forever" } })
|
|
276
|
+
),
|
|
277
|
+
watch("support") && watch("lasts") === "months" && field(
|
|
278
|
+
"months",
|
|
279
|
+
"Months",
|
|
280
|
+
(value) => {
|
|
281
|
+
var _a2, _b2;
|
|
282
|
+
return !Number.isFinite(value) ? "Counted from the day they start this plan." : value === ((_a2 = custom == null ? void 0 : custom.support) == null ? void 0 : _a2.months) && ((_b2 = custom == null ? void 0 : custom.support) == null ? void 0 : _b2.until) ? (new Date(custom.support.until) < /* @__PURE__ */ new Date() ? "Support ended " : "Support ends ") + day(custom.support.until) + "." : (custom == null ? void 0 : custom.startedAt) ? "Support ends " + monthsLabel(value) + " after the day they started this plan." : "Support ends " + monthsLabel(value) + " after they start this plan.";
|
|
283
|
+
},
|
|
284
|
+
({ onChange, value }) => /* @__PURE__ */ jsx(InputNumber, { ...{ max: 120, min: 1, onChange, placeholder: "6", step: 1, type: "number", value: value ?? "" } })
|
|
285
|
+
),
|
|
222
286
|
field(
|
|
223
287
|
"available",
|
|
224
288
|
"Available to the organization",
|
|
@@ -30,7 +30,6 @@ __export(form_ai_exports, {
|
|
|
30
30
|
FormAiBrand: () => FormAiBrand,
|
|
31
31
|
FormAiCampaign: () => FormAiCampaign,
|
|
32
32
|
FormAiImage: () => FormAiImage,
|
|
33
|
-
FormAiPage: () => FormAiPage,
|
|
34
33
|
FormAiText: () => FormAiText
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(form_ai_exports);
|
|
@@ -433,152 +432,6 @@ const FormAiImage = ({
|
|
|
433
432
|
}
|
|
434
433
|
);
|
|
435
434
|
};
|
|
436
|
-
const FormAiPage = ({
|
|
437
|
-
canManageBrands,
|
|
438
|
-
disabled,
|
|
439
|
-
onError,
|
|
440
|
-
onSuccess,
|
|
441
|
-
values
|
|
442
|
-
}) => {
|
|
443
|
-
const methods = (0, import_form.useForm)({
|
|
444
|
-
guard: false,
|
|
445
|
-
resolver: (0, import_yup.resolver)(
|
|
446
|
-
import_yup.default.object({
|
|
447
|
-
...import_input_fields.schemas.page(),
|
|
448
|
-
brand: import_yup.default.object().label("Brand").nullable(),
|
|
449
|
-
url: import_yup.default.string().label("Url").max(150).matches(import_drawbridge_utils.regex.url, "Url must start with https").required().url()
|
|
450
|
-
})
|
|
451
|
-
),
|
|
452
|
-
values
|
|
453
|
-
});
|
|
454
|
-
const { control, formState, handleSubmit } = methods;
|
|
455
|
-
const onSubmit = async ({
|
|
456
|
-
brand,
|
|
457
|
-
title,
|
|
458
|
-
url
|
|
459
|
-
}) => {
|
|
460
|
-
try {
|
|
461
|
-
const args = {
|
|
462
|
-
body: {
|
|
463
|
-
brand: (brand == null ? void 0 : brand.id) ?? null,
|
|
464
|
-
title,
|
|
465
|
-
url
|
|
466
|
-
},
|
|
467
|
-
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/ai/page",
|
|
468
|
-
method: "POST"
|
|
469
|
-
};
|
|
470
|
-
const response = await (0, import_fetch.request)(args);
|
|
471
|
-
onSuccess(response);
|
|
472
|
-
} catch (error) {
|
|
473
|
-
onError(error);
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
477
|
-
import_form2.default,
|
|
478
|
-
{
|
|
479
|
-
...{
|
|
480
|
-
className: "relative w-full space-y-6",
|
|
481
|
-
onSubmit: handleSubmit(onSubmit)
|
|
482
|
-
},
|
|
483
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wrapper_ai.default, { children: [
|
|
484
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
485
|
-
import_fieldset.default,
|
|
486
|
-
{
|
|
487
|
-
...{
|
|
488
|
-
className: "space-y-4",
|
|
489
|
-
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
490
|
-
},
|
|
491
|
-
children: [
|
|
492
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_fields.InputFieldsPage, {}),
|
|
493
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
494
|
-
import_form.Controller,
|
|
495
|
-
{
|
|
496
|
-
...{
|
|
497
|
-
control,
|
|
498
|
-
name: "url",
|
|
499
|
-
render: ({ field: { value, onChange } }) => {
|
|
500
|
-
var _a, _b;
|
|
501
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
502
|
-
import_input_group.default,
|
|
503
|
-
{
|
|
504
|
-
...{
|
|
505
|
-
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.url) == null ? void 0 : _b.message,
|
|
506
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
507
|
-
import_input_url.default,
|
|
508
|
-
{
|
|
509
|
-
...{
|
|
510
|
-
onChange,
|
|
511
|
-
placeholder: "Enter a url to get started",
|
|
512
|
-
value: value || ""
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
),
|
|
516
|
-
label: "Url"
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
),
|
|
524
|
-
canManageBrands && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
525
|
-
import_form.Controller,
|
|
526
|
-
{
|
|
527
|
-
...{
|
|
528
|
-
control,
|
|
529
|
-
name: "brand",
|
|
530
|
-
render: ({ field: { value, onChange } }) => {
|
|
531
|
-
var _a, _b;
|
|
532
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
533
|
-
import_input_group.default,
|
|
534
|
-
{
|
|
535
|
-
...{
|
|
536
|
-
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.brand) == null ? void 0 : _b.message,
|
|
537
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
538
|
-
import_input_resource.default,
|
|
539
|
-
{
|
|
540
|
-
...{
|
|
541
|
-
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/brands",
|
|
542
|
-
model: "brand",
|
|
543
|
-
onChange,
|
|
544
|
-
value
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
),
|
|
548
|
-
label: "Brand"
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
)
|
|
556
|
-
]
|
|
557
|
-
}
|
|
558
|
-
),
|
|
559
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
560
|
-
import_fieldset.default,
|
|
561
|
-
{
|
|
562
|
-
...{
|
|
563
|
-
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
564
|
-
},
|
|
565
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
566
|
-
import_button.default,
|
|
567
|
-
{
|
|
568
|
-
...{
|
|
569
|
-
loading: formState == null ? void 0 : formState.isSubmitting,
|
|
570
|
-
type: "submit",
|
|
571
|
-
variant: "ai"
|
|
572
|
-
},
|
|
573
|
-
children: "Generate"
|
|
574
|
-
}
|
|
575
|
-
)
|
|
576
|
-
}
|
|
577
|
-
)
|
|
578
|
-
] })
|
|
579
|
-
}
|
|
580
|
-
) });
|
|
581
|
-
};
|
|
582
435
|
const FormAiText = ({
|
|
583
436
|
disabled,
|
|
584
437
|
onChange = () => {
|
|
@@ -777,6 +630,5 @@ const FormAiText = ({
|
|
|
777
630
|
FormAiBrand,
|
|
778
631
|
FormAiCampaign,
|
|
779
632
|
FormAiImage,
|
|
780
|
-
FormAiPage,
|
|
781
633
|
FormAiText
|
|
782
634
|
});
|
|
@@ -11,7 +11,7 @@ import InputGroup from "../input-group.mjs";
|
|
|
11
11
|
import InputText from "../input-text.mjs";
|
|
12
12
|
import InputUrl from "../shared/input-url.mjs";
|
|
13
13
|
import InputResource from "./input-resource.mjs";
|
|
14
|
-
import { InputFieldsCampaign,
|
|
14
|
+
import { InputFieldsCampaign, schemas } from "./input-fields.mjs";
|
|
15
15
|
import InputTextarea from "../input-textarea.mjs";
|
|
16
16
|
import InputRadio from "./input-radio.mjs";
|
|
17
17
|
import CardTask from "./card-task.mjs";
|
|
@@ -397,152 +397,6 @@ const FormAiImage = ({
|
|
|
397
397
|
}
|
|
398
398
|
);
|
|
399
399
|
};
|
|
400
|
-
const FormAiPage = ({
|
|
401
|
-
canManageBrands,
|
|
402
|
-
disabled,
|
|
403
|
-
onError,
|
|
404
|
-
onSuccess,
|
|
405
|
-
values
|
|
406
|
-
}) => {
|
|
407
|
-
const methods = useForm({
|
|
408
|
-
guard: false,
|
|
409
|
-
resolver: resolver(
|
|
410
|
-
yup.object({
|
|
411
|
-
...schemas.page(),
|
|
412
|
-
brand: yup.object().label("Brand").nullable(),
|
|
413
|
-
url: yup.string().label("Url").max(150).matches(regex.url, "Url must start with https").required().url()
|
|
414
|
-
})
|
|
415
|
-
),
|
|
416
|
-
values
|
|
417
|
-
});
|
|
418
|
-
const { control, formState, handleSubmit } = methods;
|
|
419
|
-
const onSubmit = async ({
|
|
420
|
-
brand,
|
|
421
|
-
title,
|
|
422
|
-
url
|
|
423
|
-
}) => {
|
|
424
|
-
try {
|
|
425
|
-
const args = {
|
|
426
|
-
body: {
|
|
427
|
-
brand: (brand == null ? void 0 : brand.id) ?? null,
|
|
428
|
-
title,
|
|
429
|
-
url
|
|
430
|
-
},
|
|
431
|
-
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/ai/page",
|
|
432
|
-
method: "POST"
|
|
433
|
-
};
|
|
434
|
-
const response = await request(args);
|
|
435
|
-
onSuccess(response);
|
|
436
|
-
} catch (error) {
|
|
437
|
-
onError(error);
|
|
438
|
-
}
|
|
439
|
-
};
|
|
440
|
-
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx(
|
|
441
|
-
Form,
|
|
442
|
-
{
|
|
443
|
-
...{
|
|
444
|
-
className: "relative w-full space-y-6",
|
|
445
|
-
onSubmit: handleSubmit(onSubmit)
|
|
446
|
-
},
|
|
447
|
-
children: /* @__PURE__ */ jsxs(WrapperAI, { children: [
|
|
448
|
-
/* @__PURE__ */ jsxs(
|
|
449
|
-
Fieldset,
|
|
450
|
-
{
|
|
451
|
-
...{
|
|
452
|
-
className: "space-y-4",
|
|
453
|
-
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
454
|
-
},
|
|
455
|
-
children: [
|
|
456
|
-
/* @__PURE__ */ jsx(InputFieldsPage, {}),
|
|
457
|
-
/* @__PURE__ */ jsx(
|
|
458
|
-
Controller,
|
|
459
|
-
{
|
|
460
|
-
...{
|
|
461
|
-
control,
|
|
462
|
-
name: "url",
|
|
463
|
-
render: ({ field: { value, onChange } }) => {
|
|
464
|
-
var _a, _b;
|
|
465
|
-
return /* @__PURE__ */ jsx(
|
|
466
|
-
InputGroup,
|
|
467
|
-
{
|
|
468
|
-
...{
|
|
469
|
-
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.url) == null ? void 0 : _b.message,
|
|
470
|
-
input: /* @__PURE__ */ jsx(
|
|
471
|
-
InputUrl,
|
|
472
|
-
{
|
|
473
|
-
...{
|
|
474
|
-
onChange,
|
|
475
|
-
placeholder: "Enter a url to get started",
|
|
476
|
-
value: value || ""
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
),
|
|
480
|
-
label: "Url"
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
),
|
|
488
|
-
canManageBrands && /* @__PURE__ */ jsx(
|
|
489
|
-
Controller,
|
|
490
|
-
{
|
|
491
|
-
...{
|
|
492
|
-
control,
|
|
493
|
-
name: "brand",
|
|
494
|
-
render: ({ field: { value, onChange } }) => {
|
|
495
|
-
var _a, _b;
|
|
496
|
-
return /* @__PURE__ */ jsx(
|
|
497
|
-
InputGroup,
|
|
498
|
-
{
|
|
499
|
-
...{
|
|
500
|
-
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.brand) == null ? void 0 : _b.message,
|
|
501
|
-
input: /* @__PURE__ */ jsx(
|
|
502
|
-
InputResource,
|
|
503
|
-
{
|
|
504
|
-
...{
|
|
505
|
-
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/brands",
|
|
506
|
-
model: "brand",
|
|
507
|
-
onChange,
|
|
508
|
-
value
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
),
|
|
512
|
-
label: "Brand"
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
)
|
|
520
|
-
]
|
|
521
|
-
}
|
|
522
|
-
),
|
|
523
|
-
/* @__PURE__ */ jsx(
|
|
524
|
-
Fieldset,
|
|
525
|
-
{
|
|
526
|
-
...{
|
|
527
|
-
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
528
|
-
},
|
|
529
|
-
children: /* @__PURE__ */ jsx(
|
|
530
|
-
Button,
|
|
531
|
-
{
|
|
532
|
-
...{
|
|
533
|
-
loading: formState == null ? void 0 : formState.isSubmitting,
|
|
534
|
-
type: "submit",
|
|
535
|
-
variant: "ai"
|
|
536
|
-
},
|
|
537
|
-
children: "Generate"
|
|
538
|
-
}
|
|
539
|
-
)
|
|
540
|
-
}
|
|
541
|
-
)
|
|
542
|
-
] })
|
|
543
|
-
}
|
|
544
|
-
) });
|
|
545
|
-
};
|
|
546
400
|
const FormAiText = ({
|
|
547
401
|
disabled,
|
|
548
402
|
onChange = () => {
|
|
@@ -740,6 +594,5 @@ export {
|
|
|
740
594
|
FormAiBrand,
|
|
741
595
|
FormAiCampaign,
|
|
742
596
|
FormAiImage,
|
|
743
|
-
FormAiPage,
|
|
744
597
|
FormAiText
|
|
745
598
|
};
|
|
@@ -29,21 +29,50 @@ var form_filters_analytics_exports = {};
|
|
|
29
29
|
__export(form_filters_analytics_exports, {
|
|
30
30
|
analyticsFloor: () => analyticsFloor,
|
|
31
31
|
default: () => form_filters_analytics_default,
|
|
32
|
-
periodOptions: () => periodOptions
|
|
32
|
+
periodOptions: () => periodOptions,
|
|
33
|
+
variantResource: () => variantResource
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(form_filters_analytics_exports);
|
|
35
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
37
|
var import_react = require("react");
|
|
37
38
|
var import_form = require("../shared/lib/form");
|
|
38
39
|
var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
40
|
+
var import_features = require("@drawbridge/drawbridge-utils/features");
|
|
39
41
|
var import_form2 = __toESM(require("../shared/form"));
|
|
40
42
|
var import_fieldset = __toESM(require("../shared/fieldset"));
|
|
41
43
|
var import_input_group = __toESM(require("../input-group"));
|
|
42
44
|
var import_input_date = __toESM(require("./input-date"));
|
|
43
45
|
var import_input_resource = __toESM(require("./input-resource"));
|
|
44
46
|
var import_input_combobox = __toESM(require("./input-combobox"));
|
|
47
|
+
var import_card_task = __toESM(require("./card-task"));
|
|
45
48
|
var import_tabs = __toESM(require("../shared/tabs"));
|
|
46
49
|
var import_button = __toESM(require("../shared/button"));
|
|
50
|
+
var import_helpers = require("../shared/lib/helpers");
|
|
51
|
+
const variantResource = ({ endpoint, organization }) => {
|
|
52
|
+
const feature = (0, import_drawbridge_utils.getPlanFeature)(organization == null ? void 0 : organization.plan, import_features.organization.tests.key);
|
|
53
|
+
return {
|
|
54
|
+
endpoint,
|
|
55
|
+
key: "variant",
|
|
56
|
+
// Named for what people know, their tests (Darren, 2026-11-14).
|
|
57
|
+
label: "A/B test",
|
|
58
|
+
// "Select an A/B test page", "No A/B test pages found".
|
|
59
|
+
model: "A/B test page",
|
|
60
|
+
// The api's name for the variant: its test and its own title, "Summer
|
|
61
|
+
// hero · Video first", a test variant the only kind the list holds.
|
|
62
|
+
render: (item) => item == null ? void 0 : item.name,
|
|
63
|
+
...!(feature == null ? void 0 : feature.granted) && {
|
|
64
|
+
upgrade: {
|
|
65
|
+
...(0, import_helpers.hasCapability)(organization, "billing") && {
|
|
66
|
+
button: {
|
|
67
|
+
href: "/organizations/" + (organization == null ? void 0 : organization.id) + "/billing",
|
|
68
|
+
text: "Upgrade"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
message: (feature == null ? void 0 : feature.message) || import_features.organization.tests.error
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
};
|
|
47
76
|
const pad = (number) => String(number).padStart(2, "0");
|
|
48
77
|
const analyticsFloor = (show, now = /* @__PURE__ */ new Date()) => {
|
|
49
78
|
if (!show) return null;
|
|
@@ -102,8 +131,8 @@ const FormFiltersAnalytics = ({
|
|
|
102
131
|
const dateRangeEnd = (0, import_form.useWatch)({ control, name: "filters.end", defaultValue: filters == null ? void 0 : filters.end }) || "";
|
|
103
132
|
const campaign = (0, import_form.useWatch)({ control, name: "filters.campaign", defaultValue: filters == null ? void 0 : filters.campaign }) || null;
|
|
104
133
|
const campaignId = campaign && typeof campaign === "object" ? campaign.id : campaign;
|
|
105
|
-
const
|
|
106
|
-
const
|
|
134
|
+
const variant = (0, import_form.useWatch)({ control, name: "filters.variant", defaultValue: filters == null ? void 0 : filters.variant }) || null;
|
|
135
|
+
const variantCampaign = variant && typeof variant === "object" && variant.campaign || null;
|
|
107
136
|
const affiliate = (0, import_form.useWatch)({ control, name: "filters.affiliate", defaultValue: filters == null ? void 0 : filters.affiliate }) || null;
|
|
108
137
|
const affiliateCampaigns = affiliate && typeof affiliate === "object" && Array.isArray(affiliate.campaigns) ? affiliate.campaigns : null;
|
|
109
138
|
const onSubmit = async ({
|
|
@@ -172,7 +201,7 @@ const FormFiltersAnalytics = ({
|
|
|
172
201
|
},
|
|
173
202
|
key
|
|
174
203
|
));
|
|
175
|
-
const renderResources = (fields) => fields.map(({ key, label, endpoint, model, multiple, params, render: renderItem }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
+
const renderResources = (fields) => fields.map(({ key, label, endpoint, model, multiple, params, render: renderItem, upgrade }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
205
|
import_form.Controller,
|
|
177
206
|
{
|
|
178
207
|
...{
|
|
@@ -183,43 +212,61 @@ const FormFiltersAnalytics = ({
|
|
|
183
212
|
{
|
|
184
213
|
...{
|
|
185
214
|
label: (0, import_drawbridge_utils.capitalize)(label),
|
|
186
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
187
|
-
|
|
215
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
216
|
+
"div",
|
|
188
217
|
{
|
|
189
218
|
...{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
219
|
+
className: "space-y-2"
|
|
220
|
+
},
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
223
|
+
import_input_resource.default,
|
|
224
|
+
{
|
|
225
|
+
...{
|
|
226
|
+
// A filter the plan leaves out cannot be picked.
|
|
227
|
+
disabled: Boolean(upgrade),
|
|
228
|
+
endpoint,
|
|
229
|
+
model,
|
|
230
|
+
multiple: Boolean(multiple),
|
|
231
|
+
onChange: (item) => {
|
|
232
|
+
onChange(item);
|
|
233
|
+
if (key === "campaign" && item && variantCampaign !== item.id) {
|
|
234
|
+
setValue("filters.variant", null);
|
|
235
|
+
}
|
|
236
|
+
;
|
|
237
|
+
},
|
|
238
|
+
params: {
|
|
239
|
+
...params,
|
|
240
|
+
...key === "variant" && campaignId && {
|
|
241
|
+
filters: {
|
|
242
|
+
campaign: campaignId
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
...key === "campaign" && variantCampaign && {
|
|
246
|
+
filters: {
|
|
247
|
+
id: variantCampaign
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
...key === "campaign" && !variantCampaign && affiliateCampaigns && {
|
|
251
|
+
filters: {
|
|
252
|
+
id: {
|
|
253
|
+
$in: affiliateCampaigns
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
render: renderItem,
|
|
259
|
+
value: upgrade ? null : multiple ? value || [] : value || null
|
|
217
260
|
}
|
|
218
261
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
262
|
+
),
|
|
263
|
+
upgrade && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
264
|
+
import_card_task.default,
|
|
265
|
+
{
|
|
266
|
+
...upgrade
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
]
|
|
223
270
|
}
|
|
224
271
|
)
|
|
225
272
|
}
|
|
@@ -332,5 +379,6 @@ var form_filters_analytics_default = FormFiltersAnalytics;
|
|
|
332
379
|
// Annotate the CommonJS export names for ESM import in node:
|
|
333
380
|
0 && (module.exports = {
|
|
334
381
|
analyticsFloor,
|
|
335
|
-
periodOptions
|
|
382
|
+
periodOptions,
|
|
383
|
+
variantResource
|
|
336
384
|
});
|