@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
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var form_organization_campaign_section_exports = {};
|
|
29
|
+
__export(form_organization_campaign_section_exports, {
|
|
30
|
+
default: () => form_organization_campaign_section_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(form_organization_campaign_section_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_form = require("../shared/lib/form");
|
|
35
|
+
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
36
|
+
var import_yup = __toESM(require("../shared/lib/yup"));
|
|
37
|
+
var import_form2 = __toESM(require("../shared/form"));
|
|
38
|
+
var import_fieldset = __toESM(require("../shared/fieldset"));
|
|
39
|
+
var import_input_group = __toESM(require("../input-group"));
|
|
40
|
+
var import_input_text = __toESM(require("../input-text"));
|
|
41
|
+
var import_input_textarea = __toESM(require("../input-textarea"));
|
|
42
|
+
var import_input_switch = __toESM(require("../shared/input-switch"));
|
|
43
|
+
var import_button = __toESM(require("../shared/button"));
|
|
44
|
+
var import_tooltip = __toESM(require("../shared/tooltip"));
|
|
45
|
+
const FormOrganizationCampaignSection = ({
|
|
46
|
+
disabled,
|
|
47
|
+
onError,
|
|
48
|
+
onSuccess,
|
|
49
|
+
values
|
|
50
|
+
}) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const order = (values == null ? void 0 : values.type) === "order";
|
|
53
|
+
const locked = order && (values == null ? void 0 : values.giveaway) ? "Turn off the giveaway to take orders" : null;
|
|
54
|
+
const { control, formState, handleSubmit } = (0, import_form.useForm)({
|
|
55
|
+
resolver: (0, import_yup.resolver)(
|
|
56
|
+
import_yup.default.object({
|
|
57
|
+
description: import_yup.default.string().label("Description").max(300).nullable(),
|
|
58
|
+
enabled: import_yup.default.boolean(),
|
|
59
|
+
prices: import_yup.default.boolean(),
|
|
60
|
+
title: import_yup.default.string().label("Title").required().max(150)
|
|
61
|
+
})
|
|
62
|
+
),
|
|
63
|
+
values: {
|
|
64
|
+
description: (values == null ? void 0 : values.description) || "",
|
|
65
|
+
enabled: (values == null ? void 0 : values.enabled) !== false,
|
|
66
|
+
prices: ((_a = values == null ? void 0 : values.settings) == null ? void 0 : _a.prices) !== false,
|
|
67
|
+
title: (values == null ? void 0 : values.title) || ""
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const onSubmit = async ({
|
|
71
|
+
description,
|
|
72
|
+
enabled,
|
|
73
|
+
prices,
|
|
74
|
+
title
|
|
75
|
+
}) => {
|
|
76
|
+
try {
|
|
77
|
+
const response = await (0, import_fetch.request)({
|
|
78
|
+
body: {
|
|
79
|
+
description: description || null,
|
|
80
|
+
...order && {
|
|
81
|
+
...!locked && {
|
|
82
|
+
enabled
|
|
83
|
+
},
|
|
84
|
+
prices
|
|
85
|
+
},
|
|
86
|
+
title
|
|
87
|
+
},
|
|
88
|
+
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/section/" + (values == null ? void 0 : values.id),
|
|
89
|
+
method: "PUT"
|
|
90
|
+
});
|
|
91
|
+
onSuccess(response);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
onError(error);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const toggle = (key, label, message, lock) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
import_form.Controller,
|
|
98
|
+
{
|
|
99
|
+
...{
|
|
100
|
+
control,
|
|
101
|
+
name: key,
|
|
102
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
|
+
import_input_group.default,
|
|
104
|
+
{
|
|
105
|
+
...{
|
|
106
|
+
input: lock ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
|
+
import_tooltip.default,
|
|
108
|
+
{
|
|
109
|
+
...{
|
|
110
|
+
content: lock
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
113
|
+
import_input_switch.default,
|
|
114
|
+
{
|
|
115
|
+
...{
|
|
116
|
+
disabled: true,
|
|
117
|
+
value: false
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
|
+
import_input_switch.default,
|
|
124
|
+
{
|
|
125
|
+
...{
|
|
126
|
+
onChange,
|
|
127
|
+
value: Boolean(value)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
label,
|
|
132
|
+
message
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
key
|
|
139
|
+
);
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
141
|
+
import_form2.default,
|
|
142
|
+
{
|
|
143
|
+
...{
|
|
144
|
+
className: "relative w-full space-y-6",
|
|
145
|
+
onSubmit: handleSubmit(onSubmit)
|
|
146
|
+
},
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
149
|
+
import_fieldset.default,
|
|
150
|
+
{
|
|
151
|
+
...{
|
|
152
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
153
|
+
},
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
import_form.Controller,
|
|
157
|
+
{
|
|
158
|
+
...{
|
|
159
|
+
control,
|
|
160
|
+
name: "title",
|
|
161
|
+
render: ({ field: { value, onChange } }) => {
|
|
162
|
+
var _a2, _b;
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
import_input_group.default,
|
|
165
|
+
{
|
|
166
|
+
...{
|
|
167
|
+
error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.title) == null ? void 0 : _b.message,
|
|
168
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
169
|
+
import_input_text.default,
|
|
170
|
+
{
|
|
171
|
+
...{
|
|
172
|
+
onChange,
|
|
173
|
+
value: value || ""
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
label: "Title"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
186
|
+
import_form.Controller,
|
|
187
|
+
{
|
|
188
|
+
...{
|
|
189
|
+
control,
|
|
190
|
+
name: "description",
|
|
191
|
+
render: ({ field: { value, onChange } }) => {
|
|
192
|
+
var _a2, _b;
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
194
|
+
import_input_group.default,
|
|
195
|
+
{
|
|
196
|
+
...{
|
|
197
|
+
error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.description) == null ? void 0 : _b.message,
|
|
198
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
199
|
+
import_input_textarea.default,
|
|
200
|
+
{
|
|
201
|
+
...{
|
|
202
|
+
onChange,
|
|
203
|
+
value: value || ""
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
label: "Description",
|
|
208
|
+
message: "Shown under the title on the share page."
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
order && toggle("enabled", "Take orders", "Off, the form skips this section. Everything here is kept.", locked),
|
|
217
|
+
order && toggle("prices", "Show prices", "Show each item's price and an estimated total.")
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
222
|
+
import_fieldset.default,
|
|
223
|
+
{
|
|
224
|
+
...{
|
|
225
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
226
|
+
},
|
|
227
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
|
+
import_button.default,
|
|
229
|
+
{
|
|
230
|
+
...{
|
|
231
|
+
loading: formState == null ? void 0 : formState.isSubmitting,
|
|
232
|
+
type: "submit"
|
|
233
|
+
},
|
|
234
|
+
children: "Save"
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
var form_organization_campaign_section_default = FormOrganizationCampaignSection;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Controller, useForm } from "../shared/lib/form.mjs";
|
|
3
|
+
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
4
|
+
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
5
|
+
import Form from "../shared/form.mjs";
|
|
6
|
+
import Fieldset from "../shared/fieldset.mjs";
|
|
7
|
+
import InputGroup from "../input-group.mjs";
|
|
8
|
+
import InputText from "../input-text.mjs";
|
|
9
|
+
import InputTextarea from "../input-textarea.mjs";
|
|
10
|
+
import InputSwitch from "../shared/input-switch.mjs";
|
|
11
|
+
import Button from "../shared/button.mjs";
|
|
12
|
+
import Tooltip from "../shared/tooltip.mjs";
|
|
13
|
+
const FormOrganizationCampaignSection = ({
|
|
14
|
+
disabled,
|
|
15
|
+
onError,
|
|
16
|
+
onSuccess,
|
|
17
|
+
values
|
|
18
|
+
}) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const order = (values == null ? void 0 : values.type) === "order";
|
|
21
|
+
const locked = order && (values == null ? void 0 : values.giveaway) ? "Turn off the giveaway to take orders" : null;
|
|
22
|
+
const { control, formState, handleSubmit } = useForm({
|
|
23
|
+
resolver: resolver(
|
|
24
|
+
yup.object({
|
|
25
|
+
description: yup.string().label("Description").max(300).nullable(),
|
|
26
|
+
enabled: yup.boolean(),
|
|
27
|
+
prices: yup.boolean(),
|
|
28
|
+
title: yup.string().label("Title").required().max(150)
|
|
29
|
+
})
|
|
30
|
+
),
|
|
31
|
+
values: {
|
|
32
|
+
description: (values == null ? void 0 : values.description) || "",
|
|
33
|
+
enabled: (values == null ? void 0 : values.enabled) !== false,
|
|
34
|
+
prices: ((_a = values == null ? void 0 : values.settings) == null ? void 0 : _a.prices) !== false,
|
|
35
|
+
title: (values == null ? void 0 : values.title) || ""
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const onSubmit = async ({
|
|
39
|
+
description,
|
|
40
|
+
enabled,
|
|
41
|
+
prices,
|
|
42
|
+
title
|
|
43
|
+
}) => {
|
|
44
|
+
try {
|
|
45
|
+
const response = await request({
|
|
46
|
+
body: {
|
|
47
|
+
description: description || null,
|
|
48
|
+
...order && {
|
|
49
|
+
...!locked && {
|
|
50
|
+
enabled
|
|
51
|
+
},
|
|
52
|
+
prices
|
|
53
|
+
},
|
|
54
|
+
title
|
|
55
|
+
},
|
|
56
|
+
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/section/" + (values == null ? void 0 : values.id),
|
|
57
|
+
method: "PUT"
|
|
58
|
+
});
|
|
59
|
+
onSuccess(response);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
onError(error);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const toggle = (key, label, message, lock) => /* @__PURE__ */ jsx(
|
|
65
|
+
Controller,
|
|
66
|
+
{
|
|
67
|
+
...{
|
|
68
|
+
control,
|
|
69
|
+
name: key,
|
|
70
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx(
|
|
71
|
+
InputGroup,
|
|
72
|
+
{
|
|
73
|
+
...{
|
|
74
|
+
input: lock ? /* @__PURE__ */ jsx(
|
|
75
|
+
Tooltip,
|
|
76
|
+
{
|
|
77
|
+
...{
|
|
78
|
+
content: lock
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ jsx(
|
|
81
|
+
InputSwitch,
|
|
82
|
+
{
|
|
83
|
+
...{
|
|
84
|
+
disabled: true,
|
|
85
|
+
value: false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
) : /* @__PURE__ */ jsx(
|
|
91
|
+
InputSwitch,
|
|
92
|
+
{
|
|
93
|
+
...{
|
|
94
|
+
onChange,
|
|
95
|
+
value: Boolean(value)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
label,
|
|
100
|
+
message
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
key
|
|
107
|
+
);
|
|
108
|
+
return /* @__PURE__ */ jsxs(
|
|
109
|
+
Form,
|
|
110
|
+
{
|
|
111
|
+
...{
|
|
112
|
+
className: "relative w-full space-y-6",
|
|
113
|
+
onSubmit: handleSubmit(onSubmit)
|
|
114
|
+
},
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsxs(
|
|
117
|
+
Fieldset,
|
|
118
|
+
{
|
|
119
|
+
...{
|
|
120
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
124
|
+
Controller,
|
|
125
|
+
{
|
|
126
|
+
...{
|
|
127
|
+
control,
|
|
128
|
+
name: "title",
|
|
129
|
+
render: ({ field: { value, onChange } }) => {
|
|
130
|
+
var _a2, _b;
|
|
131
|
+
return /* @__PURE__ */ jsx(
|
|
132
|
+
InputGroup,
|
|
133
|
+
{
|
|
134
|
+
...{
|
|
135
|
+
error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.title) == null ? void 0 : _b.message,
|
|
136
|
+
input: /* @__PURE__ */ jsx(
|
|
137
|
+
InputText,
|
|
138
|
+
{
|
|
139
|
+
...{
|
|
140
|
+
onChange,
|
|
141
|
+
value: value || ""
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
label: "Title"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
Controller,
|
|
155
|
+
{
|
|
156
|
+
...{
|
|
157
|
+
control,
|
|
158
|
+
name: "description",
|
|
159
|
+
render: ({ field: { value, onChange } }) => {
|
|
160
|
+
var _a2, _b;
|
|
161
|
+
return /* @__PURE__ */ jsx(
|
|
162
|
+
InputGroup,
|
|
163
|
+
{
|
|
164
|
+
...{
|
|
165
|
+
error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.description) == null ? void 0 : _b.message,
|
|
166
|
+
input: /* @__PURE__ */ jsx(
|
|
167
|
+
InputTextarea,
|
|
168
|
+
{
|
|
169
|
+
...{
|
|
170
|
+
onChange,
|
|
171
|
+
value: value || ""
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
label: "Description",
|
|
176
|
+
message: "Shown under the title on the share page."
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
order && toggle("enabled", "Take orders", "Off, the form skips this section. Everything here is kept.", locked),
|
|
185
|
+
order && toggle("prices", "Show prices", "Show each item's price and an estimated total.")
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ jsx(
|
|
190
|
+
Fieldset,
|
|
191
|
+
{
|
|
192
|
+
...{
|
|
193
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
194
|
+
},
|
|
195
|
+
children: /* @__PURE__ */ jsx(
|
|
196
|
+
Button,
|
|
197
|
+
{
|
|
198
|
+
...{
|
|
199
|
+
loading: formState == null ? void 0 : formState.isSubmitting,
|
|
200
|
+
type: "submit"
|
|
201
|
+
},
|
|
202
|
+
children: "Save"
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
var form_organization_campaign_section_default = FormOrganizationCampaignSection;
|
|
212
|
+
export {
|
|
213
|
+
form_organization_campaign_section_default as default
|
|
214
|
+
};
|