@drawbridge/components 0.1.12 → 0.1.14
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 +364 -2
- package/dist/advertisement.js +3 -1
- package/dist/advertisement.mjs +3 -1
- package/dist/bridge/advertisements.js +2 -0
- package/dist/bridge/advertisements.mjs +2 -0
- package/dist/bridge/countdown.js +2 -1
- package/dist/bridge/countdown.mjs +2 -1
- package/dist/bridge/form-subdomain-embed.js +18 -20
- package/dist/bridge/form-subdomain-embed.mjs +18 -20
- package/dist/bridge/form-subdomain-header.js +24 -1
- package/dist/bridge/form-subdomain-header.mjs +24 -1
- package/dist/bridge/form-subdomain-missions.js +538 -0
- package/dist/bridge/form-subdomain-missions.mjs +502 -0
- package/dist/bridge/form-subdomain.js +530 -220
- package/dist/bridge/form-subdomain.mjs +533 -222
- package/dist/bridge/lib/entry.js +59 -0
- package/dist/bridge/lib/entry.mjs +29 -0
- package/dist/bridge/lib/location.js +38 -0
- package/dist/bridge/lib/location.mjs +13 -0
- package/dist/bridge/lib/order.js +71 -0
- package/dist/bridge/lib/order.mjs +44 -0
- package/dist/bridge/lib/url.js +9 -0
- package/dist/bridge/lib/url.mjs +7 -0
- package/dist/bridge/share-button.js +5 -3
- package/dist/bridge/share-button.mjs +5 -3
- package/dist/bridge/subdomain-content.js +7 -6
- package/dist/bridge/subdomain-content.mjs +7 -6
- package/dist/bridge/template-layout.js +59 -21
- package/dist/bridge/template-layout.mjs +59 -21
- package/dist/bridge/template-modal.js +42 -76
- package/dist/bridge/template-modal.mjs +39 -73
- package/dist/bridge/template-preview.js +208 -0
- package/dist/bridge/template-preview.mjs +173 -0
- package/dist/bridge/template-subdomain-gallery.js +6 -2
- package/dist/bridge/template-subdomain-gallery.mjs +6 -2
- package/dist/bridge/template-subdomain-link.js +6 -1
- package/dist/bridge/template-subdomain-link.mjs +6 -1
- package/dist/bridge/template-subdomain.js +20 -15
- package/dist/bridge/template-subdomain.mjs +20 -15
- package/dist/dashboard/accordion.js +74 -39
- package/dist/dashboard/accordion.mjs +74 -39
- package/dist/dashboard/avatar.js +109 -3
- package/dist/dashboard/avatar.mjs +106 -4
- package/dist/dashboard/buttons-subscription.js +384 -0
- package/dist/dashboard/buttons-subscription.mjs +349 -0
- package/dist/dashboard/card-campaign-switch.js +265 -0
- package/dist/dashboard/card-campaign-switch.mjs +231 -0
- package/dist/dashboard/card-order.js +28 -11
- package/dist/dashboard/card-order.mjs +28 -11
- package/dist/dashboard/card-section.js +26 -2
- package/dist/dashboard/card-section.mjs +26 -2
- package/dist/dashboard/card-tile.js +6 -7
- package/dist/dashboard/card-tile.mjs +6 -7
- package/dist/dashboard/connection-workflows.js +196 -0
- package/dist/dashboard/connection-workflows.mjs +162 -0
- package/dist/dashboard/device.js +95 -0
- package/dist/dashboard/device.mjs +72 -0
- package/dist/dashboard/form-admin-campaign.js +19 -50
- package/dist/dashboard/form-admin-campaign.mjs +20 -51
- package/dist/dashboard/form-ai.js +9 -6
- package/dist/dashboard/form-ai.mjs +9 -6
- package/dist/dashboard/form-auth.js +35 -25
- package/dist/dashboard/form-auth.mjs +36 -26
- package/dist/dashboard/form-file.js +10 -1
- package/dist/dashboard/form-file.mjs +10 -1
- package/dist/dashboard/form-filters-analytics.js +14 -1
- package/dist/dashboard/form-filters-analytics.mjs +15 -2
- package/dist/dashboard/form-organization-campaign-advertisement.js +15 -1
- package/dist/dashboard/form-organization-campaign-advertisement.mjs +16 -2
- package/dist/dashboard/form-organization-campaign-agreement.js +215 -164
- package/dist/dashboard/form-organization-campaign-agreement.mjs +215 -164
- package/dist/dashboard/form-organization-campaign-field-email.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-email.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-list.js +466 -0
- package/dist/dashboard/form-organization-campaign-field-list.mjs +437 -0
- package/dist/dashboard/form-organization-campaign-field-phone.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-phone.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-remove.js +66 -0
- package/dist/dashboard/form-organization-campaign-field-remove.mjs +33 -0
- package/dist/dashboard/form-organization-campaign-integration-age.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
- package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
- package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-link.js +7 -1
- package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
- package/dist/dashboard/form-organization-campaign-mission.js +291 -0
- package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
- package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
- package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-page.js +20 -11
- package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
- package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
- package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-section.js +223 -0
- package/dist/dashboard/form-organization-campaign-section.mjs +194 -0
- package/dist/dashboard/form-organization-campaign.js +114 -469
- package/dist/dashboard/form-organization-campaign.mjs +113 -467
- package/dist/dashboard/form-organization-export.js +4 -7
- package/dist/dashboard/form-organization-export.mjs +4 -7
- package/dist/dashboard/form-organization-identity.js +46 -51
- package/dist/dashboard/form-organization-identity.mjs +46 -51
- package/dist/dashboard/form-organization-workflow.js +518 -686
- package/dist/dashboard/form-organization-workflow.mjs +517 -682
- package/dist/dashboard/form-organization.js +82 -110
- package/dist/dashboard/form-organization.mjs +81 -109
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-payment-methods.js +20 -9
- package/dist/dashboard/form-payment-methods.mjs +20 -9
- package/dist/dashboard/form-stripe.js +30 -0
- package/dist/dashboard/form-stripe.mjs +26 -0
- package/dist/dashboard/input-array.js +4 -2
- package/dist/dashboard/input-array.mjs +4 -2
- package/dist/dashboard/input-combobox.js +7 -3
- package/dist/dashboard/input-combobox.mjs +7 -3
- package/dist/dashboard/input-date.js +7 -0
- package/dist/dashboard/input-date.mjs +7 -0
- package/dist/dashboard/input-fields.js +80 -20
- package/dist/dashboard/input-fields.mjs +80 -20
- package/dist/dashboard/input-file.js +21 -1
- package/dist/dashboard/input-file.mjs +21 -1
- package/dist/dashboard/input-font.js +10 -1
- package/dist/dashboard/input-font.mjs +10 -1
- package/dist/dashboard/lib/item-list.js +57 -0
- package/dist/dashboard/lib/item-list.mjs +33 -0
- package/dist/dashboard/lib/menu.js +50 -0
- package/dist/dashboard/lib/menu.mjs +26 -0
- package/dist/dashboard/locked.js +82 -0
- package/dist/dashboard/locked.mjs +53 -0
- package/dist/dashboard/menu.js +72 -19
- package/dist/dashboard/menu.mjs +72 -19
- package/dist/dashboard/note-ai.js +69 -0
- package/dist/dashboard/note-ai.mjs +36 -0
- package/dist/dashboard/preview.js +419 -0
- package/dist/dashboard/preview.mjs +384 -0
- package/dist/dashboard/steps.js +39 -13
- package/dist/dashboard/steps.mjs +37 -12
- package/dist/dashboard/table-contacts.js +136 -0
- package/dist/dashboard/table-contacts.mjs +103 -0
- package/dist/dashboard/template-not-found.js +4 -2
- package/dist/dashboard/template-not-found.mjs +4 -2
- package/dist/dashboard/template-socket.js +51 -7
- package/dist/dashboard/template-socket.mjs +51 -7
- package/dist/icons/desktop.js +46 -0
- package/dist/icons/desktop.mjs +27 -0
- package/dist/icons/phone.js +46 -0
- package/dist/icons/phone.mjs +27 -0
- package/dist/icons/puzzle-piece.js +46 -0
- package/dist/icons/puzzle-piece.mjs +27 -0
- package/dist/icons/tablet.js +46 -0
- package/dist/icons/tablet.mjs +27 -0
- package/dist/icons/users.js +46 -0
- package/dist/icons/users.mjs +27 -0
- package/dist/input-checkbox.js +1 -0
- package/dist/input-checkbox.mjs +1 -0
- package/dist/input-code.js +101 -0
- package/dist/input-code.mjs +78 -0
- package/dist/input-text.js +2 -1
- package/dist/input-text.mjs +2 -1
- package/dist/shared/input-checkbox-list.js +0 -1
- package/dist/shared/input-checkbox-list.mjs +0 -1
- package/dist/shared/input-switch.js +6 -1
- package/dist/shared/input-switch.mjs +6 -1
- package/dist/shared/lib/campaign.js +117 -0
- package/dist/shared/lib/campaign.mjs +91 -0
- package/dist/shared/lib/helpers.js +14 -2
- package/dist/shared/lib/helpers.mjs +13 -2
- package/package.json +133 -13
- package/types/bridge/form-subdomain-header.d.ts +2 -0
- package/types/bridge/form-subdomain-missions.d.ts +36 -0
- package/types/bridge/form-subdomain.d.ts +23 -1
- package/types/bridge/lib/entry.d.ts +26 -0
- package/types/bridge/lib/location.d.ts +13 -0
- package/types/bridge/lib/order.d.ts +30 -0
- package/types/bridge/lib/url.d.ts +19 -0
- package/types/bridge/template-modal.d.ts +1 -1
- package/types/bridge/template-preview.d.ts +10 -0
- package/types/bridge/template-subdomain-link.d.ts +2 -0
- package/types/dashboard/accordion.d.ts +2 -0
- package/types/dashboard/avatar.d.ts +18 -2
- package/types/dashboard/buttons-subscription.d.ts +22 -0
- package/types/dashboard/card-campaign-switch.d.ts +32 -0
- package/types/dashboard/card-order.d.ts +11 -0
- package/types/dashboard/card-section.d.ts +2 -0
- package/types/dashboard/connection-workflows.d.ts +33 -0
- package/types/dashboard/device.d.ts +12 -0
- package/types/dashboard/form-admin-campaign.d.ts +3 -2
- package/types/dashboard/form-ai.d.ts +2 -2
- package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
- package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
- package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
- package/types/dashboard/form-organization-campaign-section.d.ts +27 -0
- package/types/dashboard/form-organization-campaign.d.ts +27 -17
- package/types/dashboard/form-organization-identity.d.ts +2 -0
- package/types/dashboard/form-organization-workflow.d.ts +43 -47
- package/types/dashboard/form-organization.d.ts +7 -2
- package/types/dashboard/form-stripe.d.ts +3 -0
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/input-date.d.ts +2 -0
- package/types/dashboard/input-fields.d.ts +3 -2
- package/types/dashboard/input-file.d.ts +4 -0
- package/types/dashboard/lib/item-list.d.ts +14 -0
- package/types/dashboard/lib/menu.d.ts +17 -0
- package/types/dashboard/locked.d.ts +10 -0
- package/types/dashboard/menu.d.ts +10 -2
- package/types/dashboard/note-ai.d.ts +15 -0
- package/types/dashboard/preview.d.ts +33 -0
- package/types/dashboard/steps.d.ts +19 -4
- package/types/dashboard/table-cell-title.d.ts +2 -2
- package/types/dashboard/table-contacts.d.ts +2 -0
- package/types/icons/desktop.d.ts +5 -0
- package/types/icons/phone.d.ts +5 -0
- package/types/icons/puzzle-piece.d.ts +5 -0
- package/types/icons/tablet.d.ts +5 -0
- package/types/icons/users.d.ts +5 -0
- package/types/input-code.d.ts +23 -0
- package/types/shared/input-switch.d.ts +2 -0
- package/types/shared/lib/campaign.d.ts +35 -0
- package/types/shared/lib/helpers.d.ts +3 -0
- package/dist/dashboard/card-integration.js +0 -187
- package/dist/dashboard/card-integration.mjs +0 -158
- package/dist/dashboard/iframe.js +0 -159
- package/dist/dashboard/iframe.mjs +0 -130
- package/types/dashboard/card-integration.d.ts +0 -24
- package/types/dashboard/iframe.d.ts +0 -18
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
3
4
|
import { useForm, Controller, useWatch } from "../shared/lib/form.mjs";
|
|
4
5
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
@@ -9,198 +10,248 @@ import InputGroup from "../input-group.mjs";
|
|
|
9
10
|
import InputSwitch from "../shared/input-switch.mjs";
|
|
10
11
|
import InputText from "../input-text.mjs";
|
|
11
12
|
import InputUrl from "../shared/input-url.mjs";
|
|
12
|
-
import
|
|
13
|
-
import CardSection from "./card-section.mjs";
|
|
13
|
+
import Badge from "../shared/badge.mjs";
|
|
14
14
|
import Button from "../shared/button.mjs";
|
|
15
|
+
const schema = (enforceLink) => yup.object({
|
|
16
|
+
enabled: yup.boolean(),
|
|
17
|
+
label: yup.string().label("Label").when("enabled", ([enabled], field) => Boolean(enabled) ? field.required().max(300) : field),
|
|
18
|
+
link: yup.string().nullable().label("Link").when("enabled", ([enabled], field) => {
|
|
19
|
+
if (!Boolean(enabled)) return field;
|
|
20
|
+
const matches = [regex.url, "Url must start with https"];
|
|
21
|
+
return enforceLink ? field.required().matches(...matches).url().max(300) : field.transform((value) => value ? value : null).matches(...matches).url().max(300);
|
|
22
|
+
})
|
|
23
|
+
});
|
|
15
24
|
const FormOrganizationCampaignAgreement = ({
|
|
25
|
+
agreements = {},
|
|
26
|
+
defaultLabels = {},
|
|
16
27
|
disabled,
|
|
17
|
-
|
|
18
|
-
onSuccess,
|
|
28
|
+
onChange,
|
|
19
29
|
onError,
|
|
20
|
-
|
|
30
|
+
onFocus,
|
|
31
|
+
onSuccess,
|
|
32
|
+
params
|
|
21
33
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
34
|
+
const ids = Object.keys(agreements);
|
|
35
|
+
const { control, handleSubmit, formState, reset } = useForm({
|
|
36
|
+
defaultValues: Object.fromEntries(ids.map((id) => {
|
|
37
|
+
var _a;
|
|
38
|
+
return [id, ((_a = agreements[id]) == null ? void 0 : _a.values) || {}];
|
|
39
|
+
})),
|
|
24
40
|
resolver: resolver(
|
|
25
|
-
yup.object({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return schema.required().max(300);
|
|
30
|
-
}
|
|
31
|
-
return schema;
|
|
32
|
-
}),
|
|
33
|
-
link: yup.string().nullable().label("Link").when("enabled", ([enabled], schema) => {
|
|
34
|
-
if (Boolean(enabled)) {
|
|
35
|
-
const matches = [regex.url, "Url must start with https"];
|
|
36
|
-
if (enforceLink) {
|
|
37
|
-
return schema.required().matches(...matches).url().max(300);
|
|
38
|
-
} else {
|
|
39
|
-
return schema.transform((value) => value ? value : null).matches(...matches).url().max(300);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return schema;
|
|
43
|
-
})
|
|
44
|
-
})
|
|
41
|
+
yup.object(Object.fromEntries(ids.map((id) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return [id, schema((_a = agreements[id]) == null ? void 0 : _a.enforceLink)];
|
|
44
|
+
})))
|
|
45
45
|
)
|
|
46
46
|
});
|
|
47
47
|
const watched = useWatch({
|
|
48
48
|
control
|
|
49
49
|
});
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
const typed = JSON.stringify(watched);
|
|
51
|
+
useEffect(
|
|
52
|
+
() => {
|
|
53
|
+
onChange == null ? void 0 : onChange(watched);
|
|
54
|
+
},
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
[typed]
|
|
57
|
+
);
|
|
58
|
+
const onSubmit = async (values) => {
|
|
55
59
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
let response;
|
|
61
|
+
for (const id of ids.filter((id2) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return (_a = formState == null ? void 0 : formState.dirtyFields) == null ? void 0 : _a[id2];
|
|
64
|
+
})) {
|
|
65
|
+
const { enabled, label, link } = values[id];
|
|
66
|
+
response = await request({
|
|
67
|
+
body: {
|
|
68
|
+
enabled,
|
|
69
|
+
label,
|
|
70
|
+
link
|
|
71
|
+
},
|
|
72
|
+
endpoint: "/organization/" + (params == null ? void 0 : params.organization) + "/campaign/" + (params == null ? void 0 : params.campaign) + "/agreement/" + id,
|
|
73
|
+
method: "PUT"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
;
|
|
77
|
+
reset(values);
|
|
78
|
+
if (response) onSuccess(response);
|
|
67
79
|
} catch (error) {
|
|
68
80
|
onError(error);
|
|
69
81
|
}
|
|
70
82
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
value: value || false
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
label: "Enabled"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
(watched == null ? void 0 : watched.enabled) && /* @__PURE__ */ jsx(
|
|
112
|
-
Controller,
|
|
113
|
-
{
|
|
114
|
-
...{
|
|
115
|
-
control,
|
|
116
|
-
name: "label",
|
|
117
|
-
render: ({ field: { value, onChange } }) => {
|
|
118
|
-
var _a, _b;
|
|
119
|
-
return /* @__PURE__ */ jsx(
|
|
120
|
-
InputGroup,
|
|
121
|
-
{
|
|
122
|
-
...{
|
|
123
|
-
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.label) == null ? void 0 : _b.message,
|
|
124
|
-
input: /* @__PURE__ */ jsx(
|
|
125
|
-
InputText,
|
|
126
|
-
{
|
|
127
|
-
...{
|
|
128
|
-
onChange,
|
|
129
|
-
value: value || ""
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
),
|
|
133
|
-
label: "Label"
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
(watched == null ? void 0 : watched.enabled) && /* @__PURE__ */ jsx(
|
|
142
|
-
Controller,
|
|
143
|
-
{
|
|
144
|
-
...{
|
|
145
|
-
control,
|
|
146
|
-
name: "link",
|
|
147
|
-
render: ({ field: { value, onChange } }) => {
|
|
148
|
-
var _a, _b;
|
|
149
|
-
return /* @__PURE__ */ jsx(
|
|
150
|
-
InputGroup,
|
|
151
|
-
{
|
|
152
|
-
...{
|
|
153
|
-
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.link) == null ? void 0 : _b.message,
|
|
154
|
-
input: /* @__PURE__ */ jsx(
|
|
155
|
-
InputUrl,
|
|
156
|
-
{
|
|
157
|
-
...{
|
|
158
|
-
onChange,
|
|
159
|
-
value: value || ""
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
|
-
label: "Link"
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
);
|
|
83
|
+
const section = (id) => {
|
|
84
|
+
var _a;
|
|
85
|
+
const { active, title, warning } = agreements[id];
|
|
86
|
+
const enabled = (_a = watched == null ? void 0 : watched[id]) == null ? void 0 : _a.enabled;
|
|
87
|
+
const focus = () => onFocus == null ? void 0 : onFocus(id);
|
|
88
|
+
return /* @__PURE__ */ jsxs(
|
|
89
|
+
"section",
|
|
90
|
+
{
|
|
91
|
+
...{
|
|
92
|
+
className: "space-y-6",
|
|
93
|
+
"data-guide": "section-" + id
|
|
94
|
+
},
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsxs(
|
|
97
|
+
"h3",
|
|
98
|
+
{
|
|
99
|
+
...{
|
|
100
|
+
className: "flex items-center gap-2"
|
|
101
|
+
},
|
|
102
|
+
children: [
|
|
103
|
+
title,
|
|
104
|
+
warning && /* @__PURE__ */ jsx(
|
|
105
|
+
Badge,
|
|
106
|
+
{
|
|
107
|
+
...{
|
|
108
|
+
size: "small",
|
|
109
|
+
type: "error"
|
|
110
|
+
},
|
|
111
|
+
children: "Required"
|
|
167
112
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
113
|
+
)
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsxs(
|
|
118
|
+
Fieldset,
|
|
119
|
+
{
|
|
120
|
+
...{
|
|
121
|
+
// An agreement the api marks inactive can't be changed.
|
|
122
|
+
disabled: disabled || !active || (formState == null ? void 0 : formState.isSubmitting)
|
|
123
|
+
},
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
Controller,
|
|
179
127
|
{
|
|
180
128
|
...{
|
|
181
|
-
|
|
182
|
-
|
|
129
|
+
control,
|
|
130
|
+
name: id + ".enabled",
|
|
131
|
+
render: ({ field: { value, onChange: change } }) => /* @__PURE__ */ jsx(
|
|
132
|
+
InputGroup,
|
|
183
133
|
{
|
|
184
134
|
...{
|
|
185
|
-
|
|
186
|
-
label: /* @__PURE__ */ jsx(
|
|
135
|
+
input: /* @__PURE__ */ jsx(
|
|
187
136
|
"span",
|
|
188
137
|
{
|
|
189
|
-
...
|
|
190
|
-
className: "
|
|
138
|
+
...{
|
|
139
|
+
className: "inline-flex",
|
|
140
|
+
onFocus: focus
|
|
191
141
|
},
|
|
192
|
-
children:
|
|
142
|
+
children: /* @__PURE__ */ jsx(
|
|
143
|
+
InputSwitch,
|
|
144
|
+
{
|
|
145
|
+
...{
|
|
146
|
+
onChange: (next) => {
|
|
147
|
+
focus();
|
|
148
|
+
change(next);
|
|
149
|
+
},
|
|
150
|
+
value: value || false
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
)
|
|
193
154
|
}
|
|
194
|
-
)
|
|
155
|
+
),
|
|
156
|
+
label: "Enabled"
|
|
195
157
|
}
|
|
196
158
|
}
|
|
197
159
|
)
|
|
198
160
|
}
|
|
199
161
|
}
|
|
162
|
+
),
|
|
163
|
+
(enabled || defaultLabels[id]) && /* @__PURE__ */ jsx(
|
|
164
|
+
Controller,
|
|
165
|
+
{
|
|
166
|
+
...{
|
|
167
|
+
control,
|
|
168
|
+
name: id + ".label",
|
|
169
|
+
render: ({ field: { value, onChange: change } }) => {
|
|
170
|
+
var _a2, _b, _c;
|
|
171
|
+
return /* @__PURE__ */ jsx(
|
|
172
|
+
InputGroup,
|
|
173
|
+
{
|
|
174
|
+
...{
|
|
175
|
+
error: (_c = (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2[id]) == null ? void 0 : _b.label) == null ? void 0 : _c.message,
|
|
176
|
+
input: /* @__PURE__ */ jsx(
|
|
177
|
+
InputText,
|
|
178
|
+
{
|
|
179
|
+
...{
|
|
180
|
+
onChange: change,
|
|
181
|
+
onFocus: focus,
|
|
182
|
+
...enabled ? {
|
|
183
|
+
value: value || ""
|
|
184
|
+
} : {
|
|
185
|
+
disabled: true,
|
|
186
|
+
value: defaultLabels[id]
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
label: "Label"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
enabled && /* @__PURE__ */ jsx(
|
|
200
|
+
Controller,
|
|
201
|
+
{
|
|
202
|
+
...{
|
|
203
|
+
control,
|
|
204
|
+
name: id + ".link",
|
|
205
|
+
render: ({ field: { value, onChange: change } }) => {
|
|
206
|
+
var _a2, _b, _c;
|
|
207
|
+
return /* @__PURE__ */ jsx(
|
|
208
|
+
InputGroup,
|
|
209
|
+
{
|
|
210
|
+
...{
|
|
211
|
+
error: (_c = (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2[id]) == null ? void 0 : _b.link) == null ? void 0 : _c.message,
|
|
212
|
+
input: /* @__PURE__ */ jsx(
|
|
213
|
+
InputUrl,
|
|
214
|
+
{
|
|
215
|
+
...{
|
|
216
|
+
onChange: change,
|
|
217
|
+
onFocus: focus,
|
|
218
|
+
value: value || ""
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
label: "Link"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
200
229
|
)
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
id
|
|
236
|
+
);
|
|
237
|
+
};
|
|
238
|
+
return /* @__PURE__ */ jsxs(
|
|
239
|
+
Form,
|
|
240
|
+
{
|
|
241
|
+
...{
|
|
242
|
+
// Divided as the Page editor's form, Save under the last section.
|
|
243
|
+
className: "relative w-full divide-y divide-gray [&>*]:py-6 [&>*:first-child]:pt-0 [&>*:last-child]:pb-0",
|
|
244
|
+
onSubmit: handleSubmit(onSubmit)
|
|
245
|
+
},
|
|
246
|
+
children: [
|
|
247
|
+
ids.map(section),
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
Fieldset,
|
|
250
|
+
{
|
|
251
|
+
...{
|
|
252
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
253
|
+
},
|
|
254
|
+
children: /* @__PURE__ */ jsx(
|
|
204
255
|
Button,
|
|
205
256
|
{
|
|
206
257
|
...{
|
|
@@ -210,9 +261,9 @@ const FormOrganizationCampaignAgreement = ({
|
|
|
210
261
|
children: "Save"
|
|
211
262
|
}
|
|
212
263
|
)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
]
|
|
216
267
|
}
|
|
217
268
|
);
|
|
218
269
|
};
|
|
@@ -40,7 +40,6 @@ var import_form2 = __toESM(require("../shared/form"));
|
|
|
40
40
|
var import_fieldset = __toESM(require("../shared/fieldset"));
|
|
41
41
|
var import_input_group = __toESM(require("../input-group"));
|
|
42
42
|
var import_input_text = __toESM(require("../input-text"));
|
|
43
|
-
var import_input_switch = __toESM(require("../shared/input-switch"));
|
|
44
43
|
var import_input_array = require("./input-array");
|
|
45
44
|
var import_trash = __toESM(require("../icons/trash"));
|
|
46
45
|
var import_button = __toESM(require("../shared/button"));
|
|
@@ -90,14 +89,12 @@ const FormOrganizationCampaignFieldEmail = ({
|
|
|
90
89
|
});
|
|
91
90
|
const onSubmit = async ({
|
|
92
91
|
label,
|
|
93
|
-
primary,
|
|
94
92
|
settings = {}
|
|
95
93
|
}) => {
|
|
96
94
|
try {
|
|
97
95
|
const args = {
|
|
98
96
|
body: {
|
|
99
97
|
label,
|
|
100
|
-
primary,
|
|
101
98
|
settings,
|
|
102
99
|
slug: values == null ? void 0 : values.slug,
|
|
103
100
|
type: values == null ? void 0 : values.type
|
|
@@ -161,37 +158,6 @@ const FormOrganizationCampaignFieldEmail = ({
|
|
|
161
158
|
}
|
|
162
159
|
}
|
|
163
160
|
),
|
|
164
|
-
(values == null ? void 0 : values.id) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
|
-
import_form.Controller,
|
|
166
|
-
{
|
|
167
|
-
...{
|
|
168
|
-
control,
|
|
169
|
-
name: "primary",
|
|
170
|
-
render: ({ field: { value, onChange } }) => {
|
|
171
|
-
var _a2, _b2;
|
|
172
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
173
|
-
import_input_group.default,
|
|
174
|
-
{
|
|
175
|
-
...{
|
|
176
|
-
error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.primary) == null ? void 0 : _b2.message,
|
|
177
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
-
import_input_switch.default,
|
|
179
|
-
{
|
|
180
|
-
...{
|
|
181
|
-
disabled: Boolean(values.primary) || !inputs.includes("primary"),
|
|
182
|
-
onChange,
|
|
183
|
-
value: value || false
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
label: "Primary"
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
),
|
|
195
161
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
196
162
|
import_input_group.default,
|
|
197
163
|
{
|
|
@@ -8,7 +8,6 @@ import Form from "../shared/form.mjs";
|
|
|
8
8
|
import Fieldset from "../shared/fieldset.mjs";
|
|
9
9
|
import InputGroup from "../input-group.mjs";
|
|
10
10
|
import InputText from "../input-text.mjs";
|
|
11
|
-
import InputSwitch from "../shared/input-switch.mjs";
|
|
12
11
|
import { InputArray, InputArrayButton, InputArrayControl } from "./input-array.mjs";
|
|
13
12
|
import Trash from "../icons/trash.mjs";
|
|
14
13
|
import Button from "../shared/button.mjs";
|
|
@@ -58,14 +57,12 @@ const FormOrganizationCampaignFieldEmail = ({
|
|
|
58
57
|
});
|
|
59
58
|
const onSubmit = async ({
|
|
60
59
|
label,
|
|
61
|
-
primary,
|
|
62
60
|
settings = {}
|
|
63
61
|
}) => {
|
|
64
62
|
try {
|
|
65
63
|
const args = {
|
|
66
64
|
body: {
|
|
67
65
|
label,
|
|
68
|
-
primary,
|
|
69
66
|
settings,
|
|
70
67
|
slug: values == null ? void 0 : values.slug,
|
|
71
68
|
type: values == null ? void 0 : values.type
|
|
@@ -129,37 +126,6 @@ const FormOrganizationCampaignFieldEmail = ({
|
|
|
129
126
|
}
|
|
130
127
|
}
|
|
131
128
|
),
|
|
132
|
-
(values == null ? void 0 : values.id) && /* @__PURE__ */ jsx(
|
|
133
|
-
Controller,
|
|
134
|
-
{
|
|
135
|
-
...{
|
|
136
|
-
control,
|
|
137
|
-
name: "primary",
|
|
138
|
-
render: ({ field: { value, onChange } }) => {
|
|
139
|
-
var _a2, _b2;
|
|
140
|
-
return /* @__PURE__ */ jsx(
|
|
141
|
-
InputGroup,
|
|
142
|
-
{
|
|
143
|
-
...{
|
|
144
|
-
error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.primary) == null ? void 0 : _b2.message,
|
|
145
|
-
input: /* @__PURE__ */ jsx(
|
|
146
|
-
InputSwitch,
|
|
147
|
-
{
|
|
148
|
-
...{
|
|
149
|
-
disabled: Boolean(values.primary) || !inputs.includes("primary"),
|
|
150
|
-
onChange,
|
|
151
|
-
value: value || false
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
),
|
|
155
|
-
label: "Primary"
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
129
|
/* @__PURE__ */ jsx(
|
|
164
130
|
InputGroup,
|
|
165
131
|
{
|