@drawbridge/components 0.1.13 → 0.1.15
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 +577 -0
- package/dist/bridge/form-subdomain-missions.mjs +540 -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 +277 -0
- package/dist/dashboard/card-campaign-switch.mjs +243 -0
- package/dist/dashboard/card-order.js +231 -29
- package/dist/dashboard/card-order.mjs +231 -29
- 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 +205 -0
- package/dist/dashboard/connection-workflows.mjs +171 -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-field-select.js +51 -5
- package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
- package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
- package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
- 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 +243 -0
- package/dist/dashboard/form-organization-campaign-section.mjs +214 -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 +708 -687
- package/dist/dashboard/form-organization-workflow.mjs +704 -683
- 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 +20 -7
- package/dist/dashboard/template-socket.mjs +20 -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 +83 -0
- package/dist/input-code.mjs +50 -0
- package/dist/input-text.js +2 -1
- package/dist/input-text.mjs +2 -1
- package/dist/shared/button.js +1 -1
- package/dist/shared/button.mjs +1 -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 +123 -0
- package/dist/shared/lib/campaign.mjs +96 -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 +38 -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 +25 -1
- 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 +29 -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 +56 -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,13 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
3
|
-
import { useForm, FormProvider
|
|
3
|
+
import { useForm, FormProvider } from "../shared/lib/form.mjs";
|
|
4
4
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
5
5
|
import { InputFieldsCampaign, schemas } from "./input-fields.mjs";
|
|
6
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
7
6
|
import Form from "../shared/form.mjs";
|
|
8
7
|
import Fieldset from "../shared/fieldset.mjs";
|
|
9
|
-
import InputGroup from "../input-group.mjs";
|
|
10
|
-
import InputCombobox from "./input-combobox.mjs";
|
|
11
8
|
import Button from "../shared/button.mjs";
|
|
12
9
|
const FormAdminCampaign = ({
|
|
13
10
|
disabled,
|
|
@@ -15,36 +12,41 @@ const FormAdminCampaign = ({
|
|
|
15
12
|
onError,
|
|
16
13
|
values
|
|
17
14
|
}) => {
|
|
18
|
-
var _a;
|
|
19
|
-
const queryClient = useQueryClient();
|
|
20
|
-
const app = queryClient.getQueryData(["app"]);
|
|
15
|
+
var _a, _b;
|
|
21
16
|
const methods = useForm({
|
|
22
17
|
// Reactive `values` (not `defaultValues`): this form stays mounted on
|
|
23
18
|
// the admin campaign page, so the save-then-refetch cycle must rebase
|
|
24
19
|
// the baseline or the unsaved-changes guard would stay armed.
|
|
20
|
+
// @story campaigns/giveaway-module
|
|
21
|
+
// The two switches, read off the campaign; the api applies the rule
|
|
22
|
+
// between them again on the PUT.
|
|
25
23
|
values: {
|
|
26
24
|
...values,
|
|
27
|
-
|
|
25
|
+
form: Boolean((_a = values == null ? void 0 : values.form) == null ? void 0 : _a.enabled),
|
|
26
|
+
giveaway: Boolean((_b = values == null ? void 0 : values.giveaway) == null ? void 0 : _b.enabled)
|
|
28
27
|
},
|
|
29
28
|
resolver: resolver(
|
|
30
29
|
yup.object({
|
|
31
|
-
...schemas.campaign(
|
|
32
|
-
status: yup.string().label("Status").required().oneOf(app.enums.campaign.status.enum)
|
|
30
|
+
...schemas.campaign()
|
|
33
31
|
})
|
|
34
32
|
)
|
|
35
33
|
});
|
|
36
34
|
const { control, handleSubmit, formState } = methods;
|
|
37
35
|
const onSubmit = async ({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
form,
|
|
37
|
+
giveaway,
|
|
38
|
+
title
|
|
41
39
|
}) => {
|
|
42
40
|
try {
|
|
43
41
|
const response = await request({
|
|
44
42
|
body: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
form: {
|
|
44
|
+
enabled: form
|
|
45
|
+
},
|
|
46
|
+
giveaway: {
|
|
47
|
+
enabled: giveaway
|
|
48
|
+
},
|
|
49
|
+
title
|
|
48
50
|
},
|
|
49
51
|
endpoint: "/admin/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id),
|
|
50
52
|
method: "PUT"
|
|
@@ -62,46 +64,13 @@ const FormAdminCampaign = ({
|
|
|
62
64
|
onSubmit: handleSubmit(onSubmit)
|
|
63
65
|
},
|
|
64
66
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
66
68
|
Fieldset,
|
|
67
69
|
{
|
|
68
70
|
...{
|
|
69
71
|
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
70
72
|
},
|
|
71
|
-
children:
|
|
72
|
-
/* @__PURE__ */ jsx(InputFieldsCampaign, {}),
|
|
73
|
-
/* @__PURE__ */ jsx(
|
|
74
|
-
Controller,
|
|
75
|
-
{
|
|
76
|
-
...{
|
|
77
|
-
control,
|
|
78
|
-
name: "status",
|
|
79
|
-
render: ({ field: { value, onChange } }) => {
|
|
80
|
-
var _a2, _b;
|
|
81
|
-
return /* @__PURE__ */ jsx(
|
|
82
|
-
InputGroup,
|
|
83
|
-
{
|
|
84
|
-
...{
|
|
85
|
-
error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.status) == null ? void 0 : _b.message,
|
|
86
|
-
input: /* @__PURE__ */ jsx(
|
|
87
|
-
InputCombobox,
|
|
88
|
-
{
|
|
89
|
-
...{
|
|
90
|
-
onChange,
|
|
91
|
-
options: app.enums.campaign.status.options,
|
|
92
|
-
value
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
label: "Status"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
]
|
|
73
|
+
children: /* @__PURE__ */ jsx(InputFieldsCampaign, {})
|
|
105
74
|
}
|
|
106
75
|
),
|
|
107
76
|
/* @__PURE__ */ jsx(
|
|
@@ -201,32 +201,35 @@ const FormAiCampaign = ({
|
|
|
201
201
|
onSuccess,
|
|
202
202
|
values
|
|
203
203
|
}) => {
|
|
204
|
-
const queryClient = (0, import_react_query.useQueryClient)();
|
|
205
|
-
const app = queryClient.getQueryData(["app"]);
|
|
206
204
|
const methods = (0, import_form.useForm)({
|
|
207
205
|
guard: false,
|
|
208
206
|
resolver: (0, import_yup.resolver)(
|
|
209
207
|
import_yup.default.object({
|
|
210
|
-
...import_input_fields.schemas.campaign(
|
|
208
|
+
...import_input_fields.schemas.campaign(),
|
|
211
209
|
url: import_yup.default.string().label("Url").max(150).matches(import_drawbridge_utils.regex.url, "Url must start with https").required().url()
|
|
212
210
|
})
|
|
213
211
|
),
|
|
212
|
+
// @story campaigns/generate-ai
|
|
213
|
+
// Both switches start on.
|
|
214
214
|
values: {
|
|
215
|
-
|
|
215
|
+
form: true,
|
|
216
|
+
giveaway: true,
|
|
216
217
|
...values
|
|
217
218
|
}
|
|
218
219
|
});
|
|
219
220
|
const { control, formState, handleSubmit } = methods;
|
|
220
221
|
const onSubmit = async ({
|
|
222
|
+
form,
|
|
223
|
+
giveaway,
|
|
221
224
|
title,
|
|
222
|
-
type,
|
|
223
225
|
url
|
|
224
226
|
}) => {
|
|
225
227
|
try {
|
|
226
228
|
const args = {
|
|
227
229
|
body: {
|
|
230
|
+
form,
|
|
231
|
+
giveaway,
|
|
228
232
|
title,
|
|
229
|
-
type,
|
|
230
233
|
url
|
|
231
234
|
},
|
|
232
235
|
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/ai/campaign",
|
|
@@ -165,32 +165,35 @@ const FormAiCampaign = ({
|
|
|
165
165
|
onSuccess,
|
|
166
166
|
values
|
|
167
167
|
}) => {
|
|
168
|
-
const queryClient = useQueryClient();
|
|
169
|
-
const app = queryClient.getQueryData(["app"]);
|
|
170
168
|
const methods = useForm({
|
|
171
169
|
guard: false,
|
|
172
170
|
resolver: resolver(
|
|
173
171
|
yup.object({
|
|
174
|
-
...schemas.campaign(
|
|
172
|
+
...schemas.campaign(),
|
|
175
173
|
url: yup.string().label("Url").max(150).matches(regex.url, "Url must start with https").required().url()
|
|
176
174
|
})
|
|
177
175
|
),
|
|
176
|
+
// @story campaigns/generate-ai
|
|
177
|
+
// Both switches start on.
|
|
178
178
|
values: {
|
|
179
|
-
|
|
179
|
+
form: true,
|
|
180
|
+
giveaway: true,
|
|
180
181
|
...values
|
|
181
182
|
}
|
|
182
183
|
});
|
|
183
184
|
const { control, formState, handleSubmit } = methods;
|
|
184
185
|
const onSubmit = async ({
|
|
186
|
+
form,
|
|
187
|
+
giveaway,
|
|
185
188
|
title,
|
|
186
|
-
type,
|
|
187
189
|
url
|
|
188
190
|
}) => {
|
|
189
191
|
try {
|
|
190
192
|
const args = {
|
|
191
193
|
body: {
|
|
194
|
+
form,
|
|
195
|
+
giveaway,
|
|
192
196
|
title,
|
|
193
|
-
type,
|
|
194
197
|
url
|
|
195
198
|
},
|
|
196
199
|
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/ai/campaign",
|
|
@@ -552,7 +552,7 @@ const FormProviders = ({
|
|
|
552
552
|
referrer,
|
|
553
553
|
utm = null
|
|
554
554
|
}) => {
|
|
555
|
-
var _a;
|
|
555
|
+
var _a, _b;
|
|
556
556
|
const query = (0, import_react_query.useQuery)({
|
|
557
557
|
queryKey: ["auth-providers"],
|
|
558
558
|
queryFn: async () => {
|
|
@@ -562,31 +562,41 @@ const FormProviders = ({
|
|
|
562
562
|
return result || {};
|
|
563
563
|
}
|
|
564
564
|
});
|
|
565
|
-
if (query.isError) return null;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
ready: query.isSuccess,
|
|
574
|
-
redirectTo,
|
|
575
|
-
referrer,
|
|
576
|
-
utm
|
|
565
|
+
if (query.isError || query.isSuccess && !((_b = (_a = query.data) == null ? void 0 : _a.providers) == null ? void 0 : _b.google)) return null;
|
|
566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
567
|
+
"div",
|
|
568
|
+
{
|
|
569
|
+
...{
|
|
570
|
+
className: query.isSuccess ? "contents" : "contents invisible",
|
|
571
|
+
...!query.isSuccess && {
|
|
572
|
+
"aria-hidden": true
|
|
577
573
|
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
574
|
+
},
|
|
575
|
+
children: [
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
577
|
+
FormAuthGoogle,
|
|
578
|
+
{
|
|
579
|
+
...{
|
|
580
|
+
action,
|
|
581
|
+
ready: query.isSuccess,
|
|
582
|
+
redirectTo,
|
|
583
|
+
referrer,
|
|
584
|
+
utm
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
589
|
+
import_divider.default,
|
|
590
|
+
{
|
|
591
|
+
...{
|
|
592
|
+
classNameLabel: "bg-gray-light"
|
|
593
|
+
},
|
|
594
|
+
children: "or"
|
|
595
|
+
}
|
|
596
|
+
)
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
);
|
|
590
600
|
};
|
|
591
601
|
// Annotate the CommonJS export names for ESM import in node:
|
|
592
602
|
0 && (module.exports = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect } from "react";
|
|
3
3
|
import { useForm, Controller } from "../shared/lib/form.mjs";
|
|
4
4
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
5
5
|
import { useGoogleReCaptcha } from "react-google-recaptcha-v3";
|
|
@@ -517,7 +517,7 @@ const FormProviders = ({
|
|
|
517
517
|
referrer,
|
|
518
518
|
utm = null
|
|
519
519
|
}) => {
|
|
520
|
-
var _a;
|
|
520
|
+
var _a, _b;
|
|
521
521
|
const query = useQuery({
|
|
522
522
|
queryKey: ["auth-providers"],
|
|
523
523
|
queryFn: async () => {
|
|
@@ -527,31 +527,41 @@ const FormProviders = ({
|
|
|
527
527
|
return result || {};
|
|
528
528
|
}
|
|
529
529
|
});
|
|
530
|
-
if (query.isError) return null;
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
ready: query.isSuccess,
|
|
539
|
-
redirectTo,
|
|
540
|
-
referrer,
|
|
541
|
-
utm
|
|
530
|
+
if (query.isError || query.isSuccess && !((_b = (_a = query.data) == null ? void 0 : _a.providers) == null ? void 0 : _b.google)) return null;
|
|
531
|
+
return /* @__PURE__ */ jsxs(
|
|
532
|
+
"div",
|
|
533
|
+
{
|
|
534
|
+
...{
|
|
535
|
+
className: query.isSuccess ? "contents" : "contents invisible",
|
|
536
|
+
...!query.isSuccess && {
|
|
537
|
+
"aria-hidden": true
|
|
542
538
|
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
539
|
+
},
|
|
540
|
+
children: [
|
|
541
|
+
/* @__PURE__ */ jsx(
|
|
542
|
+
FormAuthGoogle,
|
|
543
|
+
{
|
|
544
|
+
...{
|
|
545
|
+
action,
|
|
546
|
+
ready: query.isSuccess,
|
|
547
|
+
redirectTo,
|
|
548
|
+
referrer,
|
|
549
|
+
utm
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
/* @__PURE__ */ jsx(
|
|
554
|
+
Divider,
|
|
555
|
+
{
|
|
556
|
+
...{
|
|
557
|
+
classNameLabel: "bg-gray-light"
|
|
558
|
+
},
|
|
559
|
+
children: "or"
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
]
|
|
563
|
+
}
|
|
564
|
+
);
|
|
555
565
|
};
|
|
556
566
|
export {
|
|
557
567
|
FormAuthEmail,
|
|
@@ -198,9 +198,18 @@ const FileSelect = ({
|
|
|
198
198
|
endpoint: endpoint + "/files",
|
|
199
199
|
params,
|
|
200
200
|
queryKey: ["file-list", endpoint, params],
|
|
201
|
+
// The picker opens in a modal, which is white: the grey box.
|
|
201
202
|
empty: (query) => {
|
|
202
203
|
var _a;
|
|
203
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
205
|
+
import_empty.default,
|
|
206
|
+
{
|
|
207
|
+
...{
|
|
208
|
+
variant: "secondary"
|
|
209
|
+
},
|
|
210
|
+
children: ((_a = query == null ? void 0 : query.error) == null ? void 0 : _a.message) || "No files found"
|
|
211
|
+
}
|
|
212
|
+
);
|
|
204
213
|
}
|
|
205
214
|
},
|
|
206
215
|
children: ({ items, pageInfo }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -166,9 +166,18 @@ const FileSelect = ({
|
|
|
166
166
|
endpoint: endpoint + "/files",
|
|
167
167
|
params,
|
|
168
168
|
queryKey: ["file-list", endpoint, params],
|
|
169
|
+
// The picker opens in a modal, which is white: the grey box.
|
|
169
170
|
empty: (query) => {
|
|
170
171
|
var _a;
|
|
171
|
-
return /* @__PURE__ */ jsx(
|
|
172
|
+
return /* @__PURE__ */ jsx(
|
|
173
|
+
Empty,
|
|
174
|
+
{
|
|
175
|
+
...{
|
|
176
|
+
variant: "secondary"
|
|
177
|
+
},
|
|
178
|
+
children: ((_a = query == null ? void 0 : query.error) == null ? void 0 : _a.message) || "No files found"
|
|
179
|
+
}
|
|
180
|
+
);
|
|
172
181
|
}
|
|
173
182
|
},
|
|
174
183
|
children: ({ items, pageInfo }) => /* @__PURE__ */ jsxs(
|
|
@@ -50,6 +50,8 @@ const FormFiltersAnalytics = ({
|
|
|
50
50
|
}) => {
|
|
51
51
|
const [dateMode, setDateMode] = (0, import_react.useState)((filters == null ? void 0 : filters.start) ? 1 : 0);
|
|
52
52
|
const now = /* @__PURE__ */ new Date();
|
|
53
|
+
const thisMonth = String(now.getMonth() + 1).padStart(2, "0");
|
|
54
|
+
const today = now.getFullYear() + "-" + thisMonth + "-" + String(now.getDate()).padStart(2, "0");
|
|
53
55
|
const { control, handleSubmit, formState, register, setValue } = (0, import_form.useForm)({
|
|
54
56
|
// Filters aren't unsaved data. Guarded, the trap it pushed took the
|
|
55
57
|
// ?filters= that Filter wrote, and closing the drawer stepped back off
|
|
@@ -64,6 +66,15 @@ const FormFiltersAnalytics = ({
|
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
68
|
register("filters");
|
|
69
|
+
const year = (0, import_form.useWatch)({ control, name: "filters.year", defaultValue: filters == null ? void 0 : filters.year }) || now.getFullYear();
|
|
70
|
+
const month = (0, import_form.useWatch)({ control, name: "filters.month", defaultValue: filters == null ? void 0 : filters.month });
|
|
71
|
+
const isThisYear = Number(year) === now.getFullYear();
|
|
72
|
+
(0, import_react.useEffect)(
|
|
73
|
+
() => {
|
|
74
|
+
if (isThisYear && month > thisMonth) setValue("filters.month", thisMonth);
|
|
75
|
+
},
|
|
76
|
+
[isThisYear, month, setValue, thisMonth]
|
|
77
|
+
);
|
|
67
78
|
const dateRangeStart = (0, import_form.useWatch)({ control, name: "filters.start", defaultValue: filters == null ? void 0 : filters.start }) || "";
|
|
68
79
|
const dateRangeEnd = (0, import_form.useWatch)({ control, name: "filters.end", defaultValue: filters == null ? void 0 : filters.end }) || "";
|
|
69
80
|
const campaign = (0, import_form.useWatch)({ control, name: "filters.campaign", defaultValue: filters == null ? void 0 : filters.campaign }) || null;
|
|
@@ -123,7 +134,8 @@ const FormFiltersAnalytics = ({
|
|
|
123
134
|
{
|
|
124
135
|
...{
|
|
125
136
|
onChange,
|
|
126
|
-
|
|
137
|
+
// The list as given unless a later month has to go.
|
|
138
|
+
options: key === "month" && isThisYear && (options || []).some((option) => option.value > thisMonth) ? options.filter((option) => option.value <= thisMonth) : options,
|
|
127
139
|
searchable: Boolean(searchable),
|
|
128
140
|
// An unset filter is undefined; the "all" option's
|
|
129
141
|
// value is '' so it shows as selected by default.
|
|
@@ -239,6 +251,7 @@ const FormFiltersAnalytics = ({
|
|
|
239
251
|
import_input_date.InputDateRange,
|
|
240
252
|
{
|
|
241
253
|
...{
|
|
254
|
+
max: today,
|
|
242
255
|
value: {
|
|
243
256
|
start: dateRangeStart,
|
|
244
257
|
end: dateRangeEnd
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
3
|
import { useForm, useWatch, Controller } from "../shared/lib/form.mjs";
|
|
4
4
|
import { capitalize } from "@drawbridge/drawbridge-utils";
|
|
5
5
|
import Form from "../shared/form.mjs";
|
|
@@ -18,6 +18,8 @@ const FormFiltersAnalytics = ({
|
|
|
18
18
|
}) => {
|
|
19
19
|
const [dateMode, setDateMode] = useState((filters == null ? void 0 : filters.start) ? 1 : 0);
|
|
20
20
|
const now = /* @__PURE__ */ new Date();
|
|
21
|
+
const thisMonth = String(now.getMonth() + 1).padStart(2, "0");
|
|
22
|
+
const today = now.getFullYear() + "-" + thisMonth + "-" + String(now.getDate()).padStart(2, "0");
|
|
21
23
|
const { control, handleSubmit, formState, register, setValue } = useForm({
|
|
22
24
|
// Filters aren't unsaved data. Guarded, the trap it pushed took the
|
|
23
25
|
// ?filters= that Filter wrote, and closing the drawer stepped back off
|
|
@@ -32,6 +34,15 @@ const FormFiltersAnalytics = ({
|
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
register("filters");
|
|
37
|
+
const year = useWatch({ control, name: "filters.year", defaultValue: filters == null ? void 0 : filters.year }) || now.getFullYear();
|
|
38
|
+
const month = useWatch({ control, name: "filters.month", defaultValue: filters == null ? void 0 : filters.month });
|
|
39
|
+
const isThisYear = Number(year) === now.getFullYear();
|
|
40
|
+
useEffect(
|
|
41
|
+
() => {
|
|
42
|
+
if (isThisYear && month > thisMonth) setValue("filters.month", thisMonth);
|
|
43
|
+
},
|
|
44
|
+
[isThisYear, month, setValue, thisMonth]
|
|
45
|
+
);
|
|
35
46
|
const dateRangeStart = useWatch({ control, name: "filters.start", defaultValue: filters == null ? void 0 : filters.start }) || "";
|
|
36
47
|
const dateRangeEnd = useWatch({ control, name: "filters.end", defaultValue: filters == null ? void 0 : filters.end }) || "";
|
|
37
48
|
const campaign = useWatch({ control, name: "filters.campaign", defaultValue: filters == null ? void 0 : filters.campaign }) || null;
|
|
@@ -91,7 +102,8 @@ const FormFiltersAnalytics = ({
|
|
|
91
102
|
{
|
|
92
103
|
...{
|
|
93
104
|
onChange,
|
|
94
|
-
|
|
105
|
+
// The list as given unless a later month has to go.
|
|
106
|
+
options: key === "month" && isThisYear && (options || []).some((option) => option.value > thisMonth) ? options.filter((option) => option.value <= thisMonth) : options,
|
|
95
107
|
searchable: Boolean(searchable),
|
|
96
108
|
// An unset filter is undefined; the "all" option's
|
|
97
109
|
// value is '' so it shows as selected by default.
|
|
@@ -207,6 +219,7 @@ const FormFiltersAnalytics = ({
|
|
|
207
219
|
InputDateRange,
|
|
208
220
|
{
|
|
209
221
|
...{
|
|
222
|
+
max: today,
|
|
210
223
|
value: {
|
|
211
224
|
start: dateRangeStart,
|
|
212
225
|
end: dateRangeEnd
|
|
@@ -71,14 +71,19 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
71
71
|
schema.url = import_yup.default.string().label("Url").max(150).matches(import_drawbridge_utils.regex.url, "Url must start with https").required().url();
|
|
72
72
|
}
|
|
73
73
|
;
|
|
74
|
-
const { control, handleSubmit, formState, getValues } = (0, import_form.useForm)({
|
|
74
|
+
const { control, handleSubmit, formState, getValues, setValue } = (0, import_form.useForm)({
|
|
75
75
|
resolver: (0, import_yup.resolver)(
|
|
76
76
|
import_yup.default.object(schema)
|
|
77
77
|
),
|
|
78
78
|
values
|
|
79
79
|
});
|
|
80
|
+
const described = (0, import_form.useWatch)({
|
|
81
|
+
control,
|
|
82
|
+
name: "descriptions.asset"
|
|
83
|
+
});
|
|
80
84
|
const onSubmit = async ({
|
|
81
85
|
action,
|
|
86
|
+
descriptions,
|
|
82
87
|
file,
|
|
83
88
|
status,
|
|
84
89
|
title,
|
|
@@ -90,6 +95,10 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
90
95
|
body: {
|
|
91
96
|
action,
|
|
92
97
|
asset: file == null ? void 0 : file.id,
|
|
98
|
+
// A product's ad has no Image or video field, so nothing to send.
|
|
99
|
+
...!(values == null ? void 0 : values.product) && {
|
|
100
|
+
descriptions: descriptions || {}
|
|
101
|
+
},
|
|
93
102
|
status,
|
|
94
103
|
title,
|
|
95
104
|
url,
|
|
@@ -309,6 +318,7 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
309
318
|
import_input_file.default,
|
|
310
319
|
{
|
|
311
320
|
...{
|
|
321
|
+
description: described,
|
|
312
322
|
endpoint: "/organization/" + values.organization,
|
|
313
323
|
organization,
|
|
314
324
|
onChange: (val) => {
|
|
@@ -317,6 +327,10 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
317
327
|
file: val
|
|
318
328
|
});
|
|
319
329
|
},
|
|
330
|
+
onDescription: (text) => {
|
|
331
|
+
setValue("descriptions.asset", text, { shouldDirty: true });
|
|
332
|
+
preview();
|
|
333
|
+
},
|
|
320
334
|
type: "media",
|
|
321
335
|
value: value || ""
|
|
322
336
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
3
|
-
import { useForm, Controller } from "../shared/lib/form.mjs";
|
|
3
|
+
import { useForm, Controller, useWatch } from "../shared/lib/form.mjs";
|
|
4
4
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
5
5
|
import { useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { regex } from "@drawbridge/drawbridge-utils";
|
|
@@ -38,14 +38,19 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
38
38
|
schema.url = yup.string().label("Url").max(150).matches(regex.url, "Url must start with https").required().url();
|
|
39
39
|
}
|
|
40
40
|
;
|
|
41
|
-
const { control, handleSubmit, formState, getValues } = useForm({
|
|
41
|
+
const { control, handleSubmit, formState, getValues, setValue } = useForm({
|
|
42
42
|
resolver: resolver(
|
|
43
43
|
yup.object(schema)
|
|
44
44
|
),
|
|
45
45
|
values
|
|
46
46
|
});
|
|
47
|
+
const described = useWatch({
|
|
48
|
+
control,
|
|
49
|
+
name: "descriptions.asset"
|
|
50
|
+
});
|
|
47
51
|
const onSubmit = async ({
|
|
48
52
|
action,
|
|
53
|
+
descriptions,
|
|
49
54
|
file,
|
|
50
55
|
status,
|
|
51
56
|
title,
|
|
@@ -57,6 +62,10 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
57
62
|
body: {
|
|
58
63
|
action,
|
|
59
64
|
asset: file == null ? void 0 : file.id,
|
|
65
|
+
// A product's ad has no Image or video field, so nothing to send.
|
|
66
|
+
...!(values == null ? void 0 : values.product) && {
|
|
67
|
+
descriptions: descriptions || {}
|
|
68
|
+
},
|
|
60
69
|
status,
|
|
61
70
|
title,
|
|
62
71
|
url,
|
|
@@ -276,6 +285,7 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
276
285
|
InputFile,
|
|
277
286
|
{
|
|
278
287
|
...{
|
|
288
|
+
description: described,
|
|
279
289
|
endpoint: "/organization/" + values.organization,
|
|
280
290
|
organization,
|
|
281
291
|
onChange: (val) => {
|
|
@@ -284,6 +294,10 @@ const FormOrganizationCampaignAdvertisementEdit = ({
|
|
|
284
294
|
file: val
|
|
285
295
|
});
|
|
286
296
|
},
|
|
297
|
+
onDescription: (text) => {
|
|
298
|
+
setValue("descriptions.asset", text, { shouldDirty: true });
|
|
299
|
+
preview();
|
|
300
|
+
},
|
|
287
301
|
type: "media",
|
|
288
302
|
value: value || ""
|
|
289
303
|
}
|